WP Job Manager - Version 1.34.0

Version Description

  • Templates Updated: content-job_listing.php, job-submitted.php.
  • Enhancement: Add support for pre-selecting categories in [jobs] using category slugs in query string (e.g. /jobs?search_category=developer,pm,senior).
  • Change: Job listing now supports author functionality, which will expose the author field in the REST API.
  • Change: Menu position is fixed in WP admin. Plugins such as Resumes and Applications will need to be updated to show in WP admin below WPJM. (@technerdlove)
  • Change: Filter form on [jobs] resets on page refresh and uses query string as expected.
  • Change: No longer required to generate usernames from email for password field. (@manzoorwanijk)
  • Change: Use minified version of remote jQuery UI CSS. (@ovidiul)
  • Change: Google Maps link uses https.
  • Fix: Clear the filled flag when relisting a job listing.
  • Fix: Page titles are properly set during initial set up. (@JuanchoPestana)
  • Fix: Correctly format list of file extensions when an unsupported file type is uploaded.
  • Fix: Latitude and longitude are correctly used in content-job_listing.php template. (@MarieComet)
  • Fix: Delete widget options on plugin uninstall. (@JuanchoPestana)
  • Fix: Remove unused parameter in job-submitted.php template. (@JuanchoPestana)
  • Third Party: Fix issue with saving attachments when using Download Attachments plugin.
  • Third Party: Fix issue with Polylang where translations get overwritten on save of another language.
  • Dev: Adds the ability to completely disable the state saving functionality of [jobs] results.
  • Dev: Allows custom calls to get_job_listings() to just get ids and id=>parent. (@manzoorwanijk)
  • Dev: Switched to short-array syntax across plugin.
  • Dev: Updated jquery-fileupload library to 10.2.0.
  • Dev: Updated select2 library to 4.0.10.
Download this release

Release Info

Developer jakeom
Plugin Icon 128x128 WP Job Manager
Version 1.34.0
Comparing to
See all releases

Code changes from version 1.33.5 to 1.34.0

Files changed (66) hide show
  1. LICENSE.txt +674 -0
  2. assets/js/ajax-filters.min.js +1 -1
  3. assets/js/jquery-fileupload/jquery.fileupload.js +1555 -1479
  4. assets/js/jquery-fileupload/jquery.iframe-transport.js +203 -206
  5. assets/js/select2/select2.full.min.js +2 -1
  6. assets/js/select2/select2.min.css +1 -1
  7. changelog.txt +35 -2
  8. includes/abstracts/abstract-wp-job-manager-email-template.php +4 -4
  9. includes/abstracts/abstract-wp-job-manager-email.php +5 -5
  10. includes/abstracts/abstract-wp-job-manager-form.php +23 -23
  11. includes/admin/class-wp-job-manager-addons.php +3 -3
  12. includes/admin/class-wp-job-manager-admin-notices.php +11 -11
  13. includes/admin/class-wp-job-manager-admin.php +18 -18
  14. includes/admin/class-wp-job-manager-cpt.php +92 -92
  15. includes/admin/class-wp-job-manager-permalink-settings.php +5 -5
  16. includes/admin/class-wp-job-manager-settings.php +118 -135
  17. includes/admin/class-wp-job-manager-setup.php +11 -11
  18. includes/admin/class-wp-job-manager-taxonomy-meta.php +7 -7
  19. includes/admin/class-wp-job-manager-writepanels.php +26 -25
  20. includes/admin/views/html-admin-page-addons.php +5 -5
  21. includes/class-wp-job-manager-ajax.php +35 -35
  22. includes/class-wp-job-manager-api.php +2 -2
  23. includes/class-wp-job-manager-blocks.php +1 -1
  24. includes/class-wp-job-manager-cache-helper.php +14 -14
  25. includes/class-wp-job-manager-category-walker.php +3 -3
  26. includes/class-wp-job-manager-data-cleaner.php +27 -25
  27. includes/class-wp-job-manager-data-exporter.php +15 -15
  28. includes/class-wp-job-manager-email-notifications.php +77 -77
  29. includes/class-wp-job-manager-forms.php +4 -4
  30. includes/class-wp-job-manager-geocode.php +9 -9
  31. includes/class-wp-job-manager-install.php +23 -23
  32. includes/class-wp-job-manager-post-types.php +171 -169
  33. includes/class-wp-job-manager-rest-api.php +1 -1
  34. includes/class-wp-job-manager-shortcodes.php +80 -52
  35. includes/class-wp-job-manager-usage-tracking-data.php +53 -53
  36. includes/class-wp-job-manager-usage-tracking.php +10 -10
  37. includes/class-wp-job-manager-widget.php +7 -7
  38. includes/class-wp-job-manager.php +51 -51
  39. includes/emails/class-wp-job-manager-email-employer-expiring-job.php +3 -3
  40. includes/forms/class-wp-job-manager-form-edit-job.php +6 -6
  41. includes/forms/class-wp-job-manager-form-submit-job.php +96 -91
  42. includes/helper/class-wp-job-manager-helper-api.php +10 -10
  43. includes/helper/class-wp-job-manager-helper-options.php +6 -6
  44. includes/helper/class-wp-job-manager-helper.php +32 -32
  45. includes/helper/views/html-licences.php +3 -3
  46. includes/widgets/class-wp-job-manager-widget-featured-jobs.php +19 -19
  47. includes/widgets/class-wp-job-manager-widget-recent-jobs.php +15 -15
  48. languages/wp-job-manager.pot +249 -239
  49. readme.txt +39 -3
  50. templates/account-signin.php +1 -1
  51. templates/content-job_listing.php +2 -2
  52. templates/emails/admin-expiring-job.php +1 -1
  53. templates/emails/email-styles.php +1 -1
  54. templates/form-fields/file-field.php +3 -3
  55. templates/form-fields/term-checklist-field.php +3 -3
  56. templates/form-fields/term-multiselect-field.php +2 -2
  57. templates/form-fields/term-select-field.php +2 -2
  58. templates/form-fields/wp-editor-field.php +4 -4
  59. templates/job-dashboard.php +11 -11
  60. templates/job-filters.php +3 -3
  61. templates/job-submit.php +2 -2
  62. templates/job-submitted.php +1 -2
  63. templates/pagination.php +2 -2
  64. wp-job-manager-functions.php +98 -94
  65. wp-job-manager-template.php +42 -42
  66. wp-job-manager.php +2 -2
LICENSE.txt ADDED
@@ -0,0 +1,674 @@
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
+ GNU GENERAL PUBLIC LICENSE
2
+ Version 3, 29 June 2007
3
+
4
+ Copyright (C) 2007 Free Software Foundation, Inc. <http://fsf.org/>
5
+ Everyone is permitted to copy and distribute verbatim copies
6
+ of this license document, but changing it is not allowed.
7
+
8
+ Preamble
9
+
10
+ The GNU General Public License is a free, copyleft license for
11
+ software and other kinds of works.
12
+
13
+ The licenses for most software and other practical works are designed
14
+ to take away your freedom to share and change the works. By contrast,
15
+ the GNU General Public License is intended to guarantee your freedom to
16
+ share and change all versions of a program--to make sure it remains free
17
+ software for all its users. We, the Free Software Foundation, use the
18
+ GNU General Public License for most of our software; it applies also to
19
+ any other work released this way by its authors. You can apply it to
20
+ your programs, too.
21
+
22
+ When we speak of free software, we are referring to freedom, not
23
+ price. Our General Public Licenses are designed to make sure that you
24
+ have the freedom to distribute copies of free software (and charge for
25
+ them if you wish), that you receive source code or can get it if you
26
+ want it, that you can change the software or use pieces of it in new
27
+ free programs, and that you know you can do these things.
28
+
29
+ To protect your rights, we need to prevent others from denying you
30
+ these rights or asking you to surrender the rights. Therefore, you have
31
+ certain responsibilities if you distribute copies of the software, or if
32
+ you modify it: responsibilities to respect the freedom of others.
33
+
34
+ For example, if you distribute copies of such a program, whether
35
+ gratis or for a fee, you must pass on to the recipients the same
36
+ freedoms that you received. You must make sure that they, too, receive
37
+ or can get the source code. And you must show them these terms so they
38
+ know their rights.
39
+
40
+ Developers that use the GNU GPL protect your rights with two steps:
41
+ (1) assert copyright on the software, and (2) offer you this License
42
+ giving you legal permission to copy, distribute and/or modify it.
43
+
44
+ For the developers' and authors' protection, the GPL clearly explains
45
+ that there is no warranty for this free software. For both users' and
46
+ authors' sake, the GPL requires that modified versions be marked as
47
+ changed, so that their problems will not be attributed erroneously to
48
+ authors of previous versions.
49
+
50
+ Some devices are designed to deny users access to install or run
51
+ modified versions of the software inside them, although the manufacturer
52
+ can do so. This is fundamentally incompatible with the aim of
53
+ protecting users' freedom to change the software. The systematic
54
+ pattern of such abuse occurs in the area of products for individuals to
55
+ use, which is precisely where it is most unacceptable. Therefore, we
56
+ have designed this version of the GPL to prohibit the practice for those
57
+ products. If such problems arise substantially in other domains, we
58
+ stand ready to extend this provision to those domains in future versions
59
+ of the GPL, as needed to protect the freedom of users.
60
+
61
+ Finally, every program is threatened constantly by software patents.
62
+ States should not allow patents to restrict development and use of
63
+ software on general-purpose computers, but in those that do, we wish to
64
+ avoid the special danger that patents applied to a free program could
65
+ make it effectively proprietary. To prevent this, the GPL assures that
66
+ patents cannot be used to render the program non-free.
67
+
68
+ The precise terms and conditions for copying, distribution and
69
+ modification follow.
70
+
71
+ TERMS AND CONDITIONS
72
+
73
+ 0. Definitions.
74
+
75
+ "This License" refers to version 3 of the GNU General Public License.
76
+
77
+ "Copyright" also means copyright-like laws that apply to other kinds of
78
+ works, such as semiconductor masks.
79
+
80
+ "The Program" refers to any copyrightable work licensed under this
81
+ License. Each licensee is addressed as "you". "Licensees" and
82
+ "recipients" may be individuals or organizations.
83
+
84
+ To "modify" a work means to copy from or adapt all or part of the work
85
+ in a fashion requiring copyright permission, other than the making of an
86
+ exact copy. The resulting work is called a "modified version" of the
87
+ earlier work or a work "based on" the earlier work.
88
+
89
+ A "covered work" means either the unmodified Program or a work based
90
+ on the Program.
91
+
92
+ To "propagate" a work means to do anything with it that, without
93
+ permission, would make you directly or secondarily liable for
94
+ infringement under applicable copyright law, except executing it on a
95
+ computer or modifying a private copy. Propagation includes copying,
96
+ distribution (with or without modification), making available to the
97
+ public, and in some countries other activities as well.
98
+
99
+ To "convey" a work means any kind of propagation that enables other
100
+ parties to make or receive copies. Mere interaction with a user through
101
+ a computer network, with no transfer of a copy, is not conveying.
102
+
103
+ An interactive user interface displays "Appropriate Legal Notices"
104
+ to the extent that it includes a convenient and prominently visible
105
+ feature that (1) displays an appropriate copyright notice, and (2)
106
+ tells the user that there is no warranty for the work (except to the
107
+ extent that warranties are provided), that licensees may convey the
108
+ work under this License, and how to view a copy of this License. If
109
+ the interface presents a list of user commands or options, such as a
110
+ menu, a prominent item in the list meets this criterion.
111
+
112
+ 1. Source Code.
113
+
114
+ The "source code" for a work means the preferred form of the work
115
+ for making modifications to it. "Object code" means any non-source
116
+ form of a work.
117
+
118
+ A "Standard Interface" means an interface that either is an official
119
+ standard defined by a recognized standards body, or, in the case of
120
+ interfaces specified for a particular programming language, one that
121
+ is widely used among developers working in that language.
122
+
123
+ The "System Libraries" of an executable work include anything, other
124
+ than the work as a whole, that (a) is included in the normal form of
125
+ packaging a Major Component, but which is not part of that Major
126
+ Component, and (b) serves only to enable use of the work with that
127
+ Major Component, or to implement a Standard Interface for which an
128
+ implementation is available to the public in source code form. A
129
+ "Major Component", in this context, means a major essential component
130
+ (kernel, window system, and so on) of the specific operating system
131
+ (if any) on which the executable work runs, or a compiler used to
132
+ produce the work, or an object code interpreter used to run it.
133
+
134
+ The "Corresponding Source" for a work in object code form means all
135
+ the source code needed to generate, install, and (for an executable
136
+ work) run the object code and to modify the work, including scripts to
137
+ control those activities. However, it does not include the work's
138
+ System Libraries, or general-purpose tools or generally available free
139
+ programs which are used unmodified in performing those activities but
140
+ which are not part of the work. For example, Corresponding Source
141
+ includes interface definition files associated with source files for
142
+ the work, and the source code for shared libraries and dynamically
143
+ linked subprograms that the work is specifically designed to require,
144
+ such as by intimate data communication or control flow between those
145
+ subprograms and other parts of the work.
146
+
147
+ The Corresponding Source need not include anything that users
148
+ can regenerate automatically from other parts of the Corresponding
149
+ Source.
150
+
151
+ The Corresponding Source for a work in source code form is that
152
+ same work.
153
+
154
+ 2. Basic Permissions.
155
+
156
+ All rights granted under this License are granted for the term of
157
+ copyright on the Program, and are irrevocable provided the stated
158
+ conditions are met. This License explicitly affirms your unlimited
159
+ permission to run the unmodified Program. The output from running a
160
+ covered work is covered by this License only if the output, given its
161
+ content, constitutes a covered work. This License acknowledges your
162
+ rights of fair use or other equivalent, as provided by copyright law.
163
+
164
+ You may make, run and propagate covered works that you do not
165
+ convey, without conditions so long as your license otherwise remains
166
+ in force. You may convey covered works to others for the sole purpose
167
+ of having them make modifications exclusively for you, or provide you
168
+ with facilities for running those works, provided that you comply with
169
+ the terms of this License in conveying all material for which you do
170
+ not control copyright. Those thus making or running the covered works
171
+ for you must do so exclusively on your behalf, under your direction
172
+ and control, on terms that prohibit them from making any copies of
173
+ your copyrighted material outside their relationship with you.
174
+
175
+ Conveying under any other circumstances is permitted solely under
176
+ the conditions stated below. Sublicensing is not allowed; section 10
177
+ makes it unnecessary.
178
+
179
+ 3. Protecting Users' Legal Rights From Anti-Circumvention Law.
180
+
181
+ No covered work shall be deemed part of an effective technological
182
+ measure under any applicable law fulfilling obligations under article
183
+ 11 of the WIPO copyright treaty adopted on 20 December 1996, or
184
+ similar laws prohibiting or restricting circumvention of such
185
+ measures.
186
+
187
+ When you convey a covered work, you waive any legal power to forbid
188
+ circumvention of technological measures to the extent such circumvention
189
+ is effected by exercising rights under this License with respect to
190
+ the covered work, and you disclaim any intention to limit operation or
191
+ modification of the work as a means of enforcing, against the work's
192
+ users, your or third parties' legal rights to forbid circumvention of
193
+ technological measures.
194
+
195
+ 4. Conveying Verbatim Copies.
196
+
197
+ You may convey verbatim copies of the Program's source code as you
198
+ receive it, in any medium, provided that you conspicuously and
199
+ appropriately publish on each copy an appropriate copyright notice;
200
+ keep intact all notices stating that this License and any
201
+ non-permissive terms added in accord with section 7 apply to the code;
202
+ keep intact all notices of the absence of any warranty; and give all
203
+ recipients a copy of this License along with the Program.
204
+
205
+ You may charge any price or no price for each copy that you convey,
206
+ and you may offer support or warranty protection for a fee.
207
+
208
+ 5. Conveying Modified Source Versions.
209
+
210
+ You may convey a work based on the Program, or the modifications to
211
+ produce it from the Program, in the form of source code under the
212
+ terms of section 4, provided that you also meet all of these conditions:
213
+
214
+ a) The work must carry prominent notices stating that you modified
215
+ it, and giving a relevant date.
216
+
217
+ b) The work must carry prominent notices stating that it is
218
+ released under this License and any conditions added under section
219
+ 7. This requirement modifies the requirement in section 4 to
220
+ "keep intact all notices".
221
+
222
+ c) You must license the entire work, as a whole, under this
223
+ License to anyone who comes into possession of a copy. This
224
+ License will therefore apply, along with any applicable section 7
225
+ additional terms, to the whole of the work, and all its parts,
226
+ regardless of how they are packaged. This License gives no
227
+ permission to license the work in any other way, but it does not
228
+ invalidate such permission if you have separately received it.
229
+
230
+ d) If the work has interactive user interfaces, each must display
231
+ Appropriate Legal Notices; however, if the Program has interactive
232
+ interfaces that do not display Appropriate Legal Notices, your
233
+ work need not make them do so.
234
+
235
+ A compilation of a covered work with other separate and independent
236
+ works, which are not by their nature extensions of the covered work,
237
+ and which are not combined with it such as to form a larger program,
238
+ in or on a volume of a storage or distribution medium, is called an
239
+ "aggregate" if the compilation and its resulting copyright are not
240
+ used to limit the access or legal rights of the compilation's users
241
+ beyond what the individual works permit. Inclusion of a covered work
242
+ in an aggregate does not cause this License to apply to the other
243
+ parts of the aggregate.
244
+
245
+ 6. Conveying Non-Source Forms.
246
+
247
+ You may convey a covered work in object code form under the terms
248
+ of sections 4 and 5, provided that you also convey the
249
+ machine-readable Corresponding Source under the terms of this License,
250
+ in one of these ways:
251
+
252
+ a) Convey the object code in, or embodied in, a physical product
253
+ (including a physical distribution medium), accompanied by the
254
+ Corresponding Source fixed on a durable physical medium
255
+ customarily used for software interchange.
256
+
257
+ b) Convey the object code in, or embodied in, a physical product
258
+ (including a physical distribution medium), accompanied by a
259
+ written offer, valid for at least three years and valid for as
260
+ long as you offer spare parts or customer support for that product
261
+ model, to give anyone who possesses the object code either (1) a
262
+ copy of the Corresponding Source for all the software in the
263
+ product that is covered by this License, on a durable physical
264
+ medium customarily used for software interchange, for a price no
265
+ more than your reasonable cost of physically performing this
266
+ conveying of source, or (2) access to copy the
267
+ Corresponding Source from a network server at no charge.
268
+
269
+ c) Convey individual copies of the object code with a copy of the
270
+ written offer to provide the Corresponding Source. This
271
+ alternative is allowed only occasionally and noncommercially, and
272
+ only if you received the object code with such an offer, in accord
273
+ with subsection 6b.
274
+
275
+ d) Convey the object code by offering access from a designated
276
+ place (gratis or for a charge), and offer equivalent access to the
277
+ Corresponding Source in the same way through the same place at no
278
+ further charge. You need not require recipients to copy the
279
+ Corresponding Source along with the object code. If the place to
280
+ copy the object code is a network server, the Corresponding Source
281
+ may be on a different server (operated by you or a third party)
282
+ that supports equivalent copying facilities, provided you maintain
283
+ clear directions next to the object code saying where to find the
284
+ Corresponding Source. Regardless of what server hosts the
285
+ Corresponding Source, you remain obligated to ensure that it is
286
+ available for as long as needed to satisfy these requirements.
287
+
288
+ e) Convey the object code using peer-to-peer transmission, provided
289
+ you inform other peers where the object code and Corresponding
290
+ Source of the work are being offered to the general public at no
291
+ charge under subsection 6d.
292
+
293
+ A separable portion of the object code, whose source code is excluded
294
+ from the Corresponding Source as a System Library, need not be
295
+ included in conveying the object code work.
296
+
297
+ A "User Product" is either (1) a "consumer product", which means any
298
+ tangible personal property which is normally used for personal, family,
299
+ or household purposes, or (2) anything designed or sold for incorporation
300
+ into a dwelling. In determining whether a product is a consumer product,
301
+ doubtful cases shall be resolved in favor of coverage. For a particular
302
+ product received by a particular user, "normally used" refers to a
303
+ typical or common use of that class of product, regardless of the status
304
+ of the particular user or of the way in which the particular user
305
+ actually uses, or expects or is expected to use, the product. A product
306
+ is a consumer product regardless of whether the product has substantial
307
+ commercial, industrial or non-consumer uses, unless such uses represent
308
+ the only significant mode of use of the product.
309
+
310
+ "Installation Information" for a User Product means any methods,
311
+ procedures, authorization keys, or other information required to install
312
+ and execute modified versions of a covered work in that User Product from
313
+ a modified version of its Corresponding Source. The information must
314
+ suffice to ensure that the continued functioning of the modified object
315
+ code is in no case prevented or interfered with solely because
316
+ modification has been made.
317
+
318
+ If you convey an object code work under this section in, or with, or
319
+ specifically for use in, a User Product, and the conveying occurs as
320
+ part of a transaction in which the right of possession and use of the
321
+ User Product is transferred to the recipient in perpetuity or for a
322
+ fixed term (regardless of how the transaction is characterized), the
323
+ Corresponding Source conveyed under this section must be accompanied
324
+ by the Installation Information. But this requirement does not apply
325
+ if neither you nor any third party retains the ability to install
326
+ modified object code on the User Product (for example, the work has
327
+ been installed in ROM).
328
+
329
+ The requirement to provide Installation Information does not include a
330
+ requirement to continue to provide support service, warranty, or updates
331
+ for a work that has been modified or installed by the recipient, or for
332
+ the User Product in which it has been modified or installed. Access to a
333
+ network may be denied when the modification itself materially and
334
+ adversely affects the operation of the network or violates the rules and
335
+ protocols for communication across the network.
336
+
337
+ Corresponding Source conveyed, and Installation Information provided,
338
+ in accord with this section must be in a format that is publicly
339
+ documented (and with an implementation available to the public in
340
+ source code form), and must require no special password or key for
341
+ unpacking, reading or copying.
342
+
343
+ 7. Additional Terms.
344
+
345
+ "Additional permissions" are terms that supplement the terms of this
346
+ License by making exceptions from one or more of its conditions.
347
+ Additional permissions that are applicable to the entire Program shall
348
+ be treated as though they were included in this License, to the extent
349
+ that they are valid under applicable law. If additional permissions
350
+ apply only to part of the Program, that part may be used separately
351
+ under those permissions, but the entire Program remains governed by
352
+ this License without regard to the additional permissions.
353
+
354
+ When you convey a copy of a covered work, you may at your option
355
+ remove any additional permissions from that copy, or from any part of
356
+ it. (Additional permissions may be written to require their own
357
+ removal in certain cases when you modify the work.) You may place
358
+ additional permissions on material, added by you to a covered work,
359
+ for which you have or can give appropriate copyright permission.
360
+
361
+ Notwithstanding any other provision of this License, for material you
362
+ add to a covered work, you may (if authorized by the copyright holders of
363
+ that material) supplement the terms of this License with terms:
364
+
365
+ a) Disclaiming warranty or limiting liability differently from the
366
+ terms of sections 15 and 16 of this License; or
367
+
368
+ b) Requiring preservation of specified reasonable legal notices or
369
+ author attributions in that material or in the Appropriate Legal
370
+ Notices displayed by works containing it; or
371
+
372
+ c) Prohibiting misrepresentation of the origin of that material, or
373
+ requiring that modified versions of such material be marked in
374
+ reasonable ways as different from the original version; or
375
+
376
+ d) Limiting the use for publicity purposes of names of licensors or
377
+ authors of the material; or
378
+
379
+ e) Declining to grant rights under trademark law for use of some
380
+ trade names, trademarks, or service marks; or
381
+
382
+ f) Requiring indemnification of licensors and authors of that
383
+ material by anyone who conveys the material (or modified versions of
384
+ it) with contractual assumptions of liability to the recipient, for
385
+ any liability that these contractual assumptions directly impose on
386
+ those licensors and authors.
387
+
388
+ All other non-permissive additional terms are considered "further
389
+ restrictions" within the meaning of section 10. If the Program as you
390
+ received it, or any part of it, contains a notice stating that it is
391
+ governed by this License along with a term that is a further
392
+ restriction, you may remove that term. If a license document contains
393
+ a further restriction but permits relicensing or conveying under this
394
+ License, you may add to a covered work material governed by the terms
395
+ of that license document, provided that the further restriction does
396
+ not survive such relicensing or conveying.
397
+
398
+ If you add terms to a covered work in accord with this section, you
399
+ must place, in the relevant source files, a statement of the
400
+ additional terms that apply to those files, or a notice indicating
401
+ where to find the applicable terms.
402
+
403
+ Additional terms, permissive or non-permissive, may be stated in the
404
+ form of a separately written license, or stated as exceptions;
405
+ the above requirements apply either way.
406
+
407
+ 8. Termination.
408
+
409
+ You may not propagate or modify a covered work except as expressly
410
+ provided under this License. Any attempt otherwise to propagate or
411
+ modify it is void, and will automatically terminate your rights under
412
+ this License (including any patent licenses granted under the third
413
+ paragraph of section 11).
414
+
415
+ However, if you cease all violation of this License, then your
416
+ license from a particular copyright holder is reinstated (a)
417
+ provisionally, unless and until the copyright holder explicitly and
418
+ finally terminates your license, and (b) permanently, if the copyright
419
+ holder fails to notify you of the violation by some reasonable means
420
+ prior to 60 days after the cessation.
421
+
422
+ Moreover, your license from a particular copyright holder is
423
+ reinstated permanently if the copyright holder notifies you of the
424
+ violation by some reasonable means, this is the first time you have
425
+ received notice of violation of this License (for any work) from that
426
+ copyright holder, and you cure the violation prior to 30 days after
427
+ your receipt of the notice.
428
+
429
+ Termination of your rights under this section does not terminate the
430
+ licenses of parties who have received copies or rights from you under
431
+ this License. If your rights have been terminated and not permanently
432
+ reinstated, you do not qualify to receive new licenses for the same
433
+ material under section 10.
434
+
435
+ 9. Acceptance Not Required for Having Copies.
436
+
437
+ You are not required to accept this License in order to receive or
438
+ run a copy of the Program. Ancillary propagation of a covered work
439
+ occurring solely as a consequence of using peer-to-peer transmission
440
+ to receive a copy likewise does not require acceptance. However,
441
+ nothing other than this License grants you permission to propagate or
442
+ modify any covered work. These actions infringe copyright if you do
443
+ not accept this License. Therefore, by modifying or propagating a
444
+ covered work, you indicate your acceptance of this License to do so.
445
+
446
+ 10. Automatic Licensing of Downstream Recipients.
447
+
448
+ Each time you convey a covered work, the recipient automatically
449
+ receives a license from the original licensors, to run, modify and
450
+ propagate that work, subject to this License. You are not responsible
451
+ for enforcing compliance by third parties with this License.
452
+
453
+ An "entity transaction" is a transaction transferring control of an
454
+ organization, or substantially all assets of one, or subdividing an
455
+ organization, or merging organizations. If propagation of a covered
456
+ work results from an entity transaction, each party to that
457
+ transaction who receives a copy of the work also receives whatever
458
+ licenses to the work the party's predecessor in interest had or could
459
+ give under the previous paragraph, plus a right to possession of the
460
+ Corresponding Source of the work from the predecessor in interest, if
461
+ the predecessor has it or can get it with reasonable efforts.
462
+
463
+ You may not impose any further restrictions on the exercise of the
464
+ rights granted or affirmed under this License. For example, you may
465
+ not impose a license fee, royalty, or other charge for exercise of
466
+ rights granted under this License, and you may not initiate litigation
467
+ (including a cross-claim or counterclaim in a lawsuit) alleging that
468
+ any patent claim is infringed by making, using, selling, offering for
469
+ sale, or importing the Program or any portion of it.
470
+
471
+ 11. Patents.
472
+
473
+ A "contributor" is a copyright holder who authorizes use under this
474
+ License of the Program or a work on which the Program is based. The
475
+ work thus licensed is called the contributor's "contributor version".
476
+
477
+ A contributor's "essential patent claims" are all patent claims
478
+ owned or controlled by the contributor, whether already acquired or
479
+ hereafter acquired, that would be infringed by some manner, permitted
480
+ by this License, of making, using, or selling its contributor version,
481
+ but do not include claims that would be infringed only as a
482
+ consequence of further modification of the contributor version. For
483
+ purposes of this definition, "control" includes the right to grant
484
+ patent sublicenses in a manner consistent with the requirements of
485
+ this License.
486
+
487
+ Each contributor grants you a non-exclusive, worldwide, royalty-free
488
+ patent license under the contributor's essential patent claims, to
489
+ make, use, sell, offer for sale, import and otherwise run, modify and
490
+ propagate the contents of its contributor version.
491
+
492
+ In the following three paragraphs, a "patent license" is any express
493
+ agreement or commitment, however denominated, not to enforce a patent
494
+ (such as an express permission to practice a patent or covenant not to
495
+ sue for patent infringement). To "grant" such a patent license to a
496
+ party means to make such an agreement or commitment not to enforce a
497
+ patent against the party.
498
+
499
+ If you convey a covered work, knowingly relying on a patent license,
500
+ and the Corresponding Source of the work is not available for anyone
501
+ to copy, free of charge and under the terms of this License, through a
502
+ publicly available network server or other readily accessible means,
503
+ then you must either (1) cause the Corresponding Source to be so
504
+ available, or (2) arrange to deprive yourself of the benefit of the
505
+ patent license for this particular work, or (3) arrange, in a manner
506
+ consistent with the requirements of this License, to extend the patent
507
+ license to downstream recipients. "Knowingly relying" means you have
508
+ actual knowledge that, but for the patent license, your conveying the
509
+ covered work in a country, or your recipient's use of the covered work
510
+ in a country, would infringe one or more identifiable patents in that
511
+ country that you have reason to believe are valid.
512
+
513
+ If, pursuant to or in connection with a single transaction or
514
+ arrangement, you convey, or propagate by procuring conveyance of, a
515
+ covered work, and grant a patent license to some of the parties
516
+ receiving the covered work authorizing them to use, propagate, modify
517
+ or convey a specific copy of the covered work, then the patent license
518
+ you grant is automatically extended to all recipients of the covered
519
+ work and works based on it.
520
+
521
+ A patent license is "discriminatory" if it does not include within
522
+ the scope of its coverage, prohibits the exercise of, or is
523
+ conditioned on the non-exercise of one or more of the rights that are
524
+ specifically granted under this License. You may not convey a covered
525
+ work if you are a party to an arrangement with a third party that is
526
+ in the business of distributing software, under which you make payment
527
+ to the third party based on the extent of your activity of conveying
528
+ the work, and under which the third party grants, to any of the
529
+ parties who would receive the covered work from you, a discriminatory
530
+ patent license (a) in connection with copies of the covered work
531
+ conveyed by you (or copies made from those copies), or (b) primarily
532
+ for and in connection with specific products or compilations that
533
+ contain the covered work, unless you entered into that arrangement,
534
+ or that patent license was granted, prior to 28 March 2007.
535
+
536
+ Nothing in this License shall be construed as excluding or limiting
537
+ any implied license or other defenses to infringement that may
538
+ otherwise be available to you under applicable patent law.
539
+
540
+ 12. No Surrender of Others' Freedom.
541
+
542
+ If conditions are imposed on you (whether by court order, agreement or
543
+ otherwise) that contradict the conditions of this License, they do not
544
+ excuse you from the conditions of this License. If you cannot convey a
545
+ covered work so as to satisfy simultaneously your obligations under this
546
+ License and any other pertinent obligations, then as a consequence you may
547
+ not convey it at all. For example, if you agree to terms that obligate you
548
+ to collect a royalty for further conveying from those to whom you convey
549
+ the Program, the only way you could satisfy both those terms and this
550
+ License would be to refrain entirely from conveying the Program.
551
+
552
+ 13. Use with the GNU Affero General Public License.
553
+
554
+ Notwithstanding any other provision of this License, you have
555
+ permission to link or combine any covered work with a work licensed
556
+ under version 3 of the GNU Affero General Public License into a single
557
+ combined work, and to convey the resulting work. The terms of this
558
+ License will continue to apply to the part which is the covered work,
559
+ but the special requirements of the GNU Affero General Public License,
560
+ section 13, concerning interaction through a network will apply to the
561
+ combination as such.
562
+
563
+ 14. Revised Versions of this License.
564
+
565
+ The Free Software Foundation may publish revised and/or new versions of
566
+ the GNU General Public License from time to time. Such new versions will
567
+ be similar in spirit to the present version, but may differ in detail to
568
+ address new problems or concerns.
569
+
570
+ Each version is given a distinguishing version number. If the
571
+ Program specifies that a certain numbered version of the GNU General
572
+ Public License "or any later version" applies to it, you have the
573
+ option of following the terms and conditions either of that numbered
574
+ version or of any later version published by the Free Software
575
+ Foundation. If the Program does not specify a version number of the
576
+ GNU General Public License, you may choose any version ever published
577
+ by the Free Software Foundation.
578
+
579
+ If the Program specifies that a proxy can decide which future
580
+ versions of the GNU General Public License can be used, that proxy's
581
+ public statement of acceptance of a version permanently authorizes you
582
+ to choose that version for the Program.
583
+
584
+ Later license versions may give you additional or different
585
+ permissions. However, no additional obligations are imposed on any
586
+ author or copyright holder as a result of your choosing to follow a
587
+ later version.
588
+
589
+ 15. Disclaimer of Warranty.
590
+
591
+ THERE IS NO WARRANTY FOR THE PROGRAM, TO THE EXTENT PERMITTED BY
592
+ APPLICABLE LAW. EXCEPT WHEN OTHERWISE STATED IN WRITING THE COPYRIGHT
593
+ HOLDERS AND/OR OTHER PARTIES PROVIDE THE PROGRAM "AS IS" WITHOUT WARRANTY
594
+ OF ANY KIND, EITHER EXPRESSED OR IMPLIED, INCLUDING, BUT NOT LIMITED TO,
595
+ THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR
596
+ PURPOSE. THE ENTIRE RISK AS TO THE QUALITY AND PERFORMANCE OF THE PROGRAM
597
+ IS WITH YOU. SHOULD THE PROGRAM PROVE DEFECTIVE, YOU ASSUME THE COST OF
598
+ ALL NECESSARY SERVICING, REPAIR OR CORRECTION.
599
+
600
+ 16. Limitation of Liability.
601
+
602
+ IN NO EVENT UNLESS REQUIRED BY APPLICABLE LAW OR AGREED TO IN WRITING
603
+ WILL ANY COPYRIGHT HOLDER, OR ANY OTHER PARTY WHO MODIFIES AND/OR CONVEYS
604
+ THE PROGRAM AS PERMITTED ABOVE, BE LIABLE TO YOU FOR DAMAGES, INCLUDING ANY
605
+ GENERAL, SPECIAL, INCIDENTAL OR CONSEQUENTIAL DAMAGES ARISING OUT OF THE
606
+ USE OR INABILITY TO USE THE PROGRAM (INCLUDING BUT NOT LIMITED TO LOSS OF
607
+ DATA OR DATA BEING RENDERED INACCURATE OR LOSSES SUSTAINED BY YOU OR THIRD
608
+ PARTIES OR A FAILURE OF THE PROGRAM TO OPERATE WITH ANY OTHER PROGRAMS),
609
+ EVEN IF SUCH HOLDER OR OTHER PARTY HAS BEEN ADVISED OF THE POSSIBILITY OF
610
+ SUCH DAMAGES.
611
+
612
+ 17. Interpretation of Sections 15 and 16.
613
+
614
+ If the disclaimer of warranty and limitation of liability provided
615
+ above cannot be given local legal effect according to their terms,
616
+ reviewing courts shall apply local law that most closely approximates
617
+ an absolute waiver of all civil liability in connection with the
618
+ Program, unless a warranty or assumption of liability accompanies a
619
+ copy of the Program in return for a fee.
620
+
621
+ END OF TERMS AND CONDITIONS
622
+
623
+ How to Apply These Terms to Your New Programs
624
+
625
+ If you develop a new program, and you want it to be of the greatest
626
+ possible use to the public, the best way to achieve this is to make it
627
+ free software which everyone can redistribute and change under these terms.
628
+
629
+ To do so, attach the following notices to the program. It is safest
630
+ to attach them to the start of each source file to most effectively
631
+ state the exclusion of warranty; and each file should have at least
632
+ the "copyright" line and a pointer to where the full notice is found.
633
+
634
+ <one line to give the program's name and a brief idea of what it does.>
635
+ Copyright (C) <year> <name of author>
636
+
637
+ This program is free software: you can redistribute it and/or modify
638
+ it under the terms of the GNU General Public License as published by
639
+ the Free Software Foundation, either version 3 of the License, or
640
+ (at your option) any later version.
641
+
642
+ This program is distributed in the hope that it will be useful,
643
+ but WITHOUT ANY WARRANTY; without even the implied warranty of
644
+ MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
645
+ GNU General Public License for more details.
646
+
647
+ You should have received a copy of the GNU General Public License
648
+ along with this program. If not, see <http://www.gnu.org/licenses/>.
649
+
650
+ Also add information on how to contact you by electronic and paper mail.
651
+
652
+ If the program does terminal interaction, make it output a short
653
+ notice like this when it starts in an interactive mode:
654
+
655
+ <program> Copyright (C) <year> <name of author>
656
+ This program comes with ABSOLUTELY NO WARRANTY; for details type `show w'.
657
+ This is free software, and you are welcome to redistribute it
658
+ under certain conditions; type `show c' for details.
659
+
660
+ The hypothetical commands `show w' and `show c' should show the appropriate
661
+ parts of the General Public License. Of course, your program's commands
662
+ might be different; for a GUI interface, you would use an "about box".
663
+
664
+ You should also get your employer (if you work as a programmer) or school,
665
+ if any, to sign a "copyright disclaimer" for the program, if necessary.
666
+ For more information on this, and how to apply and follow the GNU GPL, see
667
+ <http://www.gnu.org/licenses/>.
668
+
669
+ The GNU General Public License does not permit incorporating your program
670
+ into proprietary programs. If your program is a subroutine library, you
671
+ may consider it more useful to permit linking proprietary applications with
672
+ the library. If this is what you want to do, use the GNU Lesser General
673
+ Public License instead of this License. But first, please read
674
+ <http://www.gnu.org/philosophy/why-not-lgpl.html>.
assets/js/ajax-filters.min.js CHANGED
@@ -1 +1 @@
1
- jQuery(document).ready(function(e){function t(){return window.sessionStorage&&"function"==typeof window.sessionStorage.setItem}function i(t){var i=e("div.job_listings").index(t),n=t.data("post_id");return void 0!==n&&n||(n=window.location.href.replace(location.hash,"")),c+n+"_"+i}function n(e,n){if(!t())return!1;"object"!=typeof n&&(n={});var a=e.find(".job_filters");n.form=a.serialize();var o=i(e);try{return window.sessionStorage.setItem(o,JSON.stringify(n))}catch(e){}return!1}function a(e){if(!t())return!1;var n=i(e);try{var a=window.sessionStorage.getItem(n);if(a)return JSON.parse(a)}catch(e){}return!1}function o(e,i){if(!t()||!e)return!1;var o=a(e);return!!o&&(o.persist_results=i,n(e,o))}function r(e,i){if(!t())return!1;var o=a(e);o||(o={persist_results:!1});var r=e.find(".job_listings");return i.html=r.html(),o.results=i,n(e,o)}function s(e){if(!t())return!1;var n=i(e);try{window.sessionStorage.removeItem(n)}catch(e){return!1}return!0}function l(e){if(!t())return!1;var i=a(e);return i||(i={}),i.results=null,n(e,i)}function d(t,i,n){var a=t.find(".job_listings"),o=t.find(".showing_jobs");if("boolean"!=typeof n&&(n=!1),"string"==typeof i.showing&&i.showing){var r=jQuery("<span>").html(i.showing);o.show().html("").html(i.showing_links).prepend(r)}else o.hide();return i.showing_all?o.addClass("wp-job-manager-showing-all"):o.removeClass("wp-job-manager-showing-all"),i.html&&(n?a.append(i.html):a.html(i.html)),!0===t.data("show_pagination")?(t.find(".job-manager-pagination").remove(),i.pagination&&t.append(i.pagination)):(!i.found_jobs||i.max_num_pages<=i.data.page?e(".load_more_jobs:not(.load_previous)",t).hide():e(".load_more_jobs",t).show(),e(".load_more_jobs",t).removeClass("loading").data("page",i.data.page),e("li.job_listing",a).css("visibility","visible")),!0}var c="job_listing_",g=[];if(e("div.job_listings").on("click","li.job_listing a",function(){o(e(this).closest("div.job_listings"),!0)}).on("click",".job-manager-pagination a",function(){var t=e(this).closest("div.job_listings"),i=e(this).data("page");return t.triggerHandler("update_results",[i,!1]),e("body, html").animate({scrollTop:t.offset().top},600),!1}).on("update_results",function(t,i,n){var a,o,l,c="",u=e(this),_=u.find(".job_filters"),p=u.find(".job_listings"),f=u.data("per_page"),h=u.data("orderby"),b=u.data("order"),m=u.data("featured"),j=u.data("filled"),v=u.data("job_types"),w=u.data("post_status"),y=e("div.job_listings").index(this);if(!(y<0)){if(s(u),g[y]&&g[y].abort(),n&&1!==i||(e("li.job_listing, li.no_job_listings_found",p).css("visibility","hidden"),p.addClass("loading")),u.find(".load_more_jobs").data("page",i),!0===u.data("show_filters")){var k=[];e(':input[name="filter_job_type[]"]:checked, :input[name="filter_job_type[]"][type="hidden"], :input[name="filter_job_type"]',_).each(function(){k.push(e(this).val())}),a=_.find(':input[name^="search_categories"]').map(function(){return e(this).val()}).get(),o="",l="";var S=_.find(':input[name="search_keywords"]'),x=_.find(':input[name="search_location"]');S.val()!==S.attr("placeholder")&&(o=S.val()),x.val()!==x.attr("placeholder")&&(l=x.val()),c={lang:job_manager_ajax_filters.lang,search_keywords:o,search_location:l,search_categories:a,filter_job_type:k,filter_post_status:w,per_page:f,orderby:h,order:b,page:i,featured:m,filled:j,show_pagination:u.data("show_pagination"),form_data:_.serialize()}}else a=u.data("categories"),o=u.data("keywords"),l=u.data("location"),a&&("string"!=typeof a&&(a=String(a)),a=a.split(",")),c={lang:job_manager_ajax_filters.lang,search_categories:a,search_keywords:o,search_location:l,filter_post_status:w,filter_job_type:v,per_page:f,orderby:h,order:b,page:i,featured:m,filled:j,show_pagination:u.data("show_pagination")};g[y]=e.ajax({type:"POST",url:job_manager_ajax_filters.ajax_url.toString().replace("%%endpoint%%","get_listings"),data:c,success:function(e){if(e)try{e.data=c,d(u,e,n),p.removeClass("loading"),u.triggerHandler("updated_results",e),r(u,e)}catch(e){window.console&&window.console.log(e)}},error:function(e,t,i){window.console&&"abort"!==t&&window.console.log(t+": "+i)},statusCode:{404:function(){window.console&&window.console.log("Error 404: Ajax Endpoint cannot be reached. Go to Settings > Permalinks and save to resolve.")}}})}}),e("#search_keywords, #search_location, .job_types :input, #search_categories, .job-manager-filter").change(function(){var t=e(this).closest("div.job_listings");t.triggerHandler("update_results",[1,!1]),n(t)}).on("keyup",function(t){13===t.which&&e(this).trigger("change")}),e(".job_filters").on("click",".reset",function(){var t=e(this).closest("div.job_listings"),i=e(this).closest("form");return i.find(':input[name="search_keywords"], :input[name="search_location"], .job-manager-filter').not(':input[type="hidden"]').val("").trigger("change.select2"),i.find(':input[name^="search_categories"]').not(':input[type="hidden"]').val("").trigger("change.select2"),e(':input[name="filter_job_type[]"]',i).not(':input[type="hidden"]').attr("checked","checked"),t.triggerHandler("reset"),t.triggerHandler("update_results",[1,!1]),n(t),!1}).on("submit",function(){return!1}),e(document.body).on("click",".load_more_jobs",function(){var t=e(this).closest("div.job_listings"),i=parseInt(e(this).data("page")||1,10);return e(this).addClass("loading"),i+=1,e(this).data("page",i),t.triggerHandler("update_results",[i,!0]),!1}),e.isFunction(e.fn.select2)&&"undefined"!=typeof job_manager_select2_args){var u=job_manager_select2_args;u.allowClear=!0,u.minimumResultsForSearch=10,e('select[name^="search_categories"]:visible').select2(u)}e(window).on("load",function(){e("div.job_listings").each(function(){var t=e(this),i=t.find(".job_filters"),n=!1,r=a(t);r&&(r.results&&(n=d(t,r.results),o(t,!1)),"string"==typeof r.form&&""!==r.form&&(i.find("input[type=checkbox]").prop("checked",!1),i.deserialize(r.form),i.find(':input[name^="search_categories"]').not(':input[type="hidden"]').trigger("change.select2"))),!n&&i.length>0&&t.triggerHandler("update_results",[1,!1])})}),e(window).on("unload",function(){return e("div.job_listings").each(function(){var t=a(e(this));t&&!t.persist_results&&l(e(this))}),!0})});
1
+ jQuery(document).ready(function(e){function t(t){return!!n()&&(!e(document.body).hasClass("disable-job-manager-form-state-storage")&&!t.data("disable-form-state-storage"))}function n(){return window.sessionStorage&&"function"==typeof window.sessionStorage.setItem}function i(t){var n=e("div.job_listings").index(t),i=t.data("post_id");return void 0!==i&&i||(i=window.location.href.replace(location.hash,"")),_+i+"_"+n}function a(e,n){if(!t(e))return!1;"object"!=typeof n&&(n={});var a=i(e);try{return window.sessionStorage.setItem(a,JSON.stringify(n))}catch(e){}return!1}function o(e){if(!t(e))return!1;var n=i(e);try{var a=window.sessionStorage.getItem(n);if(a)return JSON.parse(a)}catch(e){}return!1}function r(e,n){if(!t(e)||!e)return!1;var i=o(e);return!!i&&(i.persist_results=n,a(e,i))}function s(e){if(!t(e)||!e)return!1;var n=o(e);if(!n)return!1;var i=e.find(".job_filters");return n.form=i.serialize(),a(e,n)}function l(e,n){if(!t(e))return!1;var i=o(e);i||(i={persist_results:!1});var r=e.find(".job_listings");return n.html=r.html(),i.results=n,a(e,i)}function d(e){if(!t(e))return!1;var n=i(e);try{window.sessionStorage.removeItem(n)}catch(e){return!1}return!0}function c(e){if(!t(e))return!1;var n=o(e);return n||(n={}),n.results=null,a(e,n)}function u(e){if(!t(e))return!1;var n=o(e);return n||(n={}),n.form=null,a(e,n)}function g(t,n,i){var a=t.find(".job_listings"),o=t.find(".showing_jobs");if("boolean"!=typeof i&&(i=!1),"string"==typeof n.showing&&n.showing){var r=jQuery("<span>").html(n.showing);o.show().html("").html(n.showing_links).prepend(r)}else o.hide();return n.showing_all?o.addClass("wp-job-manager-showing-all"):o.removeClass("wp-job-manager-showing-all"),n.html&&(i?a.append(n.html):a.html(n.html)),!0===t.data("show_pagination")?(t.find(".job-manager-pagination").remove(),n.pagination&&t.append(n.pagination)):(!n.found_jobs||n.max_num_pages<=n.data.page?e(".load_more_jobs:not(.load_previous)",t).hide():e(".load_more_jobs",t).show(),e(".load_more_jobs",t).removeClass("loading").data("page",n.data.page),e("li.job_listing",a).css("visibility","visible")),!0}var _="job_listing_";e(document).on("click","a",function(){e("div.job_listings").each(function(){s(e(this))})}),e(document).on("submit","form",function(){e("div.job_listings").each(function(){s(e(this))})});var f=[];if(e("div.job_listings").on("click","li.job_listing a",function(){r(e(this).closest("div.job_listings"),!0)}).on("click",".job-manager-pagination a",function(){var t=e(this).closest("div.job_listings"),n=e(this).data("page");return t.triggerHandler("update_results",[n,!1]),e("body, html").animate({scrollTop:t.offset().top},600),!1}).on("update_results",function(t,n,i){var a,o,r,s="",c=e(this),u=c.find(".job_filters"),_=c.find(".job_listings"),p=c.data("per_page"),h=c.data("orderby"),m=c.data("order"),b=c.data("featured"),j=c.data("filled"),v=c.data("job_types"),w=c.data("post_status"),y=e("div.job_listings").index(this);if(!(y<0)){if(d(c),f[y]&&f[y].abort(),i&&1!==n||(e("li.job_listing, li.no_job_listings_found",_).css("visibility","hidden"),_.addClass("loading")),c.find(".load_more_jobs").data("page",n),!0===c.data("show_filters")){var k=[];e(':input[name="filter_job_type[]"]:checked, :input[name="filter_job_type[]"][type="hidden"], :input[name="filter_job_type"]',u).each(function(){k.push(e(this).val())}),a=u.find(':input[name^="search_categories"]').map(function(){return e(this).val()}).get(),o="",r="";var S=u.find(':input[name="search_keywords"]'),x=u.find(':input[name="search_location"]');S.val()!==S.attr("placeholder")&&(o=S.val()),x.val()!==x.attr("placeholder")&&(r=x.val()),s={lang:job_manager_ajax_filters.lang,search_keywords:o,search_location:r,search_categories:a,filter_job_type:k,filter_post_status:w,per_page:p,orderby:h,order:m,page:n,featured:b,filled:j,show_pagination:c.data("show_pagination"),form_data:u.serialize()}}else a=c.data("categories"),o=c.data("keywords"),r=c.data("location"),a&&("string"!=typeof a&&(a=String(a)),a=a.split(",")),s={lang:job_manager_ajax_filters.lang,search_categories:a,search_keywords:o,search_location:r,filter_post_status:w,filter_job_type:v,per_page:p,orderby:h,order:m,page:n,featured:b,filled:j,show_pagination:c.data("show_pagination")};f[y]=e.ajax({type:"POST",url:job_manager_ajax_filters.ajax_url.toString().replace("%%endpoint%%","get_listings"),data:s,success:function(e){if(e)try{e.data=s,g(c,e,i),_.removeClass("loading"),c.triggerHandler("updated_results",e),l(c,e)}catch(e){window.console&&window.console.log(e)}},error:function(e,t,n){window.console&&"abort"!==t&&window.console.log(t+": "+n)},statusCode:{404:function(){window.console&&window.console.log("Error 404: Ajax Endpoint cannot be reached. Go to Settings > Permalinks and save to resolve.")}}})}}),e("#search_keywords, #search_location, .job_types :input, #search_categories, .job-manager-filter").change(function(){var t=e(this).closest("div.job_listings");t.triggerHandler("update_results",[1,!1]),a(t)}).on("keyup",function(t){13===t.which&&e(this).trigger("change")}),e(".job_filters").on("click",".reset",function(){var t=e(this).closest("div.job_listings"),n=e(this).closest("form");return n.find(':input[name="search_keywords"], :input[name="search_location"], .job-manager-filter').not(':input[type="hidden"]').val("").trigger("change.select2"),n.find(':input[name^="search_categories"]').not(':input[type="hidden"]').val("").trigger("change.select2"),e(':input[name="filter_job_type[]"]',n).not(':input[type="hidden"]').attr("checked","checked"),t.triggerHandler("reset"),t.triggerHandler("update_results",[1,!1]),a(t),!1}).on("submit",function(){return!1}),e(document.body).on("click",".load_more_jobs",function(){var t=e(this).closest("div.job_listings"),n=parseInt(e(this).data("page")||1,10);return e(this).addClass("loading"),n+=1,e(this).data("page",n),t.triggerHandler("update_results",[n,!0]),!1}),e.isFunction(e.fn.select2)&&"undefined"!=typeof job_manager_select2_args){var p=job_manager_select2_args;p.allowClear=!0,p.minimumResultsForSearch=10,e('select[name^="search_categories"]:visible').select2(p)}e(window).on("load",function(){e("div.job_listings").each(function(){var t=e(this),n=t.find(".job_filters"),i=!1,a=o(t);a&&(a.results&&(i=g(t,a.results),r(t,!1),u(t)),"string"==typeof a.form&&""!==a.form&&(n.find("input[type=checkbox]").prop("checked",!1),n.deserialize(a.form),n.find(':input[name^="search_categories"]').not(':input[type="hidden"]').trigger("change.select2"))),!i&&n.length>0&&t.triggerHandler("update_results",[1,!1])})}),e(window).on("unload",function(){return e("div.job_listings").each(function(){var t=o(e(this));t&&!t.persist_results&&c(e(this))}),!0})});
assets/js/jquery-fileupload/jquery.fileupload.js CHANGED
@@ -1,5 +1,5 @@
1
  /*
2
- * jQuery File Upload Plugin v9.32.0
3
  * https://github.com/blueimp/jQuery-File-Upload
4
  *
5
  * Copyright 2010, Sebastian Tschan
@@ -9,1527 +9,1603 @@
9
  * https://opensource.org/licenses/MIT
10
  */
11
 
12
- /* jshint nomen:false */
13
- /* global define, require, window, document, location, Blob, FormData */
14
-
15
- ;(function (factory) {
16
- 'use strict';
17
- if (typeof define === 'function' && define.amd) {
18
- // Register as an anonymous AMD module:
19
- define([
20
- 'jquery',
21
- 'jquery-ui/ui/widget'
22
- ], factory);
23
- } else if (typeof exports === 'object') {
24
- // Node/CommonJS:
25
- factory(
26
- require('jquery'),
27
- require('./vendor/jquery.ui.widget')
28
- );
29
- } else {
30
- // Browser globals:
31
- factory(window.jQuery);
32
- }
33
- }(function ($) {
34
- 'use strict';
35
-
36
- // Detect file input support, based on
37
- // http://viljamis.com/blog/2012/file-upload-support-on-mobile/
38
- $.support.fileInput = !(new RegExp(
39
- // Handle devices which give false positives for the feature detection:
40
- '(Android (1\\.[0156]|2\\.[01]))' +
41
- '|(Windows Phone (OS 7|8\\.0))|(XBLWP)|(ZuneWP)|(WPDesktop)' +
42
- '|(w(eb)?OSBrowser)|(webOS)' +
43
- '|(Kindle/(1\\.0|2\\.[05]|3\\.0))'
44
  ).test(window.navigator.userAgent) ||
45
- // Feature detection for all other devices:
46
- $('<input type="file"/>').prop('disabled'));
47
-
48
- // The FileReader API is not actually used, but works as feature detection,
49
- // as some Safari versions (5?) support XHR file uploads via the FormData API,
50
- // but not non-multipart XHR file uploads.
51
- // window.XMLHttpRequestUpload is not available on IE10, so we check for
52
- // window.ProgressEvent instead to detect XHR2 file upload capability:
53
- $.support.xhrFileUpload = !!(window.ProgressEvent && window.FileReader);
54
- $.support.xhrFormDataFileUpload = !!window.FormData;
55
-
56
- // Detect support for Blob slicing (required for chunked uploads):
57
- $.support.blobSlice = window.Blob && (Blob.prototype.slice ||
58
- Blob.prototype.webkitSlice || Blob.prototype.mozSlice);
59
-
60
- // Helper function to create drag handlers for dragover/dragenter/dragleave:
61
- function getDragHandler(type) {
62
- var isDragOver = type === 'dragover';
63
- return function (e) {
64
- e.dataTransfer = e.originalEvent && e.originalEvent.dataTransfer;
65
- var dataTransfer = e.dataTransfer;
66
- if (dataTransfer && $.inArray('Files', dataTransfer.types) !== -1 &&
67
- this._trigger(
68
- type,
69
- $.Event(type, {delegatedEvent: e})
70
- ) !== false) {
71
- e.preventDefault();
72
- if (isDragOver) {
73
- dataTransfer.dropEffect = 'copy';
74
- }
75
- }
76
- };
77
- }
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
78
 
79
- // The fileupload widget listens for change events on file input fields defined
80
- // via fileInput setting and paste or drop events of the given dropZone.
81
- // In addition to the default jQuery Widget methods, the fileupload widget
82
- // exposes the "add" and "send" methods, to add or directly send files using
83
- // the fileupload API.
84
- // By default, files added via file input selection, paste, drag & drop or
85
- // "add" method are uploaded immediately, but it is possible to override
86
- // the "add" callback option to queue file uploads.
87
- $.widget('blueimp.fileupload', {
88
-
89
- options: {
90
- // The drop target element(s), by the default the complete document.
91
- // Set to null to disable drag & drop support:
92
- dropZone: $(document),
93
- // The paste target element(s), by the default undefined.
94
- // Set to a DOM node or jQuery object to enable file pasting:
95
- pasteZone: undefined,
96
- // The file input field(s), that are listened to for change events.
97
- // If undefined, it is set to the file input fields inside
98
- // of the widget element on plugin initialization.
99
- // Set to null to disable the change listener.
100
- fileInput: undefined,
101
- // By default, the file input field is replaced with a clone after
102
- // each input field change event. This is required for iframe transport
103
- // queues and allows change events to be fired for the same file
104
- // selection, but can be disabled by setting the following option to false:
105
- replaceFileInput: true,
106
- // The parameter name for the file form data (the request argument name).
107
- // If undefined or empty, the name property of the file input field is
108
- // used, or "files[]" if the file input name property is also empty,
109
- // can be a string or an array of strings:
110
- paramName: undefined,
111
- // By default, each file of a selection is uploaded using an individual
112
- // request for XHR type uploads. Set to false to upload file
113
- // selections in one request each:
114
- singleFileUploads: true,
115
- // To limit the number of files uploaded with one XHR request,
116
- // set the following option to an integer greater than 0:
117
- limitMultiFileUploads: undefined,
118
- // The following option limits the number of files uploaded with one
119
- // XHR request to keep the request size under or equal to the defined
120
- // limit in bytes:
121
- limitMultiFileUploadSize: undefined,
122
- // Multipart file uploads add a number of bytes to each uploaded file,
123
- // therefore the following option adds an overhead for each file used
124
- // in the limitMultiFileUploadSize configuration:
125
- limitMultiFileUploadSizeOverhead: 512,
126
- // Set the following option to true to issue all file upload requests
127
- // in a sequential order:
128
- sequentialUploads: false,
129
- // To limit the number of concurrent uploads,
130
- // set the following option to an integer greater than 0:
131
- limitConcurrentUploads: undefined,
132
- // Set the following option to true to force iframe transport uploads:
133
- forceIframeTransport: false,
134
- // Set the following option to the location of a redirect url on the
135
- // origin server, for cross-domain iframe transport uploads:
136
- redirect: undefined,
137
- // The parameter name for the redirect url, sent as part of the form
138
- // data and set to 'redirect' if this option is empty:
139
- redirectParamName: undefined,
140
- // Set the following option to the location of a postMessage window,
141
- // to enable postMessage transport uploads:
142
- postMessage: undefined,
143
- // By default, XHR file uploads are sent as multipart/form-data.
144
- // The iframe transport is always using multipart/form-data.
145
- // Set to false to enable non-multipart XHR uploads:
146
- multipart: true,
147
- // To upload large files in smaller chunks, set the following option
148
- // to a preferred maximum chunk size. If set to 0, null or undefined,
149
- // or the browser does not support the required Blob API, files will
150
- // be uploaded as a whole.
151
- maxChunkSize: undefined,
152
- // When a non-multipart upload or a chunked multipart upload has been
153
- // aborted, this option can be used to resume the upload by setting
154
- // it to the size of the already uploaded bytes. This option is most
155
- // useful when modifying the options object inside of the "add" or
156
- // "send" callbacks, as the options are cloned for each file upload.
157
- uploadedBytes: undefined,
158
- // By default, failed (abort or error) file uploads are removed from the
159
- // global progress calculation. Set the following option to false to
160
- // prevent recalculating the global progress data:
161
- recalculateProgress: true,
162
- // Interval in milliseconds to calculate and trigger progress events:
163
- progressInterval: 100,
164
- // Interval in milliseconds to calculate progress bitrate:
165
- bitrateInterval: 500,
166
- // By default, uploads are started automatically when adding files:
167
- autoUpload: true,
168
- // By default, duplicate file names are expected to be handled on
169
- // the server-side. If this is not possible (e.g. when uploading
170
- // files directly to Amazon S3), the following option can be set to
171
- // an empty object or an object mapping existing filenames, e.g.:
172
- // { "image.jpg": true, "image (1).jpg": true }
173
- // If it is set, all files will be uploaded with unique filenames,
174
- // adding increasing number suffixes if necessary, e.g.:
175
- // "image (2).jpg"
176
- uniqueFilenames: undefined,
177
-
178
- // Error and info messages:
179
- messages: {
180
- uploadedBytes: 'Uploaded bytes exceed file size'
181
- },
182
-
183
- // Translation function, gets the message key to be translated
184
- // and an object with context specific data as arguments:
185
- i18n: function (message, context) {
186
- message = this.messages[message] || message.toString();
187
- if (context) {
188
- $.each(context, function (key, value) {
189
- message = message.replace('{' + key + '}', value);
190
- });
191
- }
192
- return message;
193
- },
194
-
195
- // Additional form data to be sent along with the file uploads can be set
196
- // using this option, which accepts an array of objects with name and
197
- // value properties, a function returning such an array, a FormData
198
- // object (for XHR file uploads), or a simple object.
199
- // The form of the first fileInput is given as parameter to the function:
200
- formData: function (form) {
201
- return form.serializeArray();
202
- },
203
-
204
- // The add callback is invoked as soon as files are added to the fileupload
205
- // widget (via file input selection, drag & drop, paste or add API call).
206
- // If the singleFileUploads option is enabled, this callback will be
207
- // called once for each file in the selection for XHR file uploads, else
208
- // once for each file selection.
209
- //
210
- // The upload starts when the submit method is invoked on the data parameter.
211
- // The data object contains a files property holding the added files
212
- // and allows you to override plugin options as well as define ajax settings.
213
- //
214
- // Listeners for this callback can also be bound the following way:
215
- // .bind('fileuploadadd', func);
216
- //
217
- // data.submit() returns a Promise object and allows to attach additional
218
- // handlers using jQuery's Deferred callbacks:
219
- // data.submit().done(func).fail(func).always(func);
220
- add: function (e, data) {
221
- if (e.isDefaultPrevented()) {
222
- return false;
223
- }
224
- if (data.autoUpload || (data.autoUpload !== false &&
225
- $(this).fileupload('option', 'autoUpload'))) {
226
- data.process().done(function () {
227
- data.submit();
228
- });
229
- }
230
- },
231
 
232
- // Other callbacks:
 
233
 
234
- // Callback for the submit event of each file upload:
235
- // submit: function (e, data) {}, // .bind('fileuploadsubmit', func);
236
 
237
- // Callback for the start of each file upload request:
238
- // send: function (e, data) {}, // .bind('fileuploadsend', func);
239
 
240
- // Callback for successful uploads:
241
- // done: function (e, data) {}, // .bind('fileuploaddone', func);
242
 
243
- // Callback for failed (abort or error) uploads:
244
- // fail: function (e, data) {}, // .bind('fileuploadfail', func);
245
 
246
- // Callback for completed (success, abort or error) requests:
247
- // always: function (e, data) {}, // .bind('fileuploadalways', func);
248
 
249
- // Callback for upload progress events:
250
- // progress: function (e, data) {}, // .bind('fileuploadprogress', func);
251
 
252
- // Callback for global upload progress events:
253
- // progressall: function (e, data) {}, // .bind('fileuploadprogressall', func);
254
 
255
- // Callback for uploads start, equivalent to the global ajaxStart event:
256
- // start: function (e) {}, // .bind('fileuploadstart', func);
257
 
258
- // Callback for uploads stop, equivalent to the global ajaxStop event:
259
- // stop: function (e) {}, // .bind('fileuploadstop', func);
260
 
261
- // Callback for change events of the fileInput(s):
262
- // change: function (e, data) {}, // .bind('fileuploadchange', func);
263
 
264
- // Callback for paste events to the pasteZone(s):
265
- // paste: function (e, data) {}, // .bind('fileuploadpaste', func);
266
 
267
- // Callback for drop events of the dropZone(s):
268
- // drop: function (e, data) {}, // .bind('fileuploaddrop', func);
269
 
270
- // Callback for dragover events of the dropZone(s):
271
- // dragover: function (e) {}, // .bind('fileuploaddragover', func);
272
 
273
- // Callback before the start of each chunk upload request (before form data initialization):
274
- // chunkbeforesend: function (e, data) {}, // .bind('fileuploadchunkbeforesend', func);
275
 
276
- // Callback for the start of each chunk upload request:
277
- // chunksend: function (e, data) {}, // .bind('fileuploadchunksend', func);
278
 
279
- // Callback for successful chunk uploads:
280
- // chunkdone: function (e, data) {}, // .bind('fileuploadchunkdone', func);
281
 
282
- // Callback for failed (abort or error) chunk uploads:
283
- // chunkfail: function (e, data) {}, // .bind('fileuploadchunkfail', func);
284
 
285
- // Callback for completed (success, abort or error) chunk upload requests:
286
- // chunkalways: function (e, data) {}, // .bind('fileuploadchunkalways', func);
 
 
 
 
 
287
 
288
- // The plugin options are used as settings object for the ajax calls.
289
- // The following are jQuery ajax settings required for the file uploads:
290
- processData: false,
291
- contentType: false,
292
- cache: false,
293
- timeout: 0
294
- },
 
 
295
 
296
- // A list of options that require reinitializing event listeners and/or
297
- // special initialization code:
298
- _specialOptions: [
299
- 'fileInput',
300
- 'dropZone',
301
- 'pasteZone',
302
- 'multipart',
303
- 'forceIframeTransport'
304
- ],
305
-
306
- _blobSlice: $.support.blobSlice && function () {
307
- var slice = this.slice || this.webkitSlice || this.mozSlice;
308
- return slice.apply(this, arguments);
309
- },
310
 
311
- _BitrateTimer: function () {
312
- this.timestamp = ((Date.now) ? Date.now() : (new Date()).getTime());
313
- this.loaded = 0;
314
- this.bitrate = 0;
315
- this.getBitrate = function (now, loaded, interval) {
316
- var timeDiff = now - this.timestamp;
317
- if (!this.bitrate || !interval || timeDiff > interval) {
318
- this.bitrate = (loaded - this.loaded) * (1000 / timeDiff) * 8;
319
- this.loaded = loaded;
320
- this.timestamp = now;
321
- }
322
- return this.bitrate;
323
- };
324
- },
325
-
326
- _isXHRUpload: function (options) {
327
- return !options.forceIframeTransport &&
328
- ((!options.multipart && $.support.xhrFileUpload) ||
329
- $.support.xhrFormDataFileUpload);
330
- },
331
-
332
- _getFormData: function (options) {
333
- var formData;
334
- if ($.type(options.formData) === 'function') {
335
- return options.formData(options.form);
336
- }
337
- if ($.isArray(options.formData)) {
338
- return options.formData;
339
- }
340
- if ($.type(options.formData) === 'object') {
341
- formData = [];
342
- $.each(options.formData, function (name, value) {
343
- formData.push({name: name, value: value});
344
- });
345
- return formData;
346
- }
347
- return [];
348
- },
349
-
350
- _getTotal: function (files) {
351
- var total = 0;
352
- $.each(files, function (index, file) {
353
- total += file.size || 1;
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
354
  });
355
- return total;
356
- },
357
-
358
- _initProgressObject: function (obj) {
359
- var progress = {
360
- loaded: 0,
361
- total: 0,
362
- bitrate: 0
363
- };
364
- if (obj._progress) {
365
- $.extend(obj._progress, progress);
366
- } else {
367
- obj._progress = progress;
368
- }
369
- },
370
-
371
- _initResponseObject: function (obj) {
372
- var prop;
373
- if (obj._response) {
374
- for (prop in obj._response) {
375
- if (obj._response.hasOwnProperty(prop)) {
376
- delete obj._response[prop];
377
- }
378
- }
379
- } else {
380
- obj._response = {};
381
- }
382
- },
383
-
384
- _onProgress: function (e, data) {
385
- if (e.lengthComputable) {
386
- var now = ((Date.now) ? Date.now() : (new Date()).getTime()),
387
- loaded;
388
- if (data._time && data.progressInterval &&
389
- (now - data._time < data.progressInterval) &&
390
- e.loaded !== e.total) {
391
- return;
392
- }
393
- data._time = now;
394
- loaded = Math.floor(
395
- e.loaded / e.total * (data.chunkSize || data._progress.total)
396
- ) + (data.uploadedBytes || 0);
397
- // Add the difference from the previously loaded state
398
- // to the global loaded counter:
399
- this._progress.loaded += (loaded - data._progress.loaded);
400
- this._progress.bitrate = this._bitrateTimer.getBitrate(
401
- now,
402
- this._progress.loaded,
403
- data.bitrateInterval
404
- );
405
- data._progress.loaded = data.loaded = loaded;
406
- data._progress.bitrate = data.bitrate = data._bitrateTimer.getBitrate(
407
- now,
408
- loaded,
409
- data.bitrateInterval
410
- );
411
- // Trigger a custom progress event with a total data property set
412
- // to the file size(s) of the current upload and a loaded data
413
- // property calculated accordingly:
414
- this._trigger(
415
- 'progress',
416
- $.Event('progress', {delegatedEvent: e}),
417
- data
418
- );
419
- // Trigger a global progress event for all current file uploads,
420
- // including ajax calls queued for sequential file uploads:
421
- this._trigger(
422
- 'progressall',
423
- $.Event('progressall', {delegatedEvent: e}),
424
- this._progress
425
- );
426
- }
427
- },
428
-
429
- _initProgressListener: function (options) {
430
- var that = this,
431
- xhr = options.xhr ? options.xhr() : $.ajaxSettings.xhr();
432
- // Accesss to the native XHR object is required to add event listeners
433
- // for the upload progress event:
434
- if (xhr.upload) {
435
- $(xhr.upload).bind('progress', function (e) {
436
- var oe = e.originalEvent;
437
- // Make sure the progress event properties get copied over:
438
- e.lengthComputable = oe.lengthComputable;
439
- e.loaded = oe.loaded;
440
- e.total = oe.total;
441
- that._onProgress(e, options);
442
- });
443
- options.xhr = function () {
444
- return xhr;
445
- };
446
- }
447
- },
448
-
449
- _deinitProgressListener: function (options) {
450
- var xhr = options.xhr ? options.xhr() : $.ajaxSettings.xhr();
451
- if (xhr.upload) {
452
- $(xhr.upload).unbind('progress');
453
- }
454
- },
455
-
456
- _isInstanceOf: function (type, obj) {
457
- // Cross-frame instanceof check
458
- return Object.prototype.toString.call(obj) === '[object ' + type + ']';
459
- },
460
-
461
- _getUniqueFilename: function (name, map) {
462
- name = String(name);
463
- if (map[name]) {
464
- name = name.replace(
465
- /(?: \(([\d]+)\))?(\.[^.]+)?$/,
466
- function (_, p1, p2) {
467
- var index = p1 ? Number(p1) + 1 : 1;
468
- var ext = p2 || '';
469
- return ' (' + index + ')' + ext;
470
- }
471
- );
472
- return this._getUniqueFilename(name, map);
473
- }
474
- map[name] = true;
475
- return name;
476
- },
477
-
478
- _initXHRData: function (options) {
479
- var that = this,
480
- formData,
481
- file = options.files[0],
482
- // Ignore non-multipart setting if not supported:
483
- multipart = options.multipart || !$.support.xhrFileUpload,
484
- paramName = $.type(options.paramName) === 'array' ?
485
- options.paramName[0] : options.paramName;
486
- options.headers = $.extend({}, options.headers);
487
- if (options.contentRange) {
488
- options.headers['Content-Range'] = options.contentRange;
489
- }
490
- if (!multipart || options.blob || !this._isInstanceOf('File', file)) {
491
- options.headers['Content-Disposition'] = 'attachment; filename="' +
492
- encodeURI(file.uploadName || file.name) + '"';
493
- }
494
- if (!multipart) {
495
- options.contentType = file.type || 'application/octet-stream';
496
- options.data = options.blob || file;
497
- } else if ($.support.xhrFormDataFileUpload) {
498
- if (options.postMessage) {
499
- // window.postMessage does not allow sending FormData
500
- // objects, so we just add the File/Blob objects to
501
- // the formData array and let the postMessage window
502
- // create the FormData object out of this array:
503
- formData = this._getFormData(options);
504
- if (options.blob) {
505
- formData.push({
506
- name: paramName,
507
- value: options.blob
508
- });
509
- } else {
510
- $.each(options.files, function (index, file) {
511
- formData.push({
512
- name: ($.type(options.paramName) === 'array' &&
513
- options.paramName[index]) || paramName,
514
- value: file
515
- });
516
- });
517
- }
518
- } else {
519
- if (that._isInstanceOf('FormData', options.formData)) {
520
- formData = options.formData;
521
- } else {
522
- formData = new FormData();
523
- $.each(this._getFormData(options), function (index, field) {
524
- formData.append(field.name, field.value);
525
- });
526
- }
527
- if (options.blob) {
528
- formData.append(
529
- paramName,
530
- options.blob,
531
- file.uploadName || file.name
532
- );
533
- } else {
534
- $.each(options.files, function (index, file) {
535
- // This check allows the tests to run with
536
- // dummy objects:
537
- if (that._isInstanceOf('File', file) ||
538
- that._isInstanceOf('Blob', file)) {
539
- var fileName = file.uploadName || file.name;
540
- if (options.uniqueFilenames) {
541
- fileName = that._getUniqueFilename(
542
- fileName,
543
- options.uniqueFilenames
544
- );
545
- }
546
- formData.append(
547
- ($.type(options.paramName) === 'array' &&
548
- options.paramName[index]) || paramName,
549
- file,
550
- fileName
551
- );
552
- }
553
- });
554
- }
555
- }
556
- options.data = formData;
557
- }
558
- // Blob reference is not needed anymore, free memory:
559
- options.blob = null;
560
- },
561
-
562
- _initIframeSettings: function (options) {
563
- var targetHost = $('<a></a>').prop('href', options.url).prop('host');
564
- // Setting the dataType to iframe enables the iframe transport:
565
- options.dataType = 'iframe ' + (options.dataType || '');
566
- // The iframe transport accepts a serialized array as form data:
567
- options.formData = this._getFormData(options);
568
- // Add redirect url to form data on cross-domain uploads:
569
- if (options.redirect && targetHost && targetHost !== location.host) {
570
- options.formData.push({
571
- name: options.redirectParamName || 'redirect',
572
- value: options.redirect
573
- });
574
- }
575
- },
576
-
577
- _initDataSettings: function (options) {
578
- if (this._isXHRUpload(options)) {
579
- if (!this._chunkedUpload(options, true)) {
580
- if (!options.data) {
581
- this._initXHRData(options);
582
- }
583
- this._initProgressListener(options);
584
- }
585
- if (options.postMessage) {
586
- // Setting the dataType to postmessage enables the
587
- // postMessage transport:
588
- options.dataType = 'postmessage ' + (options.dataType || '');
589
- }
590
- } else {
591
- this._initIframeSettings(options);
592
- }
593
- },
594
-
595
- _getParamName: function (options) {
596
- var fileInput = $(options.fileInput),
597
- paramName = options.paramName;
598
- if (!paramName) {
599
- paramName = [];
600
- fileInput.each(function () {
601
- var input = $(this),
602
- name = input.prop('name') || 'files[]',
603
- i = (input.prop('files') || [1]).length;
604
- while (i) {
605
- paramName.push(name);
606
- i -= 1;
607
- }
608
- });
609
- if (!paramName.length) {
610
- paramName = [fileInput.prop('name') || 'files[]'];
611
- }
612
- } else if (!$.isArray(paramName)) {
613
- paramName = [paramName];
614
- }
615
- return paramName;
616
- },
617
-
618
- _initFormSettings: function (options) {
619
- // Retrieve missing options from the input field and the
620
- // associated form, if available:
621
- if (!options.form || !options.form.length) {
622
- options.form = $(options.fileInput.prop('form'));
623
- // If the given file input doesn't have an associated form,
624
- // use the default widget file input's form:
625
- if (!options.form.length) {
626
- options.form = $(this.options.fileInput.prop('form'));
627
- }
628
- }
629
- options.paramName = this._getParamName(options);
630
- if (!options.url) {
631
- options.url = options.form.prop('action') || location.href;
632
- }
633
- // The HTTP request method must be "POST" or "PUT":
634
- options.type = (options.type ||
635
- ($.type(options.form.prop('method')) === 'string' &&
636
- options.form.prop('method')) || ''
637
- ).toUpperCase();
638
- if (options.type !== 'POST' && options.type !== 'PUT' &&
639
- options.type !== 'PATCH') {
640
- options.type = 'POST';
641
- }
642
- if (!options.formAcceptCharset) {
643
- options.formAcceptCharset = options.form.attr('accept-charset');
644
- }
645
- },
646
-
647
- _getAJAXSettings: function (data) {
648
- var options = $.extend({}, this.options, data);
649
- this._initFormSettings(options);
650
- this._initDataSettings(options);
651
- return options;
652
- },
653
-
654
- // jQuery 1.6 doesn't provide .state(),
655
- // while jQuery 1.8+ removed .isRejected() and .isResolved():
656
- _getDeferredState: function (deferred) {
657
- if (deferred.state) {
658
- return deferred.state();
659
- }
660
- if (deferred.isResolved()) {
661
- return 'resolved';
662
- }
663
- if (deferred.isRejected()) {
664
- return 'rejected';
665
- }
666
- return 'pending';
667
- },
668
-
669
- // Maps jqXHR callbacks to the equivalent
670
- // methods of the given Promise object:
671
- _enhancePromise: function (promise) {
672
- promise.success = promise.done;
673
- promise.error = promise.fail;
674
- promise.complete = promise.always;
675
- return promise;
676
- },
677
-
678
- // Creates and returns a Promise object enhanced with
679
- // the jqXHR methods abort, success, error and complete:
680
- _getXHRPromise: function (resolveOrReject, context, args) {
681
- var dfd = $.Deferred(),
682
- promise = dfd.promise();
683
- context = context || this.options.context || promise;
684
- if (resolveOrReject === true) {
685
- dfd.resolveWith(context, args);
686
- } else if (resolveOrReject === false) {
687
- dfd.rejectWith(context, args);
688
- }
689
- promise.abort = dfd.promise;
690
- return this._enhancePromise(promise);
691
- },
692
-
693
- // Adds convenience methods to the data callback argument:
694
- _addConvenienceMethods: function (e, data) {
695
- var that = this,
696
- getPromise = function (args) {
697
- return $.Deferred().resolveWith(that, args).promise();
698
- };
699
- data.process = function (resolveFunc, rejectFunc) {
700
- if (resolveFunc || rejectFunc) {
701
- data._processQueue = this._processQueue =
702
- (this._processQueue || getPromise([this])).then(
703
- function () {
704
- if (data.errorThrown) {
705
- return $.Deferred()
706
- .rejectWith(that, [data]).promise();
707
- }
708
- return getPromise(arguments);
709
- }
710
- ).then(resolveFunc, rejectFunc);
711
- }
712
- return this._processQueue || getPromise([this]);
713
- };
714
- data.submit = function () {
715
- if (this.state() !== 'pending') {
716
- data.jqXHR = this.jqXHR =
717
- (that._trigger(
718
- 'submit',
719
- $.Event('submit', {delegatedEvent: e}),
720
- this
721
- ) !== false) && that._onSend(e, this);
722
- }
723
- return this.jqXHR || that._getXHRPromise();
724
- };
725
- data.abort = function () {
726
- if (this.jqXHR) {
727
- return this.jqXHR.abort();
728
- }
729
- this.errorThrown = 'abort';
730
- that._trigger('fail', null, this);
731
- return that._getXHRPromise(false);
732
- };
733
- data.state = function () {
734
- if (this.jqXHR) {
735
- return that._getDeferredState(this.jqXHR);
736
- }
737
- if (this._processQueue) {
738
- return that._getDeferredState(this._processQueue);
739
- }
740
- };
741
- data.processing = function () {
742
- return !this.jqXHR && this._processQueue && that
743
- ._getDeferredState(this._processQueue) === 'pending';
744
- };
745
- data.progress = function () {
746
- return this._progress;
747
- };
748
- data.response = function () {
749
- return this._response;
750
- };
751
- },
752
-
753
- // Parses the Range header from the server response
754
- // and returns the uploaded bytes:
755
- _getUploadedBytes: function (jqXHR) {
756
- var range = jqXHR.getResponseHeader('Range'),
757
- parts = range && range.split('-'),
758
- upperBytesPos = parts && parts.length > 1 &&
759
- parseInt(parts[1], 10);
760
- return upperBytesPos && upperBytesPos + 1;
761
- },
762
-
763
- // Uploads a file in multiple, sequential requests
764
- // by splitting the file up in multiple blob chunks.
765
- // If the second parameter is true, only tests if the file
766
- // should be uploaded in chunks, but does not invoke any
767
- // upload requests:
768
- _chunkedUpload: function (options, testOnly) {
769
- options.uploadedBytes = options.uploadedBytes || 0;
770
- var that = this,
771
- file = options.files[0],
772
- fs = file.size,
773
- ub = options.uploadedBytes,
774
- mcs = options.maxChunkSize || fs,
775
- slice = this._blobSlice,
776
- dfd = $.Deferred(),
777
- promise = dfd.promise(),
778
- jqXHR,
779
- upload;
780
- if (!(this._isXHRUpload(options) && slice && (ub || ($.type(mcs) === 'function' ? mcs(options) : mcs) < fs)) ||
781
- options.data) {
782
- return false;
783
- }
784
- if (testOnly) {
785
- return true;
786
- }
787
- if (ub >= fs) {
788
- file.error = options.i18n('uploadedBytes');
789
- return this._getXHRPromise(
790
- false,
791
- options.context,
792
- [null, 'error', file.error]
793
- );
794
- }
795
- // The chunk upload method:
796
- upload = function () {
797
- // Clone the options object for each chunk upload:
798
- var o = $.extend({}, options),
799
- currentLoaded = o._progress.loaded;
800
- o.blob = slice.call(
801
- file,
802
- ub,
803
- ub + ($.type(mcs) === 'function' ? mcs(o) : mcs),
804
- file.type
805
- );
806
- // Store the current chunk size, as the blob itself
807
- // will be dereferenced after data processing:
808
- o.chunkSize = o.blob.size;
809
- // Expose the chunk bytes position range:
810
- o.contentRange = 'bytes ' + ub + '-' +
811
- (ub + o.chunkSize - 1) + '/' + fs;
812
- // Trigger chunkbeforesend to allow form data to be updated for this chunk
813
- that._trigger('chunkbeforesend', null, o);
814
- // Process the upload data (the blob and potential form data):
815
- that._initXHRData(o);
816
- // Add progress listeners for this chunk upload:
817
- that._initProgressListener(o);
818
- jqXHR = ((that._trigger('chunksend', null, o) !== false && $.ajax(o)) ||
819
- that._getXHRPromise(false, o.context))
820
- .done(function (result, textStatus, jqXHR) {
821
- ub = that._getUploadedBytes(jqXHR) ||
822
- (ub + o.chunkSize);
823
- // Create a progress event if no final progress event
824
- // with loaded equaling total has been triggered
825
- // for this chunk:
826
- if (currentLoaded + o.chunkSize - o._progress.loaded) {
827
- that._onProgress($.Event('progress', {
828
- lengthComputable: true,
829
- loaded: ub - o.uploadedBytes,
830
- total: ub - o.uploadedBytes
831
- }), o);
832
- }
833
- options.uploadedBytes = o.uploadedBytes = ub;
834
- o.result = result;
835
- o.textStatus = textStatus;
836
- o.jqXHR = jqXHR;
837
- that._trigger('chunkdone', null, o);
838
- that._trigger('chunkalways', null, o);
839
- if (ub < fs) {
840
- // File upload not yet complete,
841
- // continue with the next chunk:
842
- upload();
843
- } else {
844
- dfd.resolveWith(
845
- o.context,
846
- [result, textStatus, jqXHR]
847
- );
848
- }
849
- })
850
- .fail(function (jqXHR, textStatus, errorThrown) {
851
- o.jqXHR = jqXHR;
852
- o.textStatus = textStatus;
853
- o.errorThrown = errorThrown;
854
- that._trigger('chunkfail', null, o);
855
- that._trigger('chunkalways', null, o);
856
- dfd.rejectWith(
857
- o.context,
858
- [jqXHR, textStatus, errorThrown]
859
- );
860
- })
861
- .always(function () {
862
- that._deinitProgressListener(o);
863
- });
864
- };
865
- this._enhancePromise(promise);
866
- promise.abort = function () {
867
- return jqXHR.abort();
868
- };
869
- upload();
870
- return promise;
871
- },
872
-
873
- _beforeSend: function (e, data) {
874
- if (this._active === 0) {
875
- // the start callback is triggered when an upload starts
876
- // and no other uploads are currently running,
877
- // equivalent to the global ajaxStart event:
878
- this._trigger('start');
879
- // Set timer for global bitrate progress calculation:
880
- this._bitrateTimer = new this._BitrateTimer();
881
- // Reset the global progress values:
882
- this._progress.loaded = this._progress.total = 0;
883
- this._progress.bitrate = 0;
884
- }
885
- // Make sure the container objects for the .response() and
886
- // .progress() methods on the data object are available
887
- // and reset to their initial state:
888
- this._initResponseObject(data);
889
- this._initProgressObject(data);
890
- data._progress.loaded = data.loaded = data.uploadedBytes || 0;
891
- data._progress.total = data.total = this._getTotal(data.files) || 1;
892
- data._progress.bitrate = data.bitrate = 0;
893
- this._active += 1;
894
- // Initialize the global progress values:
895
- this._progress.loaded += data.loaded;
896
- this._progress.total += data.total;
897
- },
898
-
899
- _onDone: function (result, textStatus, jqXHR, options) {
900
- var total = options._progress.total,
901
- response = options._response;
902
- if (options._progress.loaded < total) {
903
- // Create a progress event if no final progress event
904
- // with loaded equaling total has been triggered:
905
- this._onProgress($.Event('progress', {
906
- lengthComputable: true,
907
- loaded: total,
908
- total: total
909
- }), options);
910
- }
911
- response.result = options.result = result;
912
- response.textStatus = options.textStatus = textStatus;
913
- response.jqXHR = options.jqXHR = jqXHR;
914
- this._trigger('done', null, options);
915
- },
916
-
917
- _onFail: function (jqXHR, textStatus, errorThrown, options) {
918
- var response = options._response;
919
- if (options.recalculateProgress) {
920
- // Remove the failed (error or abort) file upload from
921
- // the global progress calculation:
922
- this._progress.loaded -= options._progress.loaded;
923
- this._progress.total -= options._progress.total;
924
- }
925
- response.jqXHR = options.jqXHR = jqXHR;
926
- response.textStatus = options.textStatus = textStatus;
927
- response.errorThrown = options.errorThrown = errorThrown;
928
- this._trigger('fail', null, options);
929
- },
930
-
931
- _onAlways: function (jqXHRorResult, textStatus, jqXHRorError, options) {
932
- // jqXHRorResult, textStatus and jqXHRorError are added to the
933
- // options object via done and fail callbacks
934
- this._trigger('always', null, options);
935
- },
936
-
937
- _onSend: function (e, data) {
938
- if (!data.submit) {
939
- this._addConvenienceMethods(e, data);
940
- }
941
- var that = this,
942
- jqXHR,
943
- aborted,
944
- slot,
945
- pipe,
946
- options = that._getAJAXSettings(data),
947
- send = function () {
948
- that._sending += 1;
949
- // Set timer for bitrate progress calculation:
950
- options._bitrateTimer = new that._BitrateTimer();
951
- jqXHR = jqXHR || (
952
- ((aborted || that._trigger(
953
- 'send',
954
- $.Event('send', {delegatedEvent: e}),
955
- options
956
- ) === false) &&
957
- that._getXHRPromise(false, options.context, aborted)) ||
958
- that._chunkedUpload(options) || $.ajax(options)
959
- ).done(function (result, textStatus, jqXHR) {
960
- that._onDone(result, textStatus, jqXHR, options);
961
- }).fail(function (jqXHR, textStatus, errorThrown) {
962
- that._onFail(jqXHR, textStatus, errorThrown, options);
963
- }).always(function (jqXHRorResult, textStatus, jqXHRorError) {
964
- that._deinitProgressListener(options);
965
- that._onAlways(
966
- jqXHRorResult,
967
- textStatus,
968
- jqXHRorError,
969
- options
970
- );
971
- that._sending -= 1;
972
- that._active -= 1;
973
- if (options.limitConcurrentUploads &&
974
- options.limitConcurrentUploads > that._sending) {
975
- // Start the next queued upload,
976
- // that has not been aborted:
977
- var nextSlot = that._slots.shift();
978
- while (nextSlot) {
979
- if (that._getDeferredState(nextSlot) === 'pending') {
980
- nextSlot.resolve();
981
- break;
982
- }
983
- nextSlot = that._slots.shift();
984
- }
985
- }
986
- if (that._active === 0) {
987
- // The stop callback is triggered when all uploads have
988
- // been completed, equivalent to the global ajaxStop event:
989
- that._trigger('stop');
990
- }
991
- });
992
- return jqXHR;
993
- };
994
- this._beforeSend(e, options);
995
- if (this.options.sequentialUploads ||
996
- (this.options.limitConcurrentUploads &&
997
- this.options.limitConcurrentUploads <= this._sending)) {
998
- if (this.options.limitConcurrentUploads > 1) {
999
- slot = $.Deferred();
1000
- this._slots.push(slot);
1001
- pipe = slot.then(send);
1002
- } else {
1003
- this._sequence = this._sequence.then(send, send);
1004
- pipe = this._sequence;
1005
- }
1006
- // Return the piped Promise object, enhanced with an abort method,
1007
- // which is delegated to the jqXHR object of the current upload,
1008
- // and jqXHR callbacks mapped to the equivalent Promise methods:
1009
- pipe.abort = function () {
1010
- aborted = [undefined, 'abort', 'abort'];
1011
- if (!jqXHR) {
1012
- if (slot) {
1013
- slot.rejectWith(options.context, aborted);
1014
- }
1015
- return send();
1016
- }
1017
- return jqXHR.abort();
1018
- };
1019
- return this._enhancePromise(pipe);
1020
- }
1021
- return send();
1022
- },
1023
-
1024
- _onAdd: function (e, data) {
1025
- var that = this,
1026
- result = true,
1027
- options = $.extend({}, this.options, data),
1028
- files = data.files,
1029
- filesLength = files.length,
1030
- limit = options.limitMultiFileUploads,
1031
- limitSize = options.limitMultiFileUploadSize,
1032
- overhead = options.limitMultiFileUploadSizeOverhead,
1033
- batchSize = 0,
1034
- paramName = this._getParamName(options),
1035
- paramNameSet,
1036
- paramNameSlice,
1037
- fileSet,
1038
- i,
1039
- j = 0;
1040
- if (!filesLength) {
1041
- return false;
1042
- }
1043
- if (limitSize && files[0].size === undefined) {
1044
- limitSize = undefined;
1045
- }
1046
- if (!(options.singleFileUploads || limit || limitSize) ||
1047
- !this._isXHRUpload(options)) {
1048
- fileSet = [files];
1049
- paramNameSet = [paramName];
1050
- } else if (!(options.singleFileUploads || limitSize) && limit) {
1051
- fileSet = [];
1052
- paramNameSet = [];
1053
- for (i = 0; i < filesLength; i += limit) {
1054
- fileSet.push(files.slice(i, i + limit));
1055
- paramNameSlice = paramName.slice(i, i + limit);
1056
- if (!paramNameSlice.length) {
1057
- paramNameSlice = paramName;
1058
- }
1059
- paramNameSet.push(paramNameSlice);
1060
- }
1061
- } else if (!options.singleFileUploads && limitSize) {
1062
- fileSet = [];
1063
- paramNameSet = [];
1064
- for (i = 0; i < filesLength; i = i + 1) {
1065
- batchSize += files[i].size + overhead;
1066
- if (i + 1 === filesLength ||
1067
- ((batchSize + files[i + 1].size + overhead) > limitSize) ||
1068
- (limit && i + 1 - j >= limit)) {
1069
- fileSet.push(files.slice(j, i + 1));
1070
- paramNameSlice = paramName.slice(j, i + 1);
1071
- if (!paramNameSlice.length) {
1072
- paramNameSlice = paramName;
1073
- }
1074
- paramNameSet.push(paramNameSlice);
1075
- j = i + 1;
1076
- batchSize = 0;
1077
- }
1078
- }
1079
- } else {
1080
- paramNameSet = paramName;
1081
- }
1082
- data.originalFiles = files;
1083
- $.each(fileSet || files, function (index, element) {
1084
- var newData = $.extend({}, data);
1085
- newData.files = fileSet ? element : [element];
1086
- newData.paramName = paramNameSet[index];
1087
- that._initResponseObject(newData);
1088
- that._initProgressObject(newData);
1089
- that._addConvenienceMethods(e, newData);
1090
- result = that._trigger(
1091
- 'add',
1092
- $.Event('add', {delegatedEvent: e}),
1093
- newData
1094
- );
1095
- return result;
1096
  });
1097
- return result;
1098
- },
1099
-
1100
- _replaceFileInput: function (data) {
1101
- var input = data.fileInput,
1102
- inputClone = input.clone(true),
1103
- restoreFocus = input.is(document.activeElement);
1104
- // Add a reference for the new cloned file input to the data argument:
1105
- data.fileInputClone = inputClone;
1106
- $('<form></form>').append(inputClone)[0].reset();
1107
- // Detaching allows to insert the fileInput on another form
1108
- // without loosing the file input value:
1109
- input.after(inputClone).detach();
1110
- // If the fileInput had focus before it was detached,
1111
- // restore focus to the inputClone.
1112
- if (restoreFocus) {
1113
- inputClone.focus();
1114
- }
1115
- // Avoid memory leaks with the detached file input:
1116
- $.cleanData(input.unbind('remove'));
1117
- // Replace the original file input element in the fileInput
1118
- // elements set with the clone, which has been copied including
1119
- // event handlers:
1120
- this.options.fileInput = this.options.fileInput.map(function (i, el) {
1121
- if (el === input[0]) {
1122
- return inputClone[0];
1123
- }
1124
- return el;
1125
  });
1126
- // If the widget has been initialized on the file input itself,
1127
- // override this.element with the file input clone:
1128
- if (input[0] === this.element[0]) {
1129
- this.element = inputClone;
1130
- }
1131
- },
1132
-
1133
- _handleFileTreeEntry: function (entry, path) {
1134
- var that = this,
1135
- dfd = $.Deferred(),
1136
- entries = [],
1137
- dirReader,
1138
- errorHandler = function (e) {
1139
- if (e && !e.entry) {
1140
- e.entry = entry;
1141
- }
1142
- // Since $.when returns immediately if one
1143
- // Deferred is rejected, we use resolve instead.
1144
- // This allows valid files and invalid items
1145
- // to be returned together in one set:
1146
- dfd.resolve([e]);
1147
- },
1148
- successHandler = function (entries) {
1149
- that._handleFileTreeEntries(
1150
- entries,
1151
- path + entry.name + '/'
1152
- ).done(function (files) {
1153
- dfd.resolve(files);
1154
- }).fail(errorHandler);
1155
- },
1156
- readEntries = function () {
1157
- dirReader.readEntries(function (results) {
1158
- if (!results.length) {
1159
- successHandler(entries);
1160
- } else {
1161
- entries = entries.concat(results);
1162
- readEntries();
1163
- }
1164
- }, errorHandler);
1165
- };
1166
- path = path || '';
1167
- if (entry.isFile) {
1168
- if (entry._file) {
1169
- // Workaround for Chrome bug #149735
1170
- entry._file.relativePath = path;
1171
- dfd.resolve(entry._file);
1172
- } else {
1173
- entry.file(function (file) {
1174
- file.relativePath = path;
1175
- dfd.resolve(file);
1176
- }, errorHandler);
1177
  }
1178
- } else if (entry.isDirectory) {
1179
- dirReader = entry.createReader();
1180
- readEntries();
1181
- } else {
1182
- // Return an empty list for file system items
1183
- // other than files or directories:
1184
- dfd.resolve([]);
1185
- }
1186
- return dfd.promise();
1187
- },
1188
-
1189
- _handleFileTreeEntries: function (entries, path) {
1190
- var that = this;
1191
- return $.when.apply(
1192
- $,
1193
- $.map(entries, function (entry) {
1194
- return that._handleFileTreeEntry(entry, path);
1195
- })
1196
- ).then(function () {
1197
- return Array.prototype.concat.apply(
1198
- [],
1199
- arguments
1200
  );
 
1201
  });
1202
- },
1203
-
1204
- _getDroppedFiles: function (dataTransfer) {
1205
- dataTransfer = dataTransfer || {};
1206
- var items = dataTransfer.items;
1207
- if (items && items.length && (items[0].webkitGetAsEntry ||
1208
- items[0].getAsEntry)) {
1209
- return this._handleFileTreeEntries(
1210
- $.map(items, function (item) {
1211
- var entry;
1212
- if (item.webkitGetAsEntry) {
1213
- entry = item.webkitGetAsEntry();
1214
- if (entry) {
1215
- // Workaround for Chrome bug #149735:
1216
- entry._file = item.getAsFile();
1217
- }
1218
- return entry;
1219
- }
1220
- return item.getAsEntry();
1221
- })
1222
- );
1223
- }
1224
- return $.Deferred().resolve(
1225
- $.makeArray(dataTransfer.files)
1226
- ).promise();
1227
- },
1228
-
1229
- _getSingleFileInputFiles: function (fileInput) {
1230
- fileInput = $(fileInput);
1231
- var entries = fileInput.prop('webkitEntries') ||
1232
- fileInput.prop('entries'),
1233
- files,
1234
- value;
1235
- if (entries && entries.length) {
1236
- return this._handleFileTreeEntries(entries);
1237
- }
1238
- files = $.makeArray(fileInput.prop('files'));
1239
- if (!files.length) {
1240
- value = fileInput.prop('value');
1241
- if (!value) {
1242
- return $.Deferred().resolve([]).promise();
1243
- }
1244
- // If the files property is not available, the browser does not
1245
- // support the File API and we add a pseudo File object with
1246
- // the input value as name with path information removed:
1247
- files = [{name: value.replace(/^.*\\/, '')}];
1248
- } else if (files[0].name === undefined && files[0].fileName) {
1249
- // File normalization for Safari 4 and Firefox 3:
1250
- $.each(files, function (index, file) {
1251
- file.name = file.fileName;
1252
- file.size = file.fileSize;
1253
- });
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1254
  }
1255
- return $.Deferred().resolve(files).promise();
1256
- },
1257
-
1258
- _getFileInputFiles: function (fileInput) {
1259
- if (!(fileInput instanceof $) || fileInput.length === 1) {
1260
- return this._getSingleFileInputFiles(fileInput);
 
 
 
 
 
 
1261
  }
1262
- return $.when.apply(
1263
- $,
1264
- $.map(fileInput, this._getSingleFileInputFiles)
1265
- ).then(function () {
1266
- return Array.prototype.concat.apply(
1267
- [],
1268
- arguments
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1269
  );
1270
- });
1271
- },
1272
-
1273
- _onChange: function (e) {
1274
- var that = this,
1275
- data = {
1276
- fileInput: $(e.target),
1277
- form: $(e.target.form)
1278
- };
1279
- this._getFileInputFiles(data.fileInput).always(function (files) {
1280
- data.files = files;
1281
- if (that.options.replaceFileInput) {
1282
- that._replaceFileInput(data);
1283
- }
1284
- if (that._trigger(
1285
- 'change',
1286
- $.Event('change', {delegatedEvent: e}),
1287
- data
1288
- ) !== false) {
1289
- that._onAdd(e, data);
1290
- }
1291
- });
1292
- },
1293
-
1294
- _onPaste: function (e) {
1295
- var items = e.originalEvent && e.originalEvent.clipboardData &&
1296
- e.originalEvent.clipboardData.items,
1297
- data = {files: []};
1298
- if (items && items.length) {
1299
- $.each(items, function (index, item) {
1300
- var file = item.getAsFile && item.getAsFile();
1301
- if (file) {
1302
- data.files.push(file);
1303
  }
1304
- });
1305
- if (this._trigger(
1306
- 'paste',
1307
- $.Event('paste', {delegatedEvent: e}),
1308
- data
1309
- ) !== false) {
1310
- this._onAdd(e, data);
1311
  }
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1312
  }
1313
- },
1314
-
1315
- _onDrop: function (e) {
1316
- e.dataTransfer = e.originalEvent && e.originalEvent.dataTransfer;
1317
- var that = this,
1318
- dataTransfer = e.dataTransfer,
1319
- data = {};
1320
- if (dataTransfer && dataTransfer.files && dataTransfer.files.length) {
1321
- e.preventDefault();
1322
- this._getDroppedFiles(dataTransfer).always(function (files) {
1323
- data.files = files;
1324
- if (that._trigger(
1325
- 'drop',
1326
- $.Event('drop', {delegatedEvent: e}),
1327
- data
1328
- ) !== false) {
1329
- that._onAdd(e, data);
1330
- }
1331
- });
1332
- }
1333
- },
1334
-
1335
- _onDragOver: getDragHandler('dragover'),
1336
-
1337
- _onDragEnter: getDragHandler('dragenter'),
1338
-
1339
- _onDragLeave: getDragHandler('dragleave'),
1340
-
1341
- _initEventHandlers: function () {
1342
- if (this._isXHRUpload(this.options)) {
1343
- this._on(this.options.dropZone, {
1344
- dragover: this._onDragOver,
1345
- drop: this._onDrop,
1346
- // event.preventDefault() on dragenter is required for IE10+:
1347
- dragenter: this._onDragEnter,
1348
- // dragleave is not required, but added for completeness:
1349
- dragleave: this._onDragLeave
1350
- });
1351
- this._on(this.options.pasteZone, {
1352
- paste: this._onPaste
1353
- });
1354
- }
1355
- if ($.support.fileInput) {
1356
- this._on(this.options.fileInput, {
1357
- change: this._onChange
1358
- });
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1359
  }
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1360
  },
1361
-
1362
- _destroyEventHandlers: function () {
1363
- this._off(this.options.dropZone, 'dragenter dragleave dragover drop');
1364
- this._off(this.options.pasteZone, 'paste');
1365
- this._off(this.options.fileInput, 'change');
1366
- },
1367
-
1368
- _destroy: function () {
1369
- this._destroyEventHandlers();
1370
  },
1371
-
1372
- _setOption: function (key, value) {
1373
- var reinit = $.inArray(key, this._specialOptions) !== -1;
1374
- if (reinit) {
1375
- this._destroyEventHandlers();
 
 
1376
  }
1377
- this._super(key, value);
1378
- if (reinit) {
1379
- this._initSpecialOptions();
1380
- this._initEventHandlers();
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1381
  }
1382
- },
1383
-
1384
- _initSpecialOptions: function () {
1385
- var options = this.options;
1386
- if (options.fileInput === undefined) {
1387
- options.fileInput = this.element.is('input[type="file"]') ?
1388
- this.element : this.element.find('input[type="file"]');
1389
- } else if (!(options.fileInput instanceof $)) {
1390
- options.fileInput = $(options.fileInput);
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1391
  }
1392
- if (!(options.dropZone instanceof $)) {
1393
- options.dropZone = $(options.dropZone);
 
 
 
 
1394
  }
1395
- if (!(options.pasteZone instanceof $)) {
1396
- options.pasteZone = $(options.pasteZone);
 
1397
  }
1398
- },
1399
-
1400
- _getRegExp: function (str) {
1401
- var parts = str.split('/'),
1402
- modifiers = parts.pop();
1403
- parts.shift();
1404
- return new RegExp(parts.join('/'), modifiers);
1405
- },
1406
-
1407
- _isRegExpOption: function (key, value) {
1408
- return key !== 'url' && $.type(value) === 'string' &&
1409
- /^\/.*\/[igm]{0,3}$/.test(value);
1410
- },
1411
-
1412
- _initDataAttributes: function () {
1413
- var that = this,
1414
- options = this.options,
1415
- data = this.element.data();
1416
- // Initialize options set via HTML5 data-attributes:
1417
- $.each(
1418
- this.element[0].attributes,
1419
- function (index, attr) {
1420
- var key = attr.name.toLowerCase(),
1421
- value;
1422
- if (/^data-/.test(key)) {
1423
- // Convert hyphen-ated key to camelCase:
1424
- key = key.slice(5).replace(/-[a-z]/g, function (str) {
1425
- return str.charAt(1).toUpperCase();
1426
- });
1427
- value = data[key];
1428
- if (that._isRegExpOption(key, value)) {
1429
- value = that._getRegExp(value);
1430
- }
1431
- options[key] = value;
1432
- }
1433
- }
1434
  );
1435
- },
1436
-
1437
- _create: function () {
1438
- this._initDataAttributes();
1439
- this._initSpecialOptions();
1440
- this._slots = [];
1441
- this._sequence = this._getXHRPromise(true);
1442
- this._sending = this._active = 0;
1443
- this._initProgressObject(this);
1444
- this._initEventHandlers();
1445
- },
1446
-
1447
- // This method is exposed to the widget API and allows to query
1448
- // the number of active uploads:
1449
- active: function () {
1450
- return this._active;
1451
- },
1452
-
1453
- // This method is exposed to the widget API and allows to query
1454
- // the widget upload progress.
1455
- // It returns an object with loaded, total and bitrate properties
1456
- // for the running uploads:
1457
- progress: function () {
1458
- return this._progress;
1459
- },
1460
-
1461
- // This method is exposed to the widget API and allows adding files
1462
- // using the fileupload API. The data parameter accepts an object which
1463
- // must have a files property and can contain additional options:
1464
- // .fileupload('add', {files: filesList});
1465
- add: function (data) {
1466
- var that = this;
1467
- if (!data || this.options.disabled) {
1468
- return;
1469
- }
1470
- if (data.fileInput && !data.files) {
1471
- this._getFileInputFiles(data.fileInput).always(function (files) {
1472
- data.files = files;
1473
- that._onAdd(null, data);
1474
- });
1475
- } else {
1476
- data.files = $.makeArray(data.files);
1477
- this._onAdd(null, data);
1478
- }
1479
- },
1480
-
1481
- // This method is exposed to the widget API and allows sending files
1482
- // using the fileupload API. The data parameter accepts an object which
1483
- // must have a files or fileInput property and can contain additional options:
1484
- // .fileupload('send', {files: filesList});
1485
- // The method returns a Promise object for the file upload call.
1486
- send: function (data) {
1487
- if (data && !this.options.disabled) {
1488
- if (data.fileInput && !data.files) {
1489
- var that = this,
1490
- dfd = $.Deferred(),
1491
- promise = dfd.promise(),
1492
- jqXHR,
1493
- aborted;
1494
- promise.abort = function () {
1495
- aborted = true;
1496
- if (jqXHR) {
1497
- return jqXHR.abort();
1498
- }
1499
- dfd.reject(null, 'abort', 'abort');
1500
- return promise;
1501
- };
1502
- this._getFileInputFiles(data.fileInput).always(
1503
- function (files) {
1504
- if (aborted) {
1505
- return;
1506
- }
1507
- if (!files.length) {
1508
- dfd.reject();
1509
- return;
1510
- }
1511
- data.files = files;
1512
- jqXHR = that._onSend(null, data);
1513
- jqXHR.then(
1514
- function (result, textStatus, jqXHR) {
1515
- dfd.resolve(result, textStatus, jqXHR);
1516
- },
1517
- function (jqXHR, textStatus, errorThrown) {
1518
- dfd.reject(jqXHR, textStatus, errorThrown);
1519
- }
1520
- );
1521
- }
1522
- );
1523
- return this._enhancePromise(promise);
1524
- }
1525
- data.files = $.makeArray(data.files);
1526
- if (data.files.length) {
1527
- return this._onSend(null, data);
1528
- }
1529
- }
1530
- return this._getXHRPromise(false, data && data.context);
1531
  }
1532
-
1533
- });
1534
-
1535
- }));
 
 
 
 
 
1
  /*
2
+ * jQuery File Upload Plugin 10.2.0
3
  * https://github.com/blueimp/jQuery-File-Upload
4
  *
5
  * Copyright 2010, Sebastian Tschan
9
  * https://opensource.org/licenses/MIT
10
  */
11
 
12
+ /* global define, require */
13
+ /* eslint-disable new-cap */
14
+
15
+ (function(factory) {
16
+ 'use strict';
17
+ if (typeof define === 'function' && define.amd) {
18
+ // Register as an anonymous AMD module:
19
+ define(['jquery', 'jquery-ui/ui/widget'], factory);
20
+ } else if (typeof exports === 'object') {
21
+ // Node/CommonJS:
22
+ factory(require('jquery'), require('./vendor/jquery.ui.widget'));
23
+ } else {
24
+ // Browser globals:
25
+ factory(window.jQuery);
26
+ }
27
+ })(function($) {
28
+ 'use strict';
29
+
30
+ // Detect file input support, based on
31
+ // https://viljamis.com/2012/file-upload-support-on-mobile/
32
+ $.support.fileInput = !(
33
+ new RegExp(
34
+ // Handle devices which give false positives for the feature detection:
35
+ '(Android (1\\.[0156]|2\\.[01]))' +
36
+ '|(Windows Phone (OS 7|8\\.0))|(XBLWP)|(ZuneWP)|(WPDesktop)' +
37
+ '|(w(eb)?OSBrowser)|(webOS)' +
38
+ '|(Kindle/(1\\.0|2\\.[05]|3\\.0))'
 
 
 
 
 
39
  ).test(window.navigator.userAgent) ||
40
+ // Feature detection for all other devices:
41
+ $('<input type="file"/>').prop('disabled')
42
+ );
43
+
44
+ // The FileReader API is not actually used, but works as feature detection,
45
+ // as some Safari versions (5?) support XHR file uploads via the FormData API,
46
+ // but not non-multipart XHR file uploads.
47
+ // window.XMLHttpRequestUpload is not available on IE10, so we check for
48
+ // window.ProgressEvent instead to detect XHR2 file upload capability:
49
+ $.support.xhrFileUpload = !!(window.ProgressEvent && window.FileReader);
50
+ $.support.xhrFormDataFileUpload = !!window.FormData;
51
+
52
+ // Detect support for Blob slicing (required for chunked uploads):
53
+ $.support.blobSlice =
54
+ window.Blob &&
55
+ (Blob.prototype.slice ||
56
+ Blob.prototype.webkitSlice ||
57
+ Blob.prototype.mozSlice);
58
+
59
+ /**
60
+ * Helper function to create drag handlers for dragover/dragenter/dragleave
61
+ *
62
+ * @param {string} type Event type
63
+ * @returns {Function} Drag handler
64
+ */
65
+ function getDragHandler(type) {
66
+ var isDragOver = type === 'dragover';
67
+ return function(e) {
68
+ e.dataTransfer = e.originalEvent && e.originalEvent.dataTransfer;
69
+ var dataTransfer = e.dataTransfer;
70
+ if (
71
+ dataTransfer &&
72
+ $.inArray('Files', dataTransfer.types) !== -1 &&
73
+ this._trigger(type, $.Event(type, { delegatedEvent: e })) !== false
74
+ ) {
75
+ e.preventDefault();
76
+ if (isDragOver) {
77
+ dataTransfer.dropEffect = 'copy';
78
+ }
79
+ }
80
+ };
81
+ }
82
+
83
+ // The fileupload widget listens for change events on file input fields defined
84
+ // via fileInput setting and paste or drop events of the given dropZone.
85
+ // In addition to the default jQuery Widget methods, the fileupload widget
86
+ // exposes the "add" and "send" methods, to add or directly send files using
87
+ // the fileupload API.
88
+ // By default, files added via file input selection, paste, drag & drop or
89
+ // "add" method are uploaded immediately, but it is possible to override
90
+ // the "add" callback option to queue file uploads.
91
+ $.widget('blueimp.fileupload', {
92
+ options: {
93
+ // The drop target element(s), by the default the complete document.
94
+ // Set to null to disable drag & drop support:
95
+ dropZone: $(document),
96
+ // The paste target element(s), by the default undefined.
97
+ // Set to a DOM node or jQuery object to enable file pasting:
98
+ pasteZone: undefined,
99
+ // The file input field(s), that are listened to for change events.
100
+ // If undefined, it is set to the file input fields inside
101
+ // of the widget element on plugin initialization.
102
+ // Set to null to disable the change listener.
103
+ fileInput: undefined,
104
+ // By default, the file input field is replaced with a clone after
105
+ // each input field change event. This is required for iframe transport
106
+ // queues and allows change events to be fired for the same file
107
+ // selection, but can be disabled by setting the following option to false:
108
+ replaceFileInput: true,
109
+ // The parameter name for the file form data (the request argument name).
110
+ // If undefined or empty, the name property of the file input field is
111
+ // used, or "files[]" if the file input name property is also empty,
112
+ // can be a string or an array of strings:
113
+ paramName: undefined,
114
+ // By default, each file of a selection is uploaded using an individual
115
+ // request for XHR type uploads. Set to false to upload file
116
+ // selections in one request each:
117
+ singleFileUploads: true,
118
+ // To limit the number of files uploaded with one XHR request,
119
+ // set the following option to an integer greater than 0:
120
+ limitMultiFileUploads: undefined,
121
+ // The following option limits the number of files uploaded with one
122
+ // XHR request to keep the request size under or equal to the defined
123
+ // limit in bytes:
124
+ limitMultiFileUploadSize: undefined,
125
+ // Multipart file uploads add a number of bytes to each uploaded file,
126
+ // therefore the following option adds an overhead for each file used
127
+ // in the limitMultiFileUploadSize configuration:
128
+ limitMultiFileUploadSizeOverhead: 512,
129
+ // Set the following option to true to issue all file upload requests
130
+ // in a sequential order:
131
+ sequentialUploads: false,
132
+ // To limit the number of concurrent uploads,
133
+ // set the following option to an integer greater than 0:
134
+ limitConcurrentUploads: undefined,
135
+ // Set the following option to true to force iframe transport uploads:
136
+ forceIframeTransport: false,
137
+ // Set the following option to the location of a redirect url on the
138
+ // origin server, for cross-domain iframe transport uploads:
139
+ redirect: undefined,
140
+ // The parameter name for the redirect url, sent as part of the form
141
+ // data and set to 'redirect' if this option is empty:
142
+ redirectParamName: undefined,
143
+ // Set the following option to the location of a postMessage window,
144
+ // to enable postMessage transport uploads:
145
+ postMessage: undefined,
146
+ // By default, XHR file uploads are sent as multipart/form-data.
147
+ // The iframe transport is always using multipart/form-data.
148
+ // Set to false to enable non-multipart XHR uploads:
149
+ multipart: true,
150
+ // To upload large files in smaller chunks, set the following option
151
+ // to a preferred maximum chunk size. If set to 0, null or undefined,
152
+ // or the browser does not support the required Blob API, files will
153
+ // be uploaded as a whole.
154
+ maxChunkSize: undefined,
155
+ // When a non-multipart upload or a chunked multipart upload has been
156
+ // aborted, this option can be used to resume the upload by setting
157
+ // it to the size of the already uploaded bytes. This option is most
158
+ // useful when modifying the options object inside of the "add" or
159
+ // "send" callbacks, as the options are cloned for each file upload.
160
+ uploadedBytes: undefined,
161
+ // By default, failed (abort or error) file uploads are removed from the
162
+ // global progress calculation. Set the following option to false to
163
+ // prevent recalculating the global progress data:
164
+ recalculateProgress: true,
165
+ // Interval in milliseconds to calculate and trigger progress events:
166
+ progressInterval: 100,
167
+ // Interval in milliseconds to calculate progress bitrate:
168
+ bitrateInterval: 500,
169
+ // By default, uploads are started automatically when adding files:
170
+ autoUpload: true,
171
+ // By default, duplicate file names are expected to be handled on
172
+ // the server-side. If this is not possible (e.g. when uploading
173
+ // files directly to Amazon S3), the following option can be set to
174
+ // an empty object or an object mapping existing filenames, e.g.:
175
+ // { "image.jpg": true, "image (1).jpg": true }
176
+ // If it is set, all files will be uploaded with unique filenames,
177
+ // adding increasing number suffixes if necessary, e.g.:
178
+ // "image (2).jpg"
179
+ uniqueFilenames: undefined,
180
+
181
+ // Error and info messages:
182
+ messages: {
183
+ uploadedBytes: 'Uploaded bytes exceed file size'
184
+ },
185
+
186
+ // Translation function, gets the message key to be translated
187
+ // and an object with context specific data as arguments:
188
+ i18n: function(message, context) {
189
+ // eslint-disable-next-line no-param-reassign
190
+ message = this.messages[message] || message.toString();
191
+ if (context) {
192
+ $.each(context, function(key, value) {
193
+ // eslint-disable-next-line no-param-reassign
194
+ message = message.replace('{' + key + '}', value);
195
+ });
196
+ }
197
+ return message;
198
+ },
199
+
200
+ // Additional form data to be sent along with the file uploads can be set
201
+ // using this option, which accepts an array of objects with name and
202
+ // value properties, a function returning such an array, a FormData
203
+ // object (for XHR file uploads), or a simple object.
204
+ // The form of the first fileInput is given as parameter to the function:
205
+ formData: function(form) {
206
+ return form.serializeArray();
207
+ },
208
+
209
+ // The add callback is invoked as soon as files are added to the fileupload
210
+ // widget (via file input selection, drag & drop, paste or add API call).
211
+ // If the singleFileUploads option is enabled, this callback will be
212
+ // called once for each file in the selection for XHR file uploads, else
213
+ // once for each file selection.
214
+ //
215
+ // The upload starts when the submit method is invoked on the data parameter.
216
+ // The data object contains a files property holding the added files
217
+ // and allows you to override plugin options as well as define ajax settings.
218
+ //
219
+ // Listeners for this callback can also be bound the following way:
220
+ // .bind('fileuploadadd', func);
221
+ //
222
+ // data.submit() returns a Promise object and allows to attach additional
223
+ // handlers using jQuery's Deferred callbacks:
224
+ // data.submit().done(func).fail(func).always(func);
225
+ add: function(e, data) {
226
+ if (e.isDefaultPrevented()) {
227
+ return false;
228
+ }
229
+ if (
230
+ data.autoUpload ||
231
+ (data.autoUpload !== false &&
232
+ $(this).fileupload('option', 'autoUpload'))
233
+ ) {
234
+ data.process().done(function() {
235
+ data.submit();
236
+ });
237
+ }
238
+ },
239
 
240
+ // Other callbacks:
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
241
 
242
+ // Callback for the submit event of each file upload:
243
+ // submit: function (e, data) {}, // .bind('fileuploadsubmit', func);
244
 
245
+ // Callback for the start of each file upload request:
246
+ // send: function (e, data) {}, // .bind('fileuploadsend', func);
247
 
248
+ // Callback for successful uploads:
249
+ // done: function (e, data) {}, // .bind('fileuploaddone', func);
250
 
251
+ // Callback for failed (abort or error) uploads:
252
+ // fail: function (e, data) {}, // .bind('fileuploadfail', func);
253
 
254
+ // Callback for completed (success, abort or error) requests:
255
+ // always: function (e, data) {}, // .bind('fileuploadalways', func);
256
 
257
+ // Callback for upload progress events:
258
+ // progress: function (e, data) {}, // .bind('fileuploadprogress', func);
259
 
260
+ // Callback for global upload progress events:
261
+ // progressall: function (e, data) {}, // .bind('fileuploadprogressall', func);
262
 
263
+ // Callback for uploads start, equivalent to the global ajaxStart event:
264
+ // start: function (e) {}, // .bind('fileuploadstart', func);
265
 
266
+ // Callback for uploads stop, equivalent to the global ajaxStop event:
267
+ // stop: function (e) {}, // .bind('fileuploadstop', func);
268
 
269
+ // Callback for change events of the fileInput(s):
270
+ // change: function (e, data) {}, // .bind('fileuploadchange', func);
271
 
272
+ // Callback for paste events to the pasteZone(s):
273
+ // paste: function (e, data) {}, // .bind('fileuploadpaste', func);
274
 
275
+ // Callback for drop events of the dropZone(s):
276
+ // drop: function (e, data) {}, // .bind('fileuploaddrop', func);
277
 
278
+ // Callback for dragover events of the dropZone(s):
279
+ // dragover: function (e) {}, // .bind('fileuploaddragover', func);
280
 
281
+ // Callback before the start of each chunk upload request (before form data initialization):
282
+ // chunkbeforesend: function (e, data) {}, // .bind('fileuploadchunkbeforesend', func);
283
 
284
+ // Callback for the start of each chunk upload request:
285
+ // chunksend: function (e, data) {}, // .bind('fileuploadchunksend', func);
286
 
287
+ // Callback for successful chunk uploads:
288
+ // chunkdone: function (e, data) {}, // .bind('fileuploadchunkdone', func);
289
 
290
+ // Callback for failed (abort or error) chunk uploads:
291
+ // chunkfail: function (e, data) {}, // .bind('fileuploadchunkfail', func);
292
 
293
+ // Callback for completed (success, abort or error) chunk upload requests:
294
+ // chunkalways: function (e, data) {}, // .bind('fileuploadchunkalways', func);
295
 
296
+ // The plugin options are used as settings object for the ajax calls.
297
+ // The following are jQuery ajax settings required for the file uploads:
298
+ processData: false,
299
+ contentType: false,
300
+ cache: false,
301
+ timeout: 0
302
+ },
303
 
304
+ // A list of options that require reinitializing event listeners and/or
305
+ // special initialization code:
306
+ _specialOptions: [
307
+ 'fileInput',
308
+ 'dropZone',
309
+ 'pasteZone',
310
+ 'multipart',
311
+ 'forceIframeTransport'
312
+ ],
313
 
314
+ _blobSlice:
315
+ $.support.blobSlice &&
316
+ function() {
317
+ var slice = this.slice || this.webkitSlice || this.mozSlice;
318
+ return slice.apply(this, arguments);
319
+ },
 
 
 
 
 
 
 
 
320
 
321
+ _BitrateTimer: function() {
322
+ this.timestamp = Date.now ? Date.now() : new Date().getTime();
323
+ this.loaded = 0;
324
+ this.bitrate = 0;
325
+ this.getBitrate = function(now, loaded, interval) {
326
+ var timeDiff = now - this.timestamp;
327
+ if (!this.bitrate || !interval || timeDiff > interval) {
328
+ this.bitrate = (loaded - this.loaded) * (1000 / timeDiff) * 8;
329
+ this.loaded = loaded;
330
+ this.timestamp = now;
331
+ }
332
+ return this.bitrate;
333
+ };
334
+ },
335
+
336
+ _isXHRUpload: function(options) {
337
+ return (
338
+ !options.forceIframeTransport &&
339
+ ((!options.multipart && $.support.xhrFileUpload) ||
340
+ $.support.xhrFormDataFileUpload)
341
+ );
342
+ },
343
+
344
+ _getFormData: function(options) {
345
+ var formData;
346
+ if ($.type(options.formData) === 'function') {
347
+ return options.formData(options.form);
348
+ }
349
+ if ($.isArray(options.formData)) {
350
+ return options.formData;
351
+ }
352
+ if ($.type(options.formData) === 'object') {
353
+ formData = [];
354
+ $.each(options.formData, function(name, value) {
355
+ formData.push({ name: name, value: value });
356
+ });
357
+ return formData;
358
+ }
359
+ return [];
360
+ },
361
+
362
+ _getTotal: function(files) {
363
+ var total = 0;
364
+ $.each(files, function(index, file) {
365
+ total += file.size || 1;
366
+ });
367
+ return total;
368
+ },
369
+
370
+ _initProgressObject: function(obj) {
371
+ var progress = {
372
+ loaded: 0,
373
+ total: 0,
374
+ bitrate: 0
375
+ };
376
+ if (obj._progress) {
377
+ $.extend(obj._progress, progress);
378
+ } else {
379
+ obj._progress = progress;
380
+ }
381
+ },
382
+
383
+ _initResponseObject: function(obj) {
384
+ var prop;
385
+ if (obj._response) {
386
+ for (prop in obj._response) {
387
+ if (Object.prototype.hasOwnProperty.call(obj._response, prop)) {
388
+ delete obj._response[prop];
389
+ }
390
+ }
391
+ } else {
392
+ obj._response = {};
393
+ }
394
+ },
395
+
396
+ _onProgress: function(e, data) {
397
+ if (e.lengthComputable) {
398
+ var now = Date.now ? Date.now() : new Date().getTime(),
399
+ loaded;
400
+ if (
401
+ data._time &&
402
+ data.progressInterval &&
403
+ now - data._time < data.progressInterval &&
404
+ e.loaded !== e.total
405
+ ) {
406
+ return;
407
+ }
408
+ data._time = now;
409
+ loaded =
410
+ Math.floor(
411
+ (e.loaded / e.total) * (data.chunkSize || data._progress.total)
412
+ ) + (data.uploadedBytes || 0);
413
+ // Add the difference from the previously loaded state
414
+ // to the global loaded counter:
415
+ this._progress.loaded += loaded - data._progress.loaded;
416
+ this._progress.bitrate = this._bitrateTimer.getBitrate(
417
+ now,
418
+ this._progress.loaded,
419
+ data.bitrateInterval
420
+ );
421
+ data._progress.loaded = data.loaded = loaded;
422
+ data._progress.bitrate = data.bitrate = data._bitrateTimer.getBitrate(
423
+ now,
424
+ loaded,
425
+ data.bitrateInterval
426
+ );
427
+ // Trigger a custom progress event with a total data property set
428
+ // to the file size(s) of the current upload and a loaded data
429
+ // property calculated accordingly:
430
+ this._trigger(
431
+ 'progress',
432
+ $.Event('progress', { delegatedEvent: e }),
433
+ data
434
+ );
435
+ // Trigger a global progress event for all current file uploads,
436
+ // including ajax calls queued for sequential file uploads:
437
+ this._trigger(
438
+ 'progressall',
439
+ $.Event('progressall', { delegatedEvent: e }),
440
+ this._progress
441
+ );
442
+ }
443
+ },
444
+
445
+ _initProgressListener: function(options) {
446
+ var that = this,
447
+ xhr = options.xhr ? options.xhr() : $.ajaxSettings.xhr();
448
+ // Accesss to the native XHR object is required to add event listeners
449
+ // for the upload progress event:
450
+ if (xhr.upload) {
451
+ $(xhr.upload).bind('progress', function(e) {
452
+ var oe = e.originalEvent;
453
+ // Make sure the progress event properties get copied over:
454
+ e.lengthComputable = oe.lengthComputable;
455
+ e.loaded = oe.loaded;
456
+ e.total = oe.total;
457
+ that._onProgress(e, options);
458
+ });
459
+ options.xhr = function() {
460
+ return xhr;
461
+ };
462
+ }
463
+ },
464
+
465
+ _deinitProgressListener: function(options) {
466
+ var xhr = options.xhr ? options.xhr() : $.ajaxSettings.xhr();
467
+ if (xhr.upload) {
468
+ $(xhr.upload).unbind('progress');
469
+ }
470
+ },
471
+
472
+ _isInstanceOf: function(type, obj) {
473
+ // Cross-frame instanceof check
474
+ return Object.prototype.toString.call(obj) === '[object ' + type + ']';
475
+ },
476
+
477
+ _getUniqueFilename: function(name, map) {
478
+ // eslint-disable-next-line no-param-reassign
479
+ name = String(name);
480
+ if (map[name]) {
481
+ // eslint-disable-next-line no-param-reassign
482
+ name = name.replace(/(?: \(([\d]+)\))?(\.[^.]+)?$/, function(
483
+ _,
484
+ p1,
485
+ p2
486
+ ) {
487
+ var index = p1 ? Number(p1) + 1 : 1;
488
+ var ext = p2 || '';
489
+ return ' (' + index + ')' + ext;
490
+ });
491
+ return this._getUniqueFilename(name, map);
492
+ }
493
+ map[name] = true;
494
+ return name;
495
+ },
496
+
497
+ _initXHRData: function(options) {
498
+ var that = this,
499
+ formData,
500
+ file = options.files[0],
501
+ // Ignore non-multipart setting if not supported:
502
+ multipart = options.multipart || !$.support.xhrFileUpload,
503
+ paramName =
504
+ $.type(options.paramName) === 'array'
505
+ ? options.paramName[0]
506
+ : options.paramName;
507
+ options.headers = $.extend({}, options.headers);
508
+ if (options.contentRange) {
509
+ options.headers['Content-Range'] = options.contentRange;
510
+ }
511
+ if (!multipart || options.blob || !this._isInstanceOf('File', file)) {
512
+ options.headers['Content-Disposition'] =
513
+ 'attachment; filename="' +
514
+ encodeURI(file.uploadName || file.name) +
515
+ '"';
516
+ }
517
+ if (!multipart) {
518
+ options.contentType = file.type || 'application/octet-stream';
519
+ options.data = options.blob || file;
520
+ } else if ($.support.xhrFormDataFileUpload) {
521
+ if (options.postMessage) {
522
+ // window.postMessage does not allow sending FormData
523
+ // objects, so we just add the File/Blob objects to
524
+ // the formData array and let the postMessage window
525
+ // create the FormData object out of this array:
526
+ formData = this._getFormData(options);
527
+ if (options.blob) {
528
+ formData.push({
529
+ name: paramName,
530
+ value: options.blob
531
  });
532
+ } else {
533
+ $.each(options.files, function(index, file) {
534
+ formData.push({
535
+ name:
536
+ ($.type(options.paramName) === 'array' &&
537
+ options.paramName[index]) ||
538
+ paramName,
539
+ value: file
540
+ });
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
541
  });
542
+ }
543
+ } else {
544
+ if (that._isInstanceOf('FormData', options.formData)) {
545
+ formData = options.formData;
546
+ } else {
547
+ formData = new FormData();
548
+ $.each(this._getFormData(options), function(index, field) {
549
+ formData.append(field.name, field.value);
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
550
  });
551
+ }
552
+ if (options.blob) {
553
+ formData.append(
554
+ paramName,
555
+ options.blob,
556
+ file.uploadName || file.name
557
+ );
558
+ } else {
559
+ $.each(options.files, function(index, file) {
560
+ // This check allows the tests to run with
561
+ // dummy objects:
562
+ if (
563
+ that._isInstanceOf('File', file) ||
564
+ that._isInstanceOf('Blob', file)
565
+ ) {
566
+ var fileName = file.uploadName || file.name;
567
+ if (options.uniqueFilenames) {
568
+ fileName = that._getUniqueFilename(
569
+ fileName,
570
+ options.uniqueFilenames
571
+ );
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
572
  }
573
+ formData.append(
574
+ ($.type(options.paramName) === 'array' &&
575
+ options.paramName[index]) ||
576
+ paramName,
577
+ file,
578
+ fileName
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
579
  );
580
+ }
581
  });
582
+ }
583
+ }
584
+ options.data = formData;
585
+ }
586
+ // Blob reference is not needed anymore, free memory:
587
+ options.blob = null;
588
+ },
589
+
590
+ _initIframeSettings: function(options) {
591
+ var targetHost = $('<a></a>')
592
+ .prop('href', options.url)
593
+ .prop('host');
594
+ // Setting the dataType to iframe enables the iframe transport:
595
+ options.dataType = 'iframe ' + (options.dataType || '');
596
+ // The iframe transport accepts a serialized array as form data:
597
+ options.formData = this._getFormData(options);
598
+ // Add redirect url to form data on cross-domain uploads:
599
+ if (options.redirect && targetHost && targetHost !== location.host) {
600
+ options.formData.push({
601
+ name: options.redirectParamName || 'redirect',
602
+ value: options.redirect
603
+ });
604
+ }
605
+ },
606
+
607
+ _initDataSettings: function(options) {
608
+ if (this._isXHRUpload(options)) {
609
+ if (!this._chunkedUpload(options, true)) {
610
+ if (!options.data) {
611
+ this._initXHRData(options);
612
+ }
613
+ this._initProgressListener(options);
614
+ }
615
+ if (options.postMessage) {
616
+ // Setting the dataType to postmessage enables the
617
+ // postMessage transport:
618
+ options.dataType = 'postmessage ' + (options.dataType || '');
619
+ }
620
+ } else {
621
+ this._initIframeSettings(options);
622
+ }
623
+ },
624
+
625
+ _getParamName: function(options) {
626
+ var fileInput = $(options.fileInput),
627
+ paramName = options.paramName;
628
+ if (!paramName) {
629
+ paramName = [];
630
+ fileInput.each(function() {
631
+ var input = $(this),
632
+ name = input.prop('name') || 'files[]',
633
+ i = (input.prop('files') || [1]).length;
634
+ while (i) {
635
+ paramName.push(name);
636
+ i -= 1;
637
+ }
638
+ });
639
+ if (!paramName.length) {
640
+ paramName = [fileInput.prop('name') || 'files[]'];
641
+ }
642
+ } else if (!$.isArray(paramName)) {
643
+ paramName = [paramName];
644
+ }
645
+ return paramName;
646
+ },
647
+
648
+ _initFormSettings: function(options) {
649
+ // Retrieve missing options from the input field and the
650
+ // associated form, if available:
651
+ if (!options.form || !options.form.length) {
652
+ options.form = $(options.fileInput.prop('form'));
653
+ // If the given file input doesn't have an associated form,
654
+ // use the default widget file input's form:
655
+ if (!options.form.length) {
656
+ options.form = $(this.options.fileInput.prop('form'));
657
+ }
658
+ }
659
+ options.paramName = this._getParamName(options);
660
+ if (!options.url) {
661
+ options.url = options.form.prop('action') || location.href;
662
+ }
663
+ // The HTTP request method must be "POST" or "PUT":
664
+ options.type = (
665
+ options.type ||
666
+ ($.type(options.form.prop('method')) === 'string' &&
667
+ options.form.prop('method')) ||
668
+ ''
669
+ ).toUpperCase();
670
+ if (
671
+ options.type !== 'POST' &&
672
+ options.type !== 'PUT' &&
673
+ options.type !== 'PATCH'
674
+ ) {
675
+ options.type = 'POST';
676
+ }
677
+ if (!options.formAcceptCharset) {
678
+ options.formAcceptCharset = options.form.attr('accept-charset');
679
+ }
680
+ },
681
+
682
+ _getAJAXSettings: function(data) {
683
+ var options = $.extend({}, this.options, data);
684
+ this._initFormSettings(options);
685
+ this._initDataSettings(options);
686
+ return options;
687
+ },
688
+
689
+ // jQuery 1.6 doesn't provide .state(),
690
+ // while jQuery 1.8+ removed .isRejected() and .isResolved():
691
+ _getDeferredState: function(deferred) {
692
+ if (deferred.state) {
693
+ return deferred.state();
694
+ }
695
+ if (deferred.isResolved()) {
696
+ return 'resolved';
697
+ }
698
+ if (deferred.isRejected()) {
699
+ return 'rejected';
700
+ }
701
+ return 'pending';
702
+ },
703
+
704
+ // Maps jqXHR callbacks to the equivalent
705
+ // methods of the given Promise object:
706
+ _enhancePromise: function(promise) {
707
+ promise.success = promise.done;
708
+ promise.error = promise.fail;
709
+ promise.complete = promise.always;
710
+ return promise;
711
+ },
712
+
713
+ // Creates and returns a Promise object enhanced with
714
+ // the jqXHR methods abort, success, error and complete:
715
+ _getXHRPromise: function(resolveOrReject, context, args) {
716
+ var dfd = $.Deferred(),
717
+ promise = dfd.promise();
718
+ // eslint-disable-next-line no-param-reassign
719
+ context = context || this.options.context || promise;
720
+ if (resolveOrReject === true) {
721
+ dfd.resolveWith(context, args);
722
+ } else if (resolveOrReject === false) {
723
+ dfd.rejectWith(context, args);
724
+ }
725
+ promise.abort = dfd.promise;
726
+ return this._enhancePromise(promise);
727
+ },
728
+
729
+ // Adds convenience methods to the data callback argument:
730
+ _addConvenienceMethods: function(e, data) {
731
+ var that = this,
732
+ getPromise = function(args) {
733
+ return $.Deferred()
734
+ .resolveWith(that, args)
735
+ .promise();
736
+ };
737
+ data.process = function(resolveFunc, rejectFunc) {
738
+ if (resolveFunc || rejectFunc) {
739
+ data._processQueue = this._processQueue = (
740
+ this._processQueue || getPromise([this])
741
+ )
742
+ .then(function() {
743
+ if (data.errorThrown) {
744
+ return $.Deferred()
745
+ .rejectWith(that, [data])
746
+ .promise();
747
+ }
748
+ return getPromise(arguments);
749
+ })
750
+ .then(resolveFunc, rejectFunc);
751
+ }
752
+ return this._processQueue || getPromise([this]);
753
+ };
754
+ data.submit = function() {
755
+ if (this.state() !== 'pending') {
756
+ data.jqXHR = this.jqXHR =
757
+ that._trigger(
758
+ 'submit',
759
+ $.Event('submit', { delegatedEvent: e }),
760
+ this
761
+ ) !== false && that._onSend(e, this);
762
+ }
763
+ return this.jqXHR || that._getXHRPromise();
764
+ };
765
+ data.abort = function() {
766
+ if (this.jqXHR) {
767
+ return this.jqXHR.abort();
768
+ }
769
+ this.errorThrown = 'abort';
770
+ that._trigger('fail', null, this);
771
+ return that._getXHRPromise(false);
772
+ };
773
+ data.state = function() {
774
+ if (this.jqXHR) {
775
+ return that._getDeferredState(this.jqXHR);
776
+ }
777
+ if (this._processQueue) {
778
+ return that._getDeferredState(this._processQueue);
779
+ }
780
+ };
781
+ data.processing = function() {
782
+ return (
783
+ !this.jqXHR &&
784
+ this._processQueue &&
785
+ that._getDeferredState(this._processQueue) === 'pending'
786
+ );
787
+ };
788
+ data.progress = function() {
789
+ return this._progress;
790
+ };
791
+ data.response = function() {
792
+ return this._response;
793
+ };
794
+ },
795
+
796
+ // Parses the Range header from the server response
797
+ // and returns the uploaded bytes:
798
+ _getUploadedBytes: function(jqXHR) {
799
+ var range = jqXHR.getResponseHeader('Range'),
800
+ parts = range && range.split('-'),
801
+ upperBytesPos = parts && parts.length > 1 && parseInt(parts[1], 10);
802
+ return upperBytesPos && upperBytesPos + 1;
803
+ },
804
+
805
+ // Uploads a file in multiple, sequential requests
806
+ // by splitting the file up in multiple blob chunks.
807
+ // If the second parameter is true, only tests if the file
808
+ // should be uploaded in chunks, but does not invoke any
809
+ // upload requests:
810
+ _chunkedUpload: function(options, testOnly) {
811
+ options.uploadedBytes = options.uploadedBytes || 0;
812
+ var that = this,
813
+ file = options.files[0],
814
+ fs = file.size,
815
+ ub = options.uploadedBytes,
816
+ mcs = options.maxChunkSize || fs,
817
+ slice = this._blobSlice,
818
+ dfd = $.Deferred(),
819
+ promise = dfd.promise(),
820
+ jqXHR,
821
+ upload;
822
+ if (
823
+ !(
824
+ this._isXHRUpload(options) &&
825
+ slice &&
826
+ (ub || ($.type(mcs) === 'function' ? mcs(options) : mcs) < fs)
827
+ ) ||
828
+ options.data
829
+ ) {
830
+ return false;
831
+ }
832
+ if (testOnly) {
833
+ return true;
834
+ }
835
+ if (ub >= fs) {
836
+ file.error = options.i18n('uploadedBytes');
837
+ return this._getXHRPromise(false, options.context, [
838
+ null,
839
+ 'error',
840
+ file.error
841
+ ]);
842
+ }
843
+ // The chunk upload method:
844
+ upload = function() {
845
+ // Clone the options object for each chunk upload:
846
+ var o = $.extend({}, options),
847
+ currentLoaded = o._progress.loaded;
848
+ o.blob = slice.call(
849
+ file,
850
+ ub,
851
+ ub + ($.type(mcs) === 'function' ? mcs(o) : mcs),
852
+ file.type
853
+ );
854
+ // Store the current chunk size, as the blob itself
855
+ // will be dereferenced after data processing:
856
+ o.chunkSize = o.blob.size;
857
+ // Expose the chunk bytes position range:
858
+ o.contentRange =
859
+ 'bytes ' + ub + '-' + (ub + o.chunkSize - 1) + '/' + fs;
860
+ // Trigger chunkbeforesend to allow form data to be updated for this chunk
861
+ that._trigger('chunkbeforesend', null, o);
862
+ // Process the upload data (the blob and potential form data):
863
+ that._initXHRData(o);
864
+ // Add progress listeners for this chunk upload:
865
+ that._initProgressListener(o);
866
+ jqXHR = (
867
+ (that._trigger('chunksend', null, o) !== false && $.ajax(o)) ||
868
+ that._getXHRPromise(false, o.context)
869
+ )
870
+ .done(function(result, textStatus, jqXHR) {
871
+ ub = that._getUploadedBytes(jqXHR) || ub + o.chunkSize;
872
+ // Create a progress event if no final progress event
873
+ // with loaded equaling total has been triggered
874
+ // for this chunk:
875
+ if (currentLoaded + o.chunkSize - o._progress.loaded) {
876
+ that._onProgress(
877
+ $.Event('progress', {
878
+ lengthComputable: true,
879
+ loaded: ub - o.uploadedBytes,
880
+ total: ub - o.uploadedBytes
881
+ }),
882
+ o
883
+ );
884
  }
885
+ options.uploadedBytes = o.uploadedBytes = ub;
886
+ o.result = result;
887
+ o.textStatus = textStatus;
888
+ o.jqXHR = jqXHR;
889
+ that._trigger('chunkdone', null, o);
890
+ that._trigger('chunkalways', null, o);
891
+ if (ub < fs) {
892
+ // File upload not yet complete,
893
+ // continue with the next chunk:
894
+ upload();
895
+ } else {
896
+ dfd.resolveWith(o.context, [result, textStatus, jqXHR]);
897
  }
898
+ })
899
+ .fail(function(jqXHR, textStatus, errorThrown) {
900
+ o.jqXHR = jqXHR;
901
+ o.textStatus = textStatus;
902
+ o.errorThrown = errorThrown;
903
+ that._trigger('chunkfail', null, o);
904
+ that._trigger('chunkalways', null, o);
905
+ dfd.rejectWith(o.context, [jqXHR, textStatus, errorThrown]);
906
+ })
907
+ .always(function() {
908
+ that._deinitProgressListener(o);
909
+ });
910
+ };
911
+ this._enhancePromise(promise);
912
+ promise.abort = function() {
913
+ return jqXHR.abort();
914
+ };
915
+ upload();
916
+ return promise;
917
+ },
918
+
919
+ _beforeSend: function(e, data) {
920
+ if (this._active === 0) {
921
+ // the start callback is triggered when an upload starts
922
+ // and no other uploads are currently running,
923
+ // equivalent to the global ajaxStart event:
924
+ this._trigger('start');
925
+ // Set timer for global bitrate progress calculation:
926
+ this._bitrateTimer = new this._BitrateTimer();
927
+ // Reset the global progress values:
928
+ this._progress.loaded = this._progress.total = 0;
929
+ this._progress.bitrate = 0;
930
+ }
931
+ // Make sure the container objects for the .response() and
932
+ // .progress() methods on the data object are available
933
+ // and reset to their initial state:
934
+ this._initResponseObject(data);
935
+ this._initProgressObject(data);
936
+ data._progress.loaded = data.loaded = data.uploadedBytes || 0;
937
+ data._progress.total = data.total = this._getTotal(data.files) || 1;
938
+ data._progress.bitrate = data.bitrate = 0;
939
+ this._active += 1;
940
+ // Initialize the global progress values:
941
+ this._progress.loaded += data.loaded;
942
+ this._progress.total += data.total;
943
+ },
944
+
945
+ _onDone: function(result, textStatus, jqXHR, options) {
946
+ var total = options._progress.total,
947
+ response = options._response;
948
+ if (options._progress.loaded < total) {
949
+ // Create a progress event if no final progress event
950
+ // with loaded equaling total has been triggered:
951
+ this._onProgress(
952
+ $.Event('progress', {
953
+ lengthComputable: true,
954
+ loaded: total,
955
+ total: total
956
+ }),
957
+ options
958
+ );
959
+ }
960
+ response.result = options.result = result;
961
+ response.textStatus = options.textStatus = textStatus;
962
+ response.jqXHR = options.jqXHR = jqXHR;
963
+ this._trigger('done', null, options);
964
+ },
965
+
966
+ _onFail: function(jqXHR, textStatus, errorThrown, options) {
967
+ var response = options._response;
968
+ if (options.recalculateProgress) {
969
+ // Remove the failed (error or abort) file upload from
970
+ // the global progress calculation:
971
+ this._progress.loaded -= options._progress.loaded;
972
+ this._progress.total -= options._progress.total;
973
+ }
974
+ response.jqXHR = options.jqXHR = jqXHR;
975
+ response.textStatus = options.textStatus = textStatus;
976
+ response.errorThrown = options.errorThrown = errorThrown;
977
+ this._trigger('fail', null, options);
978
+ },
979
+
980
+ _onAlways: function(jqXHRorResult, textStatus, jqXHRorError, options) {
981
+ // jqXHRorResult, textStatus and jqXHRorError are added to the
982
+ // options object via done and fail callbacks
983
+ this._trigger('always', null, options);
984
+ },
985
+
986
+ _onSend: function(e, data) {
987
+ if (!data.submit) {
988
+ this._addConvenienceMethods(e, data);
989
+ }
990
+ var that = this,
991
+ jqXHR,
992
+ aborted,
993
+ slot,
994
+ pipe,
995
+ options = that._getAJAXSettings(data),
996
+ send = function() {
997
+ that._sending += 1;
998
+ // Set timer for bitrate progress calculation:
999
+ options._bitrateTimer = new that._BitrateTimer();
1000
+ jqXHR =
1001
+ jqXHR ||
1002
+ (
1003
+ ((aborted ||
1004
+ that._trigger(
1005
+ 'send',
1006
+ $.Event('send', { delegatedEvent: e }),
1007
+ options
1008
+ ) === false) &&
1009
+ that._getXHRPromise(false, options.context, aborted)) ||
1010
+ that._chunkedUpload(options) ||
1011
+ $.ajax(options)
1012
+ )
1013
+ .done(function(result, textStatus, jqXHR) {
1014
+ that._onDone(result, textStatus, jqXHR, options);
1015
+ })
1016
+ .fail(function(jqXHR, textStatus, errorThrown) {
1017
+ that._onFail(jqXHR, textStatus, errorThrown, options);
1018
+ })
1019
+ .always(function(jqXHRorResult, textStatus, jqXHRorError) {
1020
+ that._deinitProgressListener(options);
1021
+ that._onAlways(
1022
+ jqXHRorResult,
1023
+ textStatus,
1024
+ jqXHRorError,
1025
+ options
1026
  );
1027
+ that._sending -= 1;
1028
+ that._active -= 1;
1029
+ if (
1030
+ options.limitConcurrentUploads &&
1031
+ options.limitConcurrentUploads > that._sending
1032
+ ) {
1033
+ // Start the next queued upload,
1034
+ // that has not been aborted:
1035
+ var nextSlot = that._slots.shift();
1036
+ while (nextSlot) {
1037
+ if (that._getDeferredState(nextSlot) === 'pending') {
1038
+ nextSlot.resolve();
1039
+ break;
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1040
  }
1041
+ nextSlot = that._slots.shift();
1042
+ }
 
 
 
 
 
1043
  }
1044
+ if (that._active === 0) {
1045
+ // The stop callback is triggered when all uploads have
1046
+ // been completed, equivalent to the global ajaxStop event:
1047
+ that._trigger('stop');
1048
+ }
1049
+ });
1050
+ return jqXHR;
1051
+ };
1052
+ this._beforeSend(e, options);
1053
+ if (
1054
+ this.options.sequentialUploads ||
1055
+ (this.options.limitConcurrentUploads &&
1056
+ this.options.limitConcurrentUploads <= this._sending)
1057
+ ) {
1058
+ if (this.options.limitConcurrentUploads > 1) {
1059
+ slot = $.Deferred();
1060
+ this._slots.push(slot);
1061
+ pipe = slot.then(send);
1062
+ } else {
1063
+ this._sequence = this._sequence.then(send, send);
1064
+ pipe = this._sequence;
1065
+ }
1066
+ // Return the piped Promise object, enhanced with an abort method,
1067
+ // which is delegated to the jqXHR object of the current upload,
1068
+ // and jqXHR callbacks mapped to the equivalent Promise methods:
1069
+ pipe.abort = function() {
1070
+ aborted = [undefined, 'abort', 'abort'];
1071
+ if (!jqXHR) {
1072
+ if (slot) {
1073
+ slot.rejectWith(options.context, aborted);
1074
  }
1075
+ return send();
1076
+ }
1077
+ return jqXHR.abort();
1078
+ };
1079
+ return this._enhancePromise(pipe);
1080
+ }
1081
+ return send();
1082
+ },
1083
+
1084
+ _onAdd: function(e, data) {
1085
+ var that = this,
1086
+ result = true,
1087
+ options = $.extend({}, this.options, data),
1088
+ files = data.files,
1089
+ filesLength = files.length,
1090
+ limit = options.limitMultiFileUploads,
1091
+ limitSize = options.limitMultiFileUploadSize,
1092
+ overhead = options.limitMultiFileUploadSizeOverhead,
1093
+ batchSize = 0,
1094
+ paramName = this._getParamName(options),
1095
+ paramNameSet,
1096
+ paramNameSlice,
1097
+ fileSet,
1098
+ i,
1099
+ j = 0;
1100
+ if (!filesLength) {
1101
+ return false;
1102
+ }
1103
+ if (limitSize && files[0].size === undefined) {
1104
+ limitSize = undefined;
1105
+ }
1106
+ if (
1107
+ !(options.singleFileUploads || limit || limitSize) ||
1108
+ !this._isXHRUpload(options)
1109
+ ) {
1110
+ fileSet = [files];
1111
+ paramNameSet = [paramName];
1112
+ } else if (!(options.singleFileUploads || limitSize) && limit) {
1113
+ fileSet = [];
1114
+ paramNameSet = [];
1115
+ for (i = 0; i < filesLength; i += limit) {
1116
+ fileSet.push(files.slice(i, i + limit));
1117
+ paramNameSlice = paramName.slice(i, i + limit);
1118
+ if (!paramNameSlice.length) {
1119
+ paramNameSlice = paramName;
1120
+ }
1121
+ paramNameSet.push(paramNameSlice);
1122
+ }
1123
+ } else if (!options.singleFileUploads && limitSize) {
1124
+ fileSet = [];
1125
+ paramNameSet = [];
1126
+ for (i = 0; i < filesLength; i = i + 1) {
1127
+ batchSize += files[i].size + overhead;
1128
+ if (
1129
+ i + 1 === filesLength ||
1130
+ batchSize + files[i + 1].size + overhead > limitSize ||
1131
+ (limit && i + 1 - j >= limit)
1132
+ ) {
1133
+ fileSet.push(files.slice(j, i + 1));
1134
+ paramNameSlice = paramName.slice(j, i + 1);
1135
+ if (!paramNameSlice.length) {
1136
+ paramNameSlice = paramName;
1137
  }
1138
+ paramNameSet.push(paramNameSlice);
1139
+ j = i + 1;
1140
+ batchSize = 0;
1141
+ }
1142
+ }
1143
+ } else {
1144
+ paramNameSet = paramName;
1145
+ }
1146
+ data.originalFiles = files;
1147
+ $.each(fileSet || files, function(index, element) {
1148
+ var newData = $.extend({}, data);
1149
+ newData.files = fileSet ? element : [element];
1150
+ newData.paramName = paramNameSet[index];
1151
+ that._initResponseObject(newData);
1152
+ that._initProgressObject(newData);
1153
+ that._addConvenienceMethods(e, newData);
1154
+ result = that._trigger(
1155
+ 'add',
1156
+ $.Event('add', { delegatedEvent: e }),
1157
+ newData
1158
+ );
1159
+ return result;
1160
+ });
1161
+ return result;
1162
+ },
1163
+
1164
+ _replaceFileInput: function(data) {
1165
+ var input = data.fileInput,
1166
+ inputClone = input.clone(true),
1167
+ restoreFocus = input.is(document.activeElement);
1168
+ // Add a reference for the new cloned file input to the data argument:
1169
+ data.fileInputClone = inputClone;
1170
+ $('<form></form>')
1171
+ .append(inputClone)[0]
1172
+ .reset();
1173
+ // Detaching allows to insert the fileInput on another form
1174
+ // without loosing the file input value:
1175
+ input.after(inputClone).detach();
1176
+ // If the fileInput had focus before it was detached,
1177
+ // restore focus to the inputClone.
1178
+ if (restoreFocus) {
1179
+ inputClone.focus();
1180
+ }
1181
+ // Avoid memory leaks with the detached file input:
1182
+ $.cleanData(input.unbind('remove'));
1183
+ // Replace the original file input element in the fileInput
1184
+ // elements set with the clone, which has been copied including
1185
+ // event handlers:
1186
+ this.options.fileInput = this.options.fileInput.map(function(i, el) {
1187
+ if (el === input[0]) {
1188
+ return inputClone[0];
1189
+ }
1190
+ return el;
1191
+ });
1192
+ // If the widget has been initialized on the file input itself,
1193
+ // override this.element with the file input clone:
1194
+ if (input[0] === this.element[0]) {
1195
+ this.element = inputClone;
1196
+ }
1197
+ },
1198
+
1199
+ _handleFileTreeEntry: function(entry, path) {
1200
+ var that = this,
1201
+ dfd = $.Deferred(),
1202
+ entries = [],
1203
+ dirReader,
1204
+ errorHandler = function(e) {
1205
+ if (e && !e.entry) {
1206
+ e.entry = entry;
1207
+ }
1208
+ // Since $.when returns immediately if one
1209
+ // Deferred is rejected, we use resolve instead.
1210
+ // This allows valid files and invalid items
1211
+ // to be returned together in one set:
1212
+ dfd.resolve([e]);
1213
  },
1214
+ successHandler = function(entries) {
1215
+ that
1216
+ ._handleFileTreeEntries(entries, path + entry.name + '/')
1217
+ .done(function(files) {
1218
+ dfd.resolve(files);
1219
+ })
1220
+ .fail(errorHandler);
 
 
1221
  },
1222
+ readEntries = function() {
1223
+ dirReader.readEntries(function(results) {
1224
+ if (!results.length) {
1225
+ successHandler(entries);
1226
+ } else {
1227
+ entries = entries.concat(results);
1228
+ readEntries();
1229
  }
1230
+ }, errorHandler);
1231
+ };
1232
+ // eslint-disable-next-line no-param-reassign
1233
+ path = path || '';
1234
+ if (entry.isFile) {
1235
+ if (entry._file) {
1236
+ // Workaround for Chrome bug #149735
1237
+ entry._file.relativePath = path;
1238
+ dfd.resolve(entry._file);
1239
+ } else {
1240
+ entry.file(function(file) {
1241
+ file.relativePath = path;
1242
+ dfd.resolve(file);
1243
+ }, errorHandler);
1244
+ }
1245
+ } else if (entry.isDirectory) {
1246
+ dirReader = entry.createReader();
1247
+ readEntries();
1248
+ } else {
1249
+ // Return an empty list for file system items
1250
+ // other than files or directories:
1251
+ dfd.resolve([]);
1252
+ }
1253
+ return dfd.promise();
1254
+ },
1255
+
1256
+ _handleFileTreeEntries: function(entries, path) {
1257
+ var that = this;
1258
+ return $.when
1259
+ .apply(
1260
+ $,
1261
+ $.map(entries, function(entry) {
1262
+ return that._handleFileTreeEntry(entry, path);
1263
+ })
1264
+ )
1265
+ .then(function() {
1266
+ return Array.prototype.concat.apply([], arguments);
1267
+ });
1268
+ },
1269
+
1270
+ _getDroppedFiles: function(dataTransfer) {
1271
+ // eslint-disable-next-line no-param-reassign
1272
+ dataTransfer = dataTransfer || {};
1273
+ var items = dataTransfer.items;
1274
+ if (
1275
+ items &&
1276
+ items.length &&
1277
+ (items[0].webkitGetAsEntry || items[0].getAsEntry)
1278
+ ) {
1279
+ return this._handleFileTreeEntries(
1280
+ $.map(items, function(item) {
1281
+ var entry;
1282
+ if (item.webkitGetAsEntry) {
1283
+ entry = item.webkitGetAsEntry();
1284
+ if (entry) {
1285
+ // Workaround for Chrome bug #149735:
1286
+ entry._file = item.getAsFile();
1287
+ }
1288
+ return entry;
1289
  }
1290
+ return item.getAsEntry();
1291
+ })
1292
+ );
1293
+ }
1294
+ return $.Deferred()
1295
+ .resolve($.makeArray(dataTransfer.files))
1296
+ .promise();
1297
+ },
1298
+
1299
+ _getSingleFileInputFiles: function(fileInput) {
1300
+ // eslint-disable-next-line no-param-reassign
1301
+ fileInput = $(fileInput);
1302
+ var entries =
1303
+ fileInput.prop('webkitEntries') || fileInput.prop('entries'),
1304
+ files,
1305
+ value;
1306
+ if (entries && entries.length) {
1307
+ return this._handleFileTreeEntries(entries);
1308
+ }
1309
+ files = $.makeArray(fileInput.prop('files'));
1310
+ if (!files.length) {
1311
+ value = fileInput.prop('value');
1312
+ if (!value) {
1313
+ return $.Deferred()
1314
+ .resolve([])
1315
+ .promise();
1316
+ }
1317
+ // If the files property is not available, the browser does not
1318
+ // support the File API and we add a pseudo File object with
1319
+ // the input value as name with path information removed:
1320
+ files = [{ name: value.replace(/^.*\\/, '') }];
1321
+ } else if (files[0].name === undefined && files[0].fileName) {
1322
+ // File normalization for Safari 4 and Firefox 3:
1323
+ $.each(files, function(index, file) {
1324
+ file.name = file.fileName;
1325
+ file.size = file.fileSize;
1326
+ });
1327
+ }
1328
+ return $.Deferred()
1329
+ .resolve(files)
1330
+ .promise();
1331
+ },
1332
+
1333
+ _getFileInputFiles: function(fileInput) {
1334
+ if (!(fileInput instanceof $) || fileInput.length === 1) {
1335
+ return this._getSingleFileInputFiles(fileInput);
1336
+ }
1337
+ return $.when
1338
+ .apply($, $.map(fileInput, this._getSingleFileInputFiles))
1339
+ .then(function() {
1340
+ return Array.prototype.concat.apply([], arguments);
1341
+ });
1342
+ },
1343
+
1344
+ _onChange: function(e) {
1345
+ var that = this,
1346
+ data = {
1347
+ fileInput: $(e.target),
1348
+ form: $(e.target.form)
1349
+ };
1350
+ this._getFileInputFiles(data.fileInput).always(function(files) {
1351
+ data.files = files;
1352
+ if (that.options.replaceFileInput) {
1353
+ that._replaceFileInput(data);
1354
+ }
1355
+ if (
1356
+ that._trigger(
1357
+ 'change',
1358
+ $.Event('change', { delegatedEvent: e }),
1359
+ data
1360
+ ) !== false
1361
+ ) {
1362
+ that._onAdd(e, data);
1363
+ }
1364
+ });
1365
+ },
1366
+
1367
+ _onPaste: function(e) {
1368
+ var items =
1369
+ e.originalEvent &&
1370
+ e.originalEvent.clipboardData &&
1371
+ e.originalEvent.clipboardData.items,
1372
+ data = { files: [] };
1373
+ if (items && items.length) {
1374
+ $.each(items, function(index, item) {
1375
+ var file = item.getAsFile && item.getAsFile();
1376
+ if (file) {
1377
+ data.files.push(file);
1378
+ }
1379
+ });
1380
+ if (
1381
+ this._trigger(
1382
+ 'paste',
1383
+ $.Event('paste', { delegatedEvent: e }),
1384
+ data
1385
+ ) !== false
1386
+ ) {
1387
+ this._onAdd(e, data);
1388
+ }
1389
+ }
1390
+ },
1391
+
1392
+ _onDrop: function(e) {
1393
+ e.dataTransfer = e.originalEvent && e.originalEvent.dataTransfer;
1394
+ var that = this,
1395
+ dataTransfer = e.dataTransfer,
1396
+ data = {};
1397
+ if (dataTransfer && dataTransfer.files && dataTransfer.files.length) {
1398
+ e.preventDefault();
1399
+ this._getDroppedFiles(dataTransfer).always(function(files) {
1400
+ data.files = files;
1401
+ if (
1402
+ that._trigger(
1403
+ 'drop',
1404
+ $.Event('drop', { delegatedEvent: e }),
1405
+ data
1406
+ ) !== false
1407
+ ) {
1408
+ that._onAdd(e, data);
1409
+ }
1410
+ });
1411
+ }
1412
+ },
1413
+
1414
+ _onDragOver: getDragHandler('dragover'),
1415
+
1416
+ _onDragEnter: getDragHandler('dragenter'),
1417
+
1418
+ _onDragLeave: getDragHandler('dragleave'),
1419
+
1420
+ _initEventHandlers: function() {
1421
+ if (this._isXHRUpload(this.options)) {
1422
+ this._on(this.options.dropZone, {
1423
+ dragover: this._onDragOver,
1424
+ drop: this._onDrop,
1425
+ // event.preventDefault() on dragenter is required for IE10+:
1426
+ dragenter: this._onDragEnter,
1427
+ // dragleave is not required, but added for completeness:
1428
+ dragleave: this._onDragLeave
1429
+ });
1430
+ this._on(this.options.pasteZone, {
1431
+ paste: this._onPaste
1432
+ });
1433
+ }
1434
+ if ($.support.fileInput) {
1435
+ this._on(this.options.fileInput, {
1436
+ change: this._onChange
1437
+ });
1438
+ }
1439
+ },
1440
+
1441
+ _destroyEventHandlers: function() {
1442
+ this._off(this.options.dropZone, 'dragenter dragleave dragover drop');
1443
+ this._off(this.options.pasteZone, 'paste');
1444
+ this._off(this.options.fileInput, 'change');
1445
+ },
1446
+
1447
+ _destroy: function() {
1448
+ this._destroyEventHandlers();
1449
+ },
1450
+
1451
+ _setOption: function(key, value) {
1452
+ var reinit = $.inArray(key, this._specialOptions) !== -1;
1453
+ if (reinit) {
1454
+ this._destroyEventHandlers();
1455
+ }
1456
+ this._super(key, value);
1457
+ if (reinit) {
1458
+ this._initSpecialOptions();
1459
+ this._initEventHandlers();
1460
+ }
1461
+ },
1462
+
1463
+ _initSpecialOptions: function() {
1464
+ var options = this.options;
1465
+ if (options.fileInput === undefined) {
1466
+ options.fileInput = this.element.is('input[type="file"]')
1467
+ ? this.element
1468
+ : this.element.find('input[type="file"]');
1469
+ } else if (!(options.fileInput instanceof $)) {
1470
+ options.fileInput = $(options.fileInput);
1471
+ }
1472
+ if (!(options.dropZone instanceof $)) {
1473
+ options.dropZone = $(options.dropZone);
1474
+ }
1475
+ if (!(options.pasteZone instanceof $)) {
1476
+ options.pasteZone = $(options.pasteZone);
1477
+ }
1478
+ },
1479
+
1480
+ _getRegExp: function(str) {
1481
+ var parts = str.split('/'),
1482
+ modifiers = parts.pop();
1483
+ parts.shift();
1484
+ return new RegExp(parts.join('/'), modifiers);
1485
+ },
1486
+
1487
+ _isRegExpOption: function(key, value) {
1488
+ return (
1489
+ key !== 'url' &&
1490
+ $.type(value) === 'string' &&
1491
+ /^\/.*\/[igm]{0,3}$/.test(value)
1492
+ );
1493
+ },
1494
+
1495
+ _initDataAttributes: function() {
1496
+ var that = this,
1497
+ options = this.options,
1498
+ data = this.element.data();
1499
+ // Initialize options set via HTML5 data-attributes:
1500
+ $.each(this.element[0].attributes, function(index, attr) {
1501
+ var key = attr.name.toLowerCase(),
1502
+ value;
1503
+ if (/^data-/.test(key)) {
1504
+ // Convert hyphen-ated key to camelCase:
1505
+ key = key.slice(5).replace(/-[a-z]/g, function(str) {
1506
+ return str.charAt(1).toUpperCase();
1507
+ });
1508
+ value = data[key];
1509
+ if (that._isRegExpOption(key, value)) {
1510
+ value = that._getRegExp(value);
1511
+ }
1512
+ options[key] = value;
1513
+ }
1514
+ });
1515
+ },
1516
+
1517
+ _create: function() {
1518
+ this._initDataAttributes();
1519
+ this._initSpecialOptions();
1520
+ this._slots = [];
1521
+ this._sequence = this._getXHRPromise(true);
1522
+ this._sending = this._active = 0;
1523
+ this._initProgressObject(this);
1524
+ this._initEventHandlers();
1525
+ },
1526
+
1527
+ // This method is exposed to the widget API and allows to query
1528
+ // the number of active uploads:
1529
+ active: function() {
1530
+ return this._active;
1531
+ },
1532
+
1533
+ // This method is exposed to the widget API and allows to query
1534
+ // the widget upload progress.
1535
+ // It returns an object with loaded, total and bitrate properties
1536
+ // for the running uploads:
1537
+ progress: function() {
1538
+ return this._progress;
1539
+ },
1540
+
1541
+ // This method is exposed to the widget API and allows adding files
1542
+ // using the fileupload API. The data parameter accepts an object which
1543
+ // must have a files property and can contain additional options:
1544
+ // .fileupload('add', {files: filesList});
1545
+ add: function(data) {
1546
+ var that = this;
1547
+ if (!data || this.options.disabled) {
1548
+ return;
1549
+ }
1550
+ if (data.fileInput && !data.files) {
1551
+ this._getFileInputFiles(data.fileInput).always(function(files) {
1552
+ data.files = files;
1553
+ that._onAdd(null, data);
1554
+ });
1555
+ } else {
1556
+ data.files = $.makeArray(data.files);
1557
+ this._onAdd(null, data);
1558
+ }
1559
+ },
1560
+
1561
+ // This method is exposed to the widget API and allows sending files
1562
+ // using the fileupload API. The data parameter accepts an object which
1563
+ // must have a files or fileInput property and can contain additional options:
1564
+ // .fileupload('send', {files: filesList});
1565
+ // The method returns a Promise object for the file upload call.
1566
+ send: function(data) {
1567
+ if (data && !this.options.disabled) {
1568
+ if (data.fileInput && !data.files) {
1569
+ var that = this,
1570
+ dfd = $.Deferred(),
1571
+ promise = dfd.promise(),
1572
+ jqXHR,
1573
+ aborted;
1574
+ promise.abort = function() {
1575
+ aborted = true;
1576
+ if (jqXHR) {
1577
+ return jqXHR.abort();
1578
  }
1579
+ dfd.reject(null, 'abort', 'abort');
1580
+ return promise;
1581
+ };
1582
+ this._getFileInputFiles(data.fileInput).always(function(files) {
1583
+ if (aborted) {
1584
+ return;
1585
  }
1586
+ if (!files.length) {
1587
+ dfd.reject();
1588
+ return;
1589
  }
1590
+ data.files = files;
1591
+ jqXHR = that._onSend(null, data);
1592
+ jqXHR.then(
1593
+ function(result, textStatus, jqXHR) {
1594
+ dfd.resolve(result, textStatus, jqXHR);
1595
+ },
1596
+ function(jqXHR, textStatus, errorThrown) {
1597
+ dfd.reject(jqXHR, textStatus, errorThrown);
1598
+ }
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1599
  );
1600
+ });
1601
+ return this._enhancePromise(promise);
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1602
  }
1603
+ data.files = $.makeArray(data.files);
1604
+ if (data.files.length) {
1605
+ return this._onSend(null, data);
1606
+ }
1607
+ }
1608
+ return this._getXHRPromise(false, data && data.context);
1609
+ }
1610
+ });
1611
+ });
assets/js/jquery-fileupload/jquery.iframe-transport.js CHANGED
@@ -1,5 +1,5 @@
1
  /*
2
- * jQuery Iframe Transport Plugin v9.32.0
3
  * https://github.com/blueimp/jQuery-File-Upload
4
  *
5
  * Copyright 2011, Sebastian Tschan
@@ -9,216 +9,213 @@
9
  * https://opensource.org/licenses/MIT
10
  */
11
 
12
- /* global define, require, window, document, JSON */
13
 
14
- ;(function (factory) {
15
- 'use strict';
16
- if (typeof define === 'function' && define.amd) {
17
- // Register as an anonymous AMD module:
18
- define(['jquery'], factory);
19
- } else if (typeof exports === 'object') {
20
- // Node/CommonJS:
21
- factory(require('jquery'));
22
- } else {
23
- // Browser globals:
24
- factory(window.jQuery);
25
- }
26
- }(function ($) {
27
- 'use strict';
28
 
29
- // Helper variable to create unique names for the transport iframes:
30
- var counter = 0,
31
- jsonAPI = $,
32
- jsonParse = 'parseJSON';
33
 
34
- if ('JSON' in window && 'parse' in JSON) {
35
- jsonAPI = JSON;
36
- jsonParse = 'parse';
37
- }
38
 
39
- // The iframe transport accepts four additional options:
40
- // options.fileInput: a jQuery collection of file input fields
41
- // options.paramName: the parameter name for the file form data,
42
- // overrides the name property of the file input field(s),
43
- // can be a string or an array of strings.
44
- // options.formData: an array of objects with name and value properties,
45
- // equivalent to the return data of .serializeArray(), e.g.:
46
- // [{name: 'a', value: 1}, {name: 'b', value: 2}]
47
- // options.initialIframeSrc: the URL of the initial iframe src,
48
- // by default set to "javascript:false;"
49
- $.ajaxTransport('iframe', function (options) {
50
- if (options.async) {
51
- // javascript:false as initial iframe src
52
- // prevents warning popups on HTTPS in IE6:
53
- /*jshint scripturl: true */
54
- var initialIframeSrc = options.initialIframeSrc || 'javascript:false;',
55
- /*jshint scripturl: false */
56
- form,
57
- iframe,
58
- addParamChar;
59
- return {
60
- send: function (_, completeCallback) {
61
- form = $('<form style="display:none;"></form>');
62
- form.attr('accept-charset', options.formAcceptCharset);
63
- addParamChar = /\?/.test(options.url) ? '&' : '?';
64
- // XDomainRequest only supports GET and POST:
65
- if (options.type === 'DELETE') {
66
- options.url = options.url + addParamChar + '_method=DELETE';
67
- options.type = 'POST';
68
- } else if (options.type === 'PUT') {
69
- options.url = options.url + addParamChar + '_method=PUT';
70
- options.type = 'POST';
71
- } else if (options.type === 'PATCH') {
72
- options.url = options.url + addParamChar + '_method=PATCH';
73
- options.type = 'POST';
74
- }
75
- // IE versions below IE8 cannot set the name property of
76
- // elements that have already been added to the DOM,
77
- // so we set the name along with the iframe HTML markup:
78
- counter += 1;
79
- iframe = $(
80
- '<iframe src="' + initialIframeSrc +
81
- '" name="iframe-transport-' + counter + '"></iframe>'
82
- ).bind('load', function () {
83
- var fileInputClones,
84
- paramNames = $.isArray(options.paramName) ?
85
- options.paramName : [options.paramName];
86
- iframe
87
- .unbind('load')
88
- .bind('load', function () {
89
- var response;
90
- // Wrap in a try/catch block to catch exceptions thrown
91
- // when trying to access cross-domain iframe contents:
92
- try {
93
- response = iframe.contents();
94
- // Google Chrome and Firefox do not throw an
95
- // exception when calling iframe.contents() on
96
- // cross-domain requests, so we unify the response:
97
- if (!response.length || !response[0].firstChild) {
98
- throw new Error();
99
- }
100
- } catch (e) {
101
- response = undefined;
102
- }
103
- // The complete callback returns the
104
- // iframe content document as response object:
105
- completeCallback(
106
- 200,
107
- 'success',
108
- {'iframe': response}
109
- );
110
- // Fix for IE endless progress bar activity bug
111
- // (happens on form submits to iframe targets):
112
- $('<iframe src="' + initialIframeSrc + '"></iframe>')
113
- .appendTo(form);
114
- window.setTimeout(function () {
115
- // Removing the form in a setTimeout call
116
- // allows Chrome's developer tools to display
117
- // the response result
118
- form.remove();
119
- }, 0);
120
- });
121
- form
122
- .prop('target', iframe.prop('name'))
123
- .prop('action', options.url)
124
- .prop('method', options.type);
125
- if (options.formData) {
126
- $.each(options.formData, function (index, field) {
127
- $('<input type="hidden"/>')
128
- .prop('name', field.name)
129
- .val(field.value)
130
- .appendTo(form);
131
- });
132
- }
133
- if (options.fileInput && options.fileInput.length &&
134
- options.type === 'POST') {
135
- fileInputClones = options.fileInput.clone();
136
- // Insert a clone for each file input field:
137
- options.fileInput.after(function (index) {
138
- return fileInputClones[index];
139
- });
140
- if (options.paramName) {
141
- options.fileInput.each(function (index) {
142
- $(this).prop(
143
- 'name',
144
- paramNames[index] || options.paramName
145
- );
146
- });
147
- }
148
- // Appending the file input fields to the hidden form
149
- // removes them from their original location:
150
- form
151
- .append(options.fileInput)
152
- .prop('enctype', 'multipart/form-data')
153
- // enctype must be set as encoding for IE:
154
- .prop('encoding', 'multipart/form-data');
155
- // Remove the HTML5 form attribute from the input(s):
156
- options.fileInput.removeAttr('form');
157
- }
158
- form.submit();
159
- // Insert the file input fields at their original location
160
- // by replacing the clones with the originals:
161
- if (fileInputClones && fileInputClones.length) {
162
- options.fileInput.each(function (index, input) {
163
- var clone = $(fileInputClones[index]);
164
- // Restore the original name and form properties:
165
- $(input)
166
- .prop('name', clone.prop('name'))
167
- .attr('form', clone.attr('form'));
168
- clone.replaceWith(input);
169
- });
170
- }
171
- });
172
- form.append(iframe).appendTo(document.body);
173
- },
174
- abort: function () {
175
- if (iframe) {
176
- // javascript:false as iframe src aborts the request
177
- // and prevents warning popups on HTTPS in IE6.
178
- // concat is used to avoid the "Script URL" JSLint error:
179
- iframe
180
- .unbind('load')
181
- .prop('src', initialIframeSrc);
182
- }
183
- if (form) {
184
- form.remove();
185
- }
186
  }
187
- };
188
- }
189
- });
190
-
191
- // The iframe transport returns the iframe content document as response.
192
- // The following adds converters from iframe to text, json, html, xml
193
- // and script.
194
- // Please note that the Content-Type for JSON responses has to be text/plain
195
- // or text/html, if the browser doesn't include application/json in the
196
- // Accept header, else IE will show a download dialog.
197
- // The Content-Type for XML responses on the other hand has to be always
198
- // application/xml or text/xml, so IE properly parses the XML response.
199
- // See also
200
- // https://github.com/blueimp/jQuery-File-Upload/wiki/Setup#content-type-negotiation
201
- $.ajaxSetup({
202
- converters: {
203
- 'iframe text': function (iframe) {
204
- return iframe && $(iframe[0].body).text();
205
- },
206
- 'iframe json': function (iframe) {
207
- return iframe && jsonAPI[jsonParse]($(iframe[0].body).text());
208
- },
209
- 'iframe html': function (iframe) {
210
- return iframe && $(iframe[0].body).html();
211
- },
212
- 'iframe xml': function (iframe) {
213
- var xmlDoc = iframe && iframe[0];
214
- return xmlDoc && $.isXMLDoc(xmlDoc) ? xmlDoc :
215
- $.parseXML((xmlDoc.XMLDocument && xmlDoc.XMLDocument.xml) ||
216
- $(xmlDoc.body).html());
217
- },
218
- 'iframe script': function (iframe) {
219
- return iframe && $.globalEval($(iframe[0].body).text());
220
  }
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
221
  }
222
- });
 
 
223
 
224
- }));
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
  /*
2
+ * jQuery Iframe Transport Plugin 10.2.0
3
  * https://github.com/blueimp/jQuery-File-Upload
4
  *
5
  * Copyright 2011, Sebastian Tschan
9
  * https://opensource.org/licenses/MIT
10
  */
11
 
12
+ /* global define, require */
13
 
14
+ (function(factory) {
15
+ 'use strict';
16
+ if (typeof define === 'function' && define.amd) {
17
+ // Register as an anonymous AMD module:
18
+ define(['jquery'], factory);
19
+ } else if (typeof exports === 'object') {
20
+ // Node/CommonJS:
21
+ factory(require('jquery'));
22
+ } else {
23
+ // Browser globals:
24
+ factory(window.jQuery);
25
+ }
26
+ })(function($) {
27
+ 'use strict';
28
 
29
+ // Helper variable to create unique names for the transport iframes:
30
+ var counter = 0,
31
+ jsonAPI = $,
32
+ jsonParse = 'parseJSON';
33
 
34
+ if ('JSON' in window && 'parse' in JSON) {
35
+ jsonAPI = JSON;
36
+ jsonParse = 'parse';
37
+ }
38
 
39
+ // The iframe transport accepts four additional options:
40
+ // options.fileInput: a jQuery collection of file input fields
41
+ // options.paramName: the parameter name for the file form data,
42
+ // overrides the name property of the file input field(s),
43
+ // can be a string or an array of strings.
44
+ // options.formData: an array of objects with name and value properties,
45
+ // equivalent to the return data of .serializeArray(), e.g.:
46
+ // [{name: 'a', value: 1}, {name: 'b', value: 2}]
47
+ // options.initialIframeSrc: the URL of the initial iframe src,
48
+ // by default set to "javascript:false;"
49
+ $.ajaxTransport('iframe', function(options) {
50
+ if (options.async) {
51
+ // javascript:false as initial iframe src
52
+ // prevents warning popups on HTTPS in IE6:
53
+ // eslint-disable-next-line no-script-url
54
+ var initialIframeSrc = options.initialIframeSrc || 'javascript:false;',
55
+ form,
56
+ iframe,
57
+ addParamChar;
58
+ return {
59
+ send: function(_, completeCallback) {
60
+ form = $('<form style="display:none;"></form>');
61
+ form.attr('accept-charset', options.formAcceptCharset);
62
+ addParamChar = /\?/.test(options.url) ? '&' : '?';
63
+ // XDomainRequest only supports GET and POST:
64
+ if (options.type === 'DELETE') {
65
+ options.url = options.url + addParamChar + '_method=DELETE';
66
+ options.type = 'POST';
67
+ } else if (options.type === 'PUT') {
68
+ options.url = options.url + addParamChar + '_method=PUT';
69
+ options.type = 'POST';
70
+ } else if (options.type === 'PATCH') {
71
+ options.url = options.url + addParamChar + '_method=PATCH';
72
+ options.type = 'POST';
73
+ }
74
+ // IE versions below IE8 cannot set the name property of
75
+ // elements that have already been added to the DOM,
76
+ // so we set the name along with the iframe HTML markup:
77
+ counter += 1;
78
+ iframe = $(
79
+ '<iframe src="' +
80
+ initialIframeSrc +
81
+ '" name="iframe-transport-' +
82
+ counter +
83
+ '"></iframe>'
84
+ ).bind('load', function() {
85
+ var fileInputClones,
86
+ paramNames = $.isArray(options.paramName)
87
+ ? options.paramName
88
+ : [options.paramName];
89
+ iframe.unbind('load').bind('load', function() {
90
+ var response;
91
+ // Wrap in a try/catch block to catch exceptions thrown
92
+ // when trying to access cross-domain iframe contents:
93
+ try {
94
+ response = iframe.contents();
95
+ // Google Chrome and Firefox do not throw an
96
+ // exception when calling iframe.contents() on
97
+ // cross-domain requests, so we unify the response:
98
+ if (!response.length || !response[0].firstChild) {
99
+ throw new Error();
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
100
  }
101
+ } catch (e) {
102
+ response = undefined;
103
+ }
104
+ // The complete callback returns the
105
+ // iframe content document as response object:
106
+ completeCallback(200, 'success', { iframe: response });
107
+ // Fix for IE endless progress bar activity bug
108
+ // (happens on form submits to iframe targets):
109
+ $('<iframe src="' + initialIframeSrc + '"></iframe>').appendTo(
110
+ form
111
+ );
112
+ window.setTimeout(function() {
113
+ // Removing the form in a setTimeout call
114
+ // allows Chrome's developer tools to display
115
+ // the response result
116
+ form.remove();
117
+ }, 0);
118
+ });
119
+ form
120
+ .prop('target', iframe.prop('name'))
121
+ .prop('action', options.url)
122
+ .prop('method', options.type);
123
+ if (options.formData) {
124
+ $.each(options.formData, function(index, field) {
125
+ $('<input type="hidden"/>')
126
+ .prop('name', field.name)
127
+ .val(field.value)
128
+ .appendTo(form);
129
+ });
 
 
 
 
130
  }
131
+ if (
132
+ options.fileInput &&
133
+ options.fileInput.length &&
134
+ options.type === 'POST'
135
+ ) {
136
+ fileInputClones = options.fileInput.clone();
137
+ // Insert a clone for each file input field:
138
+ options.fileInput.after(function(index) {
139
+ return fileInputClones[index];
140
+ });
141
+ if (options.paramName) {
142
+ options.fileInput.each(function(index) {
143
+ $(this).prop('name', paramNames[index] || options.paramName);
144
+ });
145
+ }
146
+ // Appending the file input fields to the hidden form
147
+ // removes them from their original location:
148
+ form
149
+ .append(options.fileInput)
150
+ .prop('enctype', 'multipart/form-data')
151
+ // enctype must be set as encoding for IE:
152
+ .prop('encoding', 'multipart/form-data');
153
+ // Remove the HTML5 form attribute from the input(s):
154
+ options.fileInput.removeAttr('form');
155
+ }
156
+ form.submit();
157
+ // Insert the file input fields at their original location
158
+ // by replacing the clones with the originals:
159
+ if (fileInputClones && fileInputClones.length) {
160
+ options.fileInput.each(function(index, input) {
161
+ var clone = $(fileInputClones[index]);
162
+ // Restore the original name and form properties:
163
+ $(input)
164
+ .prop('name', clone.prop('name'))
165
+ .attr('form', clone.attr('form'));
166
+ clone.replaceWith(input);
167
+ });
168
+ }
169
+ });
170
+ form.append(iframe).appendTo(document.body);
171
+ },
172
+ abort: function() {
173
+ if (iframe) {
174
+ // javascript:false as iframe src aborts the request
175
+ // and prevents warning popups on HTTPS in IE6.
176
+ iframe.unbind('load').prop('src', initialIframeSrc);
177
+ }
178
+ if (form) {
179
+ form.remove();
180
+ }
181
  }
182
+ };
183
+ }
184
+ });
185
 
186
+ // The iframe transport returns the iframe content document as response.
187
+ // The following adds converters from iframe to text, json, html, xml
188
+ // and script.
189
+ // Please note that the Content-Type for JSON responses has to be text/plain
190
+ // or text/html, if the browser doesn't include application/json in the
191
+ // Accept header, else IE will show a download dialog.
192
+ // The Content-Type for XML responses on the other hand has to be always
193
+ // application/xml or text/xml, so IE properly parses the XML response.
194
+ // See also
195
+ // https://github.com/blueimp/jQuery-File-Upload/wiki/Setup#content-type-negotiation
196
+ $.ajaxSetup({
197
+ converters: {
198
+ 'iframe text': function(iframe) {
199
+ return iframe && $(iframe[0].body).text();
200
+ },
201
+ 'iframe json': function(iframe) {
202
+ return iframe && jsonAPI[jsonParse]($(iframe[0].body).text());
203
+ },
204
+ 'iframe html': function(iframe) {
205
+ return iframe && $(iframe[0].body).html();
206
+ },
207
+ 'iframe xml': function(iframe) {
208
+ var xmlDoc = iframe && iframe[0];
209
+ return xmlDoc && $.isXMLDoc(xmlDoc)
210
+ ? xmlDoc
211
+ : $.parseXML(
212
+ (xmlDoc.XMLDocument && xmlDoc.XMLDocument.xml) ||
213
+ $(xmlDoc.body).html()
214
+ );
215
+ },
216
+ 'iframe script': function(iframe) {
217
+ return iframe && $.globalEval($(iframe[0].body).text());
218
+ }
219
+ }
220
+ });
221
+ });
assets/js/select2/select2.full.min.js CHANGED
@@ -1 +1,2 @@
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("select2/compat/utils",["jquery"],function(a){function b(b,c,d){var e,f,g=[];e=a.trim(b.attr("class")),e&&(e=""+e,a(e.split(/\s+/)).each(function(){0===this.indexOf("select2-")&&g.push(this)})),e=a.trim(c.attr("class")),e&&(e=""+e,a(e.split(/\s+/)).each(function(){0!==this.indexOf("select2-")&&null!=(f=d(this))&&g.push(f)})),b.attr("class",g.join(" "))}return{syncCssClasses:b}}),b.define("select2/compat/containerCss",["jquery","./utils"],function(a,b){function c(a){return null}function d(){}return d.prototype.render=function(d){var e=d.call(this),f=this.options.get("containerCssClass")||"";a.isFunction(f)&&(f=f(this.$element));var g=this.options.get("adaptContainerCssClass");if(g=g||c,-1!==f.indexOf(":all:")){f=f.replace(":all:","");var h=g;g=function(a){var b=h(a);return null!=b?b+" "+a:a}}var i=this.options.get("containerCss")||{};return a.isFunction(i)&&(i=i(this.$element)),b.syncCssClasses(e,this.$element,g),e.css(i),e.addClass(f),e},d}),b.define("select2/compat/dropdownCss",["jquery","./utils"],function(a,b){function c(a){return null}function d(){}return d.prototype.render=function(d){var e=d.call(this),f=this.options.get("dropdownCssClass")||"";a.isFunction(f)&&(f=f(this.$element));var g=this.options.get("adaptDropdownCssClass");if(g=g||c,-1!==f.indexOf(":all:")){f=f.replace(":all:","");var h=g;g=function(a){var b=h(a);return null!=b?b+" "+a:a}}var i=this.options.get("dropdownCss")||{};return a.isFunction(i)&&(i=i(this.$element)),b.syncCssClasses(e,this.$element,g),e.css(i),e.addClass(f),e},d}),b.define("select2/compat/initSelection",["jquery"],function(a){function b(a,b,c){c.get("debug")&&window.console&&console.warn&&console.warn("Select2: The `initSelection` option has been deprecated in favor of a custom data adapter that overrides the `current` method. This method is now called multiple times instead of a single time when the instance is initialized. Support will be removed for the `initSelection` option in future versions of Select2"),this.initSelection=c.get("initSelection"),this._isInitialized=!1,a.call(this,b,c)}return b.prototype.current=function(b,c){var d=this;if(this._isInitialized)return void b.call(this,c);this.initSelection.call(null,this.$element,function(b){d._isInitialized=!0,a.isArray(b)||(b=[b]),c(b)})},b}),b.define("select2/compat/inputData",["jquery"],function(a){function b(a,b,c){this._currentData=[],this._valueSeparator=c.get("valueSeparator")||",","hidden"===b.prop("type")&&c.get("debug")&&console&&console.warn&&console.warn("Select2: Using a hidden input with Select2 is no longer supported and may stop working in the future. It is recommended to use a `<select>` element instead."),a.call(this,b,c)}return b.prototype.current=function(b,c){function d(b,c){var e=[];return b.selected||-1!==a.inArray(b.id,c)?(b.selected=!0,e.push(b)):b.selected=!1,b.children&&e.push.apply(e,d(b.children,c)),e}for(var e=[],f=0;f<this._currentData.length;f++){var g=this._currentData[f];e.push.apply(e,d(g,this.$element.val().split(this._valueSeparator)))}c(e)},b.prototype.select=function(b,c){if(this.options.get("multiple")){var d=this.$element.val();d+=this._valueSeparator+c.id,this.$element.val(d),this.$element.trigger("change")}else this.current(function(b){a.map(b,function(a){a.selected=!1})}),this.$element.val(c.id),this.$element.trigger("change")},b.prototype.unselect=function(a,b){var c=this;b.selected=!1,this.current(function(a){for(var d=[],e=0;e<a.length;e++){var f=a[e];b.id!=f.id&&d.push(f.id)}c.$element.val(d.join(c._valueSeparator)),c.$element.trigger("change")})},b.prototype.query=function(a,b,c){for(var d=[],e=0;e<this._currentData.length;e++){var f=this._currentData[e],g=this.matches(b,f);null!==g&&d.push(g)}c({results:d})},b.prototype.addOptions=function(b,c){var d=a.map(c,function(b){return a.data(b[0],"data")});this._currentData.push.apply(this._currentData,d)},b}),b.define("select2/compat/matcher",["jquery"],function(a){function b(b){function c(c,d){var e=a.extend(!0,{},d);if(null==c.term||""===a.trim(c.term))return e;if(d.children){for(var f=d.children.length-1;f>=0;f--){var g=d.children[f];b(c.term,g.text,g)||e.children.splice(f,1)}if(e.children.length>0)return e}return b(c.term,d.text,d)?e:null}return c}return b}),b.define("select2/compat/query",[],function(){function a(a,b,c){c.get("debug")&&window.console&&console.warn&&console.warn("Select2: The `query` option has been deprecated in favor of a custom data adapter that overrides the `query` method. Support will be removed for the `query` option in future versions of Select2."),a.call(this,b,c)}return a.prototype.query=function(a,b,c){b.callback=c,this.options.get("query").call(null,b)},a}),b.define("select2/dropdown/attachContainer",[],function(){function a(a,b,c){a.call(this,b,c)}return a.prototype.position=function(a,b,c){c.find(".dropdown-wrapper").append(b),b.addClass("select2-dropdown--below"),c.addClass("select2-container--below")},a}),b.define("select2/dropdown/stopPropagation",[],function(){function a(){}return a.prototype.bind=function(a,b,c){a.call(this,b,c);var d=["blur","change","click","dblclick","focus","focusin","focusout","input","keydown","keyup","keypress","mousedown","mouseenter","mouseleave","mousemove","mouseover","mouseup","search","touchend","touchstart"];this.$dropdown.on(d.join(" "),function(a){a.stopPropagation()})},a}),b.define("select2/selection/stopPropagation",[],function(){function a(){}return a.prototype.bind=function(a,b,c){a.call(this,b,c);var d=["blur","change","click","dblclick","focus","focusin","focusout","input","keydown","keyup","keypress","mousedown","mouseenter","mouseleave","mousemove","mouseover","mouseup","search","touchend","touchstart"];this.$selection.on(d.join(" "),function(a){a.stopPropagation()})},a}),function(c){"function"==typeof b.define&&b.define.amd?b.define("jquery-mousewheel",["jquery"],c):"object"==typeof exports?module.exports=c:c(a)}(function(a){function b(b){var g=b||window.event,h=i.call(arguments,1),j=0,l=0,m=0,n=0,o=0,p=0;if(b=a.event.fix(g),b.type="mousewheel","detail"in g&&(m=-1*g.detail),"wheelDelta"in g&&(m=g.wheelDelta),"wheelDeltaY"in g&&(m=g.wheelDeltaY),"wheelDeltaX"in g&&(l=-1*g.wheelDeltaX),"axis"in g&&g.axis===g.HORIZONTAL_AXIS&&(l=-1*m,m=0),j=0===m?l:m,"deltaY"in g&&(m=-1*g.deltaY,j=m),"deltaX"in g&&(l=g.deltaX,0===m&&(j=-1*l)),0!==m||0!==l){if(1===g.deltaMode){var q=a.data(this,"mousewheel-line-height");j*=q,m*=q,l*=q}else if(2===g.deltaMode){var r=a.data(this,"mousewheel-page-height");j*=r,m*=r,l*=r}if(n=Math.max(Math.abs(m),Math.abs(l)),(!f||n<f)&&(f=n,d(g,n)&&(f/=40)),d(g,n)&&(j/=40,l/=40,m/=40),j=Math[j>=1?"floor":"ceil"](j/f),l=Math[l>=1?"floor":"ceil"](l/f),m=Math[m>=1?"floor":"ceil"](m/f),k.settings.normalizeOffset&&this.getBoundingClientRect){var s=this.getBoundingClientRect();o=b.clientX-s.left,p=b.clientY-s.top}return b.deltaX=l,b.deltaY=m,b.deltaFactor=f,b.offsetX=o,b.offsetY=p,b.deltaMode=0,h.unshift(b,j,l,m),e&&clearTimeout(e),e=setTimeout(c,200),(a.event.dispatch||a.event.handle).apply(this,h)}}function c(){f=null}function d(a,b){return k.settings.adjustOldDeltas&&"mousewheel"===a.type&&b%120==0}var e,f,g=["wheel","mousewheel","DOMMouseScroll","MozMousePixelScroll"],h="onwheel"in document||document.documentMode>=9?["wheel"]:["mousewheel","DomMouseScroll","MozMousePixelScroll"],i=Array.prototype.slice;if(a.event.fixHooks)for(var j=g.length;j;)a.event.fixHooks[g[--j]]=a.event.mouseHooks;var k=a.event.special.mousewheel={version:"3.1.12",setup:function(){if(this.addEventListener)for(var c=h.length;c;)this.addEventListener(h[--c],b,!1);else this.onmousewheel=b;a.data(this,"mousewheel-line-height",k.getLineHeight(this)),a.data(this,"mousewheel-page-height",k.getPageHeight(this))},teardown:function(){if(this.removeEventListener)for(var c=h.length;c;)this.removeEventListener(h[--c],b,!1);else this.onmousewheel=null;a.removeData(this,"mousewheel-line-height"),a.removeData(this,"mousewheel-page-height")},getLineHeight:function(b){var c=a(b),d=c["offsetParent"in a.fn?"offsetParent":"parent"]();return d.length||(d=a("body")),parseInt(d.css("fontSize"),10)||parseInt(c.css("fontSize"),10)||16},getPageHeight:function(b){return a(b).height()},settings:{adjustOldDeltas:!0,normalizeOffset:!0}};a.fn.extend({mousewheel:function(a){return a?this.bind("mousewheel",a):this.trigger("mousewheel")},unmousewheel:function(a){return this.unbind("mousewheel",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});
 
1
+ /*! Select2 4.0.10 | https://github.com/select2/select2/blob/master/LICENSE.md */
2
+ !function(n){"function"==typeof define&&define.amd?define(["jquery"],n):"object"==typeof module&&module.exports?module.exports=function(e,t){return void 0===t&&(t="undefined"!=typeof window?require("jquery"):require("jquery")(e)),n(t),t}:n(jQuery)}(function(d){var e=function(){if(d&&d.fn&&d.fn.select2&&d.fn.select2.amd)var e=d.fn.select2.amd;var t,n,i,h,o,s,f,g,m,v,y,_,r,a,w,l;function b(e,t){return r.call(e,t)}function c(e,t){var n,i,r,o,s,a,l,c,u,d,p,h=t&&t.split("/"),f=y.map,g=f&&f["*"]||{};if(e){for(s=(e=e.split("/")).length-1,y.nodeIdCompat&&w.test(e[s])&&(e[s]=e[s].replace(w,"")),"."===e[0].charAt(0)&&h&&(e=h.slice(0,h.length-1).concat(e)),u=0;u<e.length;u++)if("."===(p=e[u]))e.splice(u,1),u-=1;else if(".."===p){if(0===u||1===u&&".."===e[2]||".."===e[u-1])continue;0<u&&(e.splice(u-1,2),u-=2)}e=e.join("/")}if((h||g)&&f){for(u=(n=e.split("/")).length;0<u;u-=1){if(i=n.slice(0,u).join("/"),h)for(d=h.length;0<d;d-=1)if(r=(r=f[h.slice(0,d).join("/")])&&r[i]){o=r,a=u;break}if(o)break;!l&&g&&g[i]&&(l=g[i],c=u)}!o&&l&&(o=l,a=c),o&&(n.splice(0,a,o),e=n.join("/"))}return e}function A(t,n){return function(){var e=a.call(arguments,0);return"string"!=typeof e[0]&&1===e.length&&e.push(null),s.apply(h,e.concat([t,n]))}}function x(t){return function(e){m[t]=e}}function S(e){if(b(v,e)){var t=v[e];delete v[e],_[e]=!0,o.apply(h,t)}if(!b(m,e)&&!b(_,e))throw new Error("No "+e);return m[e]}function u(e){var t,n=e?e.indexOf("!"):-1;return-1<n&&(t=e.substring(0,n),e=e.substring(n+1,e.length)),[t,e]}function D(e){return e?u(e):[]}return e&&e.requirejs||(e?n=e:e={},m={},v={},y={},_={},r=Object.prototype.hasOwnProperty,a=[].slice,w=/\.js$/,f=function(e,t){var n,i=u(e),r=i[0],o=t[1];return e=i[1],r&&(n=S(r=c(r,o))),r?e=n&&n.normalize?n.normalize(e,function(t){return function(e){return c(e,t)}}(o)):c(e,o):(r=(i=u(e=c(e,o)))[0],e=i[1],r&&(n=S(r))),{f:r?r+"!"+e:e,n:e,pr:r,p:n}},g={require:function(e){return A(e)},exports:function(e){var t=m[e];return void 0!==t?t:m[e]={}},module:function(e){return{id:e,uri:"",exports:m[e],config:function(e){return function(){return y&&y.config&&y.config[e]||{}}}(e)}}},o=function(e,t,n,i){var r,o,s,a,l,c,u,d=[],p=typeof n;if(c=D(i=i||e),"undefined"==p||"function"==p){for(t=!t.length&&n.length?["require","exports","module"]:t,l=0;l<t.length;l+=1)if("require"===(o=(a=f(t[l],c)).f))d[l]=g.require(e);else if("exports"===o)d[l]=g.exports(e),u=!0;else if("module"===o)r=d[l]=g.module(e);else if(b(m,o)||b(v,o)||b(_,o))d[l]=S(o);else{if(!a.p)throw new Error(e+" missing "+o);a.p.load(a.n,A(i,!0),x(o),{}),d[l]=m[o]}s=n?n.apply(m[e],d):void 0,e&&(r&&r.exports!==h&&r.exports!==m[e]?m[e]=r.exports:s===h&&u||(m[e]=s))}else e&&(m[e]=n)},t=n=s=function(e,t,n,i,r){if("string"==typeof e)return g[e]?g[e](t):S(f(e,D(t)).f);if(!e.splice){if((y=e).deps&&s(y.deps,y.callback),!t)return;t.splice?(e=t,t=n,n=null):e=h}return t=t||function(){},"function"==typeof n&&(n=i,i=r),i?o(h,e,t,n):setTimeout(function(){o(h,e,t,n)},4),s},s.config=function(e){return s(e)},t._defined=m,(i=function(e,t,n){if("string"!=typeof e)throw new Error("See almond README: incorrect module build, no module name");t.splice||(n=t,t=[]),b(m,e)||b(v,e)||(v[e]=[e,t,n])}).amd={jQuery:!0},e.requirejs=t,e.require=n,e.define=i),e.define("almond",function(){}),e.define("jquery",[],function(){var e=d||$;return null==e&&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."),e}),e.define("select2/utils",["jquery"],function(o){var r={};function u(e){var t=e.prototype,n=[];for(var i in t){"function"==typeof t[i]&&"constructor"!==i&&n.push(i)}return n}r.Extend=function(e,t){var n={}.hasOwnProperty;function i(){this.constructor=e}for(var r in t)n.call(t,r)&&(e[r]=t[r]);return i.prototype=t.prototype,e.prototype=new i,e.__super__=t.prototype,e},r.Decorate=function(i,r){var e=u(r),t=u(i);function o(){var e=Array.prototype.unshift,t=r.prototype.constructor.length,n=i.prototype.constructor;0<t&&(e.call(arguments,i.prototype.constructor),n=r.prototype.constructor),n.apply(this,arguments)}r.displayName=i.displayName,o.prototype=new function(){this.constructor=o};for(var n=0;n<t.length;n++){var s=t[n];o.prototype[s]=i.prototype[s]}function a(e){var t=function(){};e in o.prototype&&(t=o.prototype[e]);var n=r.prototype[e];return function(){return Array.prototype.unshift.call(arguments,t),n.apply(this,arguments)}}for(var l=0;l<e.length;l++){var c=e[l];o.prototype[c]=a(c)}return o};function e(){this.listeners={}}e.prototype.on=function(e,t){this.listeners=this.listeners||{},e in this.listeners?this.listeners[e].push(t):this.listeners[e]=[t]},e.prototype.trigger=function(e){var t=Array.prototype.slice,n=t.call(arguments,1);this.listeners=this.listeners||{},null==n&&(n=[]),0===n.length&&n.push({}),(n[0]._type=e)in this.listeners&&this.invoke(this.listeners[e],t.call(arguments,1)),"*"in this.listeners&&this.invoke(this.listeners["*"],arguments)},e.prototype.invoke=function(e,t){for(var n=0,i=e.length;n<i;n++)e[n].apply(this,t)},r.Observable=e,r.generateChars=function(e){for(var t="",n=0;n<e;n++){t+=Math.floor(36*Math.random()).toString(36)}return t},r.bind=function(e,t){return function(){e.apply(t,arguments)}},r._convertData=function(e){for(var t in e){var n=t.split("-"),i=e;if(1!==n.length){for(var r=0;r<n.length;r++){var o=n[r];(o=o.substring(0,1).toLowerCase()+o.substring(1))in i||(i[o]={}),r==n.length-1&&(i[o]=e[t]),i=i[o]}delete e[t]}}return e},r.hasScroll=function(e,t){var n=o(t),i=t.style.overflowX,r=t.style.overflowY;return(i!==r||"hidden"!==r&&"visible"!==r)&&("scroll"===i||"scroll"===r||(n.innerHeight()<t.scrollHeight||n.innerWidth()<t.scrollWidth))},r.escapeMarkup=function(e){var t={"\\":"&#92;","&":"&amp;","<":"&lt;",">":"&gt;",'"':"&quot;","'":"&#39;","/":"&#47;"};return"string"!=typeof e?e:String(e).replace(/[&<>"'\/\\]/g,function(e){return t[e]})},r.appendMany=function(e,t){if("1.7"===o.fn.jquery.substr(0,3)){var n=o();o.map(t,function(e){n=n.add(e)}),t=n}e.append(t)},r.__cache={};var n=0;return r.GetUniqueElementId=function(e){var t=e.getAttribute("data-select2-id");return null==t&&(e.id?(t=e.id,e.setAttribute("data-select2-id",t)):(e.setAttribute("data-select2-id",++n),t=n.toString())),t},r.StoreData=function(e,t,n){var i=r.GetUniqueElementId(e);r.__cache[i]||(r.__cache[i]={}),r.__cache[i][t]=n},r.GetData=function(e,t){var n=r.GetUniqueElementId(e);return t?r.__cache[n]&&null!=r.__cache[n][t]?r.__cache[n][t]:o(e).data(t):r.__cache[n]},r.RemoveData=function(e){var t=r.GetUniqueElementId(e);null!=r.__cache[t]&&delete r.__cache[t],e.removeAttribute("data-select2-id")},r}),e.define("select2/results",["jquery","./utils"],function(h,f){function i(e,t,n){this.$element=e,this.data=n,this.options=t,i.__super__.constructor.call(this)}return f.Extend(i,f.Observable),i.prototype.render=function(){var e=h('<ul class="select2-results__options" role="listbox"></ul>');return this.options.get("multiple")&&e.attr("aria-multiselectable","true"),this.$results=e},i.prototype.clear=function(){this.$results.empty()},i.prototype.displayMessage=function(e){var t=this.options.get("escapeMarkup");this.clear(),this.hideLoading();var n=h('<li role="alert" aria-live="assertive" class="select2-results__option"></li>'),i=this.options.get("translations").get(e.message);n.append(t(i(e.args))),n[0].className+=" select2-results__message",this.$results.append(n)},i.prototype.hideMessages=function(){this.$results.find(".select2-results__message").remove()},i.prototype.append=function(e){this.hideLoading();var t=[];if(null!=e.results&&0!==e.results.length){e.results=this.sort(e.results);for(var n=0;n<e.results.length;n++){var i=e.results[n],r=this.option(i);t.push(r)}this.$results.append(t)}else 0===this.$results.children().length&&this.trigger("results:message",{message:"noResults"})},i.prototype.position=function(e,t){t.find(".select2-results").append(e)},i.prototype.sort=function(e){return this.options.get("sorter")(e)},i.prototype.highlightFirstItem=function(){var e=this.$results.find(".select2-results__option[aria-selected]"),t=e.filter("[aria-selected=true]");0<t.length?t.first().trigger("mouseenter"):e.first().trigger("mouseenter"),this.ensureHighlightVisible()},i.prototype.setClasses=function(){var t=this;this.data.current(function(e){var i=h.map(e,function(e){return e.id.toString()});t.$results.find(".select2-results__option[aria-selected]").each(function(){var e=h(this),t=f.GetData(this,"data"),n=""+t.id;null!=t.element&&t.element.selected||null==t.element&&-1<h.inArray(n,i)?e.attr("aria-selected","true"):e.attr("aria-selected","false")})})},i.prototype.showLoading=function(e){this.hideLoading();var t={disabled:!0,loading:!0,text:this.options.get("translations").get("searching")(e)},n=this.option(t);n.className+=" loading-results",this.$results.prepend(n)},i.prototype.hideLoading=function(){this.$results.find(".loading-results").remove()},i.prototype.option=function(e){var t=document.createElement("li");t.className="select2-results__option";var n={role:"option","aria-selected":"false"},i=window.Element.prototype.matches||window.Element.prototype.msMatchesSelector||window.Element.prototype.webkitMatchesSelector;for(var r in(null!=e.element&&i.call(e.element,":disabled")||null==e.element&&e.disabled)&&(delete n["aria-selected"],n["aria-disabled"]="true"),null==e.id&&delete n["aria-selected"],null!=e._resultId&&(t.id=e._resultId),e.title&&(t.title=e.title),e.children&&(n.role="group",n["aria-label"]=e.text,delete n["aria-selected"]),n){var o=n[r];t.setAttribute(r,o)}if(e.children){var s=h(t),a=document.createElement("strong");a.className="select2-results__group";h(a);this.template(e,a);for(var l=[],c=0;c<e.children.length;c++){var u=e.children[c],d=this.option(u);l.push(d)}var p=h("<ul></ul>",{class:"select2-results__options select2-results__options--nested"});p.append(l),s.append(a),s.append(p)}else this.template(e,t);return f.StoreData(t,"data",e),t},i.prototype.bind=function(t,e){var l=this,n=t.id+"-results";this.$results.attr("id",n),t.on("results:all",function(e){l.clear(),l.append(e.data),t.isOpen()&&(l.setClasses(),l.highlightFirstItem())}),t.on("results:append",function(e){l.append(e.data),t.isOpen()&&l.setClasses()}),t.on("query",function(e){l.hideMessages(),l.showLoading(e)}),t.on("select",function(){t.isOpen()&&(l.setClasses(),l.options.get("scrollAfterSelect")&&l.highlightFirstItem())}),t.on("unselect",function(){t.isOpen()&&(l.setClasses(),l.options.get("scrollAfterSelect")&&l.highlightFirstItem())}),t.on("open",function(){l.$results.attr("aria-expanded","true"),l.$results.attr("aria-hidden","false"),l.setClasses(),l.ensureHighlightVisible()}),t.on("close",function(){l.$results.attr("aria-expanded","false"),l.$results.attr("aria-hidden","true"),l.$results.removeAttr("aria-activedescendant")}),t.on("results:toggle",function(){var e=l.getHighlightedResults();0!==e.length&&e.trigger("mouseup")}),t.on("results:select",function(){var e=l.getHighlightedResults();if(0!==e.length){var t=f.GetData(e[0],"data");"true"==e.attr("aria-selected")?l.trigger("close",{}):l.trigger("select",{data:t})}}),t.on("results:previous",function(){var e=l.getHighlightedResults(),t=l.$results.find("[aria-selected]"),n=t.index(e);if(!(n<=0)){var i=n-1;0===e.length&&(i=0);var r=t.eq(i);r.trigger("mouseenter");var o=l.$results.offset().top,s=r.offset().top,a=l.$results.scrollTop()+(s-o);0===i?l.$results.scrollTop(0):s-o<0&&l.$results.scrollTop(a)}}),t.on("results:next",function(){var e=l.getHighlightedResults(),t=l.$results.find("[aria-selected]"),n=t.index(e)+1;if(!(n>=t.length)){var i=t.eq(n);i.trigger("mouseenter");var r=l.$results.offset().top+l.$results.outerHeight(!1),o=i.offset().top+i.outerHeight(!1),s=l.$results.scrollTop()+o-r;0===n?l.$results.scrollTop(0):r<o&&l.$results.scrollTop(s)}}),t.on("results:focus",function(e){e.element.addClass("select2-results__option--highlighted")}),t.on("results:message",function(e){l.displayMessage(e)}),h.fn.mousewheel&&this.$results.on("mousewheel",function(e){var t=l.$results.scrollTop(),n=l.$results.get(0).scrollHeight-t+e.deltaY,i=0<e.deltaY&&t-e.deltaY<=0,r=e.deltaY<0&&n<=l.$results.height();i?(l.$results.scrollTop(0),e.preventDefault(),e.stopPropagation()):r&&(l.$results.scrollTop(l.$results.get(0).scrollHeight-l.$results.height()),e.preventDefault(),e.stopPropagation())}),this.$results.on("mouseup",".select2-results__option[aria-selected]",function(e){var t=h(this),n=f.GetData(this,"data");"true"!==t.attr("aria-selected")?l.trigger("select",{originalEvent:e,data:n}):l.options.get("multiple")?l.trigger("unselect",{originalEvent:e,data:n}):l.trigger("close",{})}),this.$results.on("mouseenter",".select2-results__option[aria-selected]",function(e){var t=f.GetData(this,"data");l.getHighlightedResults().removeClass("select2-results__option--highlighted"),l.trigger("results:focus",{data:t,element:h(this)})})},i.prototype.getHighlightedResults=function(){return this.$results.find(".select2-results__option--highlighted")},i.prototype.destroy=function(){this.$results.remove()},i.prototype.ensureHighlightVisible=function(){var e=this.getHighlightedResults();if(0!==e.length){var t=this.$results.find("[aria-selected]").index(e),n=this.$results.offset().top,i=e.offset().top,r=this.$results.scrollTop()+(i-n),o=i-n;r-=2*e.outerHeight(!1),t<=2?this.$results.scrollTop(0):(o>this.$results.outerHeight()||o<0)&&this.$results.scrollTop(r)}},i.prototype.template=function(e,t){var n=this.options.get("templateResult"),i=this.options.get("escapeMarkup"),r=n(e,t);null==r?t.style.display="none":"string"==typeof r?t.innerHTML=i(r):h(t).append(r)},i}),e.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}}),e.define("select2/selection/base",["jquery","../utils","../keys"],function(n,i,r){function o(e,t){this.$element=e,this.options=t,o.__super__.constructor.call(this)}return i.Extend(o,i.Observable),o.prototype.render=function(){var e=n('<span class="select2-selection" role="combobox" aria-haspopup="true" aria-expanded="false"></span>');return this._tabindex=0,null!=i.GetData(this.$element[0],"old-tabindex")?this._tabindex=i.GetData(this.$element[0],"old-tabindex"):null!=this.$element.attr("tabindex")&&(this._tabindex=this.$element.attr("tabindex")),e.attr("title",this.$element.attr("title")),e.attr("tabindex",this._tabindex),e.attr("aria-disabled","false"),this.$selection=e},o.prototype.bind=function(e,t){var n=this,i=e.id+"-results";this.container=e,this.$selection.on("focus",function(e){n.trigger("focus",e)}),this.$selection.on("blur",function(e){n._handleBlur(e)}),this.$selection.on("keydown",function(e){n.trigger("keypress",e),e.which===r.SPACE&&e.preventDefault()}),e.on("results:focus",function(e){n.$selection.attr("aria-activedescendant",e.data._resultId)}),e.on("selection:update",function(e){n.update(e.data)}),e.on("open",function(){n.$selection.attr("aria-expanded","true"),n.$selection.attr("aria-owns",i),n._attachCloseHandler(e)}),e.on("close",function(){n.$selection.attr("aria-expanded","false"),n.$selection.removeAttr("aria-activedescendant"),n.$selection.removeAttr("aria-owns"),n.$selection.trigger("focus"),n._detachCloseHandler(e)}),e.on("enable",function(){n.$selection.attr("tabindex",n._tabindex),n.$selection.attr("aria-disabled","false")}),e.on("disable",function(){n.$selection.attr("tabindex","-1"),n.$selection.attr("aria-disabled","true")})},o.prototype._handleBlur=function(e){var t=this;window.setTimeout(function(){document.activeElement==t.$selection[0]||n.contains(t.$selection[0],document.activeElement)||t.trigger("blur",e)},1)},o.prototype._attachCloseHandler=function(e){n(document.body).on("mousedown.select2."+e.id,function(e){var t=n(e.target).closest(".select2");n(".select2.select2-container--open").each(function(){this!=t[0]&&i.GetData(this,"element").select2("close")})})},o.prototype._detachCloseHandler=function(e){n(document.body).off("mousedown.select2."+e.id)},o.prototype.position=function(e,t){t.find(".selection").append(e)},o.prototype.destroy=function(){this._detachCloseHandler(this.container)},o.prototype.update=function(e){throw new Error("The `update` method must be defined in child classes.")},o}),e.define("select2/selection/single",["jquery","./base","../utils","../keys"],function(e,t,n,i){function r(){r.__super__.constructor.apply(this,arguments)}return n.Extend(r,t),r.prototype.render=function(){var e=r.__super__.render.call(this);return e.addClass("select2-selection--single"),e.html('<span class="select2-selection__rendered"></span><span class="select2-selection__arrow" role="presentation"><b role="presentation"></b></span>'),e},r.prototype.bind=function(t,e){var n=this;r.__super__.bind.apply(this,arguments);var i=t.id+"-container";this.$selection.find(".select2-selection__rendered").attr("id",i).attr("role","textbox").attr("aria-readonly","true"),this.$selection.attr("aria-labelledby",i),this.$selection.on("mousedown",function(e){1===e.which&&n.trigger("toggle",{originalEvent:e})}),this.$selection.on("focus",function(e){}),this.$selection.on("blur",function(e){}),t.on("focus",function(e){t.isOpen()||n.$selection.trigger("focus")})},r.prototype.clear=function(){var e=this.$selection.find(".select2-selection__rendered");e.empty(),e.removeAttr("title")},r.prototype.display=function(e,t){var n=this.options.get("templateSelection");return this.options.get("escapeMarkup")(n(e,t))},r.prototype.selectionContainer=function(){return e("<span></span>")},r.prototype.update=function(e){if(0!==e.length){var t=e[0],n=this.$selection.find(".select2-selection__rendered"),i=this.display(t,n);n.empty().append(i);var r=t.title||t.text;r?n.attr("title",r):n.removeAttr("title")}else this.clear()},r}),e.define("select2/selection/multiple",["jquery","./base","../utils"],function(r,e,l){function n(e,t){n.__super__.constructor.apply(this,arguments)}return l.Extend(n,e),n.prototype.render=function(){var e=n.__super__.render.call(this);return e.addClass("select2-selection--multiple"),e.html('<ul class="select2-selection__rendered"></ul>'),e},n.prototype.bind=function(e,t){var i=this;n.__super__.bind.apply(this,arguments),this.$selection.on("click",function(e){i.trigger("toggle",{originalEvent:e})}),this.$selection.on("click",".select2-selection__choice__remove",function(e){if(!i.options.get("disabled")){var t=r(this).parent(),n=l.GetData(t[0],"data");i.trigger("unselect",{originalEvent:e,data:n})}})},n.prototype.clear=function(){var e=this.$selection.find(".select2-selection__rendered");e.empty(),e.removeAttr("title")},n.prototype.display=function(e,t){var n=this.options.get("templateSelection");return this.options.get("escapeMarkup")(n(e,t))},n.prototype.selectionContainer=function(){return r('<li class="select2-selection__choice"><span class="select2-selection__choice__remove" role="presentation">&times;</span></li>')},n.prototype.update=function(e){if(this.clear(),0!==e.length){for(var t=[],n=0;n<e.length;n++){var i=e[n],r=this.selectionContainer(),o=this.display(i,r);r.append(o);var s=i.title||i.text;s&&r.attr("title",s),l.StoreData(r[0],"data",i),t.push(r)}var a=this.$selection.find(".select2-selection__rendered");l.appendMany(a,t)}},n}),e.define("select2/selection/placeholder",["../utils"],function(e){function t(e,t,n){this.placeholder=this.normalizePlaceholder(n.get("placeholder")),e.call(this,t,n)}return t.prototype.normalizePlaceholder=function(e,t){return"string"==typeof t&&(t={id:"",text:t}),t},t.prototype.createPlaceholder=function(e,t){var n=this.selectionContainer();return n.html(this.display(t)),n.addClass("select2-selection__placeholder").removeClass("select2-selection__choice"),n},t.prototype.update=function(e,t){var n=1==t.length&&t[0].id!=this.placeholder.id;if(1<t.length||n)return e.call(this,t);this.clear();var i=this.createPlaceholder(this.placeholder);this.$selection.find(".select2-selection__rendered").append(i)},t}),e.define("select2/selection/allowClear",["jquery","../keys","../utils"],function(r,i,a){function e(){}return e.prototype.bind=function(e,t,n){var i=this;e.call(this,t,n),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(e){i._handleClear(e)}),t.on("keypress",function(e){i._handleKeyboardClear(e,t)})},e.prototype._handleClear=function(e,t){if(!this.options.get("disabled")){var n=this.$selection.find(".select2-selection__clear");if(0!==n.length){t.stopPropagation();var i=a.GetData(n[0],"data"),r=this.$element.val();this.$element.val(this.placeholder.id);var o={data:i};if(this.trigger("clear",o),o.prevented)this.$element.val(r);else{for(var s=0;s<i.length;s++)if(o={data:i[s]},this.trigger("unselect",o),o.prevented)return void this.$element.val(r);this.$element.trigger("change"),this.trigger("toggle",{})}}}},e.prototype._handleKeyboardClear=function(e,t,n){n.isOpen()||t.which!=i.DELETE&&t.which!=i.BACKSPACE||this._handleClear(t)},e.prototype.update=function(e,t){if(e.call(this,t),!(0<this.$selection.find(".select2-selection__placeholder").length||0===t.length)){var n=this.options.get("translations").get("removeAllItems"),i=r('<span class="select2-selection__clear" title="'+n()+'">&times;</span>');a.StoreData(i[0],"data",t),this.$selection.find(".select2-selection__rendered").prepend(i)}},e}),e.define("select2/selection/search",["jquery","../utils","../keys"],function(i,a,l){function e(e,t,n){e.call(this,t,n)}return e.prototype.render=function(e){var t=i('<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="searchbox" aria-autocomplete="list" /></li>');this.$searchContainer=t,this.$search=t.find("input");var n=e.call(this);return this._transferTabIndex(),n},e.prototype.bind=function(e,t,n){var i=this,r=t.id+"-results";e.call(this,t,n),t.on("open",function(){i.$search.attr("aria-controls",r),i.$search.trigger("focus")}),t.on("close",function(){i.$search.val(""),i.$search.removeAttr("aria-controls"),i.$search.removeAttr("aria-activedescendant"),i.$search.trigger("focus")}),t.on("enable",function(){i.$search.prop("disabled",!1),i._transferTabIndex()}),t.on("disable",function(){i.$search.prop("disabled",!0)}),t.on("focus",function(e){i.$search.trigger("focus")}),t.on("results:focus",function(e){e.data._resultId?i.$search.attr("aria-activedescendant",e.data._resultId):i.$search.removeAttr("aria-activedescendant")}),this.$selection.on("focusin",".select2-search--inline",function(e){i.trigger("focus",e)}),this.$selection.on("focusout",".select2-search--inline",function(e){i._handleBlur(e)}),this.$selection.on("keydown",".select2-search--inline",function(e){if(e.stopPropagation(),i.trigger("keypress",e),i._keyUpPrevented=e.isDefaultPrevented(),e.which===l.BACKSPACE&&""===i.$search.val()){var t=i.$searchContainer.prev(".select2-selection__choice");if(0<t.length){var n=a.GetData(t[0],"data");i.searchRemoveChoice(n),e.preventDefault()}}}),this.$selection.on("click",".select2-search--inline",function(e){i.$search.val()&&e.stopPropagation()});var o=document.documentMode,s=o&&o<=11;this.$selection.on("input.searchcheck",".select2-search--inline",function(e){s?i.$selection.off("input.search input.searchcheck"):i.$selection.off("keyup.search")}),this.$selection.on("keyup.search input.search",".select2-search--inline",function(e){if(s&&"input"===e.type)i.$selection.off("input.search input.searchcheck");else{var t=e.which;t!=l.SHIFT&&t!=l.CTRL&&t!=l.ALT&&t!=l.TAB&&i.handleSearch(e)}})},e.prototype._transferTabIndex=function(e){this.$search.attr("tabindex",this.$selection.attr("tabindex")),this.$selection.attr("tabindex","-1")},e.prototype.createPlaceholder=function(e,t){this.$search.attr("placeholder",t.text)},e.prototype.update=function(e,t){var n=this.$search[0]==document.activeElement;this.$search.attr("placeholder",""),e.call(this,t),this.$selection.find(".select2-selection__rendered").append(this.$searchContainer),this.resizeSearch(),n&&this.$search.trigger("focus")},e.prototype.handleSearch=function(){if(this.resizeSearch(),!this._keyUpPrevented){var e=this.$search.val();this.trigger("query",{term:e})}this._keyUpPrevented=!1},e.prototype.searchRemoveChoice=function(e,t){this.trigger("unselect",{data:t}),this.$search.val(t.text),this.handleSearch()},e.prototype.resizeSearch=function(){this.$search.css("width","25px");var e="";""!==this.$search.attr("placeholder")?e=this.$selection.find(".select2-selection__rendered").width():e=.75*(this.$search.val().length+1)+"em";this.$search.css("width",e)},e}),e.define("select2/selection/eventRelay",["jquery"],function(s){function e(){}return e.prototype.bind=function(e,t,n){var i=this,r=["open","opening","close","closing","select","selecting","unselect","unselecting","clear","clearing"],o=["opening","closing","selecting","unselecting","clearing"];e.call(this,t,n),t.on("*",function(e,t){if(-1!==s.inArray(e,r)){t=t||{};var n=s.Event("select2:"+e,{params:t});i.$element.trigger(n),-1!==s.inArray(e,o)&&(t.prevented=n.isDefaultPrevented())}})},e}),e.define("select2/translation",["jquery","require"],function(t,n){function i(e){this.dict=e||{}}return i.prototype.all=function(){return this.dict},i.prototype.get=function(e){return this.dict[e]},i.prototype.extend=function(e){this.dict=t.extend({},e.all(),this.dict)},i._cache={},i.loadPath=function(e){if(!(e in i._cache)){var t=n(e);i._cache[e]=t}return new i(i._cache[e])},i}),e.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","Œ":"OE","Ƣ":"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","œ":"oe","ƣ":"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","Ά":"Α","Έ":"Ε","Ή":"Η","Ί":"Ι","Ϊ":"Ι","Ό":"Ο","Ύ":"Υ","Ϋ":"Υ","Ώ":"Ω","ά":"α","έ":"ε","ή":"η","ί":"ι","ϊ":"ι","ΐ":"ι","ό":"ο","ύ":"υ","ϋ":"υ","ΰ":"υ","ώ":"ω","ς":"σ","’":"'"}}),e.define("select2/data/base",["../utils"],function(i){function n(e,t){n.__super__.constructor.call(this)}return i.Extend(n,i.Observable),n.prototype.current=function(e){throw new Error("The `current` method must be defined in child classes.")},n.prototype.query=function(e,t){throw new Error("The `query` method must be defined in child classes.")},n.prototype.bind=function(e,t){},n.prototype.destroy=function(){},n.prototype.generateResultId=function(e,t){var n=e.id+"-result-";return n+=i.generateChars(4),null!=t.id?n+="-"+t.id.toString():n+="-"+i.generateChars(4),n},n}),e.define("select2/data/select",["./base","../utils","jquery"],function(e,a,l){function n(e,t){this.$element=e,this.options=t,n.__super__.constructor.call(this)}return a.Extend(n,e),n.prototype.current=function(e){var n=[],i=this;this.$element.find(":selected").each(function(){var e=l(this),t=i.item(e);n.push(t)}),e(n)},n.prototype.select=function(r){var o=this;if(r.selected=!0,l(r.element).is("option"))return r.element.selected=!0,void this.$element.trigger("change");if(this.$element.prop("multiple"))this.current(function(e){var t=[];(r=[r]).push.apply(r,e);for(var n=0;n<r.length;n++){var i=r[n].id;-1===l.inArray(i,t)&&t.push(i)}o.$element.val(t),o.$element.trigger("change")});else{var e=r.id;this.$element.val(e),this.$element.trigger("change")}},n.prototype.unselect=function(r){var o=this;if(this.$element.prop("multiple")){if(r.selected=!1,l(r.element).is("option"))return r.element.selected=!1,void this.$element.trigger("change");this.current(function(e){for(var t=[],n=0;n<e.length;n++){var i=e[n].id;i!==r.id&&-1===l.inArray(i,t)&&t.push(i)}o.$element.val(t),o.$element.trigger("change")})}},n.prototype.bind=function(e,t){var n=this;(this.container=e).on("select",function(e){n.select(e.data)}),e.on("unselect",function(e){n.unselect(e.data)})},n.prototype.destroy=function(){this.$element.find("*").each(function(){a.RemoveData(this)})},n.prototype.query=function(i,e){var r=[],o=this;this.$element.children().each(function(){var e=l(this);if(e.is("option")||e.is("optgroup")){var t=o.item(e),n=o.matches(i,t);null!==n&&r.push(n)}}),e({results:r})},n.prototype.addOptions=function(e){a.appendMany(this.$element,e)},n.prototype.option=function(e){var t;e.children?(t=document.createElement("optgroup")).label=e.text:void 0!==(t=document.createElement("option")).textContent?t.textContent=e.text:t.innerText=e.text,void 0!==e.id&&(t.value=e.id),e.disabled&&(t.disabled=!0),e.selected&&(t.selected=!0),e.title&&(t.title=e.title);var n=l(t),i=this._normalizeItem(e);return i.element=t,a.StoreData(t,"data",i),n},n.prototype.item=function(e){var t={};if(null!=(t=a.GetData(e[0],"data")))return t;if(e.is("option"))t={id:e.val(),text:e.text(),disabled:e.prop("disabled"),selected:e.prop("selected"),title:e.prop("title")};else if(e.is("optgroup")){t={text:e.prop("label"),children:[],title:e.prop("title")};for(var n=e.children("option"),i=[],r=0;r<n.length;r++){var o=l(n[r]),s=this.item(o);i.push(s)}t.children=i}return(t=this._normalizeItem(t)).element=e[0],a.StoreData(e[0],"data",t),t},n.prototype._normalizeItem=function(e){e!==Object(e)&&(e={id:e,text:e});return null!=(e=l.extend({},{text:""},e)).id&&(e.id=e.id.toString()),null!=e.text&&(e.text=e.text.toString()),null==e._resultId&&e.id&&null!=this.container&&(e._resultId=this.generateResultId(this.container,e)),l.extend({},{selected:!1,disabled:!1},e)},n.prototype.matches=function(e,t){return this.options.get("matcher")(e,t)},n}),e.define("select2/data/array",["./select","../utils","jquery"],function(e,f,g){function i(e,t){this._dataToConvert=t.get("data")||[],i.__super__.constructor.call(this,e,t)}return f.Extend(i,e),i.prototype.bind=function(e,t){i.__super__.bind.call(this,e,t),this.addOptions(this.convertToOptions(this._dataToConvert))},i.prototype.select=function(n){var e=this.$element.find("option").filter(function(e,t){return t.value==n.id.toString()});0===e.length&&(e=this.option(n),this.addOptions(e)),i.__super__.select.call(this,n)},i.prototype.convertToOptions=function(e){var t=this,n=this.$element.find("option"),i=n.map(function(){return t.item(g(this)).id}).get(),r=[];function o(e){return function(){return g(this).val()==e.id}}for(var s=0;s<e.length;s++){var a=this._normalizeItem(e[s]);if(0<=g.inArray(a.id,i)){var l=n.filter(o(a)),c=this.item(l),u=g.extend(!0,{},a,c),d=this.option(u);l.replaceWith(d)}else{var p=this.option(a);if(a.children){var h=this.convertToOptions(a.children);f.appendMany(p,h)}r.push(p)}}return r},i}),e.define("select2/data/ajax",["./array","../utils","jquery"],function(e,t,o){function n(e,t){this.ajaxOptions=this._applyDefaults(t.get("ajax")),null!=this.ajaxOptions.processResults&&(this.processResults=this.ajaxOptions.processResults),n.__super__.constructor.call(this,e,t)}return t.Extend(n,e),n.prototype._applyDefaults=function(e){var t={data:function(e){return o.extend({},e,{q:e.term})},transport:function(e,t,n){var i=o.ajax(e);return i.then(t),i.fail(n),i}};return o.extend({},t,e,!0)},n.prototype.processResults=function(e){return e},n.prototype.query=function(n,i){var r=this;null!=this._request&&(o.isFunction(this._request.abort)&&this._request.abort(),this._request=null);var t=o.extend({type:"GET"},this.ajaxOptions);function e(){var e=t.transport(t,function(e){var t=r.processResults(e,n);r.options.get("debug")&&window.console&&console.error&&(t&&t.results&&o.isArray(t.results)||console.error("Select2: The AJAX results did not return an array in the `results` key of the response.")),i(t)},function(){"status"in e&&(0===e.status||"0"===e.status)||r.trigger("results:message",{message:"errorLoading"})});r._request=e}"function"==typeof t.url&&(t.url=t.url.call(this.$element,n)),"function"==typeof t.data&&(t.data=t.data.call(this.$element,n)),this.ajaxOptions.delay&&null!=n.term?(this._queryTimeout&&window.clearTimeout(this._queryTimeout),this._queryTimeout=window.setTimeout(e,this.ajaxOptions.delay)):e()},n}),e.define("select2/data/tags",["jquery"],function(u){function e(e,t,n){var i=n.get("tags"),r=n.get("createTag");void 0!==r&&(this.createTag=r);var o=n.get("insertTag");if(void 0!==o&&(this.insertTag=o),e.call(this,t,n),u.isArray(i))for(var s=0;s<i.length;s++){var a=i[s],l=this._normalizeItem(a),c=this.option(l);this.$element.append(c)}}return e.prototype.query=function(e,c,u){var d=this;this._removeOldTags(),null!=c.term&&null==c.page?e.call(this,c,function e(t,n){for(var i=t.results,r=0;r<i.length;r++){var o=i[r],s=null!=o.children&&!e({results:o.children},!0);if((o.text||"").toUpperCase()===(c.term||"").toUpperCase()||s)return!n&&(t.data=i,void u(t))}if(n)return!0;var a=d.createTag(c);if(null!=a){var l=d.option(a);l.attr("data-select2-tag",!0),d.addOptions([l]),d.insertTag(i,a)}t.results=i,u(t)}):e.call(this,c,u)},e.prototype.createTag=function(e,t){var n=u.trim(t.term);return""===n?null:{id:n,text:n}},e.prototype.insertTag=function(e,t,n){t.unshift(n)},e.prototype._removeOldTags=function(e){this.$element.find("option[data-select2-tag]").each(function(){this.selected||u(this).remove()})},e}),e.define("select2/data/tokenizer",["jquery"],function(d){function e(e,t,n){var i=n.get("tokenizer");void 0!==i&&(this.tokenizer=i),e.call(this,t,n)}return e.prototype.bind=function(e,t,n){e.call(this,t,n),this.$search=t.dropdown.$search||t.selection.$search||n.find(".select2-search__field")},e.prototype.query=function(e,t,n){var i=this;t.term=t.term||"";var r=this.tokenizer(t,this.options,function(e){var t=i._normalizeItem(e);if(!i.$element.find("option").filter(function(){return d(this).val()===t.id}).length){var n=i.option(t);n.attr("data-select2-tag",!0),i._removeOldTags(),i.addOptions([n])}!function(e){i.trigger("select",{data:e})}(t)});r.term!==t.term&&(this.$search.length&&(this.$search.val(r.term),this.$search.trigger("focus")),t.term=r.term),e.call(this,t,n)},e.prototype.tokenizer=function(e,t,n,i){for(var r=n.get("tokenSeparators")||[],o=t.term,s=0,a=this.createTag||function(e){return{id:e.term,text:e.term}};s<o.length;){var l=o[s];if(-1!==d.inArray(l,r)){var c=o.substr(0,s),u=a(d.extend({},t,{term:c}));null!=u?(i(u),o=o.substr(s+1)||"",s=0):s++}else s++}return{term:o}},e}),e.define("select2/data/minimumInputLength",[],function(){function e(e,t,n){this.minimumInputLength=n.get("minimumInputLength"),e.call(this,t,n)}return e.prototype.query=function(e,t,n){t.term=t.term||"",t.term.length<this.minimumInputLength?this.trigger("results:message",{message:"inputTooShort",args:{minimum:this.minimumInputLength,input:t.term,params:t}}):e.call(this,t,n)},e}),e.define("select2/data/maximumInputLength",[],function(){function e(e,t,n){this.maximumInputLength=n.get("maximumInputLength"),e.call(this,t,n)}return e.prototype.query=function(e,t,n){t.term=t.term||"",0<this.maximumInputLength&&t.term.length>this.maximumInputLength?this.trigger("results:message",{message:"inputTooLong",args:{maximum:this.maximumInputLength,input:t.term,params:t}}):e.call(this,t,n)},e}),e.define("select2/data/maximumSelectionLength",[],function(){function e(e,t,n){this.maximumSelectionLength=n.get("maximumSelectionLength"),e.call(this,t,n)}return e.prototype.bind=function(e,t,n){var i=this;e.call(this,t,n),t.on("select",function(){i._checkIfMaximumSelected()})},e.prototype.query=function(e,t,n){var i=this;this._checkIfMaximumSelected(function(){e.call(i,t,n)})},e.prototype._checkIfMaximumSelected=function(e,n){var i=this;this.current(function(e){var t=null!=e?e.length:0;0<i.maximumSelectionLength&&t>=i.maximumSelectionLength?i.trigger("results:message",{message:"maximumSelected",args:{maximum:i.maximumSelectionLength}}):n&&n()})},e}),e.define("select2/dropdown",["jquery","./utils"],function(t,e){function n(e,t){this.$element=e,this.options=t,n.__super__.constructor.call(this)}return e.Extend(n,e.Observable),n.prototype.render=function(){var e=t('<span class="select2-dropdown"><span class="select2-results"></span></span>');return e.attr("dir",this.options.get("dir")),this.$dropdown=e},n.prototype.bind=function(){},n.prototype.position=function(e,t){},n.prototype.destroy=function(){this.$dropdown.remove()},n}),e.define("select2/dropdown/search",["jquery","../utils"],function(o,e){function t(){}return t.prototype.render=function(e){var t=e.call(this),n=o('<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="searchbox" aria-autocomplete="list" /></span>');return this.$searchContainer=n,this.$search=n.find("input"),t.prepend(n),t},t.prototype.bind=function(e,t,n){var i=this,r=t.id+"-results";e.call(this,t,n),this.$search.on("keydown",function(e){i.trigger("keypress",e),i._keyUpPrevented=e.isDefaultPrevented()}),this.$search.on("input",function(e){o(this).off("keyup")}),this.$search.on("keyup input",function(e){i.handleSearch(e)}),t.on("open",function(){i.$search.attr("tabindex",0),i.$search.attr("aria-controls",r),i.$search.trigger("focus"),window.setTimeout(function(){i.$search.trigger("focus")},0)}),t.on("close",function(){i.$search.attr("tabindex",-1),i.$search.removeAttr("aria-controls"),i.$search.removeAttr("aria-activedescendant"),i.$search.val(""),i.$search.trigger("blur")}),t.on("focus",function(){t.isOpen()||i.$search.trigger("focus")}),t.on("results:all",function(e){null!=e.query.term&&""!==e.query.term||(i.showSearch(e)?i.$searchContainer.removeClass("select2-search--hide"):i.$searchContainer.addClass("select2-search--hide"))}),t.on("results:focus",function(e){e.data._resultId?i.$search.attr("aria-activedescendant",e.data._resultId):i.$search.removeAttr("aria-activedescendant")})},t.prototype.handleSearch=function(e){if(!this._keyUpPrevented){var t=this.$search.val();this.trigger("query",{term:t})}this._keyUpPrevented=!1},t.prototype.showSearch=function(e,t){return!0},t}),e.define("select2/dropdown/hidePlaceholder",[],function(){function e(e,t,n,i){this.placeholder=this.normalizePlaceholder(n.get("placeholder")),e.call(this,t,n,i)}return e.prototype.append=function(e,t){t.results=this.removePlaceholder(t.results),e.call(this,t)},e.prototype.normalizePlaceholder=function(e,t){return"string"==typeof t&&(t={id:"",text:t}),t},e.prototype.removePlaceholder=function(e,t){for(var n=t.slice(0),i=t.length-1;0<=i;i--){var r=t[i];this.placeholder.id===r.id&&n.splice(i,1)}return n},e}),e.define("select2/dropdown/infiniteScroll",["jquery"],function(n){function e(e,t,n,i){this.lastParams={},e.call(this,t,n,i),this.$loadingMore=this.createLoadingMore(),this.loading=!1}return e.prototype.append=function(e,t){this.$loadingMore.remove(),this.loading=!1,e.call(this,t),this.showLoadingMore(t)&&(this.$results.append(this.$loadingMore),this.loadMoreIfNeeded())},e.prototype.bind=function(e,t,n){var i=this;e.call(this,t,n),t.on("query",function(e){i.lastParams=e,i.loading=!0}),t.on("query:append",function(e){i.lastParams=e,i.loading=!0}),this.$results.on("scroll",this.loadMoreIfNeeded.bind(this))},e.prototype.loadMoreIfNeeded=function(){var e=n.contains(document.documentElement,this.$loadingMore[0]);if(!this.loading&&e){var t=this.$results.offset().top+this.$results.outerHeight(!1);this.$loadingMore.offset().top+this.$loadingMore.outerHeight(!1)<=t+50&&this.loadMore()}},e.prototype.loadMore=function(){this.loading=!0;var e=n.extend({},{page:1},this.lastParams);e.page++,this.trigger("query:append",e)},e.prototype.showLoadingMore=function(e,t){return t.pagination&&t.pagination.more},e.prototype.createLoadingMore=function(){var e=n('<li class="select2-results__option select2-results__option--load-more"role="option" aria-disabled="true"></li>'),t=this.options.get("translations").get("loadingMore");return e.html(t(this.lastParams)),e},e}),e.define("select2/dropdown/attachBody",["jquery","../utils"],function(f,a){function e(e,t,n){this.$dropdownParent=f(n.get("dropdownParent")||document.body),e.call(this,t,n)}return e.prototype.bind=function(e,t,n){var i=this;e.call(this,t,n),t.on("open",function(){i._showDropdown(),i._attachPositioningHandler(t),i._bindContainerResultHandlers(t)}),t.on("close",function(){i._hideDropdown(),i._detachPositioningHandler(t)}),this.$dropdownContainer.on("mousedown",function(e){e.stopPropagation()})},e.prototype.destroy=function(e){e.call(this),this.$dropdownContainer.remove()},e.prototype.position=function(e,t,n){t.attr("class",n.attr("class")),t.removeClass("select2"),t.addClass("select2-container--open"),t.css({position:"absolute",top:-999999}),this.$container=n},e.prototype.render=function(e){var t=f("<span></span>"),n=e.call(this);return t.append(n),this.$dropdownContainer=t},e.prototype._hideDropdown=function(e){this.$dropdownContainer.detach()},e.prototype._bindContainerResultHandlers=function(e,t){if(!this._containerResultsHandlersBound){var n=this;t.on("results:all",function(){n._positionDropdown(),n._resizeDropdown()}),t.on("results:append",function(){n._positionDropdown(),n._resizeDropdown()}),t.on("results:message",function(){n._positionDropdown(),n._resizeDropdown()}),t.on("select",function(){n._positionDropdown(),n._resizeDropdown()}),t.on("unselect",function(){n._positionDropdown(),n._resizeDropdown()}),this._containerResultsHandlersBound=!0}},e.prototype._attachPositioningHandler=function(e,t){var n=this,i="scroll.select2."+t.id,r="resize.select2."+t.id,o="orientationchange.select2."+t.id,s=this.$container.parents().filter(a.hasScroll);s.each(function(){a.StoreData(this,"select2-scroll-position",{x:f(this).scrollLeft(),y:f(this).scrollTop()})}),s.on(i,function(e){var t=a.GetData(this,"select2-scroll-position");f(this).scrollTop(t.y)}),f(window).on(i+" "+r+" "+o,function(e){n._positionDropdown(),n._resizeDropdown()})},e.prototype._detachPositioningHandler=function(e,t){var n="scroll.select2."+t.id,i="resize.select2."+t.id,r="orientationchange.select2."+t.id;this.$container.parents().filter(a.hasScroll).off(n),f(window).off(n+" "+i+" "+r)},e.prototype._positionDropdown=function(){var e=f(window),t=this.$dropdown.hasClass("select2-dropdown--above"),n=this.$dropdown.hasClass("select2-dropdown--below"),i=null,r=this.$container.offset();r.bottom=r.top+this.$container.outerHeight(!1);var o={height:this.$container.outerHeight(!1)};o.top=r.top,o.bottom=r.top+o.height;var s=this.$dropdown.outerHeight(!1),a=e.scrollTop(),l=e.scrollTop()+e.height(),c=a<r.top-s,u=l>r.bottom+s,d={left:r.left,top:o.bottom},p=this.$dropdownParent;"static"===p.css("position")&&(p=p.offsetParent());var h=p.offset();d.top-=h.top,d.left-=h.left,t||n||(i="below"),u||!c||t?!c&&u&&t&&(i="below"):i="above",("above"==i||t&&"below"!==i)&&(d.top=o.top-h.top-s),null!=i&&(this.$dropdown.removeClass("select2-dropdown--below select2-dropdown--above").addClass("select2-dropdown--"+i),this.$container.removeClass("select2-container--below select2-container--above").addClass("select2-container--"+i)),this.$dropdownContainer.css(d)},e.prototype._resizeDropdown=function(){var e={width:this.$container.outerWidth(!1)+"px"};this.options.get("dropdownAutoWidth")&&(e.minWidth=e.width,e.position="relative",e.width="auto"),this.$dropdown.css(e)},e.prototype._showDropdown=function(e){this.$dropdownContainer.appendTo(this.$dropdownParent),this._positionDropdown(),this._resizeDropdown()},e}),e.define("select2/dropdown/minimumResultsForSearch",[],function(){function e(e,t,n,i){this.minimumResultsForSearch=n.get("minimumResultsForSearch"),this.minimumResultsForSearch<0&&(this.minimumResultsForSearch=1/0),e.call(this,t,n,i)}return e.prototype.showSearch=function(e,t){return!(function e(t){for(var n=0,i=0;i<t.length;i++){var r=t[i];r.children?n+=e(r.children):n++}return n}(t.data.results)<this.minimumResultsForSearch)&&e.call(this,t)},e}),e.define("select2/dropdown/selectOnClose",["../utils"],function(o){function e(){}return e.prototype.bind=function(e,t,n){var i=this;e.call(this,t,n),t.on("close",function(e){i._handleSelectOnClose(e)})},e.prototype._handleSelectOnClose=function(e,t){if(t&&null!=t.originalSelect2Event){var n=t.originalSelect2Event;if("select"===n._type||"unselect"===n._type)return}var i=this.getHighlightedResults();if(!(i.length<1)){var r=o.GetData(i[0],"data");null!=r.element&&r.element.selected||null==r.element&&r.selected||this.trigger("select",{data:r})}},e}),e.define("select2/dropdown/closeOnSelect",[],function(){function e(){}return e.prototype.bind=function(e,t,n){var i=this;e.call(this,t,n),t.on("select",function(e){i._selectTriggered(e)}),t.on("unselect",function(e){i._selectTriggered(e)})},e.prototype._selectTriggered=function(e,t){var n=t.originalEvent;n&&(n.ctrlKey||n.metaKey)||this.trigger("close",{originalEvent:n,originalSelect2Event:t})},e}),e.define("select2/i18n/en",[],function(){return{errorLoading:function(){return"The results could not be loaded."},inputTooLong:function(e){var t=e.input.length-e.maximum,n="Please delete "+t+" character";return 1!=t&&(n+="s"),n},inputTooShort:function(e){return"Please enter "+(e.minimum-e.input.length)+" or more characters"},loadingMore:function(){return"Loading more results…"},maximumSelected:function(e){var t="You can only select "+e.maximum+" item";return 1!=e.maximum&&(t+="s"),t},noResults:function(){return"No results found"},searching:function(){return"Searching…"},removeAllItems:function(){return"Remove all items"}}}),e.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(c,u,d,p,h,f,g,m,v,y,s,t,_,w,$,b,A,x,S,D,C,E,O,T,q,j,L,I,e){function n(){this.reset()}return n.prototype.apply=function(e){if(null==(e=c.extend(!0,{},this.defaults,e)).dataAdapter){if(null!=e.ajax?e.dataAdapter=$:null!=e.data?e.dataAdapter=w:e.dataAdapter=_,0<e.minimumInputLength&&(e.dataAdapter=y.Decorate(e.dataAdapter,x)),0<e.maximumInputLength&&(e.dataAdapter=y.Decorate(e.dataAdapter,S)),0<e.maximumSelectionLength&&(e.dataAdapter=y.Decorate(e.dataAdapter,D)),e.tags&&(e.dataAdapter=y.Decorate(e.dataAdapter,b)),null==e.tokenSeparators&&null==e.tokenizer||(e.dataAdapter=y.Decorate(e.dataAdapter,A)),null!=e.query){var t=u(e.amdBase+"compat/query");e.dataAdapter=y.Decorate(e.dataAdapter,t)}if(null!=e.initSelection){var n=u(e.amdBase+"compat/initSelection");e.dataAdapter=y.Decorate(e.dataAdapter,n)}}if(null==e.resultsAdapter&&(e.resultsAdapter=d,null!=e.ajax&&(e.resultsAdapter=y.Decorate(e.resultsAdapter,T)),null!=e.placeholder&&(e.resultsAdapter=y.Decorate(e.resultsAdapter,O)),e.selectOnClose&&(e.resultsAdapter=y.Decorate(e.resultsAdapter,L))),null==e.dropdownAdapter){if(e.multiple)e.dropdownAdapter=C;else{var i=y.Decorate(C,E);e.dropdownAdapter=i}if(0!==e.minimumResultsForSearch&&(e.dropdownAdapter=y.Decorate(e.dropdownAdapter,j)),e.closeOnSelect&&(e.dropdownAdapter=y.Decorate(e.dropdownAdapter,I)),null!=e.dropdownCssClass||null!=e.dropdownCss||null!=e.adaptDropdownCssClass){var r=u(e.amdBase+"compat/dropdownCss");e.dropdownAdapter=y.Decorate(e.dropdownAdapter,r)}e.dropdownAdapter=y.Decorate(e.dropdownAdapter,q)}if(null==e.selectionAdapter){if(e.multiple?e.selectionAdapter=h:e.selectionAdapter=p,null!=e.placeholder&&(e.selectionAdapter=y.Decorate(e.selectionAdapter,f)),e.allowClear&&(e.selectionAdapter=y.Decorate(e.selectionAdapter,g)),e.multiple&&(e.selectionAdapter=y.Decorate(e.selectionAdapter,m)),null!=e.containerCssClass||null!=e.containerCss||null!=e.adaptContainerCssClass){var o=u(e.amdBase+"compat/containerCss");e.selectionAdapter=y.Decorate(e.selectionAdapter,o)}e.selectionAdapter=y.Decorate(e.selectionAdapter,v)}e.language=this._resolveLanguage(e.language),e.language.push("en");for(var s=[],a=0;a<e.language.length;a++){var l=e.language[a];-1===s.indexOf(l)&&s.push(l)}return e.language=s,e.translations=this._processTranslations(e.language,e.debug),e},n.prototype.reset=function(){function a(e){return e.replace(/[^\u0000-\u007E]/g,function(e){return t[e]||e})}this.defaults={amdBase:"./",amdLanguageBase:"./i18n/",closeOnSelect:!0,debug:!1,dropdownAutoWidth:!1,escapeMarkup:y.escapeMarkup,language:{},matcher:function e(t,n){if(""===c.trim(t.term))return n;if(n.children&&0<n.children.length){for(var i=c.extend(!0,{},n),r=n.children.length-1;0<=r;r--)null==e(t,n.children[r])&&i.children.splice(r,1);return 0<i.children.length?i:e(t,i)}var o=a(n.text).toUpperCase(),s=a(t.term).toUpperCase();return-1<o.indexOf(s)?n:null},minimumInputLength:0,maximumInputLength:0,maximumSelectionLength:0,minimumResultsForSearch:0,selectOnClose:!1,scrollAfterSelect:!1,sorter:function(e){return e},templateResult:function(e){return e.text},templateSelection:function(e){return e.text},theme:"default",width:"resolve"}},n.prototype.applyFromElement=function(e,t){var n=e.language,i=this.defaults.language,r=t.prop("lang"),o=t.closest("[lang]").prop("lang"),s=Array.prototype.concat.call(this._resolveLanguage(r),this._resolveLanguage(n),this._resolveLanguage(i),this._resolveLanguage(o));return e.language=s,e},n.prototype._resolveLanguage=function(e){if(!e)return[];if(c.isEmptyObject(e))return[];if(c.isPlainObject(e))return[e];var t;t=c.isArray(e)?e:[e];for(var n=[],i=0;i<t.length;i++)if(n.push(t[i]),"string"==typeof t[i]&&0<t[i].indexOf("-")){var r=t[i].split("-")[0];n.push(r)}return n},n.prototype._processTranslations=function(e,t){for(var n=new s,i=0;i<e.length;i++){var r=new s,o=e[i];if("string"==typeof o)try{r=s.loadPath(o)}catch(e){try{o=this.defaults.amdLanguageBase+o,r=s.loadPath(o)}catch(e){t&&window.console&&console.warn&&console.warn('Select2: The language file for "'+o+'" could not be automatically loaded. A fallback will be used instead.')}}else r=c.isPlainObject(o)?new s(o):o;n.extend(r)}return n},n.prototype.set=function(e,t){var n={};n[c.camelCase(e)]=t;var i=y._convertData(n);c.extend(!0,this.defaults,i)},new n}),e.define("select2/options",["require","jquery","./defaults","./utils"],function(i,d,r,p){function e(e,t){if(this.options=e,null!=t&&this.fromElement(t),null!=t&&(this.options=r.applyFromElement(this.options,t)),this.options=r.apply(this.options),t&&t.is("input")){var n=i(this.get("amdBase")+"compat/inputData");this.options.dataAdapter=p.Decorate(this.options.dataAdapter,n)}}return e.prototype.fromElement=function(e){var t=["select2"];null==this.options.multiple&&(this.options.multiple=e.prop("multiple")),null==this.options.disabled&&(this.options.disabled=e.prop("disabled")),null==this.options.dir&&(e.prop("dir")?this.options.dir=e.prop("dir"):e.closest("[dir]").prop("dir")?this.options.dir=e.closest("[dir]").prop("dir"):this.options.dir="ltr"),e.prop("disabled",this.options.disabled),e.prop("multiple",this.options.multiple),p.GetData(e[0],"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.'),p.StoreData(e[0],"data",p.GetData(e[0],"select2Tags")),p.StoreData(e[0],"tags",!0)),p.GetData(e[0],"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."),e.attr("ajax--url",p.GetData(e[0],"ajaxUrl")),p.StoreData(e[0],"ajax-Url",p.GetData(e[0],"ajaxUrl")));var n={};function i(e,t){return t.toUpperCase()}for(var r=0;r<e[0].attributes.length;r++){var o=e[0].attributes[r].name,s="data-";if(o.substr(0,s.length)==s){var a=o.substring(s.length),l=p.GetData(e[0],a);n[a.replace(/-([a-z])/g,i)]=l}}d.fn.jquery&&"1."==d.fn.jquery.substr(0,2)&&e[0].dataset&&(n=d.extend(!0,{},e[0].dataset,n));var c=d.extend(!0,{},p.GetData(e[0]),n);for(var u in c=p._convertData(c))-1<d.inArray(u,t)||(d.isPlainObject(this.options[u])?d.extend(this.options[u],c[u]):this.options[u]=c[u]);return this},e.prototype.get=function(e){return this.options[e]},e.prototype.set=function(e,t){this.options[e]=t},e}),e.define("select2/core",["jquery","./options","./utils","./keys"],function(r,c,u,i){var d=function(e,t){null!=u.GetData(e[0],"select2")&&u.GetData(e[0],"select2").destroy(),this.$element=e,this.id=this._generateId(e),t=t||{},this.options=new c(t,e),d.__super__.constructor.call(this);var n=e.attr("tabindex")||0;u.StoreData(e[0],"old-tabindex",n),e.attr("tabindex","-1");var i=this.options.get("dataAdapter");this.dataAdapter=new i(e,this.options);var r=this.render();this._placeContainer(r);var o=this.options.get("selectionAdapter");this.selection=new o(e,this.options),this.$selection=this.selection.render(),this.selection.position(this.$selection,r);var s=this.options.get("dropdownAdapter");this.dropdown=new s(e,this.options),this.$dropdown=this.dropdown.render(),this.dropdown.position(this.$dropdown,r);var a=this.options.get("resultsAdapter");this.results=new a(e,this.options,this.dataAdapter),this.$results=this.results.render(),this.results.position(this.$results,this.$dropdown);var l=this;this._bindAdapters(),this._registerDomEvents(),this._registerDataEvents(),this._registerSelectionEvents(),this._registerDropdownEvents(),this._registerResultsEvents(),this._registerEvents(),this.dataAdapter.current(function(e){l.trigger("selection:update",{data:e})}),e.addClass("select2-hidden-accessible"),e.attr("aria-hidden","true"),this._syncAttributes(),u.StoreData(e[0],"select2",this),e.data("select2",this)};return u.Extend(d,u.Observable),d.prototype._generateId=function(e){return"select2-"+(null!=e.attr("id")?e.attr("id"):null!=e.attr("name")?e.attr("name")+"-"+u.generateChars(2):u.generateChars(4)).replace(/(:|\.|\[|\]|,)/g,"")},d.prototype._placeContainer=function(e){e.insertAfter(this.$element);var t=this._resolveWidth(this.$element,this.options.get("width"));null!=t&&e.css("width",t)},d.prototype._resolveWidth=function(e,t){var n=/^width:(([-+]?([0-9]*\.)?[0-9]+)(px|em|ex|%|in|cm|mm|pt|pc))/i;if("resolve"==t){var i=this._resolveWidth(e,"style");return null!=i?i:this._resolveWidth(e,"element")}if("element"==t){var r=e.outerWidth(!1);return r<=0?"auto":r+"px"}if("style"!=t)return"computedstyle"!=t?t:window.getComputedStyle(e[0]).width;var o=e.attr("style");if("string"!=typeof o)return null;for(var s=o.split(";"),a=0,l=s.length;a<l;a+=1){var c=s[a].replace(/\s/g,"").match(n);if(null!==c&&1<=c.length)return c[1]}return null},d.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)},d.prototype._registerDomEvents=function(){var t=this;this.$element.on("change.select2",function(){t.dataAdapter.current(function(e){t.trigger("selection:update",{data:e})})}),this.$element.on("focus.select2",function(e){t.trigger("focus",e)}),this._syncA=u.bind(this._syncAttributes,this),this._syncS=u.bind(this._syncSubtree,this),this.$element[0].attachEvent&&this.$element[0].attachEvent("onpropertychange",this._syncA);var e=window.MutationObserver||window.WebKitMutationObserver||window.MozMutationObserver;null!=e?(this._observer=new e(function(e){r.each(e,t._syncA),r.each(e,t._syncS)}),this._observer.observe(this.$element[0],{attributes:!0,childList:!0,subtree:!1})):this.$element[0].addEventListener&&(this.$element[0].addEventListener("DOMAttrModified",t._syncA,!1),this.$element[0].addEventListener("DOMNodeInserted",t._syncS,!1),this.$element[0].addEventListener("DOMNodeRemoved",t._syncS,!1))},d.prototype._registerDataEvents=function(){var n=this;this.dataAdapter.on("*",function(e,t){n.trigger(e,t)})},d.prototype._registerSelectionEvents=function(){var n=this,i=["toggle","focus"];this.selection.on("toggle",function(){n.toggleDropdown()}),this.selection.on("focus",function(e){n.focus(e)}),this.selection.on("*",function(e,t){-1===r.inArray(e,i)&&n.trigger(e,t)})},d.prototype._registerDropdownEvents=function(){var n=this;this.dropdown.on("*",function(e,t){n.trigger(e,t)})},d.prototype._registerResultsEvents=function(){var n=this;this.results.on("*",function(e,t){n.trigger(e,t)})},d.prototype._registerEvents=function(){var n=this;this.on("open",function(){n.$container.addClass("select2-container--open")}),this.on("close",function(){n.$container.removeClass("select2-container--open")}),this.on("enable",function(){n.$container.removeClass("select2-container--disabled")}),this.on("disable",function(){n.$container.addClass("select2-container--disabled")}),this.on("blur",function(){n.$container.removeClass("select2-container--focus")}),this.on("query",function(t){n.isOpen()||n.trigger("open",{}),this.dataAdapter.query(t,function(e){n.trigger("results:all",{data:e,query:t})})}),this.on("query:append",function(t){this.dataAdapter.query(t,function(e){n.trigger("results:append",{data:e,query:t})})}),this.on("keypress",function(e){var t=e.which;n.isOpen()?t===i.ESC||t===i.TAB||t===i.UP&&e.altKey?(n.close(),e.preventDefault()):t===i.ENTER?(n.trigger("results:select",{}),e.preventDefault()):t===i.SPACE&&e.ctrlKey?(n.trigger("results:toggle",{}),e.preventDefault()):t===i.UP?(n.trigger("results:previous",{}),e.preventDefault()):t===i.DOWN&&(n.trigger("results:next",{}),e.preventDefault()):(t===i.ENTER||t===i.SPACE||t===i.DOWN&&e.altKey)&&(n.open(),e.preventDefault())})},d.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",{})},d.prototype._syncSubtree=function(e,t){var n=!1,i=this;if(!e||!e.target||"OPTION"===e.target.nodeName||"OPTGROUP"===e.target.nodeName){if(t)if(t.addedNodes&&0<t.addedNodes.length)for(var r=0;r<t.addedNodes.length;r++){t.addedNodes[r].selected&&(n=!0)}else t.removedNodes&&0<t.removedNodes.length&&(n=!0);else n=!0;n&&this.dataAdapter.current(function(e){i.trigger("selection:update",{data:e})})}},d.prototype.trigger=function(e,t){var n=d.__super__.trigger,i={open:"opening",close:"closing",select:"selecting",unselect:"unselecting",clear:"clearing"};if(void 0===t&&(t={}),e in i){var r=i[e],o={prevented:!1,name:e,args:t};if(n.call(this,r,o),o.prevented)return void(t.prevented=!0)}n.call(this,e,t)},d.prototype.toggleDropdown=function(){this.options.get("disabled")||(this.isOpen()?this.close():this.open())},d.prototype.open=function(){this.isOpen()||this.trigger("query",{})},d.prototype.close=function(){this.isOpen()&&this.trigger("close",{})},d.prototype.isOpen=function(){return this.$container.hasClass("select2-container--open")},d.prototype.hasFocus=function(){return this.$container.hasClass("select2-container--focus")},d.prototype.focus=function(e){this.hasFocus()||(this.$container.addClass("select2-container--focus"),this.trigger("focus",{}))},d.prototype.enable=function(e){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!=e&&0!==e.length||(e=[!0]);var t=!e[0];this.$element.prop("disabled",t)},d.prototype.data=function(){this.options.get("debug")&&0<arguments.length&&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 t=[];return this.dataAdapter.current(function(e){t=e}),t},d.prototype.val=function(e){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==e||0===e.length)return this.$element.val();var t=e[0];r.isArray(t)&&(t=r.map(t,function(e){return e.toString()})),this.$element.val(t).trigger("change")},d.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",u.GetData(this.$element[0],"old-tabindex")),this.$element.removeClass("select2-hidden-accessible"),this.$element.attr("aria-hidden","false"),u.RemoveData(this.$element[0]),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},d.prototype.render=function(){var e=r('<span class="select2 select2-container"><span class="selection"></span><span class="dropdown-wrapper" aria-hidden="true"></span></span>');return e.attr("dir",this.options.get("dir")),this.$container=e,this.$container.addClass("select2-container--"+this.options.get("theme")),u.StoreData(e[0],"element",this.$element),e},d}),e.define("select2/compat/utils",["jquery"],function(s){return{syncCssClasses:function(e,t,n){var i,r,o=[];(i=s.trim(e.attr("class")))&&s((i=""+i).split(/\s+/)).each(function(){0===this.indexOf("select2-")&&o.push(this)}),(i=s.trim(t.attr("class")))&&s((i=""+i).split(/\s+/)).each(function(){0!==this.indexOf("select2-")&&null!=(r=n(this))&&o.push(r)}),e.attr("class",o.join(" "))}}}),e.define("select2/compat/containerCss",["jquery","./utils"],function(s,a){function l(e){return null}function e(){}return e.prototype.render=function(e){var t=e.call(this),n=this.options.get("containerCssClass")||"";s.isFunction(n)&&(n=n(this.$element));var i=this.options.get("adaptContainerCssClass");if(i=i||l,-1!==n.indexOf(":all:")){n=n.replace(":all:","");var r=i;i=function(e){var t=r(e);return null!=t?t+" "+e:e}}var o=this.options.get("containerCss")||{};return s.isFunction(o)&&(o=o(this.$element)),a.syncCssClasses(t,this.$element,i),t.css(o),t.addClass(n),t},e}),e.define("select2/compat/dropdownCss",["jquery","./utils"],function(s,a){function l(e){return null}function e(){}return e.prototype.render=function(e){var t=e.call(this),n=this.options.get("dropdownCssClass")||"";s.isFunction(n)&&(n=n(this.$element));var i=this.options.get("adaptDropdownCssClass");if(i=i||l,-1!==n.indexOf(":all:")){n=n.replace(":all:","");var r=i;i=function(e){var t=r(e);return null!=t?t+" "+e:e}}var o=this.options.get("dropdownCss")||{};return s.isFunction(o)&&(o=o(this.$element)),a.syncCssClasses(t,this.$element,i),t.css(o),t.addClass(n),t},e}),e.define("select2/compat/initSelection",["jquery"],function(i){function e(e,t,n){n.get("debug")&&window.console&&console.warn&&console.warn("Select2: The `initSelection` option has been deprecated in favor of a custom data adapter that overrides the `current` method. This method is now called multiple times instead of a single time when the instance is initialized. Support will be removed for the `initSelection` option in future versions of Select2"),this.initSelection=n.get("initSelection"),this._isInitialized=!1,e.call(this,t,n)}return e.prototype.current=function(e,t){var n=this;this._isInitialized?e.call(this,t):this.initSelection.call(null,this.$element,function(e){n._isInitialized=!0,i.isArray(e)||(e=[e]),t(e)})},e}),e.define("select2/compat/inputData",["jquery","../utils"],function(s,i){function e(e,t,n){this._currentData=[],this._valueSeparator=n.get("valueSeparator")||",","hidden"===t.prop("type")&&n.get("debug")&&console&&console.warn&&console.warn("Select2: Using a hidden input with Select2 is no longer supported and may stop working in the future. It is recommended to use a `<select>` element instead."),e.call(this,t,n)}return e.prototype.current=function(e,t){function i(e,t){var n=[];return e.selected||-1!==s.inArray(e.id,t)?(e.selected=!0,n.push(e)):e.selected=!1,e.children&&n.push.apply(n,i(e.children,t)),n}for(var n=[],r=0;r<this._currentData.length;r++){var o=this._currentData[r];n.push.apply(n,i(o,this.$element.val().split(this._valueSeparator)))}t(n)},e.prototype.select=function(e,t){if(this.options.get("multiple")){var n=this.$element.val();n+=this._valueSeparator+t.id,this.$element.val(n),this.$element.trigger("change")}else this.current(function(e){s.map(e,function(e){e.selected=!1})}),this.$element.val(t.id),this.$element.trigger("change")},e.prototype.unselect=function(e,r){var o=this;r.selected=!1,this.current(function(e){for(var t=[],n=0;n<e.length;n++){var i=e[n];r.id!=i.id&&t.push(i.id)}o.$element.val(t.join(o._valueSeparator)),o.$element.trigger("change")})},e.prototype.query=function(e,t,n){for(var i=[],r=0;r<this._currentData.length;r++){var o=this._currentData[r],s=this.matches(t,o);null!==s&&i.push(s)}n({results:i})},e.prototype.addOptions=function(e,t){var n=s.map(t,function(e){return i.GetData(e[0],"data")});this._currentData.push.apply(this._currentData,n)},e}),e.define("select2/compat/matcher",["jquery"],function(s){return function(o){return function(e,t){var n=s.extend(!0,{},t);if(null==e.term||""===s.trim(e.term))return n;if(t.children){for(var i=t.children.length-1;0<=i;i--){var r=t.children[i];o(e.term,r.text,r)||n.children.splice(i,1)}if(0<n.children.length)return n}return o(e.term,t.text,t)?n:null}}}),e.define("select2/compat/query",[],function(){function e(e,t,n){n.get("debug")&&window.console&&console.warn&&console.warn("Select2: The `query` option has been deprecated in favor of a custom data adapter that overrides the `query` method. Support will be removed for the `query` option in future versions of Select2."),e.call(this,t,n)}return e.prototype.query=function(e,t,n){t.callback=n,this.options.get("query").call(null,t)},e}),e.define("select2/dropdown/attachContainer",[],function(){function e(e,t,n){e.call(this,t,n)}return e.prototype.position=function(e,t,n){n.find(".dropdown-wrapper").append(t),t.addClass("select2-dropdown--below"),n.addClass("select2-container--below")},e}),e.define("select2/dropdown/stopPropagation",[],function(){function e(){}return e.prototype.bind=function(e,t,n){e.call(this,t,n);this.$dropdown.on(["blur","change","click","dblclick","focus","focusin","focusout","input","keydown","keyup","keypress","mousedown","mouseenter","mouseleave","mousemove","mouseover","mouseup","search","touchend","touchstart"].join(" "),function(e){e.stopPropagation()})},e}),e.define("select2/selection/stopPropagation",[],function(){function e(){}return e.prototype.bind=function(e,t,n){e.call(this,t,n);this.$selection.on(["blur","change","click","dblclick","focus","focusin","focusout","input","keydown","keyup","keypress","mousedown","mouseenter","mouseleave","mousemove","mouseover","mouseup","search","touchend","touchstart"].join(" "),function(e){e.stopPropagation()})},e}),l=function(p){var h,f,e=["wheel","mousewheel","DOMMouseScroll","MozMousePixelScroll"],t="onwheel"in document||9<=document.documentMode?["wheel"]:["mousewheel","DomMouseScroll","MozMousePixelScroll"],g=Array.prototype.slice;if(p.event.fixHooks)for(var n=e.length;n;)p.event.fixHooks[e[--n]]=p.event.mouseHooks;var m=p.event.special.mousewheel={version:"3.1.12",setup:function(){if(this.addEventListener)for(var e=t.length;e;)this.addEventListener(t[--e],i,!1);else this.onmousewheel=i;p.data(this,"mousewheel-line-height",m.getLineHeight(this)),p.data(this,"mousewheel-page-height",m.getPageHeight(this))},teardown:function(){if(this.removeEventListener)for(var e=t.length;e;)this.removeEventListener(t[--e],i,!1);else this.onmousewheel=null;p.removeData(this,"mousewheel-line-height"),p.removeData(this,"mousewheel-page-height")},getLineHeight:function(e){var t=p(e),n=t["offsetParent"in p.fn?"offsetParent":"parent"]();return n.length||(n=p("body")),parseInt(n.css("fontSize"),10)||parseInt(t.css("fontSize"),10)||16},getPageHeight:function(e){return p(e).height()},settings:{adjustOldDeltas:!0,normalizeOffset:!0}};function i(e){var t,n=e||window.event,i=g.call(arguments,1),r=0,o=0,s=0,a=0,l=0;if((e=p.event.fix(n)).type="mousewheel","detail"in n&&(s=-1*n.detail),"wheelDelta"in n&&(s=n.wheelDelta),"wheelDeltaY"in n&&(s=n.wheelDeltaY),"wheelDeltaX"in n&&(o=-1*n.wheelDeltaX),"axis"in n&&n.axis===n.HORIZONTAL_AXIS&&(o=-1*s,s=0),r=0===s?o:s,"deltaY"in n&&(r=s=-1*n.deltaY),"deltaX"in n&&(o=n.deltaX,0===s&&(r=-1*o)),0!==s||0!==o){if(1===n.deltaMode){var c=p.data(this,"mousewheel-line-height");r*=c,s*=c,o*=c}else if(2===n.deltaMode){var u=p.data(this,"mousewheel-page-height");r*=u,s*=u,o*=u}if(t=Math.max(Math.abs(s),Math.abs(o)),(!f||t<f)&&y(n,f=t)&&(f/=40),y(n,t)&&(r/=40,o/=40,s/=40),r=Math[1<=r?"floor":"ceil"](r/f),o=Math[1<=o?"floor":"ceil"](o/f),s=Math[1<=s?"floor":"ceil"](s/f),m.settings.normalizeOffset&&this.getBoundingClientRect){var d=this.getBoundingClientRect();a=e.clientX-d.left,l=e.clientY-d.top}return e.deltaX=o,e.deltaY=s,e.deltaFactor=f,e.offsetX=a,e.offsetY=l,e.deltaMode=0,i.unshift(e,r,o,s),h&&clearTimeout(h),h=setTimeout(v,200),(p.event.dispatch||p.event.handle).apply(this,i)}}function v(){f=null}function y(e,t){return m.settings.adjustOldDeltas&&"mousewheel"===e.type&&t%120==0}p.fn.extend({mousewheel:function(e){return e?this.bind("mousewheel",e):this.trigger("mousewheel")},unmousewheel:function(e){return this.unbind("mousewheel",e)}})},"function"==typeof e.define&&e.define.amd?e.define("jquery-mousewheel",["jquery"],l):"object"==typeof exports?module.exports=l:l(d),e.define("jquery.select2",["jquery","jquery-mousewheel","./select2/core","./select2/defaults","./select2/utils"],function(r,e,o,t,s){if(null==r.fn.select2){var a=["open","close","destroy"];r.fn.select2=function(t){if("object"==typeof(t=t||{}))return this.each(function(){var e=r.extend(!0,{},t);new o(r(this),e)}),this;if("string"!=typeof t)throw new Error("Invalid arguments for Select2: "+t);var n,i=Array.prototype.slice.call(arguments,1);return this.each(function(){var e=s.GetData(this,"select2");null==e&&window.console&&console.error&&console.error("The select2('"+t+"') method was called on an element that is not using Select2."),n=e[t].apply(e,i)}),-1<r.inArray(t,a)?this:n}}return null==r.fn.select2.defaults&&(r.fn.select2.defaults=t),o}),{define:e.define,require:e.require}}(),t=e.require("jquery.select2");return d.fn.select2.amd=e,t});
assets/js/select2/select2.min.css CHANGED
@@ -1 +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}
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;-webkit-clip-path:inset(50%) !important;clip-path:inset(50%) !important;height:1px !important;overflow:hidden !important;padding:0 !important;position:absolute !important;width:1px !important;white-space:nowrap !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__clear{cursor:pointer;float:right;font-weight:bold;margin-top:5px;margin-right:10px;padding:1px}.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-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;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}
changelog.txt CHANGED
@@ -1,9 +1,42 @@
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
  = 1.33.5 =
2
  * Fix: Issue where a JS error could occur when submitting a job.
3
 
 
 
 
 
 
 
 
 
 
 
4
  = 1.33.3 =
5
- * Fix: Upgrade jquery-fileupload to v9.32.0
6
- * Fix: Set frame origin on pages where shortcodes are embedded
7
 
8
  = 1.33.2 =
9
  * Fix: Issue with `[jobs]` filter form on some themes and plugins.
1
+ = 1.34.0 =
2
+ * Templates Updated: `content-job_listing.php`, `job-submitted.php`.
3
+ * Enhancement: Add support for pre-selecting categories in `[jobs]` using category slugs in query string (e.g. `/jobs?search_category=developer,pm,senior`).
4
+ * Change: Job listing now supports `author` functionality, which will expose the author field in the REST API.
5
+ * Change: Menu position is fixed in WP admin. Plugins such as Resumes and Applications will need to be updated to show in WP admin below WPJM. (@technerdlove)
6
+ * Change: Filter form on `[jobs]` resets on page refresh and uses query string as expected.
7
+ * Change: No longer required to generate usernames from email for password field. (@manzoorwanijk)
8
+ * Change: Use minified version of remote jQuery UI CSS. (@ovidiul)
9
+ * Change: Google Maps link uses https.
10
+ * Fix: Clear the `filled` flag when relisting a job listing.
11
+ * Fix: Page titles are properly set during initial set up. (@JuanchoPestana)
12
+ * Fix: Correctly format list of file extensions when an unsupported file type is uploaded.
13
+ * Fix: Latitude and longitude are correctly used in `content-job_listing.php` template. (@MarieComet)
14
+ * Fix: Delete widget options on plugin uninstall. (@JuanchoPestana)
15
+ * Fix: Remove unused parameter in `job-submitted.php` template. (@JuanchoPestana)
16
+ * Third Party: Fix issue with saving attachments when using Download Attachments plugin.
17
+ * Third Party: Fix issue with Polylang where translations get overwritten on save of another language.
18
+ * Dev: Adds the ability to completely disable the state saving functionality of `[jobs]` results.
19
+ * Dev: Allows custom calls to `get_job_listings()` to just get `ids` and `id=>parent`. (@manzoorwanijk)
20
+ * Dev: Switched to short-array syntax across plugin.
21
+ * Dev: Updated `jquery-fileupload` library to 10.2.0.
22
+ * Dev: Updated `select2` library to 4.0.10.
23
+
24
  = 1.33.5 =
25
  * Fix: Issue where a JS error could occur when submitting a job.
26
 
27
+ = 1.33.4 =
28
+ * Note: WP Job Manager now requires a minimum PHP version of 5.6.20.
29
+ * Fix: Javascript error in job-submission.js on custom job description fields.
30
+ * Fix: Checking typeof undefined should be in quotes in job_submission.js.
31
+ * Fix: Plugin activation issue that didn't set up roles correctly.
32
+ * Fix: Escaped HTML issue in expiring jobs email notice.
33
+ * Change: Added additional unslashing and sanitization of input variables from forms.
34
+ * Change: Limited direct database access within the plugin and migrated to WordPress core functions when possible.
35
+ * Removed: Transient garbage collection. WordPress 4.9 and up handle this automatically.
36
+
37
  = 1.33.3 =
38
+ * Fix: Upgrade jquery-fileupload to v9.32.0.
39
+ * Fix: Set frame origin on pages where shortcodes are embedded.
40
 
41
  = 1.33.2 =
42
  * Fix: Issue with `[jobs]` filter form on some themes and plugins.
includes/abstracts/abstract-wp-job-manager-email-template.php CHANGED
@@ -92,8 +92,8 @@ abstract class WP_Job_Manager_Email_Template extends WP_Job_Manager_Email {
92
  */
93
  protected function locate_template( $plain_text ) {
94
  $class_name = get_class( $this );
95
- $template_path = call_user_func( array( $class_name, 'get_template_path' ) );
96
- $template_default_path = call_user_func( array( $class_name, 'get_template_default_path' ) );
97
  return locate_job_manager_template( $this->get_template_file_name( $plain_text ), $template_path, $template_default_path );
98
  }
99
 
@@ -106,7 +106,7 @@ abstract class WP_Job_Manager_Email_Template extends WP_Job_Manager_Email {
106
  protected function get_template_file_name( $plain_text = false ) {
107
  $class_name = get_class( $this );
108
  // PHP 5.2: Using `call_user_func()` but `$class_name::get_key()` preferred.
109
- $email_notification_key = call_user_func( array( $class_name, 'get_key' ) );
110
  $template_name = str_replace( '_', '-', $email_notification_key );
111
  return self::generate_template_file_name( $template_name, $plain_text );
112
  }
@@ -119,7 +119,7 @@ abstract class WP_Job_Manager_Email_Template extends WP_Job_Manager_Email {
119
  * @return string
120
  */
121
  public static function generate_template_file_name( $template_name, $plain_text = false ) {
122
- $file_name_parts = array( 'emails' );
123
  if ( $plain_text ) {
124
  $file_name_parts[] = 'plain';
125
  }
92
  */
93
  protected function locate_template( $plain_text ) {
94
  $class_name = get_class( $this );
95
+ $template_path = call_user_func( [ $class_name, 'get_template_path' ] );
96
+ $template_default_path = call_user_func( [ $class_name, 'get_template_default_path' ] );
97
  return locate_job_manager_template( $this->get_template_file_name( $plain_text ), $template_path, $template_default_path );
98
  }
99
 
106
  protected function get_template_file_name( $plain_text = false ) {
107
  $class_name = get_class( $this );
108
  // PHP 5.2: Using `call_user_func()` but `$class_name::get_key()` preferred.
109
+ $email_notification_key = call_user_func( [ $class_name, 'get_key' ] );
110
  $template_name = str_replace( '_', '-', $email_notification_key );
111
  return self::generate_template_file_name( $template_name, $plain_text );
112
  }
119
  * @return string
120
  */
121
  public static function generate_template_file_name( $template_name, $plain_text = false ) {
122
+ $file_name_parts = [ 'emails' ];
123
  if ( $plain_text ) {
124
  $file_name_parts[] = 'plain';
125
  }
includes/abstracts/abstract-wp-job-manager-email.php CHANGED
@@ -36,14 +36,14 @@ abstract class WP_Job_Manager_Email {
36
  *
37
  * @var array
38
  */
39
- private $args = array();
40
 
41
  /**
42
  * Settings for this email notification.
43
  *
44
  * @var array
45
  */
46
- private $settings = array();
47
 
48
  /**
49
  * WP_Job_Manager_Email constructor.
@@ -161,7 +161,7 @@ abstract class WP_Job_Manager_Email {
161
  * @return array
162
  */
163
  public function get_attachments() {
164
- return array();
165
  }
166
 
167
  /**
@@ -179,7 +179,7 @@ abstract class WP_Job_Manager_Email {
179
  * @return array
180
  */
181
  public function get_headers() {
182
- return array();
183
  }
184
 
185
  /**
@@ -197,7 +197,7 @@ abstract class WP_Job_Manager_Email {
197
  * @return array
198
  */
199
  public static function get_setting_fields() {
200
- return array();
201
  }
202
 
203
  /**
36
  *
37
  * @var array
38
  */
39
+ private $args = [];
40
 
41
  /**
42
  * Settings for this email notification.
43
  *
44
  * @var array
45
  */
46
+ private $settings = [];
47
 
48
  /**
49
  * WP_Job_Manager_Email constructor.
161
  * @return array
162
  */
163
  public function get_attachments() {
164
+ return [];
165
  }
166
 
167
  /**
179
  * @return array
180
  */
181
  public function get_headers() {
182
+ return [];
183
  }
184
 
185
  /**
197
  * @return array
198
  */
199
  public static function get_setting_fields() {
200
+ return [];
201
  }
202
 
203
  /**
includes/abstracts/abstract-wp-job-manager-form.php CHANGED
@@ -23,7 +23,7 @@ abstract class WP_Job_Manager_Form {
23
  * @access protected
24
  * @var array
25
  */
26
- protected $fields = array();
27
 
28
  /**
29
  * Form action.
@@ -39,7 +39,7 @@ abstract class WP_Job_Manager_Form {
39
  * @access protected
40
  * @var array
41
  */
42
- protected $errors = array();
43
 
44
  /**
45
  * Form notices.
@@ -47,7 +47,7 @@ abstract class WP_Job_Manager_Form {
47
  * @access protected
48
  * @var array
49
  */
50
- protected $messages = array();
51
 
52
  /**
53
  * Form steps.
@@ -55,7 +55,7 @@ abstract class WP_Job_Manager_Form {
55
  * @access protected
56
  * @var array
57
  */
58
- protected $steps = array();
59
 
60
  /**
61
  * Current form step.
@@ -102,7 +102,7 @@ abstract class WP_Job_Manager_Form {
102
  delete_post_meta( sanitize_text_field( wp_unslash( $_COOKIE['wp-job-manager-submitting-job-id'] ) ), '_submitting_key' );
103
  setcookie( 'wp-job-manager-submitting-job-id', '', time() - 3600, COOKIEPATH, COOKIE_DOMAIN, false );
104
  setcookie( 'wp-job-manager-submitting-job-key', '', time() - 3600, COOKIEPATH, COOKIE_DOMAIN, false );
105
- wp_safe_redirect( remove_query_arg( array( 'new', 'key' ) ) );
106
  exit;
107
  }
108
 
@@ -135,7 +135,7 @@ abstract class WP_Job_Manager_Form {
135
  *
136
  * @param array $atts Attributes to use in the view handler.
137
  */
138
- public function output( $atts = array() ) {
139
  $this->enqueue_scripts();
140
  $step_key = $this->get_step_key( $this->step );
141
  $this->show_errors();
@@ -267,12 +267,12 @@ abstract class WP_Job_Manager_Form {
267
  */
268
  public function get_fields( $key ) {
269
  if ( empty( $this->fields[ $key ] ) ) {
270
- return array();
271
  }
272
 
273
  $fields = $this->fields[ $key ];
274
 
275
- uasort( $fields, array( $this, 'sort_by_priority' ) );
276
 
277
  return $fields;
278
  }
@@ -295,7 +295,7 @@ abstract class WP_Job_Manager_Form {
295
  * Initializes form fields.
296
  */
297
  protected function init_fields() {
298
- $this->fields = array();
299
  }
300
 
301
  /**
@@ -304,7 +304,7 @@ abstract class WP_Job_Manager_Form {
304
  public function enqueue_scripts() {
305
  if ( $this->use_recaptcha_field() ) {
306
  // phpcs:ignore WordPress.WP.EnqueuedResourceParameters.NoExplicitVersion
307
- wp_enqueue_script( 'recaptcha', 'https://www.google.com/recaptcha/api.js', array(), false, false );
308
  }
309
  }
310
 
@@ -341,16 +341,16 @@ abstract class WP_Job_Manager_Form {
341
  * Output the reCAPTCHA field.
342
  */
343
  public function display_recaptcha_field() {
344
- $field = array();
345
  $field['label'] = get_option( 'job_manager_recaptcha_label' );
346
  $field['required'] = true;
347
  $field['site_key'] = get_option( 'job_manager_recaptcha_site_key' );
348
  get_job_manager_template(
349
  'form-fields/recaptcha-field.php',
350
- array(
351
  'key' => 'recaptcha',
352
  'field' => $field,
353
- )
354
  );
355
  }
356
 
@@ -374,11 +374,11 @@ abstract class WP_Job_Manager_Form {
374
  $default_remote_addr = isset( $_SERVER['REMOTE_ADDR'] ) ? sanitize_text_field( wp_unslash( $_SERVER['REMOTE_ADDR'] ) ) : '';
375
  $response = wp_remote_get(
376
  add_query_arg(
377
- array(
378
  'secret' => get_option( 'job_manager_recaptcha_secret_key' ),
379
  'response' => $input_recaptcha_response,
380
  'remoteip' => isset( $_SERVER['HTTP_X_FORWARDED_FOR'] ) ? sanitize_text_field( wp_unslash( $_SERVER['HTTP_X_FORWARDED_FOR'] ) ) : $default_remote_addr,
381
- ),
382
  'https://www.google.com/recaptcha/api/siteverify'
383
  )
384
  );
@@ -406,7 +406,7 @@ abstract class WP_Job_Manager_Form {
406
  protected function get_posted_fields() {
407
  $this->init_fields();
408
 
409
- $values = array();
410
 
411
  foreach ( $this->fields as $group_key => $group_fields ) {
412
  foreach ( $group_fields as $key => $field ) {
@@ -417,7 +417,7 @@ abstract class WP_Job_Manager_Form {
417
  if ( $handler ) {
418
  $values[ $group_key ][ $key ] = call_user_func( $handler, $key, $field );
419
  } elseif ( method_exists( $this, "get_posted_{$field_type}_field" ) ) {
420
- $values[ $group_key ][ $key ] = call_user_func( array( $this, "get_posted_{$field_type}_field" ), $key, $field );
421
  } else {
422
  $values[ $group_key ][ $key ] = $this->get_posted_field( $key, $field );
423
  }
@@ -509,7 +509,7 @@ abstract class WP_Job_Manager_Form {
509
  */
510
  protected function get_posted_multiselect_field( $key, $field ) {
511
  // phpcs:ignore WordPress.Security.NonceVerification.Missing -- Nonce check happens earlier.
512
- return isset( $_POST[ $key ] ) ? array_map( 'sanitize_text_field', wp_unslash( $_POST[ $key ] ) ) : array();
513
  }
514
 
515
  /**
@@ -569,7 +569,7 @@ abstract class WP_Job_Manager_Form {
569
  // phpcs:ignore WordPress.Security.NonceVerification.Missing -- Nonce check happens earlier.
570
  return array_map( 'absint', $_POST['tax_input'][ $field['taxonomy'] ] );
571
  } else {
572
- return array();
573
  }
574
  }
575
 
@@ -582,7 +582,7 @@ abstract class WP_Job_Manager_Form {
582
  */
583
  protected function get_posted_term_multiselect_field( $key, $field ) {
584
  // phpcs:ignore WordPress.Security.NonceVerification.Missing -- Nonce check happens earlier.
585
- return isset( $_POST[ $key ] ) ? array_map( 'absint', $_POST[ $key ] ) : array();
586
  }
587
 
588
  /**
@@ -613,16 +613,16 @@ abstract class WP_Job_Manager_Form {
613
  $allowed_mime_types = job_manager_get_allowed_mime_types();
614
  }
615
 
616
- $file_urls = array();
617
  $files_to_upload = job_manager_prepare_uploaded_files( $_FILES[ $field_key ] ); //phpcs:ignore WordPress.Security.ValidatedSanitizedInput.InputNotSanitized, WordPress.Security.ValidatedSanitizedInput.MissingUnslash -- see https://github.com/WordPress-Coding-Standards/WordPress-Coding-Standards/issues/1720.
618
 
619
  foreach ( $files_to_upload as $file_to_upload ) {
620
  $uploaded_file = job_manager_upload_file(
621
  $file_to_upload,
622
- array(
623
  'file_key' => $field_key,
624
  'allowed_mime_types' => $allowed_mime_types,
625
- )
626
  );
627
 
628
  if ( is_wp_error( $uploaded_file ) ) {
23
  * @access protected
24
  * @var array
25
  */
26
+ protected $fields = [];
27
 
28
  /**
29
  * Form action.
39
  * @access protected
40
  * @var array
41
  */
42
+ protected $errors = [];
43
 
44
  /**
45
  * Form notices.
47
  * @access protected
48
  * @var array
49
  */
50
+ protected $messages = [];
51
 
52
  /**
53
  * Form steps.
55
  * @access protected
56
  * @var array
57
  */
58
+ protected $steps = [];
59
 
60
  /**
61
  * Current form step.
102
  delete_post_meta( sanitize_text_field( wp_unslash( $_COOKIE['wp-job-manager-submitting-job-id'] ) ), '_submitting_key' );
103
  setcookie( 'wp-job-manager-submitting-job-id', '', time() - 3600, COOKIEPATH, COOKIE_DOMAIN, false );
104
  setcookie( 'wp-job-manager-submitting-job-key', '', time() - 3600, COOKIEPATH, COOKIE_DOMAIN, false );
105
+ wp_safe_redirect( remove_query_arg( [ 'new', 'key' ] ) );
106
  exit;
107
  }
108
 
135
  *
136
  * @param array $atts Attributes to use in the view handler.
137
  */
138
+ public function output( $atts = [] ) {
139
  $this->enqueue_scripts();
140
  $step_key = $this->get_step_key( $this->step );
141
  $this->show_errors();
267
  */
268
  public function get_fields( $key ) {
269
  if ( empty( $this->fields[ $key ] ) ) {
270
+ return [];
271
  }
272
 
273
  $fields = $this->fields[ $key ];
274
 
275
+ uasort( $fields, [ $this, 'sort_by_priority' ] );
276
 
277
  return $fields;
278
  }
295
  * Initializes form fields.
296
  */
297
  protected function init_fields() {
298
+ $this->fields = [];
299
  }
300
 
301
  /**
304
  public function enqueue_scripts() {
305
  if ( $this->use_recaptcha_field() ) {
306
  // phpcs:ignore WordPress.WP.EnqueuedResourceParameters.NoExplicitVersion
307
+ wp_enqueue_script( 'recaptcha', 'https://www.google.com/recaptcha/api.js', [], false, false );
308
  }
309
  }
310
 
341
  * Output the reCAPTCHA field.
342
  */
343
  public function display_recaptcha_field() {
344
+ $field = [];
345
  $field['label'] = get_option( 'job_manager_recaptcha_label' );
346
  $field['required'] = true;
347
  $field['site_key'] = get_option( 'job_manager_recaptcha_site_key' );
348
  get_job_manager_template(
349
  'form-fields/recaptcha-field.php',
350
+ [
351
  'key' => 'recaptcha',
352
  'field' => $field,
353
+ ]
354
  );
355
  }
356
 
374
  $default_remote_addr = isset( $_SERVER['REMOTE_ADDR'] ) ? sanitize_text_field( wp_unslash( $_SERVER['REMOTE_ADDR'] ) ) : '';
375
  $response = wp_remote_get(
376
  add_query_arg(
377
+ [
378
  'secret' => get_option( 'job_manager_recaptcha_secret_key' ),
379
  'response' => $input_recaptcha_response,
380
  'remoteip' => isset( $_SERVER['HTTP_X_FORWARDED_FOR'] ) ? sanitize_text_field( wp_unslash( $_SERVER['HTTP_X_FORWARDED_FOR'] ) ) : $default_remote_addr,
381
+ ],
382
  'https://www.google.com/recaptcha/api/siteverify'
383
  )
384
  );
406
  protected function get_posted_fields() {
407
  $this->init_fields();
408
 
409
+ $values = [];
410
 
411
  foreach ( $this->fields as $group_key => $group_fields ) {
412
  foreach ( $group_fields as $key => $field ) {
417
  if ( $handler ) {
418
  $values[ $group_key ][ $key ] = call_user_func( $handler, $key, $field );
419
  } elseif ( method_exists( $this, "get_posted_{$field_type}_field" ) ) {
420
+ $values[ $group_key ][ $key ] = call_user_func( [ $this, "get_posted_{$field_type}_field" ], $key, $field );
421
  } else {
422
  $values[ $group_key ][ $key ] = $this->get_posted_field( $key, $field );
423
  }
509
  */
510
  protected function get_posted_multiselect_field( $key, $field ) {
511
  // phpcs:ignore WordPress.Security.NonceVerification.Missing -- Nonce check happens earlier.
512
+ return isset( $_POST[ $key ] ) ? array_map( 'sanitize_text_field', wp_unslash( $_POST[ $key ] ) ) : [];
513
  }
514
 
515
  /**
569
  // phpcs:ignore WordPress.Security.NonceVerification.Missing -- Nonce check happens earlier.
570
  return array_map( 'absint', $_POST['tax_input'][ $field['taxonomy'] ] );
571
  } else {
572
+ return [];
573
  }
574
  }
575
 
582
  */
583
  protected function get_posted_term_multiselect_field( $key, $field ) {
584
  // phpcs:ignore WordPress.Security.NonceVerification.Missing -- Nonce check happens earlier.
585
+ return isset( $_POST[ $key ] ) ? array_map( 'absint', $_POST[ $key ] ) : [];
586
  }
587
 
588
  /**
613
  $allowed_mime_types = job_manager_get_allowed_mime_types();
614
  }
615
 
616
+ $file_urls = [];
617
  $files_to_upload = job_manager_prepare_uploaded_files( $_FILES[ $field_key ] ); //phpcs:ignore WordPress.Security.ValidatedSanitizedInput.InputNotSanitized, WordPress.Security.ValidatedSanitizedInput.MissingUnslash -- see https://github.com/WordPress-Coding-Standards/WordPress-Coding-Standards/issues/1720.
618
 
619
  foreach ( $files_to_upload as $file_to_upload ) {
620
  $uploaded_file = job_manager_upload_file(
621
  $file_to_upload,
622
+ [
623
  'file_key' => $field_key,
624
  'allowed_mime_types' => $allowed_mime_types,
625
+ ]
626
  );
627
 
628
  if ( is_wp_error( $uploaded_file ) ) {
includes/admin/class-wp-job-manager-addons.php CHANGED
@@ -50,7 +50,7 @@ class WP_Job_Manager_Addons {
50
  */
51
  private function get_add_ons( $category = null ) {
52
  $raw_add_ons = wp_remote_get(
53
- add_query_arg( array( array( 'category' => $category ) ), self::WPJM_COM_PRODUCTS_API_BASE_URL . '/search' )
54
  );
55
  if ( ! is_wp_error( $raw_add_ons ) ) {
56
  $add_ons = json_decode( wp_remote_retrieve_body( $raw_add_ons ) )->products;
@@ -91,10 +91,10 @@ class WP_Job_Manager_Addons {
91
  if ( false === ( $add_on_messages ) ) {
92
  $raw_messages = wp_safe_remote_get(
93
  add_query_arg(
94
- array(
95
  'version' => JOB_MANAGER_VERSION,
96
  'lang' => get_locale(),
97
- ),
98
  self::WPJM_COM_PRODUCTS_API_BASE_URL . '/messages'
99
  )
100
  );
50
  */
51
  private function get_add_ons( $category = null ) {
52
  $raw_add_ons = wp_remote_get(
53
+ add_query_arg( [ [ 'category' => $category ] ], self::WPJM_COM_PRODUCTS_API_BASE_URL . '/search' )
54
  );
55
  if ( ! is_wp_error( $raw_add_ons ) ) {
56
  $add_ons = json_decode( wp_remote_retrieve_body( $raw_add_ons ) )->products;
91
  if ( false === ( $add_on_messages ) ) {
92
  $raw_messages = wp_safe_remote_get(
93
  add_query_arg(
94
+ [
95
  'version' => JOB_MANAGER_VERSION,
96
  'lang' => get_locale(),
97
+ ],
98
  self::WPJM_COM_PRODUCTS_API_BASE_URL . '/messages'
99
  )
100
  );
includes/admin/class-wp-job-manager-admin-notices.php CHANGED
@@ -29,9 +29,9 @@ class WP_Job_Manager_Admin_Notices {
29
  * Initialize admin notice handling.
30
  */
31
  public static function init() {
32
- add_action( 'job_manager_init_admin_notices', array( __CLASS__, 'init_core_notices' ) );
33
- add_action( 'admin_notices', array( __CLASS__, 'display_notices' ) );
34
- add_action( 'wp_loaded', array( __CLASS__, 'dismiss_notices' ) );
35
  }
36
 
37
  /**
@@ -73,7 +73,7 @@ class WP_Job_Manager_Admin_Notices {
73
  * Clears all enqueued notices.
74
  */
75
  public static function reset_notices() {
76
- self::$notice_state = array();
77
  self::save_notice_state();
78
  }
79
 
@@ -97,7 +97,7 @@ class WP_Job_Manager_Admin_Notices {
97
  */
98
  public static function init_core_notices() {
99
  // core_setup: Notice is used when first activating WP Job Manager.
100
- add_action( 'job_manager_admin_notice_' . self::NOTICE_CORE_SETUP, array( __CLASS__, 'display_core_setup' ) );
101
  }
102
 
103
  /**
@@ -117,7 +117,7 @@ class WP_Job_Manager_Admin_Notices {
117
 
118
  self::remove_notice( $hide_notice );
119
 
120
- wp_safe_redirect( remove_query_arg( array( 'wpjm_hide_notice', '_wpjm_notice_nonce' ) ) );
121
  exit;
122
  }
123
  }
@@ -165,17 +165,17 @@ class WP_Job_Manager_Admin_Notices {
165
  * @param array $additional_screens Screen IDs to also show a notice on.
166
  * @return bool
167
  */
168
- public static function is_admin_on_standard_job_manager_screen( $additional_screens = array() ) {
169
  $screen = get_current_screen();
170
  $screen_id = $screen ? $screen->id : '';
171
  $show_on_screens = array_merge(
172
- array(
173
  'edit-job_listing',
174
  'edit-job_listing_category',
175
  'edit-job_listing_type',
176
  'job_listing_page_job-manager-addons',
177
  'job_listing_page_job-manager-settings',
178
- ),
179
  $additional_screens
180
  );
181
 
@@ -196,7 +196,7 @@ class WP_Job_Manager_Admin_Notices {
196
  * Note: For internal use only. Do not call manually.
197
  */
198
  public static function display_core_setup() {
199
- if ( ! self::is_admin_on_standard_job_manager_screen( array( 'plugins', 'dashboard' ) ) ) {
200
  return;
201
  }
202
  include dirname( __FILE__ ) . '/views/html-admin-notice-core-setup.php';
@@ -211,7 +211,7 @@ class WP_Job_Manager_Admin_Notices {
211
  if ( null === self::$notice_state ) {
212
  self::$notice_state = json_decode( get_option( self::STATE_OPTION, '[]' ), true );
213
  if ( ! is_array( self::$notice_state ) ) {
214
- self::$notice_state = array();
215
  }
216
  }
217
  return self::$notice_state;
29
  * Initialize admin notice handling.
30
  */
31
  public static function init() {
32
+ add_action( 'job_manager_init_admin_notices', [ __CLASS__, 'init_core_notices' ] );
33
+ add_action( 'admin_notices', [ __CLASS__, 'display_notices' ] );
34
+ add_action( 'wp_loaded', [ __CLASS__, 'dismiss_notices' ] );
35
  }
36
 
37
  /**
73
  * Clears all enqueued notices.
74
  */
75
  public static function reset_notices() {
76
+ self::$notice_state = [];
77
  self::save_notice_state();
78
  }
79
 
97
  */
98
  public static function init_core_notices() {
99
  // core_setup: Notice is used when first activating WP Job Manager.
100
+ add_action( 'job_manager_admin_notice_' . self::NOTICE_CORE_SETUP, [ __CLASS__, 'display_core_setup' ] );
101
  }
102
 
103
  /**
117
 
118
  self::remove_notice( $hide_notice );
119
 
120
+ wp_safe_redirect( remove_query_arg( [ 'wpjm_hide_notice', '_wpjm_notice_nonce' ] ) );
121
  exit;
122
  }
123
  }
165
  * @param array $additional_screens Screen IDs to also show a notice on.
166
  * @return bool
167
  */
168
+ public static function is_admin_on_standard_job_manager_screen( $additional_screens = [] ) {
169
  $screen = get_current_screen();
170
  $screen_id = $screen ? $screen->id : '';
171
  $show_on_screens = array_merge(
172
+ [
173
  'edit-job_listing',
174
  'edit-job_listing_category',
175
  'edit-job_listing_type',
176
  'job_listing_page_job-manager-addons',
177
  'job_listing_page_job-manager-settings',
178
+ ],
179
  $additional_screens
180
  );
181
 
196
  * Note: For internal use only. Do not call manually.
197
  */
198
  public static function display_core_setup() {
199
+ if ( ! self::is_admin_on_standard_job_manager_screen( [ 'plugins', 'dashboard' ] ) ) {
200
  return;
201
  }
202
  include dirname( __FILE__ ) . '/views/html-admin-notice-core-setup.php';
211
  if ( null === self::$notice_state ) {
212
  self::$notice_state = json_decode( get_option( self::STATE_OPTION, '[]' ), true );
213
  if ( ! is_array( self::$notice_state ) ) {
214
+ self::$notice_state = [];
215
  }
216
  }
217
  return self::$notice_state;
includes/admin/class-wp-job-manager-admin.php CHANGED
@@ -54,10 +54,10 @@ class WP_Job_Manager_Admin {
54
 
55
  $this->settings_page = WP_Job_Manager_Settings::instance();
56
 
57
- add_action( 'admin_init', array( $this, 'admin_init' ) );
58
- add_action( 'current_screen', array( $this, 'conditional_includes' ) );
59
- add_action( 'admin_menu', array( $this, 'admin_menu' ), 12 );
60
- add_action( 'admin_enqueue_scripts', array( $this, 'admin_enqueue_scripts' ) );
61
  }
62
 
63
  /**
@@ -89,54 +89,54 @@ class WP_Job_Manager_Admin {
89
  WP_Job_Manager::register_select2_assets();
90
 
91
  $screen = get_current_screen();
92
- if ( in_array( $screen->id, apply_filters( 'job_manager_admin_screen_ids', array( 'edit-job_listing', 'plugins', 'job_listing', 'job_listing_page_job-manager-settings', 'job_listing_page_job-manager-addons' ) ), true ) ) {
93
  wp_enqueue_style( 'jquery-ui' );
94
  wp_enqueue_style( 'select2' );
95
- wp_enqueue_style( 'job_manager_admin_css', JOB_MANAGER_PLUGIN_URL . '/assets/css/admin.css', array(), JOB_MANAGER_VERSION );
96
- wp_register_script( 'jquery-tiptip', JOB_MANAGER_PLUGIN_URL . '/assets/js/jquery-tiptip/jquery.tipTip.min.js', array( 'jquery' ), JOB_MANAGER_VERSION, true );
97
- wp_enqueue_script( 'job_manager_datepicker_js', JOB_MANAGER_PLUGIN_URL . '/assets/js/datepicker.min.js', array( 'jquery', 'jquery-ui-datepicker' ), JOB_MANAGER_VERSION, true );
98
- wp_enqueue_script( 'job_manager_admin_js', JOB_MANAGER_PLUGIN_URL . '/assets/js/admin.min.js', array( 'jquery', 'jquery-tiptip', 'select2' ), JOB_MANAGER_VERSION, true );
99
 
100
  wp_localize_script(
101
  'job_manager_admin_js',
102
  'job_manager_admin_params',
103
- array(
104
- 'user_selection_strings' => array(
105
  'no_matches' => _x( 'No matches found', 'user selection', 'wp-job-manager' ),
106
  'ajax_error' => _x( 'Loading failed', 'user selection', 'wp-job-manager' ),
107
  'input_too_short_1' => _x( 'Please enter 1 or more characters', 'user selection', 'wp-job-manager' ),
108
  'input_too_short_n' => _x( 'Please enter %qty% or more characters', 'user selection', 'wp-job-manager' ),
109
  'load_more' => _x( 'Loading more results&hellip;', 'user selection', 'wp-job-manager' ),
110
  'searching' => _x( 'Searching&hellip;', 'user selection', 'wp-job-manager' ),
111
- ),
112
  'ajax_url' => admin_url( 'admin-ajax.php' ),
113
  'search_users_nonce' => wp_create_nonce( 'search-users' ),
114
- )
115
  );
116
 
117
  if ( ! function_exists( 'wp_localize_jquery_ui_datepicker' ) || ! has_action( 'admin_enqueue_scripts', 'wp_localize_jquery_ui_datepicker' ) ) {
118
  wp_localize_script(
119
  'job_manager_datepicker_js',
120
  'job_manager_datepicker',
121
- array(
122
  /* translators: jQuery date format, see http://api.jqueryui.com/datepicker/#utility-formatDate */
123
  'date_format' => _x( 'yy-mm-dd', 'Date format for jQuery datepicker.', 'wp-job-manager' ),
124
- )
125
  );
126
  }
127
  }
128
 
129
- wp_enqueue_style( 'job_manager_admin_menu_css', JOB_MANAGER_PLUGIN_URL . '/assets/css/menu.css', array(), JOB_MANAGER_VERSION );
130
  }
131
 
132
  /**
133
  * Adds pages to admin menu.
134
  */
135
  public function admin_menu() {
136
- add_submenu_page( 'edit.php?post_type=job_listing', __( 'Settings', 'wp-job-manager' ), __( 'Settings', 'wp-job-manager' ), 'manage_options', 'job-manager-settings', array( $this->settings_page, 'output' ) );
137
 
138
  if ( WP_Job_Manager_Helper::instance()->has_licenced_products() || apply_filters( 'job_manager_show_addons_page', true ) ) {
139
- add_submenu_page( 'edit.php?post_type=job_listing', __( 'WP Job Manager Add-ons', 'wp-job-manager' ), __( 'Add-ons', 'wp-job-manager' ), 'manage_options', 'job-manager-addons', array( $this, 'addons_page' ) );
140
  }
141
  }
142
 
54
 
55
  $this->settings_page = WP_Job_Manager_Settings::instance();
56
 
57
+ add_action( 'admin_init', [ $this, 'admin_init' ] );
58
+ add_action( 'current_screen', [ $this, 'conditional_includes' ] );
59
+ add_action( 'admin_menu', [ $this, 'admin_menu' ], 12 );
60
+ add_action( 'admin_enqueue_scripts', [ $this, 'admin_enqueue_scripts' ] );
61
  }
62
 
63
  /**
89
  WP_Job_Manager::register_select2_assets();
90
 
91
  $screen = get_current_screen();
92
+ if ( in_array( $screen->id, apply_filters( 'job_manager_admin_screen_ids', [ 'edit-job_listing', 'plugins', 'job_listing', 'job_listing_page_job-manager-settings', 'job_listing_page_job-manager-addons' ] ), true ) ) {
93
  wp_enqueue_style( 'jquery-ui' );
94
  wp_enqueue_style( 'select2' );
95
+ wp_enqueue_style( 'job_manager_admin_css', JOB_MANAGER_PLUGIN_URL . '/assets/css/admin.css', [], JOB_MANAGER_VERSION );
96
+ wp_register_script( 'jquery-tiptip', JOB_MANAGER_PLUGIN_URL . '/assets/js/jquery-tiptip/jquery.tipTip.min.js', [ 'jquery' ], JOB_MANAGER_VERSION, true );
97
+ wp_enqueue_script( 'job_manager_datepicker_js', JOB_MANAGER_PLUGIN_URL . '/assets/js/datepicker.min.js', [ 'jquery', 'jquery-ui-datepicker' ], JOB_MANAGER_VERSION, true );
98
+ wp_enqueue_script( 'job_manager_admin_js', JOB_MANAGER_PLUGIN_URL . '/assets/js/admin.min.js', [ 'jquery', 'jquery-tiptip', 'select2' ], JOB_MANAGER_VERSION, true );
99
 
100
  wp_localize_script(
101
  'job_manager_admin_js',
102
  'job_manager_admin_params',
103
+ [
104
+ 'user_selection_strings' => [
105
  'no_matches' => _x( 'No matches found', 'user selection', 'wp-job-manager' ),
106
  'ajax_error' => _x( 'Loading failed', 'user selection', 'wp-job-manager' ),
107
  'input_too_short_1' => _x( 'Please enter 1 or more characters', 'user selection', 'wp-job-manager' ),
108
  'input_too_short_n' => _x( 'Please enter %qty% or more characters', 'user selection', 'wp-job-manager' ),
109
  'load_more' => _x( 'Loading more results&hellip;', 'user selection', 'wp-job-manager' ),
110
  'searching' => _x( 'Searching&hellip;', 'user selection', 'wp-job-manager' ),
111
+ ],
112
  'ajax_url' => admin_url( 'admin-ajax.php' ),
113
  'search_users_nonce' => wp_create_nonce( 'search-users' ),
114
+ ]
115
  );
116
 
117
  if ( ! function_exists( 'wp_localize_jquery_ui_datepicker' ) || ! has_action( 'admin_enqueue_scripts', 'wp_localize_jquery_ui_datepicker' ) ) {
118
  wp_localize_script(
119
  'job_manager_datepicker_js',
120
  'job_manager_datepicker',
121
+ [
122
  /* translators: jQuery date format, see http://api.jqueryui.com/datepicker/#utility-formatDate */
123
  'date_format' => _x( 'yy-mm-dd', 'Date format for jQuery datepicker.', 'wp-job-manager' ),
124
+ ]
125
  );
126
  }
127
  }
128
 
129
+ wp_enqueue_style( 'job_manager_admin_menu_css', JOB_MANAGER_PLUGIN_URL . '/assets/css/menu.css', [], JOB_MANAGER_VERSION );
130
  }
131
 
132
  /**
133
  * Adds pages to admin menu.
134
  */
135
  public function admin_menu() {
136
+ add_submenu_page( 'edit.php?post_type=job_listing', __( 'Settings', 'wp-job-manager' ), __( 'Settings', 'wp-job-manager' ), 'manage_options', 'job-manager-settings', [ $this->settings_page, 'output' ] );
137
 
138
  if ( WP_Job_Manager_Helper::instance()->has_licenced_products() || apply_filters( 'job_manager_show_addons_page', true ) ) {
139
+ add_submenu_page( 'edit.php?post_type=job_listing', __( 'WP Job Manager Add-ons', 'wp-job-manager' ), __( 'Add-ons', 'wp-job-manager' ), 'manage_options', 'job-manager-addons', [ $this, 'addons_page' ] );
140
  }
141
  }
142
 
includes/admin/class-wp-job-manager-cpt.php CHANGED
@@ -42,30 +42,30 @@ class WP_Job_Manager_CPT {
42
  * Constructor.
43
  */
44
  public function __construct() {
45
- add_filter( 'enter_title_here', array( $this, 'enter_title_here' ), 1, 2 );
46
- add_filter( 'manage_edit-job_listing_columns', array( $this, 'columns' ) );
47
- add_filter( 'list_table_primary_column', array( $this, 'primary_column' ), 10, 2 );
48
- add_filter( 'post_row_actions', array( $this, 'row_actions' ) );
49
- add_action( 'manage_job_listing_posts_custom_column', array( $this, 'custom_columns' ), 2 );
50
- add_filter( 'manage_edit-job_listing_sortable_columns', array( $this, 'sortable_columns' ) );
51
- add_filter( 'request', array( $this, 'sort_columns' ) );
52
- add_action( 'parse_query', array( $this, 'search_meta' ) );
53
- add_action( 'parse_query', array( $this, 'filter_meta' ) );
54
- add_filter( 'get_search_query', array( $this, 'search_meta_label' ) );
55
- add_filter( 'post_updated_messages', array( $this, 'post_updated_messages' ) );
56
- add_action( 'bulk_actions-edit-job_listing', array( $this, 'add_bulk_actions' ) );
57
- add_action( 'handle_bulk_actions-edit-job_listing', array( $this, 'do_bulk_actions' ), 10, 3 );
58
- add_action( 'admin_init', array( $this, 'approve_job' ) );
59
- add_action( 'admin_notices', array( $this, 'action_notices' ) );
60
- add_action( 'view_mode_post_types', array( $this, 'disable_view_mode' ) );
61
 
62
  if ( get_option( 'job_manager_enable_categories' ) ) {
63
- add_action( 'restrict_manage_posts', array( $this, 'jobs_by_category' ) );
64
  }
65
- add_action( 'restrict_manage_posts', array( $this, 'jobs_meta_filters' ) );
66
 
67
- foreach ( array( 'post', 'post-new' ) as $hook ) {
68
- add_action( "admin_footer-{$hook}.php", array( $this, 'extend_submitdiv_post_status' ) );
69
  }
70
  }
71
 
@@ -75,35 +75,35 @@ class WP_Job_Manager_CPT {
75
  * @return array
76
  */
77
  public function get_bulk_actions() {
78
- $actions_handled = array();
79
- $actions_handled['approve_jobs'] = array(
80
  // translators: Placeholder (%s) is the plural name of the job listings post type.
81
  'label' => __( 'Approve %s', 'wp-job-manager' ),
82
  // translators: Placeholder (%s) is the plural name of the job listings post type.
83
  'notice' => __( '%s approved', 'wp-job-manager' ),
84
- 'handler' => array( $this, 'bulk_action_handle_approve_job' ),
85
- );
86
- $actions_handled['expire_jobs'] = array(
87
  // translators: Placeholder (%s) is the plural name of the job listings post type.
88
  'label' => __( 'Expire %s', 'wp-job-manager' ),
89
  // translators: Placeholder (%s) is the plural name of the job listings post type.
90
  'notice' => __( '%s expired', 'wp-job-manager' ),
91
- 'handler' => array( $this, 'bulk_action_handle_expire_job' ),
92
- );
93
- $actions_handled['mark_jobs_filled'] = array(
94
  // translators: Placeholder (%s) is the plural name of the job listings post type.
95
  'label' => __( 'Mark %s Filled', 'wp-job-manager' ),
96
  // translators: Placeholder (%s) is the plural name of the job listings post type.
97
  'notice' => __( '%s marked as filled', 'wp-job-manager' ),
98
- 'handler' => array( $this, 'bulk_action_handle_mark_job_filled' ),
99
- );
100
- $actions_handled['mark_jobs_not_filled'] = array(
101
  // translators: Placeholder (%s) is the plural name of the job listings post type.
102
  'label' => __( 'Mark %s Not Filled', 'wp-job-manager' ),
103
  // translators: Placeholder (%s) is the plural name of the job listings post type.
104
  'notice' => __( '%s marked as not filled', 'wp-job-manager' ),
105
- 'handler' => array( $this, 'bulk_action_handle_mark_job_not_filled' ),
106
- );
107
 
108
  /**
109
  * Filters the bulk actions that can be applied to job listings.
@@ -152,7 +152,7 @@ class WP_Job_Manager_CPT {
152
  public function do_bulk_actions( $redirect_url, $action, $post_ids ) {
153
  $actions_handled = $this->get_bulk_actions();
154
  if ( isset( $actions_handled[ $action ] ) && isset( $actions_handled[ $action ]['handler'] ) ) {
155
- $handled_jobs = array();
156
  if ( ! empty( $post_ids ) ) {
157
  foreach ( $post_ids as $post_id ) {
158
  if (
@@ -176,12 +176,12 @@ class WP_Job_Manager_CPT {
176
  * @return bool
177
  */
178
  public function bulk_action_handle_approve_job( $post_id ) {
179
- $job_data = array(
180
  'ID' => $post_id,
181
  'post_status' => 'publish',
182
- );
183
  if (
184
- in_array( get_post_status( $post_id ), array( 'pending', 'pending_payment' ), true )
185
  && current_user_can( 'publish_post', $post_id )
186
  && wp_update_post( $job_data )
187
  ) {
@@ -197,10 +197,10 @@ class WP_Job_Manager_CPT {
197
  * @return bool
198
  */
199
  public function bulk_action_handle_expire_job( $post_id ) {
200
- $job_data = array(
201
  'ID' => $post_id,
202
  'post_status' => 'expired',
203
- );
204
  if (
205
  current_user_can( 'manage_job_listings', $post_id )
206
  && wp_update_post( $job_data )
@@ -254,10 +254,10 @@ class WP_Job_Manager_CPT {
254
  && current_user_can( 'publish_post', absint( $_GET['approve_job'] ) )
255
  ) {
256
  $post_id = absint( $_GET['approve_job'] );
257
- $job_data = array(
258
  'ID' => $post_id,
259
  'post_status' => 'publish',
260
- );
261
  wp_update_post( $job_data );
262
  wp_safe_redirect( remove_query_arg( 'approve_job', add_query_arg( 'handled_jobs', $post_id, add_query_arg( 'action_performed', 'approve_jobs', admin_url( 'edit.php?post_type=job_listing' ) ) ) ) );
263
  exit;
@@ -285,7 +285,7 @@ class WP_Job_Manager_CPT {
285
  && isset( $actions_handled[ $action ]['notice'] )
286
  ) {
287
  if ( is_array( $handled_jobs ) ) {
288
- $titles = array();
289
  foreach ( $handled_jobs as $job_id ) {
290
  $titles[] = wpjm_get_the_job_title( $job_id );
291
  }
@@ -308,7 +308,7 @@ class WP_Job_Manager_CPT {
308
 
309
  include_once JOB_MANAGER_PLUGIN_DIR . '/includes/class-wp-job-manager-category-walker.php';
310
 
311
- $r = array();
312
  $r['taxonomy'] = 'job_listing_category';
313
  $r['pad_counts'] = 1;
314
  $r['hierarchical'] = 1;
@@ -323,13 +323,13 @@ class WP_Job_Manager_CPT {
323
  return;
324
  }
325
 
326
- $allowed_html = array(
327
- 'option' => array(
328
- 'value' => array(),
329
- 'selected' => array(),
330
- 'class' => array(),
331
- ),
332
- );
333
 
334
  // phpcs:ignore WordPress.Security.NonceVerification.Recommended -- No changes or data exposed based on input.
335
  $selected_category = isset( $_GET['job_listing_category'] ) ? sanitize_text_field( wp_unslash( $_GET['job_listing_category'] ) ) : '';
@@ -356,39 +356,39 @@ class WP_Job_Manager_CPT {
356
  // Filter by Filled.
357
  $this->jobs_filter_dropdown(
358
  'job_listing_filled',
359
- array(
360
- array(
361
  'value' => '',
362
  'text' => __( 'Select Filled', 'wp-job-manager' ),
363
- ),
364
- array(
365
  'value' => '1',
366
  'text' => __( 'Filled', 'wp-job-manager' ),
367
- ),
368
- array(
369
  'value' => '0',
370
  'text' => __( 'Not Filled', 'wp-job-manager' ),
371
- ),
372
- )
373
  );
374
 
375
  // Filter by Featured.
376
  $this->jobs_filter_dropdown(
377
  'job_listing_featured',
378
- array(
379
- array(
380
  'value' => '',
381
  'text' => __( 'Select Featured', 'wp-job-manager' ),
382
- ),
383
- array(
384
  'value' => '1',
385
  'text' => __( 'Featured', 'wp-job-manager' ),
386
- ),
387
- array(
388
  'value' => '0',
389
  'text' => __( 'Not Featured', 'wp-job-manager' ),
390
- ),
391
- )
392
  );
393
  }
394
 
@@ -449,7 +449,7 @@ class WP_Job_Manager_CPT {
449
  // phpcs:ignore WordPress.Security.NonceVerification.Recommended -- No changes based on input.
450
  $revision_title = isset( $_GET['revision'] ) ? wp_post_revision_title( (int) $_GET['revision'], false ) : false;
451
 
452
- $messages['job_listing'] = array(
453
  0 => '',
454
  // translators: %1$s is the singular name of the job listing post type; %2$s is the URL to view the listing.
455
  1 => sprintf( __( '%1$s updated. <a href="%2$s">View</a>', 'wp-job-manager' ), $wp_post_types['job_listing']->labels->singular_name, esc_url( get_permalink( $post_ID ) ) ),
@@ -474,7 +474,7 @@ class WP_Job_Manager_CPT {
474
  ),
475
  // translators: %1$s is the singular name of the job listing post type; %2$s is the URL to view the listing.
476
  10 => sprintf( __( '%1$s draft updated. <a target="_blank" href="%2$s">Preview</a>', 'wp-job-manager' ), $wp_post_types['job_listing']->labels->singular_name, esc_url( add_query_arg( 'preview', 'true', get_permalink( $post_ID ) ) ) ),
477
- );
478
 
479
  return $messages;
480
  }
@@ -487,7 +487,7 @@ class WP_Job_Manager_CPT {
487
  */
488
  public function columns( $columns ) {
489
  if ( ! is_array( $columns ) ) {
490
- $columns = array();
491
  }
492
 
493
  unset( $columns['title'], $columns['date'], $columns['author'] );
@@ -540,7 +540,7 @@ class WP_Job_Manager_CPT {
540
  */
541
  public function row_actions( $actions ) {
542
  if ( 'job_listing' === get_post_type() ) {
543
- return array();
544
  }
545
  return $actions;
546
  }
@@ -624,36 +624,36 @@ class WP_Job_Manager_CPT {
624
  break;
625
  case 'job_actions':
626
  echo '<div class="actions">';
627
- $admin_actions = apply_filters( 'post_row_actions', array(), $post );
628
 
629
- if ( in_array( $post->post_status, array( 'pending', 'pending_payment' ), true ) && current_user_can( 'publish_post', $post->ID ) ) {
630
- $admin_actions['approve'] = array(
631
  'action' => 'approve',
632
  'name' => __( 'Approve', 'wp-job-manager' ),
633
  'url' => wp_nonce_url( add_query_arg( 'approve_job', $post->ID ), 'approve_job' ),
634
- );
635
  }
636
  if ( 'trash' !== $post->post_status ) {
637
  if ( current_user_can( 'read_post', $post->ID ) ) {
638
- $admin_actions['view'] = array(
639
  'action' => 'view',
640
  'name' => __( 'View', 'wp-job-manager' ),
641
  'url' => get_permalink( $post->ID ),
642
- );
643
  }
644
  if ( current_user_can( 'edit_post', $post->ID ) ) {
645
- $admin_actions['edit'] = array(
646
  'action' => 'edit',
647
  'name' => __( 'Edit', 'wp-job-manager' ),
648
  'url' => get_edit_post_link( $post->ID ),
649
- );
650
  }
651
  if ( current_user_can( 'delete_post', $post->ID ) ) {
652
- $admin_actions['delete'] = array(
653
  'action' => 'delete',
654
  'name' => __( 'Delete', 'wp-job-manager' ),
655
  'url' => get_delete_post_link( $post->ID ),
656
- );
657
  }
658
  }
659
 
@@ -680,12 +680,12 @@ class WP_Job_Manager_CPT {
680
  * @return array
681
  */
682
  public function sortable_columns( $columns ) {
683
- $custom = array(
684
  'job_posted' => 'date',
685
  'job_position' => 'title',
686
  'job_location' => 'job_location',
687
  'job_expires' => 'job_expires',
688
- );
689
  return wp_parse_args( $custom, $columns );
690
  }
691
 
@@ -700,18 +700,18 @@ class WP_Job_Manager_CPT {
700
  if ( 'job_expires' === $vars['orderby'] ) {
701
  $vars = array_merge(
702
  $vars,
703
- array(
704
  'meta_key' => '_job_expires',
705
  'orderby' => 'meta_value',
706
- )
707
  );
708
  } elseif ( 'job_location' === $vars['orderby'] ) {
709
  $vars = array_merge(
710
  $vars,
711
- array(
712
  'meta_key' => '_job_location',
713
  'orderby' => 'meta_value',
714
- )
715
  );
716
  }
717
  }
@@ -752,7 +752,7 @@ class WP_Job_Manager_CPT {
752
  '%' . $wpdb->esc_like( $wp->query_vars['s'] ) . '%'
753
  )
754
  ),
755
- array( 0 )
756
  )
757
  );
758
 
@@ -781,23 +781,23 @@ class WP_Job_Manager_CPT {
781
 
782
  $meta_query = $wp->get( 'meta_query' );
783
  if ( ! is_array( $meta_query ) ) {
784
- $meta_query = array();
785
  }
786
 
787
  // Filter on _filled meta.
788
  if ( false !== $input_job_listing_filled ) {
789
- $meta_query[] = array(
790
  'key' => '_filled',
791
  'value' => $input_job_listing_filled,
792
- );
793
  }
794
 
795
  // Filter on _featured meta.
796
  if ( false !== $input_job_listing_featured ) {
797
- $meta_query[] = array(
798
  'key' => '_featured',
799
  'value' => $input_job_listing_featured,
800
- );
801
  }
802
 
803
  // Set new meta query.
42
  * Constructor.
43
  */
44
  public function __construct() {
45
+ add_filter( 'enter_title_here', [ $this, 'enter_title_here' ], 1, 2 );
46
+ add_filter( 'manage_edit-job_listing_columns', [ $this, 'columns' ] );
47
+ add_filter( 'list_table_primary_column', [ $this, 'primary_column' ], 10, 2 );
48
+ add_filter( 'post_row_actions', [ $this, 'row_actions' ] );
49
+ add_action( 'manage_job_listing_posts_custom_column', [ $this, 'custom_columns' ], 2 );
50
+ add_filter( 'manage_edit-job_listing_sortable_columns', [ $this, 'sortable_columns' ] );
51
+ add_filter( 'request', [ $this, 'sort_columns' ] );
52
+ add_action( 'parse_query', [ $this, 'search_meta' ] );
53
+ add_action( 'parse_query', [ $this, 'filter_meta' ] );
54
+ add_filter( 'get_search_query', [ $this, 'search_meta_label' ] );
55
+ add_filter( 'post_updated_messages', [ $this, 'post_updated_messages' ] );
56
+ add_action( 'bulk_actions-edit-job_listing', [ $this, 'add_bulk_actions' ] );
57
+ add_action( 'handle_bulk_actions-edit-job_listing', [ $this, 'do_bulk_actions' ], 10, 3 );
58
+ add_action( 'admin_init', [ $this, 'approve_job' ] );
59
+ add_action( 'admin_notices', [ $this, 'action_notices' ] );
60
+ add_action( 'view_mode_post_types', [ $this, 'disable_view_mode' ] );
61
 
62
  if ( get_option( 'job_manager_enable_categories' ) ) {
63
+ add_action( 'restrict_manage_posts', [ $this, 'jobs_by_category' ] );
64
  }
65
+ add_action( 'restrict_manage_posts', [ $this, 'jobs_meta_filters' ] );
66
 
67
+ foreach ( [ 'post', 'post-new' ] as $hook ) {
68
+ add_action( "admin_footer-{$hook}.php", [ $this, 'extend_submitdiv_post_status' ] );
69
  }
70
  }
71
 
75
  * @return array
76
  */
77
  public function get_bulk_actions() {
78
+ $actions_handled = [];
79
+ $actions_handled['approve_jobs'] = [
80
  // translators: Placeholder (%s) is the plural name of the job listings post type.
81
  'label' => __( 'Approve %s', 'wp-job-manager' ),
82
  // translators: Placeholder (%s) is the plural name of the job listings post type.
83
  'notice' => __( '%s approved', 'wp-job-manager' ),
84
+ 'handler' => [ $this, 'bulk_action_handle_approve_job' ],
85
+ ];
86
+ $actions_handled['expire_jobs'] = [
87
  // translators: Placeholder (%s) is the plural name of the job listings post type.
88
  'label' => __( 'Expire %s', 'wp-job-manager' ),
89
  // translators: Placeholder (%s) is the plural name of the job listings post type.
90
  'notice' => __( '%s expired', 'wp-job-manager' ),
91
+ 'handler' => [ $this, 'bulk_action_handle_expire_job' ],
92
+ ];
93
+ $actions_handled['mark_jobs_filled'] = [
94
  // translators: Placeholder (%s) is the plural name of the job listings post type.
95
  'label' => __( 'Mark %s Filled', 'wp-job-manager' ),
96
  // translators: Placeholder (%s) is the plural name of the job listings post type.
97
  'notice' => __( '%s marked as filled', 'wp-job-manager' ),
98
+ 'handler' => [ $this, 'bulk_action_handle_mark_job_filled' ],
99
+ ];
100
+ $actions_handled['mark_jobs_not_filled'] = [
101
  // translators: Placeholder (%s) is the plural name of the job listings post type.
102
  'label' => __( 'Mark %s Not Filled', 'wp-job-manager' ),
103
  // translators: Placeholder (%s) is the plural name of the job listings post type.
104
  'notice' => __( '%s marked as not filled', 'wp-job-manager' ),
105
+ 'handler' => [ $this, 'bulk_action_handle_mark_job_not_filled' ],
106
+ ];
107
 
108
  /**
109
  * Filters the bulk actions that can be applied to job listings.
152
  public function do_bulk_actions( $redirect_url, $action, $post_ids ) {
153
  $actions_handled = $this->get_bulk_actions();
154
  if ( isset( $actions_handled[ $action ] ) && isset( $actions_handled[ $action ]['handler'] ) ) {
155
+ $handled_jobs = [];
156
  if ( ! empty( $post_ids ) ) {
157
  foreach ( $post_ids as $post_id ) {
158
  if (
176
  * @return bool
177
  */
178
  public function bulk_action_handle_approve_job( $post_id ) {
179
+ $job_data = [
180
  'ID' => $post_id,
181
  'post_status' => 'publish',
182
+ ];
183
  if (
184
+ in_array( get_post_status( $post_id ), [ 'pending', 'pending_payment' ], true )
185
  && current_user_can( 'publish_post', $post_id )
186
  && wp_update_post( $job_data )
187
  ) {
197
  * @return bool
198
  */
199
  public function bulk_action_handle_expire_job( $post_id ) {
200
+ $job_data = [
201
  'ID' => $post_id,
202
  'post_status' => 'expired',
203
+ ];
204
  if (
205
  current_user_can( 'manage_job_listings', $post_id )
206
  && wp_update_post( $job_data )
254
  && current_user_can( 'publish_post', absint( $_GET['approve_job'] ) )
255
  ) {
256
  $post_id = absint( $_GET['approve_job'] );
257
+ $job_data = [
258
  'ID' => $post_id,
259
  'post_status' => 'publish',
260
+ ];
261
  wp_update_post( $job_data );
262
  wp_safe_redirect( remove_query_arg( 'approve_job', add_query_arg( 'handled_jobs', $post_id, add_query_arg( 'action_performed', 'approve_jobs', admin_url( 'edit.php?post_type=job_listing' ) ) ) ) );
263
  exit;
285
  && isset( $actions_handled[ $action ]['notice'] )
286
  ) {
287
  if ( is_array( $handled_jobs ) ) {
288
+ $titles = [];
289
  foreach ( $handled_jobs as $job_id ) {
290
  $titles[] = wpjm_get_the_job_title( $job_id );
291
  }
308
 
309
  include_once JOB_MANAGER_PLUGIN_DIR . '/includes/class-wp-job-manager-category-walker.php';
310
 
311
+ $r = [];
312
  $r['taxonomy'] = 'job_listing_category';
313
  $r['pad_counts'] = 1;
314
  $r['hierarchical'] = 1;
323
  return;
324
  }
325
 
326
+ $allowed_html = [
327
+ 'option' => [
328
+ 'value' => [],
329
+ 'selected' => [],
330
+ 'class' => [],
331
+ ],
332
+ ];
333
 
334
  // phpcs:ignore WordPress.Security.NonceVerification.Recommended -- No changes or data exposed based on input.
335
  $selected_category = isset( $_GET['job_listing_category'] ) ? sanitize_text_field( wp_unslash( $_GET['job_listing_category'] ) ) : '';
356
  // Filter by Filled.
357
  $this->jobs_filter_dropdown(
358
  'job_listing_filled',
359
+ [
360
+ [
361
  'value' => '',
362
  'text' => __( 'Select Filled', 'wp-job-manager' ),
363
+ ],
364
+ [
365
  'value' => '1',
366
  'text' => __( 'Filled', 'wp-job-manager' ),
367
+ ],
368
+ [
369
  'value' => '0',
370
  'text' => __( 'Not Filled', 'wp-job-manager' ),
371
+ ],
372
+ ]
373
  );
374
 
375
  // Filter by Featured.
376
  $this->jobs_filter_dropdown(
377
  'job_listing_featured',
378
+ [
379
+ [
380
  'value' => '',
381
  'text' => __( 'Select Featured', 'wp-job-manager' ),
382
+ ],
383
+ [
384
  'value' => '1',
385
  'text' => __( 'Featured', 'wp-job-manager' ),
386
+ ],
387
+ [
388
  'value' => '0',
389
  'text' => __( 'Not Featured', 'wp-job-manager' ),
390
+ ],
391
+ ]
392
  );
393
  }
394
 
449
  // phpcs:ignore WordPress.Security.NonceVerification.Recommended -- No changes based on input.
450
  $revision_title = isset( $_GET['revision'] ) ? wp_post_revision_title( (int) $_GET['revision'], false ) : false;
451
 
452
+ $messages['job_listing'] = [
453
  0 => '',
454
  // translators: %1$s is the singular name of the job listing post type; %2$s is the URL to view the listing.
455
  1 => sprintf( __( '%1$s updated. <a href="%2$s">View</a>', 'wp-job-manager' ), $wp_post_types['job_listing']->labels->singular_name, esc_url( get_permalink( $post_ID ) ) ),
474
  ),
475
  // translators: %1$s is the singular name of the job listing post type; %2$s is the URL to view the listing.
476
  10 => sprintf( __( '%1$s draft updated. <a target="_blank" href="%2$s">Preview</a>', 'wp-job-manager' ), $wp_post_types['job_listing']->labels->singular_name, esc_url( add_query_arg( 'preview', 'true', get_permalink( $post_ID ) ) ) ),
477
+ ];
478
 
479
  return $messages;
480
  }
487
  */
488
  public function columns( $columns ) {
489
  if ( ! is_array( $columns ) ) {
490
+ $columns = [];
491
  }
492
 
493
  unset( $columns['title'], $columns['date'], $columns['author'] );
540
  */
541
  public function row_actions( $actions ) {
542
  if ( 'job_listing' === get_post_type() ) {
543
+ return [];
544
  }
545
  return $actions;
546
  }
624
  break;
625
  case 'job_actions':
626
  echo '<div class="actions">';
627
+ $admin_actions = apply_filters( 'post_row_actions', [], $post );
628
 
629
+ if ( in_array( $post->post_status, [ 'pending', 'pending_payment' ], true ) && current_user_can( 'publish_post', $post->ID ) ) {
630
+ $admin_actions['approve'] = [
631
  'action' => 'approve',
632
  'name' => __( 'Approve', 'wp-job-manager' ),
633
  'url' => wp_nonce_url( add_query_arg( 'approve_job', $post->ID ), 'approve_job' ),
634
+ ];
635
  }
636
  if ( 'trash' !== $post->post_status ) {
637
  if ( current_user_can( 'read_post', $post->ID ) ) {
638
+ $admin_actions['view'] = [
639
  'action' => 'view',
640
  'name' => __( 'View', 'wp-job-manager' ),
641
  'url' => get_permalink( $post->ID ),
642
+ ];
643
  }
644
  if ( current_user_can( 'edit_post', $post->ID ) ) {
645
+ $admin_actions['edit'] = [
646
  'action' => 'edit',
647
  'name' => __( 'Edit', 'wp-job-manager' ),
648
  'url' => get_edit_post_link( $post->ID ),
649
+ ];
650
  }
651
  if ( current_user_can( 'delete_post', $post->ID ) ) {
652
+ $admin_actions['delete'] = [
653
  'action' => 'delete',
654
  'name' => __( 'Delete', 'wp-job-manager' ),
655
  'url' => get_delete_post_link( $post->ID ),
656
+ ];
657
  }
658
  }
659
 
680
  * @return array
681
  */
682
  public function sortable_columns( $columns ) {
683
+ $custom = [
684
  'job_posted' => 'date',
685
  'job_position' => 'title',
686
  'job_location' => 'job_location',
687
  'job_expires' => 'job_expires',
688
+ ];
689
  return wp_parse_args( $custom, $columns );
690
  }
691
 
700
  if ( 'job_expires' === $vars['orderby'] ) {
701
  $vars = array_merge(
702
  $vars,
703
+ [
704
  'meta_key' => '_job_expires',
705
  'orderby' => 'meta_value',
706
+ ]
707
  );
708
  } elseif ( 'job_location' === $vars['orderby'] ) {
709
  $vars = array_merge(
710
  $vars,
711
+ [
712
  'meta_key' => '_job_location',
713
  'orderby' => 'meta_value',
714
+ ]
715
  );
716
  }
717
  }
752
  '%' . $wpdb->esc_like( $wp->query_vars['s'] ) . '%'
753
  )
754
  ),
755
+ [ 0 ]
756
  )
757
  );
758
 
781
 
782
  $meta_query = $wp->get( 'meta_query' );
783
  if ( ! is_array( $meta_query ) ) {
784
+ $meta_query = [];
785
  }
786
 
787
  // Filter on _filled meta.
788
  if ( false !== $input_job_listing_filled ) {
789
+ $meta_query[] = [
790
  'key' => '_filled',
791
  'value' => $input_job_listing_filled,
792
+ ];
793
  }
794
 
795
  // Filter on _featured meta.
796
  if ( false !== $input_job_listing_featured ) {
797
+ $meta_query[] = [
798
  'key' => '_featured',
799
  'value' => $input_job_listing_featured,
800
+ ];
801
  }
802
 
803
  // Set new meta query.
includes/admin/class-wp-job-manager-permalink-settings.php CHANGED
@@ -30,7 +30,7 @@ class WP_Job_Manager_Permalink_Settings {
30
  * @var array
31
  * @since 1.27.0
32
  */
33
- private $permalinks = array();
34
 
35
  /**
36
  * Allows for accessing single instance of class. Class should only be constructed once per call.
@@ -62,21 +62,21 @@ class WP_Job_Manager_Permalink_Settings {
62
  add_settings_field(
63
  'wpjm_job_base_slug',
64
  __( 'Job base', 'wp-job-manager' ),
65
- array( $this, 'job_base_slug_input' ),
66
  'permalink',
67
  'optional'
68
  );
69
  add_settings_field(
70
  'wpjm_job_category_slug',
71
  __( 'Job category base', 'wp-job-manager' ),
72
- array( $this, 'job_category_slug_input' ),
73
  'permalink',
74
  'optional'
75
  );
76
  add_settings_field(
77
  'wpjm_job_type_slug',
78
  __( 'Job type base', 'wp-job-manager' ),
79
- array( $this, 'job_type_slug_input' ),
80
  'permalink',
81
  'optional'
82
  );
@@ -84,7 +84,7 @@ class WP_Job_Manager_Permalink_Settings {
84
  add_settings_field(
85
  'wpjm_job_listings_archive_slug',
86
  __( 'Job listing archive page', 'wp-job-manager' ),
87
- array( $this, 'job_listings_archive_slug_input' ),
88
  'permalink',
89
  'optional'
90
  );
30
  * @var array
31
  * @since 1.27.0
32
  */
33
+ private $permalinks = [];
34
 
35
  /**
36
  * Allows for accessing single instance of class. Class should only be constructed once per call.
62
  add_settings_field(
63
  'wpjm_job_base_slug',
64
  __( 'Job base', 'wp-job-manager' ),
65
+ [ $this, 'job_base_slug_input' ],
66
  'permalink',
67
  'optional'
68
  );
69
  add_settings_field(
70
  'wpjm_job_category_slug',
71
  __( 'Job category base', 'wp-job-manager' ),
72
+ [ $this, 'job_category_slug_input' ],
73
  'permalink',
74
  'optional'
75
  );
76
  add_settings_field(
77
  'wpjm_job_type_slug',
78
  __( 'Job type base', 'wp-job-manager' ),
79
+ [ $this, 'job_type_slug_input' ],
80
  'permalink',
81
  'optional'
82
  );
84
  add_settings_field(
85
  'wpjm_job_listings_archive_slug',
86
  __( 'Job listing archive page', 'wp-job-manager' ),
87
+ [ $this, 'job_listings_archive_slug_input' ],
88
  'permalink',
89
  'optional'
90
  );
includes/admin/class-wp-job-manager-settings.php CHANGED
@@ -29,7 +29,7 @@ class WP_Job_Manager_Settings {
29
  *
30
  * @var array Settings.
31
  */
32
- protected $settings = array();
33
 
34
  /**
35
  * Allows for accessing single instance of class. Class should only be constructed once per call.
@@ -50,7 +50,7 @@ class WP_Job_Manager_Settings {
50
  */
51
  public function __construct() {
52
  $this->settings_group = 'job_manager';
53
- add_action( 'admin_init', array( $this, 'register_settings' ) );
54
  }
55
 
56
  /**
@@ -73,7 +73,7 @@ class WP_Job_Manager_Settings {
73
  protected function init_settings() {
74
  // Prepare roles option.
75
  $roles = get_editable_roles();
76
- $account_roles = array();
77
 
78
  foreach ( $roles as $key => $role ) {
79
  if ( 'administrator' === $key ) {
@@ -84,294 +84,294 @@ class WP_Job_Manager_Settings {
84
 
85
  $this->settings = apply_filters(
86
  'job_manager_settings',
87
- array(
88
- 'general' => array(
89
  __( 'General', 'wp-job-manager' ),
90
- array(
91
- array(
92
  'name' => 'job_manager_date_format',
93
  'std' => 'relative',
94
  'label' => __( 'Date Format', 'wp-job-manager' ),
95
  'desc' => __( 'Choose how you want the published date for jobs to be displayed on the front-end.', 'wp-job-manager' ),
96
  'type' => 'radio',
97
- 'options' => array(
98
  'relative' => __( 'Relative to the current date (e.g., 1 day, 1 week, 1 month ago)', 'wp-job-manager' ),
99
  'default' => __( 'Default date format as defined in Settings', 'wp-job-manager' ),
100
- ),
101
- ),
102
- array(
103
  'name' => 'job_manager_google_maps_api_key',
104
  'std' => '',
105
  'label' => __( 'Google Maps API Key', 'wp-job-manager' ),
106
  // translators: Placeholder %s is URL to set up a Google Maps API key.
107
  'desc' => sprintf( __( 'Google requires an API key to retrieve location information for job listings. Acquire an API key from the <a href="%s">Google Maps API developer site</a>.', 'wp-job-manager' ), 'https://developers.google.com/maps/documentation/geocoding/get-api-key' ),
108
- 'attributes' => array(),
109
- ),
110
- array(
111
  'name' => 'job_manager_delete_data_on_uninstall',
112
  'std' => '0',
113
  'label' => __( 'Delete Data On Uninstall', 'wp-job-manager' ),
114
  'cb_label' => __( 'Delete WP Job Manager data when the plugin is deleted. Once removed, this data cannot be restored.', 'wp-job-manager' ),
115
  'desc' => '',
116
  'type' => 'checkbox',
117
- 'attributes' => array(),
118
- ),
119
- ),
120
- ),
121
- 'job_listings' => array(
122
  __( 'Job Listings', 'wp-job-manager' ),
123
- array(
124
- array(
125
  'name' => 'job_manager_per_page',
126
  'std' => '10',
127
  'placeholder' => '',
128
  'label' => __( 'Listings Per Page', 'wp-job-manager' ),
129
  'desc' => __( 'Number of job listings to display per page.', 'wp-job-manager' ),
130
- 'attributes' => array(),
131
- ),
132
- array(
133
  'name' => 'job_manager_hide_filled_positions',
134
  'std' => '0',
135
  'label' => __( 'Filled Positions', 'wp-job-manager' ),
136
  'cb_label' => __( 'Hide filled positions', 'wp-job-manager' ),
137
  'desc' => __( 'Filled positions will not display in your archives.', 'wp-job-manager' ),
138
  'type' => 'checkbox',
139
- 'attributes' => array(),
140
- ),
141
- array(
142
  'name' => 'job_manager_hide_expired',
143
  'std' => get_option( 'job_manager_hide_expired_content' ) ? '1' : '0', // back compat.
144
  'label' => __( 'Hide Expired Listings', 'wp-job-manager' ),
145
  'cb_label' => __( 'Hide expired listings in job archives/search', 'wp-job-manager' ),
146
  'desc' => __( 'Expired job listings will not be searchable.', 'wp-job-manager' ),
147
  'type' => 'checkbox',
148
- 'attributes' => array(),
149
- ),
150
- array(
151
  'name' => 'job_manager_hide_expired_content',
152
  'std' => '1',
153
  'label' => __( 'Hide Expired Listings Content', 'wp-job-manager' ),
154
  'cb_label' => __( 'Hide content in expired single job listings', 'wp-job-manager' ),
155
  'desc' => __( 'Your site will display the titles of expired listings, but not the content of the listings. Otherwise, expired listings display their full content minus the application area.', 'wp-job-manager' ),
156
  'type' => 'checkbox',
157
- 'attributes' => array(),
158
- ),
159
- array(
160
  'name' => 'job_manager_enable_categories',
161
  'std' => '0',
162
  'label' => __( 'Categories', 'wp-job-manager' ),
163
  'cb_label' => __( 'Enable listing categories', 'wp-job-manager' ),
164
  'desc' => __( 'This lets users select from a list of categories when submitting a job. Note: an admin has to create categories before site users can select them.', 'wp-job-manager' ),
165
  'type' => 'checkbox',
166
- 'attributes' => array(),
167
- ),
168
- array(
169
  'name' => 'job_manager_enable_default_category_multiselect',
170
  'std' => '0',
171
  'label' => __( 'Multi-select Categories', 'wp-job-manager' ),
172
  'cb_label' => __( 'Default to category multiselect', 'wp-job-manager' ),
173
  'desc' => __( 'The category selection box will default to allowing multiple selections on the [jobs] shortcode. Without this, visitors will only be able to select a single category when filtering jobs.', 'wp-job-manager' ),
174
  'type' => 'checkbox',
175
- 'attributes' => array(),
176
- ),
177
- array(
178
  'name' => 'job_manager_category_filter_type',
179
  'std' => 'any',
180
  'label' => __( 'Category Filter Type', 'wp-job-manager' ),
181
  'desc' => __( 'Determines the logic used to display jobs when selecting multiple categories.', 'wp-job-manager' ),
182
  'type' => 'radio',
183
- 'options' => array(
184
  'any' => __( 'Jobs will be shown if within ANY selected category', 'wp-job-manager' ),
185
  'all' => __( 'Jobs will be shown if within ALL selected categories', 'wp-job-manager' ),
186
- ),
187
- ),
188
- array(
189
  'name' => 'job_manager_enable_types',
190
  'std' => '1',
191
  'label' => __( 'Types', 'wp-job-manager' ),
192
  'cb_label' => __( 'Enable listing types', 'wp-job-manager' ),
193
  'desc' => __( 'This lets users select from a list of types when submitting a job. Note: an admin has to create types before site users can select them.', 'wp-job-manager' ),
194
  'type' => 'checkbox',
195
- 'attributes' => array(),
196
- ),
197
- array(
198
  'name' => 'job_manager_multi_job_type',
199
  'std' => '0',
200
  'label' => __( 'Multi-select Listing Types', 'wp-job-manager' ),
201
  'cb_label' => __( 'Allow multiple types for listings', 'wp-job-manager' ),
202
  'desc' => __( 'This allows users to select more than one type when submitting a job. The metabox on the post editor and the selection box on the front-end job submission form will both reflect this.', 'wp-job-manager' ),
203
  'type' => 'checkbox',
204
- 'attributes' => array(),
205
- ),
206
- ),
207
- ),
208
- 'job_submission' => array(
209
  __( 'Job Submission', 'wp-job-manager' ),
210
- array(
211
- array(
212
  'name' => 'job_manager_user_requires_account',
213
  'std' => '1',
214
  'label' => __( 'Account Required', 'wp-job-manager' ),
215
  'cb_label' => __( 'Require an account to submit listings', 'wp-job-manager' ),
216
  'desc' => __( 'Limits job listing submissions to registered, logged-in users.', 'wp-job-manager' ),
217
  'type' => 'checkbox',
218
- 'attributes' => array(),
219
- ),
220
- array(
221
  'name' => 'job_manager_enable_registration',
222
  'std' => '1',
223
  'label' => __( 'Account Creation', 'wp-job-manager' ),
224
  'cb_label' => __( 'Enable account creation during submission', 'wp-job-manager' ),
225
  'desc' => __( 'Includes account creation on the listing submission form, to allow non-registered users to create an account and submit a job listing simultaneously.', 'wp-job-manager' ),
226
  'type' => 'checkbox',
227
- 'attributes' => array(),
228
- ),
229
- array(
230
  'name' => 'job_manager_generate_username_from_email',
231
  'std' => '1',
232
  'label' => __( 'Account Username', 'wp-job-manager' ),
233
  'cb_label' => __( 'Generate usernames from email addresses', 'wp-job-manager' ),
234
  'desc' => __( 'Automatically generates usernames for new accounts from the registrant\'s email address. If this is not enabled, a "username" field will display instead.', 'wp-job-manager' ),
235
  'type' => 'checkbox',
236
- 'attributes' => array(),
237
- ),
238
- array(
239
  'name' => 'job_manager_use_standard_password_setup_email',
240
  'std' => '1',
241
  'label' => __( 'Account Password', 'wp-job-manager' ),
242
  'cb_label' => __( 'Email new users a link to set a password', 'wp-job-manager' ),
243
  'desc' => __( 'Sends an email to the user with their username and a link to set their password. If this is not enabled, a "password" field will display instead, and their email address won\'t be verified.', 'wp-job-manager' ),
244
  'type' => 'checkbox',
245
- 'attributes' => array(),
246
- ),
247
- array(
248
  'name' => 'job_manager_registration_role',
249
  'std' => 'employer',
250
  'label' => __( 'Account Role', 'wp-job-manager' ),
251
  'desc' => __( 'Any new accounts created during submission will have this role. If you haven\'t enabled account creation during submission in the options above, your own method of assigning roles will apply.', 'wp-job-manager' ),
252
  'type' => 'select',
253
  'options' => $account_roles,
254
- ),
255
- array(
256
  'name' => 'job_manager_submission_requires_approval',
257
  'std' => '1',
258
  'label' => __( 'Moderate New Listings', 'wp-job-manager' ),
259
  'cb_label' => __( 'Require admin approval of all new listing submissions', 'wp-job-manager' ),
260
  'desc' => __( 'Sets all new submissions to "pending." They will not appear on your site until an admin approves them.', 'wp-job-manager' ),
261
  'type' => 'checkbox',
262
- 'attributes' => array(),
263
- ),
264
- array(
265
  'name' => 'job_manager_user_can_edit_pending_submissions',
266
  'std' => '0',
267
  'label' => __( 'Allow Pending Edits', 'wp-job-manager' ),
268
  'cb_label' => __( 'Allow editing of pending listings', 'wp-job-manager' ),
269
  'desc' => __( 'Users can continue to edit pending listings until they are approved by an admin.', 'wp-job-manager' ),
270
  'type' => 'checkbox',
271
- 'attributes' => array(),
272
- ),
273
- array(
274
  'name' => 'job_manager_user_edit_published_submissions',
275
  'std' => 'yes',
276
  'label' => __( 'Allow Published Edits', 'wp-job-manager' ),
277
  'cb_label' => __( 'Allow editing of published listings', 'wp-job-manager' ),
278
  'desc' => __( 'Choose whether published job listings can be edited and if edits require admin approval. When moderation is required, the original job listings will be unpublished while edits await admin approval.', 'wp-job-manager' ),
279
  'type' => 'radio',
280
- 'options' => array(
281
  'no' => __( 'Users cannot edit', 'wp-job-manager' ),
282
  'yes' => __( 'Users can edit without admin approval', 'wp-job-manager' ),
283
  'yes_moderated' => __( 'Users can edit, but edits require admin approval', 'wp-job-manager' ),
284
- ),
285
- 'attributes' => array(),
286
- ),
287
- array(
288
  'name' => 'job_manager_submission_duration',
289
  'std' => '30',
290
  'label' => __( 'Listing Duration', 'wp-job-manager' ),
291
  'desc' => __( 'Listings will display for the set number of days, then expire. Leave this field blank if you don\'t want listings to have an expiration date.', 'wp-job-manager' ),
292
- 'attributes' => array(),
293
- ),
294
- array(
295
  'name' => 'job_manager_allowed_application_method',
296
  'std' => '',
297
  'label' => __( 'Application Method', 'wp-job-manager' ),
298
  'desc' => __( 'Choose the application method job listers will need to provide. Specify URL or email address only, or allow listers to choose which they prefer.', 'wp-job-manager' ),
299
  'type' => 'radio',
300
- 'options' => array(
301
  '' => __( 'Email address or website URL', 'wp-job-manager' ),
302
  'email' => __( 'Email addresses only', 'wp-job-manager' ),
303
  'url' => __( 'Website URLs only', 'wp-job-manager' ),
304
- ),
305
- ),
306
- ),
307
- ),
308
- 'recaptcha' => array(
309
  __( 'reCAPTCHA', 'wp-job-manager' ),
310
- array(
311
- array(
312
  'name' => 'job_manager_recaptcha_label',
313
  'std' => __( 'Are you human?', 'wp-job-manager' ),
314
  'placeholder' => '',
315
  'label' => __( 'Field Label', 'wp-job-manager' ),
316
  'desc' => __( 'The label used for the reCAPTCHA field on forms.', 'wp-job-manager' ),
317
- 'attributes' => array(),
318
- ),
319
- array(
320
  'name' => 'job_manager_recaptcha_site_key',
321
  'std' => '',
322
  'placeholder' => '',
323
  'label' => __( 'Site Key', 'wp-job-manager' ),
324
  // translators: Placeholder %s is URL to set up Google reCAPTCHA API key.
325
  'desc' => sprintf( __( 'You can retrieve your site key from <a href="%s">Google\'s reCAPTCHA admin dashboard</a>.', 'wp-job-manager' ), 'https://www.google.com/recaptcha/admin#list' ),
326
- 'attributes' => array(),
327
- ),
328
- array(
329
  'name' => 'job_manager_recaptcha_secret_key',
330
  'std' => '',
331
  'placeholder' => '',
332
  'label' => __( 'Secret Key', 'wp-job-manager' ),
333
  // translators: Placeholder %s is URL to set up Google reCAPTCHA API key.
334
  'desc' => sprintf( __( 'You can retrieve your secret key from <a href="%s">Google\'s reCAPTCHA admin dashboard</a>.', 'wp-job-manager' ), 'https://www.google.com/recaptcha/admin#list' ),
335
- 'attributes' => array(),
336
- ),
337
- array(
338
  'name' => 'job_manager_enable_recaptcha_job_submission',
339
  'std' => '0',
340
  'label' => __( 'Job Submission Form', 'wp-job-manager' ),
341
  'cb_label' => __( 'Display a reCAPTCHA field on job submission form.', 'wp-job-manager' ),
342
  'desc' => sprintf( __( 'This will help prevent bots from submitting job listings. You must have entered a valid site key and secret key above.', 'wp-job-manager' ), 'https://www.google.com/recaptcha/admin#list' ),
343
  'type' => 'checkbox',
344
- 'attributes' => array(),
345
- ),
346
- ),
347
- ),
348
- 'job_pages' => array(
349
  __( 'Pages', 'wp-job-manager' ),
350
- array(
351
- array(
352
  'name' => 'job_manager_submit_job_form_page_id',
353
  'std' => '',
354
  'label' => __( 'Submit Job Form Page', 'wp-job-manager' ),
355
  'desc' => __( 'Select the page where you\'ve used the [submit_job_form] shortcode. This lets the plugin know the location of the form.', 'wp-job-manager' ),
356
  'type' => 'page',
357
- ),
358
- array(
359
  'name' => 'job_manager_job_dashboard_page_id',
360
  'std' => '',
361
  'label' => __( 'Job Dashboard Page', 'wp-job-manager' ),
362
  'desc' => __( 'Select the page where you\'ve used the [job_dashboard] shortcode. This lets the plugin know the location of the dashboard.', 'wp-job-manager' ),
363
  'type' => 'page',
364
- ),
365
- array(
366
  'name' => 'job_manager_jobs_page_id',
367
  'std' => '',
368
  'label' => __( 'Job Listings Page', 'wp-job-manager' ),
369
  'desc' => __( 'Select the page where you\'ve used the [jobs] shortcode. This lets the plugin know the location of the job listings page.', 'wp-job-manager' ),
370
  'type' => 'page',
371
- ),
372
- ),
373
- ),
374
- )
375
  );
376
  }
377
 
@@ -418,7 +418,7 @@ class WP_Job_Manager_Settings {
418
  }
419
 
420
  foreach ( $this->settings as $key => $section ) {
421
- $section_args = isset( $section[2] ) ? (array) $section[2] : array();
422
  echo '<div id="settings-' . esc_attr( sanitize_title( $key ) ) . '" class="settings_panel">';
423
  if ( ! empty( $section_args['before'] ) ) {
424
  echo '<p class="before-settings">' . wp_kses_post( $section_args['before'] ) . '</p>';
@@ -487,23 +487,6 @@ class WP_Job_Manager_Settings {
487
  }
488
  }).change();
489
 
490
- // If generate username is enabled on page load, assume use_standard_password_setup_email has been cleared.
491
- // Default is true, so let's sneakily set it to that before it gets cleared and disabled.
492
- if ( $generate_username_from_email.is(':checked') ) {
493
- $use_standard_password_setup_email.prop('checked', true);
494
- }
495
-
496
- $generate_username_from_email.change(function() {
497
- if ( jQuery( this ).is(':checked') ) {
498
- $use_standard_password_setup_email.data('original-state', $use_standard_password_setup_email.is(':checked')).prop('checked', true).prop('disabled', true);
499
- } else {
500
- $use_standard_password_setup_email.prop('disabled', false);
501
- if ( undefined !== $use_standard_password_setup_email.data('original-state') ) {
502
- $use_standard_password_setup_email.prop('checked', $use_standard_password_setup_email.data('original-state'));
503
- }
504
- }
505
- }).change();
506
-
507
  jQuery( '.sub-settings-expander' ).on( 'change', function() {
508
  var $expandable = jQuery(this).parent().siblings( '.sub-settings-expandable' );
509
  var checked = jQuery(this).is( ':checked' );
@@ -642,7 +625,7 @@ class WP_Job_Manager_Settings {
642
  * @param string $ignored_placeholder
643
  */
644
  protected function input_page( $option, $ignored_attributes, $value, $ignored_placeholder ) {
645
- $args = array(
646
  'name' => $option['name'],
647
  'id' => $option['name'],
648
  'sort_column' => 'menu_order',
@@ -650,7 +633,7 @@ class WP_Job_Manager_Settings {
650
  'show_option_none' => __( '--no page--', 'wp-job-manager' ),
651
  'echo' => false,
652
  'selected' => absint( $value ),
653
- );
654
 
655
  // phpcs:ignore WordPress.Security.EscapeOutput.OutputNotEscaped -- Safe output.
656
  echo str_replace( ' id=', " data-placeholder='" . esc_attr__( 'Select a page&hellip;', 'wp-job-manager' ) . "' id=", wp_dropdown_pages( $args ) );
@@ -785,7 +768,7 @@ class WP_Job_Manager_Settings {
785
  $placeholder = ( ! empty( $option['placeholder'] ) ) ? 'placeholder="' . esc_attr( $option['placeholder'] ) . '"' : '';
786
  $class = ! empty( $option['class'] ) ? $option['class'] : '';
787
  $option['type'] = ! empty( $option['type'] ) ? $option['type'] : 'text';
788
- $attributes = array();
789
  if ( ! empty( $option['attributes'] ) && is_array( $option['attributes'] ) ) {
790
  foreach ( $option['attributes'] as $attribute_name => $attribute_value ) {
791
  $attributes[] = esc_attr( $attribute_name ) . '="' . esc_attr( $attribute_value ) . '"';
@@ -832,7 +815,7 @@ class WP_Job_Manager_Settings {
832
  $enable_option = $option['enable_field'];
833
  $enable_option['name'] = $option['name'] . '[' . $enable_option['name'] . ']';
834
  $enable_option['type'] = 'checkbox';
835
- $enable_option['attributes'] = array( 'class="sub-settings-expander"' );
836
  $this->input_checkbox( $enable_option, $enable_option['attributes'], $values[ $option['enable_field']['name'] ], null );
837
 
838
  echo '<div class="sub-settings-expandable">';
29
  *
30
  * @var array Settings.
31
  */
32
+ protected $settings = [];
33
 
34
  /**
35
  * Allows for accessing single instance of class. Class should only be constructed once per call.
50
  */
51
  public function __construct() {
52
  $this->settings_group = 'job_manager';
53
+ add_action( 'admin_init', [ $this, 'register_settings' ] );
54
  }
55
 
56
  /**
73
  protected function init_settings() {
74
  // Prepare roles option.
75
  $roles = get_editable_roles();
76
+ $account_roles = [];
77
 
78
  foreach ( $roles as $key => $role ) {
79
  if ( 'administrator' === $key ) {
84
 
85
  $this->settings = apply_filters(
86
  'job_manager_settings',
87
+ [
88
+ 'general' => [
89
  __( 'General', 'wp-job-manager' ),
90
+ [
91
+ [
92
  'name' => 'job_manager_date_format',
93
  'std' => 'relative',
94
  'label' => __( 'Date Format', 'wp-job-manager' ),
95
  'desc' => __( 'Choose how you want the published date for jobs to be displayed on the front-end.', 'wp-job-manager' ),
96
  'type' => 'radio',
97
+ 'options' => [
98
  'relative' => __( 'Relative to the current date (e.g., 1 day, 1 week, 1 month ago)', 'wp-job-manager' ),
99
  'default' => __( 'Default date format as defined in Settings', 'wp-job-manager' ),
100
+ ],
101
+ ],
102
+ [
103
  'name' => 'job_manager_google_maps_api_key',
104
  'std' => '',
105
  'label' => __( 'Google Maps API Key', 'wp-job-manager' ),
106
  // translators: Placeholder %s is URL to set up a Google Maps API key.
107
  'desc' => sprintf( __( 'Google requires an API key to retrieve location information for job listings. Acquire an API key from the <a href="%s">Google Maps API developer site</a>.', 'wp-job-manager' ), 'https://developers.google.com/maps/documentation/geocoding/get-api-key' ),
108
+ 'attributes' => [],
109
+ ],
110
+ [
111
  'name' => 'job_manager_delete_data_on_uninstall',
112
  'std' => '0',
113
  'label' => __( 'Delete Data On Uninstall', 'wp-job-manager' ),
114
  'cb_label' => __( 'Delete WP Job Manager data when the plugin is deleted. Once removed, this data cannot be restored.', 'wp-job-manager' ),
115
  'desc' => '',
116
  'type' => 'checkbox',
117
+ 'attributes' => [],
118
+ ],
119
+ ],
120
+ ],
121
+ 'job_listings' => [
122
  __( 'Job Listings', 'wp-job-manager' ),
123
+ [
124
+ [
125
  'name' => 'job_manager_per_page',
126
  'std' => '10',
127
  'placeholder' => '',
128
  'label' => __( 'Listings Per Page', 'wp-job-manager' ),
129
  'desc' => __( 'Number of job listings to display per page.', 'wp-job-manager' ),
130
+ 'attributes' => [],
131
+ ],
132
+ [
133
  'name' => 'job_manager_hide_filled_positions',
134
  'std' => '0',
135
  'label' => __( 'Filled Positions', 'wp-job-manager' ),
136
  'cb_label' => __( 'Hide filled positions', 'wp-job-manager' ),
137
  'desc' => __( 'Filled positions will not display in your archives.', 'wp-job-manager' ),
138
  'type' => 'checkbox',
139
+ 'attributes' => [],
140
+ ],
141
+ [
142
  'name' => 'job_manager_hide_expired',
143
  'std' => get_option( 'job_manager_hide_expired_content' ) ? '1' : '0', // back compat.
144
  'label' => __( 'Hide Expired Listings', 'wp-job-manager' ),
145
  'cb_label' => __( 'Hide expired listings in job archives/search', 'wp-job-manager' ),
146
  'desc' => __( 'Expired job listings will not be searchable.', 'wp-job-manager' ),
147
  'type' => 'checkbox',
148
+ 'attributes' => [],
149
+ ],
150
+ [
151
  'name' => 'job_manager_hide_expired_content',
152
  'std' => '1',
153
  'label' => __( 'Hide Expired Listings Content', 'wp-job-manager' ),
154
  'cb_label' => __( 'Hide content in expired single job listings', 'wp-job-manager' ),
155
  'desc' => __( 'Your site will display the titles of expired listings, but not the content of the listings. Otherwise, expired listings display their full content minus the application area.', 'wp-job-manager' ),
156
  'type' => 'checkbox',
157
+ 'attributes' => [],
158
+ ],
159
+ [
160
  'name' => 'job_manager_enable_categories',
161
  'std' => '0',
162
  'label' => __( 'Categories', 'wp-job-manager' ),
163
  'cb_label' => __( 'Enable listing categories', 'wp-job-manager' ),
164
  'desc' => __( 'This lets users select from a list of categories when submitting a job. Note: an admin has to create categories before site users can select them.', 'wp-job-manager' ),
165
  'type' => 'checkbox',
166
+ 'attributes' => [],
167
+ ],
168
+ [
169
  'name' => 'job_manager_enable_default_category_multiselect',
170
  'std' => '0',
171
  'label' => __( 'Multi-select Categories', 'wp-job-manager' ),
172
  'cb_label' => __( 'Default to category multiselect', 'wp-job-manager' ),
173
  'desc' => __( 'The category selection box will default to allowing multiple selections on the [jobs] shortcode. Without this, visitors will only be able to select a single category when filtering jobs.', 'wp-job-manager' ),
174
  'type' => 'checkbox',
175
+ 'attributes' => [],
176
+ ],
177
+ [
178
  'name' => 'job_manager_category_filter_type',
179
  'std' => 'any',
180
  'label' => __( 'Category Filter Type', 'wp-job-manager' ),
181
  'desc' => __( 'Determines the logic used to display jobs when selecting multiple categories.', 'wp-job-manager' ),
182
  'type' => 'radio',
183
+ 'options' => [
184
  'any' => __( 'Jobs will be shown if within ANY selected category', 'wp-job-manager' ),
185
  'all' => __( 'Jobs will be shown if within ALL selected categories', 'wp-job-manager' ),
186
+ ],
187
+ ],
188
+ [
189
  'name' => 'job_manager_enable_types',
190
  'std' => '1',
191
  'label' => __( 'Types', 'wp-job-manager' ),
192
  'cb_label' => __( 'Enable listing types', 'wp-job-manager' ),
193
  'desc' => __( 'This lets users select from a list of types when submitting a job. Note: an admin has to create types before site users can select them.', 'wp-job-manager' ),
194
  'type' => 'checkbox',
195
+ 'attributes' => [],
196
+ ],
197
+ [
198
  'name' => 'job_manager_multi_job_type',
199
  'std' => '0',
200
  'label' => __( 'Multi-select Listing Types', 'wp-job-manager' ),
201
  'cb_label' => __( 'Allow multiple types for listings', 'wp-job-manager' ),
202
  'desc' => __( 'This allows users to select more than one type when submitting a job. The metabox on the post editor and the selection box on the front-end job submission form will both reflect this.', 'wp-job-manager' ),
203
  'type' => 'checkbox',
204
+ 'attributes' => [],
205
+ ],
206
+ ],
207
+ ],
208
+ 'job_submission' => [
209
  __( 'Job Submission', 'wp-job-manager' ),
210
+ [
211
+ [
212
  'name' => 'job_manager_user_requires_account',
213
  'std' => '1',
214
  'label' => __( 'Account Required', 'wp-job-manager' ),
215
  'cb_label' => __( 'Require an account to submit listings', 'wp-job-manager' ),
216
  'desc' => __( 'Limits job listing submissions to registered, logged-in users.', 'wp-job-manager' ),
217
  'type' => 'checkbox',
218
+ 'attributes' => [],
219
+ ],
220
+ [
221
  'name' => 'job_manager_enable_registration',
222
  'std' => '1',
223
  'label' => __( 'Account Creation', 'wp-job-manager' ),
224
  'cb_label' => __( 'Enable account creation during submission', 'wp-job-manager' ),
225
  'desc' => __( 'Includes account creation on the listing submission form, to allow non-registered users to create an account and submit a job listing simultaneously.', 'wp-job-manager' ),
226
  'type' => 'checkbox',
227
+ 'attributes' => [],
228
+ ],
229
+ [
230
  'name' => 'job_manager_generate_username_from_email',
231
  'std' => '1',
232
  'label' => __( 'Account Username', 'wp-job-manager' ),
233
  'cb_label' => __( 'Generate usernames from email addresses', 'wp-job-manager' ),
234
  'desc' => __( 'Automatically generates usernames for new accounts from the registrant\'s email address. If this is not enabled, a "username" field will display instead.', 'wp-job-manager' ),
235
  'type' => 'checkbox',
236
+ 'attributes' => [],
237
+ ],
238
+ [
239
  'name' => 'job_manager_use_standard_password_setup_email',
240
  'std' => '1',
241
  'label' => __( 'Account Password', 'wp-job-manager' ),
242
  'cb_label' => __( 'Email new users a link to set a password', 'wp-job-manager' ),
243
  'desc' => __( 'Sends an email to the user with their username and a link to set their password. If this is not enabled, a "password" field will display instead, and their email address won\'t be verified.', 'wp-job-manager' ),
244
  'type' => 'checkbox',
245
+ 'attributes' => [],
246
+ ],
247
+ [
248
  'name' => 'job_manager_registration_role',
249
  'std' => 'employer',
250
  'label' => __( 'Account Role', 'wp-job-manager' ),
251
  'desc' => __( 'Any new accounts created during submission will have this role. If you haven\'t enabled account creation during submission in the options above, your own method of assigning roles will apply.', 'wp-job-manager' ),
252
  'type' => 'select',
253
  'options' => $account_roles,
254
+ ],
255
+ [
256
  'name' => 'job_manager_submission_requires_approval',
257
  'std' => '1',
258
  'label' => __( 'Moderate New Listings', 'wp-job-manager' ),
259
  'cb_label' => __( 'Require admin approval of all new listing submissions', 'wp-job-manager' ),
260
  'desc' => __( 'Sets all new submissions to "pending." They will not appear on your site until an admin approves them.', 'wp-job-manager' ),
261
  'type' => 'checkbox',
262
+ 'attributes' => [],
263
+ ],
264
+ [
265
  'name' => 'job_manager_user_can_edit_pending_submissions',
266
  'std' => '0',
267
  'label' => __( 'Allow Pending Edits', 'wp-job-manager' ),
268
  'cb_label' => __( 'Allow editing of pending listings', 'wp-job-manager' ),
269
  'desc' => __( 'Users can continue to edit pending listings until they are approved by an admin.', 'wp-job-manager' ),
270
  'type' => 'checkbox',
271
+ 'attributes' => [],
272
+ ],
273
+ [
274
  'name' => 'job_manager_user_edit_published_submissions',
275
  'std' => 'yes',
276
  'label' => __( 'Allow Published Edits', 'wp-job-manager' ),
277
  'cb_label' => __( 'Allow editing of published listings', 'wp-job-manager' ),
278
  'desc' => __( 'Choose whether published job listings can be edited and if edits require admin approval. When moderation is required, the original job listings will be unpublished while edits await admin approval.', 'wp-job-manager' ),
279
  'type' => 'radio',
280
+ 'options' => [
281
  'no' => __( 'Users cannot edit', 'wp-job-manager' ),
282
  'yes' => __( 'Users can edit without admin approval', 'wp-job-manager' ),
283
  'yes_moderated' => __( 'Users can edit, but edits require admin approval', 'wp-job-manager' ),
284
+ ],
285
+ 'attributes' => [],
286
+ ],
287
+ [
288
  'name' => 'job_manager_submission_duration',
289
  'std' => '30',
290
  'label' => __( 'Listing Duration', 'wp-job-manager' ),
291
  'desc' => __( 'Listings will display for the set number of days, then expire. Leave this field blank if you don\'t want listings to have an expiration date.', 'wp-job-manager' ),
292
+ 'attributes' => [],
293
+ ],
294
+ [
295
  'name' => 'job_manager_allowed_application_method',
296
  'std' => '',
297
  'label' => __( 'Application Method', 'wp-job-manager' ),
298
  'desc' => __( 'Choose the application method job listers will need to provide. Specify URL or email address only, or allow listers to choose which they prefer.', 'wp-job-manager' ),
299
  'type' => 'radio',
300
+ 'options' => [
301
  '' => __( 'Email address or website URL', 'wp-job-manager' ),
302
  'email' => __( 'Email addresses only', 'wp-job-manager' ),
303
  'url' => __( 'Website URLs only', 'wp-job-manager' ),
304
+ ],
305
+ ],
306
+ ],
307
+ ],
308
+ 'recaptcha' => [
309
  __( 'reCAPTCHA', 'wp-job-manager' ),
310
+ [
311
+ [
312
  'name' => 'job_manager_recaptcha_label',
313
  'std' => __( 'Are you human?', 'wp-job-manager' ),
314
  'placeholder' => '',
315
  'label' => __( 'Field Label', 'wp-job-manager' ),
316
  'desc' => __( 'The label used for the reCAPTCHA field on forms.', 'wp-job-manager' ),
317
+ 'attributes' => [],
318
+ ],
319
+ [
320
  'name' => 'job_manager_recaptcha_site_key',
321
  'std' => '',
322
  'placeholder' => '',
323
  'label' => __( 'Site Key', 'wp-job-manager' ),
324
  // translators: Placeholder %s is URL to set up Google reCAPTCHA API key.
325
  'desc' => sprintf( __( 'You can retrieve your site key from <a href="%s">Google\'s reCAPTCHA admin dashboard</a>.', 'wp-job-manager' ), 'https://www.google.com/recaptcha/admin#list' ),
326
+ 'attributes' => [],
327
+ ],
328
+ [
329
  'name' => 'job_manager_recaptcha_secret_key',
330
  'std' => '',
331
  'placeholder' => '',
332
  'label' => __( 'Secret Key', 'wp-job-manager' ),
333
  // translators: Placeholder %s is URL to set up Google reCAPTCHA API key.
334
  'desc' => sprintf( __( 'You can retrieve your secret key from <a href="%s">Google\'s reCAPTCHA admin dashboard</a>.', 'wp-job-manager' ), 'https://www.google.com/recaptcha/admin#list' ),
335
+ 'attributes' => [],
336
+ ],
337
+ [
338
  'name' => 'job_manager_enable_recaptcha_job_submission',
339
  'std' => '0',
340
  'label' => __( 'Job Submission Form', 'wp-job-manager' ),
341
  'cb_label' => __( 'Display a reCAPTCHA field on job submission form.', 'wp-job-manager' ),
342
  'desc' => sprintf( __( 'This will help prevent bots from submitting job listings. You must have entered a valid site key and secret key above.', 'wp-job-manager' ), 'https://www.google.com/recaptcha/admin#list' ),
343
  'type' => 'checkbox',
344
+ 'attributes' => [],
345
+ ],
346
+ ],
347
+ ],
348
+ 'job_pages' => [
349
  __( 'Pages', 'wp-job-manager' ),
350
+ [
351
+ [
352
  'name' => 'job_manager_submit_job_form_page_id',
353
  'std' => '',
354
  'label' => __( 'Submit Job Form Page', 'wp-job-manager' ),
355
  'desc' => __( 'Select the page where you\'ve used the [submit_job_form] shortcode. This lets the plugin know the location of the form.', 'wp-job-manager' ),
356
  'type' => 'page',
357
+ ],
358
+ [
359
  'name' => 'job_manager_job_dashboard_page_id',
360
  'std' => '',
361
  'label' => __( 'Job Dashboard Page', 'wp-job-manager' ),
362
  'desc' => __( 'Select the page where you\'ve used the [job_dashboard] shortcode. This lets the plugin know the location of the dashboard.', 'wp-job-manager' ),
363
  'type' => 'page',
364
+ ],
365
+ [
366
  'name' => 'job_manager_jobs_page_id',
367
  'std' => '',
368
  'label' => __( 'Job Listings Page', 'wp-job-manager' ),
369
  'desc' => __( 'Select the page where you\'ve used the [jobs] shortcode. This lets the plugin know the location of the job listings page.', 'wp-job-manager' ),
370
  'type' => 'page',
371
+ ],
372
+ ],
373
+ ],
374
+ ]
375
  );
376
  }
377
 
418
  }
419
 
420
  foreach ( $this->settings as $key => $section ) {
421
+ $section_args = isset( $section[2] ) ? (array) $section[2] : [];
422
  echo '<div id="settings-' . esc_attr( sanitize_title( $key ) ) . '" class="settings_panel">';
423
  if ( ! empty( $section_args['before'] ) ) {
424
  echo '<p class="before-settings">' . wp_kses_post( $section_args['before'] ) . '</p>';
487
  }
488
  }).change();
489
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
490
  jQuery( '.sub-settings-expander' ).on( 'change', function() {
491
  var $expandable = jQuery(this).parent().siblings( '.sub-settings-expandable' );
492
  var checked = jQuery(this).is( ':checked' );
625
  * @param string $ignored_placeholder
626
  */
627
  protected function input_page( $option, $ignored_attributes, $value, $ignored_placeholder ) {
628
+ $args = [
629
  'name' => $option['name'],
630
  'id' => $option['name'],
631
  'sort_column' => 'menu_order',
633
  'show_option_none' => __( '--no page--', 'wp-job-manager' ),
634
  'echo' => false,
635
  'selected' => absint( $value ),
636
+ ];
637
 
638
  // phpcs:ignore WordPress.Security.EscapeOutput.OutputNotEscaped -- Safe output.
639
  echo str_replace( ' id=', " data-placeholder='" . esc_attr__( 'Select a page&hellip;', 'wp-job-manager' ) . "' id=", wp_dropdown_pages( $args ) );
768
  $placeholder = ( ! empty( $option['placeholder'] ) ) ? 'placeholder="' . esc_attr( $option['placeholder'] ) . '"' : '';
769
  $class = ! empty( $option['class'] ) ? $option['class'] : '';
770
  $option['type'] = ! empty( $option['type'] ) ? $option['type'] : 'text';
771
+ $attributes = [];
772
  if ( ! empty( $option['attributes'] ) && is_array( $option['attributes'] ) ) {
773
  foreach ( $option['attributes'] as $attribute_name => $attribute_value ) {
774
  $attributes[] = esc_attr( $attribute_name ) . '="' . esc_attr( $attribute_value ) . '"';
815
  $enable_option = $option['enable_field'];
816
  $enable_option['name'] = $option['name'] . '[' . $enable_option['name'] . ']';
817
  $enable_option['type'] = 'checkbox';
818
+ $enable_option['attributes'] = [ 'class="sub-settings-expander"' ];
819
  $this->input_checkbox( $enable_option, $enable_option['attributes'], $values[ $option['enable_field']['name'] ], null );
820
 
821
  echo '<div class="sub-settings-expandable">';
includes/admin/class-wp-job-manager-setup.php CHANGED
@@ -42,12 +42,12 @@ class WP_Job_Manager_Setup {
42
  * Constructor.
43
  */
44
  public function __construct() {
45
- add_action( 'admin_menu', array( $this, 'admin_menu' ), 12 );
46
- add_action( 'admin_head', array( $this, 'admin_head' ) );
47
 
48
  // phpcs:ignore WordPress.Security.NonceVerification.Recommended -- Input is used safely.
49
  if ( isset( $_GET['page'] ) && 'job-manager-setup' === $_GET['page'] ) {
50
- add_action( 'admin_enqueue_scripts', array( $this, 'admin_enqueue_scripts' ), 12 );
51
  }
52
  }
53
 
@@ -55,7 +55,7 @@ class WP_Job_Manager_Setup {
55
  * Adds setup link to admin dashboard menu briefly so the page callback is registered.
56
  */
57
  public function admin_menu() {
58
- add_dashboard_page( __( 'Setup', 'wp-job-manager' ), __( 'Setup', 'wp-job-manager' ), 'manage_options', 'job-manager-setup', array( $this, 'setup_page' ) );
59
  }
60
 
61
  /**
@@ -69,7 +69,7 @@ class WP_Job_Manager_Setup {
69
  * Enqueues scripts for setup page.
70
  */
71
  public function admin_enqueue_scripts() {
72
- wp_enqueue_style( 'job_manager_setup_css', JOB_MANAGER_PLUGIN_URL . '/assets/css/setup.css', array( 'dashicons' ), JOB_MANAGER_VERSION );
73
  }
74
 
75
  /**
@@ -80,7 +80,7 @@ class WP_Job_Manager_Setup {
80
  * @param string $option
81
  */
82
  public function create_page( $title, $content, $option ) {
83
- $page_data = array(
84
  'post_status' => 'publish',
85
  'post_type' => 'page',
86
  'post_author' => 1,
@@ -89,7 +89,7 @@ class WP_Job_Manager_Setup {
89
  'post_content' => $content,
90
  'post_parent' => 0,
91
  'comment_status' => 'closed',
92
- );
93
  $page_id = wp_insert_post( $page_data );
94
 
95
  if ( $option ) {
@@ -125,13 +125,13 @@ class WP_Job_Manager_Setup {
125
  ) {
126
  wp_die( 'Error in nonce. Try again.', 'wp-job-manager' );
127
  }
128
- $create_pages = isset( $_POST['wp-job-manager-create-page'] ) ? array_map( 'sanitize_text_field', wp_unslash( $_POST['wp-job-manager-create-page'] ) ) : array();
129
- $page_titles = isset( $_POST['wp-job-manager-page-title'] ) ? array_map( 'sanitize_title', wp_unslash( $_POST['wp-job-manager-page-title'] ) ) : array();
130
- $pages_to_create = array(
131
  'submit_job_form' => '[submit_job_form]',
132
  'job_dashboard' => '[job_dashboard]',
133
  'jobs' => '[jobs]',
134
- );
135
 
136
  foreach ( $pages_to_create as $page => $content ) {
137
  if ( ! isset( $create_pages[ $page ] ) || empty( $page_titles[ $page ] ) ) {
42
  * Constructor.
43
  */
44
  public function __construct() {
45
+ add_action( 'admin_menu', [ $this, 'admin_menu' ], 12 );
46
+ add_action( 'admin_head', [ $this, 'admin_head' ] );
47
 
48
  // phpcs:ignore WordPress.Security.NonceVerification.Recommended -- Input is used safely.
49
  if ( isset( $_GET['page'] ) && 'job-manager-setup' === $_GET['page'] ) {
50
+ add_action( 'admin_enqueue_scripts', [ $this, 'admin_enqueue_scripts' ], 12 );
51
  }
52
  }
53
 
55
  * Adds setup link to admin dashboard menu briefly so the page callback is registered.
56
  */
57
  public function admin_menu() {
58
+ add_dashboard_page( __( 'Setup', 'wp-job-manager' ), __( 'Setup', 'wp-job-manager' ), 'manage_options', 'job-manager-setup', [ $this, 'setup_page' ] );
59
  }
60
 
61
  /**
69
  * Enqueues scripts for setup page.
70
  */
71
  public function admin_enqueue_scripts() {
72
+ wp_enqueue_style( 'job_manager_setup_css', JOB_MANAGER_PLUGIN_URL . '/assets/css/setup.css', [ 'dashicons' ], JOB_MANAGER_VERSION );
73
  }
74
 
75
  /**
80
  * @param string $option
81
  */
82
  public function create_page( $title, $content, $option ) {
83
+ $page_data = [
84
  'post_status' => 'publish',
85
  'post_type' => 'page',
86
  'post_author' => 1,
89
  'post_content' => $content,
90
  'post_parent' => 0,
91
  'comment_status' => 'closed',
92
+ ];
93
  $page_id = wp_insert_post( $page_data );
94
 
95
  if ( $option ) {
125
  ) {
126
  wp_die( 'Error in nonce. Try again.', 'wp-job-manager' );
127
  }
128
+ $create_pages = isset( $_POST['wp-job-manager-create-page'] ) ? array_map( 'sanitize_text_field', wp_unslash( $_POST['wp-job-manager-create-page'] ) ) : [];
129
+ $page_titles = isset( $_POST['wp-job-manager-page-title'] ) ? array_map( 'sanitize_text_field', wp_unslash( $_POST['wp-job-manager-page-title'] ) ) : [];
130
+ $pages_to_create = [
131
  'submit_job_form' => '[submit_job_form]',
132
  'job_dashboard' => '[job_dashboard]',
133
  'jobs' => '[jobs]',
134
+ ];
135
 
136
  foreach ( $pages_to_create as $page => $content ) {
137
  if ( ! isset( $create_pages[ $page ] ) || empty( $page_titles[ $page ] ) ) {
includes/admin/class-wp-job-manager-taxonomy-meta.php CHANGED
@@ -42,13 +42,13 @@ class WP_Job_Manager_Taxonomy_Meta {
42
  */
43
  public function __construct() {
44
  if ( wpjm_job_listing_employment_type_enabled() ) {
45
- add_action( 'job_listing_type_edit_form_fields', array( $this, 'display_schema_org_employment_type_field' ), 10, 2 );
46
- add_action( 'job_listing_type_add_form_fields', array( $this, 'add_form_display_schema_org_employment_type_field' ), 10 );
47
- add_action( 'edited_job_listing_type', array( $this, 'set_schema_org_employment_type_field' ), 10, 2 );
48
- add_action( 'created_job_listing_type', array( $this, 'set_schema_org_employment_type_field' ), 10, 2 );
49
- add_filter( 'manage_edit-job_listing_type_columns', array( $this, 'add_employment_type_column' ) );
50
- add_filter( 'manage_job_listing_type_custom_column', array( $this, 'add_employment_type_column_content' ), 10, 3 );
51
- add_filter( 'manage_edit-job_listing_type_sortable_columns', array( $this, 'add_employment_type_column_sortable' ) );
52
  }
53
  }
54
 
42
  */
43
  public function __construct() {
44
  if ( wpjm_job_listing_employment_type_enabled() ) {
45
+ add_action( 'job_listing_type_edit_form_fields', [ $this, 'display_schema_org_employment_type_field' ], 10, 2 );
46
+ add_action( 'job_listing_type_add_form_fields', [ $this, 'add_form_display_schema_org_employment_type_field' ], 10 );
47
+ add_action( 'edited_job_listing_type', [ $this, 'set_schema_org_employment_type_field' ], 10, 2 );
48
+ add_action( 'created_job_listing_type', [ $this, 'set_schema_org_employment_type_field' ], 10, 2 );
49
+ add_filter( 'manage_edit-job_listing_type_columns', [ $this, 'add_employment_type_column' ] );
50
+ add_filter( 'manage_job_listing_type_custom_column', [ $this, 'add_employment_type_column_content' ], 10, 3 );
51
+ add_filter( 'manage_edit-job_listing_type_sortable_columns', [ $this, 'add_employment_type_column_sortable' ] );
52
  }
53
  }
54
 
includes/admin/class-wp-job-manager-writepanels.php CHANGED
@@ -42,9 +42,9 @@ class WP_Job_Manager_Writepanels {
42
  * Constructor.
43
  */
44
  public function __construct() {
45
- add_action( 'add_meta_boxes', array( $this, 'add_meta_boxes' ) );
46
- add_action( 'save_post', array( $this, 'save_post' ), 1, 2 );
47
- add_action( 'job_manager_save_job_listing', array( $this, 'save_job_listing_data' ), 20, 2 );
48
  }
49
 
50
  /**
@@ -57,14 +57,14 @@ class WP_Job_Manager_Writepanels {
57
 
58
  $current_user = wp_get_current_user();
59
  $fields_raw = WP_Job_Manager_Post_Types::get_job_listing_fields();
60
- $fields = array();
61
 
62
  if ( $current_user->has_cap( 'edit_others_job_listings' ) ) {
63
- $fields['_job_author'] = array(
64
  'label' => __( 'Posted by', 'wp-job-manager' ),
65
  'type' => 'author',
66
  'priority' => 0,
67
- );
68
  }
69
 
70
  foreach ( $fields_raw as $meta_key => $field ) {
@@ -120,7 +120,7 @@ class WP_Job_Manager_Writepanels {
120
  */
121
  $fields = apply_filters( 'job_manager_job_listing_wp_admin_fields', $fields, $post_id );
122
 
123
- uasort( $fields, array( __CLASS__, 'sort_by_priority' ) );
124
 
125
  return $fields;
126
  }
@@ -147,13 +147,13 @@ class WP_Job_Manager_Writepanels {
147
  global $wp_post_types;
148
 
149
  // translators: Placeholder %s is the singular name for a job listing post type.
150
- add_meta_box( 'job_listing_data', sprintf( __( '%s Data', 'wp-job-manager' ), $wp_post_types['job_listing']->labels->singular_name ), array( $this, 'job_listing_data' ), 'job_listing', 'normal', 'high' );
151
  if ( ! get_option( 'job_manager_enable_types' ) || 0 === intval( wp_count_terms( 'job_listing_type' ) ) ) {
152
  remove_meta_box( 'job_listing_typediv', 'job_listing', 'side' );
153
  } elseif ( false === job_manager_multi_job_type() ) {
154
  remove_meta_box( 'job_listing_typediv', 'job_listing', 'side' );
155
  $job_listing_type = get_taxonomy( 'job_listing_type' );
156
- add_meta_box( 'job_listing_type', $job_listing_type->labels->menu_name, array( $this, 'job_type_single_meta_box' ), 'job_listing', 'side', 'core' );
157
  }
158
  }
159
 
@@ -168,10 +168,10 @@ class WP_Job_Manager_Writepanels {
168
 
169
  // Get all the terms for this taxonomy.
170
  $terms = get_terms(
171
- array(
172
  'taxonomy' => $taxonomy_name,
173
  'hide_empty' => 0,
174
- )
175
  );
176
  $postterms = get_the_terms( $post->ID, $taxonomy_name );
177
  $current = $postterms ? array_pop( $postterms ) : false;
@@ -255,7 +255,7 @@ class WP_Job_Manager_Writepanels {
255
  $name = $key;
256
  }
257
  if ( ! empty( $field['classes'] ) ) {
258
- $classes = implode( ' ', is_array( $field['classes'] ) ? $field['classes'] : array( $field['classes'] ) );
259
  } else {
260
  $classes = '';
261
  }
@@ -298,7 +298,7 @@ class WP_Job_Manager_Writepanels {
298
  $name = $key;
299
  }
300
  if ( ! empty( $field['classes'] ) ) {
301
- $classes = implode( ' ', is_array( $field['classes'] ) ? $field['classes'] : array( $field['classes'] ) );
302
  } else {
303
  $classes = '';
304
  }
@@ -316,7 +316,7 @@ class WP_Job_Manager_Writepanels {
316
  <?php endif; ?>
317
  </label>
318
  <?php if ( ! empty( $field['information'] ) ) : ?>
319
- <span class="information"><?php echo wp_kses( $field['information'], array( 'a' => array( 'href' => array() ) ) ); ?></span>
320
  <?php endif; ?>
321
  <?php echo '<input type="hidden" name="' . esc_attr( $name ) . '" class="' . esc_attr( $classes ) . '" id="' . esc_attr( $key ) . '" value="' . esc_attr( $field['value'] ) . '" />'; ?>
322
  </p>
@@ -545,7 +545,7 @@ class WP_Job_Manager_Writepanels {
545
  if ( has_action( 'job_manager_input_' . $type ) ) {
546
  do_action( 'job_manager_input_' . $type, $key, $field );
547
  } elseif ( method_exists( $this, 'input_' . $type ) ) {
548
- call_user_func( array( $this, 'input_' . $type ), $key, $field );
549
  }
550
  }
551
 
@@ -604,6 +604,8 @@ class WP_Job_Manager_Writepanels {
604
  * @param WP_Post $post (Unused).
605
  */
606
  public function save_job_listing_data( $post_id, $post ) {
 
 
607
  // These need to exist.
608
  add_post_meta( $post_id, '_filled', 0, true );
609
  add_post_meta( $post_id, '_featured', 0, true );
@@ -642,13 +644,12 @@ class WP_Job_Manager_Writepanels {
642
  if ( empty( $_POST[ $key ] ) ) {
643
  $_POST[ $key ] = 0;
644
  }
645
- $job_data = array();
646
- $job_data['ID'] = $post_id;
647
- $job_data['post_author'] = $_POST[ $key ] > 0 ? intval( $_POST[ $key ] ) : 0; // phpcs:ignore WordPress.Security.NonceVerification.Missing -- Nonce check handled by WP core.
648
 
649
- remove_action( 'job_manager_save_job_listing', array( $this, 'save_job_listing_data' ), 20 );
650
- wp_update_post( $job_data );
651
- add_action( 'job_manager_save_job_listing', array( $this, 'save_job_listing_data' ), 20, 2 );
 
 
652
  } elseif ( isset( $_POST[ $key ] ) ) { // phpcs:ignore WordPress.Security.NonceVerification.Missing -- Nonce check handled by WP core.
653
  // phpcs:ignore WordPress.Security.ValidatedSanitizedInput.InputNotSanitized, WordPress.Security.NonceVerification.Missing -- Input sanitized in registered post meta config; see WP_Job_Manager_Post_Types::register_meta_fields() and WP_Job_Manager_Post_Types::get_job_listing_fields() methods.
654
  update_post_meta( $post_id, $key, wp_unslash( $_POST[ $key ] ) );
@@ -660,17 +661,17 @@ class WP_Job_Manager_Writepanels {
660
  $today_date = date( 'Y-m-d', current_time( 'timestamp' ) );
661
  $is_job_listing_expired = $expiry_date && $today_date > $expiry_date;
662
  if ( $is_job_listing_expired && ! $this->is_job_listing_status_changing( null, 'draft' ) ) {
663
- remove_action( 'job_manager_save_job_listing', array( $this, 'save_job_listing_data' ), 20 );
664
  if ( $this->is_job_listing_status_changing( 'expired', 'publish' ) ) {
665
  update_post_meta( $post_id, '_job_expires', calculate_job_expiry( $post_id ) );
666
  } else {
667
- $job_data = array(
668
  'ID' => $post_id,
669
  'post_status' => 'expired',
670
- );
671
  wp_update_post( $job_data );
672
  }
673
- add_action( 'job_manager_save_job_listing', array( $this, 'save_job_listing_data' ), 20, 2 );
674
  }
675
  }
676
 
42
  * Constructor.
43
  */
44
  public function __construct() {
45
+ add_action( 'add_meta_boxes', [ $this, 'add_meta_boxes' ] );
46
+ add_action( 'save_post', [ $this, 'save_post' ], 1, 2 );
47
+ add_action( 'job_manager_save_job_listing', [ $this, 'save_job_listing_data' ], 20, 2 );
48
  }
49
 
50
  /**
57
 
58
  $current_user = wp_get_current_user();
59
  $fields_raw = WP_Job_Manager_Post_Types::get_job_listing_fields();
60
+ $fields = [];
61
 
62
  if ( $current_user->has_cap( 'edit_others_job_listings' ) ) {
63
+ $fields['_job_author'] = [
64
  'label' => __( 'Posted by', 'wp-job-manager' ),
65
  'type' => 'author',
66
  'priority' => 0,
67
+ ];
68
  }
69
 
70
  foreach ( $fields_raw as $meta_key => $field ) {
120
  */
121
  $fields = apply_filters( 'job_manager_job_listing_wp_admin_fields', $fields, $post_id );
122
 
123
+ uasort( $fields, [ __CLASS__, 'sort_by_priority' ] );
124
 
125
  return $fields;
126
  }
147
  global $wp_post_types;
148
 
149
  // translators: Placeholder %s is the singular name for a job listing post type.
150
+ add_meta_box( 'job_listing_data', sprintf( __( '%s Data', 'wp-job-manager' ), $wp_post_types['job_listing']->labels->singular_name ), [ $this, 'job_listing_data' ], 'job_listing', 'normal', 'high' );
151
  if ( ! get_option( 'job_manager_enable_types' ) || 0 === intval( wp_count_terms( 'job_listing_type' ) ) ) {
152
  remove_meta_box( 'job_listing_typediv', 'job_listing', 'side' );
153
  } elseif ( false === job_manager_multi_job_type() ) {
154
  remove_meta_box( 'job_listing_typediv', 'job_listing', 'side' );
155
  $job_listing_type = get_taxonomy( 'job_listing_type' );
156
+ add_meta_box( 'job_listing_type', $job_listing_type->labels->menu_name, [ $this, 'job_type_single_meta_box' ], 'job_listing', 'side', 'core' );
157
  }
158
  }
159
 
168
 
169
  // Get all the terms for this taxonomy.
170
  $terms = get_terms(
171
+ [
172
  'taxonomy' => $taxonomy_name,
173
  'hide_empty' => 0,
174
+ ]
175
  );
176
  $postterms = get_the_terms( $post->ID, $taxonomy_name );
177
  $current = $postterms ? array_pop( $postterms ) : false;
255
  $name = $key;
256
  }
257
  if ( ! empty( $field['classes'] ) ) {
258
+ $classes = implode( ' ', is_array( $field['classes'] ) ? $field['classes'] : [ $field['classes'] ] );
259
  } else {
260
  $classes = '';
261
  }
298
  $name = $key;
299
  }
300
  if ( ! empty( $field['classes'] ) ) {
301
+ $classes = implode( ' ', is_array( $field['classes'] ) ? $field['classes'] : [ $field['classes'] ] );
302
  } else {
303
  $classes = '';
304
  }
316
  <?php endif; ?>
317
  </label>
318
  <?php if ( ! empty( $field['information'] ) ) : ?>
319
+ <span class="information"><?php echo wp_kses( $field['information'], [ 'a' => [ 'href' => [] ] ] ); ?></span>
320
  <?php endif; ?>
321
  <?php echo '<input type="hidden" name="' . esc_attr( $name ) . '" class="' . esc_attr( $classes ) . '" id="' . esc_attr( $key ) . '" value="' . esc_attr( $field['value'] ) . '" />'; ?>
322
  </p>
545
  if ( has_action( 'job_manager_input_' . $type ) ) {
546
  do_action( 'job_manager_input_' . $type, $key, $field );
547
  } elseif ( method_exists( $this, 'input_' . $type ) ) {
548
+ call_user_func( [ $this, 'input_' . $type ], $key, $field );
549
  }
550
  }
551
 
604
  * @param WP_Post $post (Unused).
605
  */
606
  public function save_job_listing_data( $post_id, $post ) {
607
+ global $wpdb;
608
+
609
  // These need to exist.
610
  add_post_meta( $post_id, '_filled', 0, true );
611
  add_post_meta( $post_id, '_featured', 0, true );
644
  if ( empty( $_POST[ $key ] ) ) {
645
  $_POST[ $key ] = 0;
646
  }
 
 
 
647
 
648
+ // phpcs:ignore WordPress.Security.NonceVerification.Missing -- Nonce check handled by WP core.
649
+ $input_post_author = $_POST[ $key ] > 0 ? intval( $_POST[ $key ] ) : 0;
650
+
651
+ // phpcs:ignore WordPress.DB.DirectDatabaseQuery.DirectQuery, WordPress.DB.DirectDatabaseQuery.NoCaching -- Avoid update post within `save_post` action.
652
+ $wpdb->update( $wpdb->posts, [ 'post_author' => $input_post_author ], [ 'ID' => $post_id ] );
653
  } elseif ( isset( $_POST[ $key ] ) ) { // phpcs:ignore WordPress.Security.NonceVerification.Missing -- Nonce check handled by WP core.
654
  // phpcs:ignore WordPress.Security.ValidatedSanitizedInput.InputNotSanitized, WordPress.Security.NonceVerification.Missing -- Input sanitized in registered post meta config; see WP_Job_Manager_Post_Types::register_meta_fields() and WP_Job_Manager_Post_Types::get_job_listing_fields() methods.
655
  update_post_meta( $post_id, $key, wp_unslash( $_POST[ $key ] ) );
661
  $today_date = date( 'Y-m-d', current_time( 'timestamp' ) );
662
  $is_job_listing_expired = $expiry_date && $today_date > $expiry_date;
663
  if ( $is_job_listing_expired && ! $this->is_job_listing_status_changing( null, 'draft' ) ) {
664
+ remove_action( 'job_manager_save_job_listing', [ $this, 'save_job_listing_data' ], 20 );
665
  if ( $this->is_job_listing_status_changing( 'expired', 'publish' ) ) {
666
  update_post_meta( $post_id, '_job_expires', calculate_job_expiry( $post_id ) );
667
  } else {
668
+ $job_data = [
669
  'ID' => $post_id,
670
  'post_status' => 'expired',
671
+ ];
672
  wp_update_post( $job_data );
673
  }
674
+ add_action( 'job_manager_save_job_listing', [ $this, 'save_job_listing_data' ], 20, 2 );
675
  }
676
  }
677
 
includes/admin/views/html-admin-page-addons.php CHANGED
@@ -17,11 +17,11 @@ if ( ! empty( $messages ) ) {
17
  }
18
  $message_type = 'info';
19
  if ( isset( $message->type )
20
- && in_array( $message->type, array( 'info', 'success', 'warning', 'error' ), true ) ) {
21
  $message_type = $message->type;
22
  }
23
  $action_label = isset( $message->action_label ) ? esc_attr( $message->action_label ) : __( 'More Information &rarr;', 'wp-job-manager' );
24
- $action_url = isset( $message->action_url ) ? esc_url( $message->action_url, array( 'http', 'https' ) ) : false;
25
  $action_target = isset( $message->action_target ) && 'self' === $message->action_target ? '_self' : '_blank';
26
  $action_str = '';
27
  if ( $action_url ) {
@@ -56,17 +56,17 @@ if ( empty( $add_ons ) ) {
56
  echo '<ul class="products">';
57
  foreach ( $add_ons as $add_on ) {
58
  $url = add_query_arg(
59
- array(
60
  'utm_source' => 'product',
61
  'utm_medium' => 'addonpage',
62
  'utm_campaign' => 'wpjmplugin',
63
  'utm_content' => 'listing',
64
- ),
65
  $add_on->link
66
  );
67
  ?>
68
  <li class="product">
69
- <a href="<?php echo esc_url( $url, array( 'http', 'https' ) ); ?>">
70
  <?php if ( ! empty( $add_on->image ) ) : ?>
71
  <img src="<?php echo esc_url( $add_on->image ); ?>" />
72
  <?php endif; ?>
17
  }
18
  $message_type = 'info';
19
  if ( isset( $message->type )
20
+ && in_array( $message->type, [ 'info', 'success', 'warning', 'error' ], true ) ) {
21
  $message_type = $message->type;
22
  }
23
  $action_label = isset( $message->action_label ) ? esc_attr( $message->action_label ) : __( 'More Information &rarr;', 'wp-job-manager' );
24
+ $action_url = isset( $message->action_url ) ? esc_url( $message->action_url, [ 'http', 'https' ] ) : false;
25
  $action_target = isset( $message->action_target ) && 'self' === $message->action_target ? '_self' : '_blank';
26
  $action_str = '';
27
  if ( $action_url ) {
56
  echo '<ul class="products">';
57
  foreach ( $add_ons as $add_on ) {
58
  $url = add_query_arg(
59
+ [
60
  'utm_source' => 'product',
61
  'utm_medium' => 'addonpage',
62
  'utm_campaign' => 'wpjmplugin',
63
  'utm_content' => 'listing',
64
+ ],
65
  $add_on->link
66
  );
67
  ?>
68
  <li class="product">
69
+ <a href="<?php echo esc_url( $url, [ 'http', 'https' ] ); ?>">
70
  <?php if ( ! empty( $add_on->image ) ) : ?>
71
  <img src="<?php echo esc_url( $add_on->image ); ?>" />
72
  <?php endif; ?>
includes/class-wp-job-manager-ajax.php CHANGED
@@ -42,19 +42,19 @@ class WP_Job_Manager_Ajax {
42
  * Constructor.
43
  */
44
  public function __construct() {
45
- add_action( 'init', array( __CLASS__, 'add_endpoint' ) );
46
- add_action( 'template_redirect', array( __CLASS__, 'do_jm_ajax' ), 0 );
47
 
48
  // JM Ajax endpoints.
49
- add_action( 'job_manager_ajax_get_listings', array( $this, 'get_listings' ) );
50
- add_action( 'job_manager_ajax_upload_file', array( $this, 'upload_file' ) );
51
 
52
  // BW compatible handlers.
53
- add_action( 'wp_ajax_nopriv_job_manager_get_listings', array( $this, 'get_listings' ) );
54
- add_action( 'wp_ajax_job_manager_get_listings', array( $this, 'get_listings' ) );
55
- add_action( 'wp_ajax_nopriv_job_manager_upload_file', array( $this, 'upload_file' ) );
56
- add_action( 'wp_ajax_job_manager_upload_file', array( $this, 'upload_file' ) );
57
- add_action( 'wp_ajax_job_manager_search_users', array( $this, 'ajax_search_users' ) );
58
  }
59
 
60
  /**
@@ -138,23 +138,23 @@ class WP_Job_Manager_Ajax {
138
  if ( is_array( $search_categories ) ) {
139
  $search_categories = array_filter( array_map( 'sanitize_text_field', array_map( 'stripslashes', $search_categories ) ) );
140
  } else {
141
- $search_categories = array_filter( array( sanitize_text_field( wp_unslash( $search_categories ) ) ) );
142
  }
143
 
144
  $types = get_job_listing_types();
145
  $job_types_filtered = ! is_null( $filter_job_types ) && count( $types ) !== count( $filter_job_types );
146
 
147
- $args = array(
148
  'search_location' => $search_location,
149
  'search_keywords' => $search_keywords,
150
  'search_categories' => $search_categories,
151
- 'job_types' => is_null( $filter_job_types ) || count( $types ) === count( $filter_job_types ) ? '' : $filter_job_types + array( 0 ),
152
  'post_status' => $filter_post_status,
153
  'orderby' => $orderby,
154
  'order' => $order,
155
  'offset' => ( $page - 1 ) * $per_page,
156
  'posts_per_page' => max( 1, $per_page ),
157
- );
158
 
159
  if ( 'true' === $filled || 'false' === $filled ) {
160
  $args['filled'] = 'true' === $filled;
@@ -174,11 +174,11 @@ class WP_Job_Manager_Ajax {
174
  */
175
  $jobs = get_job_listings( apply_filters( 'job_manager_get_listings_args', $args ) );
176
 
177
- $result = array(
178
  'found_jobs' => $jobs->have_posts(),
179
  'showing' => '',
180
  'max_num_pages' => $jobs->max_num_pages,
181
- );
182
 
183
  if ( $jobs->post_count && ( $search_location || $search_keywords || $search_categories || $job_types_filtered ) ) {
184
  // translators: Placeholder %d is the number of found search results.
@@ -188,11 +188,11 @@ class WP_Job_Manager_Ajax {
188
  $message = '';
189
  }
190
 
191
- $search_values = array(
192
  'location' => $search_location,
193
  'keywords' => $search_keywords,
194
  'categories' => $search_categories,
195
- );
196
 
197
  /**
198
  * Filter the message that describes the results of the search query.
@@ -212,12 +212,12 @@ class WP_Job_Manager_Ajax {
212
 
213
  // Generate RSS link.
214
  $result['showing_links'] = job_manager_get_filtered_links(
215
- array(
216
  'filter_job_types' => $filter_job_types,
217
  'search_location' => $search_location,
218
  'search_categories' => $search_categories,
219
  'search_keywords' => $search_keywords,
220
- )
221
  );
222
 
223
  /**
@@ -283,9 +283,9 @@ class WP_Job_Manager_Ajax {
283
  wp_send_json_error( __( 'You must be logged in to upload files using this method.', 'wp-job-manager' ) );
284
  return;
285
  }
286
- $data = array(
287
- 'files' => array(),
288
- );
289
 
290
  if ( ! empty( $_FILES ) ) {
291
  foreach ( $_FILES as $file_key => $file ) {
@@ -293,15 +293,15 @@ class WP_Job_Manager_Ajax {
293
  foreach ( $files_to_upload as $file_to_upload ) {
294
  $uploaded_file = job_manager_upload_file(
295
  $file_to_upload,
296
- array(
297
  'file_key' => $file_key,
298
- )
299
  );
300
 
301
  if ( is_wp_error( $uploaded_file ) ) {
302
- $data['files'][] = array(
303
  'error' => $uploaded_file->get_error_message(),
304
- );
305
  } else {
306
  $data['files'][] = $uploaded_file;
307
  }
@@ -327,7 +327,7 @@ class WP_Job_Manager_Ajax {
327
  *
328
  * @param array $user_caps Array of capabilities/roles that are allowed to search for users.
329
  */
330
- $allowed_capabilities = apply_filters( 'job_manager_caps_can_search_users', array( 'edit_job_listings' ) );
331
  foreach ( $allowed_capabilities as $cap ) {
332
  if ( current_user_can( $cap ) ) {
333
  $user_can_search_users = true;
@@ -359,7 +359,7 @@ class WP_Job_Manager_Ajax {
359
  $page = isset( $_GET['page'] ) ? intval( $_GET['page'] ) : 1;
360
  $per_page = 20;
361
 
362
- $exclude = array();
363
  if ( ! empty( $_GET['exclude'] ) ) {
364
  $exclude = array_map( 'intval', $_GET['exclude'] );
365
  }
@@ -369,7 +369,7 @@ class WP_Job_Manager_Ajax {
369
  }
370
 
371
  $more_exist = false;
372
- $users = array();
373
 
374
  // Search by ID.
375
  if ( is_numeric( $term ) && ! in_array( intval( $term ), $exclude, true ) ) {
@@ -380,15 +380,15 @@ class WP_Job_Manager_Ajax {
380
  }
381
 
382
  if ( empty( $users ) ) {
383
- $search_args = array(
384
  'exclude' => $exclude,
385
  'search' => '*' . esc_attr( $term ) . '*',
386
- 'search_columns' => array( 'user_login', 'user_email', 'user_nicename', 'display_name' ),
387
  'number' => $per_page,
388
  'paged' => $page,
389
  'orderby' => 'display_name',
390
  'order' => 'ASC',
391
- );
392
 
393
  /**
394
  * Modify the arguments used for `WP_User_Query` constructor.
@@ -410,7 +410,7 @@ class WP_Job_Manager_Ajax {
410
  $more_exist = $total_pages > $page;
411
  }
412
 
413
- $found_users = array();
414
 
415
  foreach ( $users as $user ) {
416
  $found_users[ $user->ID ] = sprintf(
@@ -422,10 +422,10 @@ class WP_Job_Manager_Ajax {
422
  );
423
  }
424
 
425
- $response = array(
426
  'results' => $found_users,
427
  'more' => $more_exist,
428
- );
429
 
430
  /**
431
  * Modify the search results response for users in ajax call.
42
  * Constructor.
43
  */
44
  public function __construct() {
45
+ add_action( 'init', [ __CLASS__, 'add_endpoint' ] );
46
+ add_action( 'template_redirect', [ __CLASS__, 'do_jm_ajax' ], 0 );
47
 
48
  // JM Ajax endpoints.
49
+ add_action( 'job_manager_ajax_get_listings', [ $this, 'get_listings' ] );
50
+ add_action( 'job_manager_ajax_upload_file', [ $this, 'upload_file' ] );
51
 
52
  // BW compatible handlers.
53
+ add_action( 'wp_ajax_nopriv_job_manager_get_listings', [ $this, 'get_listings' ] );
54
+ add_action( 'wp_ajax_job_manager_get_listings', [ $this, 'get_listings' ] );
55
+ add_action( 'wp_ajax_nopriv_job_manager_upload_file', [ $this, 'upload_file' ] );
56
+ add_action( 'wp_ajax_job_manager_upload_file', [ $this, 'upload_file' ] );
57
+ add_action( 'wp_ajax_job_manager_search_users', [ $this, 'ajax_search_users' ] );
58
  }
59
 
60
  /**
138
  if ( is_array( $search_categories ) ) {
139
  $search_categories = array_filter( array_map( 'sanitize_text_field', array_map( 'stripslashes', $search_categories ) ) );
140
  } else {
141
+ $search_categories = array_filter( [ sanitize_text_field( wp_unslash( $search_categories ) ) ] );
142
  }
143
 
144
  $types = get_job_listing_types();
145
  $job_types_filtered = ! is_null( $filter_job_types ) && count( $types ) !== count( $filter_job_types );
146
 
147
+ $args = [
148
  'search_location' => $search_location,
149
  'search_keywords' => $search_keywords,
150
  'search_categories' => $search_categories,
151
+ 'job_types' => is_null( $filter_job_types ) || count( $types ) === count( $filter_job_types ) ? '' : $filter_job_types + [ 0 ],
152
  'post_status' => $filter_post_status,
153
  'orderby' => $orderby,
154
  'order' => $order,
155
  'offset' => ( $page - 1 ) * $per_page,
156
  'posts_per_page' => max( 1, $per_page ),
157
+ ];
158
 
159
  if ( 'true' === $filled || 'false' === $filled ) {
160
  $args['filled'] = 'true' === $filled;
174
  */
175
  $jobs = get_job_listings( apply_filters( 'job_manager_get_listings_args', $args ) );
176
 
177
+ $result = [
178
  'found_jobs' => $jobs->have_posts(),
179
  'showing' => '',
180
  'max_num_pages' => $jobs->max_num_pages,
181
+ ];
182
 
183
  if ( $jobs->post_count && ( $search_location || $search_keywords || $search_categories || $job_types_filtered ) ) {
184
  // translators: Placeholder %d is the number of found search results.
188
  $message = '';
189
  }
190
 
191
+ $search_values = [
192
  'location' => $search_location,
193
  'keywords' => $search_keywords,
194
  'categories' => $search_categories,
195
+ ];
196
 
197
  /**
198
  * Filter the message that describes the results of the search query.
212
 
213
  // Generate RSS link.
214
  $result['showing_links'] = job_manager_get_filtered_links(
215
+ [
216
  'filter_job_types' => $filter_job_types,
217
  'search_location' => $search_location,
218
  'search_categories' => $search_categories,
219
  'search_keywords' => $search_keywords,
220
+ ]
221
  );
222
 
223
  /**
283
  wp_send_json_error( __( 'You must be logged in to upload files using this method.', 'wp-job-manager' ) );
284
  return;
285
  }
286
+ $data = [
287
+ 'files' => [],
288
+ ];
289
 
290
  if ( ! empty( $_FILES ) ) {
291
  foreach ( $_FILES as $file_key => $file ) {
293
  foreach ( $files_to_upload as $file_to_upload ) {
294
  $uploaded_file = job_manager_upload_file(
295
  $file_to_upload,
296
+ [
297
  'file_key' => $file_key,
298
+ ]
299
  );
300
 
301
  if ( is_wp_error( $uploaded_file ) ) {
302
+ $data['files'][] = [
303
  'error' => $uploaded_file->get_error_message(),
304
+ ];
305
  } else {
306
  $data['files'][] = $uploaded_file;
307
  }
327
  *
328
  * @param array $user_caps Array of capabilities/roles that are allowed to search for users.
329
  */
330
+ $allowed_capabilities = apply_filters( 'job_manager_caps_can_search_users', [ 'edit_job_listings' ] );
331
  foreach ( $allowed_capabilities as $cap ) {
332
  if ( current_user_can( $cap ) ) {
333
  $user_can_search_users = true;
359
  $page = isset( $_GET['page'] ) ? intval( $_GET['page'] ) : 1;
360
  $per_page = 20;
361
 
362
+ $exclude = [];
363
  if ( ! empty( $_GET['exclude'] ) ) {
364
  $exclude = array_map( 'intval', $_GET['exclude'] );
365
  }
369
  }
370
 
371
  $more_exist = false;
372
+ $users = [];
373
 
374
  // Search by ID.
375
  if ( is_numeric( $term ) && ! in_array( intval( $term ), $exclude, true ) ) {
380
  }
381
 
382
  if ( empty( $users ) ) {
383
+ $search_args = [
384
  'exclude' => $exclude,
385
  'search' => '*' . esc_attr( $term ) . '*',
386
+ 'search_columns' => [ 'user_login', 'user_email', 'user_nicename', 'display_name' ],
387
  'number' => $per_page,
388
  'paged' => $page,
389
  'orderby' => 'display_name',
390
  'order' => 'ASC',
391
+ ];
392
 
393
  /**
394
  * Modify the arguments used for `WP_User_Query` constructor.
410
  $more_exist = $total_pages > $page;
411
  }
412
 
413
+ $found_users = [];
414
 
415
  foreach ( $users as $user ) {
416
  $found_users[ $user->ID ] = sprintf(
422
  );
423
  }
424
 
425
+ $response = [
426
  'results' => $found_users,
427
  'more' => $more_exist,
428
+ ];
429
 
430
  /**
431
  * Modify the search results response for users in ajax call.
includes/class-wp-job-manager-api.php CHANGED
@@ -43,8 +43,8 @@ class WP_Job_Manager_API {
43
  * Constructor.
44
  */
45
  public function __construct() {
46
- add_filter( 'query_vars', array( $this, 'add_query_vars' ), 0 );
47
- add_action( 'parse_request', array( $this, 'api_requests' ), 0 );
48
  }
49
 
50
  /**
43
  * Constructor.
44
  */
45
  public function __construct() {
46
+ add_filter( 'query_vars', [ $this, 'add_query_vars' ], 0 );
47
+ add_action( 'parse_request', [ $this, 'api_requests' ], 0 );
48
  }
49
 
50
  /**
includes/class-wp-job-manager-blocks.php CHANGED
@@ -42,7 +42,7 @@ class WP_Job_Manager_Blocks {
42
  return;
43
  }
44
 
45
- add_action( 'init', array( $this, 'register_blocks' ) );
46
  }
47
 
48
  /**
42
  return;
43
  }
44
 
45
+ add_action( 'init', [ $this, 'register_blocks' ] );
46
  }
47
 
48
  /**
includes/class-wp-job-manager-cache-helper.php CHANGED
@@ -21,15 +21,15 @@ class WP_Job_Manager_Cache_Helper {
21
  * Initializes cache hooks.
22
  */
23
  public static function init() {
24
- add_action( 'save_post', array( __CLASS__, 'flush_get_job_listings_cache' ) );
25
- add_action( 'delete_post', array( __CLASS__, 'flush_get_job_listings_cache' ) );
26
- add_action( 'trash_post', array( __CLASS__, 'flush_get_job_listings_cache' ) );
27
- add_action( 'job_manager_my_job_do_action', array( __CLASS__, 'job_manager_my_job_do_action' ) );
28
- add_action( 'set_object_terms', array( __CLASS__, 'set_term' ), 10, 4 );
29
- add_action( 'edited_term', array( __CLASS__, 'edited_term' ), 10, 3 );
30
- add_action( 'create_term', array( __CLASS__, 'edited_term' ), 10, 3 );
31
- add_action( 'delete_term', array( __CLASS__, 'edited_term' ), 10, 3 );
32
- add_action( 'transition_post_status', array( __CLASS__, 'maybe_clear_count_transients' ), 10, 3 );
33
  }
34
 
35
  /**
@@ -124,10 +124,10 @@ class WP_Job_Manager_Cache_Helper {
124
  /**
125
  * Clear expired transients.
126
  *
127
- * @deprecated 1.34.0 Handled by WordPress since 4.9.
128
  */
129
  public static function clear_expired_transients() {
130
- _deprecated_function( __METHOD__, '1.34.0', 'handled by WordPress core since 4.9' );
131
  }
132
 
133
  /**
@@ -155,7 +155,7 @@ class WP_Job_Manager_Cache_Helper {
155
  * @param string $old_status Old post status.
156
  * @param WP_Post $post Post object.
157
  */
158
- $post_types = apply_filters( 'wpjm_count_cache_supported_post_types', array( 'job_listing' ), $new_status, $old_status, $post );
159
 
160
  // Only proceed when statuses do not match, and post type is supported post type.
161
  if ( $new_status === $old_status || ! in_array( $post->post_type, $post_types, true ) ) {
@@ -172,9 +172,9 @@ class WP_Job_Manager_Cache_Helper {
172
  * @param string $old_status Old post status.
173
  * @param WP_Post $post Post object.
174
  */
175
- $valid_statuses = apply_filters( 'wpjm_count_cache_supported_statuses', array( 'pending' ), $new_status, $old_status, $post );
176
 
177
- $rlike = array();
178
  // New status transient option name.
179
  if ( in_array( $new_status, $valid_statuses, true ) ) {
180
  $rlike[] = "^_transient_jm_{$new_status}_{$post->post_type}_count_user_";
21
  * Initializes cache hooks.
22
  */
23
  public static function init() {
24
+ add_action( 'save_post', [ __CLASS__, 'flush_get_job_listings_cache' ] );
25
+ add_action( 'delete_post', [ __CLASS__, 'flush_get_job_listings_cache' ] );
26
+ add_action( 'trash_post', [ __CLASS__, 'flush_get_job_listings_cache' ] );
27
+ add_action( 'job_manager_my_job_do_action', [ __CLASS__, 'job_manager_my_job_do_action' ] );
28
+ add_action( 'set_object_terms', [ __CLASS__, 'set_term' ], 10, 4 );
29
+ add_action( 'edited_term', [ __CLASS__, 'edited_term' ], 10, 3 );
30
+ add_action( 'create_term', [ __CLASS__, 'edited_term' ], 10, 3 );
31
+ add_action( 'delete_term', [ __CLASS__, 'edited_term' ], 10, 3 );
32
+ add_action( 'transition_post_status', [ __CLASS__, 'maybe_clear_count_transients' ], 10, 3 );
33
  }
34
 
35
  /**
124
  /**
125
  * Clear expired transients.
126
  *
127
+ * @deprecated 1.33.4 Handled by WordPress since 4.9.
128
  */
129
  public static function clear_expired_transients() {
130
+ _deprecated_function( __METHOD__, '1.33.4', 'handled by WordPress core since 4.9' );
131
  }
132
 
133
  /**
155
  * @param string $old_status Old post status.
156
  * @param WP_Post $post Post object.
157
  */
158
+ $post_types = apply_filters( 'wpjm_count_cache_supported_post_types', [ 'job_listing' ], $new_status, $old_status, $post );
159
 
160
  // Only proceed when statuses do not match, and post type is supported post type.
161
  if ( $new_status === $old_status || ! in_array( $post->post_type, $post_types, true ) ) {
172
  * @param string $old_status Old post status.
173
  * @param WP_Post $post Post object.
174
  */
175
+ $valid_statuses = apply_filters( 'wpjm_count_cache_supported_statuses', [ 'pending' ], $new_status, $old_status, $post );
176
 
177
+ $rlike = [];
178
  // New status transient option name.
179
  if ( in_array( $new_status, $valid_statuses, true ) ) {
180
  $rlike[] = "^_transient_jm_{$new_status}_{$post->post_type}_count_user_";
includes/class-wp-job-manager-category-walker.php CHANGED
@@ -30,11 +30,11 @@ class WP_Job_Manager_Category_Walker extends Walker {
30
  *
31
  * @var array
32
  */
33
- public $db_fields = array(
34
  'parent' => 'parent',
35
  'id' => 'term_id',
36
  'slug' => 'slug',
37
- );
38
 
39
  /**
40
  * Start the list walker.
@@ -48,7 +48,7 @@ class WP_Job_Manager_Category_Walker extends Walker {
48
  * @param array $args
49
  * @param int $current_object_id
50
  */
51
- public function start_el( &$output, $object, $depth = 0, $args = array(), $current_object_id = 0 ) {
52
 
53
  if ( ! empty( $args['hierarchical'] ) ) {
54
  $pad = str_repeat( '&nbsp;', $depth * 3 );
30
  *
31
  * @var array
32
  */
33
+ public $db_fields = [
34
  'parent' => 'parent',
35
  'id' => 'term_id',
36
  'slug' => 'slug',
37
+ ];
38
 
39
  /**
40
  * Start the list walker.
48
  * @param array $args
49
  * @param int $current_object_id
50
  */
51
+ public function start_el( &$output, $object, $depth = 0, $args = [], $current_object_id = 0 ) {
52
 
53
  if ( ! empty( $args['hierarchical'] ) ) {
54
  $pad = str_repeat( '&nbsp;', $depth * 3 );
includes/class-wp-job-manager-data-cleaner.php CHANGED
@@ -22,25 +22,25 @@ class WP_Job_Manager_Data_Cleaner {
22
  *
23
  * @var $custom_post_types
24
  */
25
- private static $custom_post_types = array(
26
  'job_listing',
27
- );
28
 
29
  /**
30
  * Taxonomies to be deleted.
31
  *
32
  * @var $taxonomies
33
  */
34
- private static $taxonomies = array(
35
  'job_listing_category',
36
  'job_listing_type',
37
- );
38
 
39
  /** Cron jobs to be unscheduled.
40
  *
41
  * @var $cron_jobs
42
  */
43
- private static $cron_jobs = array(
44
  'job_manager_check_for_expired_jobs',
45
  'job_manager_delete_old_previews',
46
  'job_manager_email_daily_notices',
@@ -48,14 +48,14 @@ class WP_Job_Manager_Data_Cleaner {
48
 
49
  // Old cron jobs.
50
  'job_manager_clear_expired_transients',
51
- );
52
 
53
  /**
54
  * Options to be deleted.
55
  *
56
  * @var $options
57
  */
58
- private static $options = array(
59
  'wp_job_manager_version',
60
  'job_manager_installed_terms',
61
  'wpjm_permalinks',
@@ -99,16 +99,18 @@ class WP_Job_Manager_Data_Cleaner {
99
  'job_manager_email_admin_expiring_job',
100
  'job_manager_email_employer_expiring_job',
101
  'job_manager_admin_notices',
102
- );
 
 
103
 
104
  /**
105
  * Site options to be deleted.
106
  *
107
  * @var $site_options
108
  */
109
- private static $site_options = array(
110
  'job_manager_helper',
111
- );
112
 
113
  /**
114
  * Transient names (as MySQL regexes) to be deleted. The prefixes
@@ -116,11 +118,11 @@ class WP_Job_Manager_Data_Cleaner {
116
  *
117
  * @var $transients
118
  */
119
- private static $transients = array(
120
  '_job_manager_activation_redirect', // Legacy transient that should still be removed.
121
  'get_job_listings-transient-version',
122
  'jm_.*',
123
- );
124
 
125
  /**
126
  * Role to be removed.
@@ -134,7 +136,7 @@ class WP_Job_Manager_Data_Cleaner {
134
  *
135
  * @var $caps
136
  */
137
- private static $caps = array(
138
  'manage_job_listings',
139
  'edit_job_listing',
140
  'read_job_listing',
@@ -153,21 +155,21 @@ class WP_Job_Manager_Data_Cleaner {
153
  'edit_job_listing_terms',
154
  'delete_job_listing_terms',
155
  'assign_job_listing_terms',
156
- );
157
 
158
  /**
159
  * User meta key names to be deleted.
160
  *
161
  * @var array $user_meta_keys
162
  */
163
- private static $user_meta_keys = array(
164
  '_company_logo',
165
  '_company_name',
166
  '_company_website',
167
  '_company_tagline',
168
  '_company_twitter',
169
  '_company_video',
170
- );
171
 
172
  /**
173
  * Cleanup all data.
@@ -194,12 +196,12 @@ class WP_Job_Manager_Data_Cleaner {
194
  private static function cleanup_custom_post_types() {
195
  foreach ( self::$custom_post_types as $post_type ) {
196
  $items = get_posts(
197
- array(
198
  'post_type' => $post_type,
199
  'post_status' => 'any',
200
  'numberposts' => -1,
201
  'fields' => 'ids',
202
- )
203
  );
204
 
205
  foreach ( $items as $item ) {
@@ -228,10 +230,10 @@ class WP_Job_Manager_Data_Cleaner {
228
 
229
  // Delete all data for each term.
230
  foreach ( $terms as $term ) {
231
- $wpdb->delete( $wpdb->term_relationships, array( 'term_taxonomy_id' => $term->term_taxonomy_id ) );
232
- $wpdb->delete( $wpdb->term_taxonomy, array( 'term_taxonomy_id' => $term->term_taxonomy_id ) );
233
- $wpdb->delete( $wpdb->terms, array( 'term_id' => $term->term_id ) );
234
- $wpdb->delete( $wpdb->termmeta, array( 'term_id' => $term->term_id ) );
235
  }
236
 
237
  if ( function_exists( 'clean_taxonomy_cache' ) ) {
@@ -300,7 +302,7 @@ class WP_Job_Manager_Data_Cleaner {
300
 
301
  // phpcs:disable WordPress.DB.DirectDatabaseQuery.DirectQuery
302
  // phpcs:disable WordPress.DB.DirectDatabaseQuery.NoCaching
303
- foreach ( array( '_transient_', '_transient_timeout_' ) as $prefix ) {
304
  foreach ( self::$transients as $transient ) {
305
  $wpdb->query(
306
  $wpdb->prepare(
@@ -330,7 +332,7 @@ class WP_Job_Manager_Data_Cleaner {
330
  }
331
 
332
  // Remove caps and role from users.
333
- $users = get_users( array() );
334
  foreach ( $users as $user ) {
335
  self::remove_all_job_manager_caps( $user );
336
  $user->remove_role( self::$role );
@@ -361,7 +363,7 @@ class WP_Job_Manager_Data_Cleaner {
361
 
362
  foreach ( self::$user_meta_keys as $meta_key ) {
363
  // phpcs:disable WordPress.DB.DirectDatabaseQuery.NoCaching, WordPress.DB.DirectDatabaseQuery.DirectQuery -- Delete data across all users.
364
- $wpdb->delete( $wpdb->usermeta, array( 'meta_key' => $meta_key ) );
365
  // phpcs:enable WordPress.DB.DirectDatabaseQuery.NoCaching, WordPress.DB.DirectDatabaseQuery.DirectQuery
366
  }
367
  }
22
  *
23
  * @var $custom_post_types
24
  */
25
+ private static $custom_post_types = [
26
  'job_listing',
27
+ ];
28
 
29
  /**
30
  * Taxonomies to be deleted.
31
  *
32
  * @var $taxonomies
33
  */
34
+ private static $taxonomies = [
35
  'job_listing_category',
36
  'job_listing_type',
37
+ ];
38
 
39
  /** Cron jobs to be unscheduled.
40
  *
41
  * @var $cron_jobs
42
  */
43
+ private static $cron_jobs = [
44
  'job_manager_check_for_expired_jobs',
45
  'job_manager_delete_old_previews',
46
  'job_manager_email_daily_notices',
48
 
49
  // Old cron jobs.
50
  'job_manager_clear_expired_transients',
51
+ ];
52
 
53
  /**
54
  * Options to be deleted.
55
  *
56
  * @var $options
57
  */
58
+ private static $options = [
59
  'wp_job_manager_version',
60
  'job_manager_installed_terms',
61
  'wpjm_permalinks',
99
  'job_manager_email_admin_expiring_job',
100
  'job_manager_email_employer_expiring_job',
101
  'job_manager_admin_notices',
102
+ 'widget_widget_featured_jobs',
103
+ 'widget_widget_recent_jobs',
104
+ ];
105
 
106
  /**
107
  * Site options to be deleted.
108
  *
109
  * @var $site_options
110
  */
111
+ private static $site_options = [
112
  'job_manager_helper',
113
+ ];
114
 
115
  /**
116
  * Transient names (as MySQL regexes) to be deleted. The prefixes
118
  *
119
  * @var $transients
120
  */
121
+ private static $transients = [
122
  '_job_manager_activation_redirect', // Legacy transient that should still be removed.
123
  'get_job_listings-transient-version',
124
  'jm_.*',
125
+ ];
126
 
127
  /**
128
  * Role to be removed.
136
  *
137
  * @var $caps
138
  */
139
+ private static $caps = [
140
  'manage_job_listings',
141
  'edit_job_listing',
142
  'read_job_listing',
155
  'edit_job_listing_terms',
156
  'delete_job_listing_terms',
157
  'assign_job_listing_terms',
158
+ ];
159
 
160
  /**
161
  * User meta key names to be deleted.
162
  *
163
  * @var array $user_meta_keys
164
  */
165
+ private static $user_meta_keys = [
166
  '_company_logo',
167
  '_company_name',
168
  '_company_website',
169
  '_company_tagline',
170
  '_company_twitter',
171
  '_company_video',
172
+ ];
173
 
174
  /**
175
  * Cleanup all data.
196
  private static function cleanup_custom_post_types() {
197
  foreach ( self::$custom_post_types as $post_type ) {
198
  $items = get_posts(
199
+ [
200
  'post_type' => $post_type,
201
  'post_status' => 'any',
202
  'numberposts' => -1,
203
  'fields' => 'ids',
204
+ ]
205
  );
206
 
207
  foreach ( $items as $item ) {
230
 
231
  // Delete all data for each term.
232
  foreach ( $terms as $term ) {
233
+ $wpdb->delete( $wpdb->term_relationships, [ 'term_taxonomy_id' => $term->term_taxonomy_id ] );
234
+ $wpdb->delete( $wpdb->term_taxonomy, [ 'term_taxonomy_id' => $term->term_taxonomy_id ] );
235
+ $wpdb->delete( $wpdb->terms, [ 'term_id' => $term->term_id ] );
236
+ $wpdb->delete( $wpdb->termmeta, [ 'term_id' => $term->term_id ] );
237
  }
238
 
239
  if ( function_exists( 'clean_taxonomy_cache' ) ) {
302
 
303
  // phpcs:disable WordPress.DB.DirectDatabaseQuery.DirectQuery
304
  // phpcs:disable WordPress.DB.DirectDatabaseQuery.NoCaching
305
+ foreach ( [ '_transient_', '_transient_timeout_' ] as $prefix ) {
306
  foreach ( self::$transients as $transient ) {
307
  $wpdb->query(
308
  $wpdb->prepare(
332
  }
333
 
334
  // Remove caps and role from users.
335
+ $users = get_users( [] );
336
  foreach ( $users as $user ) {
337
  self::remove_all_job_manager_caps( $user );
338
  $user->remove_role( self::$role );
363
 
364
  foreach ( self::$user_meta_keys as $meta_key ) {
365
  // phpcs:disable WordPress.DB.DirectDatabaseQuery.NoCaching, WordPress.DB.DirectDatabaseQuery.DirectQuery -- Delete data across all users.
366
+ $wpdb->delete( $wpdb->usermeta, [ 'meta_key' => $meta_key ] );
367
  // phpcs:enable WordPress.DB.DirectDatabaseQuery.NoCaching, WordPress.DB.DirectDatabaseQuery.DirectQuery
368
  }
369
  }
includes/class-wp-job-manager-data-exporter.php CHANGED
@@ -23,10 +23,10 @@ class WP_Job_Manager_Data_Exporter {
23
  * @return array $exporters The exporter array.
24
  */
25
  public static function register_wpjm_user_data_exporter( $exporters ) {
26
- $exporters['wp-job-manager'] = array(
27
  'exporter_friendly_name' => __( 'WP Job Manager', 'wp-job-manager' ),
28
- 'callback' => array( __CLASS__, 'user_data_exporter' ),
29
- );
30
  return $exporters;
31
  }
32
 
@@ -37,24 +37,24 @@ class WP_Job_Manager_Data_Exporter {
37
  * @return array
38
  */
39
  public static function user_data_exporter( $email_address ) {
40
- $export_items = array();
41
  $user = get_user_by( 'email', $email_address );
42
  if ( false === $user ) {
43
- return array(
44
  'data' => $export_items,
45
  'done' => true,
46
- );
47
  }
48
 
49
- $user_data_to_export = array();
50
- $user_meta_keys = array(
51
  '_company_logo' => __( 'Company Logo', 'wp-job-manager' ),
52
  '_company_name' => __( 'Company Name', 'wp-job-manager' ),
53
  '_company_website' => __( 'Company Website', 'wp-job-manager' ),
54
  '_company_tagline' => __( 'Company Tagline', 'wp-job-manager' ),
55
  '_company_twitter' => __( 'Company Twitter', 'wp-job-manager' ),
56
  '_company_video' => __( 'Company Video', 'wp-job-manager' ),
57
- );
58
 
59
  foreach ( $user_meta_keys as $user_meta_key => $name ) {
60
  $user_meta = get_user_meta( $user->ID, $user_meta_key, true );
@@ -70,22 +70,22 @@ class WP_Job_Manager_Data_Exporter {
70
  }
71
  }
72
 
73
- $user_data_to_export[] = array(
74
  'name' => $name,
75
  'value' => $user_meta,
76
- );
77
  }
78
 
79
- $export_items[] = array(
80
  'group_id' => 'wpjm-user-data',
81
  'group_label' => __( 'WP Job Manager User Data', 'wp-job-manager' ),
82
  'item_id' => "wpjm-user-data-{$user->ID}",
83
  'data' => $user_data_to_export,
84
- );
85
 
86
- return array(
87
  'data' => $export_items,
88
  'done' => true,
89
- );
90
  }
91
  }
23
  * @return array $exporters The exporter array.
24
  */
25
  public static function register_wpjm_user_data_exporter( $exporters ) {
26
+ $exporters['wp-job-manager'] = [
27
  'exporter_friendly_name' => __( 'WP Job Manager', 'wp-job-manager' ),
28
+ 'callback' => [ __CLASS__, 'user_data_exporter' ],
29
+ ];
30
  return $exporters;
31
  }
32
 
37
  * @return array
38
  */
39
  public static function user_data_exporter( $email_address ) {
40
+ $export_items = [];
41
  $user = get_user_by( 'email', $email_address );
42
  if ( false === $user ) {
43
+ return [
44
  'data' => $export_items,
45
  'done' => true,
46
+ ];
47
  }
48
 
49
+ $user_data_to_export = [];
50
+ $user_meta_keys = [
51
  '_company_logo' => __( 'Company Logo', 'wp-job-manager' ),
52
  '_company_name' => __( 'Company Name', 'wp-job-manager' ),
53
  '_company_website' => __( 'Company Website', 'wp-job-manager' ),
54
  '_company_tagline' => __( 'Company Tagline', 'wp-job-manager' ),
55
  '_company_twitter' => __( 'Company Twitter', 'wp-job-manager' ),
56
  '_company_video' => __( 'Company Video', 'wp-job-manager' ),
57
+ ];
58
 
59
  foreach ( $user_meta_keys as $user_meta_key => $name ) {
60
  $user_meta = get_user_meta( $user->ID, $user_meta_key, true );
70
  }
71
  }
72
 
73
+ $user_data_to_export[] = [
74
  'name' => $name,
75
  'value' => $user_meta,
76
+ ];
77
  }
78
 
79
+ $export_items[] = [
80
  'group_id' => 'wpjm-user-data',
81
  'group_label' => __( 'WP Job Manager User Data', 'wp-job-manager' ),
82
  'item_id' => "wpjm-user-data-{$user->ID}",
83
  'data' => $user_data_to_export,
84
+ ];
85
 
86
+ return [
87
  'data' => $export_items,
88
  'done' => true,
89
+ ];
90
  }
91
  }
includes/class-wp-job-manager-email-notifications.php CHANGED
@@ -24,7 +24,7 @@ final class WP_Job_Manager_Email_Notifications {
24
  *
25
  * @var array
26
  */
27
- private static $deferred_notifications = array();
28
 
29
  /**
30
  * Sets up initial hooks.
@@ -32,16 +32,16 @@ final class WP_Job_Manager_Email_Notifications {
32
  * @static
33
  */
34
  public static function init() {
35
- add_action( 'job_manager_send_notification', array( __CLASS__, 'schedule_notification' ), 10, 2 );
36
- add_action( 'job_manager_email_init', array( __CLASS__, 'lazy_init' ) );
37
- add_action( 'job_manager_email_job_details', array( __CLASS__, 'output_job_details' ), 10, 4 );
38
- add_action( 'job_manager_email_header', array( __CLASS__, 'output_header' ), 10, 3 );
39
- add_action( 'job_manager_email_footer', array( __CLASS__, 'output_footer' ), 10, 3 );
40
- add_action( 'job_manager_email_daily_notices', array( __CLASS__, 'send_employer_expiring_notice' ) );
41
- add_action( 'job_manager_email_daily_notices', array( __CLASS__, 'send_admin_expiring_notice' ) );
42
- add_filter( 'job_manager_settings', array( __CLASS__, 'add_job_manager_email_settings' ), 1 );
43
- add_action( 'job_manager_job_submitted', array( __CLASS__, 'send_new_job_notification' ) );
44
- add_action( 'job_manager_user_edit_job_listing', array( __CLASS__, 'send_updated_job_notification' ) );
45
  }
46
 
47
  /**
@@ -50,12 +50,12 @@ final class WP_Job_Manager_Email_Notifications {
50
  * @return array
51
  */
52
  public static function core_email_notifications() {
53
- return array(
54
  'WP_Job_Manager_Email_Admin_New_Job',
55
  'WP_Job_Manager_Email_Admin_Updated_Job',
56
  'WP_Job_Manager_Email_Admin_Expiring_Job',
57
  'WP_Job_Manager_Email_Employer_Expiring_Job',
58
- );
59
  }
60
 
61
  /**
@@ -68,10 +68,10 @@ final class WP_Job_Manager_Email_Notifications {
68
  * @param string $notification
69
  * @param array $args
70
  */
71
- public static function schedule_notification( $notification, $args = array() ) {
72
  self::maybe_init();
73
 
74
- self::$deferred_notifications[] = array( $notification, $args );
75
  }
76
 
77
  /**
@@ -93,7 +93,7 @@ final class WP_Job_Manager_Email_Notifications {
93
 
94
  $email_class = $email_notifications[ $email[0] ];
95
  $email_notification_key = $email[0];
96
- $email_args = is_array( $email[1] ) ? $email[1] : array();
97
 
98
  self::send_email( $email[0], new $email_class( $email_args, self::get_email_settings( $email_notification_key ) ) );
99
  }
@@ -122,7 +122,7 @@ final class WP_Job_Manager_Email_Notifications {
122
  * @access private
123
  */
124
  public static function lazy_init() {
125
- add_action( 'shutdown', array( __CLASS__, 'send_deferred_notifications' ) );
126
 
127
  include_once JOB_MANAGER_PLUGIN_DIR . '/includes/emails/class-wp-job-manager-email-admin-new-job.php';
128
  include_once JOB_MANAGER_PLUGIN_DIR . '/includes/emails/class-wp-job-manager-email-admin-updated-job.php';
@@ -145,7 +145,7 @@ final class WP_Job_Manager_Email_Notifications {
145
  if ( ! defined( 'PHPUNIT_WPJM_TESTSUITE' ) || ! PHPUNIT_WPJM_TESTSUITE ) {
146
  die( 'This is just for use while testing' );
147
  }
148
- self::$deferred_notifications = array();
149
  }
150
 
151
  /**
@@ -165,7 +165,7 @@ final class WP_Job_Manager_Email_Notifications {
165
  * @param array $email_notifications All the email notifications to be registered.
166
  */
167
  $email_notification_classes = array_unique( apply_filters( 'job_manager_email_notifications', self::core_email_notifications() ) );
168
- $email_notifications = array();
169
 
170
  /**
171
  * Email class in loop.
@@ -179,7 +179,7 @@ final class WP_Job_Manager_Email_Notifications {
179
  }
180
 
181
  // PHP 5.2: Using `call_user_func()` but `$email_class::get_key()` preferred.
182
- $email_notification_key = call_user_func( array( $email_class, 'get_key' ) );
183
  if (
184
  isset( $email_notifications[ $email_notification_key ] )
185
  || ( $enabled_notifications_only && ! self::is_email_notification_enabled( $email_notification_key ) )
@@ -221,12 +221,12 @@ final class WP_Job_Manager_Email_Notifications {
221
  * @return array
222
  */
223
  private static function get_job_detail_fields( WP_Post $job, $sent_to_admin, $plain_text = false ) {
224
- $fields = array();
225
 
226
- $fields['job_title'] = array(
227
  'label' => __( 'Job title', 'wp-job-manager' ),
228
  'value' => $job->post_title,
229
- );
230
 
231
  if ( $sent_to_admin || 'publish' === $job->post_status ) {
232
  $fields['job_title']['url'] = get_permalink( $job );
@@ -234,65 +234,65 @@ final class WP_Job_Manager_Email_Notifications {
234
 
235
  $job_location = get_the_job_location( $job );
236
  if ( ! empty( $job_location ) ) {
237
- $fields['job_location'] = array(
238
  'label' => __( 'Location', 'wp-job-manager' ),
239
  'value' => $job_location,
240
- );
241
  }
242
 
243
  if ( get_option( 'job_manager_enable_types' ) && wp_count_terms( 'job_listing_type' ) > 0 ) {
244
  $job_types = wpjm_get_the_job_types( $job );
245
  if ( ! empty( $job_types ) ) {
246
- $fields['job_type'] = array(
247
  'label' => __( 'Job type', 'wp-job-manager' ),
248
  'value' => implode( ', ', wp_list_pluck( $job_types, 'name' ) ),
249
- );
250
  }
251
  }
252
 
253
  if ( get_option( 'job_manager_enable_categories' ) && wp_count_terms( 'job_listing_category' ) > 0 ) {
254
  $job_categories = wpjm_get_the_job_categories( $job );
255
  if ( ! empty( $job_categories ) ) {
256
- $fields['job_category'] = array(
257
  'label' => __( 'Job category', 'wp-job-manager' ),
258
  'value' => implode( ', ', wp_list_pluck( $job_categories, 'name' ) ),
259
- );
260
  }
261
  }
262
 
263
  $company_name = get_the_company_name( $job );
264
  if ( ! empty( $company_name ) ) {
265
- $fields['company_name'] = array(
266
  'label' => __( 'Company name', 'wp-job-manager' ),
267
  'value' => $company_name,
268
- );
269
  }
270
 
271
  $company_website = get_the_company_website( $job );
272
  if ( ! empty( $company_website ) ) {
273
- $fields['company_website'] = array(
274
  'label' => __( 'Company website', 'wp-job-manager' ),
275
- 'value' => $plain_text ? $company_website : sprintf( '<a href="%1$s">%1$s</a>', esc_url( $company_website, array( 'http', 'https' ) ) ),
276
- );
277
  }
278
 
279
  $job_expires = get_post_meta( $job->ID, '_job_expires', true );
280
  if ( ! empty( $job_expires ) ) {
281
  $job_expires_str = date_i18n( get_option( 'date_format' ), strtotime( $job_expires ) );
282
- $fields['job_expires'] = array(
283
  'label' => __( 'Listing expires', 'wp-job-manager' ),
284
  'value' => $job_expires_str,
285
- );
286
  }
287
 
288
  if ( $sent_to_admin ) {
289
  $author = get_user_by( 'ID', $job->post_author );
290
  if ( $author instanceof WP_User ) {
291
- $fields['author'] = array(
292
  'label' => __( 'Posted by', 'wp-job-manager' ),
293
  'value' => $author->user_nicename,
294
  'url' => 'mailto:' . $author->user_email,
295
- );
296
  }
297
  }
298
 
@@ -367,12 +367,12 @@ final class WP_Job_Manager_Email_Notifications {
367
  return false;
368
  }
369
 
370
- $template_default_path = call_user_func( array( $email_class, 'get_template_default_path' ) );
371
  if ( '' === $template_default_path ) {
372
  return false;
373
  }
374
 
375
- $template_path = call_user_func( array( $email_class, 'get_template_path' ) );
376
  $template = self::locate_template_file( $template_name, $plain_text, $template_path, $template_default_path );
377
  if ( '' === $template ) {
378
  return false;
@@ -413,37 +413,37 @@ final class WP_Job_Manager_Email_Notifications {
413
  */
414
  public static function add_email_settings( $settings, $context ) {
415
  $email_notifications = self::get_email_notifications( false );
416
- $email_settings = array();
417
 
418
  foreach ( $email_notifications as $email_notification_key => $email_class ) {
419
- $email_notification_context = call_user_func( array( $email_class, 'get_context' ) );
420
  if ( $context !== $email_notification_context ) {
421
  continue;
422
  }
423
 
424
- $email_settings[] = array(
425
  'type' => 'multi_enable_expand',
426
  'class' => 'email-setting-row no-separator',
427
- 'name' => self::EMAIL_SETTING_PREFIX . call_user_func( array( $email_class, 'get_key' ) ),
428
- 'enable_field' => array(
429
  'name' => self::EMAIL_SETTING_ENABLED,
430
- 'cb_label' => call_user_func( array( $email_class, 'get_name' ) ),
431
- 'desc' => call_user_func( array( $email_class, 'get_description' ) ),
432
- ),
433
  'label' => false,
434
  'std' => self::get_email_setting_defaults( $email_notification_key ),
435
  'settings' => self::get_email_setting_fields( $email_notification_key ),
436
- );
437
  }
438
 
439
  if ( ! empty( $email_settings ) ) {
440
- $settings['email_notifications'] = array(
441
  __( 'Email Notifications', 'wp-job-manager' ),
442
  $email_settings,
443
- array(
444
  'before' => __( 'Select the email notifications to enable.', 'wp-job-manager' ),
445
- ),
446
- );
447
  }
448
 
449
  return $settings;
@@ -529,7 +529,7 @@ final class WP_Job_Manager_Email_Notifications {
529
  * @param int $job_id
530
  */
531
  public static function send_new_job_notification( $job_id ) {
532
- do_action( 'job_manager_send_notification', 'admin_new_job', array( 'job_id' => $job_id ) );
533
  }
534
 
535
  /**
@@ -538,7 +538,7 @@ final class WP_Job_Manager_Email_Notifications {
538
  * @param int $job_id
539
  */
540
  public static function send_updated_job_notification( $job_id ) {
541
- do_action( 'job_manager_send_notification', 'admin_updated_job', array( 'job_id' => $job_id ) );
542
  }
543
 
544
  /**
@@ -550,23 +550,23 @@ final class WP_Job_Manager_Email_Notifications {
550
  private static function send_expiring_notice( $email_notification_key, $days_notice ) {
551
  $notice_before_ts = current_time( 'timestamp' ) + ( DAY_IN_SECONDS * $days_notice );
552
  $job_ids = get_posts(
553
- array(
554
  'post_type' => 'job_listing',
555
  'post_status' => 'publish',
556
  'fields' => 'ids',
557
  'posts_per_page' => -1,
558
- 'meta_query' => array(
559
- array(
560
  'key' => '_job_expires',
561
  'value' => date( 'Y-m-d', $notice_before_ts ),
562
- ),
563
- ),
564
- )
565
  );
566
 
567
  if ( $job_ids ) {
568
  foreach ( $job_ids as $job_id ) {
569
- do_action( 'job_manager_send_notification', $email_notification_key, array( 'job_id' => $job_id ) );
570
  }
571
  }
572
  }
@@ -579,19 +579,19 @@ final class WP_Job_Manager_Email_Notifications {
579
  */
580
  private static function get_email_setting_fields( $email_notification_key ) {
581
  $email_class = self::get_email_class( $email_notification_key );
582
- $core_settings = array(
583
- array(
584
  'name' => 'plain_text',
585
  'std' => '0',
586
  'label' => __( 'Format', 'wp-job-manager' ),
587
  'type' => 'radio',
588
- 'options' => array(
589
  '1' => __( 'Send plain text email', 'wp-job-manager' ),
590
  '0' => __( 'Send rich text email', 'wp-job-manager' ),
591
- ),
592
- ),
593
- );
594
- $email_settings = call_user_func( array( $email_class, 'get_setting_fields' ) );
595
  return array_merge( $core_settings, $email_settings );
596
  }
597
 
@@ -605,7 +605,7 @@ final class WP_Job_Manager_Email_Notifications {
605
  $option_name = self::EMAIL_SETTING_PREFIX . $email_notification_key;
606
  $option_value = get_option( $option_name );
607
  if ( empty( $option_value ) || ! is_array( $option_value ) ) {
608
- $option_value = array();
609
  }
610
  $default_settings = self::get_email_setting_defaults( $email_notification_key );
611
 
@@ -622,8 +622,8 @@ final class WP_Job_Manager_Email_Notifications {
622
  $settings = self::get_email_setting_fields( $email_notification_key );
623
  $email_class = self::get_email_class( $email_notification_key );
624
 
625
- $defaults = array();
626
- $defaults[ self::EMAIL_SETTING_ENABLED ] = call_user_func( array( $email_class, 'is_default_enabled' ) ) ? '1' : '0';
627
 
628
  foreach ( $settings as $setting ) {
629
  $defaults[ $setting['name'] ] = null;
@@ -691,8 +691,8 @@ final class WP_Job_Manager_Email_Notifications {
691
  return is_string( $email_class )
692
  && class_exists( $email_class )
693
  && is_subclass_of( $email_class, 'WP_Job_Manager_Email' )
694
- && false !== call_user_func( array( $email_class, 'get_key' ) )
695
- && false !== call_user_func( array( $email_class, 'get_name' ) );
696
  }
697
 
698
  /**
@@ -709,8 +709,8 @@ final class WP_Job_Manager_Email_Notifications {
709
  return false;
710
  }
711
 
712
- $fields = array( 'to', 'from', 'subject', 'rich_content', 'plain_content', 'attachments', 'cc', 'headers' );
713
- $args = array();
714
  foreach ( $fields as $field ) {
715
  $method = 'get_' . $field;
716
 
@@ -725,7 +725,7 @@ final class WP_Job_Manager_Email_Notifications {
725
  $args[ $field ] = apply_filters( "job_manager_email_{$email_notification_key}_{$field}", $email->$method(), $email );
726
  }
727
 
728
- $headers = is_array( $args['headers'] ) ? $args['headers'] : array();
729
 
730
  if ( ! empty( $args['from'] ) ) {
731
  $headers[] = 'From: ' . $args['from'];
24
  *
25
  * @var array
26
  */
27
+ private static $deferred_notifications = [];
28
 
29
  /**
30
  * Sets up initial hooks.
32
  * @static
33
  */
34
  public static function init() {
35
+ add_action( 'job_manager_send_notification', [ __CLASS__, 'schedule_notification' ], 10, 2 );
36
+ add_action( 'job_manager_email_init', [ __CLASS__, 'lazy_init' ] );
37
+ add_action( 'job_manager_email_job_details', [ __CLASS__, 'output_job_details' ], 10, 4 );
38
+ add_action( 'job_manager_email_header', [ __CLASS__, 'output_header' ], 10, 3 );
39
+ add_action( 'job_manager_email_footer', [ __CLASS__, 'output_footer' ], 10, 3 );
40
+ add_action( 'job_manager_email_daily_notices', [ __CLASS__, 'send_employer_expiring_notice' ] );
41
+ add_action( 'job_manager_email_daily_notices', [ __CLASS__, 'send_admin_expiring_notice' ] );
42
+ add_filter( 'job_manager_settings', [ __CLASS__, 'add_job_manager_email_settings' ], 1 );
43
+ add_action( 'job_manager_job_submitted', [ __CLASS__, 'send_new_job_notification' ] );
44
+ add_action( 'job_manager_user_edit_job_listing', [ __CLASS__, 'send_updated_job_notification' ] );
45
  }
46
 
47
  /**
50
  * @return array
51
  */
52
  public static function core_email_notifications() {
53
+ return [
54
  'WP_Job_Manager_Email_Admin_New_Job',
55
  'WP_Job_Manager_Email_Admin_Updated_Job',
56
  'WP_Job_Manager_Email_Admin_Expiring_Job',
57
  'WP_Job_Manager_Email_Employer_Expiring_Job',
58
+ ];
59
  }
60
 
61
  /**
68
  * @param string $notification
69
  * @param array $args
70
  */
71
+ public static function schedule_notification( $notification, $args = [] ) {
72
  self::maybe_init();
73
 
74
+ self::$deferred_notifications[] = [ $notification, $args ];
75
  }
76
 
77
  /**
93
 
94
  $email_class = $email_notifications[ $email[0] ];
95
  $email_notification_key = $email[0];
96
+ $email_args = is_array( $email[1] ) ? $email[1] : [];
97
 
98
  self::send_email( $email[0], new $email_class( $email_args, self::get_email_settings( $email_notification_key ) ) );
99
  }
122
  * @access private
123
  */
124
  public static function lazy_init() {
125
+ add_action( 'shutdown', [ __CLASS__, 'send_deferred_notifications' ] );
126
 
127
  include_once JOB_MANAGER_PLUGIN_DIR . '/includes/emails/class-wp-job-manager-email-admin-new-job.php';
128
  include_once JOB_MANAGER_PLUGIN_DIR . '/includes/emails/class-wp-job-manager-email-admin-updated-job.php';
145
  if ( ! defined( 'PHPUNIT_WPJM_TESTSUITE' ) || ! PHPUNIT_WPJM_TESTSUITE ) {
146
  die( 'This is just for use while testing' );
147
  }
148
+ self::$deferred_notifications = [];
149
  }
150
 
151
  /**
165
  * @param array $email_notifications All the email notifications to be registered.
166
  */
167
  $email_notification_classes = array_unique( apply_filters( 'job_manager_email_notifications', self::core_email_notifications() ) );
168
+ $email_notifications = [];
169
 
170
  /**
171
  * Email class in loop.
179
  }
180
 
181
  // PHP 5.2: Using `call_user_func()` but `$email_class::get_key()` preferred.
182
+ $email_notification_key = call_user_func( [ $email_class, 'get_key' ] );
183
  if (
184
  isset( $email_notifications[ $email_notification_key ] )
185
  || ( $enabled_notifications_only && ! self::is_email_notification_enabled( $email_notification_key ) )
221
  * @return array
222
  */
223
  private static function get_job_detail_fields( WP_Post $job, $sent_to_admin, $plain_text = false ) {
224
+ $fields = [];
225
 
226
+ $fields['job_title'] = [
227
  'label' => __( 'Job title', 'wp-job-manager' ),
228
  'value' => $job->post_title,
229
+ ];
230
 
231
  if ( $sent_to_admin || 'publish' === $job->post_status ) {
232
  $fields['job_title']['url'] = get_permalink( $job );
234
 
235
  $job_location = get_the_job_location( $job );
236
  if ( ! empty( $job_location ) ) {
237
+ $fields['job_location'] = [
238
  'label' => __( 'Location', 'wp-job-manager' ),
239
  'value' => $job_location,
240
+ ];
241
  }
242
 
243
  if ( get_option( 'job_manager_enable_types' ) && wp_count_terms( 'job_listing_type' ) > 0 ) {
244
  $job_types = wpjm_get_the_job_types( $job );
245
  if ( ! empty( $job_types ) ) {
246
+ $fields['job_type'] = [
247
  'label' => __( 'Job type', 'wp-job-manager' ),
248
  'value' => implode( ', ', wp_list_pluck( $job_types, 'name' ) ),
249
+ ];
250
  }
251
  }
252
 
253
  if ( get_option( 'job_manager_enable_categories' ) && wp_count_terms( 'job_listing_category' ) > 0 ) {
254
  $job_categories = wpjm_get_the_job_categories( $job );
255
  if ( ! empty( $job_categories ) ) {
256
+ $fields['job_category'] = [
257
  'label' => __( 'Job category', 'wp-job-manager' ),
258
  'value' => implode( ', ', wp_list_pluck( $job_categories, 'name' ) ),
259
+ ];
260
  }
261
  }
262
 
263
  $company_name = get_the_company_name( $job );
264
  if ( ! empty( $company_name ) ) {
265
+ $fields['company_name'] = [
266
  'label' => __( 'Company name', 'wp-job-manager' ),
267
  'value' => $company_name,
268
+ ];
269
  }
270
 
271
  $company_website = get_the_company_website( $job );
272
  if ( ! empty( $company_website ) ) {
273
+ $fields['company_website'] = [
274
  'label' => __( 'Company website', 'wp-job-manager' ),
275
+ 'value' => $plain_text ? $company_website : sprintf( '<a href="%1$s">%1$s</a>', esc_url( $company_website, [ 'http', 'https' ] ) ),
276
+ ];
277
  }
278
 
279
  $job_expires = get_post_meta( $job->ID, '_job_expires', true );
280
  if ( ! empty( $job_expires ) ) {
281
  $job_expires_str = date_i18n( get_option( 'date_format' ), strtotime( $job_expires ) );
282
+ $fields['job_expires'] = [
283
  'label' => __( 'Listing expires', 'wp-job-manager' ),
284
  'value' => $job_expires_str,
285
+ ];
286
  }
287
 
288
  if ( $sent_to_admin ) {
289
  $author = get_user_by( 'ID', $job->post_author );
290
  if ( $author instanceof WP_User ) {
291
+ $fields['author'] = [
292
  'label' => __( 'Posted by', 'wp-job-manager' ),
293
  'value' => $author->user_nicename,
294
  'url' => 'mailto:' . $author->user_email,
295
+ ];
296
  }
297
  }
298
 
367
  return false;
368
  }
369
 
370
+ $template_default_path = call_user_func( [ $email_class, 'get_template_default_path' ] );
371
  if ( '' === $template_default_path ) {
372
  return false;
373
  }
374
 
375
+ $template_path = call_user_func( [ $email_class, 'get_template_path' ] );
376
  $template = self::locate_template_file( $template_name, $plain_text, $template_path, $template_default_path );
377
  if ( '' === $template ) {
378
  return false;
413
  */
414
  public static function add_email_settings( $settings, $context ) {
415
  $email_notifications = self::get_email_notifications( false );
416
+ $email_settings = [];
417
 
418
  foreach ( $email_notifications as $email_notification_key => $email_class ) {
419
+ $email_notification_context = call_user_func( [ $email_class, 'get_context' ] );
420
  if ( $context !== $email_notification_context ) {
421
  continue;
422
  }
423
 
424
+ $email_settings[] = [
425
  'type' => 'multi_enable_expand',
426
  'class' => 'email-setting-row no-separator',
427
+ 'name' => self::EMAIL_SETTING_PREFIX . call_user_func( [ $email_class, 'get_key' ] ),
428
+ 'enable_field' => [
429
  'name' => self::EMAIL_SETTING_ENABLED,
430
+ 'cb_label' => call_user_func( [ $email_class, 'get_name' ] ),
431
+ 'desc' => call_user_func( [ $email_class, 'get_description' ] ),
432
+ ],
433
  'label' => false,
434
  'std' => self::get_email_setting_defaults( $email_notification_key ),
435
  'settings' => self::get_email_setting_fields( $email_notification_key ),
436
+ ];
437
  }
438
 
439
  if ( ! empty( $email_settings ) ) {
440
+ $settings['email_notifications'] = [
441
  __( 'Email Notifications', 'wp-job-manager' ),
442
  $email_settings,
443
+ [
444
  'before' => __( 'Select the email notifications to enable.', 'wp-job-manager' ),
445
+ ],
446
+ ];
447
  }
448
 
449
  return $settings;
529
  * @param int $job_id
530
  */
531
  public static function send_new_job_notification( $job_id ) {
532
+ do_action( 'job_manager_send_notification', 'admin_new_job', [ 'job_id' => $job_id ] );
533
  }
534
 
535
  /**
538
  * @param int $job_id
539
  */
540
  public static function send_updated_job_notification( $job_id ) {
541
+ do_action( 'job_manager_send_notification', 'admin_updated_job', [ 'job_id' => $job_id ] );
542
  }
543
 
544
  /**
550
  private static function send_expiring_notice( $email_notification_key, $days_notice ) {
551
  $notice_before_ts = current_time( 'timestamp' ) + ( DAY_IN_SECONDS * $days_notice );
552
  $job_ids = get_posts(
553
+ [
554
  'post_type' => 'job_listing',
555
  'post_status' => 'publish',
556
  'fields' => 'ids',
557
  'posts_per_page' => -1,
558
+ 'meta_query' => [
559
+ [
560
  'key' => '_job_expires',
561
  'value' => date( 'Y-m-d', $notice_before_ts ),
562
+ ],
563
+ ],
564
+ ]
565
  );
566
 
567
  if ( $job_ids ) {
568
  foreach ( $job_ids as $job_id ) {
569
+ do_action( 'job_manager_send_notification', $email_notification_key, [ 'job_id' => $job_id ] );
570
  }
571
  }
572
  }
579
  */
580
  private static function get_email_setting_fields( $email_notification_key ) {
581
  $email_class = self::get_email_class( $email_notification_key );
582
+ $core_settings = [
583
+ [
584
  'name' => 'plain_text',
585
  'std' => '0',
586
  'label' => __( 'Format', 'wp-job-manager' ),
587
  'type' => 'radio',
588
+ 'options' => [
589
  '1' => __( 'Send plain text email', 'wp-job-manager' ),
590
  '0' => __( 'Send rich text email', 'wp-job-manager' ),
591
+ ],
592
+ ],
593
+ ];
594
+ $email_settings = call_user_func( [ $email_class, 'get_setting_fields' ] );
595
  return array_merge( $core_settings, $email_settings );
596
  }
597
 
605
  $option_name = self::EMAIL_SETTING_PREFIX . $email_notification_key;
606
  $option_value = get_option( $option_name );
607
  if ( empty( $option_value ) || ! is_array( $option_value ) ) {
608
+ $option_value = [];
609
  }
610
  $default_settings = self::get_email_setting_defaults( $email_notification_key );
611
 
622
  $settings = self::get_email_setting_fields( $email_notification_key );
623
  $email_class = self::get_email_class( $email_notification_key );
624
 
625
+ $defaults = [];
626
+ $defaults[ self::EMAIL_SETTING_ENABLED ] = call_user_func( [ $email_class, 'is_default_enabled' ] ) ? '1' : '0';
627
 
628
  foreach ( $settings as $setting ) {
629
  $defaults[ $setting['name'] ] = null;
691
  return is_string( $email_class )
692
  && class_exists( $email_class )
693
  && is_subclass_of( $email_class, 'WP_Job_Manager_Email' )
694
+ && false !== call_user_func( [ $email_class, 'get_key' ] )
695
+ && false !== call_user_func( [ $email_class, 'get_name' ] );
696
  }
697
 
698
  /**
709
  return false;
710
  }
711
 
712
+ $fields = [ 'to', 'from', 'subject', 'rich_content', 'plain_content', 'attachments', 'cc', 'headers' ];
713
+ $args = [];
714
  foreach ( $fields as $field ) {
715
  $method = 'get_' . $field;
716
 
725
  $args[ $field ] = apply_filters( "job_manager_email_{$email_notification_key}_{$field}", $email->$method(), $email );
726
  }
727
 
728
+ $headers = is_array( $args['headers'] ) ? $args['headers'] : [];
729
 
730
  if ( ! empty( $args['from'] ) ) {
731
  $headers[] = 'From: ' . $args['from'];
includes/class-wp-job-manager-forms.php CHANGED
@@ -42,7 +42,7 @@ class WP_Job_Manager_Forms {
42
  * Constructor.
43
  */
44
  public function __construct() {
45
- add_action( 'init', array( $this, 'load_posted_form' ) );
46
  }
47
 
48
  /**
@@ -73,7 +73,7 @@ class WP_Job_Manager_Forms {
73
  $form_file = JOB_MANAGER_PLUGIN_DIR . '/includes/forms/class-wp-job-manager-form-' . $form_name . '.php';
74
 
75
  if ( class_exists( $form_class ) ) {
76
- return call_user_func( array( $form_class, 'instance' ) );
77
  }
78
 
79
  if ( ! file_exists( $form_file ) ) {
@@ -85,7 +85,7 @@ class WP_Job_Manager_Forms {
85
  }
86
 
87
  // Init the form.
88
- return call_user_func( array( $form_class, 'instance' ) );
89
  }
90
 
91
  /**
@@ -95,7 +95,7 @@ class WP_Job_Manager_Forms {
95
  * @param array $atts Optional passed attributes.
96
  * @return string|null
97
  */
98
- public function get_form( $form_name, $atts = array() ) {
99
  $form = $this->load_form_class( $form_name );
100
  if ( $form ) {
101
  ob_start();
42
  * Constructor.
43
  */
44
  public function __construct() {
45
+ add_action( 'init', [ $this, 'load_posted_form' ] );
46
  }
47
 
48
  /**
73
  $form_file = JOB_MANAGER_PLUGIN_DIR . '/includes/forms/class-wp-job-manager-form-' . $form_name . '.php';
74
 
75
  if ( class_exists( $form_class ) ) {
76
+ return call_user_func( [ $form_class, 'instance' ] );
77
  }
78
 
79
  if ( ! file_exists( $form_file ) ) {
85
  }
86
 
87
  // Init the form.
88
+ return call_user_func( [ $form_class, 'instance' ] );
89
  }
90
 
91
  /**
95
  * @param array $atts Optional passed attributes.
96
  * @return string|null
97
  */
98
+ public function get_form( $form_name, $atts = [] ) {
99
  $form = $this->load_form_class( $form_name );
100
  if ( $form ) {
101
  ob_start();
includes/class-wp-job-manager-geocode.php CHANGED
@@ -44,10 +44,10 @@ class WP_Job_Manager_Geocode {
44
  * Constructor.
45
  */
46
  public function __construct() {
47
- add_filter( 'job_manager_geolocation_endpoint', array( $this, 'add_geolocation_endpoint_query_args' ), 0, 2 );
48
- add_filter( 'job_manager_geolocation_api_key', array( $this, 'get_google_maps_api_key' ), 0 );
49
- add_action( 'job_manager_update_job_data', array( $this, 'update_location_data' ), 20, 2 );
50
- add_action( 'job_manager_job_location_edited', array( $this, 'change_location_data' ), 20, 2 );
51
  }
52
 
53
  /**
@@ -186,14 +186,14 @@ class WP_Job_Manager_Geocode {
186
  * @throws Exception After geocoding error.
187
  */
188
  public static function get_location_data( $raw_address ) {
189
- $invalid_chars = array(
190
  ' ' => '+',
191
  ',' => '',
192
  '?' => '',
193
  '&' => '',
194
  '=' => '',
195
  '#' => '',
196
- );
197
  $raw_address = trim( strtolower( str_replace( array_keys( $invalid_chars ), array_values( $invalid_chars ), $raw_address ) ) );
198
 
199
  if ( empty( $raw_address ) ) {
@@ -218,13 +218,13 @@ class WP_Job_Manager_Geocode {
218
  if ( false === $geocoded_address || empty( $geocoded_address->results[0] ) ) {
219
  $result = wp_remote_get(
220
  $geocode_api_url,
221
- array(
222
  'timeout' => 5,
223
  'redirection' => 1,
224
  'httpversion' => '1.1',
225
  'user-agent' => 'WordPress/WP-Job-Manager-' . JOB_MANAGER_VERSION . '; ' . get_bloginfo( 'url' ),
226
  'sslverify' => false,
227
- )
228
  );
229
  $result = wp_remote_retrieve_body( $result );
230
  $geocoded_address = json_decode( $result );
@@ -248,7 +248,7 @@ class WP_Job_Manager_Geocode {
248
  return new WP_Error( 'error', $e->getMessage() );
249
  }
250
 
251
- $address = array();
252
  $address['lat'] = sanitize_text_field( $geocoded_address->results[0]->geometry->location->lat );
253
  $address['long'] = sanitize_text_field( $geocoded_address->results[0]->geometry->location->lng );
254
  $address['formatted_address'] = sanitize_text_field( $geocoded_address->results[0]->formatted_address );
44
  * Constructor.
45
  */
46
  public function __construct() {
47
+ add_filter( 'job_manager_geolocation_endpoint', [ $this, 'add_geolocation_endpoint_query_args' ], 0, 2 );
48
+ add_filter( 'job_manager_geolocation_api_key', [ $this, 'get_google_maps_api_key' ], 0 );
49
+ add_action( 'job_manager_update_job_data', [ $this, 'update_location_data' ], 20, 2 );
50
+ add_action( 'job_manager_job_location_edited', [ $this, 'change_location_data' ], 20, 2 );
51
  }
52
 
53
  /**
186
  * @throws Exception After geocoding error.
187
  */
188
  public static function get_location_data( $raw_address ) {
189
+ $invalid_chars = [
190
  ' ' => '+',
191
  ',' => '',
192
  '?' => '',
193
  '&' => '',
194
  '=' => '',
195
  '#' => '',
196
+ ];
197
  $raw_address = trim( strtolower( str_replace( array_keys( $invalid_chars ), array_values( $invalid_chars ), $raw_address ) ) );
198
 
199
  if ( empty( $raw_address ) ) {
218
  if ( false === $geocoded_address || empty( $geocoded_address->results[0] ) ) {
219
  $result = wp_remote_get(
220
  $geocode_api_url,
221
+ [
222
  'timeout' => 5,
223
  'redirection' => 1,
224
  'httpversion' => '1.1',
225
  'user-agent' => 'WordPress/WP-Job-Manager-' . JOB_MANAGER_VERSION . '; ' . get_bloginfo( 'url' ),
226
  'sslverify' => false,
227
+ ]
228
  );
229
  $result = wp_remote_retrieve_body( $result );
230
  $geocoded_address = json_decode( $result );
248
  return new WP_Error( 'error', $e->getMessage() );
249
  }
250
 
251
+ $address = [];
252
  $address['lat'] = sanitize_text_field( $geocoded_address->results[0]->geometry->location->lat );
253
  $address['long'] = sanitize_text_field( $geocoded_address->results[0]->geometry->location->lng );
254
  $address['formatted_address'] = sanitize_text_field( $geocoded_address->results[0]->formatted_address );
includes/class-wp-job-manager-install.php CHANGED
@@ -57,7 +57,7 @@ class WP_Job_Manager_Install {
57
  update_option( 'job_manager_job_dashboard_page_id', $page_id );
58
  }
59
 
60
- // Scheduled hook was removed in 1.34.0.
61
  if ( wp_next_scheduled( 'job_manager_clear_expired_transients' ) ) {
62
  wp_clear_scheduled_hook( 'job_manager_clear_expired_transients' );
63
  }
@@ -82,11 +82,11 @@ class WP_Job_Manager_Install {
82
  add_role(
83
  'employer',
84
  __( 'Employer', 'wp-job-manager' ),
85
- array(
86
  'read' => true,
87
  'edit_posts' => false,
88
  'delete_posts' => false,
89
- )
90
  );
91
 
92
  $capabilities = self::get_core_capabilities();
@@ -105,11 +105,11 @@ class WP_Job_Manager_Install {
105
  * @return array
106
  */
107
  private static function get_core_capabilities() {
108
- return array(
109
- 'core' => array(
110
  'manage_job_listings',
111
- ),
112
- 'job_listing' => array(
113
  'edit_job_listing',
114
  'read_job_listing',
115
  'delete_job_listing',
@@ -127,8 +127,8 @@ class WP_Job_Manager_Install {
127
  'edit_job_listing_terms',
128
  'delete_job_listing_terms',
129
  'assign_job_listing_terms',
130
- ),
131
- );
132
  }
133
 
134
  /**
@@ -162,25 +162,25 @@ class WP_Job_Manager_Install {
162
  * @return array Default taxonomy terms.
163
  */
164
  private static function get_default_taxonomy_terms() {
165
- return array(
166
- 'job_listing_type' => array(
167
- 'Full Time' => array(
168
  'employment_type' => 'FULL_TIME',
169
- ),
170
- 'Part Time' => array(
171
  'employment_type' => 'PART_TIME',
172
- ),
173
- 'Temporary' => array(
174
  'employment_type' => 'TEMPORARY',
175
- ),
176
- 'Freelance' => array(
177
  'employment_type' => 'CONTRACTOR',
178
- ),
179
- 'Internship' => array(
180
  'employment_type' => 'INTERN',
181
- ),
182
- ),
183
- );
184
  }
185
 
186
  /**
57
  update_option( 'job_manager_job_dashboard_page_id', $page_id );
58
  }
59
 
60
+ // Scheduled hook was removed in 1.33.4.
61
  if ( wp_next_scheduled( 'job_manager_clear_expired_transients' ) ) {
62
  wp_clear_scheduled_hook( 'job_manager_clear_expired_transients' );
63
  }
82
  add_role(
83
  'employer',
84
  __( 'Employer', 'wp-job-manager' ),
85
+ [
86
  'read' => true,
87
  'edit_posts' => false,
88
  'delete_posts' => false,
89
+ ]
90
  );
91
 
92
  $capabilities = self::get_core_capabilities();
105
  * @return array
106
  */
107
  private static function get_core_capabilities() {
108
+ return [
109
+ 'core' => [
110
  'manage_job_listings',
111
+ ],
112
+ 'job_listing' => [
113
  'edit_job_listing',
114
  'read_job_listing',
115
  'delete_job_listing',
127
  'edit_job_listing_terms',
128
  'delete_job_listing_terms',
129
  'assign_job_listing_terms',
130
+ ],
131
+ ];
132
  }
133
 
134
  /**
162
  * @return array Default taxonomy terms.
163
  */
164
  private static function get_default_taxonomy_terms() {
165
+ return [
166
+ 'job_listing_type' => [
167
+ 'Full Time' => [
168
  'employment_type' => 'FULL_TIME',
169
+ ],
170
+ 'Part Time' => [
171
  'employment_type' => 'PART_TIME',
172
+ ],
173
+ 'Temporary' => [
174
  'employment_type' => 'TEMPORARY',
175
+ ],
176
+ 'Freelance' => [
177
  'employment_type' => 'CONTRACTOR',
178
+ ],
179
+ 'Internship' => [
180
  'employment_type' => 'INTERN',
181
+ ],
182
+ ],
183
+ ];
184
  }
185
 
186
  /**
includes/class-wp-job-manager-post-types.php CHANGED
@@ -44,21 +44,21 @@ class WP_Job_Manager_Post_Types {
44
  * Constructor.
45
  */
46
  public function __construct() {
47
- add_action( 'init', array( $this, 'register_post_types' ), 0 );
48
- add_action( 'init', array( $this, 'prepare_block_editor' ) );
49
- add_action( 'init', array( $this, 'register_meta_fields' ) );
50
- add_filter( 'admin_head', array( $this, 'admin_head' ) );
51
- add_action( 'job_manager_check_for_expired_jobs', array( $this, 'check_for_expired_jobs' ) );
52
- add_action( 'job_manager_delete_old_previews', array( $this, 'delete_old_previews' ) );
53
-
54
- add_action( 'pending_to_publish', array( $this, 'set_expiry' ) );
55
- add_action( 'preview_to_publish', array( $this, 'set_expiry' ) );
56
- add_action( 'draft_to_publish', array( $this, 'set_expiry' ) );
57
- add_action( 'auto-draft_to_publish', array( $this, 'set_expiry' ) );
58
- add_action( 'expired_to_publish', array( $this, 'set_expiry' ) );
59
-
60
- add_action( 'wp_head', array( $this, 'noindex_expired_filled_job_listings' ) );
61
- add_action( 'wp_footer', array( $this, 'output_structured_data' ) );
62
 
63
  add_filter( 'the_job_description', 'wptexturize' );
64
  add_filter( 'the_job_description', 'convert_smilies' );
@@ -67,22 +67,22 @@ class WP_Job_Manager_Post_Types {
67
  add_filter( 'the_job_description', 'shortcode_unautop' );
68
  add_filter( 'the_job_description', 'prepend_attachment' );
69
  if ( ! empty( $GLOBALS['wp_embed'] ) ) {
70
- add_filter( 'the_job_description', array( $GLOBALS['wp_embed'], 'run_shortcode' ), 8 );
71
- add_filter( 'the_job_description', array( $GLOBALS['wp_embed'], 'autoembed' ), 8 );
72
  }
73
 
74
- add_action( 'job_manager_application_details_email', array( $this, 'application_details_email' ) );
75
- add_action( 'job_manager_application_details_url', array( $this, 'application_details_url' ) );
76
 
77
- add_filter( 'wp_insert_post_data', array( $this, 'fix_post_name' ), 10, 2 );
78
- add_action( 'add_post_meta', array( $this, 'maybe_add_geolocation_data' ), 10, 3 );
79
- add_action( 'update_post_meta', array( $this, 'update_post_meta' ), 10, 4 );
80
- add_action( 'wp_insert_post', array( $this, 'maybe_add_default_meta_data' ), 10, 2 );
81
- add_filter( 'post_types_to_delete_with_user', array( $this, 'delete_user_add_job_listings_post_type' ) );
82
 
83
- add_action( 'transition_post_status', array( $this, 'track_job_submission' ), 10, 3 );
84
 
85
- add_action( 'parse_query', array( $this, 'add_feed_query_args' ) );
86
 
87
  // Single job content.
88
  $this->job_content_filter( true );
@@ -92,10 +92,10 @@ class WP_Job_Manager_Post_Types {
92
  * Prepare CPTs for special block editor situations.
93
  */
94
  public function prepare_block_editor() {
95
- add_filter( 'allowed_block_types', array( $this, 'force_classic_block' ), 10, 2 );
96
 
97
  if ( false === job_manager_multi_job_type() ) {
98
- add_filter( 'rest_prepare_taxonomy', array( $this, 'hide_job_type_block_editor_selector' ), 10, 3 );
99
  }
100
  }
101
 
@@ -109,7 +109,7 @@ class WP_Job_Manager_Post_Types {
109
  */
110
  public function force_classic_block( $allowed_block_types, $post ) {
111
  if ( 'job_listing' === $post->post_type ) {
112
- return array( 'core/freeform' );
113
  }
114
  return $allowed_block_types;
115
  }
@@ -155,11 +155,11 @@ class WP_Job_Manager_Post_Types {
155
  $plural = __( 'Job categories', 'wp-job-manager' );
156
 
157
  if ( current_theme_supports( 'job-manager-templates' ) ) {
158
- $rewrite = array(
159
  'slug' => $permalink_structure['category_rewrite_slug'],
160
  'with_front' => false,
161
  'hierarchical' => false,
162
- );
163
  $public = true;
164
  } else {
165
  $rewrite = false;
@@ -168,14 +168,14 @@ class WP_Job_Manager_Post_Types {
168
 
169
  register_taxonomy(
170
  'job_listing_category',
171
- apply_filters( 'register_taxonomy_job_listing_category_object_type', array( 'job_listing' ) ),
172
  apply_filters(
173
  'register_taxonomy_job_listing_category_args',
174
- array(
175
  'hierarchical' => true,
176
  'update_count_callback' => '_update_post_term_count',
177
  'label' => $plural,
178
- 'labels' => array(
179
  'name' => $plural,
180
  'singular_name' => $singular,
181
  'menu_name' => ucwords( $plural ),
@@ -195,21 +195,21 @@ class WP_Job_Manager_Post_Types {
195
  'add_new_item' => sprintf( __( 'Add New %s', 'wp-job-manager' ), $singular ),
196
  // translators: Placeholder %s is the singular label of the job listing category taxonomy type.
197
  'new_item_name' => sprintf( __( 'New %s Name', 'wp-job-manager' ), $singular ),
198
- ),
199
  'show_ui' => true,
200
  'show_tagcloud' => false,
201
  'public' => $public,
202
- 'capabilities' => array(
203
  'manage_terms' => $admin_capability,
204
  'edit_terms' => $admin_capability,
205
  'delete_terms' => $admin_capability,
206
  'assign_terms' => $admin_capability,
207
- ),
208
  'rewrite' => $rewrite,
209
  'show_in_rest' => true,
210
  'rest_base' => 'job-categories',
211
 
212
- )
213
  )
214
  );
215
  }
@@ -219,11 +219,11 @@ class WP_Job_Manager_Post_Types {
219
  $plural = __( 'Job types', 'wp-job-manager' );
220
 
221
  if ( current_theme_supports( 'job-manager-templates' ) ) {
222
- $rewrite = array(
223
  'slug' => $permalink_structure['type_rewrite_slug'],
224
  'with_front' => false,
225
  'hierarchical' => false,
226
- );
227
  $public = true;
228
  } else {
229
  $rewrite = false;
@@ -232,13 +232,13 @@ class WP_Job_Manager_Post_Types {
232
 
233
  register_taxonomy(
234
  'job_listing_type',
235
- apply_filters( 'register_taxonomy_job_listing_type_object_type', array( 'job_listing' ) ),
236
  apply_filters(
237
  'register_taxonomy_job_listing_type_args',
238
- array(
239
  'hierarchical' => true,
240
  'label' => $plural,
241
- 'labels' => array(
242
  'name' => $plural,
243
  'singular_name' => $singular,
244
  'menu_name' => ucwords( $plural ),
@@ -258,35 +258,35 @@ class WP_Job_Manager_Post_Types {
258
  'add_new_item' => sprintf( __( 'Add New %s', 'wp-job-manager' ), $singular ),
259
  // translators: Placeholder %s is the singular label of the job listing job type taxonomy type.
260
  'new_item_name' => sprintf( __( 'New %s Name', 'wp-job-manager' ), $singular ),
261
- ),
262
  'show_ui' => true,
263
  'show_tagcloud' => false,
264
  'public' => $public,
265
- 'capabilities' => array(
266
  'manage_terms' => $admin_capability,
267
  'edit_terms' => $admin_capability,
268
  'delete_terms' => $admin_capability,
269
  'assign_terms' => $admin_capability,
270
- ),
271
  'rewrite' => $rewrite,
272
  'show_in_rest' => true,
273
  'rest_base' => 'job-types',
274
- 'meta_box_sanitize_cb' => array( $this, 'sanitize_job_type_meta_box_input' ),
275
- )
276
  )
277
  );
278
  if ( function_exists( 'wpjm_job_listing_employment_type_enabled' ) && wpjm_job_listing_employment_type_enabled() ) {
279
  register_meta(
280
  'term',
281
  'employment_type',
282
- array(
283
  'object_subtype' => 'job_listing_type',
284
  'show_in_rest' => true,
285
  'type' => 'string',
286
  'single' => true,
287
  'description' => esc_html__( 'Employment Type', 'wp-job-manager' ),
288
- 'sanitize_callback' => array( $this, 'sanitize_employment_type' ),
289
- )
290
  );
291
  }
292
  }
@@ -310,19 +310,19 @@ class WP_Job_Manager_Post_Types {
310
  $has_archive = false;
311
  }
312
 
313
- $rewrite = array(
314
  'slug' => $permalink_structure['job_rewrite_slug'],
315
  'with_front' => false,
316
  'feeds' => true,
317
  'pages' => false,
318
- );
319
 
320
  register_post_type(
321
  'job_listing',
322
  apply_filters(
323
  'register_post_type_job_listing',
324
- array(
325
- 'labels' => array(
326
  'name' => $plural,
327
  'singular_name' => $singular,
328
  'menu_name' => __( 'Job Listings', 'wp-job-manager' ),
@@ -352,7 +352,7 @@ class WP_Job_Manager_Post_Types {
352
  'set_featured_image' => __( 'Set company logo', 'wp-job-manager' ),
353
  'remove_featured_image' => __( 'Remove company logo', 'wp-job-manager' ),
354
  'use_featured_image' => __( 'Use as company logo', 'wp-job-manager' ),
355
- ),
356
  // translators: Placeholder %s is the plural label of the job listing post type.
357
  'description' => sprintf( __( 'This is where you can create and manage %s.', 'wp-job-manager' ), $plural ),
358
  'public' => true,
@@ -364,30 +364,31 @@ class WP_Job_Manager_Post_Types {
364
  'hierarchical' => false,
365
  'rewrite' => $rewrite,
366
  'query_var' => true,
367
- 'supports' => array( 'title', 'editor', 'custom-fields', 'publicize', 'thumbnail' ),
368
  'has_archive' => $has_archive,
369
  'show_in_nav_menus' => false,
370
  'delete_with_user' => true,
371
  'show_in_rest' => true,
372
  'rest_base' => 'job-listings',
373
  'rest_controller_class' => 'WP_REST_Posts_Controller',
374
- 'template' => array( array( 'core/freeform' ) ),
375
  'template_lock' => 'all',
376
- )
 
377
  )
378
  );
379
 
380
  /**
381
  * Feeds
382
  */
383
- add_feed( self::get_job_feed_name(), array( $this, 'job_feed' ) );
384
 
385
  /**
386
  * Post status
387
  */
388
  register_post_status(
389
  'expired',
390
- array(
391
  'label' => _x( 'Expired', 'post status', 'wp-job-manager' ),
392
  'public' => true,
393
  'protected' => true,
@@ -396,11 +397,11 @@ class WP_Job_Manager_Post_Types {
396
  'show_in_admin_status_list' => true,
397
  // translators: Placeholder %s is the number of expired posts of this type.
398
  'label_count' => _n_noop( 'Expired <span class="count">(%s)</span>', 'Expired <span class="count">(%s)</span>', 'wp-job-manager' ),
399
- )
400
  );
401
  register_post_status(
402
  'preview',
403
- array(
404
  'label' => _x( 'Preview', 'post status', 'wp-job-manager' ),
405
  'public' => false,
406
  'exclude_from_search' => true,
@@ -408,7 +409,7 @@ class WP_Job_Manager_Post_Types {
408
  'show_in_admin_status_list' => true,
409
  // translators: Placeholder %s is the number of posts in a preview state.
410
  'label_count' => _n_noop( 'Preview <span class="count">(%s)</span>', 'Preview <span class="count">(%s)</span>', 'wp-job-manager' ),
411
- )
412
  );
413
  }
414
 
@@ -466,8 +467,8 @@ class WP_Job_Manager_Post_Types {
466
  'job_manager_kses_allowed_html',
467
  array_replace_recursive( // phpcs:ignore PHPCompatibility.FunctionUse.NewFunctions.array_replace_recursiveFound
468
  wp_kses_allowed_html( 'post' ),
469
- array(
470
- 'iframe' => array(
471
  'src' => true,
472
  'width' => true,
473
  'height' => true,
@@ -478,8 +479,8 @@ class WP_Job_Manager_Post_Types {
478
  'title' => true,
479
  'allow' => true,
480
  'allowfullscreen' => true,
481
- ),
482
- )
483
  )
484
  );
485
  }
@@ -505,9 +506,9 @@ class WP_Job_Manager_Post_Types {
505
  */
506
  private function job_content_filter( $enable ) {
507
  if ( ! $enable ) {
508
- remove_filter( 'the_content', array( $this, 'job_content' ) );
509
  } else {
510
- add_filter( 'the_content', array( $this, 'job_content' ) );
511
  }
512
  }
513
 
@@ -553,48 +554,48 @@ class WP_Job_Manager_Post_Types {
553
  $job_manager_keyword = isset( $_GET['search_keywords'] ) ? sanitize_text_field( wp_unslash( $_GET['search_keywords'] ) ) : '';
554
  // phpcs:enable WordPress.Security.NonceVerification.Recommended
555
 
556
- $query_args = array(
557
  'post_type' => 'job_listing',
558
  'post_status' => 'publish',
559
  'ignore_sticky_posts' => 1,
560
  'posts_per_page' => $input_posts_per_page,
561
  'paged' => absint( get_query_var( 'paged', 1 ) ),
562
- 'tax_query' => array(),
563
- 'meta_query' => array(),
564
- );
565
 
566
  if ( ! empty( $input_search_location ) ) {
567
- $location_meta_keys = array( 'geolocation_formatted_address', '_job_location', 'geolocation_state_long' );
568
- $location_search = array( 'relation' => 'OR' );
569
  foreach ( $location_meta_keys as $meta_key ) {
570
- $location_search[] = array(
571
  'key' => $meta_key,
572
  'value' => $input_search_location,
573
  'compare' => 'like',
574
- );
575
  }
576
  $query_args['meta_query'][] = $location_search;
577
  }
578
 
579
  if ( ! empty( $input_job_types ) ) {
580
- $query_args['tax_query'][] = array(
581
  'taxonomy' => 'job_listing_type',
582
  'field' => 'slug',
583
- 'terms' => $input_job_types + array( 0 ),
584
- );
585
  }
586
 
587
  if ( ! empty( $input_job_categories ) ) {
588
- $cats = $input_job_categories + array( 0 );
589
  $field = is_numeric( $cats ) ? 'term_id' : 'slug';
590
  $operator = 'all' === get_option( 'job_manager_category_filter_type', 'all' ) && count( $cats ) > 1 ? 'AND' : 'IN';
591
- $query_args['tax_query'][] = array(
592
  'taxonomy' => 'job_listing_category',
593
  'field' => $field,
594
  'terms' => $cats,
595
  'include_children' => 'AND' !== $operator,
596
  'operator' => $operator,
597
- );
598
  }
599
 
600
  if ( ! empty( $job_manager_keyword ) ) {
@@ -612,8 +613,8 @@ class WP_Job_Manager_Post_Types {
612
 
613
  // phpcs:ignore WordPress.WP.DiscouragedFunctions
614
  query_posts( apply_filters( 'job_feed_args', $query_args ) );
615
- add_action( 'rss2_ns', array( $this, 'job_feed_namespace' ) );
616
- add_action( 'rss2_item', array( $this, 'job_feed_item' ) );
617
  do_feed_rss2( false );
618
  remove_filter( 'posts_search', 'get_job_listings_keyword_search' );
619
  }
@@ -684,30 +685,30 @@ class WP_Job_Manager_Post_Types {
684
  public function check_for_expired_jobs() {
685
  // Change status to expired.
686
  $job_ids = get_posts(
687
- array(
688
  'post_type' => 'job_listing',
689
  'post_status' => 'publish',
690
  'fields' => 'ids',
691
  'posts_per_page' => -1,
692
- 'meta_query' => array(
693
  'relation' => 'AND',
694
- array(
695
  'key' => '_job_expires',
696
  'value' => 0,
697
  'compare' => '>',
698
- ),
699
- array(
700
  'key' => '_job_expires',
701
  'value' => date( 'Y-m-d', current_time( 'timestamp' ) ),
702
  'compare' => '<',
703
- ),
704
- ),
705
- )
706
  );
707
 
708
  if ( $job_ids ) {
709
  foreach ( $job_ids as $job_id ) {
710
- $job_data = array();
711
  $job_data['ID'] = $job_id;
712
  $job_data['post_status'] = 'expired';
713
  wp_update_post( $job_data );
@@ -734,18 +735,18 @@ class WP_Job_Manager_Post_Types {
734
  $delete_expired_jobs_days = apply_filters( 'job_manager_delete_expired_jobs_days', 30 );
735
 
736
  $job_ids = get_posts(
737
- array(
738
  'post_type' => 'job_listing',
739
  'post_status' => 'expired',
740
  'fields' => 'ids',
741
- 'date_query' => array(
742
- array(
743
  'column' => 'post_modified',
744
  'before' => date( 'Y-m-d', strtotime( '-' . $delete_expired_jobs_days . ' days', current_time( 'timestamp' ) ) ),
745
- ),
746
- ),
747
  'posts_per_page' => -1,
748
- )
749
  );
750
 
751
  if ( $job_ids ) {
@@ -762,18 +763,18 @@ class WP_Job_Manager_Post_Types {
762
  public function delete_old_previews() {
763
  // Delete old jobs stuck in preview.
764
  $job_ids = get_posts(
765
- array(
766
  'post_type' => 'job_listing',
767
  'post_status' => 'preview',
768
  'fields' => 'ids',
769
- 'date_query' => array(
770
- array(
771
  'column' => 'post_modified',
772
  'before' => date( 'Y-m-d', strtotime( '-30 days', current_time( 'timestamp' ) ) ),
773
- ),
774
- ),
775
  'posts_per_page' => -1,
776
- )
777
  );
778
 
779
  if ( $job_ids ) {
@@ -837,7 +838,7 @@ class WP_Job_Manager_Post_Types {
837
  * @param stdClass $apply
838
  */
839
  public function application_details_email( $apply ) {
840
- get_job_manager_template( 'job-application-email.php', array( 'apply' => $apply ) );
841
  }
842
 
843
  /**
@@ -846,7 +847,7 @@ class WP_Job_Manager_Post_Types {
846
  * @param stdClass $apply
847
  */
848
  public function application_details_url( $apply ) {
849
- get_job_manager_template( 'job-application-url.php', array( 'apply' => $apply ) );
850
  }
851
 
852
  /**
@@ -898,7 +899,7 @@ class WP_Job_Manager_Post_Types {
898
  */
899
  $legacy_permalink_settings = '[]';
900
  if ( false !== get_option( 'wpjm_permalinks', false ) ) {
901
- $legacy_permalink_settings = wp_json_encode( get_option( 'wpjm_permalinks', array() ) );
902
  delete_option( 'wpjm_permalinks' );
903
  }
904
 
@@ -933,12 +934,12 @@ class WP_Job_Manager_Post_Types {
933
 
934
  $permalinks = wp_parse_args(
935
  $permalink_settings,
936
- array(
937
  'job_base' => '',
938
  'category_base' => '',
939
  'type_base' => '',
940
  'jobs_archive' => '',
941
- )
942
  );
943
 
944
  // Ensure rewrite slugs are set. Use legacy translation options if not.
@@ -981,7 +982,6 @@ class WP_Job_Manager_Post_Types {
981
  return;
982
  }
983
 
984
- remove_action( 'update_post_meta', array( $this, 'update_post_meta' ) );
985
  switch ( $meta_key ) {
986
  case '_job_location':
987
  $this->maybe_update_geolocation_data( $meta_id, $object_id, $meta_key, $meta_value );
@@ -990,7 +990,6 @@ class WP_Job_Manager_Post_Types {
990
  $this->maybe_update_menu_order( $meta_id, $object_id, $meta_key, $meta_value );
991
  break;
992
  }
993
- add_action( 'update_post_meta', array( $this, 'update_post_meta' ), 10, 4 );
994
  }
995
 
996
  /**
@@ -1014,25 +1013,28 @@ class WP_Job_Manager_Post_Types {
1014
  * @param mixed $meta_value
1015
  */
1016
  public function maybe_update_menu_order( $meta_id, $object_id, $meta_key, $meta_value ) {
 
 
1017
  if ( 1 === intval( $meta_value ) ) {
1018
- wp_update_post(
1019
- array(
 
 
 
 
 
 
 
 
 
 
1020
  'ID' => $object_id,
1021
  'menu_order' => -1,
1022
- )
1023
  );
1024
- } else {
1025
- $post = get_post( $object_id );
1026
-
1027
- if ( -1 === intval( $post->menu_order ) ) {
1028
- wp_update_post(
1029
- array(
1030
- 'ID' => $object_id,
1031
- 'menu_order' => 0,
1032
- )
1033
- );
1034
- }
1035
  }
 
 
1036
  }
1037
 
1038
  /**
@@ -1089,9 +1091,9 @@ class WP_Job_Manager_Post_Types {
1089
  // Track approving a new job listing.
1090
  WP_Job_Manager_Usage_Tracking::track_job_approval(
1091
  $post->ID,
1092
- array(
1093
  'source' => $source,
1094
- )
1095
  );
1096
 
1097
  return;
@@ -1099,10 +1101,10 @@ class WP_Job_Manager_Post_Types {
1099
 
1100
  WP_Job_Manager_Usage_Tracking::track_job_submission(
1101
  $post->ID,
1102
- array(
1103
  'source' => $source,
1104
  'old_status' => $old_status,
1105
- )
1106
  );
1107
  }
1108
 
@@ -1169,7 +1171,7 @@ class WP_Job_Manager_Post_Types {
1169
  register_meta(
1170
  'post',
1171
  $meta_key,
1172
- array(
1173
  'type' => $field['data_type'],
1174
  'show_in_rest' => $field['show_in_rest'],
1175
  'description' => $field['label'],
@@ -1177,7 +1179,7 @@ class WP_Job_Manager_Post_Types {
1177
  'auth_callback' => $field['auth_edit_callback'],
1178
  'single' => true,
1179
  'object_subtype' => 'job_listing',
1180
- )
1181
  );
1182
  }
1183
  }
@@ -1188,22 +1190,22 @@ class WP_Job_Manager_Post_Types {
1188
  * @return array See `job_manager_job_listing_data_fields` filter for more documentation.
1189
  */
1190
  public static function get_job_listing_fields() {
1191
- $default_field = array(
1192
  'label' => null,
1193
  'placeholder' => null,
1194
  'description' => null,
1195
  'priority' => 10,
1196
  'value' => null,
1197
  'default' => null,
1198
- 'classes' => array(),
1199
  'type' => 'text',
1200
  'data_type' => 'string',
1201
  'show_in_admin' => true,
1202
  'show_in_rest' => false,
1203
- 'auth_edit_callback' => array( __CLASS__, 'auth_check_can_edit_job_listings' ),
1204
  'auth_view_callback' => null,
1205
- 'sanitize_callback' => array( __CLASS__, 'sanitize_meta_field_based_on_input_type' ),
1206
- );
1207
 
1208
  $allowed_application_method = get_option( 'job_manager_allowed_application_method', '' );
1209
  $application_method_label = __( 'Application email/URL', 'wp-job-manager' );
@@ -1217,8 +1219,8 @@ class WP_Job_Manager_Post_Types {
1217
  $application_method_placeholder = __( 'https://', 'wp-job-manager' );
1218
  }
1219
 
1220
- $fields = array(
1221
- '_job_location' => array(
1222
  'label' => __( 'Location', 'wp-job-manager' ),
1223
  'placeholder' => __( 'e.g. "London"', 'wp-job-manager' ),
1224
  'description' => __( 'Leave this blank if the location is not important.', 'wp-job-manager' ),
@@ -1226,8 +1228,8 @@ class WP_Job_Manager_Post_Types {
1226
  'data_type' => 'string',
1227
  'show_in_admin' => true,
1228
  'show_in_rest' => true,
1229
- ),
1230
- '_application' => array(
1231
  'label' => $application_method_label,
1232
  'placeholder' => $application_method_placeholder,
1233
  'description' => __( 'This field is required for the "application" area to appear beneath the listing.', 'wp-job-manager' ),
@@ -1235,42 +1237,42 @@ class WP_Job_Manager_Post_Types {
1235
  'data_type' => 'string',
1236
  'show_in_admin' => true,
1237
  'show_in_rest' => true,
1238
- 'sanitize_callback' => array( __CLASS__, 'sanitize_meta_field_application' ),
1239
- ),
1240
- '_company_name' => array(
1241
  'label' => __( 'Company Name', 'wp-job-manager' ),
1242
  'placeholder' => '',
1243
  'priority' => 3,
1244
  'data_type' => 'string',
1245
  'show_in_admin' => true,
1246
  'show_in_rest' => true,
1247
- ),
1248
- '_company_website' => array(
1249
  'label' => __( 'Company Website', 'wp-job-manager' ),
1250
  'placeholder' => '',
1251
  'priority' => 4,
1252
  'data_type' => 'string',
1253
  'show_in_admin' => true,
1254
  'show_in_rest' => true,
1255
- 'sanitize_callback' => array( __CLASS__, 'sanitize_meta_field_url' ),
1256
- ),
1257
- '_company_tagline' => array(
1258
  'label' => __( 'Company Tagline', 'wp-job-manager' ),
1259
  'placeholder' => __( 'Brief description about the company', 'wp-job-manager' ),
1260
  'priority' => 5,
1261
  'data_type' => 'string',
1262
  'show_in_admin' => true,
1263
  'show_in_rest' => true,
1264
- ),
1265
- '_company_twitter' => array(
1266
  'label' => __( 'Company Twitter', 'wp-job-manager' ),
1267
  'placeholder' => '@yourcompany',
1268
  'priority' => 6,
1269
  'data_type' => 'string',
1270
  'show_in_admin' => true,
1271
  'show_in_rest' => true,
1272
- ),
1273
- '_company_video' => array(
1274
  'label' => __( 'Company Video', 'wp-job-manager' ),
1275
  'placeholder' => __( 'URL to the company video', 'wp-job-manager' ),
1276
  'type' => 'file',
@@ -1278,9 +1280,9 @@ class WP_Job_Manager_Post_Types {
1278
  'data_type' => 'string',
1279
  'show_in_admin' => true,
1280
  'show_in_rest' => true,
1281
- 'sanitize_callback' => array( __CLASS__, 'sanitize_meta_field_url' ),
1282
- ),
1283
- '_filled' => array(
1284
  'label' => __( 'Position Filled', 'wp-job-manager' ),
1285
  'type' => 'checkbox',
1286
  'priority' => 9,
@@ -1288,8 +1290,8 @@ class WP_Job_Manager_Post_Types {
1288
  'show_in_admin' => true,
1289
  'show_in_rest' => true,
1290
  'description' => __( 'Filled listings will no longer accept applications.', 'wp-job-manager' ),
1291
- ),
1292
- '_featured' => array(
1293
  'label' => __( 'Featured Listing', 'wp-job-manager' ),
1294
  'type' => 'checkbox',
1295
  'description' => __( 'Featured listings will be sticky during searches, and can be styled differently.', 'wp-job-manager' ),
@@ -1297,20 +1299,20 @@ class WP_Job_Manager_Post_Types {
1297
  'data_type' => 'integer',
1298
  'show_in_admin' => true,
1299
  'show_in_rest' => true,
1300
- 'auth_edit_callback' => array( __CLASS__, 'auth_check_can_manage_job_listings' ),
1301
- ),
1302
- '_job_expires' => array(
1303
  'label' => __( 'Listing Expiry Date', 'wp-job-manager' ),
1304
  'priority' => 11,
1305
  'show_in_admin' => true,
1306
  'show_in_rest' => true,
1307
  'data_type' => 'string',
1308
- 'classes' => array( 'job-manager-datepicker' ),
1309
- 'auth_edit_callback' => array( __CLASS__, 'auth_check_can_manage_job_listings' ),
1310
- 'auth_view_callback' => array( __CLASS__, 'auth_check_can_edit_job_listings' ),
1311
- 'sanitize_callback' => array( __CLASS__, 'sanitize_meta_field_date' ),
1312
- ),
1313
- );
1314
 
1315
  /**
1316
  * Filters job listing data fields.
44
  * Constructor.
45
  */
46
  public function __construct() {
47
+ add_action( 'init', [ $this, 'register_post_types' ], 0 );
48
+ add_action( 'init', [ $this, 'prepare_block_editor' ] );
49
+ add_action( 'init', [ $this, 'register_meta_fields' ] );
50
+ add_filter( 'admin_head', [ $this, 'admin_head' ] );
51
+ add_action( 'job_manager_check_for_expired_jobs', [ $this, 'check_for_expired_jobs' ] );
52
+ add_action( 'job_manager_delete_old_previews', [ $this, 'delete_old_previews' ] );
53
+
54
+ add_action( 'pending_to_publish', [ $this, 'set_expiry' ] );
55
+ add_action( 'preview_to_publish', [ $this, 'set_expiry' ] );
56
+ add_action( 'draft_to_publish', [ $this, 'set_expiry' ] );
57
+ add_action( 'auto-draft_to_publish', [ $this, 'set_expiry' ] );
58
+ add_action( 'expired_to_publish', [ $this, 'set_expiry' ] );
59
+
60
+ add_action( 'wp_head', [ $this, 'noindex_expired_filled_job_listings' ] );
61
+ add_action( 'wp_footer', [ $this, 'output_structured_data' ] );
62
 
63
  add_filter( 'the_job_description', 'wptexturize' );
64
  add_filter( 'the_job_description', 'convert_smilies' );
67
  add_filter( 'the_job_description', 'shortcode_unautop' );
68
  add_filter( 'the_job_description', 'prepend_attachment' );
69
  if ( ! empty( $GLOBALS['wp_embed'] ) ) {
70
+ add_filter( 'the_job_description', [ $GLOBALS['wp_embed'], 'run_shortcode' ], 8 );
71
+ add_filter( 'the_job_description', [ $GLOBALS['wp_embed'], 'autoembed' ], 8 );
72
  }
73
 
74
+ add_action( 'job_manager_application_details_email', [ $this, 'application_details_email' ] );
75
+ add_action( 'job_manager_application_details_url', [ $this, 'application_details_url' ] );
76
 
77
+ add_filter( 'wp_insert_post_data', [ $this, 'fix_post_name' ], 10, 2 );
78
+ add_action( 'add_post_meta', [ $this, 'maybe_add_geolocation_data' ], 10, 3 );
79
+ add_action( 'update_post_meta', [ $this, 'update_post_meta' ], 10, 4 );
80
+ add_action( 'wp_insert_post', [ $this, 'maybe_add_default_meta_data' ], 10, 2 );
81
+ add_filter( 'post_types_to_delete_with_user', [ $this, 'delete_user_add_job_listings_post_type' ] );
82
 
83
+ add_action( 'transition_post_status', [ $this, 'track_job_submission' ], 10, 3 );
84
 
85
+ add_action( 'parse_query', [ $this, 'add_feed_query_args' ] );
86
 
87
  // Single job content.
88
  $this->job_content_filter( true );
92
  * Prepare CPTs for special block editor situations.
93
  */
94
  public function prepare_block_editor() {
95
+ add_filter( 'allowed_block_types', [ $this, 'force_classic_block' ], 10, 2 );
96
 
97
  if ( false === job_manager_multi_job_type() ) {
98
+ add_filter( 'rest_prepare_taxonomy', [ $this, 'hide_job_type_block_editor_selector' ], 10, 3 );
99
  }
100
  }
101
 
109
  */
110
  public function force_classic_block( $allowed_block_types, $post ) {
111
  if ( 'job_listing' === $post->post_type ) {
112
+ return [ 'core/freeform' ];
113
  }
114
  return $allowed_block_types;
115
  }
155
  $plural = __( 'Job categories', 'wp-job-manager' );
156
 
157
  if ( current_theme_supports( 'job-manager-templates' ) ) {
158
+ $rewrite = [
159
  'slug' => $permalink_structure['category_rewrite_slug'],
160
  'with_front' => false,
161
  'hierarchical' => false,
162
+ ];
163
  $public = true;
164
  } else {
165
  $rewrite = false;
168
 
169
  register_taxonomy(
170
  'job_listing_category',
171
+ apply_filters( 'register_taxonomy_job_listing_category_object_type', [ 'job_listing' ] ),
172
  apply_filters(
173
  'register_taxonomy_job_listing_category_args',
174
+ [
175
  'hierarchical' => true,
176
  'update_count_callback' => '_update_post_term_count',
177
  'label' => $plural,
178
+ 'labels' => [
179
  'name' => $plural,
180
  'singular_name' => $singular,
181
  'menu_name' => ucwords( $plural ),
195
  'add_new_item' => sprintf( __( 'Add New %s', 'wp-job-manager' ), $singular ),
196
  // translators: Placeholder %s is the singular label of the job listing category taxonomy type.
197
  'new_item_name' => sprintf( __( 'New %s Name', 'wp-job-manager' ), $singular ),
198
+ ],
199
  'show_ui' => true,
200
  'show_tagcloud' => false,
201
  'public' => $public,
202
+ 'capabilities' => [
203
  'manage_terms' => $admin_capability,
204
  'edit_terms' => $admin_capability,
205
  'delete_terms' => $admin_capability,
206
  'assign_terms' => $admin_capability,
207
+ ],
208
  'rewrite' => $rewrite,
209
  'show_in_rest' => true,
210
  'rest_base' => 'job-categories',
211
 
212
+ ]
213
  )
214
  );
215
  }
219
  $plural = __( 'Job types', 'wp-job-manager' );
220
 
221
  if ( current_theme_supports( 'job-manager-templates' ) ) {
222
+ $rewrite = [
223
  'slug' => $permalink_structure['type_rewrite_slug'],
224
  'with_front' => false,
225
  'hierarchical' => false,
226
+ ];
227
  $public = true;
228
  } else {
229
  $rewrite = false;
232
 
233
  register_taxonomy(
234
  'job_listing_type',
235
+ apply_filters( 'register_taxonomy_job_listing_type_object_type', [ 'job_listing' ] ),
236
  apply_filters(
237
  'register_taxonomy_job_listing_type_args',
238
+ [
239
  'hierarchical' => true,
240
  'label' => $plural,
241
+ 'labels' => [
242
  'name' => $plural,
243
  'singular_name' => $singular,
244
  'menu_name' => ucwords( $plural ),
258
  'add_new_item' => sprintf( __( 'Add New %s', 'wp-job-manager' ), $singular ),
259
  // translators: Placeholder %s is the singular label of the job listing job type taxonomy type.
260
  'new_item_name' => sprintf( __( 'New %s Name', 'wp-job-manager' ), $singular ),
261
+ ],
262
  'show_ui' => true,
263
  'show_tagcloud' => false,
264
  'public' => $public,
265
+ 'capabilities' => [
266
  'manage_terms' => $admin_capability,
267
  'edit_terms' => $admin_capability,
268
  'delete_terms' => $admin_capability,
269
  'assign_terms' => $admin_capability,
270
+ ],
271
  'rewrite' => $rewrite,
272
  'show_in_rest' => true,
273
  'rest_base' => 'job-types',
274
+ 'meta_box_sanitize_cb' => [ $this, 'sanitize_job_type_meta_box_input' ],
275
+ ]
276
  )
277
  );
278
  if ( function_exists( 'wpjm_job_listing_employment_type_enabled' ) && wpjm_job_listing_employment_type_enabled() ) {
279
  register_meta(
280
  'term',
281
  'employment_type',
282
+ [
283
  'object_subtype' => 'job_listing_type',
284
  'show_in_rest' => true,
285
  'type' => 'string',
286
  'single' => true,
287
  'description' => esc_html__( 'Employment Type', 'wp-job-manager' ),
288
+ 'sanitize_callback' => [ $this, 'sanitize_employment_type' ],
289
+ ]
290
  );
291
  }
292
  }
310
  $has_archive = false;
311
  }
312
 
313
+ $rewrite = [
314
  'slug' => $permalink_structure['job_rewrite_slug'],
315
  'with_front' => false,
316
  'feeds' => true,
317
  'pages' => false,
318
+ ];
319
 
320
  register_post_type(
321
  'job_listing',
322
  apply_filters(
323
  'register_post_type_job_listing',
324
+ [
325
+ 'labels' => [
326
  'name' => $plural,
327
  'singular_name' => $singular,
328
  'menu_name' => __( 'Job Listings', 'wp-job-manager' ),
352
  'set_featured_image' => __( 'Set company logo', 'wp-job-manager' ),
353
  'remove_featured_image' => __( 'Remove company logo', 'wp-job-manager' ),
354
  'use_featured_image' => __( 'Use as company logo', 'wp-job-manager' ),
355
+ ],
356
  // translators: Placeholder %s is the plural label of the job listing post type.
357
  'description' => sprintf( __( 'This is where you can create and manage %s.', 'wp-job-manager' ), $plural ),
358
  'public' => true,
364
  'hierarchical' => false,
365
  'rewrite' => $rewrite,
366
  'query_var' => true,
367
+ 'supports' => [ 'title', 'editor', 'custom-fields', 'publicize', 'thumbnail', 'author' ],
368
  'has_archive' => $has_archive,
369
  'show_in_nav_menus' => false,
370
  'delete_with_user' => true,
371
  'show_in_rest' => true,
372
  'rest_base' => 'job-listings',
373
  'rest_controller_class' => 'WP_REST_Posts_Controller',
374
+ 'template' => [ [ 'core/freeform' ] ],
375
  'template_lock' => 'all',
376
+ 'menu_position' => 30,
377
+ ]
378
  )
379
  );
380
 
381
  /**
382
  * Feeds
383
  */
384
+ add_feed( self::get_job_feed_name(), [ $this, 'job_feed' ] );
385
 
386
  /**
387
  * Post status
388
  */
389
  register_post_status(
390
  'expired',
391
+ [
392
  'label' => _x( 'Expired', 'post status', 'wp-job-manager' ),
393
  'public' => true,
394
  'protected' => true,
397
  'show_in_admin_status_list' => true,
398
  // translators: Placeholder %s is the number of expired posts of this type.
399
  'label_count' => _n_noop( 'Expired <span class="count">(%s)</span>', 'Expired <span class="count">(%s)</span>', 'wp-job-manager' ),
400
+ ]
401
  );
402
  register_post_status(
403
  'preview',
404
+ [
405
  'label' => _x( 'Preview', 'post status', 'wp-job-manager' ),
406
  'public' => false,
407
  'exclude_from_search' => true,
409
  'show_in_admin_status_list' => true,
410
  // translators: Placeholder %s is the number of posts in a preview state.
411
  'label_count' => _n_noop( 'Preview <span class="count">(%s)</span>', 'Preview <span class="count">(%s)</span>', 'wp-job-manager' ),
412
+ ]
413
  );
414
  }
415
 
467
  'job_manager_kses_allowed_html',
468
  array_replace_recursive( // phpcs:ignore PHPCompatibility.FunctionUse.NewFunctions.array_replace_recursiveFound
469
  wp_kses_allowed_html( 'post' ),
470
+ [
471
+ 'iframe' => [
472
  'src' => true,
473
  'width' => true,
474
  'height' => true,
479
  'title' => true,
480
  'allow' => true,
481
  'allowfullscreen' => true,
482
+ ],
483
+ ]
484
  )
485
  );
486
  }
506
  */
507
  private function job_content_filter( $enable ) {
508
  if ( ! $enable ) {
509
+ remove_filter( 'the_content', [ $this, 'job_content' ] );
510
  } else {
511
+ add_filter( 'the_content', [ $this, 'job_content' ] );
512
  }
513
  }
514
 
554
  $job_manager_keyword = isset( $_GET['search_keywords'] ) ? sanitize_text_field( wp_unslash( $_GET['search_keywords'] ) ) : '';
555
  // phpcs:enable WordPress.Security.NonceVerification.Recommended
556
 
557
+ $query_args = [
558
  'post_type' => 'job_listing',
559
  'post_status' => 'publish',
560
  'ignore_sticky_posts' => 1,
561
  'posts_per_page' => $input_posts_per_page,
562
  'paged' => absint( get_query_var( 'paged', 1 ) ),
563
+ 'tax_query' => [],
564
+ 'meta_query' => [],
565
+ ];
566
 
567
  if ( ! empty( $input_search_location ) ) {
568
+ $location_meta_keys = [ 'geolocation_formatted_address', '_job_location', 'geolocation_state_long' ];
569
+ $location_search = [ 'relation' => 'OR' ];
570
  foreach ( $location_meta_keys as $meta_key ) {
571
+ $location_search[] = [
572
  'key' => $meta_key,
573
  'value' => $input_search_location,
574
  'compare' => 'like',
575
+ ];
576
  }
577
  $query_args['meta_query'][] = $location_search;
578
  }
579
 
580
  if ( ! empty( $input_job_types ) ) {
581
+ $query_args['tax_query'][] = [
582
  'taxonomy' => 'job_listing_type',
583
  'field' => 'slug',
584
+ 'terms' => $input_job_types + [ 0 ],
585
+ ];
586
  }
587
 
588
  if ( ! empty( $input_job_categories ) ) {
589
+ $cats = $input_job_categories + [ 0 ];
590
  $field = is_numeric( $cats ) ? 'term_id' : 'slug';
591
  $operator = 'all' === get_option( 'job_manager_category_filter_type', 'all' ) && count( $cats ) > 1 ? 'AND' : 'IN';
592
+ $query_args['tax_query'][] = [
593
  'taxonomy' => 'job_listing_category',
594
  'field' => $field,
595
  'terms' => $cats,
596
  'include_children' => 'AND' !== $operator,
597
  'operator' => $operator,
598
+ ];
599
  }
600
 
601
  if ( ! empty( $job_manager_keyword ) ) {
613
 
614
  // phpcs:ignore WordPress.WP.DiscouragedFunctions
615
  query_posts( apply_filters( 'job_feed_args', $query_args ) );
616
+ add_action( 'rss2_ns', [ $this, 'job_feed_namespace' ] );
617
+ add_action( 'rss2_item', [ $this, 'job_feed_item' ] );
618
  do_feed_rss2( false );
619
  remove_filter( 'posts_search', 'get_job_listings_keyword_search' );
620
  }
685
  public function check_for_expired_jobs() {
686
  // Change status to expired.
687
  $job_ids = get_posts(
688
+ [
689
  'post_type' => 'job_listing',
690
  'post_status' => 'publish',
691
  'fields' => 'ids',
692
  'posts_per_page' => -1,
693
+ 'meta_query' => [
694
  'relation' => 'AND',
695
+ [
696
  'key' => '_job_expires',
697
  'value' => 0,
698
  'compare' => '>',
699
+ ],
700
+ [
701
  'key' => '_job_expires',
702
  'value' => date( 'Y-m-d', current_time( 'timestamp' ) ),
703
  'compare' => '<',
704
+ ],
705
+ ],
706
+ ]
707
  );
708
 
709
  if ( $job_ids ) {
710
  foreach ( $job_ids as $job_id ) {
711
+ $job_data = [];
712
  $job_data['ID'] = $job_id;
713
  $job_data['post_status'] = 'expired';
714
  wp_update_post( $job_data );
735
  $delete_expired_jobs_days = apply_filters( 'job_manager_delete_expired_jobs_days', 30 );
736
 
737
  $job_ids = get_posts(
738
+ [
739
  'post_type' => 'job_listing',
740
  'post_status' => 'expired',
741
  'fields' => 'ids',
742
+ 'date_query' => [
743
+ [
744
  'column' => 'post_modified',
745
  'before' => date( 'Y-m-d', strtotime( '-' . $delete_expired_jobs_days . ' days', current_time( 'timestamp' ) ) ),
746
+ ],
747
+ ],
748
  'posts_per_page' => -1,
749
+ ]
750
  );
751
 
752
  if ( $job_ids ) {
763
  public function delete_old_previews() {
764
  // Delete old jobs stuck in preview.
765
  $job_ids = get_posts(
766
+ [
767
  'post_type' => 'job_listing',
768
  'post_status' => 'preview',
769
  'fields' => 'ids',
770
+ 'date_query' => [
771
+ [
772
  'column' => 'post_modified',
773
  'before' => date( 'Y-m-d', strtotime( '-30 days', current_time( 'timestamp' ) ) ),
774
+ ],
775
+ ],
776
  'posts_per_page' => -1,
777
+ ]
778
  );
779
 
780
  if ( $job_ids ) {
838
  * @param stdClass $apply
839
  */
840
  public function application_details_email( $apply ) {
841
+ get_job_manager_template( 'job-application-email.php', [ 'apply' => $apply ] );
842
  }
843
 
844
  /**
847
  * @param stdClass $apply
848
  */
849
  public function application_details_url( $apply ) {
850
+ get_job_manager_template( 'job-application-url.php', [ 'apply' => $apply ] );
851
  }
852
 
853
  /**
899
  */
900
  $legacy_permalink_settings = '[]';
901
  if ( false !== get_option( 'wpjm_permalinks', false ) ) {
902
+ $legacy_permalink_settings = wp_json_encode( get_option( 'wpjm_permalinks', [] ) );
903
  delete_option( 'wpjm_permalinks' );
904
  }
905
 
934
 
935
  $permalinks = wp_parse_args(
936
  $permalink_settings,
937
+ [
938
  'job_base' => '',
939
  'category_base' => '',
940
  'type_base' => '',
941
  'jobs_archive' => '',
942
+ ]
943
  );
944
 
945
  // Ensure rewrite slugs are set. Use legacy translation options if not.
982
  return;
983
  }
984
 
 
985
  switch ( $meta_key ) {
986
  case '_job_location':
987
  $this->maybe_update_geolocation_data( $meta_id, $object_id, $meta_key, $meta_value );
990
  $this->maybe_update_menu_order( $meta_id, $object_id, $meta_key, $meta_value );
991
  break;
992
  }
 
993
  }
994
 
995
  /**
1013
  * @param mixed $meta_value
1014
  */
1015
  public function maybe_update_menu_order( $meta_id, $object_id, $meta_key, $meta_value ) {
1016
+ global $wpdb;
1017
+
1018
  if ( 1 === intval( $meta_value ) ) {
1019
+ // phpcs:ignore WordPress.DB.DirectDatabaseQuery.DirectQuery, WordPress.DB.DirectDatabaseQuery.NoCaching -- Update post menu order without firing actions.
1020
+ $wpdb->update(
1021
+ $wpdb->posts,
1022
+ [ 'menu_order' => -1 ],
1023
+ [ 'ID' => $object_id ]
1024
+ );
1025
+ } else {
1026
+ // phpcs:ignore WordPress.DB.DirectDatabaseQuery.DirectQuery, WordPress.DB.DirectDatabaseQuery.NoCaching -- Update post menu order without firing actions.
1027
+ $wpdb->update(
1028
+ $wpdb->posts,
1029
+ [ 'menu_order' => 0 ],
1030
+ [
1031
  'ID' => $object_id,
1032
  'menu_order' => -1,
1033
+ ]
1034
  );
 
 
 
 
 
 
 
 
 
 
 
1035
  }
1036
+
1037
+ clean_post_cache( $object_id );
1038
  }
1039
 
1040
  /**
1091
  // Track approving a new job listing.
1092
  WP_Job_Manager_Usage_Tracking::track_job_approval(
1093
  $post->ID,
1094
+ [
1095
  'source' => $source,
1096
+ ]
1097
  );
1098
 
1099
  return;
1101
 
1102
  WP_Job_Manager_Usage_Tracking::track_job_submission(
1103
  $post->ID,
1104
+ [
1105
  'source' => $source,
1106
  'old_status' => $old_status,
1107
+ ]
1108
  );
1109
  }
1110
 
1171
  register_meta(
1172
  'post',
1173
  $meta_key,
1174
+ [
1175
  'type' => $field['data_type'],
1176
  'show_in_rest' => $field['show_in_rest'],
1177
  'description' => $field['label'],
1179
  'auth_callback' => $field['auth_edit_callback'],
1180
  'single' => true,
1181
  'object_subtype' => 'job_listing',
1182
+ ]
1183
  );
1184
  }
1185
  }
1190
  * @return array See `job_manager_job_listing_data_fields` filter for more documentation.
1191
  */
1192
  public static function get_job_listing_fields() {
1193
+ $default_field = [
1194
  'label' => null,
1195
  'placeholder' => null,
1196
  'description' => null,
1197
  'priority' => 10,
1198
  'value' => null,
1199
  'default' => null,
1200
+ 'classes' => [],
1201
  'type' => 'text',
1202
  'data_type' => 'string',
1203
  'show_in_admin' => true,
1204
  'show_in_rest' => false,
1205
+ 'auth_edit_callback' => [ __CLASS__, 'auth_check_can_edit_job_listings' ],
1206
  'auth_view_callback' => null,
1207
+ 'sanitize_callback' => [ __CLASS__, 'sanitize_meta_field_based_on_input_type' ],
1208
+ ];
1209
 
1210
  $allowed_application_method = get_option( 'job_manager_allowed_application_method', '' );
1211
  $application_method_label = __( 'Application email/URL', 'wp-job-manager' );
1219
  $application_method_placeholder = __( 'https://', 'wp-job-manager' );
1220
  }
1221
 
1222
+ $fields = [
1223
+ '_job_location' => [
1224
  'label' => __( 'Location', 'wp-job-manager' ),
1225
  'placeholder' => __( 'e.g. "London"', 'wp-job-manager' ),
1226
  'description' => __( 'Leave this blank if the location is not important.', 'wp-job-manager' ),
1228
  'data_type' => 'string',
1229
  'show_in_admin' => true,
1230
  'show_in_rest' => true,
1231
+ ],
1232
+ '_application' => [
1233
  'label' => $application_method_label,
1234
  'placeholder' => $application_method_placeholder,
1235
  'description' => __( 'This field is required for the "application" area to appear beneath the listing.', 'wp-job-manager' ),
1237
  'data_type' => 'string',
1238
  'show_in_admin' => true,
1239
  'show_in_rest' => true,
1240
+ 'sanitize_callback' => [ __CLASS__, 'sanitize_meta_field_application' ],
1241
+ ],
1242
+ '_company_name' => [
1243
  'label' => __( 'Company Name', 'wp-job-manager' ),
1244
  'placeholder' => '',
1245
  'priority' => 3,
1246
  'data_type' => 'string',
1247
  'show_in_admin' => true,
1248
  'show_in_rest' => true,
1249
+ ],
1250
+ '_company_website' => [
1251
  'label' => __( 'Company Website', 'wp-job-manager' ),
1252
  'placeholder' => '',
1253
  'priority' => 4,
1254
  'data_type' => 'string',
1255
  'show_in_admin' => true,
1256
  'show_in_rest' => true,
1257
+ 'sanitize_callback' => [ __CLASS__, 'sanitize_meta_field_url' ],
1258
+ ],
1259
+ '_company_tagline' => [
1260
  'label' => __( 'Company Tagline', 'wp-job-manager' ),
1261
  'placeholder' => __( 'Brief description about the company', 'wp-job-manager' ),
1262
  'priority' => 5,
1263
  'data_type' => 'string',
1264
  'show_in_admin' => true,
1265
  'show_in_rest' => true,
1266
+ ],
1267
+ '_company_twitter' => [
1268
  'label' => __( 'Company Twitter', 'wp-job-manager' ),
1269
  'placeholder' => '@yourcompany',
1270
  'priority' => 6,
1271
  'data_type' => 'string',
1272
  'show_in_admin' => true,
1273
  'show_in_rest' => true,
1274
+ ],
1275
+ '_company_video' => [
1276
  'label' => __( 'Company Video', 'wp-job-manager' ),
1277
  'placeholder' => __( 'URL to the company video', 'wp-job-manager' ),
1278
  'type' => 'file',
1280
  'data_type' => 'string',
1281
  'show_in_admin' => true,
1282
  'show_in_rest' => true,
1283
+ 'sanitize_callback' => [ __CLASS__, 'sanitize_meta_field_url' ],
1284
+ ],
1285
+ '_filled' => [
1286
  'label' => __( 'Position Filled', 'wp-job-manager' ),
1287
  'type' => 'checkbox',
1288
  'priority' => 9,
1290
  'show_in_admin' => true,
1291
  'show_in_rest' => true,
1292
  'description' => __( 'Filled listings will no longer accept applications.', 'wp-job-manager' ),
1293
+ ],
1294
+ '_featured' => [
1295
  'label' => __( 'Featured Listing', 'wp-job-manager' ),
1296
  'type' => 'checkbox',
1297
  'description' => __( 'Featured listings will be sticky during searches, and can be styled differently.', 'wp-job-manager' ),
1299
  'data_type' => 'integer',
1300
  'show_in_admin' => true,
1301
  'show_in_rest' => true,
1302
+ 'auth_edit_callback' => [ __CLASS__, 'auth_check_can_manage_job_listings' ],
1303
+ ],
1304
+ '_job_expires' => [
1305
  'label' => __( 'Listing Expiry Date', 'wp-job-manager' ),
1306
  'priority' => 11,
1307
  'show_in_admin' => true,
1308
  'show_in_rest' => true,
1309
  'data_type' => 'string',
1310
+ 'classes' => [ 'job-manager-datepicker' ],
1311
+ 'auth_edit_callback' => [ __CLASS__, 'auth_check_can_manage_job_listings' ],
1312
+ 'auth_view_callback' => [ __CLASS__, 'auth_check_can_edit_job_listings' ],
1313
+ 'sanitize_callback' => [ __CLASS__, 'sanitize_meta_field_date' ],
1314
+ ],
1315
+ ];
1316
 
1317
  /**
1318
  * Filters job listing data fields.
includes/class-wp-job-manager-rest-api.php CHANGED
@@ -21,7 +21,7 @@ class WP_Job_Manager_REST_API {
21
  * @static
22
  */
23
  public static function init() {
24
- add_filter( 'rest_prepare_job_listing', array( __CLASS__, 'prepare_job_listing' ), 10, 2 );
25
  }
26
 
27
  /**
21
  * @static
22
  */
23
  public static function init() {
24
+ add_filter( 'rest_prepare_job_listing', [ __CLASS__, 'prepare_job_listing' ], 10, 2 );
25
  }
26
 
27
  /**
includes/class-wp-job-manager-shortcodes.php CHANGED
@@ -50,17 +50,17 @@ class WP_Job_Manager_Shortcodes {
50
  * Constructor.
51
  */
52
  public function __construct() {
53
- add_action( 'wp', array( $this, 'shortcode_action_handler' ) );
54
- add_action( 'job_manager_job_dashboard_content_edit', array( $this, 'edit_job' ) );
55
- add_action( 'job_manager_job_filters_end', array( $this, 'job_filter_job_types' ), 20 );
56
- add_action( 'job_manager_job_filters_end', array( $this, 'job_filter_results' ), 30 );
57
- add_action( 'job_manager_output_jobs_no_results', array( $this, 'output_no_results' ) );
58
- add_shortcode( 'submit_job_form', array( $this, 'submit_job_form' ) );
59
- add_shortcode( 'job_dashboard', array( $this, 'job_dashboard' ) );
60
- add_shortcode( 'jobs', array( $this, 'output_jobs' ) );
61
- add_shortcode( 'job', array( $this, 'output_job' ) );
62
- add_shortcode( 'job_summary', array( $this, 'output_job_summary' ) );
63
- add_shortcode( 'job_apply', array( $this, 'output_job_apply' ) );
64
  }
65
 
66
  /**
@@ -80,7 +80,7 @@ class WP_Job_Manager_Shortcodes {
80
  * @param array $atts
81
  * @return string|null
82
  */
83
- public function submit_job_form( $atts = array() ) {
84
  return $GLOBALS['job_manager']->forms->get_form( 'submit-job', $atts );
85
  }
86
 
@@ -152,7 +152,7 @@ class WP_Job_Manager_Shortcodes {
152
  $new_job_id = job_manager_duplicate_listing( $job_id );
153
 
154
  if ( $new_job_id ) {
155
- wp_safe_redirect( add_query_arg( array( 'job_id' => absint( $new_job_id ) ), job_manager_get_permalink( 'submit_job_form' ) ) );
156
  exit;
157
  }
158
 
@@ -164,7 +164,7 @@ class WP_Job_Manager_Shortcodes {
164
  }
165
 
166
  // redirect to post page.
167
- wp_safe_redirect( add_query_arg( array( 'job_id' => absint( $job_id ) ), job_manager_get_permalink( 'submit_job_form' ) ) );
168
  exit;
169
  default:
170
  do_action( 'job_manager_job_dashboard_do_action_' . $action, $job_id );
@@ -208,9 +208,9 @@ class WP_Job_Manager_Shortcodes {
208
  }
209
 
210
  $new_atts = shortcode_atts(
211
- array(
212
  'posts_per_page' => '25',
213
- ),
214
  $atts
215
  );
216
  $posts_per_page = $new_atts['posts_per_page'];
@@ -234,16 +234,16 @@ class WP_Job_Manager_Shortcodes {
234
  // ....If not show the job dashboard.
235
  $args = apply_filters(
236
  'job_manager_get_dashboard_jobs_args',
237
- array(
238
  'post_type' => 'job_listing',
239
- 'post_status' => array( 'publish', 'expired', 'pending', 'draft', 'preview' ),
240
  'ignore_sticky_posts' => 1,
241
  'posts_per_page' => $posts_per_page,
242
  'offset' => ( max( 1, get_query_var( 'paged' ) ) - 1 ) * $posts_per_page,
243
  'orderby' => 'date',
244
  'order' => 'desc',
245
  'author' => get_current_user_id(),
246
- )
247
  );
248
 
249
  $jobs = new WP_Query();
@@ -252,21 +252,21 @@ class WP_Job_Manager_Shortcodes {
252
 
253
  $job_dashboard_columns = apply_filters(
254
  'job_manager_job_dashboard_columns',
255
- array(
256
  'job_title' => __( 'Title', 'wp-job-manager' ),
257
  'filled' => __( 'Filled?', 'wp-job-manager' ),
258
  'date' => __( 'Date Posted', 'wp-job-manager' ),
259
  'expires' => __( 'Listing Expires', 'wp-job-manager' ),
260
- )
261
  );
262
 
263
  get_job_manager_template(
264
  'job-dashboard.php',
265
- array(
266
  'jobs' => $jobs->query( $args ),
267
  'max_num_pages' => $jobs->max_num_pages,
268
  'job_dashboard_columns' => $job_dashboard_columns,
269
- )
270
  );
271
 
272
  return ob_get_clean();
@@ -294,7 +294,7 @@ class WP_Job_Manager_Shortcodes {
294
  $atts = shortcode_atts(
295
  apply_filters(
296
  'job_manager_output_jobs_defaults',
297
- array(
298
  'per_page' => get_option( 'job_manager_per_page' ),
299
  'orderby' => 'featured',
300
  'order' => 'DESC',
@@ -318,7 +318,7 @@ class WP_Job_Manager_Shortcodes {
318
  'keywords' => '',
319
  'selected_category' => '',
320
  'selected_job_types' => implode( ',', array_values( get_job_listing_types( 'id=>slug' ) ) ),
321
- )
322
  ),
323
  $atts
324
  );
@@ -335,11 +335,11 @@ class WP_Job_Manager_Shortcodes {
335
  $atts['show_pagination'] = $this->string_to_bool( $atts['show_pagination'] );
336
 
337
  if ( ! is_null( $atts['featured'] ) ) {
338
- $atts['featured'] = ( is_bool( $atts['featured'] ) && $atts['featured'] ) || in_array( $atts['featured'], array( 1, '1', 'true', 'yes' ), true );
339
  }
340
 
341
  if ( ! is_null( $atts['filled'] ) ) {
342
- $atts['filled'] = ( is_bool( $atts['filled'] ) && $atts['filled'] ) || in_array( $atts['filled'], array( 1, '1', 'true', 'yes' ), true );
343
  }
344
 
345
  // Get keywords, location, category and type from querystring if set.
@@ -360,11 +360,25 @@ class WP_Job_Manager_Shortcodes {
360
 
361
  // Array handling.
362
  $atts['categories'] = is_array( $atts['categories'] ) ? $atts['categories'] : array_filter( array_map( 'trim', explode( ',', $atts['categories'] ) ) );
 
363
  $atts['job_types'] = is_array( $atts['job_types'] ) ? $atts['job_types'] : array_filter( array_map( 'trim', explode( ',', $atts['job_types'] ) ) );
364
  $atts['post_status'] = is_array( $atts['post_status'] ) ? $atts['post_status'] : array_filter( array_map( 'trim', explode( ',', $atts['post_status'] ) ) );
365
  $atts['selected_job_types'] = is_array( $atts['selected_job_types'] ) ? $atts['selected_job_types'] : array_filter( array_map( 'trim', explode( ',', $atts['selected_job_types'] ) ) );
366
 
367
- $data_attributes = array(
 
 
 
 
 
 
 
 
 
 
 
 
 
368
  'location' => $atts['location'],
369
  'keywords' => $atts['keywords'],
370
  'show_filters' => $atts['show_filters'] ? 'true' : 'false',
@@ -373,12 +387,12 @@ class WP_Job_Manager_Shortcodes {
373
  'orderby' => $atts['orderby'],
374
  'order' => $atts['order'],
375
  'categories' => implode( ',', $atts['categories'] ),
376
- );
377
 
378
  if ( $atts['show_filters'] ) {
379
  get_job_manager_template(
380
  'job-filters.php',
381
- array(
382
  'per_page' => $atts['per_page'],
383
  'orderby' => $atts['orderby'],
384
  'order' => $atts['order'],
@@ -391,7 +405,7 @@ class WP_Job_Manager_Shortcodes {
391
  'keywords' => $atts['keywords'],
392
  'selected_job_types' => $atts['selected_job_types'],
393
  'show_category_multiselect' => $atts['show_category_multiselect'],
394
- )
395
  );
396
 
397
  get_job_manager_template( 'job-listings-start.php' );
@@ -404,7 +418,7 @@ class WP_Job_Manager_Shortcodes {
404
  $jobs = get_job_listings(
405
  apply_filters(
406
  'job_manager_output_jobs_args',
407
- array(
408
  'search_location' => $atts['location'],
409
  'search_keywords' => $atts['keywords'],
410
  'post_status' => $atts['post_status'],
@@ -415,7 +429,7 @@ class WP_Job_Manager_Shortcodes {
415
  'posts_per_page' => $atts['per_page'],
416
  'featured' => $atts['featured'],
417
  'filled' => $atts['filled'],
418
- )
419
  )
420
  );
421
 
@@ -458,6 +472,20 @@ class WP_Job_Manager_Shortcodes {
458
 
459
  $data_attributes['post_id'] = isset( $GLOBALS['post'] ) ? $GLOBALS['post']->ID : 0;
460
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
461
  foreach ( $data_attributes as $key => $value ) {
462
  $data_attributes_string .= 'data-' . esc_attr( $key ) . '="' . esc_attr( $value ) . '" ';
463
  }
@@ -481,7 +509,7 @@ class WP_Job_Manager_Shortcodes {
481
  * @return bool
482
  */
483
  public function string_to_bool( $value ) {
484
- return ( is_bool( $value ) && $value ) || in_array( $value, array( 1, '1', 'true', 'yes' ), true );
485
  }
486
 
487
  /**
@@ -495,11 +523,11 @@ class WP_Job_Manager_Shortcodes {
495
 
496
  get_job_manager_template(
497
  'job-filter-job-types.php',
498
- array(
499
  'job_types' => $job_types,
500
  'atts' => $atts,
501
  'selected_job_types' => $selected_job_types,
502
- )
503
  );
504
  }
505
 
@@ -518,9 +546,9 @@ class WP_Job_Manager_Shortcodes {
518
  */
519
  public function output_job( $atts ) {
520
  $atts = shortcode_atts(
521
- array(
522
  'id' => '',
523
- ),
524
  $atts
525
  );
526
 
@@ -530,11 +558,11 @@ class WP_Job_Manager_Shortcodes {
530
 
531
  ob_start();
532
 
533
- $args = array(
534
  'post_type' => 'job_listing',
535
  'post_status' => 'publish',
536
  'p' => $atts['id'],
537
- );
538
 
539
  $jobs = new WP_Query( $args );
540
 
@@ -559,34 +587,34 @@ class WP_Job_Manager_Shortcodes {
559
  */
560
  public function output_job_summary( $atts ) {
561
  $atts = shortcode_atts(
562
- array(
563
  'id' => '',
564
  'width' => '250px',
565
  'align' => 'left',
566
  'featured' => null, // True to show only featured, false to hide featured, leave null to show both (when leaving out id).
567
  'limit' => 1,
568
- ),
569
  $atts
570
  );
571
 
572
  ob_start();
573
 
574
- $args = array(
575
  'post_type' => 'job_listing',
576
  'post_status' => 'publish',
577
- );
578
 
579
  if ( ! $atts['id'] ) {
580
  $args['posts_per_page'] = $atts['limit'];
581
  $args['orderby'] = 'rand';
582
  if ( ! is_null( $atts['featured'] ) ) {
583
- $args['meta_query'] = array(
584
- array(
585
  'key' => '_featured',
586
  'value' => '1',
587
  'compare' => $atts['featured'] ? '=' : '!=',
588
- ),
589
- );
590
  }
591
  } else {
592
  $args['p'] = absint( $atts['id'] );
@@ -617,19 +645,19 @@ class WP_Job_Manager_Shortcodes {
617
  */
618
  public function output_job_apply( $atts ) {
619
  $new_atts = shortcode_atts(
620
- array(
621
  'id' => '',
622
- ),
623
  $atts
624
  );
625
  $id = $new_atts['id'];
626
 
627
  ob_start();
628
 
629
- $args = array(
630
  'post_type' => 'job_listing',
631
  'post_status' => 'publish',
632
- );
633
 
634
  if ( ! $id ) {
635
  return '';
50
  * Constructor.
51
  */
52
  public function __construct() {
53
+ add_action( 'wp', [ $this, 'shortcode_action_handler' ] );
54
+ add_action( 'job_manager_job_dashboard_content_edit', [ $this, 'edit_job' ] );
55
+ add_action( 'job_manager_job_filters_end', [ $this, 'job_filter_job_types' ], 20 );
56
+ add_action( 'job_manager_job_filters_end', [ $this, 'job_filter_results' ], 30 );
57
+ add_action( 'job_manager_output_jobs_no_results', [ $this, 'output_no_results' ] );
58
+ add_shortcode( 'submit_job_form', [ $this, 'submit_job_form' ] );
59
+ add_shortcode( 'job_dashboard', [ $this, 'job_dashboard' ] );
60
+ add_shortcode( 'jobs', [ $this, 'output_jobs' ] );
61
+ add_shortcode( 'job', [ $this, 'output_job' ] );
62
+ add_shortcode( 'job_summary', [ $this, 'output_job_summary' ] );
63
+ add_shortcode( 'job_apply', [ $this, 'output_job_apply' ] );
64
  }
65
 
66
  /**
80
  * @param array $atts
81
  * @return string|null
82
  */
83
+ public function submit_job_form( $atts = [] ) {
84
  return $GLOBALS['job_manager']->forms->get_form( 'submit-job', $atts );
85
  }
86
 
152
  $new_job_id = job_manager_duplicate_listing( $job_id );
153
 
154
  if ( $new_job_id ) {
155
+ wp_safe_redirect( add_query_arg( [ 'job_id' => absint( $new_job_id ) ], job_manager_get_permalink( 'submit_job_form' ) ) );
156
  exit;
157
  }
158
 
164
  }
165
 
166
  // redirect to post page.
167
+ wp_safe_redirect( add_query_arg( [ 'job_id' => absint( $job_id ) ], job_manager_get_permalink( 'submit_job_form' ) ) );
168
  exit;
169
  default:
170
  do_action( 'job_manager_job_dashboard_do_action_' . $action, $job_id );
208
  }
209
 
210
  $new_atts = shortcode_atts(
211
+ [
212
  'posts_per_page' => '25',
213
+ ],
214
  $atts
215
  );
216
  $posts_per_page = $new_atts['posts_per_page'];
234
  // ....If not show the job dashboard.
235
  $args = apply_filters(
236
  'job_manager_get_dashboard_jobs_args',
237
+ [
238
  'post_type' => 'job_listing',
239
+ 'post_status' => [ 'publish', 'expired', 'pending', 'draft', 'preview' ],
240
  'ignore_sticky_posts' => 1,
241
  'posts_per_page' => $posts_per_page,
242
  'offset' => ( max( 1, get_query_var( 'paged' ) ) - 1 ) * $posts_per_page,
243
  'orderby' => 'date',
244
  'order' => 'desc',
245
  'author' => get_current_user_id(),
246
+ ]
247
  );
248
 
249
  $jobs = new WP_Query();
252
 
253
  $job_dashboard_columns = apply_filters(
254
  'job_manager_job_dashboard_columns',
255
+ [
256
  'job_title' => __( 'Title', 'wp-job-manager' ),
257
  'filled' => __( 'Filled?', 'wp-job-manager' ),
258
  'date' => __( 'Date Posted', 'wp-job-manager' ),
259
  'expires' => __( 'Listing Expires', 'wp-job-manager' ),
260
+ ]
261
  );
262
 
263
  get_job_manager_template(
264
  'job-dashboard.php',
265
+ [
266
  'jobs' => $jobs->query( $args ),
267
  'max_num_pages' => $jobs->max_num_pages,
268
  'job_dashboard_columns' => $job_dashboard_columns,
269
+ ]
270
  );
271
 
272
  return ob_get_clean();
294
  $atts = shortcode_atts(
295
  apply_filters(
296
  'job_manager_output_jobs_defaults',
297
+ [
298
  'per_page' => get_option( 'job_manager_per_page' ),
299
  'orderby' => 'featured',
300
  'order' => 'DESC',
318
  'keywords' => '',
319
  'selected_category' => '',
320
  'selected_job_types' => implode( ',', array_values( get_job_listing_types( 'id=>slug' ) ) ),
321
+ ]
322
  ),
323
  $atts
324
  );
335
  $atts['show_pagination'] = $this->string_to_bool( $atts['show_pagination'] );
336
 
337
  if ( ! is_null( $atts['featured'] ) ) {
338
+ $atts['featured'] = ( is_bool( $atts['featured'] ) && $atts['featured'] ) || in_array( $atts['featured'], [ 1, '1', 'true', 'yes' ], true );
339
  }
340
 
341
  if ( ! is_null( $atts['filled'] ) ) {
342
+ $atts['filled'] = ( is_bool( $atts['filled'] ) && $atts['filled'] ) || in_array( $atts['filled'], [ 1, '1', 'true', 'yes' ], true );
343
  }
344
 
345
  // Get keywords, location, category and type from querystring if set.
360
 
361
  // Array handling.
362
  $atts['categories'] = is_array( $atts['categories'] ) ? $atts['categories'] : array_filter( array_map( 'trim', explode( ',', $atts['categories'] ) ) );
363
+ $atts['selected_category'] = is_array( $atts['selected_category'] ) ? $atts['selected_category'] : array_filter( array_map( 'trim', explode( ',', $atts['selected_category'] ) ) );
364
  $atts['job_types'] = is_array( $atts['job_types'] ) ? $atts['job_types'] : array_filter( array_map( 'trim', explode( ',', $atts['job_types'] ) ) );
365
  $atts['post_status'] = is_array( $atts['post_status'] ) ? $atts['post_status'] : array_filter( array_map( 'trim', explode( ',', $atts['post_status'] ) ) );
366
  $atts['selected_job_types'] = is_array( $atts['selected_job_types'] ) ? $atts['selected_job_types'] : array_filter( array_map( 'trim', explode( ',', $atts['selected_job_types'] ) ) );
367
 
368
+ // Normalize field for categories.
369
+ if ( ! empty( $atts['selected_category'] ) ) {
370
+ foreach ( $atts['selected_category'] as $cat_index => $category ) {
371
+ if ( ! is_numeric( $category ) ) {
372
+ $term = get_term_by( 'slug', $category, 'job_listing_category' );
373
+
374
+ if ( $term ) {
375
+ $atts['selected_category'][ $cat_index ] = $term->term_id;
376
+ }
377
+ }
378
+ }
379
+ }
380
+
381
+ $data_attributes = [
382
  'location' => $atts['location'],
383
  'keywords' => $atts['keywords'],
384
  'show_filters' => $atts['show_filters'] ? 'true' : 'false',
387
  'orderby' => $atts['orderby'],
388
  'order' => $atts['order'],
389
  'categories' => implode( ',', $atts['categories'] ),
390
+ ];
391
 
392
  if ( $atts['show_filters'] ) {
393
  get_job_manager_template(
394
  'job-filters.php',
395
+ [
396
  'per_page' => $atts['per_page'],
397
  'orderby' => $atts['orderby'],
398
  'order' => $atts['order'],
405
  'keywords' => $atts['keywords'],
406
  'selected_job_types' => $atts['selected_job_types'],
407
  'show_category_multiselect' => $atts['show_category_multiselect'],
408
+ ]
409
  );
410
 
411
  get_job_manager_template( 'job-listings-start.php' );
418
  $jobs = get_job_listings(
419
  apply_filters(
420
  'job_manager_output_jobs_args',
421
+ [
422
  'search_location' => $atts['location'],
423
  'search_keywords' => $atts['keywords'],
424
  'post_status' => $atts['post_status'],
429
  'posts_per_page' => $atts['per_page'],
430
  'featured' => $atts['featured'],
431
  'filled' => $atts['filled'],
432
+ ]
433
  )
434
  );
435
 
472
 
473
  $data_attributes['post_id'] = isset( $GLOBALS['post'] ) ? $GLOBALS['post']->ID : 0;
474
 
475
+ /**
476
+ * Pass additional data to the job listings <div> wrapper.
477
+ *
478
+ * @since 1.34.0
479
+ *
480
+ * @param array $data_attributes {
481
+ * Key => Value array of data attributes to pass.
482
+ *
483
+ * @type string $$key Value to pass as a data attribute.
484
+ * }
485
+ * @param array $atts Attributes for the shortcode.
486
+ */
487
+ $data_attributes = apply_filters( 'job_manager_jobs_shortcode_data_attributes', $data_attributes, $atts );
488
+
489
  foreach ( $data_attributes as $key => $value ) {
490
  $data_attributes_string .= 'data-' . esc_attr( $key ) . '="' . esc_attr( $value ) . '" ';
491
  }
509
  * @return bool
510
  */
511
  public function string_to_bool( $value ) {
512
+ return ( is_bool( $value ) && $value ) || in_array( $value, [ 1, '1', 'true', 'yes' ], true );
513
  }
514
 
515
  /**
523
 
524
  get_job_manager_template(
525
  'job-filter-job-types.php',
526
+ [
527
  'job_types' => $job_types,
528
  'atts' => $atts,
529
  'selected_job_types' => $selected_job_types,
530
+ ]
531
  );
532
  }
533
 
546
  */
547
  public function output_job( $atts ) {
548
  $atts = shortcode_atts(
549
+ [
550
  'id' => '',
551
+ ],
552
  $atts
553
  );
554
 
558
 
559
  ob_start();
560
 
561
+ $args = [
562
  'post_type' => 'job_listing',
563
  'post_status' => 'publish',
564
  'p' => $atts['id'],
565
+ ];
566
 
567
  $jobs = new WP_Query( $args );
568
 
587
  */
588
  public function output_job_summary( $atts ) {
589
  $atts = shortcode_atts(
590
+ [
591
  'id' => '',
592
  'width' => '250px',
593
  'align' => 'left',
594
  'featured' => null, // True to show only featured, false to hide featured, leave null to show both (when leaving out id).
595
  'limit' => 1,
596
+ ],
597
  $atts
598
  );
599
 
600
  ob_start();
601
 
602
+ $args = [
603
  'post_type' => 'job_listing',
604
  'post_status' => 'publish',
605
+ ];
606
 
607
  if ( ! $atts['id'] ) {
608
  $args['posts_per_page'] = $atts['limit'];
609
  $args['orderby'] = 'rand';
610
  if ( ! is_null( $atts['featured'] ) ) {
611
+ $args['meta_query'] = [
612
+ [
613
  'key' => '_featured',
614
  'value' => '1',
615
  'compare' => $atts['featured'] ? '=' : '!=',
616
+ ],
617
+ ];
618
  }
619
  } else {
620
  $args['p'] = absint( $atts['id'] );
645
  */
646
  public function output_job_apply( $atts ) {
647
  $new_atts = shortcode_atts(
648
+ [
649
  'id' => '',
650
+ ],
651
  $atts
652
  );
653
  $id = $new_atts['id'];
654
 
655
  ob_start();
656
 
657
+ $args = [
658
  'post_type' => 'job_listing',
659
  'post_status' => 'publish',
660
+ ];
661
 
662
  if ( ! $id ) {
663
  return '';
includes/class-wp-job-manager-usage-tracking-data.php CHANGED
@@ -27,14 +27,14 @@ class WP_Job_Manager_Usage_Tracking_Data {
27
  $count_posts = wp_count_posts( 'job_listing' );
28
 
29
  if ( taxonomy_exists( 'job_listing_category' ) ) {
30
- $categories = wp_count_terms( 'job_listing_category', array( 'hide_empty' => false ) );
31
  }
32
 
33
- return array(
34
  'employers' => self::get_employer_count(),
35
  'job_categories' => $categories,
36
  'job_categories_desc' => self::get_job_category_has_description_count(),
37
- 'job_types' => wp_count_terms( 'job_listing_type', array( 'hide_empty' => false ) ),
38
  'job_types_desc' => self::get_job_type_has_description_count(),
39
  'job_types_emp_type' => self::get_job_type_has_employment_type_count(),
40
  'jobs_type' => self::get_job_type_count(),
@@ -62,7 +62,7 @@ class WP_Job_Manager_Usage_Tracking_Data {
62
  'jobs_by_guests' => self::get_jobs_by_guests(),
63
  'official_extensions' => self::get_official_extensions_count(),
64
  'licensed_extensions' => self::get_licensed_extensions_count(),
65
- );
66
  }
67
 
68
  /**
@@ -72,10 +72,10 @@ class WP_Job_Manager_Usage_Tracking_Data {
72
  */
73
  private static function get_employer_count() {
74
  $employer_query = new WP_User_Query(
75
- array(
76
  'fields' => 'ID',
77
  'role' => 'employer',
78
- )
79
  );
80
 
81
  return $employer_query->total_users;
@@ -95,10 +95,10 @@ class WP_Job_Manager_Usage_Tracking_Data {
95
 
96
  $count = 0;
97
  $terms = get_terms(
98
- array(
99
  'taxonomy' => 'job_listing_category',
100
  'hide_empty' => false,
101
- )
102
  );
103
 
104
  foreach ( $terms as $term ) {
@@ -122,10 +122,10 @@ class WP_Job_Manager_Usage_Tracking_Data {
122
  private static function get_job_type_has_description_count() {
123
  $count = 0;
124
  $terms = get_terms(
125
- array(
126
  'taxonomy' => 'job_listing_type',
127
  'hide_empty' => false,
128
- )
129
  );
130
 
131
  foreach ( $terms as $term ) {
@@ -149,10 +149,10 @@ class WP_Job_Manager_Usage_Tracking_Data {
149
  private static function get_job_type_has_employment_type_count() {
150
  $count = 0;
151
  $terms = get_terms(
152
- array(
153
  'taxonomy' => 'job_listing_type',
154
  'hide_empty' => false,
155
- )
156
  );
157
 
158
  foreach ( $terms as $term ) {
@@ -177,18 +177,18 @@ class WP_Job_Manager_Usage_Tracking_Data {
177
  **/
178
  private static function get_jobs_by_type_count( $job_type ) {
179
  $query = new WP_Query(
180
- array(
181
  'post_type' => 'job_listing',
182
- 'post_status' => array( 'expired', 'publish' ),
183
  'fields' => 'ids',
184
- 'tax_query' => array(
185
- array(
186
  'field' => 'slug',
187
  'taxonomy' => 'job_listing_type',
188
  'terms' => $job_type,
189
- ),
190
- ),
191
- )
192
  );
193
 
194
  return $query->found_posts;
@@ -203,17 +203,17 @@ class WP_Job_Manager_Usage_Tracking_Data {
203
  */
204
  private static function get_company_logo_count() {
205
  $query = new WP_Query(
206
- array(
207
  'post_type' => 'job_listing',
208
- 'post_status' => array( 'expired', 'publish' ),
209
  'fields' => 'ids',
210
- 'meta_query' => array(
211
- array(
212
  'key' => '_thumbnail_id',
213
  'compare' => 'EXISTS',
214
- ),
215
- ),
216
- )
217
  );
218
 
219
  return $query->found_posts;
@@ -228,17 +228,17 @@ class WP_Job_Manager_Usage_Tracking_Data {
228
  **/
229
  private static function get_job_type_count() {
230
  $query = new WP_Query(
231
- array(
232
  'post_type' => 'job_listing',
233
- 'post_status' => array( 'expired', 'publish' ),
234
  'fields' => 'ids',
235
- 'tax_query' => array(
236
- array(
237
  'taxonomy' => 'job_listing_type',
238
  'operator' => 'EXISTS',
239
- ),
240
- ),
241
- )
242
  );
243
 
244
  return $query->found_posts;
@@ -253,18 +253,18 @@ class WP_Job_Manager_Usage_Tracking_Data {
253
  */
254
  private static function get_jobs_count_with_meta( $meta_key ) {
255
  $query = new WP_Query(
256
- array(
257
  'post_type' => 'job_listing',
258
- 'post_status' => array( 'publish', 'expired' ),
259
  'fields' => 'ids',
260
- 'meta_query' => array(
261
- array(
262
  'key' => $meta_key,
263
  'value' => '[^[:space:]]',
264
  'compare' => 'REGEXP',
265
- ),
266
- ),
267
- )
268
  );
269
 
270
  return $query->found_posts;
@@ -280,17 +280,17 @@ class WP_Job_Manager_Usage_Tracking_Data {
280
  */
281
  private static function get_jobs_count_with_checked_meta( $meta_key ) {
282
  $query = new WP_Query(
283
- array(
284
  'post_type' => 'job_listing',
285
- 'post_status' => array( 'publish', 'expired' ),
286
  'fields' => 'ids',
287
- 'meta_query' => array(
288
- array(
289
  'key' => $meta_key,
290
  'value' => '1',
291
- ),
292
- ),
293
- )
294
  );
295
 
296
  return $query->found_posts;
@@ -303,12 +303,12 @@ class WP_Job_Manager_Usage_Tracking_Data {
303
  */
304
  private static function get_jobs_by_guests() {
305
  $query = new WP_Query(
306
- array(
307
  'post_type' => 'job_listing',
308
- 'post_status' => array( 'publish', 'expired' ),
309
  'fields' => 'ids',
310
- 'author__in' => array( 0 ),
311
- )
312
  );
313
 
314
  return $query->found_posts;
@@ -371,10 +371,10 @@ class WP_Job_Manager_Usage_Tracking_Data {
371
  * @return array
372
  */
373
  public static function get_event_logging_base_fields() {
374
- $base_fields = array(
375
  'job_listings' => wp_count_posts( 'job_listing' )->publish,
376
  'paid' => self::has_paid_extensions() ? 1 : 0,
377
- );
378
 
379
  /**
380
  * Filter the fields that should be sent with every event that is logged.
27
  $count_posts = wp_count_posts( 'job_listing' );
28
 
29
  if ( taxonomy_exists( 'job_listing_category' ) ) {
30
+ $categories = wp_count_terms( 'job_listing_category', [ 'hide_empty' => false ] );
31
  }
32
 
33
+ return [
34
  'employers' => self::get_employer_count(),
35
  'job_categories' => $categories,
36
  'job_categories_desc' => self::get_job_category_has_description_count(),
37
+ 'job_types' => wp_count_terms( 'job_listing_type', [ 'hide_empty' => false ] ),
38
  'job_types_desc' => self::get_job_type_has_description_count(),
39
  'job_types_emp_type' => self::get_job_type_has_employment_type_count(),
40
  'jobs_type' => self::get_job_type_count(),
62
  'jobs_by_guests' => self::get_jobs_by_guests(),
63
  'official_extensions' => self::get_official_extensions_count(),
64
  'licensed_extensions' => self::get_licensed_extensions_count(),
65
+ ];
66
  }
67
 
68
  /**
72
  */
73
  private static function get_employer_count() {
74
  $employer_query = new WP_User_Query(
75
+ [
76
  'fields' => 'ID',
77
  'role' => 'employer',
78
+ ]
79
  );
80
 
81
  return $employer_query->total_users;
95
 
96
  $count = 0;
97
  $terms = get_terms(
98
+ [
99
  'taxonomy' => 'job_listing_category',
100
  'hide_empty' => false,
101
+ ]
102
  );
103
 
104
  foreach ( $terms as $term ) {
122
  private static function get_job_type_has_description_count() {
123
  $count = 0;
124
  $terms = get_terms(
125
+ [
126
  'taxonomy' => 'job_listing_type',
127
  'hide_empty' => false,
128
+ ]
129
  );
130
 
131
  foreach ( $terms as $term ) {
149
  private static function get_job_type_has_employment_type_count() {
150
  $count = 0;
151
  $terms = get_terms(
152
+ [
153
  'taxonomy' => 'job_listing_type',
154
  'hide_empty' => false,
155
+ ]
156
  );
157
 
158
  foreach ( $terms as $term ) {
177
  **/
178
  private static function get_jobs_by_type_count( $job_type ) {
179
  $query = new WP_Query(
180
+ [
181
  'post_type' => 'job_listing',
182
+ 'post_status' => [ 'expired', 'publish' ],
183
  'fields' => 'ids',
184
+ 'tax_query' => [
185
+ [
186
  'field' => 'slug',
187
  'taxonomy' => 'job_listing_type',
188
  'terms' => $job_type,
189
+ ],
190
+ ],
191
+ ]
192
  );
193
 
194
  return $query->found_posts;
203
  */
204
  private static function get_company_logo_count() {
205
  $query = new WP_Query(
206
+ [
207
  'post_type' => 'job_listing',
208
+ 'post_status' => [ 'expired', 'publish' ],
209
  'fields' => 'ids',
210
+ 'meta_query' => [
211
+ [
212
  'key' => '_thumbnail_id',
213
  'compare' => 'EXISTS',
214
+ ],
215
+ ],
216
+ ]
217
  );
218
 
219
  return $query->found_posts;
228
  **/
229
  private static function get_job_type_count() {
230
  $query = new WP_Query(
231
+ [
232
  'post_type' => 'job_listing',
233
+ 'post_status' => [ 'expired', 'publish' ],
234
  'fields' => 'ids',
235
+ 'tax_query' => [
236
+ [
237
  'taxonomy' => 'job_listing_type',
238
  'operator' => 'EXISTS',
239
+ ],
240
+ ],
241
+ ]
242
  );
243
 
244
  return $query->found_posts;
253
  */
254
  private static function get_jobs_count_with_meta( $meta_key ) {
255
  $query = new WP_Query(
256
+ [
257
  'post_type' => 'job_listing',
258
+ 'post_status' => [ 'publish', 'expired' ],
259
  'fields' => 'ids',
260
+ 'meta_query' => [
261
+ [
262
  'key' => $meta_key,
263
  'value' => '[^[:space:]]',
264
  'compare' => 'REGEXP',
265
+ ],
266
+ ],
267
+ ]
268
  );
269
 
270
  return $query->found_posts;
280
  */
281
  private static function get_jobs_count_with_checked_meta( $meta_key ) {
282
  $query = new WP_Query(
283
+ [
284
  'post_type' => 'job_listing',
285
+ 'post_status' => [ 'publish', 'expired' ],
286
  'fields' => 'ids',
287
+ 'meta_query' => [
288
+ [
289
  'key' => $meta_key,
290
  'value' => '1',
291
+ ],
292
+ ],
293
+ ]
294
  );
295
 
296
  return $query->found_posts;
303
  */
304
  private static function get_jobs_by_guests() {
305
  $query = new WP_Query(
306
+ [
307
  'post_type' => 'job_listing',
308
+ 'post_status' => [ 'publish', 'expired' ],
309
  'fields' => 'ids',
310
+ 'author__in' => [ 0 ],
311
+ ]
312
  );
313
 
314
  return $query->found_posts;
371
  * @return array
372
  */
373
  public static function get_event_logging_base_fields() {
374
+ $base_fields = [
375
  'job_listings' => wp_count_posts( 'job_listing' )->publish,
376
  'paid' => self::has_paid_extensions() ? 1 : 0,
377
+ ];
378
 
379
  /**
380
  * Filter the fields that should be sent with every event that is logged.
includes/class-wp-job-manager-usage-tracking.php CHANGED
@@ -27,12 +27,12 @@ class WP_Job_Manager_Usage_Tracking extends WP_Job_Manager_Usage_Tracking_Base {
27
  parent::__construct();
28
 
29
  // Add filter for settings.
30
- add_filter( 'job_manager_settings', array( $this, 'add_setting_field' ) );
31
 
32
  // In the setup wizard, do not display the normal opt-in dialog.
33
  // phpcs:ignore WordPress.Security.NonceVerification.Recommended -- Input is used safely.
34
  if ( isset( $_GET['page'] ) && 'job-manager-setup' === $_GET['page'] ) {
35
- remove_action( 'admin_notices', array( $this, 'maybe_display_tracking_opt_in' ) );
36
  }
37
  }
38
 
@@ -42,7 +42,7 @@ class WP_Job_Manager_Usage_Tracking extends WP_Job_Manager_Usage_Tracking_Base {
42
  * @return array
43
  */
44
  protected function get_base_system_data() {
45
- $base_data = array();
46
  $base_data['version'] = JOB_MANAGER_VERSION;
47
 
48
  return $base_data;
@@ -56,7 +56,7 @@ class WP_Job_Manager_Usage_Tracking extends WP_Job_Manager_Usage_Tracking_Base {
56
  * @param string $event_name The name of the event, without the `wpjm` prefix.
57
  * @param array $properties The event properties to be sent.
58
  */
59
- public static function log_event( $event_name, $properties = array() ) {
60
  $properties = array_merge(
61
  WP_Job_Manager_Usage_Tracking_Data::get_event_logging_base_fields(),
62
  $properties
@@ -106,7 +106,7 @@ class WP_Job_Manager_Usage_Tracking extends WP_Job_Manager_Usage_Tracking_Base {
106
  * @param int $post_id Post ID.
107
  * @param array $properties Default properties to use.
108
  */
109
- public static function track_job_submission( $post_id, $properties = array() ) {
110
  // Only track the first time a job is submitted.
111
  if ( get_post_meta( $post_id, '_tracked_submitted' ) ) {
112
  return;
@@ -130,7 +130,7 @@ class WP_Job_Manager_Usage_Tracking extends WP_Job_Manager_Usage_Tracking_Base {
130
  * @param int $post_id Post ID.
131
  * @param array $properties Default properties to use.
132
  */
133
- public static function track_job_approval( $post_id, $properties = array() ) {
134
  // Only track the first time a job is approved.
135
  if ( get_post_meta( $post_id, '_tracked_approved' ) ) {
136
  return;
@@ -245,14 +245,14 @@ class WP_Job_Manager_Usage_Tracking extends WP_Job_Manager_Usage_Tracking_Base {
245
  if ( 1 === preg_match( '/^wp\-job\-manager/', $plugin_slug ) ) {
246
  return true;
247
  }
248
- $third_party_plugins = array(
249
  'all-in-one-seo-pack',
250
  'polylang',
251
  'jetpack',
252
  'wordpress-seo', // Yoast.
253
  'sitepress-multilingual-cms', // WPML.
254
  'bibblio-related-posts', // Related Posts for WordPress.
255
- );
256
  if ( in_array( $plugin_slug, $third_party_plugins, true ) ) {
257
  return true;
258
  }
@@ -316,14 +316,14 @@ class WP_Job_Manager_Usage_Tracking extends WP_Job_Manager_Usage_Tracking_Base {
316
  * @return array
317
  */
318
  public function add_setting_field( $fields ) {
319
- $fields['general'][1][] = array(
320
  'name' => self::WPJM_SETTING_NAME,
321
  'std' => '0',
322
  'type' => 'checkbox',
323
  'desc' => '',
324
  'label' => __( 'Enable Usage Tracking', 'wp-job-manager' ),
325
  'cb_label' => $this->opt_in_checkbox_text(),
326
- );
327
 
328
  return $fields;
329
  }
27
  parent::__construct();
28
 
29
  // Add filter for settings.
30
+ add_filter( 'job_manager_settings', [ $this, 'add_setting_field' ] );
31
 
32
  // In the setup wizard, do not display the normal opt-in dialog.
33
  // phpcs:ignore WordPress.Security.NonceVerification.Recommended -- Input is used safely.
34
  if ( isset( $_GET['page'] ) && 'job-manager-setup' === $_GET['page'] ) {
35
+ remove_action( 'admin_notices', [ $this, 'maybe_display_tracking_opt_in' ] );
36
  }
37
  }
38
 
42
  * @return array
43
  */
44
  protected function get_base_system_data() {
45
+ $base_data = [];
46
  $base_data['version'] = JOB_MANAGER_VERSION;
47
 
48
  return $base_data;
56
  * @param string $event_name The name of the event, without the `wpjm` prefix.
57
  * @param array $properties The event properties to be sent.
58
  */
59
+ public static function log_event( $event_name, $properties = [] ) {
60
  $properties = array_merge(
61
  WP_Job_Manager_Usage_Tracking_Data::get_event_logging_base_fields(),
62
  $properties
106
  * @param int $post_id Post ID.
107
  * @param array $properties Default properties to use.
108
  */
109
+ public static function track_job_submission( $post_id, $properties = [] ) {
110
  // Only track the first time a job is submitted.
111
  if ( get_post_meta( $post_id, '_tracked_submitted' ) ) {
112
  return;
130
  * @param int $post_id Post ID.
131
  * @param array $properties Default properties to use.
132
  */
133
+ public static function track_job_approval( $post_id, $properties = [] ) {
134
  // Only track the first time a job is approved.
135
  if ( get_post_meta( $post_id, '_tracked_approved' ) ) {
136
  return;
245
  if ( 1 === preg_match( '/^wp\-job\-manager/', $plugin_slug ) ) {
246
  return true;
247
  }
248
+ $third_party_plugins = [
249
  'all-in-one-seo-pack',
250
  'polylang',
251
  'jetpack',
252
  'wordpress-seo', // Yoast.
253
  'sitepress-multilingual-cms', // WPML.
254
  'bibblio-related-posts', // Related Posts for WordPress.
255
+ ];
256
  if ( in_array( $plugin_slug, $third_party_plugins, true ) ) {
257
  return true;
258
  }
316
  * @return array
317
  */
318
  public function add_setting_field( $fields ) {
319
+ $fields['general'][1][] = [
320
  'name' => self::WPJM_SETTING_NAME,
321
  'std' => '0',
322
  'type' => 'checkbox',
323
  'desc' => '',
324
  'label' => __( 'Enable Usage Tracking', 'wp-job-manager' ),
325
  'cb_label' => $this->opt_in_checkbox_text(),
326
+ ];
327
 
328
  return $fields;
329
  }
includes/class-wp-job-manager-widget.php CHANGED
@@ -62,16 +62,16 @@ class WP_Job_Manager_Widget extends WP_Widget {
62
  * Registers widget.
63
  */
64
  public function register() {
65
- $widget_ops = array(
66
  'classname' => $this->widget_cssclass,
67
  'description' => $this->widget_description,
68
- );
69
 
70
  parent::__construct( $this->widget_id, $this->widget_name, $widget_ops );
71
 
72
- add_action( 'save_post', array( $this, 'flush_widget_cache' ) );
73
- add_action( 'deleted_post', array( $this, 'flush_widget_cache' ) );
74
- add_action( 'switch_theme', array( $this, 'flush_widget_cache' ) );
75
  }
76
 
77
  /**
@@ -84,7 +84,7 @@ class WP_Job_Manager_Widget extends WP_Widget {
84
  $cache = wp_cache_get( $this->widget_id, 'widget' );
85
 
86
  if ( ! is_array( $cache ) ) {
87
- $cache = array();
88
  }
89
 
90
  if ( isset( $cache[ $args['widget_id'] ] ) ) {
@@ -201,7 +201,7 @@ class WP_Job_Manager_Widget extends WP_Widget {
201
  * @return array
202
  */
203
  protected function get_default_instance() {
204
- $defaults = array();
205
  if ( ! empty( $this->settings ) ) {
206
  foreach ( $this->settings as $key => $setting ) {
207
  $defaults[ $key ] = null;
62
  * Registers widget.
63
  */
64
  public function register() {
65
+ $widget_ops = [
66
  'classname' => $this->widget_cssclass,
67
  'description' => $this->widget_description,
68
+ ];
69
 
70
  parent::__construct( $this->widget_id, $this->widget_name, $widget_ops );
71
 
72
+ add_action( 'save_post', [ $this, 'flush_widget_cache' ] );
73
+ add_action( 'deleted_post', [ $this, 'flush_widget_cache' ] );
74
+ add_action( 'switch_theme', [ $this, 'flush_widget_cache' ] );
75
  }
76
 
77
  /**
84
  $cache = wp_cache_get( $this->widget_id, 'widget' );
85
 
86
  if ( ! is_array( $cache ) ) {
87
+ $cache = [];
88
  }
89
 
90
  if ( isset( $cache[ $args['widget_id'] ] ) ) {
201
  * @return array
202
  */
203
  protected function get_default_instance() {
204
+ $defaults = [];
205
  if ( ! empty( $this->settings ) ) {
206
  foreach ( $this->settings as $key => $setting ) {
207
  $defaults[ $key ] = null;
includes/class-wp-job-manager.php CHANGED
@@ -76,26 +76,26 @@ class WP_Job_Manager {
76
  self::maybe_schedule_cron_jobs();
77
 
78
  // Switch theme.
79
- add_action( 'after_switch_theme', array( 'WP_Job_Manager_Ajax', 'add_endpoint' ), 10 );
80
- add_action( 'after_switch_theme', array( $this->post_types, 'register_post_types' ), 11 );
81
  add_action( 'after_switch_theme', 'flush_rewrite_rules', 15 );
82
 
83
  // Actions.
84
- add_action( 'after_setup_theme', array( $this, 'load_plugin_textdomain' ) );
85
- add_action( 'after_setup_theme', array( $this, 'include_template_functions' ), 11 );
86
- add_action( 'widgets_init', array( $this, 'widgets_init' ) );
87
- add_action( 'wp_loaded', array( $this, 'register_shared_assets' ) );
88
- add_action( 'wp_enqueue_scripts', array( $this, 'frontend_scripts' ) );
89
- add_action( 'admin_init', array( $this, 'updater' ) );
90
- add_action( 'admin_init', array( $this, 'add_privacy_policy_content' ) );
91
- add_action( 'wp_logout', array( $this, 'cleanup_job_posting_cookies' ) );
92
- add_action( 'init', array( 'WP_Job_Manager_Email_Notifications', 'init' ) );
93
- add_action( 'rest_api_init', array( $this, 'rest_init' ) );
94
 
95
  // Filters.
96
- add_filter( 'wp_privacy_personal_data_exporters', array( 'WP_Job_Manager_Data_Exporter', 'register_wpjm_user_data_exporter' ) );
97
 
98
- add_action( 'init', array( $this, 'usage_tracking_init' ) );
99
 
100
  // Defaults for WPJM core actions.
101
  add_action( 'wpjm_notify_new_user', 'wp_job_manager_notify_new_user', 10, 2 );
@@ -136,7 +136,7 @@ class WP_Job_Manager {
136
  $content = sprintf(
137
  // translators: Placeholders %1$s and %2$s are the names of the two cookies used in WP Job Manager.
138
  __(
139
- 'This site adds the following cookies to help users resume job submissions that they
140
  have started but have not completed: %1$s and %2$s',
141
  'wp-job-manager'
142
  ),
@@ -192,7 +192,7 @@ class WP_Job_Manager {
192
  include_once JOB_MANAGER_PLUGIN_DIR . '/includes/class-wp-job-manager-usage-tracking-data.php';
193
 
194
  WP_Job_Manager_Usage_Tracking::get_instance()->set_callback(
195
- array( 'WP_Job_Manager_Usage_Tracking_Data', 'get_usage_data' )
196
  );
197
 
198
  if ( is_admin() ) {
@@ -250,15 +250,15 @@ class WP_Job_Manager {
250
  global $wp_scripts;
251
 
252
  $jquery_version = isset( $wp_scripts->registered['jquery-ui-core']->ver ) ? $wp_scripts->registered['jquery-ui-core']->ver : '1.9.2';
253
- wp_register_style( 'jquery-ui', '//code.jquery.com/ui/' . $jquery_version . '/themes/smoothness/jquery-ui.css', array(), $jquery_version );
254
  }
255
 
256
  /**
257
  * Registers select2 assets when needed.
258
  */
259
  public static function register_select2_assets() {
260
- wp_register_script( 'select2', JOB_MANAGER_PLUGIN_URL . '/assets/js/select2/select2.full.min.js', array( 'jquery' ), '4.0.5', false );
261
- wp_register_style( 'select2', JOB_MANAGER_PLUGIN_URL . '/assets/js/select2/select2.min.css', array(), '4.0.5' );
262
  }
263
 
264
  /**
@@ -269,12 +269,12 @@ class WP_Job_Manager {
269
  */
270
  public function frontend_scripts() {
271
  $ajax_url = WP_Job_Manager_Ajax::get_endpoint();
272
- $ajax_filter_deps = array( 'jquery', 'jquery-deserialize' );
273
- $ajax_data = array(
274
  'ajax_url' => $ajax_url,
275
  'is_rtl' => is_rtl() ? 1 : 0,
276
  'i18n_load_prev_listings' => __( 'Load previous listings', 'wp-job-manager' ),
277
- );
278
 
279
  /**
280
  * Retrieves the current language for use when caching requests.
@@ -285,7 +285,7 @@ class WP_Job_Manager {
285
  */
286
  $ajax_data['lang'] = apply_filters( 'wpjm_lang', null );
287
 
288
- $enhanced_select_shortcodes = array( 'submit_job_form', 'job_dashboard', 'jobs' );
289
  $enhanced_select_used_on_page = has_wpjm_shortcode( null, $enhanced_select_shortcodes );
290
 
291
  /**
@@ -299,8 +299,8 @@ class WP_Job_Manager {
299
 
300
  // Register the script for dependencies that still require it.
301
  if ( ! wp_script_is( 'chosen', 'registered' ) ) {
302
- wp_register_script( 'chosen', JOB_MANAGER_PLUGIN_URL . '/assets/js/jquery-chosen/chosen.jquery.min.js', array( 'jquery' ), '1.1.0', true );
303
- wp_register_style( 'chosen', JOB_MANAGER_PLUGIN_URL . '/assets/css/chosen.css', array(), '1.1.0' );
304
  }
305
 
306
  // Backwards compatibility for third-party themes/plugins while they transition to Select2.
@@ -309,9 +309,9 @@ class WP_Job_Manager {
309
  'job_manager_chosen_multiselect_args',
310
  apply_filters(
311
  'job_manager_chosen_multiselect_args',
312
- array(
313
  'search_contains' => true,
314
- )
315
  )
316
  );
317
 
@@ -346,13 +346,13 @@ class WP_Job_Manager {
346
  */
347
  if ( apply_filters( 'job_manager_enhanced_select_enabled', $enhanced_select_used_on_page ) ) {
348
  self::register_select2_assets();
349
- wp_register_script( 'wp-job-manager-term-multiselect', JOB_MANAGER_PLUGIN_URL . '/assets/js/term-multiselect.min.js', array( 'jquery', 'select2' ), JOB_MANAGER_VERSION, true );
350
- wp_register_script( 'wp-job-manager-multiselect', JOB_MANAGER_PLUGIN_URL . '/assets/js/multiselect.min.js', array( 'jquery', 'select2' ), JOB_MANAGER_VERSION, true );
351
  wp_enqueue_style( 'select2' );
352
 
353
  $ajax_filter_deps[] = 'select2';
354
 
355
- $select2_args = array();
356
  if ( is_rtl() ) {
357
  $select2_args['dir'] = 'rtl';
358
  }
@@ -367,74 +367,74 @@ class WP_Job_Manager {
367
  }
368
 
369
  if ( job_manager_user_can_upload_file_via_ajax() ) {
370
- wp_register_script( 'jquery-iframe-transport', JOB_MANAGER_PLUGIN_URL . '/assets/js/jquery-fileupload/jquery.iframe-transport.js', array( 'jquery' ), '9.30.0', true );
371
- wp_register_script( 'jquery-fileupload', JOB_MANAGER_PLUGIN_URL . '/assets/js/jquery-fileupload/jquery.fileupload.js', array( 'jquery', 'jquery-iframe-transport', 'jquery-ui-widget' ), '9.30.0', true );
372
- wp_register_script( 'wp-job-manager-ajax-file-upload', JOB_MANAGER_PLUGIN_URL . '/assets/js/ajax-file-upload.min.js', array( 'jquery', 'jquery-fileupload' ), JOB_MANAGER_VERSION, true );
373
 
374
  ob_start();
375
  get_job_manager_template(
376
  'form-fields/uploaded-file-html.php',
377
- array(
378
  'name' => '',
379
  'value' => '',
380
  'extension' => 'jpg',
381
- )
382
  );
383
  $js_field_html_img = ob_get_clean();
384
 
385
  ob_start();
386
  get_job_manager_template(
387
  'form-fields/uploaded-file-html.php',
388
- array(
389
  'name' => '',
390
  'value' => '',
391
  'extension' => 'zip',
392
- )
393
  );
394
  $js_field_html = ob_get_clean();
395
 
396
  wp_localize_script(
397
  'wp-job-manager-ajax-file-upload',
398
  'job_manager_ajax_file_upload',
399
- array(
400
  'ajax_url' => $ajax_url,
401
  'js_field_html_img' => esc_js( str_replace( "\n", '', $js_field_html_img ) ),
402
  'js_field_html' => esc_js( str_replace( "\n", '', $js_field_html ) ),
403
  'i18n_invalid_file_type' => esc_html__( 'Invalid file type. Accepted types:', 'wp-job-manager' ),
404
- )
405
  );
406
  }
407
 
408
- wp_register_script( 'jquery-deserialize', JOB_MANAGER_PLUGIN_URL . '/assets/js/jquery-deserialize/jquery.deserialize.js', array( 'jquery' ), '1.2.1', true );
409
  wp_register_script( 'wp-job-manager-ajax-filters', JOB_MANAGER_PLUGIN_URL . '/assets/js/ajax-filters.min.js', $ajax_filter_deps, JOB_MANAGER_VERSION, true );
410
- wp_register_script( 'wp-job-manager-job-dashboard', JOB_MANAGER_PLUGIN_URL . '/assets/js/job-dashboard.min.js', array( 'jquery' ), JOB_MANAGER_VERSION, true );
411
- wp_register_script( 'wp-job-manager-job-application', JOB_MANAGER_PLUGIN_URL . '/assets/js/job-application.min.js', array( 'jquery' ), JOB_MANAGER_VERSION, true );
412
- wp_register_script( 'wp-job-manager-job-submission', JOB_MANAGER_PLUGIN_URL . '/assets/js/job-submission.min.js', array( 'jquery' ), JOB_MANAGER_VERSION, true );
413
  wp_localize_script( 'wp-job-manager-ajax-filters', 'job_manager_ajax_filters', $ajax_data );
414
 
415
  wp_localize_script(
416
  'wp-job-manager-job-submission',
417
  'job_manager_job_submission',
418
- array(
419
  // translators: Placeholder %d is the number of files to that users are limited to.
420
  'i18n_over_upload_limit' => esc_html__( 'You are only allowed to upload a maximum of %d files.', 'wp-job-manager' ),
421
- )
422
  );
423
 
424
  wp_localize_script(
425
  'wp-job-manager-job-dashboard',
426
  'job_manager_job_dashboard',
427
- array(
428
  'i18n_confirm_delete' => esc_html__( 'Are you sure you want to delete this listing?', 'wp-job-manager' ),
429
- )
430
  );
431
 
432
  wp_localize_script(
433
  'wp-job-manager-job-submission',
434
  'job_manager_job_submission',
435
- array(
436
  'i18n_required_field' => __( 'This field is required.', 'wp-job-manager' ),
437
- )
438
  );
439
 
440
  /**
@@ -462,9 +462,9 @@ class WP_Job_Manager {
462
  * @param bool $is_frontend_style_enabled
463
  */
464
  if ( apply_filters( 'job_manager_enqueue_frontend_style', is_wpjm() ) ) {
465
- wp_enqueue_style( 'wp-job-manager-frontend', JOB_MANAGER_PLUGIN_URL . '/assets/css/frontend.css', array(), JOB_MANAGER_VERSION );
466
  } else {
467
- wp_register_style( 'wp-job-manager-job-listings', JOB_MANAGER_PLUGIN_URL . '/assets/css/job-listings.css', array(), JOB_MANAGER_VERSION );
468
  }
469
  }
470
  }
76
  self::maybe_schedule_cron_jobs();
77
 
78
  // Switch theme.
79
+ add_action( 'after_switch_theme', [ 'WP_Job_Manager_Ajax', 'add_endpoint' ], 10 );
80
+ add_action( 'after_switch_theme', [ $this->post_types, 'register_post_types' ], 11 );
81
  add_action( 'after_switch_theme', 'flush_rewrite_rules', 15 );
82
 
83
  // Actions.
84
+ add_action( 'after_setup_theme', [ $this, 'load_plugin_textdomain' ] );
85
+ add_action( 'after_setup_theme', [ $this, 'include_template_functions' ], 11 );
86
+ add_action( 'widgets_init', [ $this, 'widgets_init' ] );
87
+ add_action( 'wp_loaded', [ $this, 'register_shared_assets' ] );
88
+ add_action( 'wp_enqueue_scripts', [ $this, 'frontend_scripts' ] );
89
+ add_action( 'admin_init', [ $this, 'updater' ] );
90
+ add_action( 'admin_init', [ $this, 'add_privacy_policy_content' ] );
91
+ add_action( 'wp_logout', [ $this, 'cleanup_job_posting_cookies' ] );
92
+ add_action( 'init', [ 'WP_Job_Manager_Email_Notifications', 'init' ] );
93
+ add_action( 'rest_api_init', [ $this, 'rest_init' ] );
94
 
95
  // Filters.
96
+ add_filter( 'wp_privacy_personal_data_exporters', [ 'WP_Job_Manager_Data_Exporter', 'register_wpjm_user_data_exporter' ] );
97
 
98
+ add_action( 'init', [ $this, 'usage_tracking_init' ] );
99
 
100
  // Defaults for WPJM core actions.
101
  add_action( 'wpjm_notify_new_user', 'wp_job_manager_notify_new_user', 10, 2 );
136
  $content = sprintf(
137
  // translators: Placeholders %1$s and %2$s are the names of the two cookies used in WP Job Manager.
138
  __(
139
+ 'This site adds the following cookies to help users resume job submissions that they
140
  have started but have not completed: %1$s and %2$s',
141
  'wp-job-manager'
142
  ),
192
  include_once JOB_MANAGER_PLUGIN_DIR . '/includes/class-wp-job-manager-usage-tracking-data.php';
193
 
194
  WP_Job_Manager_Usage_Tracking::get_instance()->set_callback(
195
+ [ 'WP_Job_Manager_Usage_Tracking_Data', 'get_usage_data' ]
196
  );
197
 
198
  if ( is_admin() ) {
250
  global $wp_scripts;
251
 
252
  $jquery_version = isset( $wp_scripts->registered['jquery-ui-core']->ver ) ? $wp_scripts->registered['jquery-ui-core']->ver : '1.9.2';
253
+ wp_register_style( 'jquery-ui', '//code.jquery.com/ui/' . $jquery_version . '/themes/smoothness/jquery-ui.min.css', [], $jquery_version );
254
  }
255
 
256
  /**
257
  * Registers select2 assets when needed.
258
  */
259
  public static function register_select2_assets() {
260
+ wp_register_script( 'select2', JOB_MANAGER_PLUGIN_URL . '/assets/js/select2/select2.full.min.js', [ 'jquery' ], '4.0.5', false );
261
+ wp_register_style( 'select2', JOB_MANAGER_PLUGIN_URL . '/assets/js/select2/select2.min.css', [], '4.0.5' );
262
  }
263
 
264
  /**
269
  */
270
  public function frontend_scripts() {
271
  $ajax_url = WP_Job_Manager_Ajax::get_endpoint();
272
+ $ajax_filter_deps = [ 'jquery', 'jquery-deserialize' ];
273
+ $ajax_data = [
274
  'ajax_url' => $ajax_url,
275
  'is_rtl' => is_rtl() ? 1 : 0,
276
  'i18n_load_prev_listings' => __( 'Load previous listings', 'wp-job-manager' ),
277
+ ];
278
 
279
  /**
280
  * Retrieves the current language for use when caching requests.
285
  */
286
  $ajax_data['lang'] = apply_filters( 'wpjm_lang', null );
287
 
288
+ $enhanced_select_shortcodes = [ 'submit_job_form', 'job_dashboard', 'jobs' ];
289
  $enhanced_select_used_on_page = has_wpjm_shortcode( null, $enhanced_select_shortcodes );
290
 
291
  /**
299
 
300
  // Register the script for dependencies that still require it.
301
  if ( ! wp_script_is( 'chosen', 'registered' ) ) {
302
+ wp_register_script( 'chosen', JOB_MANAGER_PLUGIN_URL . '/assets/js/jquery-chosen/chosen.jquery.min.js', [ 'jquery' ], '1.1.0', true );
303
+ wp_register_style( 'chosen', JOB_MANAGER_PLUGIN_URL . '/assets/css/chosen.css', [], '1.1.0' );
304
  }
305
 
306
  // Backwards compatibility for third-party themes/plugins while they transition to Select2.
309
  'job_manager_chosen_multiselect_args',
310
  apply_filters(
311
  'job_manager_chosen_multiselect_args',
312
+ [
313
  'search_contains' => true,
314
+ ]
315
  )
316
  );
317
 
346
  */
347
  if ( apply_filters( 'job_manager_enhanced_select_enabled', $enhanced_select_used_on_page ) ) {
348
  self::register_select2_assets();
349
+ wp_register_script( 'wp-job-manager-term-multiselect', JOB_MANAGER_PLUGIN_URL . '/assets/js/term-multiselect.min.js', [ 'jquery', 'select2' ], JOB_MANAGER_VERSION, true );
350
+ wp_register_script( 'wp-job-manager-multiselect', JOB_MANAGER_PLUGIN_URL . '/assets/js/multiselect.min.js', [ 'jquery', 'select2' ], JOB_MANAGER_VERSION, true );
351
  wp_enqueue_style( 'select2' );
352
 
353
  $ajax_filter_deps[] = 'select2';
354
 
355
+ $select2_args = [];
356
  if ( is_rtl() ) {
357
  $select2_args['dir'] = 'rtl';
358
  }
367
  }
368
 
369
  if ( job_manager_user_can_upload_file_via_ajax() ) {
370
+ wp_register_script( 'jquery-iframe-transport', JOB_MANAGER_PLUGIN_URL . '/assets/js/jquery-fileupload/jquery.iframe-transport.js', [ 'jquery' ], '10.1.0', true );
371
+ wp_register_script( 'jquery-fileupload', JOB_MANAGER_PLUGIN_URL . '/assets/js/jquery-fileupload/jquery.fileupload.js', [ 'jquery', 'jquery-iframe-transport', 'jquery-ui-widget' ], '10.1.0', true );
372
+ wp_register_script( 'wp-job-manager-ajax-file-upload', JOB_MANAGER_PLUGIN_URL . '/assets/js/ajax-file-upload.min.js', [ 'jquery', 'jquery-fileupload' ], JOB_MANAGER_VERSION, true );
373
 
374
  ob_start();
375
  get_job_manager_template(
376
  'form-fields/uploaded-file-html.php',
377
+ [
378
  'name' => '',
379
  'value' => '',
380
  'extension' => 'jpg',
381
+ ]
382
  );
383
  $js_field_html_img = ob_get_clean();
384
 
385
  ob_start();
386
  get_job_manager_template(
387
  'form-fields/uploaded-file-html.php',
388
+ [
389
  'name' => '',
390
  'value' => '',
391
  'extension' => 'zip',
392
+ ]
393
  );
394
  $js_field_html = ob_get_clean();
395
 
396
  wp_localize_script(
397
  'wp-job-manager-ajax-file-upload',
398
  'job_manager_ajax_file_upload',
399
+ [
400
  'ajax_url' => $ajax_url,
401
  'js_field_html_img' => esc_js( str_replace( "\n", '', $js_field_html_img ) ),
402
  'js_field_html' => esc_js( str_replace( "\n", '', $js_field_html ) ),
403
  'i18n_invalid_file_type' => esc_html__( 'Invalid file type. Accepted types:', 'wp-job-manager' ),
404
+ ]
405
  );
406
  }
407
 
408
+ wp_register_script( 'jquery-deserialize', JOB_MANAGER_PLUGIN_URL . '/assets/js/jquery-deserialize/jquery.deserialize.js', [ 'jquery' ], '1.2.1', true );
409
  wp_register_script( 'wp-job-manager-ajax-filters', JOB_MANAGER_PLUGIN_URL . '/assets/js/ajax-filters.min.js', $ajax_filter_deps, JOB_MANAGER_VERSION, true );
410
+ wp_register_script( 'wp-job-manager-job-dashboard', JOB_MANAGER_PLUGIN_URL . '/assets/js/job-dashboard.min.js', [ 'jquery' ], JOB_MANAGER_VERSION, true );
411
+ wp_register_script( 'wp-job-manager-job-application', JOB_MANAGER_PLUGIN_URL . '/assets/js/job-application.min.js', [ 'jquery' ], JOB_MANAGER_VERSION, true );
412
+ wp_register_script( 'wp-job-manager-job-submission', JOB_MANAGER_PLUGIN_URL . '/assets/js/job-submission.min.js', [ 'jquery' ], JOB_MANAGER_VERSION, true );
413
  wp_localize_script( 'wp-job-manager-ajax-filters', 'job_manager_ajax_filters', $ajax_data );
414
 
415
  wp_localize_script(
416
  'wp-job-manager-job-submission',
417
  'job_manager_job_submission',
418
+ [
419
  // translators: Placeholder %d is the number of files to that users are limited to.
420
  'i18n_over_upload_limit' => esc_html__( 'You are only allowed to upload a maximum of %d files.', 'wp-job-manager' ),
421
+ ]
422
  );
423
 
424
  wp_localize_script(
425
  'wp-job-manager-job-dashboard',
426
  'job_manager_job_dashboard',
427
+ [
428
  'i18n_confirm_delete' => esc_html__( 'Are you sure you want to delete this listing?', 'wp-job-manager' ),
429
+ ]
430
  );
431
 
432
  wp_localize_script(
433
  'wp-job-manager-job-submission',
434
  'job_manager_job_submission',
435
+ [
436
  'i18n_required_field' => __( 'This field is required.', 'wp-job-manager' ),
437
+ ]
438
  );
439
 
440
  /**
462
  * @param bool $is_frontend_style_enabled
463
  */
464
  if ( apply_filters( 'job_manager_enqueue_frontend_style', is_wpjm() ) ) {
465
+ wp_enqueue_style( 'wp-job-manager-frontend', JOB_MANAGER_PLUGIN_URL . '/assets/css/frontend.css', [], JOB_MANAGER_VERSION );
466
  } else {
467
+ wp_register_style( 'wp-job-manager-job-listings', JOB_MANAGER_PLUGIN_URL . '/assets/css/job-listings.css', [], JOB_MANAGER_VERSION );
468
  }
469
  }
470
  }
includes/emails/class-wp-job-manager-email-employer-expiring-job.php CHANGED
@@ -126,14 +126,14 @@ class WP_Job_Manager_Email_Employer_Expiring_Job extends WP_Job_Manager_Email_Te
126
  */
127
  public static function get_setting_fields() {
128
  $fields = parent::get_setting_fields();
129
- $fields[] = array(
130
  'name' => self::SETTING_NOTICE_PERIOD_NAME,
131
  'std' => self::SETTING_NOTICE_PERIOD_DEFAULT,
132
  'label' => __( 'Notice Period', 'wp-job-manager' ),
133
  'type' => 'number',
134
  'after' => ' ' . __( 'days', 'wp-job-manager' ),
135
- 'attributes' => array( 'min' => 0 ),
136
- );
137
  return $fields;
138
  }
139
 
126
  */
127
  public static function get_setting_fields() {
128
  $fields = parent::get_setting_fields();
129
+ $fields[] = [
130
  'name' => self::SETTING_NOTICE_PERIOD_NAME,
131
  'std' => self::SETTING_NOTICE_PERIOD_DEFAULT,
132
  'label' => __( 'Notice Period', 'wp-job-manager' ),
133
  'type' => 'number',
134
  'after' => ' ' . __( 'days', 'wp-job-manager' ),
135
+ 'attributes' => [ 'min' => 0 ],
136
+ ];
137
  return $fields;
138
  }
139
 
includes/forms/class-wp-job-manager-form-edit-job.php CHANGED
@@ -62,8 +62,8 @@ class WP_Job_Manager_Form_Edit_Job extends WP_Job_Manager_Form_Submit_Job {
62
  * Constructor
63
  */
64
  public function __construct() {
65
- add_action( 'wp', array( $this, 'submit_handler' ) );
66
- add_action( 'submit_job_form_start', array( $this, 'output_submit_form_nonce_field' ) );
67
 
68
  // phpcs:ignore WordPress.Security.NonceVerification.Recommended -- Check happens later when possible.
69
  $this->job_id = ! empty( $_REQUEST['job_id'] ) ? absint( $_REQUEST['job_id'] ) : 0;
@@ -88,7 +88,7 @@ class WP_Job_Manager_Form_Edit_Job extends WP_Job_Manager_Form_Submit_Job {
88
  *
89
  * @param array $atts
90
  */
91
- public function output( $atts = array() ) {
92
  if ( ! empty( $this->save_message ) ) {
93
  echo '<div class="job-manager-message">' . wp_kses_post( $this->save_message ) . '</div>';
94
  }
@@ -124,7 +124,7 @@ class WP_Job_Manager_Form_Edit_Job extends WP_Job_Manager_Form_Submit_Job {
124
  $this->fields[ $group_key ][ $key ]['value'] = has_post_thumbnail( $job->ID ) ? get_post_thumbnail_id( $job->ID ) : get_post_meta( $job->ID, '_' . $key, true );
125
 
126
  } elseif ( ! empty( $field['taxonomy'] ) ) {
127
- $this->fields[ $group_key ][ $key ]['value'] = wp_get_object_terms( $job->ID, $field['taxonomy'], array( 'fields' => 'ids' ) );
128
 
129
  } else {
130
  $this->fields[ $group_key ][ $key ]['value'] = get_post_meta( $job->ID, '_' . $key, true );
@@ -149,7 +149,7 @@ class WP_Job_Manager_Form_Edit_Job extends WP_Job_Manager_Form_Submit_Job {
149
 
150
  get_job_manager_template(
151
  'job-submit.php',
152
- array(
153
  'form' => $this->form_name,
154
  'job_id' => $this->get_job_id(),
155
  'action' => $this->get_action(),
@@ -157,7 +157,7 @@ class WP_Job_Manager_Form_Edit_Job extends WP_Job_Manager_Form_Submit_Job {
157
  'company_fields' => $this->get_fields( 'company' ),
158
  'step' => $this->get_step(),
159
  'submit_button_text' => $save_button_text,
160
- )
161
  );
162
  }
163
 
62
  * Constructor
63
  */
64
  public function __construct() {
65
+ add_action( 'wp', [ $this, 'submit_handler' ] );
66
+ add_action( 'submit_job_form_start', [ $this, 'output_submit_form_nonce_field' ] );
67
 
68
  // phpcs:ignore WordPress.Security.NonceVerification.Recommended -- Check happens later when possible.
69
  $this->job_id = ! empty( $_REQUEST['job_id'] ) ? absint( $_REQUEST['job_id'] ) : 0;
88
  *
89
  * @param array $atts
90
  */
91
+ public function output( $atts = [] ) {
92
  if ( ! empty( $this->save_message ) ) {
93
  echo '<div class="job-manager-message">' . wp_kses_post( $this->save_message ) . '</div>';
94
  }
124
  $this->fields[ $group_key ][ $key ]['value'] = has_post_thumbnail( $job->ID ) ? get_post_thumbnail_id( $job->ID ) : get_post_meta( $job->ID, '_' . $key, true );
125
 
126
  } elseif ( ! empty( $field['taxonomy'] ) ) {
127
+ $this->fields[ $group_key ][ $key ]['value'] = wp_get_object_terms( $job->ID, $field['taxonomy'], [ 'fields' => 'ids' ] );
128
 
129
  } else {
130
  $this->fields[ $group_key ][ $key ]['value'] = get_post_meta( $job->ID, '_' . $key, true );
149
 
150
  get_job_manager_template(
151
  'job-submit.php',
152
+ [
153
  'form' => $this->form_name,
154
  'job_id' => $this->get_job_id(),
155
  'action' => $this->get_action(),
157
  'company_fields' => $this->get_fields( 'company' ),
158
  'step' => $this->get_step(),
159
  'submit_button_text' => $save_button_text,
160
+ ]
161
  );
162
  }
163
 
includes/forms/class-wp-job-manager-form-submit-job.php CHANGED
@@ -64,42 +64,42 @@ class WP_Job_Manager_Form_Submit_Job extends WP_Job_Manager_Form {
64
  * Constructor.
65
  */
66
  public function __construct() {
67
- add_action( 'wp', array( $this, 'process' ) );
68
- add_action( 'submit_job_form_start', array( $this, 'output_submit_form_nonce_field' ) );
69
- add_action( 'preview_job_form_start', array( $this, 'output_preview_form_nonce_field' ) );
70
- add_action( 'job_manager_job_submitted', array( $this, 'track_job_submission' ) );
71
 
72
  if ( $this->use_recaptcha_field() ) {
73
- add_action( 'submit_job_form_end', array( $this, 'display_recaptcha_field' ) );
74
- add_filter( 'submit_job_form_validate_fields', array( $this, 'validate_recaptcha_field' ) );
75
- add_filter( 'submit_draft_job_form_validate_fields', array( $this, 'validate_recaptcha_field' ) );
76
  }
77
 
78
  $this->steps = (array) apply_filters(
79
  'submit_job_steps',
80
- array(
81
- 'submit' => array(
82
  'name' => __( 'Submit Details', 'wp-job-manager' ),
83
- 'view' => array( $this, 'submit' ),
84
- 'handler' => array( $this, 'submit_handler' ),
85
  'priority' => 10,
86
- ),
87
- 'preview' => array(
88
  'name' => __( 'Preview', 'wp-job-manager' ),
89
- 'view' => array( $this, 'preview' ),
90
- 'handler' => array( $this, 'preview_handler' ),
91
  'priority' => 20,
92
- ),
93
- 'done' => array(
94
  'name' => __( 'Done', 'wp-job-manager' ),
95
- 'before' => array( $this, 'done_before' ),
96
- 'view' => array( $this, 'done' ),
97
  'priority' => 30,
98
- ),
99
- )
100
  );
101
 
102
- uasort( $this->steps, array( $this, 'sort_by_priority' ) );
103
 
104
  // phpcs:disable WordPress.Security.NonceVerification.Missing, WordPress.Security.NonceVerification.Recommended -- Check happens later when possible. Input is used safely.
105
  // Get step/job.
@@ -150,7 +150,7 @@ class WP_Job_Manager_Form_Submit_Job extends WP_Job_Manager_Form {
150
  $this->job_id = 0;
151
  $this->step = 0;
152
  }
153
- } elseif ( ! in_array( $job_status, apply_filters( 'job_manager_valid_submit_job_statuses', array( 'preview', 'draft' ) ), true ) ) {
154
  $this->job_id = 0;
155
  $this->step = 0;
156
  }
@@ -200,24 +200,24 @@ class WP_Job_Manager_Form_Submit_Job extends WP_Job_Manager_Form {
200
  }
201
  $this->fields = apply_filters(
202
  'submit_job_form_fields',
203
- array(
204
- 'job' => array(
205
- 'job_title' => array(
206
  'label' => __( 'Job Title', 'wp-job-manager' ),
207
  'type' => 'text',
208
  'required' => true,
209
  'placeholder' => '',
210
  'priority' => 1,
211
- ),
212
- 'job_location' => array(
213
  'label' => __( 'Location', 'wp-job-manager' ),
214
  'description' => __( 'Leave this blank if the location is not important', 'wp-job-manager' ),
215
  'type' => 'text',
216
  'required' => false,
217
  'placeholder' => __( 'e.g. "London"', 'wp-job-manager' ),
218
  'priority' => 2,
219
- ),
220
- 'job_type' => array(
221
  'label' => __( 'Job type', 'wp-job-manager' ),
222
  'type' => $job_type,
223
  'required' => true,
@@ -225,8 +225,8 @@ class WP_Job_Manager_Form_Submit_Job extends WP_Job_Manager_Form {
225
  'priority' => 3,
226
  'default' => 'full-time',
227
  'taxonomy' => 'job_listing_type',
228
- ),
229
- 'job_category' => array(
230
  'label' => __( 'Job category', 'wp-job-manager' ),
231
  'type' => 'term-multiselect',
232
  'required' => true,
@@ -234,62 +234,62 @@ class WP_Job_Manager_Form_Submit_Job extends WP_Job_Manager_Form {
234
  'priority' => 4,
235
  'default' => '',
236
  'taxonomy' => 'job_listing_category',
237
- ),
238
- 'job_description' => array(
239
  'label' => __( 'Description', 'wp-job-manager' ),
240
  'type' => 'wp-editor',
241
  'required' => true,
242
  'priority' => 5,
243
- ),
244
- 'application' => array(
245
  'label' => $application_method_label,
246
  'type' => 'text',
247
  'sanitizer' => $application_method_sanitizer,
248
  'required' => true,
249
  'placeholder' => $application_method_placeholder,
250
  'priority' => 6,
251
- ),
252
- ),
253
- 'company' => array(
254
- 'company_name' => array(
255
  'label' => __( 'Company name', 'wp-job-manager' ),
256
  'type' => 'text',
257
  'required' => true,
258
  'placeholder' => __( 'Enter the name of the company', 'wp-job-manager' ),
259
  'priority' => 1,
260
- ),
261
- 'company_website' => array(
262
  'label' => __( 'Website', 'wp-job-manager' ),
263
  'type' => 'text',
264
  'sanitizer' => 'url',
265
  'required' => false,
266
  'placeholder' => __( 'http://', 'wp-job-manager' ),
267
  'priority' => 2,
268
- ),
269
- 'company_tagline' => array(
270
  'label' => __( 'Tagline', 'wp-job-manager' ),
271
  'type' => 'text',
272
  'required' => false,
273
  'placeholder' => __( 'Briefly describe your company', 'wp-job-manager' ),
274
  'maxlength' => 64,
275
  'priority' => 3,
276
- ),
277
- 'company_video' => array(
278
  'label' => __( 'Video', 'wp-job-manager' ),
279
  'type' => 'text',
280
  'sanitizer' => 'url',
281
  'required' => false,
282
  'placeholder' => __( 'A link to a video about your company', 'wp-job-manager' ),
283
  'priority' => 4,
284
- ),
285
- 'company_twitter' => array(
286
  'label' => __( 'Twitter username', 'wp-job-manager' ),
287
  'type' => 'text',
288
  'required' => false,
289
  'placeholder' => __( '@yourcompany', 'wp-job-manager' ),
290
  'priority' => 5,
291
- ),
292
- 'company_logo' => array(
293
  'label' => __( 'Logo', 'wp-job-manager' ),
294
  'type' => 'file',
295
  'required' => false,
@@ -297,15 +297,15 @@ class WP_Job_Manager_Form_Submit_Job extends WP_Job_Manager_Form {
297
  'priority' => 6,
298
  'ajax' => true,
299
  'multiple' => false,
300
- 'allowed_mime_types' => array(
301
  'jpg' => 'image/jpeg',
302
  'jpeg' => 'image/jpeg',
303
  'gif' => 'image/gif',
304
  'png' => 'image/png',
305
- ),
306
- ),
307
- ),
308
- )
309
  );
310
 
311
  if ( ! get_option( 'job_manager_enable_categories' ) || 0 === intval( wp_count_terms( 'job_listing_category' ) ) ) {
@@ -342,11 +342,11 @@ class WP_Job_Manager_Form_Submit_Job extends WP_Job_Manager_Form {
342
  // translators: Placeholder %s is the label for the required field.
343
  return new WP_Error( 'validation-error', sprintf( __( '%s is a required field', 'wp-job-manager' ), $field['label'] ) );
344
  }
345
- if ( ! empty( $field['taxonomy'] ) && in_array( $field['type'], array( 'term-checklist', 'term-select', 'term-multiselect' ), true ) ) {
346
  if ( is_array( $values[ $group_key ][ $key ] ) ) {
347
  $check_value = $values[ $group_key ][ $key ];
348
  } else {
349
- $check_value = empty( $values[ $group_key ][ $key ] ) ? array() : array( $values[ $group_key ][ $key ] );
350
  }
351
  foreach ( $check_value as $term ) {
352
  if ( ! term_exists( $term, $field['taxonomy'] ) ) {
@@ -359,14 +359,14 @@ class WP_Job_Manager_Form_Submit_Job extends WP_Job_Manager_Form {
359
  if ( is_array( $values[ $group_key ][ $key ] ) ) {
360
  $check_value = array_filter( $values[ $group_key ][ $key ] );
361
  } else {
362
- $check_value = array_filter( array( $values[ $group_key ][ $key ] ) );
363
  }
364
  if ( ! empty( $check_value ) ) {
365
  foreach ( $check_value as $file_url ) {
366
  if ( is_numeric( $file_url ) ) {
367
  continue;
368
  }
369
- $file_url = esc_url( $file_url, array( 'http', 'https' ) );
370
  if ( empty( $file_url ) ) {
371
  throw new Exception( __( 'Invalid attachment provided.', 'wp-job-manager' ) );
372
  }
@@ -377,7 +377,7 @@ class WP_Job_Manager_Form_Submit_Job extends WP_Job_Manager_Form {
377
  if ( is_array( $values[ $group_key ][ $key ] ) ) {
378
  $check_value = array_filter( $values[ $group_key ][ $key ] );
379
  } else {
380
- $check_value = array_filter( array( $values[ $group_key ][ $key ] ) );
381
  }
382
  if ( ! empty( $check_value ) ) {
383
  foreach ( $check_value as $file_url ) {
@@ -399,7 +399,7 @@ class WP_Job_Manager_Form_Submit_Job extends WP_Job_Manager_Form {
399
  if ( is_array( $values[ $group_key ][ $key ] ) ) {
400
  $check_value = array_filter( $values[ $group_key ][ $key ] );
401
  } else {
402
- $check_value = array_filter( array( $values[ $group_key ][ $key ] ) );
403
  }
404
  if ( count( $check_value ) > $file_limit ) {
405
  // translators: Placeholder %d is the number of files to that users are limited to.
@@ -464,14 +464,14 @@ class WP_Job_Manager_Form_Submit_Job extends WP_Job_Manager_Form {
464
  */
465
  protected function enqueue_job_form_assets() {
466
  wp_enqueue_script( 'wp-job-manager-job-submission' );
467
- wp_enqueue_style( 'wp-job-manager-job-submission', JOB_MANAGER_PLUGIN_URL . '/assets/css/job-submission.css', array(), JOB_MANAGER_VERSION );
468
 
469
  // Register datepicker JS. It will be enqueued if needed when a date.
470
  // field is rendered.
471
- wp_register_script( 'wp-job-manager-datepicker', JOB_MANAGER_PLUGIN_URL . '/assets/js/datepicker.min.js', array( 'jquery', 'jquery-ui-datepicker' ), JOB_MANAGER_VERSION, true );
472
 
473
  // Localize scripts after the fields are rendered.
474
- add_action( 'submit_job_form_end', array( $this, 'localize_job_form_scripts' ) );
475
  }
476
 
477
  /**
@@ -485,10 +485,10 @@ class WP_Job_Manager_Form_Submit_Job extends WP_Job_Manager_Form {
485
  wp_localize_script(
486
  'wp-job-manager-datepicker',
487
  'job_manager_datepicker',
488
- array(
489
  /* translators: jQuery date format, see http://api.jqueryui.com/datepicker/#utility-formatDate */
490
  'date_format' => _x( 'yy-mm-dd', 'Date format for jQuery datepicker.', 'wp-job-manager' ),
491
- )
492
  );
493
  }
494
  }
@@ -499,7 +499,7 @@ class WP_Job_Manager_Form_Submit_Job extends WP_Job_Manager_Form {
499
  * @return array
500
  */
501
  private function job_types() {
502
- $options = array();
503
  $terms = get_job_listing_types();
504
  foreach ( $terms as $term ) {
505
  $options[ $term->slug ] = $term->name;
@@ -526,13 +526,13 @@ class WP_Job_Manager_Form_Submit_Job extends WP_Job_Manager_Form {
526
  $this->fields[ $group_key ][ $key ]['value'] = $job->post_content;
527
  break;
528
  case 'job_type':
529
- $this->fields[ $group_key ][ $key ]['value'] = wp_get_object_terms( $job->ID, 'job_listing_type', array( 'fields' => 'ids' ) );
530
  if ( ! job_manager_multi_job_type() ) {
531
  $this->fields[ $group_key ][ $key ]['value'] = current( $this->fields[ $group_key ][ $key ]['value'] );
532
  }
533
  break;
534
  case 'job_category':
535
- $this->fields[ $group_key ][ $key ]['value'] = wp_get_object_terms( $job->ID, 'job_listing_category', array( 'fields' => 'ids' ) );
536
  break;
537
  case 'company_logo':
538
  $this->fields[ $group_key ][ $key ]['value'] = has_post_thumbnail( $job->ID ) ? get_post_thumbnail_id( $job->ID ) : get_post_meta( $job->ID, '_' . $key, true );
@@ -566,7 +566,7 @@ class WP_Job_Manager_Form_Submit_Job extends WP_Job_Manager_Form {
566
  $this->enqueue_job_form_assets();
567
  get_job_manager_template(
568
  'job-submit.php',
569
- array(
570
  'form' => $this->form_name,
571
  'job_id' => $this->get_job_id(),
572
  'resume_edit' => $this->resume_edit,
@@ -576,7 +576,7 @@ class WP_Job_Manager_Form_Submit_Job extends WP_Job_Manager_Form {
576
  'step' => $this->get_step(),
577
  'can_continue_later' => $this->can_continue_later(),
578
  'submit_button_text' => apply_filters( 'submit_job_form_submit_button_text', __( 'Preview', 'wp-job-manager' ) ),
579
- )
580
  );
581
  }
582
 
@@ -663,12 +663,12 @@ class WP_Job_Manager_Form_Submit_Job extends WP_Job_Manager_Form {
663
 
664
  if ( ! empty( $input_create_account_email ) ) {
665
  $create_account = wp_job_manager_create_account(
666
- array(
667
  'username' => ( job_manager_generate_username_from_email() || empty( $input_create_account_username ) ) ? '' : $input_create_account_username,
668
  'password' => ( wpjm_use_standard_password_setup_email() || empty( $input_create_account_password ) ) ? '' : $input_create_account_password,
669
  'email' => sanitize_text_field( wp_unslash( $input_create_account_email ) ),
670
  'role' => get_option( 'job_manager_registration_role' ),
671
- )
672
  );
673
  }
674
  }
@@ -693,6 +693,11 @@ class WP_Job_Manager_Form_Submit_Job extends WP_Job_Manager_Form {
693
  $this->save_job( $values['job']['job_title'], $values['job']['job_description'], $post_status, $values );
694
  $this->update_job_data( $values );
695
 
 
 
 
 
 
696
  if ( $is_saving_draft ) {
697
  $job_dashboard_page_id = get_option( 'job_manager_job_dashboard_page_id', false );
698
 
@@ -717,16 +722,16 @@ class WP_Job_Manager_Form_Submit_Job extends WP_Job_Manager_Form {
717
  * @param array $values
718
  * @param bool $update_slug
719
  */
720
- protected function save_job( $post_title, $post_content, $status = 'preview', $values = array(), $update_slug = true ) {
721
- $job_data = array(
722
  'post_title' => $post_title,
723
  'post_content' => $post_content,
724
  'post_type' => 'job_listing',
725
  'comment_status' => 'closed',
726
- );
727
 
728
  if ( $update_slug ) {
729
- $job_slug = array();
730
 
731
  // Prepend with company name.
732
  if ( apply_filters( 'submit_job_form_prefix_post_name_with_company', true ) && ! empty( $values['company']['company_name'] ) ) {
@@ -793,7 +798,7 @@ class WP_Job_Manager_Form_Submit_Job extends WP_Job_Manager_Form {
793
  include_once ABSPATH . 'wp-admin/includes/media.php';
794
 
795
  $upload_dir = wp_upload_dir();
796
- $attachment_url = esc_url( $attachment_url, array( 'http', 'https' ) );
797
  if ( empty( $attachment_url ) ) {
798
  return 0;
799
  }
@@ -807,18 +812,18 @@ class WP_Job_Manager_Form_Submit_Job extends WP_Job_Manager_Form {
807
 
808
  $attachment_url = sprintf( '%s://%s%s', $attachment_url_parts['scheme'], $attachment_url_parts['host'], $attachment_url_parts['path'] );
809
 
810
- $attachment_url = str_replace( array( $upload_dir['baseurl'], WP_CONTENT_URL, site_url( '/' ) ), array( $upload_dir['basedir'], WP_CONTENT_DIR, ABSPATH ), $attachment_url );
811
  if ( empty( $attachment_url ) || ! is_string( $attachment_url ) ) {
812
  return 0;
813
  }
814
 
815
- $attachment = array(
816
  'post_title' => wpjm_get_the_job_title( $this->job_id ),
817
  'post_content' => '',
818
  'post_status' => 'inherit',
819
  'post_parent' => $this->job_id,
820
  'guid' => $attachment_url,
821
- );
822
 
823
  $info = wp_check_filetype( $attachment_url );
824
  if ( $info ) {
@@ -845,7 +850,7 @@ class WP_Job_Manager_Form_Submit_Job extends WP_Job_Manager_Form {
845
  add_post_meta( $this->job_id, '_filled', 0, true );
846
  add_post_meta( $this->job_id, '_featured', 0, true );
847
 
848
- $maybe_attach = array();
849
 
850
  // Loop fields and save meta and term data.
851
  foreach ( $this->fields as $group_key => $group_fields ) {
@@ -855,7 +860,7 @@ class WP_Job_Manager_Form_Submit_Job extends WP_Job_Manager_Form {
855
  if ( is_array( $values[ $group_key ][ $key ] ) ) {
856
  wp_set_object_terms( $this->job_id, $values[ $group_key ][ $key ], $field['taxonomy'], false );
857
  } else {
858
- wp_set_object_terms( $this->job_id, array( $values[ $group_key ][ $key ] ), $field['taxonomy'], false );
859
  }
860
 
861
  // Company logo is a featured image.
@@ -892,7 +897,7 @@ class WP_Job_Manager_Form_Submit_Job extends WP_Job_Manager_Form {
892
  if ( count( $maybe_attach ) && apply_filters( 'job_manager_attach_uploaded_files', true ) ) {
893
  // Get attachments.
894
  $attachments = get_posts( 'post_parent=' . $this->job_id . '&post_type=attachment&fields=ids&numberposts=-1' );
895
- $attachment_urls = array();
896
 
897
  // Loop attachments already attached to the job.
898
  foreach ( $attachments as $attachment_id ) {
@@ -934,9 +939,9 @@ class WP_Job_Manager_Form_Submit_Job extends WP_Job_Manager_Form {
934
 
935
  get_job_manager_template(
936
  'job-preview.php',
937
- array(
938
  'form' => $this,
939
- )
940
  );
941
 
942
  wp_reset_postdata();
@@ -963,12 +968,12 @@ class WP_Job_Manager_Form_Submit_Job extends WP_Job_Manager_Form {
963
  if ( ! empty( $_POST['continue'] ) ) { // phpcs:ignore WordPress.Security.NonceVerification.Missing -- Input is used safely.
964
  $job = get_post( $this->job_id );
965
 
966
- if ( in_array( $job->post_status, array( 'preview', 'expired' ), true ) ) {
967
  // Reset expiry.
968
  delete_post_meta( $job->ID, '_job_expires' );
969
 
970
  // Update job listing.
971
- $update_job = array();
972
  $update_job['ID'] = $job->ID;
973
  $update_job['post_status'] = apply_filters( 'submit_job_post_status', get_option( 'job_manager_submission_requires_approval' ) ? 'pending' : 'publish', $job );
974
  $update_job['post_date'] = current_time( 'mysql' );
@@ -1039,7 +1044,7 @@ class WP_Job_Manager_Form_Submit_Job extends WP_Job_Manager_Form {
1039
  * Displays the final screen after a job listing has been submitted.
1040
  */
1041
  public function done() {
1042
- get_job_manager_template( 'job-submitted.php', array( 'job' => get_post( $this->job_id ) ) );
1043
  }
1044
 
1045
  /**
@@ -1085,10 +1090,10 @@ class WP_Job_Manager_Form_Submit_Job extends WP_Job_Manager_Form {
1085
  public function track_job_submission( $post_id ) {
1086
  WP_Job_Manager_Usage_Tracking::track_job_submission(
1087
  $post_id,
1088
- array(
1089
  'source' => 'frontend',
1090
  'old_status' => 'preview',
1091
- )
1092
  );
1093
  }
1094
  }
64
  * Constructor.
65
  */
66
  public function __construct() {
67
+ add_action( 'wp', [ $this, 'process' ] );
68
+ add_action( 'submit_job_form_start', [ $this, 'output_submit_form_nonce_field' ] );
69
+ add_action( 'preview_job_form_start', [ $this, 'output_preview_form_nonce_field' ] );
70
+ add_action( 'job_manager_job_submitted', [ $this, 'track_job_submission' ] );
71
 
72
  if ( $this->use_recaptcha_field() ) {
73
+ add_action( 'submit_job_form_end', [ $this, 'display_recaptcha_field' ] );
74
+ add_filter( 'submit_job_form_validate_fields', [ $this, 'validate_recaptcha_field' ] );
75
+ add_filter( 'submit_draft_job_form_validate_fields', [ $this, 'validate_recaptcha_field' ] );
76
  }
77
 
78
  $this->steps = (array) apply_filters(
79
  'submit_job_steps',
80
+ [
81
+ 'submit' => [
82
  'name' => __( 'Submit Details', 'wp-job-manager' ),
83
+ 'view' => [ $this, 'submit' ],
84
+ 'handler' => [ $this, 'submit_handler' ],
85
  'priority' => 10,
86
+ ],
87
+ 'preview' => [
88
  'name' => __( 'Preview', 'wp-job-manager' ),
89
+ 'view' => [ $this, 'preview' ],
90
+ 'handler' => [ $this, 'preview_handler' ],
91
  'priority' => 20,
92
+ ],
93
+ 'done' => [
94
  'name' => __( 'Done', 'wp-job-manager' ),
95
+ 'before' => [ $this, 'done_before' ],
96
+ 'view' => [ $this, 'done' ],
97
  'priority' => 30,
98
+ ],
99
+ ]
100
  );
101
 
102
+ uasort( $this->steps, [ $this, 'sort_by_priority' ] );
103
 
104
  // phpcs:disable WordPress.Security.NonceVerification.Missing, WordPress.Security.NonceVerification.Recommended -- Check happens later when possible. Input is used safely.
105
  // Get step/job.
150
  $this->job_id = 0;
151
  $this->step = 0;
152
  }
153
+ } elseif ( ! in_array( $job_status, apply_filters( 'job_manager_valid_submit_job_statuses', [ 'preview', 'draft' ] ), true ) ) {
154
  $this->job_id = 0;
155
  $this->step = 0;
156
  }
200
  }
201
  $this->fields = apply_filters(
202
  'submit_job_form_fields',
203
+ [
204
+ 'job' => [
205
+ 'job_title' => [
206
  'label' => __( 'Job Title', 'wp-job-manager' ),
207
  'type' => 'text',
208
  'required' => true,
209
  'placeholder' => '',
210
  'priority' => 1,
211
+ ],
212
+ 'job_location' => [
213
  'label' => __( 'Location', 'wp-job-manager' ),
214
  'description' => __( 'Leave this blank if the location is not important', 'wp-job-manager' ),
215
  'type' => 'text',
216
  'required' => false,
217
  'placeholder' => __( 'e.g. "London"', 'wp-job-manager' ),
218
  'priority' => 2,
219
+ ],
220
+ 'job_type' => [
221
  'label' => __( 'Job type', 'wp-job-manager' ),
222
  'type' => $job_type,
223
  'required' => true,
225
  'priority' => 3,
226
  'default' => 'full-time',
227
  'taxonomy' => 'job_listing_type',
228
+ ],
229
+ 'job_category' => [
230
  'label' => __( 'Job category', 'wp-job-manager' ),
231
  'type' => 'term-multiselect',
232
  'required' => true,
234
  'priority' => 4,
235
  'default' => '',
236
  'taxonomy' => 'job_listing_category',
237
+ ],
238
+ 'job_description' => [
239
  'label' => __( 'Description', 'wp-job-manager' ),
240
  'type' => 'wp-editor',
241
  'required' => true,
242
  'priority' => 5,
243
+ ],
244
+ 'application' => [
245
  'label' => $application_method_label,
246
  'type' => 'text',
247
  'sanitizer' => $application_method_sanitizer,
248
  'required' => true,
249
  'placeholder' => $application_method_placeholder,
250
  'priority' => 6,
251
+ ],
252
+ ],
253
+ 'company' => [
254
+ 'company_name' => [
255
  'label' => __( 'Company name', 'wp-job-manager' ),
256
  'type' => 'text',
257
  'required' => true,
258
  'placeholder' => __( 'Enter the name of the company', 'wp-job-manager' ),
259
  'priority' => 1,
260
+ ],
261
+ 'company_website' => [
262
  'label' => __( 'Website', 'wp-job-manager' ),
263
  'type' => 'text',
264
  'sanitizer' => 'url',
265
  'required' => false,
266
  'placeholder' => __( 'http://', 'wp-job-manager' ),
267
  'priority' => 2,
268
+ ],
269
+ 'company_tagline' => [
270
  'label' => __( 'Tagline', 'wp-job-manager' ),
271
  'type' => 'text',
272
  'required' => false,
273
  'placeholder' => __( 'Briefly describe your company', 'wp-job-manager' ),
274
  'maxlength' => 64,
275
  'priority' => 3,
276
+ ],
277
+ 'company_video' => [
278
  'label' => __( 'Video', 'wp-job-manager' ),
279
  'type' => 'text',
280
  'sanitizer' => 'url',
281
  'required' => false,
282
  'placeholder' => __( 'A link to a video about your company', 'wp-job-manager' ),
283
  'priority' => 4,
284
+ ],
285
+ 'company_twitter' => [
286
  'label' => __( 'Twitter username', 'wp-job-manager' ),
287
  'type' => 'text',
288
  'required' => false,
289
  'placeholder' => __( '@yourcompany', 'wp-job-manager' ),
290
  'priority' => 5,
291
+ ],
292
+ 'company_logo' => [
293
  'label' => __( 'Logo', 'wp-job-manager' ),
294
  'type' => 'file',
295
  'required' => false,
297
  'priority' => 6,
298
  'ajax' => true,
299
  'multiple' => false,
300
+ 'allowed_mime_types' => [
301
  'jpg' => 'image/jpeg',
302
  'jpeg' => 'image/jpeg',
303
  'gif' => 'image/gif',
304
  'png' => 'image/png',
305
+ ],
306
+ ],
307
+ ],
308
+ ]
309
  );
310
 
311
  if ( ! get_option( 'job_manager_enable_categories' ) || 0 === intval( wp_count_terms( 'job_listing_category' ) ) ) {
342
  // translators: Placeholder %s is the label for the required field.
343
  return new WP_Error( 'validation-error', sprintf( __( '%s is a required field', 'wp-job-manager' ), $field['label'] ) );
344
  }
345
+ if ( ! empty( $field['taxonomy'] ) && in_array( $field['type'], [ 'term-checklist', 'term-select', 'term-multiselect' ], true ) ) {
346
  if ( is_array( $values[ $group_key ][ $key ] ) ) {
347
  $check_value = $values[ $group_key ][ $key ];
348
  } else {
349
+ $check_value = empty( $values[ $group_key ][ $key ] ) ? [] : [ $values[ $group_key ][ $key ] ];
350
  }
351
  foreach ( $check_value as $term ) {
352
  if ( ! term_exists( $term, $field['taxonomy'] ) ) {
359
  if ( is_array( $values[ $group_key ][ $key ] ) ) {
360
  $check_value = array_filter( $values[ $group_key ][ $key ] );
361
  } else {
362
+ $check_value = array_filter( [ $values[ $group_key ][ $key ] ] );
363
  }
364
  if ( ! empty( $check_value ) ) {
365
  foreach ( $check_value as $file_url ) {
366
  if ( is_numeric( $file_url ) ) {
367
  continue;
368
  }
369
+ $file_url = esc_url( $file_url, [ 'http', 'https' ] );
370
  if ( empty( $file_url ) ) {
371
  throw new Exception( __( 'Invalid attachment provided.', 'wp-job-manager' ) );
372
  }
377
  if ( is_array( $values[ $group_key ][ $key ] ) ) {
378
  $check_value = array_filter( $values[ $group_key ][ $key ] );
379
  } else {
380
+ $check_value = array_filter( [ $values[ $group_key ][ $key ] ] );
381
  }
382
  if ( ! empty( $check_value ) ) {
383
  foreach ( $check_value as $file_url ) {
399
  if ( is_array( $values[ $group_key ][ $key ] ) ) {
400
  $check_value = array_filter( $values[ $group_key ][ $key ] );
401
  } else {
402
+ $check_value = array_filter( [ $values[ $group_key ][ $key ] ] );
403
  }
404
  if ( count( $check_value ) > $file_limit ) {
405
  // translators: Placeholder %d is the number of files to that users are limited to.
464
  */
465
  protected function enqueue_job_form_assets() {
466
  wp_enqueue_script( 'wp-job-manager-job-submission' );
467
+ wp_enqueue_style( 'wp-job-manager-job-submission', JOB_MANAGER_PLUGIN_URL . '/assets/css/job-submission.css', [], JOB_MANAGER_VERSION );
468
 
469
  // Register datepicker JS. It will be enqueued if needed when a date.
470
  // field is rendered.
471
+ wp_register_script( 'wp-job-manager-datepicker', JOB_MANAGER_PLUGIN_URL . '/assets/js/datepicker.min.js', [ 'jquery', 'jquery-ui-datepicker' ], JOB_MANAGER_VERSION, true );
472
 
473
  // Localize scripts after the fields are rendered.
474
+ add_action( 'submit_job_form_end', [ $this, 'localize_job_form_scripts' ] );
475
  }
476
 
477
  /**
485
  wp_localize_script(
486
  'wp-job-manager-datepicker',
487
  'job_manager_datepicker',
488
+ [
489
  /* translators: jQuery date format, see http://api.jqueryui.com/datepicker/#utility-formatDate */
490
  'date_format' => _x( 'yy-mm-dd', 'Date format for jQuery datepicker.', 'wp-job-manager' ),
491
+ ]
492
  );
493
  }
494
  }
499
  * @return array
500
  */
501
  private function job_types() {
502
+ $options = [];
503
  $terms = get_job_listing_types();
504
  foreach ( $terms as $term ) {
505
  $options[ $term->slug ] = $term->name;
526
  $this->fields[ $group_key ][ $key ]['value'] = $job->post_content;
527
  break;
528
  case 'job_type':
529
+ $this->fields[ $group_key ][ $key ]['value'] = wp_get_object_terms( $job->ID, 'job_listing_type', [ 'fields' => 'ids' ] );
530
  if ( ! job_manager_multi_job_type() ) {
531
  $this->fields[ $group_key ][ $key ]['value'] = current( $this->fields[ $group_key ][ $key ]['value'] );
532
  }
533
  break;
534
  case 'job_category':
535
+ $this->fields[ $group_key ][ $key ]['value'] = wp_get_object_terms( $job->ID, 'job_listing_category', [ 'fields' => 'ids' ] );
536
  break;
537
  case 'company_logo':
538
  $this->fields[ $group_key ][ $key ]['value'] = has_post_thumbnail( $job->ID ) ? get_post_thumbnail_id( $job->ID ) : get_post_meta( $job->ID, '_' . $key, true );
566
  $this->enqueue_job_form_assets();
567
  get_job_manager_template(
568
  'job-submit.php',
569
+ [
570
  'form' => $this->form_name,
571
  'job_id' => $this->get_job_id(),
572
  'resume_edit' => $this->resume_edit,
576
  'step' => $this->get_step(),
577
  'can_continue_later' => $this->can_continue_later(),
578
  'submit_button_text' => apply_filters( 'submit_job_form_submit_button_text', __( 'Preview', 'wp-job-manager' ) ),
579
+ ]
580
  );
581
  }
582
 
663
 
664
  if ( ! empty( $input_create_account_email ) ) {
665
  $create_account = wp_job_manager_create_account(
666
+ [
667
  'username' => ( job_manager_generate_username_from_email() || empty( $input_create_account_username ) ) ? '' : $input_create_account_username,
668
  'password' => ( wpjm_use_standard_password_setup_email() || empty( $input_create_account_password ) ) ? '' : $input_create_account_password,
669
  'email' => sanitize_text_field( wp_unslash( $input_create_account_email ) ),
670
  'role' => get_option( 'job_manager_registration_role' ),
671
+ ]
672
  );
673
  }
674
  }
693
  $this->save_job( $values['job']['job_title'], $values['job']['job_description'], $post_status, $values );
694
  $this->update_job_data( $values );
695
 
696
+ if ( $this->job_id ) {
697
+ // Reset the `_filled` flag.
698
+ update_post_meta( $this->job_id, '_filled', 0 );
699
+ }
700
+
701
  if ( $is_saving_draft ) {
702
  $job_dashboard_page_id = get_option( 'job_manager_job_dashboard_page_id', false );
703
 
722
  * @param array $values
723
  * @param bool $update_slug
724
  */
725
+ protected function save_job( $post_title, $post_content, $status = 'preview', $values = [], $update_slug = true ) {
726
+ $job_data = [
727
  'post_title' => $post_title,
728
  'post_content' => $post_content,
729
  'post_type' => 'job_listing',
730
  'comment_status' => 'closed',
731
+ ];
732
 
733
  if ( $update_slug ) {
734
+ $job_slug = [];
735
 
736
  // Prepend with company name.
737
  if ( apply_filters( 'submit_job_form_prefix_post_name_with_company', true ) && ! empty( $values['company']['company_name'] ) ) {
798
  include_once ABSPATH . 'wp-admin/includes/media.php';
799
 
800
  $upload_dir = wp_upload_dir();
801
+ $attachment_url = esc_url( $attachment_url, [ 'http', 'https' ] );
802
  if ( empty( $attachment_url ) ) {
803
  return 0;
804
  }
812
 
813
  $attachment_url = sprintf( '%s://%s%s', $attachment_url_parts['scheme'], $attachment_url_parts['host'], $attachment_url_parts['path'] );
814
 
815
+ $attachment_url = str_replace( [ $upload_dir['baseurl'], WP_CONTENT_URL, site_url( '/' ) ], [ $upload_dir['basedir'], WP_CONTENT_DIR, ABSPATH ], $attachment_url );
816
  if ( empty( $attachment_url ) || ! is_string( $attachment_url ) ) {
817
  return 0;
818
  }
819
 
820
+ $attachment = [
821
  'post_title' => wpjm_get_the_job_title( $this->job_id ),
822
  'post_content' => '',
823
  'post_status' => 'inherit',
824
  'post_parent' => $this->job_id,
825
  'guid' => $attachment_url,
826
+ ];
827
 
828
  $info = wp_check_filetype( $attachment_url );
829
  if ( $info ) {
850
  add_post_meta( $this->job_id, '_filled', 0, true );
851
  add_post_meta( $this->job_id, '_featured', 0, true );
852
 
853
+ $maybe_attach = [];
854
 
855
  // Loop fields and save meta and term data.
856
  foreach ( $this->fields as $group_key => $group_fields ) {
860
  if ( is_array( $values[ $group_key ][ $key ] ) ) {
861
  wp_set_object_terms( $this->job_id, $values[ $group_key ][ $key ], $field['taxonomy'], false );
862
  } else {
863
+ wp_set_object_terms( $this->job_id, [ $values[ $group_key ][ $key ] ], $field['taxonomy'], false );
864
  }
865
 
866
  // Company logo is a featured image.
897
  if ( count( $maybe_attach ) && apply_filters( 'job_manager_attach_uploaded_files', true ) ) {
898
  // Get attachments.
899
  $attachments = get_posts( 'post_parent=' . $this->job_id . '&post_type=attachment&fields=ids&numberposts=-1' );
900
+ $attachment_urls = [];
901
 
902
  // Loop attachments already attached to the job.
903
  foreach ( $attachments as $attachment_id ) {
939
 
940
  get_job_manager_template(
941
  'job-preview.php',
942
+ [
943
  'form' => $this,
944
+ ]
945
  );
946
 
947
  wp_reset_postdata();
968
  if ( ! empty( $_POST['continue'] ) ) { // phpcs:ignore WordPress.Security.NonceVerification.Missing -- Input is used safely.
969
  $job = get_post( $this->job_id );
970
 
971
+ if ( in_array( $job->post_status, [ 'preview', 'expired' ], true ) ) {
972
  // Reset expiry.
973
  delete_post_meta( $job->ID, '_job_expires' );
974
 
975
  // Update job listing.
976
+ $update_job = [];
977
  $update_job['ID'] = $job->ID;
978
  $update_job['post_status'] = apply_filters( 'submit_job_post_status', get_option( 'job_manager_submission_requires_approval' ) ? 'pending' : 'publish', $job );
979
  $update_job['post_date'] = current_time( 'mysql' );
1044
  * Displays the final screen after a job listing has been submitted.
1045
  */
1046
  public function done() {
1047
+ get_job_manager_template( 'job-submitted.php', [ 'job' => get_post( $this->job_id ) ] );
1048
  }
1049
 
1050
  /**
1090
  public function track_job_submission( $post_id ) {
1091
  WP_Job_Manager_Usage_Tracking::track_job_submission(
1092
  $post_id,
1093
+ [
1094
  'source' => 'frontend',
1095
  'old_status' => 'preview',
1096
+ ]
1097
  );
1098
  }
1099
  }
includes/helper/class-wp-job-manager-helper-api.php CHANGED
@@ -107,38 +107,38 @@ class WP_Job_Manager_Helper_API {
107
  * @return array|bool|mixed|object
108
  */
109
  protected function request( $args, $return_error = false ) {
110
- $defaults = array(
111
  'instance' => $this->get_site_url(),
112
  'plugin_name' => '',
113
  'version' => '',
114
  'api_product_id' => '',
115
  'licence_key' => '',
116
  'email' => '',
117
- );
118
 
119
  $args = wp_parse_args( $args, $defaults );
120
  $request = wp_safe_remote_get(
121
  $this->get_api_base_url() . '?' . http_build_query( $args, '', '&' ),
122
- array(
123
  'timeout' => 10,
124
- 'headers' => array(
125
  'Accept' => 'application/json',
126
- ),
127
- )
128
  );
129
 
130
  if ( is_wp_error( $request ) || 200 !== wp_remote_retrieve_response_code( $request ) ) {
131
  if ( $return_error ) {
132
  if ( is_wp_error( $request ) ) {
133
- return array(
134
  'error_code' => $request->get_error_code(),
135
  'error' => $request->get_error_message(),
136
- );
137
  }
138
- return array(
139
  'error_code' => wp_remote_retrieve_response_code( $request ),
140
  'error' => 'Error code: ' . wp_remote_retrieve_response_code( $request ),
141
- );
142
  }
143
  return false;
144
  }
107
  * @return array|bool|mixed|object
108
  */
109
  protected function request( $args, $return_error = false ) {
110
+ $defaults = [
111
  'instance' => $this->get_site_url(),
112
  'plugin_name' => '',
113
  'version' => '',
114
  'api_product_id' => '',
115
  'licence_key' => '',
116
  'email' => '',
117
+ ];
118
 
119
  $args = wp_parse_args( $args, $defaults );
120
  $request = wp_safe_remote_get(
121
  $this->get_api_base_url() . '?' . http_build_query( $args, '', '&' ),
122
+ [
123
  'timeout' => 10,
124
+ 'headers' => [
125
  'Accept' => 'application/json',
126
+ ],
127
+ ]
128
  );
129
 
130
  if ( is_wp_error( $request ) || 200 !== wp_remote_retrieve_response_code( $request ) ) {
131
  if ( $return_error ) {
132
  if ( is_wp_error( $request ) ) {
133
+ return [
134
  'error_code' => $request->get_error_code(),
135
  'error' => $request->get_error_message(),
136
+ ];
137
  }
138
+ return [
139
  'error_code' => wp_remote_retrieve_response_code( $request ),
140
  'error' => 'Error code: ' . wp_remote_retrieve_response_code( $request ),
141
+ ];
142
  }
143
  return false;
144
  }
includes/helper/class-wp-job-manager-helper-options.php CHANGED
@@ -27,7 +27,7 @@ class WP_Job_Manager_Helper_Options {
27
  public static function update( $product_slug, $key, $value ) {
28
  $options = self::get_master_option();
29
  if ( ! isset( $options[ $product_slug ] ) ) {
30
- $options[ $product_slug ] = array();
31
  }
32
  $options[ $product_slug ][ $key ] = $value;
33
  return self::update_master_option( $options );
@@ -64,7 +64,7 @@ class WP_Job_Manager_Helper_Options {
64
  public static function delete( $product_slug, $key ) {
65
  $options = self::get_master_option();
66
  if ( ! isset( $options[ $product_slug ] ) ) {
67
- $options[ $product_slug ] = array();
68
  }
69
  unset( $options[ $product_slug ][ $key ] );
70
  return self::update_master_option( $options );
@@ -80,9 +80,9 @@ class WP_Job_Manager_Helper_Options {
80
  private static function attempt_legacy_restore( $product_slug ) {
81
  $options = self::get_master_option();
82
  if ( ! isset( $options[ $product_slug ] ) ) {
83
- $options[ $product_slug ] = array();
84
  }
85
- foreach ( array( 'licence_key', 'email', 'errors', 'hide_key_notice' ) as $key ) {
86
  $option_value = get_option( $product_slug . '_' . $key, false );
87
  if ( ! empty( $option_value ) ) {
88
  $options[ $product_slug ][ $key ] = $option_value;
@@ -100,9 +100,9 @@ class WP_Job_Manager_Helper_Options {
100
  */
101
  private static function get_master_option() {
102
  if ( is_multisite() || is_network_admin() ) {
103
- return get_site_option( self::OPTION_NAME, array() );
104
  }
105
- return get_option( self::OPTION_NAME, array() );
106
  }
107
 
108
  /**
27
  public static function update( $product_slug, $key, $value ) {
28
  $options = self::get_master_option();
29
  if ( ! isset( $options[ $product_slug ] ) ) {
30
+ $options[ $product_slug ] = [];
31
  }
32
  $options[ $product_slug ][ $key ] = $value;
33
  return self::update_master_option( $options );
64
  public static function delete( $product_slug, $key ) {
65
  $options = self::get_master_option();
66
  if ( ! isset( $options[ $product_slug ] ) ) {
67
+ $options[ $product_slug ] = [];
68
  }
69
  unset( $options[ $product_slug ][ $key ] );
70
  return self::update_master_option( $options );
80
  private static function attempt_legacy_restore( $product_slug ) {
81
  $options = self::get_master_option();
82
  if ( ! isset( $options[ $product_slug ] ) ) {
83
+ $options[ $product_slug ] = [];
84
  }
85
+ foreach ( [ 'licence_key', 'email', 'errors', 'hide_key_notice' ] as $key ) {
86
  $option_value = get_option( $product_slug . '_' . $key, false );
87
  if ( ! empty( $option_value ) ) {
88
  $options[ $product_slug ][ $key ] = $option_value;
100
  */
101
  private static function get_master_option() {
102
  if ( is_multisite() || is_network_admin() ) {
103
+ return get_site_option( self::OPTION_NAME, [] );
104
  }
105
+ return get_option( self::OPTION_NAME, [] );
106
  }
107
 
108
  /**
includes/helper/class-wp-job-manager-helper.php CHANGED
@@ -21,7 +21,7 @@ class WP_Job_Manager_Helper {
21
  *
22
  * @var array Messages when updating licences.
23
  */
24
- protected $licence_messages = array();
25
 
26
  /**
27
  * API object.
@@ -69,24 +69,24 @@ class WP_Job_Manager_Helper {
69
 
70
  $this->api = WP_Job_Manager_Helper_API::instance();
71
 
72
- add_action( 'job_manager_helper_output', array( $this, 'licence_output' ) );
73
 
74
- add_filter( 'job_manager_addon_core_version_check', array( $this, 'addon_core_version_check' ), 10, 2 );
75
- add_filter( 'extra_plugin_headers', array( $this, 'extra_headers' ) );
76
- add_filter( 'plugins_api', array( $this, 'plugins_api' ), 20, 3 );
77
- add_action( 'pre_set_site_transient_update_plugins', array( $this, 'check_for_updates' ) );
78
 
79
- add_action( 'activated_plugin', array( $this, 'plugin_activated' ) );
80
- add_action( 'deactivated_plugin', array( $this, 'plugin_deactivated' ) );
81
- add_action( 'admin_init', array( $this, 'admin_init' ) );
82
  }
83
 
84
  /**
85
  * Initializes admin-only actions.
86
  */
87
  public function admin_init() {
88
- add_action( 'plugin_action_links', array( $this, 'plugin_links' ), 10, 2 );
89
- add_action( 'admin_notices', array( $this, 'licence_error_notices' ) );
90
  $this->handle_admin_request();
91
  }
92
 
@@ -123,7 +123,7 @@ class WP_Job_Manager_Helper {
123
 
124
  // We only want to show the notices on the plugins page and main job listing admin page.
125
  $screen = get_current_screen();
126
- if ( null === $screen || ! in_array( $screen->id, array( 'plugins', 'edit-job_listing' ), true ) ) {
127
  return false;
128
  }
129
 
@@ -181,13 +181,13 @@ class WP_Job_Manager_Helper {
181
  }
182
 
183
  $response = $this->api->plugin_update_check(
184
- array(
185
  'plugin_name' => $plugin_data['Name'],
186
  'version' => $plugin_data['Version'],
187
  'api_product_id' => $product_slug,
188
  'licence_key' => $licence['licence_key'],
189
  'email' => $licence['email'],
190
- )
191
  );
192
 
193
  $this->handle_api_errors( $product_slug, $response );
@@ -363,11 +363,11 @@ class WP_Job_Manager_Helper {
363
  $activation_email = WP_Job_Manager_Helper_Options::get( $product_slug, 'email' );
364
  $errors = WP_Job_Manager_Helper_Options::get( $product_slug, 'errors' );
365
 
366
- return array(
367
  'licence_key' => $licence_key,
368
  'email' => $activation_email,
369
  'errors' => $errors,
370
- );
371
  }
372
 
373
  /**
@@ -418,7 +418,7 @@ class WP_Job_Manager_Helper {
418
  self::$cleared_plugin_cache = true;
419
  }
420
 
421
- $wpjm_plugins = array();
422
  $plugins = get_plugins();
423
 
424
  foreach ( $plugins as $filename => $data ) {
@@ -456,7 +456,7 @@ class WP_Job_Manager_Helper {
456
  */
457
  public function licence_error_notices() {
458
  $screen = get_current_screen();
459
- if ( null === $screen || in_array( $screen->id, array( 'job_listing_page_job-manager-addons' ), true ) ) {
460
  return;
461
  }
462
  foreach ( $this->get_installed_plugins() as $product_slug => $plugin_data ) {
@@ -513,11 +513,11 @@ class WP_Job_Manager_Helper {
513
  */
514
  private function activate_licence( $product_slug, $licence_key, $email ) {
515
  $response = $this->api->activate(
516
- array(
517
  'api_product_id' => $product_slug,
518
  'licence_key' => $licence_key,
519
  'email' => $email,
520
- )
521
  );
522
 
523
  $error = false;
@@ -538,7 +538,7 @@ class WP_Job_Manager_Helper {
538
  $this->add_error( $product_slug, __( 'An unknown error occurred while attempting to activate the license', 'wp-job-manager' ) );
539
  }
540
 
541
- $event_properties = array( 'slug' => $product_slug );
542
  if ( false !== $error ) {
543
  $event_properties['error'] = $error;
544
  self::log_event( 'license_activation_error', $event_properties );
@@ -559,11 +559,11 @@ class WP_Job_Manager_Helper {
559
  return;
560
  }
561
  $this->api->deactivate(
562
- array(
563
  'api_product_id' => $product_slug,
564
  'licence_key' => $licence['licence_key'],
565
  'email' => $licence['email'],
566
- )
567
  );
568
 
569
  WP_Job_Manager_Helper_Options::delete( $product_slug, 'licence_key' );
@@ -575,9 +575,9 @@ class WP_Job_Manager_Helper {
575
 
576
  self::log_event(
577
  'license_deactivated',
578
- array(
579
  'slug' => $product_slug,
580
- )
581
  );
582
  }
583
 
@@ -593,8 +593,8 @@ class WP_Job_Manager_Helper {
593
  return;
594
  }
595
 
596
- $errors = ! empty( $response['errors'] ) ? $response['errors'] : array();
597
- $allowed_errors = array( 'no_activation', 'expired_key', 'expiring_soon' );
598
  $ignored_errors = array_diff( array_keys( $errors ), $allowed_errors );
599
 
600
  foreach ( $ignored_errors as $key ) {
@@ -637,12 +637,12 @@ class WP_Job_Manager_Helper {
637
  */
638
  private function add_message( $type, $product_slug, $message ) {
639
  if ( ! isset( $this->licence_messages[ $product_slug ] ) ) {
640
- $this->licence_messages[ $product_slug ] = array();
641
  }
642
- $this->licence_messages[ $product_slug ][] = array(
643
  'type' => $type,
644
  'message' => $message,
645
- );
646
  }
647
 
648
  /**
@@ -653,7 +653,7 @@ class WP_Job_Manager_Helper {
653
  */
654
  public function get_messages( $product_slug ) {
655
  if ( ! isset( $this->licence_messages[ $product_slug ] ) ) {
656
- $this->licence_messages[ $product_slug ] = array();
657
  }
658
 
659
  return $this->licence_messages[ $product_slug ];
@@ -665,7 +665,7 @@ class WP_Job_Manager_Helper {
665
  * @param string $event_name The name of the event, without the `wpjm` prefix.
666
  * @param array $properties The event properties to be sent.
667
  */
668
- private function log_event( $event_name, $properties = array() ) {
669
  if ( ! class_exists( 'WP_Job_Manager_Usage_Tracking' ) ) {
670
  return;
671
  }
21
  *
22
  * @var array Messages when updating licences.
23
  */
24
+ protected $licence_messages = [];
25
 
26
  /**
27
  * API object.
69
 
70
  $this->api = WP_Job_Manager_Helper_API::instance();
71
 
72
+ add_action( 'job_manager_helper_output', [ $this, 'licence_output' ] );
73
 
74
+ add_filter( 'job_manager_addon_core_version_check', [ $this, 'addon_core_version_check' ], 10, 2 );
75
+ add_filter( 'extra_plugin_headers', [ $this, 'extra_headers' ] );
76
+ add_filter( 'plugins_api', [ $this, 'plugins_api' ], 20, 3 );
77
+ add_action( 'pre_set_site_transient_update_plugins', [ $this, 'check_for_updates' ] );
78
 
79
+ add_action( 'activated_plugin', [ $this, 'plugin_activated' ] );
80
+ add_action( 'deactivated_plugin', [ $this, 'plugin_deactivated' ] );
81
+ add_action( 'admin_init', [ $this, 'admin_init' ] );
82
  }
83
 
84
  /**
85
  * Initializes admin-only actions.
86
  */
87
  public function admin_init() {
88
+ add_action( 'plugin_action_links', [ $this, 'plugin_links' ], 10, 2 );
89
+ add_action( 'admin_notices', [ $this, 'licence_error_notices' ] );
90
  $this->handle_admin_request();
91
  }
92
 
123
 
124
  // We only want to show the notices on the plugins page and main job listing admin page.
125
  $screen = get_current_screen();
126
+ if ( null === $screen || ! in_array( $screen->id, [ 'plugins', 'edit-job_listing' ], true ) ) {
127
  return false;
128
  }
129
 
181
  }
182
 
183
  $response = $this->api->plugin_update_check(
184
+ [
185
  'plugin_name' => $plugin_data['Name'],
186
  'version' => $plugin_data['Version'],
187
  'api_product_id' => $product_slug,
188
  'licence_key' => $licence['licence_key'],
189
  'email' => $licence['email'],
190
+ ]
191
  );
192
 
193
  $this->handle_api_errors( $product_slug, $response );
363
  $activation_email = WP_Job_Manager_Helper_Options::get( $product_slug, 'email' );
364
  $errors = WP_Job_Manager_Helper_Options::get( $product_slug, 'errors' );
365
 
366
+ return [
367
  'licence_key' => $licence_key,
368
  'email' => $activation_email,
369
  'errors' => $errors,
370
+ ];
371
  }
372
 
373
  /**
418
  self::$cleared_plugin_cache = true;
419
  }
420
 
421
+ $wpjm_plugins = [];
422
  $plugins = get_plugins();
423
 
424
  foreach ( $plugins as $filename => $data ) {
456
  */
457
  public function licence_error_notices() {
458
  $screen = get_current_screen();
459
+ if ( null === $screen || in_array( $screen->id, [ 'job_listing_page_job-manager-addons' ], true ) ) {
460
  return;
461
  }
462
  foreach ( $this->get_installed_plugins() as $product_slug => $plugin_data ) {
513
  */
514
  private function activate_licence( $product_slug, $licence_key, $email ) {
515
  $response = $this->api->activate(
516
+ [
517
  'api_product_id' => $product_slug,
518
  'licence_key' => $licence_key,
519
  'email' => $email,
520
+ ]
521
  );
522
 
523
  $error = false;
538
  $this->add_error( $product_slug, __( 'An unknown error occurred while attempting to activate the license', 'wp-job-manager' ) );
539
  }
540
 
541
+ $event_properties = [ 'slug' => $product_slug ];
542
  if ( false !== $error ) {
543
  $event_properties['error'] = $error;
544
  self::log_event( 'license_activation_error', $event_properties );
559
  return;
560
  }
561
  $this->api->deactivate(
562
+ [
563
  'api_product_id' => $product_slug,
564
  'licence_key' => $licence['licence_key'],
565
  'email' => $licence['email'],
566
+ ]
567
  );
568
 
569
  WP_Job_Manager_Helper_Options::delete( $product_slug, 'licence_key' );
575
 
576
  self::log_event(
577
  'license_deactivated',
578
+ [
579
  'slug' => $product_slug,
580
+ ]
581
  );
582
  }
583
 
593
  return;
594
  }
595
 
596
+ $errors = ! empty( $response['errors'] ) ? $response['errors'] : [];
597
+ $allowed_errors = [ 'no_activation', 'expired_key', 'expiring_soon' ];
598
  $ignored_errors = array_diff( array_keys( $errors ), $allowed_errors );
599
 
600
  foreach ( $ignored_errors as $key ) {
637
  */
638
  private function add_message( $type, $product_slug, $message ) {
639
  if ( ! isset( $this->licence_messages[ $product_slug ] ) ) {
640
+ $this->licence_messages[ $product_slug ] = [];
641
  }
642
+ $this->licence_messages[ $product_slug ][] = [
643
  'type' => $type,
644
  'message' => $message,
645
+ ];
646
  }
647
 
648
  /**
653
  */
654
  public function get_messages( $product_slug ) {
655
  if ( ! isset( $this->licence_messages[ $product_slug ] ) ) {
656
+ $this->licence_messages[ $product_slug ] = [];
657
  }
658
 
659
  return $this->licence_messages[ $product_slug ];
665
  * @param string $event_name The name of the event, without the `wpjm` prefix.
666
  * @param array $properties The event properties to be sent.
667
  */
668
+ private function log_event( $event_name, $properties = [] ) {
669
  if ( ! class_exists( 'WP_Job_Manager_Usage_Tracking' ) ) {
670
  return;
671
  }
includes/helper/views/html-licences.php CHANGED
@@ -33,12 +33,12 @@ if ( ! defined( 'ABSPATH' ) ) {
33
  <?php
34
  $notices = WP_Job_Manager_Helper::get_messages( $product_slug );
35
  if ( empty( $notices ) && ! empty( $licence['errors'] ) ) {
36
- $notices = array();
37
  foreach ( $licence['errors'] as $key => $error_message ) {
38
- $notices[] = array(
39
  'type' => 'error',
40
  'message' => $error_message,
41
- );
42
  }
43
  }
44
  foreach ( $notices as $message ) {
33
  <?php
34
  $notices = WP_Job_Manager_Helper::get_messages( $product_slug );
35
  if ( empty( $notices ) && ! empty( $licence['errors'] ) ) {
36
+ $notices = [];
37
  foreach ( $licence['errors'] as $key => $error_message ) {
38
+ $notices[] = [
39
  'type' => 'error',
40
  'message' => $error_message,
41
+ ];
42
  }
43
  }
44
  foreach ( $notices as $message ) {
includes/widgets/class-wp-job-manager-widget-featured-jobs.php CHANGED
@@ -28,47 +28,47 @@ class WP_Job_Manager_Widget_Featured_Jobs extends WP_Job_Manager_Widget {
28
  $this->widget_cssclass = 'job_manager widget_featured_jobs';
29
  $this->widget_description = __( 'Display a list of featured listings on your site.', 'wp-job-manager' );
30
  $this->widget_id = 'widget_featured_jobs';
31
- $this->settings = array(
32
- 'title' => array(
33
  'type' => 'text',
34
  // translators: Placeholder %s is the plural label for the job listing post type.
35
  'std' => sprintf( __( 'Featured %s', 'wp-job-manager' ), $wp_post_types['job_listing']->labels->name ),
36
  'label' => __( 'Title', 'wp-job-manager' ),
37
- ),
38
- 'number' => array(
39
  'type' => 'number',
40
  'step' => 1,
41
  'min' => 1,
42
  'max' => '',
43
  'std' => 10,
44
  'label' => __( 'Number of listings to show', 'wp-job-manager' ),
45
- ),
46
- 'orderby' => array(
47
  'type' => 'select',
48
  'std' => 'date',
49
  'label' => __( 'Sort By', 'wp-job-manager' ),
50
- 'options' => array(
51
  'date' => __( 'Date', 'wp-job-manager' ),
52
  'title' => __( 'Title', 'wp-job-manager' ),
53
  'author' => __( 'Author', 'wp-job-manager' ),
54
  'rand_featured' => __( 'Random', 'wp-job-manager' ),
55
- ),
56
- ),
57
- 'order' => array(
58
  'type' => 'select',
59
  'std' => 'DESC',
60
  'label' => __( 'Sort Direction', 'wp-job-manager' ),
61
- 'options' => array(
62
  'ASC' => __( 'Ascending', 'wp-job-manager' ),
63
  'DESC' => __( 'Descending', 'wp-job-manager' ),
64
- ),
65
- ),
66
- 'show_logo' => array(
67
  'type' => 'checkbox',
68
  'std' => 0,
69
  'label' => esc_html__( 'Show Company Logo', 'wp-job-manager' ),
70
- ),
71
- );
72
  parent::__construct();
73
  }
74
 
@@ -97,12 +97,12 @@ class WP_Job_Manager_Widget_Featured_Jobs extends WP_Job_Manager_Widget {
97
  $title = apply_filters( 'widget_title', $title_instance, $instance, $this->id_base );
98
  $show_logo = absint( $instance['show_logo'] );
99
  $jobs = get_job_listings(
100
- array(
101
  'posts_per_page' => $number,
102
  'orderby' => $orderby,
103
  'order' => $order,
104
  'featured' => true,
105
- )
106
  );
107
 
108
  if ( $jobs->have_posts() ) : ?>
@@ -122,7 +122,7 @@ class WP_Job_Manager_Widget_Featured_Jobs extends WP_Job_Manager_Widget {
122
  $jobs->the_post();
123
  ?>
124
 
125
- <?php get_job_manager_template( 'content-widget-job_listing.php', array( 'show_logo' => $show_logo ) ); ?>
126
 
127
  <?php endwhile; ?>
128
 
28
  $this->widget_cssclass = 'job_manager widget_featured_jobs';
29
  $this->widget_description = __( 'Display a list of featured listings on your site.', 'wp-job-manager' );
30
  $this->widget_id = 'widget_featured_jobs';
31
+ $this->settings = [
32
+ 'title' => [
33
  'type' => 'text',
34
  // translators: Placeholder %s is the plural label for the job listing post type.
35
  'std' => sprintf( __( 'Featured %s', 'wp-job-manager' ), $wp_post_types['job_listing']->labels->name ),
36
  'label' => __( 'Title', 'wp-job-manager' ),
37
+ ],
38
+ 'number' => [
39
  'type' => 'number',
40
  'step' => 1,
41
  'min' => 1,
42
  'max' => '',
43
  'std' => 10,
44
  'label' => __( 'Number of listings to show', 'wp-job-manager' ),
45
+ ],
46
+ 'orderby' => [
47
  'type' => 'select',
48
  'std' => 'date',
49
  'label' => __( 'Sort By', 'wp-job-manager' ),
50
+ 'options' => [
51
  'date' => __( 'Date', 'wp-job-manager' ),
52
  'title' => __( 'Title', 'wp-job-manager' ),
53
  'author' => __( 'Author', 'wp-job-manager' ),
54
  'rand_featured' => __( 'Random', 'wp-job-manager' ),
55
+ ],
56
+ ],
57
+ 'order' => [
58
  'type' => 'select',
59
  'std' => 'DESC',
60
  'label' => __( 'Sort Direction', 'wp-job-manager' ),
61
+ 'options' => [
62
  'ASC' => __( 'Ascending', 'wp-job-manager' ),
63
  'DESC' => __( 'Descending', 'wp-job-manager' ),
64
+ ],
65
+ ],
66
+ 'show_logo' => [
67
  'type' => 'checkbox',
68
  'std' => 0,
69
  'label' => esc_html__( 'Show Company Logo', 'wp-job-manager' ),
70
+ ],
71
+ ];
72
  parent::__construct();
73
  }
74
 
97
  $title = apply_filters( 'widget_title', $title_instance, $instance, $this->id_base );
98
  $show_logo = absint( $instance['show_logo'] );
99
  $jobs = get_job_listings(
100
+ [
101
  'posts_per_page' => $number,
102
  'orderby' => $orderby,
103
  'order' => $order,
104
  'featured' => true,
105
+ ]
106
  );
107
 
108
  if ( $jobs->have_posts() ) : ?>
122
  $jobs->the_post();
123
  ?>
124
 
125
+ <?php get_job_manager_template( 'content-widget-job_listing.php', [ 'show_logo' => $show_logo ] ); ?>
126
 
127
  <?php endwhile; ?>
128
 
includes/widgets/class-wp-job-manager-widget-recent-jobs.php CHANGED
@@ -28,37 +28,37 @@ class WP_Job_Manager_Widget_Recent_Jobs extends WP_Job_Manager_Widget {
28
  $this->widget_cssclass = 'job_manager widget_recent_jobs';
29
  $this->widget_description = __( 'Display a list of recent listings on your site, optionally matching a keyword and location.', 'wp-job-manager' );
30
  $this->widget_id = 'widget_recent_jobs';
31
- $this->settings = array(
32
- 'title' => array(
33
  'type' => 'text',
34
  // translators: Placeholder %s is the plural label for the job listing post type.
35
  'std' => sprintf( __( 'Recent %s', 'wp-job-manager' ), $wp_post_types['job_listing']->labels->name ),
36
  'label' => __( 'Title', 'wp-job-manager' ),
37
- ),
38
- 'keyword' => array(
39
  'type' => 'text',
40
  'std' => '',
41
  'label' => __( 'Keyword', 'wp-job-manager' ),
42
- ),
43
- 'location' => array(
44
  'type' => 'text',
45
  'std' => '',
46
  'label' => __( 'Location', 'wp-job-manager' ),
47
- ),
48
- 'number' => array(
49
  'type' => 'number',
50
  'step' => 1,
51
  'min' => 1,
52
  'max' => '',
53
  'std' => 10,
54
  'label' => __( 'Number of listings to show', 'wp-job-manager' ),
55
- ),
56
- 'show_logo' => array(
57
  'type' => 'checkbox',
58
  'std' => 0,
59
  'label' => esc_html__( 'Show Company Logo', 'wp-job-manager' ),
60
- ),
61
- );
62
 
63
  parent::__construct();
64
  }
@@ -84,13 +84,13 @@ class WP_Job_Manager_Widget_Recent_Jobs extends WP_Job_Manager_Widget {
84
  $title = apply_filters( 'widget_title', $instance['title'], $instance, $this->id_base );
85
  $number = absint( $instance['number'] );
86
  $jobs = get_job_listings(
87
- array(
88
  'search_location' => $instance['location'],
89
  'search_keywords' => $instance['keyword'],
90
  'posts_per_page' => $number,
91
  'orderby' => 'date',
92
  'order' => 'DESC',
93
- )
94
  );
95
  $show_logo = absint( $instance['show_logo'] );
96
 
@@ -122,7 +122,7 @@ class WP_Job_Manager_Widget_Recent_Jobs extends WP_Job_Manager_Widget {
122
  $jobs->the_post();
123
  ?>
124
 
125
- <?php get_job_manager_template( 'content-widget-job_listing.php', array( 'show_logo' => $show_logo ) ); ?>
126
 
127
  <?php endwhile; ?>
128
 
28
  $this->widget_cssclass = 'job_manager widget_recent_jobs';
29
  $this->widget_description = __( 'Display a list of recent listings on your site, optionally matching a keyword and location.', 'wp-job-manager' );
30
  $this->widget_id = 'widget_recent_jobs';
31
+ $this->settings = [
32
+ 'title' => [
33
  'type' => 'text',
34
  // translators: Placeholder %s is the plural label for the job listing post type.
35
  'std' => sprintf( __( 'Recent %s', 'wp-job-manager' ), $wp_post_types['job_listing']->labels->name ),
36
  'label' => __( 'Title', 'wp-job-manager' ),
37
+ ],
38
+ 'keyword' => [
39
  'type' => 'text',
40
  'std' => '',
41
  'label' => __( 'Keyword', 'wp-job-manager' ),
42
+ ],
43
+ 'location' => [
44
  'type' => 'text',
45
  'std' => '',
46
  'label' => __( 'Location', 'wp-job-manager' ),
47
+ ],
48
+ 'number' => [
49
  'type' => 'number',
50
  'step' => 1,
51
  'min' => 1,
52
  'max' => '',
53
  'std' => 10,
54
  'label' => __( 'Number of listings to show', 'wp-job-manager' ),
55
+ ],
56
+ 'show_logo' => [
57
  'type' => 'checkbox',
58
  'std' => 0,
59
  'label' => esc_html__( 'Show Company Logo', 'wp-job-manager' ),
60
+ ],
61
+ ];
62
 
63
  parent::__construct();
64
  }
84
  $title = apply_filters( 'widget_title', $instance['title'], $instance, $this->id_base );
85
  $number = absint( $instance['number'] );
86
  $jobs = get_job_listings(
87
+ [
88
  'search_location' => $instance['location'],
89
  'search_keywords' => $instance['keyword'],
90
  'posts_per_page' => $number,
91
  'orderby' => 'date',
92
  'order' => 'DESC',
93
+ ]
94
  );
95
  $show_logo = absint( $instance['show_logo'] );
96
 
122
  $jobs->the_post();
123
  ?>
124
 
125
+ <?php get_job_manager_template( 'content-widget-job_listing.php', [ 'show_logo' => $show_logo ] ); ?>
126
 
127
  <?php endwhile; ?>
128
 
languages/wp-job-manager.pot CHANGED
@@ -2,9 +2,9 @@
2
  # This file is distributed under the GPL2+.
3
  msgid ""
4
  msgstr ""
5
- "Project-Id-Version: WP Job Manager 1.33.3\n"
6
  "Report-Msgid-Bugs-To: https://github.com/Automattic/WP-Job-Manager/issues\n"
7
- "POT-Creation-Date: 2019-07-08 16:37:22+00:00\n"
8
  "MIME-Version: 1.0\n"
9
  "Content-Type: text/plain; charset=utf-8\n"
10
  "Content-Transfer-Encoding: 8bit\n"
@@ -13,30 +13,30 @@ msgstr ""
13
  "Language-Team: LANGUAGE <EMAIL@ADDRESS>\n"
14
  "X-Generator: grunt-wp-i18n 1.0.3\n"
15
 
16
- #: includes/3rd-party/wpml.php:84
17
  msgid "Page Not Set"
18
  msgstr ""
19
 
20
- #: includes/3rd-party/wpml.php:98
21
  #. translators: Placeholder (%s) is the URL to edit the primary language in
22
  #. WPML.
23
  msgid "<a href=\"%s\">Switch to primary language</a> to edit this setting."
24
  msgstr ""
25
 
26
- #: includes/abstracts/abstract-wp-job-manager-form.php:363
27
- #: includes/abstracts/abstract-wp-job-manager-form.php:378
28
  #. translators: Placeholder is for the label of the reCAPTCHA field.
29
  #. translators: %s is the name of the form validation that failed.
30
  msgid "\"%s\" check failed. Please try again."
31
  msgstr ""
32
 
33
- #: includes/admin/class-wp-job-manager-addons.php:123
34
  #: includes/admin/class-wp-job-manager-admin.php:139
35
  #: includes/admin/views/html-admin-page-addons.php:12
36
  msgid "WP Job Manager Add-ons"
37
  msgstr ""
38
 
39
- #: includes/admin/class-wp-job-manager-addons.php:130
40
  #: includes/helper/views/html-licences.php:12
41
  msgid "Licenses"
42
  msgstr ""
@@ -105,83 +105,83 @@ msgstr ""
105
  msgid "%s marked as not filled"
106
  msgstr ""
107
 
108
- #: includes/admin/class-wp-job-manager-cpt.php:322
109
  msgid "Select category"
110
  msgstr ""
111
 
112
- #: includes/admin/class-wp-job-manager-cpt.php:347
113
  msgid "Select Filled"
114
  msgstr ""
115
 
116
- #: includes/admin/class-wp-job-manager-cpt.php:351
117
  msgid "Filled"
118
  msgstr ""
119
 
120
- #: includes/admin/class-wp-job-manager-cpt.php:355
121
  msgid "Not Filled"
122
  msgstr ""
123
 
124
- #: includes/admin/class-wp-job-manager-cpt.php:366
125
  msgid "Select Featured"
126
  msgstr ""
127
 
128
- #: includes/admin/class-wp-job-manager-cpt.php:370
129
  msgid "Featured"
130
  msgstr ""
131
 
132
- #: includes/admin/class-wp-job-manager-cpt.php:374
133
  msgid "Not Featured"
134
  msgstr ""
135
 
136
- #: includes/admin/class-wp-job-manager-cpt.php:419
137
- #: includes/admin/class-wp-job-manager-cpt.php:476
138
  msgid "Position"
139
  msgstr ""
140
 
141
- #: includes/admin/class-wp-job-manager-cpt.php:436
142
  #. translators: %1$s is the singular name of the job listing post type; %2$s is
143
  #. the URL to view the listing.
144
  msgid "%1$s updated. <a href=\"%2$s\">View</a>"
145
  msgstr ""
146
 
147
- #: includes/admin/class-wp-job-manager-cpt.php:437
148
  msgid "Custom field updated."
149
  msgstr ""
150
 
151
- #: includes/admin/class-wp-job-manager-cpt.php:438
152
  msgid "Custom field deleted."
153
  msgstr ""
154
 
155
- #: includes/admin/class-wp-job-manager-cpt.php:440
156
  #. translators: %s is the singular name of the job listing post type.
157
  msgid "%s updated."
158
  msgstr ""
159
 
160
- #: includes/admin/class-wp-job-manager-cpt.php:442
161
  #. translators: %1$s is the singular name of the job listing post type; %2$s is
162
  #. the revision number.
163
  msgid "%1$s restored to revision from %2$s"
164
  msgstr ""
165
 
166
- #: includes/admin/class-wp-job-manager-cpt.php:444
167
  #. translators: %1$s is the singular name of the job listing post type; %2$s is
168
  #. the URL to view the listing.
169
  msgid "%1$s published. <a href=\"%2$s\">View</a>"
170
  msgstr ""
171
 
172
- #: includes/admin/class-wp-job-manager-cpt.php:446
173
  #. translators: %1$s is the singular name of the job listing post type; %2$s is
174
  #. the URL to view the listing.
175
  msgid "%s saved."
176
  msgstr ""
177
 
178
- #: includes/admin/class-wp-job-manager-cpt.php:448
179
  #. translators: %1$s is the singular name of the job listing post type; %2$s is
180
  #. the URL to preview the listing.
181
  msgid "%1$s submitted. <a target=\"_blank\" href=\"%2$s\">Preview</a>"
182
  msgstr ""
183
 
184
- #: includes/admin/class-wp-job-manager-cpt.php:451
185
  #. translators: %1$s is the singular name of the post type; %2$s is the date
186
  #. the post will be published; %3$s is the URL to preview the listing.
187
  msgid ""
@@ -189,87 +189,87 @@ msgid ""
189
  "href=\"%3$s\">Preview</a>"
190
  msgstr ""
191
 
192
- #: includes/admin/class-wp-job-manager-cpt.php:457
193
  #. translators: %1$s is the singular name of the job listing post type; %2$s is
194
  #. the URL to view the listing.
195
  msgid "%1$s draft updated. <a target=\"_blank\" href=\"%2$s\">Preview</a>"
196
  msgstr ""
197
 
198
- #: includes/admin/class-wp-job-manager-cpt.php:477
199
  msgid "Type"
200
  msgstr ""
201
 
202
- #: includes/admin/class-wp-job-manager-cpt.php:478
203
  #: includes/class-wp-job-manager-email-notifications.php:238
204
- #: includes/class-wp-job-manager-post-types.php:1175
205
- #: includes/forms/class-wp-job-manager-form-submit-job.php:197
206
  #: includes/widgets/class-wp-job-manager-widget-recent-jobs.php:46
207
  #: templates/job-filters.php:35 templates/job-filters.php:36
208
  msgid "Location"
209
  msgstr ""
210
 
211
- #: includes/admin/class-wp-job-manager-cpt.php:479
212
  msgid "Status"
213
  msgstr ""
214
 
215
- #: includes/admin/class-wp-job-manager-cpt.php:480
216
  msgid "Posted"
217
  msgstr ""
218
 
219
- #: includes/admin/class-wp-job-manager-cpt.php:481
220
  msgid "Expires"
221
  msgstr ""
222
 
223
- #: includes/admin/class-wp-job-manager-cpt.php:482
224
  #: includes/admin/class-wp-job-manager-settings.php:162
225
  msgid "Categories"
226
  msgstr ""
227
 
228
- #: includes/admin/class-wp-job-manager-cpt.php:483
229
  msgid "Featured?"
230
  msgstr ""
231
 
232
- #: includes/admin/class-wp-job-manager-cpt.php:484
233
- #: includes/class-wp-job-manager-shortcodes.php:252
234
  msgid "Filled?"
235
  msgstr ""
236
 
237
- #: includes/admin/class-wp-job-manager-cpt.php:485
238
  msgid "Actions"
239
  msgstr ""
240
 
241
- #: includes/admin/class-wp-job-manager-cpt.php:550
242
  #. translators: %d is the post ID for the job listing.
243
  msgid "ID: %d"
244
  msgstr ""
245
 
246
- #: includes/admin/class-wp-job-manager-cpt.php:594
247
  #. translators: %s placeholder is the username of the user.
248
  msgid "by a guest"
249
  msgstr ""
250
 
251
- #: includes/admin/class-wp-job-manager-cpt.php:594
252
  msgid "by %s"
253
  msgstr ""
254
 
255
- #: includes/admin/class-wp-job-manager-cpt.php:613
256
  msgid "Approve"
257
  msgstr ""
258
 
259
- #: includes/admin/class-wp-job-manager-cpt.php:621
260
  #: includes/admin/class-wp-job-manager-writepanels.php:227
261
  #: includes/admin/class-wp-job-manager-writepanels.php:232
262
  #: includes/admin/class-wp-job-manager-writepanels.php:237
263
  msgid "View"
264
  msgstr ""
265
 
266
- #: includes/admin/class-wp-job-manager-cpt.php:628
267
  #: includes/class-wp-job-manager-post-types.php:334
268
  #: templates/job-dashboard.php:52 templates/job-dashboard.php:70
269
  msgid "Edit"
270
  msgstr ""
271
 
272
- #: includes/admin/class-wp-job-manager-cpt.php:635
273
  #: templates/job-dashboard.php:79
274
  msgid "Delete"
275
  msgstr ""
@@ -336,7 +336,7 @@ msgstr ""
336
 
337
  #: includes/admin/class-wp-job-manager-settings.php:122
338
  #: includes/class-wp-job-manager-post-types.php:328
339
- #: includes/class-wp-job-manager-post-types.php:430
340
  msgid "Job Listings"
341
  msgstr ""
342
 
@@ -704,29 +704,29 @@ msgid ""
704
  "plugin know the location of the job listings page."
705
  msgstr ""
706
 
707
- #: includes/admin/class-wp-job-manager-settings.php:416
708
  msgid "Settings successfully saved"
709
  msgstr ""
710
 
711
- #: includes/admin/class-wp-job-manager-settings.php:441
712
  msgid "Save Changes"
713
  msgstr ""
714
 
715
- #: includes/admin/class-wp-job-manager-settings.php:649
716
  msgid "--no page--"
717
  msgstr ""
718
 
719
- #: includes/admin/class-wp-job-manager-settings.php:654
720
  msgid "Select a page&hellip;"
721
  msgstr ""
722
 
723
- #: includes/admin/class-wp-job-manager-setup.php:56
724
  msgid "Setup"
725
  msgstr ""
726
 
727
- #: includes/admin/class-wp-job-manager-taxonomy-meta.php:83
728
- #: includes/admin/class-wp-job-manager-taxonomy-meta.php:106
729
- #: includes/admin/class-wp-job-manager-taxonomy-meta.php:125
730
  #: includes/class-wp-job-manager-post-types.php:287
731
  msgid "Employment Type"
732
  msgstr ""
@@ -759,7 +759,7 @@ msgid "Add file"
759
  msgstr ""
760
 
761
  #: includes/admin/class-wp-job-manager-writepanels.php:471
762
- #: includes/class-wp-job-manager-ajax.php:410
763
  #. translators: Used in user select. %1$s is the user's display name; #%2$s is
764
  #. the user ID; %3$s is the user email.
765
  msgid "%1$s (#%2$s – %3$s)"
@@ -801,7 +801,7 @@ msgstr ""
801
  msgid "More Information &rarr;"
802
  msgstr ""
803
 
804
- #: includes/admin/views/html-admin-page-addons.php:53
805
  msgid "No add-ons were found."
806
  msgstr ""
807
 
@@ -876,19 +876,19 @@ msgid ""
876
  "for detailed instructions.)"
877
  msgstr ""
878
 
879
- #: includes/admin/views/html-admin-setup-step-2.php:38
880
  msgid "Page Title"
881
  msgstr ""
882
 
883
- #: includes/admin/views/html-admin-setup-step-2.php:39
884
  msgid "Page Description"
885
  msgstr ""
886
 
887
- #: includes/admin/views/html-admin-setup-step-2.php:40
888
  msgid "Content Shortcode"
889
  msgstr ""
890
 
891
- #: includes/admin/views/html-admin-setup-step-2.php:48
892
  msgid ""
893
  "Creates a page that allows employers to post new jobs directly from a page "
894
  "on your website, instead of requiring them to log in to an admin area. If "
@@ -896,7 +896,7 @@ msgid ""
896
  "the admin dashboard only -- you can uncheck this setting."
897
  msgstr ""
898
 
899
- #: includes/admin/views/html-admin-setup-step-2.php:56
900
  msgid ""
901
  "Creates a page that allows employers to manage their job listings directly "
902
  "from a page on your website, instead of requiring them to log in to an "
@@ -904,11 +904,11 @@ msgid ""
904
  "only, you can uncheck this setting."
905
  msgstr ""
906
 
907
- #: includes/admin/views/html-admin-setup-step-2.php:63
908
  msgid "Creates a page where visitors can browse, search, and filter job listings."
909
  msgstr ""
910
 
911
- #: includes/admin/views/html-admin-setup-step-2.php:71
912
  msgid "Skip this step"
913
  msgstr ""
914
 
@@ -963,11 +963,11 @@ msgid ""
963
  "hiring!"
964
  msgstr ""
965
 
966
- #: includes/admin/views/html-admin-setup-step-3.php:65
967
  msgid "Support WP Job Manager's Ongoing Development"
968
  msgstr ""
969
 
970
- #: includes/admin/views/html-admin-setup-step-3.php:66
971
  msgid ""
972
  "There are lots of ways you can support open source software projects like "
973
  "this one: contributing code, fixing a bug, assisting with non-English "
@@ -975,30 +975,30 @@ msgid ""
975
  "spread the word. We appreciate your support!"
976
  msgstr ""
977
 
978
- #: includes/admin/views/html-admin-setup-step-3.php:68
979
  msgid "Leave a positive review"
980
  msgstr ""
981
 
982
- #: includes/admin/views/html-admin-setup-step-3.php:69
983
  msgid "Contribute a localization"
984
  msgstr ""
985
 
986
- #: includes/admin/views/html-admin-setup-step-3.php:70
987
  msgid "Contribute code or report a bug"
988
  msgstr ""
989
 
990
- #: includes/admin/views/html-admin-setup-step-3.php:71
991
  msgid "Help other users on the forums"
992
  msgstr ""
993
 
994
- #: includes/class-wp-job-manager-ajax.php:179
995
  #. translators: Placeholder %d is the number of found search results.
996
  msgid "Search completed. Found %d matching record."
997
  msgid_plural "Search completed. Found %d matching records."
998
  msgstr[0] ""
999
  msgstr[1] ""
1000
 
1001
- #: includes/class-wp-job-manager-ajax.php:275
1002
  msgid "You must be logged in to upload files using this method."
1003
  msgstr ""
1004
 
@@ -1012,27 +1012,27 @@ msgid "Company Logo"
1012
  msgstr ""
1013
 
1014
  #: includes/class-wp-job-manager-data-exporter.php:52
1015
- #: includes/class-wp-job-manager-post-types.php:1194
1016
  msgid "Company Name"
1017
  msgstr ""
1018
 
1019
  #: includes/class-wp-job-manager-data-exporter.php:53
1020
- #: includes/class-wp-job-manager-post-types.php:1202
1021
  msgid "Company Website"
1022
  msgstr ""
1023
 
1024
  #: includes/class-wp-job-manager-data-exporter.php:54
1025
- #: includes/class-wp-job-manager-post-types.php:1211
1026
  msgid "Company Tagline"
1027
  msgstr ""
1028
 
1029
  #: includes/class-wp-job-manager-data-exporter.php:55
1030
- #: includes/class-wp-job-manager-post-types.php:1219
1031
  msgid "Company Twitter"
1032
  msgstr ""
1033
 
1034
  #: includes/class-wp-job-manager-data-exporter.php:56
1035
- #: includes/class-wp-job-manager-post-types.php:1227
1036
  msgid "Company Video"
1037
  msgstr ""
1038
 
@@ -1040,32 +1040,31 @@ msgstr ""
1040
  msgid "WP Job Manager User Data"
1041
  msgstr ""
1042
 
1043
- #: includes/class-wp-job-manager-dependency-checker.php:63
1044
  #. translators: %1$s is version of PHP that WP Job Manager requires; %2$s is
1045
  #. the version of PHP WordPress is running on.
1046
  msgid ""
1047
- "The next release of <strong>WP Job Manager</strong> will require a minimum "
1048
- "PHP version of %1$s, but you are running %2$s. Please update PHP to "
1049
- "continue using this plugin."
1050
  msgstr ""
1051
 
1052
- #: includes/class-wp-job-manager-dependency-checker.php:74
1053
  msgid "Learn more about updating PHP"
1054
  msgstr ""
1055
 
1056
- #: includes/class-wp-job-manager-dependency-checker.php:76
1057
  #. translators: accessibility text
1058
  msgid "(opens in a new tab)"
1059
  msgstr ""
1060
 
1061
- #: includes/class-wp-job-manager-dependency-checker.php:112
1062
  #. translators: %s is the URL for the page where users can go to update
1063
  #. WordPress.
1064
  msgid "<strong>WP Job Manager</strong> requires a more recent version of WordPress."
1065
  msgstr ""
1066
 
1067
- #: includes/class-wp-job-manager-dependency-checker.php:126
1068
- #: includes/class-wp-job-manager-dependency-checker.php:128
1069
  msgid "WordPress Update Required"
1070
  msgstr ""
1071
 
@@ -1075,18 +1074,18 @@ msgstr ""
1075
 
1076
  #: includes/class-wp-job-manager-email-notifications.php:247
1077
  #: includes/class-wp-job-manager-post-types.php:218
1078
- #: includes/forms/class-wp-job-manager-form-submit-job.php:205
1079
  msgid "Job type"
1080
  msgstr ""
1081
 
1082
  #: includes/class-wp-job-manager-email-notifications.php:257
1083
  #: includes/class-wp-job-manager-post-types.php:154
1084
- #: includes/forms/class-wp-job-manager-form-submit-job.php:214
1085
  msgid "Job category"
1086
  msgstr ""
1087
 
1088
  #: includes/class-wp-job-manager-email-notifications.php:266
1089
- #: includes/forms/class-wp-job-manager-form-submit-job.php:239
1090
  msgid "Company name"
1091
  msgstr ""
1092
 
@@ -1131,7 +1130,7 @@ msgstr ""
1131
  msgid "Geocoding error"
1132
  msgstr ""
1133
 
1134
- #: includes/class-wp-job-manager-install.php:82
1135
  msgid "Employer"
1136
  msgstr ""
1137
 
@@ -1288,148 +1287,148 @@ msgstr ""
1288
  msgid "This is where you can create and manage %s."
1289
  msgstr ""
1290
 
1291
- #: includes/class-wp-job-manager-post-types.php:398
1292
  #. translators: Placeholder %s is the number of expired posts of this type.
1293
  msgid "Expired <span class=\"count\">(%s)</span>"
1294
  msgid_plural "Expired <span class=\"count\">(%s)</span>"
1295
  msgstr[0] ""
1296
  msgstr[1] ""
1297
 
1298
- #: includes/class-wp-job-manager-post-types.php:410
1299
  #. translators: Placeholder %s is the number of posts in a preview state.
1300
  msgid "Preview <span class=\"count\">(%s)</span>"
1301
  msgid_plural "Preview <span class=\"count\">(%s)</span>"
1302
  msgstr[0] ""
1303
  msgstr[1] ""
1304
 
1305
- #: includes/class-wp-job-manager-post-types.php:1162
1306
- #: includes/forms/class-wp-job-manager-form-submit-job.php:174
1307
  msgid "Application email/URL"
1308
  msgstr ""
1309
 
1310
- #: includes/class-wp-job-manager-post-types.php:1163
1311
- #: includes/forms/class-wp-job-manager-form-submit-job.php:175
1312
  msgid "Enter an email address or website URL"
1313
  msgstr ""
1314
 
1315
- #: includes/class-wp-job-manager-post-types.php:1166
1316
- #: includes/forms/class-wp-job-manager-form-submit-job.php:164
1317
  msgid "Application email"
1318
  msgstr ""
1319
 
1320
- #: includes/class-wp-job-manager-post-types.php:1167
1321
- #: includes/forms/class-wp-job-manager-form-submit-job.php:165
1322
  msgid "you@example.com"
1323
  msgstr ""
1324
 
1325
- #: includes/class-wp-job-manager-post-types.php:1169
1326
- #: includes/forms/class-wp-job-manager-form-submit-job.php:169
1327
  msgid "Application URL"
1328
  msgstr ""
1329
 
1330
- #: includes/class-wp-job-manager-post-types.php:1170
1331
- #: includes/forms/class-wp-job-manager-form-submit-job.php:170
1332
  msgid "https://"
1333
  msgstr ""
1334
 
1335
- #: includes/class-wp-job-manager-post-types.php:1176
1336
- #: includes/forms/class-wp-job-manager-form-submit-job.php:201
1337
  msgid "e.g. \"London\""
1338
  msgstr ""
1339
 
1340
- #: includes/class-wp-job-manager-post-types.php:1177
1341
  msgid "Leave this blank if the location is not important."
1342
  msgstr ""
1343
 
1344
- #: includes/class-wp-job-manager-post-types.php:1186
1345
  msgid ""
1346
  "This field is required for the \"application\" area to appear beneath the "
1347
  "listing."
1348
  msgstr ""
1349
 
1350
- #: includes/class-wp-job-manager-post-types.php:1212
1351
  msgid "Brief description about the company"
1352
  msgstr ""
1353
 
1354
- #: includes/class-wp-job-manager-post-types.php:1228
1355
  msgid "URL to the company video"
1356
  msgstr ""
1357
 
1358
- #: includes/class-wp-job-manager-post-types.php:1237
1359
  msgid "Position Filled"
1360
  msgstr ""
1361
 
1362
- #: includes/class-wp-job-manager-post-types.php:1243
1363
  msgid "Filled listings will no longer accept applications."
1364
  msgstr ""
1365
 
1366
- #: includes/class-wp-job-manager-post-types.php:1246
1367
  msgid "Featured Listing"
1368
  msgstr ""
1369
 
1370
- #: includes/class-wp-job-manager-post-types.php:1248
1371
  msgid ""
1372
  "Featured listings will be sticky during searches, and can be styled "
1373
  "differently."
1374
  msgstr ""
1375
 
1376
- #: includes/class-wp-job-manager-post-types.php:1256
1377
  msgid "Listing Expiry Date"
1378
  msgstr ""
1379
 
1380
- #: includes/class-wp-job-manager-shortcodes.php:104
1381
  msgid "Invalid ID"
1382
  msgstr ""
1383
 
1384
- #: includes/class-wp-job-manager-shortcodes.php:111
1385
  msgid "This position has already been filled"
1386
  msgstr ""
1387
 
1388
- #: includes/class-wp-job-manager-shortcodes.php:119
1389
  #. translators: Placeholder %s is the job listing title.
1390
  msgid "%s has been filled"
1391
  msgstr ""
1392
 
1393
- #: includes/class-wp-job-manager-shortcodes.php:124
1394
  msgid "This position is not filled"
1395
  msgstr ""
1396
 
1397
- #: includes/class-wp-job-manager-shortcodes.php:132
1398
  #. translators: Placeholder %s is the job listing title.
1399
  msgid "%s has been marked as not filled"
1400
  msgstr ""
1401
 
1402
- #: includes/class-wp-job-manager-shortcodes.php:140
1403
  #. translators: Placeholder %s is the job listing title.
1404
  msgid "%s has been deleted"
1405
  msgstr ""
1406
 
1407
- #: includes/class-wp-job-manager-shortcodes.php:145
1408
- #: includes/class-wp-job-manager-shortcodes.php:159
1409
  msgid "Missing submission page."
1410
  msgstr ""
1411
 
1412
- #: includes/class-wp-job-manager-shortcodes.php:251
1413
  #: includes/widgets/class-wp-job-manager-widget-featured-jobs.php:36
1414
  #: includes/widgets/class-wp-job-manager-widget-featured-jobs.php:52
1415
  #: includes/widgets/class-wp-job-manager-widget-recent-jobs.php:36
1416
  msgid "Title"
1417
  msgstr ""
1418
 
1419
- #: includes/class-wp-job-manager-shortcodes.php:253
1420
  msgid "Date Posted"
1421
  msgstr ""
1422
 
1423
- #: includes/class-wp-job-manager-shortcodes.php:254
1424
  msgid "Listing Expires"
1425
  msgstr ""
1426
 
1427
- #: includes/class-wp-job-manager-shortcodes.php:392
1428
- #: includes/class-wp-job-manager-shortcodes.php:429
1429
  msgid "Load more listings"
1430
  msgstr ""
1431
 
1432
- #: includes/class-wp-job-manager-usage-tracking.php:227
1433
  #. translators: Placeholder %s is a URL to the document on wpjobmanager.com
1434
  #. with info on usage tracking.
1435
  msgid ""
@@ -1439,7 +1438,7 @@ msgid ""
1439
  "\t\t\t\tcollected, and you can opt out at any time."
1440
  msgstr ""
1441
 
1442
- #: includes/class-wp-job-manager-usage-tracking.php:295
1443
  #. translators: the href tag contains the URL for the page telling users what
1444
  #. data WPJM tracks.
1445
  msgid ""
@@ -1448,12 +1447,12 @@ msgid ""
1448
  "\t\t\t\tNo sensitive information is collected."
1449
  msgstr ""
1450
 
1451
- #: includes/class-wp-job-manager-usage-tracking.php:320
1452
  #: lib/usage-tracking/class-usage-tracking-base.php:483
1453
  msgid "Enable Usage Tracking"
1454
  msgstr ""
1455
 
1456
- #: includes/class-wp-job-manager.php:145
1457
  #. translators: Placeholders %1$s and %2$s are the names of the two cookies
1458
  #. used in WP Job Manager.
1459
  msgid ""
@@ -1462,26 +1461,26 @@ msgid ""
1462
  "\t\t\t\thave started but have not completed: %1$s and %2$s"
1463
  msgstr ""
1464
 
1465
- #: includes/class-wp-job-manager.php:285
1466
  msgid "Load previous listings"
1467
  msgstr ""
1468
 
1469
- #: includes/class-wp-job-manager.php:408
1470
  msgid "Invalid file type. Accepted types:"
1471
  msgstr ""
1472
 
1473
- #: includes/class-wp-job-manager.php:425
1474
- #: includes/forms/class-wp-job-manager-form-submit-job.php:390
1475
  #. translators: Placeholder %d is the number of files to that users are limited
1476
  #. to.
1477
  msgid "You are only allowed to upload a maximum of %d files."
1478
  msgstr ""
1479
 
1480
- #: includes/class-wp-job-manager.php:433
1481
  msgid "Are you sure you want to delete this listing?"
1482
  msgstr ""
1483
 
1484
- #: includes/class-wp-job-manager.php:441
1485
  msgid "This field is required."
1486
  msgstr ""
1487
 
@@ -1544,27 +1543,27 @@ msgstr ""
1544
  msgid "days"
1545
  msgstr ""
1546
 
1547
- #: includes/forms/class-wp-job-manager-form-edit-job.php:107
1548
  msgid "Invalid listing"
1549
  msgstr ""
1550
 
1551
- #: includes/forms/class-wp-job-manager-form-edit-job.php:139
1552
  msgid "Save changes"
1553
  msgstr ""
1554
 
1555
- #: includes/forms/class-wp-job-manager-form-edit-job.php:142
1556
  msgid "Submit changes for approval"
1557
  msgstr ""
1558
 
1559
- #: includes/forms/class-wp-job-manager-form-edit-job.php:195
1560
  msgid "Your changes have been saved."
1561
  msgstr ""
1562
 
1563
- #: includes/forms/class-wp-job-manager-form-edit-job.php:201
1564
  msgid "View &rarr;"
1565
  msgstr ""
1566
 
1567
- #: includes/forms/class-wp-job-manager-form-edit-job.php:203
1568
  msgid ""
1569
  "Your changes have been submitted and your listing will be visible again "
1570
  "once approved."
@@ -1575,7 +1574,7 @@ msgid "Submit Details"
1575
  msgstr ""
1576
 
1577
  #: includes/forms/class-wp-job-manager-form-submit-job.php:88
1578
- #: includes/forms/class-wp-job-manager-form-submit-job.php:562
1579
  #: templates/job-preview.php:30
1580
  msgid "Preview"
1581
  msgstr ""
@@ -1584,79 +1583,79 @@ msgstr ""
1584
  msgid "Done"
1585
  msgstr ""
1586
 
1587
- #: includes/forms/class-wp-job-manager-form-submit-job.php:190
1588
  msgid "Job Title"
1589
  msgstr ""
1590
 
1591
- #: includes/forms/class-wp-job-manager-form-submit-job.php:198
1592
  msgid "Leave this blank if the location is not important"
1593
  msgstr ""
1594
 
1595
- #: includes/forms/class-wp-job-manager-form-submit-job.php:208
1596
  msgid "Choose job type&hellip;"
1597
  msgstr ""
1598
 
1599
- #: includes/forms/class-wp-job-manager-form-submit-job.php:223
1600
  msgid "Description"
1601
  msgstr ""
1602
 
1603
- #: includes/forms/class-wp-job-manager-form-submit-job.php:242
1604
  msgid "Enter the name of the company"
1605
  msgstr ""
1606
 
1607
- #: includes/forms/class-wp-job-manager-form-submit-job.php:246
1608
  #: templates/content-single-job_listing-company.php:30
1609
  msgid "Website"
1610
  msgstr ""
1611
 
1612
- #: includes/forms/class-wp-job-manager-form-submit-job.php:250
1613
  msgid "http://"
1614
  msgstr ""
1615
 
1616
- #: includes/forms/class-wp-job-manager-form-submit-job.php:254
1617
  msgid "Tagline"
1618
  msgstr ""
1619
 
1620
- #: includes/forms/class-wp-job-manager-form-submit-job.php:257
1621
  msgid "Briefly describe your company"
1622
  msgstr ""
1623
 
1624
- #: includes/forms/class-wp-job-manager-form-submit-job.php:262
1625
  msgid "Video"
1626
  msgstr ""
1627
 
1628
- #: includes/forms/class-wp-job-manager-form-submit-job.php:266
1629
  msgid "A link to a video about your company"
1630
  msgstr ""
1631
 
1632
- #: includes/forms/class-wp-job-manager-form-submit-job.php:270
1633
  msgid "Twitter username"
1634
  msgstr ""
1635
 
1636
- #: includes/forms/class-wp-job-manager-form-submit-job.php:273
1637
  msgid "@yourcompany"
1638
  msgstr ""
1639
 
1640
- #: includes/forms/class-wp-job-manager-form-submit-job.php:277
1641
  msgid "Logo"
1642
  msgstr ""
1643
 
1644
- #: includes/forms/class-wp-job-manager-form-submit-job.php:327
1645
  #. translators: Placeholder %s is the label for the required field.
1646
  msgid "%s is a required field"
1647
  msgstr ""
1648
 
1649
- #: includes/forms/class-wp-job-manager-form-submit-job.php:338
1650
  #. translators: Placeholder %s is the field label that is did not validate.
1651
  msgid "%s is invalid"
1652
  msgstr ""
1653
 
1654
- #: includes/forms/class-wp-job-manager-form-submit-job.php:355
1655
  msgid "Invalid attachment provided."
1656
  msgstr ""
1657
 
1658
- #: includes/forms/class-wp-job-manager-form-submit-job.php:373
1659
- #: wp-job-manager-functions.php:1291
1660
  #. translators: Placeholder %1$s is field label; %2$s is the file mime type;
1661
  #. %3$s is the allowed mime-types.
1662
  #. translators: %1$s is the file field label; %2$s is the file type; %3$s is
@@ -1664,90 +1663,90 @@ msgstr ""
1664
  msgid "\"%1$s\" (filetype %2$s) needs to be one of the following file types: %3$s"
1665
  msgstr ""
1666
 
1667
- #: includes/forms/class-wp-job-manager-form-submit-job.php:408
1668
  msgid "Please enter a valid application email address"
1669
  msgstr ""
1670
 
1671
- #: includes/forms/class-wp-job-manager-form-submit-job.php:417
1672
  msgid "Please enter a valid application URL"
1673
  msgstr ""
1674
 
1675
- #: includes/forms/class-wp-job-manager-form-submit-job.php:427
1676
  msgid "Please enter a valid application email address or URL"
1677
  msgstr ""
1678
 
1679
- #: includes/forms/class-wp-job-manager-form-submit-job.php:615
1680
  msgid "Please enter a username."
1681
  msgstr ""
1682
 
1683
- #: includes/forms/class-wp-job-manager-form-submit-job.php:619
1684
  msgid "Please enter a password."
1685
  msgstr ""
1686
 
1687
- #: includes/forms/class-wp-job-manager-form-submit-job.php:623
1688
  msgid "Please enter your email address."
1689
  msgstr ""
1690
 
1691
- #: includes/forms/class-wp-job-manager-form-submit-job.php:629
1692
  msgid "Passwords must match."
1693
  msgstr ""
1694
 
1695
- #: includes/forms/class-wp-job-manager-form-submit-job.php:635
1696
  #. translators: Placeholder %s is the password hint.
1697
  msgid "Invalid Password: %s"
1698
  msgstr ""
1699
 
1700
- #: includes/forms/class-wp-job-manager-form-submit-job.php:637
1701
  msgid "Password is not valid."
1702
  msgstr ""
1703
 
1704
- #: includes/forms/class-wp-job-manager-form-submit-job.php:660
1705
  msgid "You must be signed in to post a new listing."
1706
  msgstr ""
1707
 
1708
- #: includes/forms/class-wp-job-manager-form-submit-job.php:678
1709
  #. translators: placeholder is the URL to the job dashboard page.
1710
  msgid ""
1711
  "Draft was saved. Job listing drafts can be resumed from the <a "
1712
  "href=\"%s\">job dashboard</a>."
1713
  msgstr ""
1714
 
1715
- #: includes/helper/class-wp-job-manager-helper.php:272
1716
  msgid "Manage License (Requires Attention)"
1717
  msgstr ""
1718
 
1719
- #: includes/helper/class-wp-job-manager-helper.php:275
1720
  msgid "Manage License"
1721
  msgstr ""
1722
 
1723
- #: includes/helper/class-wp-job-manager-helper.php:278
1724
  #: includes/helper/views/html-licences.php:75
1725
  msgid "Activate License"
1726
  msgstr ""
1727
 
1728
- #: includes/helper/class-wp-job-manager-helper.php:484
1729
  msgid ""
1730
  "Please enter a valid license key and email address in order to activate "
1731
  "this plugin's license."
1732
  msgstr ""
1733
 
1734
- #: includes/helper/class-wp-job-manager-helper.php:516
1735
  msgid "Connection failed to the License Key API server - possible server issue."
1736
  msgstr ""
1737
 
1738
- #: includes/helper/class-wp-job-manager-helper.php:525
1739
  msgid "Plugin license has been activated."
1740
  msgstr ""
1741
 
1742
- #: includes/helper/class-wp-job-manager-helper.php:528
1743
  msgid "An unknown error occurred while attempting to activate the license"
1744
  msgstr ""
1745
 
1746
- #: includes/helper/class-wp-job-manager-helper.php:548
1747
  msgid "license is not active."
1748
  msgstr ""
1749
 
1750
- #: includes/helper/class-wp-job-manager-helper.php:564
1751
  msgid "Plugin license has been deactivated."
1752
  msgstr ""
1753
 
@@ -1923,17 +1922,20 @@ msgstr ""
1923
  msgid "This listing has expired."
1924
  msgstr ""
1925
 
1926
- #: templates/emails/admin-expiring-job.php:30
1927
- #: templates/emails/employer-expiring-job.php:32
1928
- msgid "The following job listing is expiring today from <a href=\"%s\">%s</a>."
1929
- msgstr ""
1930
-
1931
  #: templates/emails/admin-expiring-job.php:32
1932
- #: templates/emails/employer-expiring-job.php:40
1933
- msgid "The following job listing is expiring soon from <a href=\"%s\">%s</a>."
 
1934
  msgstr ""
1935
 
1936
  #: templates/emails/admin-expiring-job.php:35
 
 
 
 
 
 
 
1937
  msgid "Visit <a href=\"%s\">WordPress admin</a> to manage the listing."
1938
  msgstr ""
1939
 
@@ -1967,6 +1969,14 @@ msgid ""
1967
  "an administrator in the site's <a href=\"%s\">WordPress admin</a>."
1968
  msgstr ""
1969
 
 
 
 
 
 
 
 
 
1970
  #: templates/emails/employer-expiring-job.php:48
1971
  msgid "Visit the <a href=\"%s\">job listing dashboard</a> to manage the listing."
1972
  msgstr ""
@@ -2012,12 +2022,12 @@ msgid "Maximum file size: %s."
2012
  msgstr ""
2013
 
2014
  #: templates/form-fields/multiselect-field.php:20
2015
- #: wp-job-manager-functions.php:1074
2016
  msgid "No results match"
2017
  msgstr ""
2018
 
2019
  #: templates/form-fields/multiselect-field.php:20
2020
- #: wp-job-manager-functions.php:1075
2021
  msgid "Select Some Options"
2022
  msgstr ""
2023
 
@@ -2130,67 +2140,67 @@ msgstr ""
2130
  msgid "%s submitted successfully. Your listing will be visible once approved."
2131
  msgstr ""
2132
 
2133
- #: wp-job-manager-functions.php:445
2134
  msgid "Reset"
2135
  msgstr ""
2136
 
2137
- #: wp-job-manager-functions.php:449
2138
  msgid "RSS"
2139
  msgstr ""
2140
 
2141
- #: wp-job-manager-functions.php:554
2142
  msgid "Invalid email address."
2143
  msgstr ""
2144
 
2145
- #: wp-job-manager-functions.php:562
2146
  msgid "Your email address isn&#8217;t correct."
2147
  msgstr ""
2148
 
2149
- #: wp-job-manager-functions.php:566
2150
  msgid "This email is already registered, please choose another one."
2151
  msgstr ""
2152
 
2153
- #: wp-job-manager-functions.php:880
2154
  msgid "Full Time"
2155
  msgstr ""
2156
 
2157
- #: wp-job-manager-functions.php:881
2158
  msgid "Part Time"
2159
  msgstr ""
2160
 
2161
- #: wp-job-manager-functions.php:882
2162
  msgid "Contractor"
2163
  msgstr ""
2164
 
2165
- #: wp-job-manager-functions.php:883
2166
  msgid "Temporary"
2167
  msgstr ""
2168
 
2169
- #: wp-job-manager-functions.php:884
2170
  msgid "Intern"
2171
  msgstr ""
2172
 
2173
- #: wp-job-manager-functions.php:885
2174
  msgid "Volunteer"
2175
  msgstr ""
2176
 
2177
- #: wp-job-manager-functions.php:886
2178
  msgid "Per Diem"
2179
  msgstr ""
2180
 
2181
- #: wp-job-manager-functions.php:887
2182
  msgid "Other"
2183
  msgstr ""
2184
 
2185
- #: wp-job-manager-functions.php:954
2186
  msgid "Passwords must be at least 8 characters long."
2187
  msgstr ""
2188
 
2189
- #: wp-job-manager-functions.php:1073
2190
  msgid "Choose a category&hellip;"
2191
  msgstr ""
2192
 
2193
- #: wp-job-manager-functions.php:1294
2194
  #. translators: %s is the list of allowed file types.
2195
  msgid "Uploaded files need to be one of the following file types: %s"
2196
  msgstr ""
@@ -2205,37 +2215,37 @@ msgstr ""
2205
  msgid "Application via %1$s listing on %2$s"
2206
  msgstr ""
2207
 
2208
- #: wp-job-manager-template.php:693
2209
- msgid "Username"
2210
  msgstr ""
2211
 
2212
- #: wp-job-manager-template.php:701
2213
- msgid "Password"
2214
  msgstr ""
2215
 
2216
- #: wp-job-manager-template.php:711
2217
- msgid "Verify Password"
2218
  msgstr ""
2219
 
2220
- #: wp-job-manager-template.php:718
2221
- msgid "Your email"
2222
  msgstr ""
2223
 
2224
- #: wp-job-manager-template.php:719
2225
- msgid "you@yourdomain.com"
2226
  msgstr ""
2227
 
2228
- #: wp-job-manager-template.php:745
2229
  msgid "Posted on "
2230
  msgstr ""
2231
 
2232
- #: wp-job-manager-template.php:748 wp-job-manager-template.php:769
2233
  #. translators: Placeholder %s is the relative, human readable time since the
2234
  #. job listing was posted.
2235
  msgid "Posted %s ago"
2236
  msgstr ""
2237
 
2238
- #: wp-job-manager-template.php:798
2239
  msgid "Anywhere"
2240
  msgstr ""
2241
 
@@ -2284,7 +2294,7 @@ msgid "Searching&hellip;"
2284
  msgstr ""
2285
 
2286
  #: includes/admin/class-wp-job-manager-admin.php:123
2287
- #: includes/forms/class-wp-job-manager-form-submit-job.php:474
2288
  #. translators: jQuery date format, see
2289
  #. http:api.jqueryui.com/datepicker/#utility-formatDate
2290
  msgctxt "Date format for jQuery datepicker."
@@ -2292,71 +2302,71 @@ msgid "yy-mm-dd"
2292
  msgstr ""
2293
 
2294
  #: includes/admin/class-wp-job-manager-permalink-settings.php:108
2295
- #: includes/class-wp-job-manager-post-types.php:901
2296
  msgctxt "Job permalink - resave permalinks after changing this"
2297
  msgid "job"
2298
  msgstr ""
2299
 
2300
  #: includes/admin/class-wp-job-manager-permalink-settings.php:117
2301
- #: includes/class-wp-job-manager-post-types.php:902
2302
  msgctxt "Job category slug - resave permalinks after changing this"
2303
  msgid "job-category"
2304
  msgstr ""
2305
 
2306
  #: includes/admin/class-wp-job-manager-permalink-settings.php:126
2307
- #: includes/class-wp-job-manager-post-types.php:903
2308
  msgctxt "Job type slug - resave permalinks after changing this"
2309
  msgid "job-type"
2310
  msgstr ""
2311
 
2312
- #: includes/admin/views/html-admin-setup-step-2.php:46
2313
  msgctxt "Default page title (wizard)"
2314
  msgid "Post a Job"
2315
  msgstr ""
2316
 
2317
- #: includes/admin/views/html-admin-setup-step-2.php:54
2318
  msgctxt "Default page title (wizard)"
2319
  msgid "Job Dashboard"
2320
  msgstr ""
2321
 
2322
- #: includes/admin/views/html-admin-setup-step-2.php:62
2323
  msgctxt "Default page title (wizard)"
2324
  msgid "Jobs"
2325
  msgstr ""
2326
 
2327
- #: includes/class-wp-job-manager-post-types.php:391
2328
- #: wp-job-manager-functions.php:320
2329
  msgctxt "post status"
2330
  msgid "Expired"
2331
  msgstr ""
2332
 
2333
- #: includes/class-wp-job-manager-post-types.php:404
2334
- #: wp-job-manager-functions.php:321
2335
  msgctxt "post status"
2336
  msgid "Preview"
2337
  msgstr ""
2338
 
2339
- #: wp-job-manager-functions.php:319
2340
  msgctxt "post status"
2341
  msgid "Draft"
2342
  msgstr ""
2343
 
2344
- #: wp-job-manager-functions.php:322
2345
  msgctxt "post status"
2346
  msgid "Pending approval"
2347
  msgstr ""
2348
 
2349
- #: wp-job-manager-functions.php:323
2350
  msgctxt "post status"
2351
  msgid "Pending payment"
2352
  msgstr ""
2353
 
2354
- #: wp-job-manager-functions.php:324
2355
  msgctxt "post status"
2356
  msgid "Active"
2357
  msgstr ""
2358
 
2359
- #: includes/class-wp-job-manager-post-types.php:885
2360
  msgctxt "Post type archive slug - resave permalinks after changing this"
2361
  msgid "jobs"
2362
- msgstr ""
2
  # This file is distributed under the GPL2+.
3
  msgid ""
4
  msgstr ""
5
+ "Project-Id-Version: WP Job Manager 1.34.0\n"
6
  "Report-Msgid-Bugs-To: https://github.com/Automattic/WP-Job-Manager/issues\n"
7
+ "POT-Creation-Date: 2019-10-01 09:58:35+00:00\n"
8
  "MIME-Version: 1.0\n"
9
  "Content-Type: text/plain; charset=utf-8\n"
10
  "Content-Transfer-Encoding: 8bit\n"
13
  "Language-Team: LANGUAGE <EMAIL@ADDRESS>\n"
14
  "X-Generator: grunt-wp-i18n 1.0.3\n"
15
 
16
+ #: includes/3rd-party/wpml.php:94
17
  msgid "Page Not Set"
18
  msgstr ""
19
 
20
+ #: includes/3rd-party/wpml.php:108
21
  #. translators: Placeholder (%s) is the URL to edit the primary language in
22
  #. WPML.
23
  msgid "<a href=\"%s\">Switch to primary language</a> to edit this setting."
24
  msgstr ""
25
 
26
+ #: includes/abstracts/abstract-wp-job-manager-form.php:371
27
+ #: includes/abstracts/abstract-wp-job-manager-form.php:387
28
  #. translators: Placeholder is for the label of the reCAPTCHA field.
29
  #. translators: %s is the name of the form validation that failed.
30
  msgid "\"%s\" check failed. Please try again."
31
  msgstr ""
32
 
33
+ #: includes/admin/class-wp-job-manager-addons.php:125
34
  #: includes/admin/class-wp-job-manager-admin.php:139
35
  #: includes/admin/views/html-admin-page-addons.php:12
36
  msgid "WP Job Manager Add-ons"
37
  msgstr ""
38
 
39
+ #: includes/admin/class-wp-job-manager-addons.php:133
40
  #: includes/helper/views/html-licences.php:12
41
  msgid "Licenses"
42
  msgstr ""
105
  msgid "%s marked as not filled"
106
  msgstr ""
107
 
108
+ #: includes/admin/class-wp-job-manager-cpt.php:337
109
  msgid "Select category"
110
  msgstr ""
111
 
112
+ #: includes/admin/class-wp-job-manager-cpt.php:362
113
  msgid "Select Filled"
114
  msgstr ""
115
 
116
+ #: includes/admin/class-wp-job-manager-cpt.php:366
117
  msgid "Filled"
118
  msgstr ""
119
 
120
+ #: includes/admin/class-wp-job-manager-cpt.php:370
121
  msgid "Not Filled"
122
  msgstr ""
123
 
124
+ #: includes/admin/class-wp-job-manager-cpt.php:381
125
  msgid "Select Featured"
126
  msgstr ""
127
 
128
+ #: includes/admin/class-wp-job-manager-cpt.php:385
129
  msgid "Featured"
130
  msgstr ""
131
 
132
+ #: includes/admin/class-wp-job-manager-cpt.php:389
133
  msgid "Not Featured"
134
  msgstr ""
135
 
136
+ #: includes/admin/class-wp-job-manager-cpt.php:435
137
+ #: includes/admin/class-wp-job-manager-cpt.php:495
138
  msgid "Position"
139
  msgstr ""
140
 
141
+ #: includes/admin/class-wp-job-manager-cpt.php:455
142
  #. translators: %1$s is the singular name of the job listing post type; %2$s is
143
  #. the URL to view the listing.
144
  msgid "%1$s updated. <a href=\"%2$s\">View</a>"
145
  msgstr ""
146
 
147
+ #: includes/admin/class-wp-job-manager-cpt.php:456
148
  msgid "Custom field updated."
149
  msgstr ""
150
 
151
+ #: includes/admin/class-wp-job-manager-cpt.php:457
152
  msgid "Custom field deleted."
153
  msgstr ""
154
 
155
+ #: includes/admin/class-wp-job-manager-cpt.php:459
156
  #. translators: %s is the singular name of the job listing post type.
157
  msgid "%s updated."
158
  msgstr ""
159
 
160
+ #: includes/admin/class-wp-job-manager-cpt.php:461
161
  #. translators: %1$s is the singular name of the job listing post type; %2$s is
162
  #. the revision number.
163
  msgid "%1$s restored to revision from %2$s"
164
  msgstr ""
165
 
166
+ #: includes/admin/class-wp-job-manager-cpt.php:463
167
  #. translators: %1$s is the singular name of the job listing post type; %2$s is
168
  #. the URL to view the listing.
169
  msgid "%1$s published. <a href=\"%2$s\">View</a>"
170
  msgstr ""
171
 
172
+ #: includes/admin/class-wp-job-manager-cpt.php:465
173
  #. translators: %1$s is the singular name of the job listing post type; %2$s is
174
  #. the URL to view the listing.
175
  msgid "%s saved."
176
  msgstr ""
177
 
178
+ #: includes/admin/class-wp-job-manager-cpt.php:467
179
  #. translators: %1$s is the singular name of the job listing post type; %2$s is
180
  #. the URL to preview the listing.
181
  msgid "%1$s submitted. <a target=\"_blank\" href=\"%2$s\">Preview</a>"
182
  msgstr ""
183
 
184
+ #: includes/admin/class-wp-job-manager-cpt.php:470
185
  #. translators: %1$s is the singular name of the post type; %2$s is the date
186
  #. the post will be published; %3$s is the URL to preview the listing.
187
  msgid ""
189
  "href=\"%3$s\">Preview</a>"
190
  msgstr ""
191
 
192
+ #: includes/admin/class-wp-job-manager-cpt.php:476
193
  #. translators: %1$s is the singular name of the job listing post type; %2$s is
194
  #. the URL to view the listing.
195
  msgid "%1$s draft updated. <a target=\"_blank\" href=\"%2$s\">Preview</a>"
196
  msgstr ""
197
 
198
+ #: includes/admin/class-wp-job-manager-cpt.php:496
199
  msgid "Type"
200
  msgstr ""
201
 
202
+ #: includes/admin/class-wp-job-manager-cpt.php:497
203
  #: includes/class-wp-job-manager-email-notifications.php:238
204
+ #: includes/class-wp-job-manager-post-types.php:1224
205
+ #: includes/forms/class-wp-job-manager-form-submit-job.php:213
206
  #: includes/widgets/class-wp-job-manager-widget-recent-jobs.php:46
207
  #: templates/job-filters.php:35 templates/job-filters.php:36
208
  msgid "Location"
209
  msgstr ""
210
 
211
+ #: includes/admin/class-wp-job-manager-cpt.php:498
212
  msgid "Status"
213
  msgstr ""
214
 
215
+ #: includes/admin/class-wp-job-manager-cpt.php:499
216
  msgid "Posted"
217
  msgstr ""
218
 
219
+ #: includes/admin/class-wp-job-manager-cpt.php:500
220
  msgid "Expires"
221
  msgstr ""
222
 
223
+ #: includes/admin/class-wp-job-manager-cpt.php:501
224
  #: includes/admin/class-wp-job-manager-settings.php:162
225
  msgid "Categories"
226
  msgstr ""
227
 
228
+ #: includes/admin/class-wp-job-manager-cpt.php:502
229
  msgid "Featured?"
230
  msgstr ""
231
 
232
+ #: includes/admin/class-wp-job-manager-cpt.php:503
233
+ #: includes/class-wp-job-manager-shortcodes.php:257
234
  msgid "Filled?"
235
  msgstr ""
236
 
237
+ #: includes/admin/class-wp-job-manager-cpt.php:504
238
  msgid "Actions"
239
  msgstr ""
240
 
241
+ #: includes/admin/class-wp-job-manager-cpt.php:569
242
  #. translators: %d is the post ID for the job listing.
243
  msgid "ID: %d"
244
  msgstr ""
245
 
246
+ #: includes/admin/class-wp-job-manager-cpt.php:613
247
  #. translators: %s placeholder is the username of the user.
248
  msgid "by a guest"
249
  msgstr ""
250
 
251
+ #: includes/admin/class-wp-job-manager-cpt.php:613
252
  msgid "by %s"
253
  msgstr ""
254
 
255
+ #: includes/admin/class-wp-job-manager-cpt.php:632
256
  msgid "Approve"
257
  msgstr ""
258
 
259
+ #: includes/admin/class-wp-job-manager-cpt.php:640
260
  #: includes/admin/class-wp-job-manager-writepanels.php:227
261
  #: includes/admin/class-wp-job-manager-writepanels.php:232
262
  #: includes/admin/class-wp-job-manager-writepanels.php:237
263
  msgid "View"
264
  msgstr ""
265
 
266
+ #: includes/admin/class-wp-job-manager-cpt.php:647
267
  #: includes/class-wp-job-manager-post-types.php:334
268
  #: templates/job-dashboard.php:52 templates/job-dashboard.php:70
269
  msgid "Edit"
270
  msgstr ""
271
 
272
+ #: includes/admin/class-wp-job-manager-cpt.php:654
273
  #: templates/job-dashboard.php:79
274
  msgid "Delete"
275
  msgstr ""
336
 
337
  #: includes/admin/class-wp-job-manager-settings.php:122
338
  #: includes/class-wp-job-manager-post-types.php:328
339
+ #: includes/class-wp-job-manager-post-types.php:431
340
  msgid "Job Listings"
341
  msgstr ""
342
 
704
  "plugin know the location of the job listings page."
705
  msgstr ""
706
 
707
+ #: includes/admin/class-wp-job-manager-settings.php:417
708
  msgid "Settings successfully saved"
709
  msgstr ""
710
 
711
+ #: includes/admin/class-wp-job-manager-settings.php:442
712
  msgid "Save Changes"
713
  msgstr ""
714
 
715
+ #: includes/admin/class-wp-job-manager-settings.php:633
716
  msgid "--no page--"
717
  msgstr ""
718
 
719
+ #: includes/admin/class-wp-job-manager-settings.php:639
720
  msgid "Select a page&hellip;"
721
  msgstr ""
722
 
723
+ #: includes/admin/class-wp-job-manager-setup.php:58
724
  msgid "Setup"
725
  msgstr ""
726
 
727
+ #: includes/admin/class-wp-job-manager-taxonomy-meta.php:87
728
+ #: includes/admin/class-wp-job-manager-taxonomy-meta.php:110
729
+ #: includes/admin/class-wp-job-manager-taxonomy-meta.php:129
730
  #: includes/class-wp-job-manager-post-types.php:287
731
  msgid "Employment Type"
732
  msgstr ""
759
  msgstr ""
760
 
761
  #: includes/admin/class-wp-job-manager-writepanels.php:471
762
+ #: includes/class-wp-job-manager-ajax.php:418
763
  #. translators: Used in user select. %1$s is the user's display name; #%2$s is
764
  #. the user ID; %3$s is the user email.
765
  msgid "%1$s (#%2$s – %3$s)"
801
  msgid "More Information &rarr;"
802
  msgstr ""
803
 
804
+ #: includes/admin/views/html-admin-page-addons.php:54
805
  msgid "No add-ons were found."
806
  msgstr ""
807
 
876
  "for detailed instructions.)"
877
  msgstr ""
878
 
879
+ #: includes/admin/views/html-admin-setup-step-2.php:39
880
  msgid "Page Title"
881
  msgstr ""
882
 
883
+ #: includes/admin/views/html-admin-setup-step-2.php:40
884
  msgid "Page Description"
885
  msgstr ""
886
 
887
+ #: includes/admin/views/html-admin-setup-step-2.php:41
888
  msgid "Content Shortcode"
889
  msgstr ""
890
 
891
+ #: includes/admin/views/html-admin-setup-step-2.php:49
892
  msgid ""
893
  "Creates a page that allows employers to post new jobs directly from a page "
894
  "on your website, instead of requiring them to log in to an admin area. If "
896
  "the admin dashboard only -- you can uncheck this setting."
897
  msgstr ""
898
 
899
+ #: includes/admin/views/html-admin-setup-step-2.php:57
900
  msgid ""
901
  "Creates a page that allows employers to manage their job listings directly "
902
  "from a page on your website, instead of requiring them to log in to an "
904
  "only, you can uncheck this setting."
905
  msgstr ""
906
 
907
+ #: includes/admin/views/html-admin-setup-step-2.php:64
908
  msgid "Creates a page where visitors can browse, search, and filter job listings."
909
  msgstr ""
910
 
911
+ #: includes/admin/views/html-admin-setup-step-2.php:72
912
  msgid "Skip this step"
913
  msgstr ""
914
 
963
  "hiring!"
964
  msgstr ""
965
 
966
+ #: includes/admin/views/html-admin-setup-step-3.php:66
967
  msgid "Support WP Job Manager's Ongoing Development"
968
  msgstr ""
969
 
970
+ #: includes/admin/views/html-admin-setup-step-3.php:67
971
  msgid ""
972
  "There are lots of ways you can support open source software projects like "
973
  "this one: contributing code, fixing a bug, assisting with non-English "
975
  "spread the word. We appreciate your support!"
976
  msgstr ""
977
 
978
+ #: includes/admin/views/html-admin-setup-step-3.php:69
979
  msgid "Leave a positive review"
980
  msgstr ""
981
 
982
+ #: includes/admin/views/html-admin-setup-step-3.php:70
983
  msgid "Contribute a localization"
984
  msgstr ""
985
 
986
+ #: includes/admin/views/html-admin-setup-step-3.php:71
987
  msgid "Contribute code or report a bug"
988
  msgstr ""
989
 
990
+ #: includes/admin/views/html-admin-setup-step-3.php:72
991
  msgid "Help other users on the forums"
992
  msgstr ""
993
 
994
+ #: includes/class-wp-job-manager-ajax.php:185
995
  #. translators: Placeholder %d is the number of found search results.
996
  msgid "Search completed. Found %d matching record."
997
  msgid_plural "Search completed. Found %d matching records."
998
  msgstr[0] ""
999
  msgstr[1] ""
1000
 
1001
+ #: includes/class-wp-job-manager-ajax.php:283
1002
  msgid "You must be logged in to upload files using this method."
1003
  msgstr ""
1004
 
1012
  msgstr ""
1013
 
1014
  #: includes/class-wp-job-manager-data-exporter.php:52
1015
+ #: includes/class-wp-job-manager-post-types.php:1243
1016
  msgid "Company Name"
1017
  msgstr ""
1018
 
1019
  #: includes/class-wp-job-manager-data-exporter.php:53
1020
+ #: includes/class-wp-job-manager-post-types.php:1251
1021
  msgid "Company Website"
1022
  msgstr ""
1023
 
1024
  #: includes/class-wp-job-manager-data-exporter.php:54
1025
+ #: includes/class-wp-job-manager-post-types.php:1260
1026
  msgid "Company Tagline"
1027
  msgstr ""
1028
 
1029
  #: includes/class-wp-job-manager-data-exporter.php:55
1030
+ #: includes/class-wp-job-manager-post-types.php:1268
1031
  msgid "Company Twitter"
1032
  msgstr ""
1033
 
1034
  #: includes/class-wp-job-manager-data-exporter.php:56
1035
+ #: includes/class-wp-job-manager-post-types.php:1276
1036
  msgid "Company Video"
1037
  msgstr ""
1038
 
1040
  msgid "WP Job Manager User Data"
1041
  msgstr ""
1042
 
1043
+ #: includes/class-wp-job-manager-dependency-checker.php:66
1044
  #. translators: %1$s is version of PHP that WP Job Manager requires; %2$s is
1045
  #. the version of PHP WordPress is running on.
1046
  msgid ""
1047
+ "<strong>WP Job Manager</strong> requires a minimum PHP version of %1$s, but "
1048
+ "you are running %2$s."
 
1049
  msgstr ""
1050
 
1051
+ #: includes/class-wp-job-manager-dependency-checker.php:77
1052
  msgid "Learn more about updating PHP"
1053
  msgstr ""
1054
 
1055
+ #: includes/class-wp-job-manager-dependency-checker.php:79
1056
  #. translators: accessibility text
1057
  msgid "(opens in a new tab)"
1058
  msgstr ""
1059
 
1060
+ #: includes/class-wp-job-manager-dependency-checker.php:122
1061
  #. translators: %s is the URL for the page where users can go to update
1062
  #. WordPress.
1063
  msgid "<strong>WP Job Manager</strong> requires a more recent version of WordPress."
1064
  msgstr ""
1065
 
1066
+ #: includes/class-wp-job-manager-dependency-checker.php:136
1067
+ #: includes/class-wp-job-manager-dependency-checker.php:138
1068
  msgid "WordPress Update Required"
1069
  msgstr ""
1070
 
1074
 
1075
  #: includes/class-wp-job-manager-email-notifications.php:247
1076
  #: includes/class-wp-job-manager-post-types.php:218
1077
+ #: includes/forms/class-wp-job-manager-form-submit-job.php:221
1078
  msgid "Job type"
1079
  msgstr ""
1080
 
1081
  #: includes/class-wp-job-manager-email-notifications.php:257
1082
  #: includes/class-wp-job-manager-post-types.php:154
1083
+ #: includes/forms/class-wp-job-manager-form-submit-job.php:230
1084
  msgid "Job category"
1085
  msgstr ""
1086
 
1087
  #: includes/class-wp-job-manager-email-notifications.php:266
1088
+ #: includes/forms/class-wp-job-manager-form-submit-job.php:255
1089
  msgid "Company name"
1090
  msgstr ""
1091
 
1130
  msgid "Geocoding error"
1131
  msgstr ""
1132
 
1133
+ #: includes/class-wp-job-manager-install.php:84
1134
  msgid "Employer"
1135
  msgstr ""
1136
 
1287
  msgid "This is where you can create and manage %s."
1288
  msgstr ""
1289
 
1290
+ #: includes/class-wp-job-manager-post-types.php:399
1291
  #. translators: Placeholder %s is the number of expired posts of this type.
1292
  msgid "Expired <span class=\"count\">(%s)</span>"
1293
  msgid_plural "Expired <span class=\"count\">(%s)</span>"
1294
  msgstr[0] ""
1295
  msgstr[1] ""
1296
 
1297
+ #: includes/class-wp-job-manager-post-types.php:411
1298
  #. translators: Placeholder %s is the number of posts in a preview state.
1299
  msgid "Preview <span class=\"count\">(%s)</span>"
1300
  msgid_plural "Preview <span class=\"count\">(%s)</span>"
1301
  msgstr[0] ""
1302
  msgstr[1] ""
1303
 
1304
+ #: includes/class-wp-job-manager-post-types.php:1211
1305
+ #: includes/forms/class-wp-job-manager-form-submit-job.php:190
1306
  msgid "Application email/URL"
1307
  msgstr ""
1308
 
1309
+ #: includes/class-wp-job-manager-post-types.php:1212
1310
+ #: includes/forms/class-wp-job-manager-form-submit-job.php:191
1311
  msgid "Enter an email address or website URL"
1312
  msgstr ""
1313
 
1314
+ #: includes/class-wp-job-manager-post-types.php:1215
1315
+ #: includes/forms/class-wp-job-manager-form-submit-job.php:180
1316
  msgid "Application email"
1317
  msgstr ""
1318
 
1319
+ #: includes/class-wp-job-manager-post-types.php:1216
1320
+ #: includes/forms/class-wp-job-manager-form-submit-job.php:181
1321
  msgid "you@example.com"
1322
  msgstr ""
1323
 
1324
+ #: includes/class-wp-job-manager-post-types.php:1218
1325
+ #: includes/forms/class-wp-job-manager-form-submit-job.php:185
1326
  msgid "Application URL"
1327
  msgstr ""
1328
 
1329
+ #: includes/class-wp-job-manager-post-types.php:1219
1330
+ #: includes/forms/class-wp-job-manager-form-submit-job.php:186
1331
  msgid "https://"
1332
  msgstr ""
1333
 
1334
+ #: includes/class-wp-job-manager-post-types.php:1225
1335
+ #: includes/forms/class-wp-job-manager-form-submit-job.php:217
1336
  msgid "e.g. \"London\""
1337
  msgstr ""
1338
 
1339
+ #: includes/class-wp-job-manager-post-types.php:1226
1340
  msgid "Leave this blank if the location is not important."
1341
  msgstr ""
1342
 
1343
+ #: includes/class-wp-job-manager-post-types.php:1235
1344
  msgid ""
1345
  "This field is required for the \"application\" area to appear beneath the "
1346
  "listing."
1347
  msgstr ""
1348
 
1349
+ #: includes/class-wp-job-manager-post-types.php:1261
1350
  msgid "Brief description about the company"
1351
  msgstr ""
1352
 
1353
+ #: includes/class-wp-job-manager-post-types.php:1277
1354
  msgid "URL to the company video"
1355
  msgstr ""
1356
 
1357
+ #: includes/class-wp-job-manager-post-types.php:1286
1358
  msgid "Position Filled"
1359
  msgstr ""
1360
 
1361
+ #: includes/class-wp-job-manager-post-types.php:1292
1362
  msgid "Filled listings will no longer accept applications."
1363
  msgstr ""
1364
 
1365
+ #: includes/class-wp-job-manager-post-types.php:1295
1366
  msgid "Featured Listing"
1367
  msgstr ""
1368
 
1369
+ #: includes/class-wp-job-manager-post-types.php:1297
1370
  msgid ""
1371
  "Featured listings will be sticky during searches, and can be styled "
1372
  "differently."
1373
  msgstr ""
1374
 
1375
+ #: includes/class-wp-job-manager-post-types.php:1305
1376
  msgid "Listing Expiry Date"
1377
  msgstr ""
1378
 
1379
+ #: includes/class-wp-job-manager-shortcodes.php:108
1380
  msgid "Invalid ID"
1381
  msgstr ""
1382
 
1383
+ #: includes/class-wp-job-manager-shortcodes.php:115
1384
  msgid "This position has already been filled"
1385
  msgstr ""
1386
 
1387
+ #: includes/class-wp-job-manager-shortcodes.php:123
1388
  #. translators: Placeholder %s is the job listing title.
1389
  msgid "%s has been filled"
1390
  msgstr ""
1391
 
1392
+ #: includes/class-wp-job-manager-shortcodes.php:128
1393
  msgid "This position is not filled"
1394
  msgstr ""
1395
 
1396
+ #: includes/class-wp-job-manager-shortcodes.php:136
1397
  #. translators: Placeholder %s is the job listing title.
1398
  msgid "%s has been marked as not filled"
1399
  msgstr ""
1400
 
1401
+ #: includes/class-wp-job-manager-shortcodes.php:144
1402
  #. translators: Placeholder %s is the job listing title.
1403
  msgid "%s has been deleted"
1404
  msgstr ""
1405
 
1406
+ #: includes/class-wp-job-manager-shortcodes.php:149
1407
+ #: includes/class-wp-job-manager-shortcodes.php:163
1408
  msgid "Missing submission page."
1409
  msgstr ""
1410
 
1411
+ #: includes/class-wp-job-manager-shortcodes.php:256
1412
  #: includes/widgets/class-wp-job-manager-widget-featured-jobs.php:36
1413
  #: includes/widgets/class-wp-job-manager-widget-featured-jobs.php:52
1414
  #: includes/widgets/class-wp-job-manager-widget-recent-jobs.php:36
1415
  msgid "Title"
1416
  msgstr ""
1417
 
1418
+ #: includes/class-wp-job-manager-shortcodes.php:258
1419
  msgid "Date Posted"
1420
  msgstr ""
1421
 
1422
+ #: includes/class-wp-job-manager-shortcodes.php:259
1423
  msgid "Listing Expires"
1424
  msgstr ""
1425
 
1426
+ #: includes/class-wp-job-manager-shortcodes.php:415
1427
+ #: includes/class-wp-job-manager-shortcodes.php:453
1428
  msgid "Load more listings"
1429
  msgstr ""
1430
 
1431
+ #: includes/class-wp-job-manager-usage-tracking.php:228
1432
  #. translators: Placeholder %s is a URL to the document on wpjobmanager.com
1433
  #. with info on usage tracking.
1434
  msgid ""
1438
  "\t\t\t\tcollected, and you can opt out at any time."
1439
  msgstr ""
1440
 
1441
+ #: includes/class-wp-job-manager-usage-tracking.php:297
1442
  #. translators: the href tag contains the URL for the page telling users what
1443
  #. data WPJM tracks.
1444
  msgid ""
1447
  "\t\t\t\tNo sensitive information is collected."
1448
  msgstr ""
1449
 
1450
+ #: includes/class-wp-job-manager-usage-tracking.php:324
1451
  #: lib/usage-tracking/class-usage-tracking-base.php:483
1452
  msgid "Enable Usage Tracking"
1453
  msgstr ""
1454
 
1455
+ #: includes/class-wp-job-manager.php:138
1456
  #. translators: Placeholders %1$s and %2$s are the names of the two cookies
1457
  #. used in WP Job Manager.
1458
  msgid ""
1461
  "\t\t\t\thave started but have not completed: %1$s and %2$s"
1462
  msgstr ""
1463
 
1464
+ #: includes/class-wp-job-manager.php:276
1465
  msgid "Load previous listings"
1466
  msgstr ""
1467
 
1468
+ #: includes/class-wp-job-manager.php:403
1469
  msgid "Invalid file type. Accepted types:"
1470
  msgstr ""
1471
 
1472
+ #: includes/class-wp-job-manager.php:420
1473
+ #: includes/forms/class-wp-job-manager-form-submit-job.php:406
1474
  #. translators: Placeholder %d is the number of files to that users are limited
1475
  #. to.
1476
  msgid "You are only allowed to upload a maximum of %d files."
1477
  msgstr ""
1478
 
1479
+ #: includes/class-wp-job-manager.php:428
1480
  msgid "Are you sure you want to delete this listing?"
1481
  msgstr ""
1482
 
1483
+ #: includes/class-wp-job-manager.php:436
1484
  msgid "This field is required."
1485
  msgstr ""
1486
 
1543
  msgid "days"
1544
  msgstr ""
1545
 
1546
+ #: includes/forms/class-wp-job-manager-form-edit-job.php:108
1547
  msgid "Invalid listing"
1548
  msgstr ""
1549
 
1550
+ #: includes/forms/class-wp-job-manager-form-edit-job.php:140
1551
  msgid "Save changes"
1552
  msgstr ""
1553
 
1554
+ #: includes/forms/class-wp-job-manager-form-edit-job.php:145
1555
  msgid "Submit changes for approval"
1556
  msgstr ""
1557
 
1558
+ #: includes/forms/class-wp-job-manager-form-edit-job.php:199
1559
  msgid "Your changes have been saved."
1560
  msgstr ""
1561
 
1562
+ #: includes/forms/class-wp-job-manager-form-edit-job.php:205
1563
  msgid "View &rarr;"
1564
  msgstr ""
1565
 
1566
+ #: includes/forms/class-wp-job-manager-form-edit-job.php:207
1567
  msgid ""
1568
  "Your changes have been submitted and your listing will be visible again "
1569
  "once approved."
1574
  msgstr ""
1575
 
1576
  #: includes/forms/class-wp-job-manager-form-submit-job.php:88
1577
+ #: includes/forms/class-wp-job-manager-form-submit-job.php:578
1578
  #: templates/job-preview.php:30
1579
  msgid "Preview"
1580
  msgstr ""
1583
  msgid "Done"
1584
  msgstr ""
1585
 
1586
+ #: includes/forms/class-wp-job-manager-form-submit-job.php:206
1587
  msgid "Job Title"
1588
  msgstr ""
1589
 
1590
+ #: includes/forms/class-wp-job-manager-form-submit-job.php:214
1591
  msgid "Leave this blank if the location is not important"
1592
  msgstr ""
1593
 
1594
+ #: includes/forms/class-wp-job-manager-form-submit-job.php:224
1595
  msgid "Choose job type&hellip;"
1596
  msgstr ""
1597
 
1598
+ #: includes/forms/class-wp-job-manager-form-submit-job.php:239
1599
  msgid "Description"
1600
  msgstr ""
1601
 
1602
+ #: includes/forms/class-wp-job-manager-form-submit-job.php:258
1603
  msgid "Enter the name of the company"
1604
  msgstr ""
1605
 
1606
+ #: includes/forms/class-wp-job-manager-form-submit-job.php:262
1607
  #: templates/content-single-job_listing-company.php:30
1608
  msgid "Website"
1609
  msgstr ""
1610
 
1611
+ #: includes/forms/class-wp-job-manager-form-submit-job.php:266
1612
  msgid "http://"
1613
  msgstr ""
1614
 
1615
+ #: includes/forms/class-wp-job-manager-form-submit-job.php:270
1616
  msgid "Tagline"
1617
  msgstr ""
1618
 
1619
+ #: includes/forms/class-wp-job-manager-form-submit-job.php:273
1620
  msgid "Briefly describe your company"
1621
  msgstr ""
1622
 
1623
+ #: includes/forms/class-wp-job-manager-form-submit-job.php:278
1624
  msgid "Video"
1625
  msgstr ""
1626
 
1627
+ #: includes/forms/class-wp-job-manager-form-submit-job.php:282
1628
  msgid "A link to a video about your company"
1629
  msgstr ""
1630
 
1631
+ #: includes/forms/class-wp-job-manager-form-submit-job.php:286
1632
  msgid "Twitter username"
1633
  msgstr ""
1634
 
1635
+ #: includes/forms/class-wp-job-manager-form-submit-job.php:289
1636
  msgid "@yourcompany"
1637
  msgstr ""
1638
 
1639
+ #: includes/forms/class-wp-job-manager-form-submit-job.php:293
1640
  msgid "Logo"
1641
  msgstr ""
1642
 
1643
+ #: includes/forms/class-wp-job-manager-form-submit-job.php:343
1644
  #. translators: Placeholder %s is the label for the required field.
1645
  msgid "%s is a required field"
1646
  msgstr ""
1647
 
1648
+ #: includes/forms/class-wp-job-manager-form-submit-job.php:354
1649
  #. translators: Placeholder %s is the field label that is did not validate.
1650
  msgid "%s is invalid"
1651
  msgstr ""
1652
 
1653
+ #: includes/forms/class-wp-job-manager-form-submit-job.php:371
1654
  msgid "Invalid attachment provided."
1655
  msgstr ""
1656
 
1657
+ #: includes/forms/class-wp-job-manager-form-submit-job.php:389
1658
+ #: wp-job-manager-functions.php:1308
1659
  #. translators: Placeholder %1$s is field label; %2$s is the file mime type;
1660
  #. %3$s is the allowed mime-types.
1661
  #. translators: %1$s is the file field label; %2$s is the file type; %3$s is
1663
  msgid "\"%1$s\" (filetype %2$s) needs to be one of the following file types: %3$s"
1664
  msgstr ""
1665
 
1666
+ #: includes/forms/class-wp-job-manager-form-submit-job.php:424
1667
  msgid "Please enter a valid application email address"
1668
  msgstr ""
1669
 
1670
+ #: includes/forms/class-wp-job-manager-form-submit-job.php:433
1671
  msgid "Please enter a valid application URL"
1672
  msgstr ""
1673
 
1674
+ #: includes/forms/class-wp-job-manager-form-submit-job.php:443
1675
  msgid "Please enter a valid application email address or URL"
1676
  msgstr ""
1677
 
1678
+ #: includes/forms/class-wp-job-manager-form-submit-job.php:637
1679
  msgid "Please enter a username."
1680
  msgstr ""
1681
 
1682
+ #: includes/forms/class-wp-job-manager-form-submit-job.php:641
1683
  msgid "Please enter a password."
1684
  msgstr ""
1685
 
1686
+ #: includes/forms/class-wp-job-manager-form-submit-job.php:645
1687
  msgid "Please enter your email address."
1688
  msgstr ""
1689
 
1690
+ #: includes/forms/class-wp-job-manager-form-submit-job.php:651
1691
  msgid "Passwords must match."
1692
  msgstr ""
1693
 
1694
+ #: includes/forms/class-wp-job-manager-form-submit-job.php:657
1695
  #. translators: Placeholder %s is the password hint.
1696
  msgid "Invalid Password: %s"
1697
  msgstr ""
1698
 
1699
+ #: includes/forms/class-wp-job-manager-form-submit-job.php:659
1700
  msgid "Password is not valid."
1701
  msgstr ""
1702
 
1703
+ #: includes/forms/class-wp-job-manager-form-submit-job.php:682
1704
  msgid "You must be signed in to post a new listing."
1705
  msgstr ""
1706
 
1707
+ #: includes/forms/class-wp-job-manager-form-submit-job.php:705
1708
  #. translators: placeholder is the URL to the job dashboard page.
1709
  msgid ""
1710
  "Draft was saved. Job listing drafts can be resumed from the <a "
1711
  "href=\"%s\">job dashboard</a>."
1712
  msgstr ""
1713
 
1714
+ #: includes/helper/class-wp-job-manager-helper.php:279
1715
  msgid "Manage License (Requires Attention)"
1716
  msgstr ""
1717
 
1718
+ #: includes/helper/class-wp-job-manager-helper.php:282
1719
  msgid "Manage License"
1720
  msgstr ""
1721
 
1722
+ #: includes/helper/class-wp-job-manager-helper.php:285
1723
  #: includes/helper/views/html-licences.php:75
1724
  msgid "Activate License"
1725
  msgstr ""
1726
 
1727
+ #: includes/helper/class-wp-job-manager-helper.php:494
1728
  msgid ""
1729
  "Please enter a valid license key and email address in order to activate "
1730
  "this plugin's license."
1731
  msgstr ""
1732
 
1733
+ #: includes/helper/class-wp-job-manager-helper.php:526
1734
  msgid "Connection failed to the License Key API server - possible server issue."
1735
  msgstr ""
1736
 
1737
+ #: includes/helper/class-wp-job-manager-helper.php:535
1738
  msgid "Plugin license has been activated."
1739
  msgstr ""
1740
 
1741
+ #: includes/helper/class-wp-job-manager-helper.php:538
1742
  msgid "An unknown error occurred while attempting to activate the license"
1743
  msgstr ""
1744
 
1745
+ #: includes/helper/class-wp-job-manager-helper.php:558
1746
  msgid "license is not active."
1747
  msgstr ""
1748
 
1749
+ #: includes/helper/class-wp-job-manager-helper.php:574
1750
  msgid "Plugin license has been deactivated."
1751
  msgstr ""
1752
 
1922
  msgid "This listing has expired."
1923
  msgstr ""
1924
 
 
 
 
 
 
1925
  #: templates/emails/admin-expiring-job.php:32
1926
+ #. translators: %1$s placeholder is URL to the blog. %2$s placeholder is the
1927
+ #. name of the site.
1928
+ msgid "The following job listing is expiring today from <a href=\"%1$s\">%2$s</a>."
1929
  msgstr ""
1930
 
1931
  #: templates/emails/admin-expiring-job.php:35
1932
+ #. translators: %1$s placeholder is URL to the blog. %2$s placeholder is the
1933
+ #. name of the site.
1934
+ msgid "The following job listing is expiring soon from <a href=\"%1$s\">%2$s</a>."
1935
+ msgstr ""
1936
+
1937
+ #: templates/emails/admin-expiring-job.php:41
1938
+ #. translators: Placeholder is URL to site's WP admin.
1939
  msgid "Visit <a href=\"%s\">WordPress admin</a> to manage the listing."
1940
  msgstr ""
1941
 
1969
  "an administrator in the site's <a href=\"%s\">WordPress admin</a>."
1970
  msgstr ""
1971
 
1972
+ #: templates/emails/employer-expiring-job.php:32
1973
+ msgid "The following job listing is expiring today from <a href=\"%s\">%s</a>."
1974
+ msgstr ""
1975
+
1976
+ #: templates/emails/employer-expiring-job.php:40
1977
+ msgid "The following job listing is expiring soon from <a href=\"%s\">%s</a>."
1978
+ msgstr ""
1979
+
1980
  #: templates/emails/employer-expiring-job.php:48
1981
  msgid "Visit the <a href=\"%s\">job listing dashboard</a> to manage the listing."
1982
  msgstr ""
2022
  msgstr ""
2023
 
2024
  #: templates/form-fields/multiselect-field.php:20
2025
+ #: wp-job-manager-functions.php:1087
2026
  msgid "No results match"
2027
  msgstr ""
2028
 
2029
  #: templates/form-fields/multiselect-field.php:20
2030
+ #: wp-job-manager-functions.php:1088
2031
  msgid "Select Some Options"
2032
  msgstr ""
2033
 
2140
  msgid "%s submitted successfully. Your listing will be visible once approved."
2141
  msgstr ""
2142
 
2143
+ #: wp-job-manager-functions.php:460
2144
  msgid "Reset"
2145
  msgstr ""
2146
 
2147
+ #: wp-job-manager-functions.php:464
2148
  msgid "RSS"
2149
  msgstr ""
2150
 
2151
+ #: wp-job-manager-functions.php:572
2152
  msgid "Invalid email address."
2153
  msgstr ""
2154
 
2155
+ #: wp-job-manager-functions.php:580
2156
  msgid "Your email address isn&#8217;t correct."
2157
  msgstr ""
2158
 
2159
+ #: wp-job-manager-functions.php:584
2160
  msgid "This email is already registered, please choose another one."
2161
  msgstr ""
2162
 
2163
+ #: wp-job-manager-functions.php:893
2164
  msgid "Full Time"
2165
  msgstr ""
2166
 
2167
+ #: wp-job-manager-functions.php:894
2168
  msgid "Part Time"
2169
  msgstr ""
2170
 
2171
+ #: wp-job-manager-functions.php:895
2172
  msgid "Contractor"
2173
  msgstr ""
2174
 
2175
+ #: wp-job-manager-functions.php:896
2176
  msgid "Temporary"
2177
  msgstr ""
2178
 
2179
+ #: wp-job-manager-functions.php:897
2180
  msgid "Intern"
2181
  msgstr ""
2182
 
2183
+ #: wp-job-manager-functions.php:898
2184
  msgid "Volunteer"
2185
  msgstr ""
2186
 
2187
+ #: wp-job-manager-functions.php:899
2188
  msgid "Per Diem"
2189
  msgstr ""
2190
 
2191
+ #: wp-job-manager-functions.php:900
2192
  msgid "Other"
2193
  msgstr ""
2194
 
2195
+ #: wp-job-manager-functions.php:967
2196
  msgid "Passwords must be at least 8 characters long."
2197
  msgstr ""
2198
 
2199
+ #: wp-job-manager-functions.php:1086
2200
  msgid "Choose a category&hellip;"
2201
  msgstr ""
2202
 
2203
+ #: wp-job-manager-functions.php:1311
2204
  #. translators: %s is the list of allowed file types.
2205
  msgid "Uploaded files need to be one of the following file types: %s"
2206
  msgstr ""
2215
  msgid "Application via %1$s listing on %2$s"
2216
  msgstr ""
2217
 
2218
+ #: wp-job-manager-template.php:692
2219
+ msgid "Your email"
2220
  msgstr ""
2221
 
2222
+ #: wp-job-manager-template.php:693
2223
+ msgid "you@yourdomain.com"
2224
  msgstr ""
2225
 
2226
+ #: wp-job-manager-template.php:701
2227
+ msgid "Username"
2228
  msgstr ""
2229
 
2230
+ #: wp-job-manager-template.php:710
2231
+ msgid "Password"
2232
  msgstr ""
2233
 
2234
+ #: wp-job-manager-template.php:720
2235
+ msgid "Verify Password"
2236
  msgstr ""
2237
 
2238
+ #: wp-job-manager-template.php:747
2239
  msgid "Posted on "
2240
  msgstr ""
2241
 
2242
+ #: wp-job-manager-template.php:750 wp-job-manager-template.php:771
2243
  #. translators: Placeholder %s is the relative, human readable time since the
2244
  #. job listing was posted.
2245
  msgid "Posted %s ago"
2246
  msgstr ""
2247
 
2248
+ #: wp-job-manager-template.php:801
2249
  msgid "Anywhere"
2250
  msgstr ""
2251
 
2294
  msgstr ""
2295
 
2296
  #: includes/admin/class-wp-job-manager-admin.php:123
2297
+ #: includes/forms/class-wp-job-manager-form-submit-job.php:490
2298
  #. translators: jQuery date format, see
2299
  #. http:api.jqueryui.com/datepicker/#utility-formatDate
2300
  msgctxt "Date format for jQuery datepicker."
2302
  msgstr ""
2303
 
2304
  #: includes/admin/class-wp-job-manager-permalink-settings.php:108
2305
+ #: includes/class-wp-job-manager-post-types.php:946
2306
  msgctxt "Job permalink - resave permalinks after changing this"
2307
  msgid "job"
2308
  msgstr ""
2309
 
2310
  #: includes/admin/class-wp-job-manager-permalink-settings.php:117
2311
+ #: includes/class-wp-job-manager-post-types.php:947
2312
  msgctxt "Job category slug - resave permalinks after changing this"
2313
  msgid "job-category"
2314
  msgstr ""
2315
 
2316
  #: includes/admin/class-wp-job-manager-permalink-settings.php:126
2317
+ #: includes/class-wp-job-manager-post-types.php:948
2318
  msgctxt "Job type slug - resave permalinks after changing this"
2319
  msgid "job-type"
2320
  msgstr ""
2321
 
2322
+ #: includes/admin/views/html-admin-setup-step-2.php:47
2323
  msgctxt "Default page title (wizard)"
2324
  msgid "Post a Job"
2325
  msgstr ""
2326
 
2327
+ #: includes/admin/views/html-admin-setup-step-2.php:55
2328
  msgctxt "Default page title (wizard)"
2329
  msgid "Job Dashboard"
2330
  msgstr ""
2331
 
2332
+ #: includes/admin/views/html-admin-setup-step-2.php:63
2333
  msgctxt "Default page title (wizard)"
2334
  msgid "Jobs"
2335
  msgstr ""
2336
 
2337
+ #: includes/class-wp-job-manager-post-types.php:392
2338
+ #: wp-job-manager-functions.php:335
2339
  msgctxt "post status"
2340
  msgid "Expired"
2341
  msgstr ""
2342
 
2343
+ #: includes/class-wp-job-manager-post-types.php:405
2344
+ #: wp-job-manager-functions.php:336
2345
  msgctxt "post status"
2346
  msgid "Preview"
2347
  msgstr ""
2348
 
2349
+ #: wp-job-manager-functions.php:334
2350
  msgctxt "post status"
2351
  msgid "Draft"
2352
  msgstr ""
2353
 
2354
+ #: wp-job-manager-functions.php:337
2355
  msgctxt "post status"
2356
  msgid "Pending approval"
2357
  msgstr ""
2358
 
2359
+ #: wp-job-manager-functions.php:338
2360
  msgctxt "post status"
2361
  msgid "Pending payment"
2362
  msgstr ""
2363
 
2364
+ #: wp-job-manager-functions.php:339
2365
  msgctxt "post status"
2366
  msgid "Active"
2367
  msgstr ""
2368
 
2369
+ #: includes/class-wp-job-manager-post-types.php:930
2370
  msgctxt "Post type archive slug - resave permalinks after changing this"
2371
  msgid "jobs"
2372
+ msgstr ""
readme.txt CHANGED
@@ -4,7 +4,7 @@ Tags: job manager, job listing, job board, job management, job lists, job list,
4
  Requires at least: 4.9
5
  Tested up to: 5.2
6
  Requires PHP: 5.6
7
- Stable tag: 1.33.5
8
  License: GPLv3
9
  License URI: http://www.gnu.org/licenses/gpl-3.0.html
10
 
@@ -152,9 +152,45 @@ It then creates a database based on the parameters passed to it.
152
  6. Job listings in admin.
153
 
154
  == Changelog ==
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
155
  = 1.33.3 =
156
- * Fix: Upgrade jquery-fileupload to v9.32.0
157
- * Fix: Set frame origin on pages where shortcodes are embedded
158
 
159
  = 1.33.2 =
160
  * Fix: Issue with `[jobs]` filter form on some themes and plugins.
4
  Requires at least: 4.9
5
  Tested up to: 5.2
6
  Requires PHP: 5.6
7
+ Stable tag: 1.34.0
8
  License: GPLv3
9
  License URI: http://www.gnu.org/licenses/gpl-3.0.html
10
 
152
  6. Job listings in admin.
153
 
154
  == Changelog ==
155
+ = 1.34.0 =
156
+ * Templates Updated: `content-job_listing.php`, `job-submitted.php`.
157
+ * Enhancement: Add support for pre-selecting categories in `[jobs]` using category slugs in query string (e.g. `/jobs?search_category=developer,pm,senior`).
158
+ * Change: Job listing now supports `author` functionality, which will expose the author field in the REST API.
159
+ * Change: Menu position is fixed in WP admin. Plugins such as Resumes and Applications will need to be updated to show in WP admin below WPJM. (@technerdlove)
160
+ * Change: Filter form on `[jobs]` resets on page refresh and uses query string as expected.
161
+ * Change: No longer required to generate usernames from email for password field. (@manzoorwanijk)
162
+ * Change: Use minified version of remote jQuery UI CSS. (@ovidiul)
163
+ * Change: Google Maps link uses https.
164
+ * Fix: Clear the `filled` flag when relisting a job listing.
165
+ * Fix: Page titles are properly set during initial set up. (@JuanchoPestana)
166
+ * Fix: Correctly format list of file extensions when an unsupported file type is uploaded.
167
+ * Fix: Latitude and longitude are correctly used in `content-job_listing.php` template. (@MarieComet)
168
+ * Fix: Delete widget options on plugin uninstall. (@JuanchoPestana)
169
+ * Fix: Remove unused parameter in `job-submitted.php` template. (@JuanchoPestana)
170
+ * Third Party: Fix issue with saving attachments when using Download Attachments plugin.
171
+ * Third Party: Fix issue with Polylang where translations get overwritten on save of another language.
172
+ * Dev: Adds the ability to completely disable the state saving functionality of `[jobs]` results.
173
+ * Dev: Allows custom calls to `get_job_listings()` to just get `ids` and `id=>parent`. (@manzoorwanijk)
174
+ * Dev: Switched to short-array syntax across plugin.
175
+ * Dev: Updated `jquery-fileupload` library to 10.2.0.
176
+ * Dev: Updated `select2` library to 4.0.10.
177
+
178
+ = 1.33.5 =
179
+ * Fix: Issue where a JS error could occur when submitting a job.
180
+
181
+ = 1.33.4 =
182
+ * Note: WP Job Manager now requires a minimum PHP version of 5.6.20.
183
+ * Fix: Javascript error in job-submission.js on custom job description fields.
184
+ * Fix: Checking typeof undefined should be in quotes in job_submission.js.
185
+ * Fix: Plugin activation issue that didn't set up roles correctly.
186
+ * Fix: Escaped HTML issue in expiring jobs email notice.
187
+ * Change: Added additional unslashing and sanitization of input variables from forms.
188
+ * Change: Limited direct database access within the plugin and migrated to WordPress core functions when possible.
189
+ * Removed: Transient garbage collection. WordPress 4.9 and up handle this automatically.
190
+
191
  = 1.33.3 =
192
+ * Fix: Upgrade jquery-fileupload to v9.32.0.
193
+ * Fix: Set frame origin on pages where shortcodes are embedded.
194
 
195
  = 1.33.2 =
196
  * Fix: Issue with `[jobs]` filter form on some themes and plugins.
templates/account-signin.php CHANGED
@@ -62,7 +62,7 @@ if ( ! defined( 'ABSPATH' ) ) {
62
  <label
63
  for="<?php echo esc_attr( $key ); ?>"><?php echo esc_html( $field[ 'label' ] ) . wp_kses_post( apply_filters( 'submit_job_form_required_label', $field[ 'required' ] ? '' : ' <small>' . __( '(optional)', 'wp-job-manager' ) . '</small>', $field ) ); ?></label>
64
  <div class="field <?php echo $field[ 'required' ] ? 'required-field draft-required' : ''; ?>">
65
- <?php get_job_manager_template( 'form-fields/' . $field[ 'type' ] . '-field.php', array( 'key' => $key, 'field' => $field ) ); ?>
66
  </div>
67
  </fieldset>
68
  <?php
62
  <label
63
  for="<?php echo esc_attr( $key ); ?>"><?php echo esc_html( $field[ 'label' ] ) . wp_kses_post( apply_filters( 'submit_job_form_required_label', $field[ 'required' ] ? '' : ' <small>' . __( '(optional)', 'wp-job-manager' ) . '</small>', $field ) ); ?></label>
64
  <div class="field <?php echo $field[ 'required' ] ? 'required-field draft-required' : ''; ?>">
65
+ <?php get_job_manager_template( 'form-fields/' . $field[ 'type' ] . '-field.php', [ 'key' => $key, 'field' => $field ] ); ?>
66
  </div>
67
  </fieldset>
68
  <?php
templates/content-job_listing.php CHANGED
@@ -9,7 +9,7 @@
9
  * @package wp-job-manager
10
  * @category Template
11
  * @since 1.0.0
12
- * @version 1.27.0
13
  */
14
 
15
  if ( ! defined( 'ABSPATH' ) ) {
@@ -18,7 +18,7 @@ if ( ! defined( 'ABSPATH' ) ) {
18
 
19
  global $post;
20
  ?>
21
- <li <?php job_listing_class(); ?> data-longitude="<?php echo esc_attr( $post->geolocation_lat ); ?>" data-latitude="<?php echo esc_attr( $post->geolocation_long ); ?>">
22
  <a href="<?php the_job_permalink(); ?>">
23
  <?php the_company_logo(); ?>
24
  <div class="position">
9
  * @package wp-job-manager
10
  * @category Template
11
  * @since 1.0.0
12
+ * @version 1.34.0
13
  */
14
 
15
  if ( ! defined( 'ABSPATH' ) ) {
18
 
19
  global $post;
20
  ?>
21
+ <li <?php job_listing_class(); ?> data-longitude="<?php echo esc_attr( $post->geolocation_long ); ?>" data-latitude="<?php echo esc_attr( $post->geolocation_lat ); ?>">
22
  <a href="<?php the_job_permalink(); ?>">
23
  <?php the_company_logo(); ?>
24
  <div class="position">
templates/emails/admin-expiring-job.php CHANGED
@@ -8,7 +8,7 @@
8
  * @author Automattic
9
  * @package wp-job-manager
10
  * @category Template
11
- * @version 1.34.0
12
  */
13
 
14
  if ( ! defined( 'ABSPATH' ) ) {
8
  * @author Automattic
9
  * @package wp-job-manager
10
  * @category Template
11
+ * @version 1.33.4
12
  */
13
 
14
  if ( ! defined( 'ABSPATH' ) ) {
templates/emails/email-styles.php CHANGED
@@ -15,7 +15,7 @@ if ( ! defined( 'ABSPATH' ) ) {
15
  exit; // Exit if accessed directly.
16
  }
17
 
18
- $style_vars = array();
19
  $style_vars['color_bg'] = '#fff';
20
  $style_vars['color_fg'] = '#000';
21
  $style_vars['color_light'] = '#eee';
15
  exit; // Exit if accessed directly.
16
  }
17
 
18
+ $style_vars = [];
19
  $style_vars['color_bg'] = '#fff';
20
  $style_vars['color_fg'] = '#000';
21
  $style_vars['color_light'] = '#eee';
templates/form-fields/file-field.php CHANGED
@@ -15,7 +15,7 @@ if ( ! defined( 'ABSPATH' ) ) {
15
  exit; // Exit if accessed directly.
16
  }
17
 
18
- $classes = array( 'input-text' );
19
  $allowed_mime_types = array_keys( ! empty( $field['allowed_mime_types'] ) ? $field['allowed_mime_types'] : get_allowed_mime_types() );
20
  $field_name = isset( $field['name'] ) ? $field['name'] : $key;
21
  $field_name .= ! empty( $field['multiple'] ) ? '[]' : '';
@@ -34,10 +34,10 @@ if ( ! empty( $field['ajax'] ) && job_manager_user_can_upload_file_via_ajax() )
34
  <?php if ( ! empty( $field['value'] ) ) : ?>
35
  <?php if ( is_array( $field['value'] ) ) : ?>
36
  <?php foreach ( $field['value'] as $value ) : ?>
37
- <?php get_job_manager_template( 'form-fields/uploaded-file-html.php', array( 'key' => $key, 'name' => 'current_' . $field_name, 'value' => $value, 'field' => $field ) ); ?>
38
  <?php endforeach; ?>
39
  <?php elseif ( $value = $field['value'] ) : ?>
40
- <?php get_job_manager_template( 'form-fields/uploaded-file-html.php', array( 'key' => $key, 'name' => 'current_' . $field_name, 'value' => $value, 'field' => $field ) ); ?>
41
  <?php endif; ?>
42
  <?php endif; ?>
43
  </div>
15
  exit; // Exit if accessed directly.
16
  }
17
 
18
+ $classes = [ 'input-text' ];
19
  $allowed_mime_types = array_keys( ! empty( $field['allowed_mime_types'] ) ? $field['allowed_mime_types'] : get_allowed_mime_types() );
20
  $field_name = isset( $field['name'] ) ? $field['name'] : $key;
21
  $field_name .= ! empty( $field['multiple'] ) ? '[]' : '';
34
  <?php if ( ! empty( $field['value'] ) ) : ?>
35
  <?php if ( is_array( $field['value'] ) ) : ?>
36
  <?php foreach ( $field['value'] as $value ) : ?>
37
+ <?php get_job_manager_template( 'form-fields/uploaded-file-html.php', [ 'key' => $key, 'name' => 'current_' . $field_name, 'value' => $value, 'field' => $field ] ); ?>
38
  <?php endforeach; ?>
39
  <?php elseif ( $value = $field['value'] ) : ?>
40
+ <?php get_job_manager_template( 'form-fields/uploaded-file-html.php', [ 'key' => $key, 'name' => 'current_' . $field_name, 'value' => $value, 'field' => $field ] ); ?>
41
  <?php endif; ?>
42
  <?php endif; ?>
43
  </div>
templates/form-fields/term-checklist-field.php CHANGED
@@ -23,13 +23,13 @@ if ( ! defined( 'ABSPATH' ) ) {
23
  $field['default'] = '';
24
  }
25
 
26
- $args = array(
27
  'descendants_and_self' => 0,
28
- 'selected_cats' => isset( $field['value'] ) ? $field['value'] : ( is_array( $field['default'] ) ? $field['default'] : array( $field['default'] ) ),
29
  'popular_cats' => false,
30
  'taxonomy' => $field['taxonomy'],
31
  'checked_ontop' => false
32
- );
33
 
34
  // $field['post_id'] needs to be passed via the args so we can get the existing terms.
35
  ob_start();
23
  $field['default'] = '';
24
  }
25
 
26
+ $args = [
27
  'descendants_and_self' => 0,
28
+ 'selected_cats' => isset( $field['value'] ) ? $field['value'] : ( is_array( $field['default'] ) ? $field['default'] : [ $field['default'] ] ),
29
  'popular_cats' => false,
30
  'taxonomy' => $field['taxonomy'],
31
  'checked_ontop' => false
32
+ ];
33
 
34
  // $field['post_id'] needs to be passed via the args so we can get the existing terms.
35
  ob_start();
templates/form-fields/term-multiselect-field.php CHANGED
@@ -28,14 +28,14 @@ if ( isset( $field['value'] ) ) {
28
 
29
  wp_enqueue_script( 'wp-job-manager-term-multiselect' );
30
 
31
- $args = array(
32
  'taxonomy' => $field['taxonomy'],
33
  'hierarchical' => 1,
34
  'name' => isset( $field['name'] ) ? $field['name'] : $key,
35
  'orderby' => 'name',
36
  'selected' => $selected,
37
  'hide_empty' => false
38
- );
39
 
40
  if ( isset( $field['placeholder'] ) && ! empty( $field['placeholder'] ) ) $args['placeholder'] = $field['placeholder'];
41
 
28
 
29
  wp_enqueue_script( 'wp-job-manager-term-multiselect' );
30
 
31
+ $args = [
32
  'taxonomy' => $field['taxonomy'],
33
  'hierarchical' => 1,
34
  'name' => isset( $field['name'] ) ? $field['name'] : $key,
35
  'orderby' => 'name',
36
  'selected' => $selected,
37
  'hide_empty' => false
38
+ ];
39
 
40
  if ( isset( $field['placeholder'] ) && ! empty( $field['placeholder'] ) ) $args['placeholder'] = $field['placeholder'];
41
 
templates/form-fields/term-select-field.php CHANGED
@@ -31,7 +31,7 @@ if ( is_array( $selected ) ) {
31
  $selected = current( $selected );
32
  }
33
 
34
- wp_dropdown_categories( apply_filters( 'job_manager_term_select_field_wp_dropdown_categories_args', array(
35
  'taxonomy' => $field['taxonomy'],
36
  'hierarchical' => 1,
37
  'show_option_all' => false,
@@ -40,5 +40,5 @@ wp_dropdown_categories( apply_filters( 'job_manager_term_select_field_wp_dropdow
40
  'orderby' => 'name',
41
  'selected' => $selected,
42
  'hide_empty' => false
43
- ), $key, $field ) );
44
  if ( ! empty( $field['description'] ) ) : ?><small class="description"><?php echo wp_kses_post( $field['description'] ); ?></small><?php endif; ?>
31
  $selected = current( $selected );
32
  }
33
 
34
+ wp_dropdown_categories( apply_filters( 'job_manager_term_select_field_wp_dropdown_categories_args', [
35
  'taxonomy' => $field['taxonomy'],
36
  'hierarchical' => 1,
37
  'show_option_all' => false,
40
  'orderby' => 'name',
41
  'selected' => $selected,
42
  'hide_empty' => false
43
+ ], $key, $field ) );
44
  if ( ! empty( $field['description'] ) ) : ?><small class="description"><?php echo wp_kses_post( $field['description'] ); ?></small><?php endif; ?>
templates/form-fields/wp-editor-field.php CHANGED
@@ -15,12 +15,12 @@ if ( ! defined( 'ABSPATH' ) ) {
15
  exit; // Exit if accessed directly.
16
  }
17
 
18
- $editor = apply_filters( 'submit_job_form_wp_editor_args', array(
19
  'textarea_name' => isset( $field['name'] ) ? $field['name'] : $key,
20
  'media_buttons' => false,
21
  'textarea_rows' => 8,
22
  'quicktags' => false,
23
- 'tinymce' => array(
24
  'plugins' => 'lists,paste,tabfocus,wplink,wordpress',
25
  'paste_as_text' => true,
26
  'paste_auto_cleanup_on_paste' => true,
@@ -32,7 +32,7 @@ $editor = apply_filters( 'submit_job_form_wp_editor_args', array(
32
  'toolbar2' => '',
33
  'toolbar3' => '',
34
  'toolbar4' => ''
35
- ),
36
- ) );
37
  wp_editor( isset( $field['value'] ) ? wp_kses_post( $field['value'] ) : '', $key, $editor );
38
  if ( ! empty( $field['description'] ) ) : ?><small class="description"><?php echo wp_kses_post( $field['description'] ); ?></small><?php endif; ?>
15
  exit; // Exit if accessed directly.
16
  }
17
 
18
+ $editor = apply_filters( 'submit_job_form_wp_editor_args', [
19
  'textarea_name' => isset( $field['name'] ) ? $field['name'] : $key,
20
  'media_buttons' => false,
21
  'textarea_rows' => 8,
22
  'quicktags' => false,
23
+ 'tinymce' => [
24
  'plugins' => 'lists,paste,tabfocus,wplink,wordpress',
25
  'paste_as_text' => true,
26
  'paste_auto_cleanup_on_paste' => true,
32
  'toolbar2' => '',
33
  'toolbar3' => '',
34
  'toolbar4' => ''
35
+ ],
36
+ ] );
37
  wp_editor( isset( $field['value'] ) ? wp_kses_post( $field['value'] ) : '', $key, $editor );
38
  if ( ! empty( $field['description'] ) ) : ?><small class="description"><?php echo wp_kses_post( $field['description'] ); ?></small><?php endif; ?>
templates/job-dashboard.php CHANGED
@@ -44,43 +44,43 @@ if ( ! defined( 'ABSPATH' ) ) {
44
  <?php echo is_position_featured( $job ) ? '<span class="featured-job-icon" title="' . esc_attr__( 'Featured Job', 'wp-job-manager' ) . '"></span>' : ''; ?>
45
  <ul class="job-dashboard-actions">
46
  <?php
47
- $actions = array();
48
 
49
  switch ( $job->post_status ) {
50
  case 'publish' :
51
  if ( wpjm_user_can_edit_published_submissions() ) {
52
- $actions[ 'edit' ] = array( 'label' => __( 'Edit', 'wp-job-manager' ), 'nonce' => false );
53
  }
54
  if ( is_position_filled( $job ) ) {
55
- $actions['mark_not_filled'] = array( 'label' => __( 'Mark not filled', 'wp-job-manager' ), 'nonce' => true );
56
  } else {
57
- $actions['mark_filled'] = array( 'label' => __( 'Mark filled', 'wp-job-manager' ), 'nonce' => true );
58
  }
59
 
60
- $actions['duplicate'] = array( 'label' => __( 'Duplicate', 'wp-job-manager' ), 'nonce' => true );
61
  break;
62
  case 'expired' :
63
  if ( job_manager_get_permalink( 'submit_job_form' ) ) {
64
- $actions['relist'] = array( 'label' => __( 'Relist', 'wp-job-manager' ), 'nonce' => true );
65
  }
66
  break;
67
  case 'pending_payment' :
68
  case 'pending' :
69
  if ( job_manager_user_can_edit_pending_submissions() ) {
70
- $actions['edit'] = array( 'label' => __( 'Edit', 'wp-job-manager' ), 'nonce' => false );
71
  }
72
  break;
73
  case 'draft' :
74
  case 'preview' :
75
- $actions['continue'] = array( 'label' => __( 'Continue Submission', 'wp-job-manager' ), 'nonce' => true );
76
  break;
77
  }
78
 
79
- $actions['delete'] = array( 'label' => __( 'Delete', 'wp-job-manager' ), 'nonce' => true );
80
  $actions = apply_filters( 'job_manager_my_job_actions', $actions, $job );
81
 
82
  foreach ( $actions as $action => $value ) {
83
- $action_url = add_query_arg( array( 'action' => $action, 'job_id' => $job->ID ) );
84
  if ( $value['nonce'] ) {
85
  $action_url = wp_nonce_url( $action_url, 'job_manager_my_job_actions' );
86
  }
@@ -104,5 +104,5 @@ if ( ! defined( 'ABSPATH' ) ) {
104
  <?php endif; ?>
105
  </tbody>
106
  </table>
107
- <?php get_job_manager_template( 'pagination.php', array( 'max_num_pages' => $max_num_pages ) ); ?>
108
  </div>
44
  <?php echo is_position_featured( $job ) ? '<span class="featured-job-icon" title="' . esc_attr__( 'Featured Job', 'wp-job-manager' ) . '"></span>' : ''; ?>
45
  <ul class="job-dashboard-actions">
46
  <?php
47
+ $actions = [];
48
 
49
  switch ( $job->post_status ) {
50
  case 'publish' :
51
  if ( wpjm_user_can_edit_published_submissions() ) {
52
+ $actions[ 'edit' ] = [ 'label' => __( 'Edit', 'wp-job-manager' ), 'nonce' => false ];
53
  }
54
  if ( is_position_filled( $job ) ) {
55
+ $actions['mark_not_filled'] = [ 'label' => __( 'Mark not filled', 'wp-job-manager' ), 'nonce' => true ];
56
  } else {
57
+ $actions['mark_filled'] = [ 'label' => __( 'Mark filled', 'wp-job-manager' ), 'nonce' => true ];
58
  }
59
 
60
+ $actions['duplicate'] = [ 'label' => __( 'Duplicate', 'wp-job-manager' ), 'nonce' => true ];
61
  break;
62
  case 'expired' :
63
  if ( job_manager_get_permalink( 'submit_job_form' ) ) {
64
+ $actions['relist'] = [ 'label' => __( 'Relist', 'wp-job-manager' ), 'nonce' => true ];
65
  }
66
  break;
67
  case 'pending_payment' :
68
  case 'pending' :
69
  if ( job_manager_user_can_edit_pending_submissions() ) {
70
+ $actions['edit'] = [ 'label' => __( 'Edit', 'wp-job-manager' ), 'nonce' => false ];
71
  }
72
  break;
73
  case 'draft' :
74
  case 'preview' :
75
+ $actions['continue'] = [ 'label' => __( 'Continue Submission', 'wp-job-manager' ), 'nonce' => true ];
76
  break;
77
  }
78
 
79
+ $actions['delete'] = [ 'label' => __( 'Delete', 'wp-job-manager' ), 'nonce' => true ];
80
  $actions = apply_filters( 'job_manager_my_job_actions', $actions, $job );
81
 
82
  foreach ( $actions as $action => $value ) {
83
+ $action_url = add_query_arg( [ 'action' => $action, 'job_id' => $job->ID ] );
84
  if ( $value['nonce'] ) {
85
  $action_url = wp_nonce_url( $action_url, 'job_manager_my_job_actions' );
86
  }
104
  <?php endif; ?>
105
  </tbody>
106
  </table>
107
+ <?php get_job_manager_template( 'pagination.php', [ 'max_num_pages' => $max_num_pages ] ); ?>
108
  </div>
templates/job-filters.php CHANGED
@@ -42,13 +42,13 @@ do_action( 'job_manager_job_filters_before', $atts );
42
  <?php foreach ( $categories as $category ) : ?>
43
  <input type="hidden" name="search_categories[]" value="<?php echo esc_attr( sanitize_title( $category ) ); ?>" />
44
  <?php endforeach; ?>
45
- <?php elseif ( $show_categories && ! is_tax( 'job_listing_category' ) && get_terms( array( 'taxonomy' => 'job_listing_category' ) ) ) : ?>
46
  <div class="search_categories">
47
  <label for="search_categories"><?php esc_html_e( 'Category', 'wp-job-manager' ); ?></label>
48
  <?php if ( $show_category_multiselect ) : ?>
49
- <?php job_manager_dropdown_categories( array( 'taxonomy' => 'job_listing_category', 'hierarchical' => 1, 'name' => 'search_categories', 'orderby' => 'name', 'selected' => $selected_category, 'hide_empty' => true ) ); ?>
50
  <?php else : ?>
51
- <?php job_manager_dropdown_categories( array( 'taxonomy' => 'job_listing_category', 'hierarchical' => 1, 'show_option_all' => __( 'Any category', 'wp-job-manager' ), 'name' => 'search_categories', 'orderby' => 'name', 'selected' => $selected_category, 'multiple' => false, 'hide_empty' => true ) ); ?>
52
  <?php endif; ?>
53
  </div>
54
  <?php endif; ?>
42
  <?php foreach ( $categories as $category ) : ?>
43
  <input type="hidden" name="search_categories[]" value="<?php echo esc_attr( sanitize_title( $category ) ); ?>" />
44
  <?php endforeach; ?>
45
+ <?php elseif ( $show_categories && ! is_tax( 'job_listing_category' ) && get_terms( [ 'taxonomy' => 'job_listing_category' ] ) ) : ?>
46
  <div class="search_categories">
47
  <label for="search_categories"><?php esc_html_e( 'Category', 'wp-job-manager' ); ?></label>
48
  <?php if ( $show_category_multiselect ) : ?>
49
+ <?php job_manager_dropdown_categories( [ 'taxonomy' => 'job_listing_category', 'hierarchical' => 1, 'name' => 'search_categories', 'orderby' => 'name', 'selected' => $selected_category, 'hide_empty' => true ] ); ?>
50
  <?php else : ?>
51
+ <?php job_manager_dropdown_categories( [ 'taxonomy' => 'job_listing_category', 'hierarchical' => 1, 'show_option_all' => __( 'Any category', 'wp-job-manager' ), 'name' => 'search_categories', 'orderby' => 'name', 'selected' => $selected_category, 'multiple' => false, 'hide_empty' => true ] ); ?>
52
  <?php endif; ?>
53
  </div>
54
  <?php endif; ?>
templates/job-submit.php CHANGED
@@ -42,7 +42,7 @@ global $job_manager;
42
  <fieldset class="fieldset-<?php echo esc_attr( $key ); ?> fieldset-type-<?php echo esc_attr( $field['type'] ); ?>">
43
  <label for="<?php echo esc_attr( $key ); ?>"><?php echo wp_kses_post( $field['label'] ) . wp_kses_post( apply_filters( 'submit_job_form_required_label', $field['required'] ? '' : ' <small>' . __( '(optional)', 'wp-job-manager' ) . '</small>', $field ) ); ?></label>
44
  <div class="field <?php echo $field['required'] ? 'required-field' : ''; ?>">
45
- <?php get_job_manager_template( 'form-fields/' . $field['type'] . '-field.php', array( 'key' => $key, 'field' => $field ) ); ?>
46
  </div>
47
  </fieldset>
48
  <?php endforeach; ?>
@@ -59,7 +59,7 @@ global $job_manager;
59
  <fieldset class="fieldset-<?php echo esc_attr( $key ); ?> fieldset-type-<?php echo esc_attr( $field['type'] ); ?>">
60
  <label for="<?php echo esc_attr( $key ); ?>"><?php echo wp_kses_post( $field['label'] ) . wp_kses_post( apply_filters( 'submit_job_form_required_label', $field['required'] ? '' : ' <small>' . __( '(optional)', 'wp-job-manager' ) . '</small>', $field ) ); ?></label>
61
  <div class="field <?php echo $field['required'] ? 'required-field' : ''; ?>">
62
- <?php get_job_manager_template( 'form-fields/' . $field['type'] . '-field.php', array( 'key' => $key, 'field' => $field ) ); ?>
63
  </div>
64
  </fieldset>
65
  <?php endforeach; ?>
42
  <fieldset class="fieldset-<?php echo esc_attr( $key ); ?> fieldset-type-<?php echo esc_attr( $field['type'] ); ?>">
43
  <label for="<?php echo esc_attr( $key ); ?>"><?php echo wp_kses_post( $field['label'] ) . wp_kses_post( apply_filters( 'submit_job_form_required_label', $field['required'] ? '' : ' <small>' . __( '(optional)', 'wp-job-manager' ) . '</small>', $field ) ); ?></label>
44
  <div class="field <?php echo $field['required'] ? 'required-field' : ''; ?>">
45
+ <?php get_job_manager_template( 'form-fields/' . $field['type'] . '-field.php', [ 'key' => $key, 'field' => $field ] ); ?>
46
  </div>
47
  </fieldset>
48
  <?php endforeach; ?>
59
  <fieldset class="fieldset-<?php echo esc_attr( $key ); ?> fieldset-type-<?php echo esc_attr( $field['type'] ); ?>">
60
  <label for="<?php echo esc_attr( $key ); ?>"><?php echo wp_kses_post( $field['label'] ) . wp_kses_post( apply_filters( 'submit_job_form_required_label', $field['required'] ? '' : ' <small>' . __( '(optional)', 'wp-job-manager' ) . '</small>', $field ) ); ?></label>
61
  <div class="field <?php echo $field['required'] ? 'required-field' : ''; ?>">
62
+ <?php get_job_manager_template( 'form-fields/' . $field['type'] . '-field.php', [ 'key' => $key, 'field' => $field ] ); ?>
63
  </div>
64
  </fieldset>
65
  <?php endforeach; ?>
templates/job-submitted.php CHANGED
@@ -31,8 +31,7 @@ switch ( $job->post_status ) :
31
  echo wp_kses_post(
32
  sprintf(
33
  esc_html__( '%s submitted successfully. Your listing will be visible once approved.', 'wp-job-manager' ),
34
- esc_html( $wp_post_types['job_listing']->labels->singular_name ),
35
- get_permalink( $job->ID )
36
  )
37
  );
38
  break;
31
  echo wp_kses_post(
32
  sprintf(
33
  esc_html__( '%s submitted successfully. Your listing will be visible once approved.', 'wp-job-manager' ),
34
+ esc_html( $wp_post_types['job_listing']->labels->singular_name )
 
35
  )
36
  );
37
  break;
templates/pagination.php CHANGED
@@ -21,7 +21,7 @@ if ( $max_num_pages <= 1 ) {
21
  ?>
22
  <nav class="job-manager-pagination">
23
  <?php
24
- echo paginate_links( apply_filters( 'job_manager_pagination_args', array(
25
  'base' => esc_url_raw( str_replace( 999999999, '%#%', get_pagenum_link( 999999999, false ) ) ),
26
  'format' => '',
27
  'current' => max( 1, get_query_var('paged') ),
@@ -31,6 +31,6 @@ if ( $max_num_pages <= 1 ) {
31
  'type' => 'list',
32
  'end_size' => 3,
33
  'mid_size' => 3
34
- ) ) );
35
  ?>
36
  </nav>
21
  ?>
22
  <nav class="job-manager-pagination">
23
  <?php
24
+ echo paginate_links( apply_filters( 'job_manager_pagination_args', [
25
  'base' => esc_url_raw( str_replace( 999999999, '%#%', get_pagenum_link( 999999999, false ) ) ),
26
  'format' => '',
27
  'current' => max( 1, get_query_var('paged') ),
31
  'type' => 'list',
32
  'end_size' => 3,
33
  'mid_size' => 3
34
+ ] ) );
35
  ?>
36
  </nav>
wp-job-manager-functions.php CHANGED
@@ -15,17 +15,17 @@ if ( ! function_exists( 'get_job_listings' ) ) :
15
  * @param string|array|object $args Arguments used to retrieve job listings.
16
  * @return WP_Query
17
  */
18
- function get_job_listings( $args = array() ) {
19
  global $job_manager_keyword;
20
 
21
  $args = wp_parse_args(
22
  $args,
23
- array(
24
  'search_location' => '',
25
  'search_keywords' => '',
26
- 'search_categories' => array(),
27
- 'job_types' => array(),
28
- 'post_status' => array(),
29
  'offset' => 0,
30
  'posts_per_page' => 20,
31
  'orderby' => 'date',
@@ -33,7 +33,7 @@ if ( ! function_exists( 'get_job_listings' ) ) :
33
  'featured' => null,
34
  'filled' => null,
35
  'fields' => 'all',
36
- )
37
  );
38
 
39
  /**
@@ -48,12 +48,12 @@ if ( ! function_exists( 'get_job_listings' ) ) :
48
  if ( ! empty( $args['post_status'] ) ) {
49
  $post_status = $args['post_status'];
50
  } elseif ( 0 === intval( get_option( 'job_manager_hide_expired', get_option( 'job_manager_hide_expired_content', 1 ) ) ) ) {
51
- $post_status = array( 'publish', 'expired' );
52
  } else {
53
  $post_status = 'publish';
54
  }
55
 
56
- $query_args = array(
57
  'post_type' => 'job_listing',
58
  'post_status' => $post_status,
59
  'ignore_sticky_posts' => 1,
@@ -61,80 +61,80 @@ if ( ! function_exists( 'get_job_listings' ) ) :
61
  'posts_per_page' => intval( $args['posts_per_page'] ),
62
  'orderby' => $args['orderby'],
63
  'order' => $args['order'],
64
- 'tax_query' => array(),
65
- 'meta_query' => array(),
66
  'update_post_term_cache' => false,
67
  'update_post_meta_cache' => false,
68
  'cache_results' => false,
69
  'fields' => $args['fields'],
70
- );
71
 
72
  if ( $args['posts_per_page'] < 0 ) {
73
  $query_args['no_found_rows'] = true;
74
  }
75
 
76
  if ( ! empty( $args['search_location'] ) ) {
77
- $location_meta_keys = array( 'geolocation_formatted_address', '_job_location', 'geolocation_state_long' );
78
- $location_search = array( 'relation' => 'OR' );
79
  foreach ( $location_meta_keys as $meta_key ) {
80
- $location_search[] = array(
81
  'key' => $meta_key,
82
  'value' => $args['search_location'],
83
  'compare' => 'like',
84
- );
85
  }
86
  $query_args['meta_query'][] = $location_search;
87
  }
88
 
89
  if ( ! is_null( $args['featured'] ) ) {
90
- $query_args['meta_query'][] = array(
91
  'key' => '_featured',
92
  'value' => '1',
93
  'compare' => $args['featured'] ? '=' : '!=',
94
- );
95
  }
96
 
97
  if ( ! is_null( $args['filled'] ) || 1 === absint( get_option( 'job_manager_hide_filled_positions' ) ) ) {
98
- $query_args['meta_query'][] = array(
99
  'key' => '_filled',
100
  'value' => '1',
101
  'compare' => $args['filled'] ? '=' : '!=',
102
- );
103
  }
104
 
105
  if ( ! empty( $args['job_types'] ) ) {
106
- $query_args['tax_query'][] = array(
107
  'taxonomy' => 'job_listing_type',
108
  'field' => 'slug',
109
  'terms' => $args['job_types'],
110
- );
111
  }
112
 
113
  if ( ! empty( $args['search_categories'] ) ) {
114
  $field = is_numeric( $args['search_categories'][0] ) ? 'term_id' : 'slug';
115
  $operator = 'all' === get_option( 'job_manager_category_filter_type', 'all' ) && count( $args['search_categories'] ) > 1 ? 'AND' : 'IN';
116
- $query_args['tax_query'][] = array(
117
  'taxonomy' => 'job_listing_category',
118
  'field' => $field,
119
  'terms' => array_values( $args['search_categories'] ),
120
  'include_children' => 'AND' !== $operator,
121
  'operator' => $operator,
122
- );
123
  }
124
 
125
  if ( 'featured' === $args['orderby'] ) {
126
- $query_args['orderby'] = array(
127
  'menu_order' => 'ASC',
128
  'date' => 'DESC',
129
  'ID' => 'DESC',
130
- );
131
  }
132
 
133
  if ( 'rand_featured' === $args['orderby'] ) {
134
- $query_args['orderby'] = array(
135
  'menu_order' => 'ASC',
136
  'rand' => 'ASC',
137
- );
138
  }
139
 
140
  $job_manager_keyword = sanitize_text_field( $args['search_keywords'] );
@@ -179,7 +179,13 @@ if ( ! function_exists( 'get_job_listings' ) ) :
179
  && isset( $cached_query_posts->posts )
180
  && is_array( $cached_query_posts->posts )
181
  ) {
182
- $posts = array_map( 'get_post', $cached_query_posts->posts );
 
 
 
 
 
 
183
  $result = new WP_Query();
184
  $result->parse_query( $query_args );
185
  $result->posts = $posts;
@@ -193,7 +199,7 @@ if ( ! function_exists( 'get_job_listings' ) ) :
193
  $result = new WP_Query( $query_args );
194
  $cached_query_results = false;
195
 
196
- $cacheable_result = array();
197
  $cacheable_result['posts'] = array_values( $result->posts );
198
  $cacheable_result['found_posts'] = $result->found_posts;
199
  $cacheable_result['max_num_pages'] = $result->max_num_pages;
@@ -258,7 +264,7 @@ if ( ! function_exists( 'get_job_listings_keyword_search' ) ) :
258
  global $wpdb, $job_manager_keyword;
259
 
260
  // Searchable Meta Keys: set to empty to search all meta keys.
261
- $searchable_meta_keys = array(
262
  '_job_location',
263
  '_company_name',
264
  '_application',
@@ -266,12 +272,12 @@ if ( ! function_exists( 'get_job_listings_keyword_search' ) ) :
266
  '_company_tagline',
267
  '_company_website',
268
  '_company_twitter',
269
- );
270
 
271
  $searchable_meta_keys = apply_filters( 'job_listing_searchable_meta_keys', $searchable_meta_keys );
272
 
273
  // Set Search DB Conditions.
274
- $conditions = array();
275
 
276
  // Search Post Meta.
277
  if ( apply_filters( 'job_listing_search_post_meta', true ) ) {
@@ -324,14 +330,14 @@ if ( ! function_exists( 'get_job_listing_post_statuses' ) ) :
324
  function get_job_listing_post_statuses() {
325
  return apply_filters(
326
  'job_listing_post_statuses',
327
- array(
328
  'draft' => _x( 'Draft', 'post status', 'wp-job-manager' ),
329
  'expired' => _x( 'Expired', 'post status', 'wp-job-manager' ),
330
  'preview' => _x( 'Preview', 'post status', 'wp-job-manager' ),
331
  'pending' => _x( 'Pending approval', 'post status', 'wp-job-manager' ),
332
  'pending_payment' => _x( 'Pending payment', 'post status', 'wp-job-manager' ),
333
  'publish' => _x( 'Active', 'post status', 'wp-job-manager' ),
334
- )
335
  );
336
  }
337
  endif;
@@ -345,7 +351,7 @@ if ( ! function_exists( 'get_featured_job_ids' ) ) :
345
  */
346
  function get_featured_job_ids() {
347
  return get_posts(
348
- array(
349
  'posts_per_page' => -1,
350
  'suppress_filters' => false,
351
  'post_type' => 'job_listing',
@@ -353,7 +359,7 @@ if ( ! function_exists( 'get_featured_job_ids' ) ) :
353
  'meta_key' => '_featured',
354
  'meta_value' => '1',
355
  'fields' => 'ids',
356
- )
357
  );
358
  }
359
  endif;
@@ -368,14 +374,14 @@ if ( ! function_exists( 'get_job_listing_types' ) ) :
368
  */
369
  function get_job_listing_types( $fields = 'all' ) {
370
  if ( ! get_option( 'job_manager_enable_types' ) ) {
371
- return array();
372
  } else {
373
- $args = array(
374
  'fields' => $fields,
375
  'hide_empty' => false,
376
  'order' => 'ASC',
377
  'orderby' => 'name',
378
- );
379
 
380
  $args = apply_filters( 'get_job_listing_types_args', $args );
381
 
@@ -396,14 +402,14 @@ if ( ! function_exists( 'get_job_listing_categories' ) ) :
396
  */
397
  function get_job_listing_categories() {
398
  if ( ! get_option( 'job_manager_enable_categories' ) ) {
399
- return array();
400
  }
401
 
402
- $args = array(
403
  'orderby' => 'name',
404
  'order' => 'ASC',
405
  'hide_empty' => false,
406
- );
407
 
408
  /**
409
  * Change the category query arguments.
@@ -429,8 +435,8 @@ if ( ! function_exists( 'job_manager_get_filtered_links' ) ) :
429
  * @param array $args
430
  * @return string
431
  */
432
- function job_manager_get_filtered_links( $args = array() ) {
433
- $job_categories = array();
434
  $types = get_job_listing_types();
435
 
436
  // Convert to slugs.
@@ -449,26 +455,26 @@ if ( ! function_exists( 'job_manager_get_filtered_links' ) ) :
449
 
450
  $links = apply_filters(
451
  'job_manager_job_filters_showing_jobs_links',
452
- array(
453
- 'reset' => array(
454
  'name' => __( 'Reset', 'wp-job-manager' ),
455
  'url' => '#',
456
- ),
457
- 'rss_link' => array(
458
  'name' => __( 'RSS', 'wp-job-manager' ),
459
  'url' => get_job_listing_rss_link(
460
  apply_filters(
461
  'job_manager_get_listings_custom_filter_rss_args',
462
- array(
463
  'job_types' => isset( $args['filter_job_types'] ) ? implode( ',', $args['filter_job_types'] ) : '',
464
  'search_location' => $args['search_location'],
465
  'job_categories' => implode( ',', $job_categories ),
466
  'search_keywords' => $args['search_keywords'],
467
- )
468
  )
469
  ),
470
- ),
471
- ),
472
  $args
473
  );
474
 
@@ -500,8 +506,8 @@ if ( ! function_exists( 'get_job_listing_rss_link' ) ) :
500
  * @param array $args
501
  * @return string
502
  */
503
- function get_job_listing_rss_link( $args = array() ) {
504
- $rss_link = add_query_arg( urlencode_deep( array_merge( array( 'feed' => WP_Job_Manager_Post_Types::get_job_feed_name() ), $args ) ), home_url() );
505
  return $rss_link;
506
  }
507
  endif;
@@ -542,19 +548,19 @@ if ( ! function_exists( 'wp_job_manager_create_account' ) ) :
542
  function wp_job_manager_create_account( $args, $deprecated = '' ) {
543
  // Soft Deprecated in 1.20.0.
544
  if ( ! is_array( $args ) ) {
545
- $args = array(
546
  'username' => '',
547
  'password' => false,
548
  'email' => $args,
549
  'role' => $deprecated,
550
- );
551
  } else {
552
- $defaults = array(
553
  'username' => '',
554
  'email' => '',
555
  'password' => false,
556
  'role' => get_option( 'default_role' ),
557
- );
558
 
559
  $args = wp_parse_args( $args, $defaults );
560
  }
@@ -598,12 +604,12 @@ if ( ! function_exists( 'wp_job_manager_create_account' ) ) :
598
  }
599
 
600
  // Create account.
601
- $new_user = array(
602
  'user_login' => $username,
603
  'user_pass' => $args['password'],
604
  'user_email' => $email,
605
  'role' => $args['role'],
606
- );
607
 
608
  // User is forced to set up account with email sent to them. This password will remain a secret.
609
  if ( empty( $new_user['user_pass'] ) ) {
@@ -750,11 +756,11 @@ function is_wpjm_page() {
750
 
751
  if ( ! $is_wpjm_page ) {
752
  $wpjm_page_ids = array_filter(
753
- array(
754
  get_option( 'job_manager_submit_job_form_page_id', false ),
755
  get_option( 'job_manager_job_dashboard_page_id', false ),
756
  get_option( 'job_manager_jobs_page_id', false ),
757
- )
758
  );
759
 
760
  /**
@@ -797,7 +803,7 @@ function has_wpjm_shortcode( $content = null, $tag = null ) {
797
  }
798
 
799
  if ( ! empty( $content ) ) {
800
- $wpjm_shortcodes = array( 'submit_job_form', 'job_dashboard', 'jobs', 'job', 'job_summary', 'job_apply' );
801
  /**
802
  * Filters a list of all shortcodes associated with WPJM.
803
  *
@@ -809,7 +815,7 @@ function has_wpjm_shortcode( $content = null, $tag = null ) {
809
 
810
  if ( null !== $tag ) {
811
  if ( ! is_array( $tag ) ) {
812
- $tag = array( $tag );
813
  }
814
  $wpjm_shortcodes = array_intersect( $wpjm_shortcodes, $tag );
815
  }
@@ -840,7 +846,7 @@ function has_wpjm_shortcode( $content = null, $tag = null ) {
840
  * @return bool
841
  */
842
  function is_wpjm_job_listing() {
843
- return is_singular( array( 'job_listing' ) );
844
  }
845
 
846
  /**
@@ -862,12 +868,7 @@ function is_wpjm_taxonomy() {
862
  * @return bool True if they are to use standard email, false to allow user to set password at first job creation.
863
  */
864
  function wpjm_use_standard_password_setup_email() {
865
- $use_standard_password_setup_email = true;
866
-
867
- // If username is being automatically generated, force them to send password setup email.
868
- if ( ! job_manager_generate_username_from_email() ) {
869
- $use_standard_password_setup_email = 1 === intval( get_option( 'job_manager_use_standard_password_setup_email' ) );
870
- }
871
 
872
  /**
873
  * Allows an override of the setting for if a password should be auto-generated for new users.
@@ -888,7 +889,7 @@ function wpjm_use_standard_password_setup_email() {
888
  * @return array
889
  */
890
  function wpjm_job_listing_employment_type_options() {
891
- $employment_types = array();
892
  $employment_types['FULL_TIME'] = __( 'Full Time', 'wp-job-manager' );
893
  $employment_types['PART_TIME'] = __( 'Part Time', 'wp-job-manager' );
894
  $employment_types['CONTRACTOR'] = __( 'Contractor', 'wp-job-manager' );
@@ -1030,7 +1031,7 @@ function wpjm_user_can_edit_published_submissions() {
1030
  *
1031
  * @param bool $can_edit_published_submissions
1032
  */
1033
- return apply_filters( 'job_manager_user_can_edit_published_submissions', in_array( get_option( 'job_manager_user_edit_published_submissions' ), array( 'yes', 'yes_moderated' ), true ) );
1034
  }
1035
 
1036
  /**
@@ -1063,7 +1064,7 @@ function wpjm_published_submission_edits_require_moderation() {
1063
  * @return string
1064
  */
1065
  function job_manager_dropdown_categories( $args = '' ) {
1066
- $defaults = array(
1067
  'orderby' => 'id',
1068
  'order' => 'ASC',
1069
  'show_count' => 0,
@@ -1085,7 +1086,7 @@ function job_manager_dropdown_categories( $args = '' ) {
1085
  'placeholder' => __( 'Choose a category&hellip;', 'wp-job-manager' ),
1086
  'no_results_text' => __( 'No results match', 'wp-job-manager' ),
1087
  'multiple_text' => __( 'Select Some Options', 'wp-job-manager' ),
1088
- );
1089
 
1090
  $r = wp_parse_args( $args, $defaults );
1091
 
@@ -1102,7 +1103,7 @@ function job_manager_dropdown_categories( $args = '' ) {
1102
 
1103
  if ( empty( $categories ) ) {
1104
  $categories = get_terms(
1105
- array(
1106
  'taxonomy' => $r['taxonomy'],
1107
  'orderby' => $r['orderby'],
1108
  'order' => $r['order'],
@@ -1111,7 +1112,7 @@ function job_manager_dropdown_categories( $args = '' ) {
1111
  'child_of' => $r['child_of'],
1112
  'exclude' => $r['exclude'],
1113
  'hierarchical' => $r['hierarchical'],
1114
- )
1115
  );
1116
  set_transient( $categories_hash, $categories, DAY_IN_SECONDS * 7 );
1117
  }
@@ -1224,19 +1225,19 @@ add_filter( 'upload_dir', 'job_manager_upload_dir' );
1224
  * @return array
1225
  */
1226
  function job_manager_prepare_uploaded_files( $file_data ) {
1227
- $files_to_upload = array();
1228
 
1229
  if ( is_array( $file_data['name'] ) ) {
1230
  foreach ( $file_data['name'] as $file_data_key => $file_data_value ) {
1231
  if ( $file_data['name'][ $file_data_key ] ) {
1232
  $type = wp_check_filetype( $file_data['name'][ $file_data_key ] ); // Map mime type to one WordPress recognises.
1233
- $files_to_upload[] = array(
1234
  'name' => $file_data['name'][ $file_data_key ],
1235
  'type' => $type['type'],
1236
  'tmp_name' => $file_data['tmp_name'][ $file_data_key ],
1237
  'error' => $file_data['error'][ $file_data_key ],
1238
  'size' => $file_data['size'][ $file_data_key ],
1239
- );
1240
  }
1241
  }
1242
  } else {
@@ -1256,7 +1257,7 @@ function job_manager_prepare_uploaded_files( $file_data ) {
1256
  * @param string|array|object $args Optional arguments.
1257
  * @return stdClass|WP_Error Object containing file information, or error.
1258
  */
1259
- function job_manager_upload_file( $file, $args = array() ) {
1260
  global $job_manager_upload, $job_manager_uploading_file;
1261
 
1262
  include_once ABSPATH . 'wp-admin/includes/file.php';
@@ -1264,11 +1265,11 @@ function job_manager_upload_file( $file, $args = array() ) {
1264
 
1265
  $args = wp_parse_args(
1266
  $args,
1267
- array(
1268
  'file_key' => '',
1269
  'file_label' => '',
1270
  'allowed_mime_types' => '',
1271
- )
1272
  );
1273
 
1274
  $job_manager_upload = true;
@@ -1299,15 +1300,18 @@ function job_manager_upload_file( $file, $args = array() ) {
1299
  }
1300
 
1301
  if ( ! in_array( $file['type'], $allowed_mime_types, true ) ) {
 
 
 
1302
  if ( $args['file_label'] ) {
1303
  // translators: %1$s is the file field label; %2$s is the file type; %3$s is the list of allowed file types.
1304
- return new WP_Error( 'upload', sprintf( __( '"%1$s" (filetype %2$s) needs to be one of the following file types: %3$s', 'wp-job-manager' ), $args['file_label'], $file['type'], implode( ', ', array_keys( $allowed_mime_types ) ) ) );
1305
  } else {
1306
  // translators: %s is the list of allowed file types.
1307
- return new WP_Error( 'upload', sprintf( __( 'Uploaded files need to be one of the following file types: %s', 'wp-job-manager' ), implode( ', ', array_keys( $allowed_mime_types ) ) ) );
1308
  }
1309
  } else {
1310
- $upload = wp_handle_upload( $file, apply_filters( 'submit_job_wp_handle_upload_overrides', array( 'test_form' => false ) ) );
1311
  if ( ! empty( $upload['error'] ) ) {
1312
  return new WP_Error( 'upload', $upload['error'] );
1313
  } else {
@@ -1335,20 +1339,20 @@ function job_manager_upload_file( $file, $args = array() ) {
1335
  */
1336
  function job_manager_get_allowed_mime_types( $field = '' ) {
1337
  if ( 'company_logo' === $field ) {
1338
- $allowed_mime_types = array(
1339
  'jpg|jpeg|jpe' => 'image/jpeg',
1340
  'gif' => 'image/gif',
1341
  'png' => 'image/png',
1342
- );
1343
  } else {
1344
- $allowed_mime_types = array(
1345
  'jpg|jpeg|jpe' => 'image/jpeg',
1346
  'gif' => 'image/gif',
1347
  'png' => 'image/png',
1348
  'pdf' => 'application/pdf',
1349
  'doc' => 'application/msword',
1350
  'docx' => 'application/vnd.openxmlformats-officedocument.wordprocessingml.document',
1351
- );
1352
  }
1353
 
1354
  /**
@@ -1413,7 +1417,7 @@ function job_manager_duplicate_listing( $post_id ) {
1413
  * Duplicate the post.
1414
  */
1415
  $new_post_id = wp_insert_post(
1416
- array(
1417
  'comment_status' => $post->comment_status,
1418
  'ping_status' => $post->ping_status,
1419
  'post_author' => $post->post_author,
@@ -1427,7 +1431,7 @@ function job_manager_duplicate_listing( $post_id ) {
1427
  'post_type' => $post->post_type,
1428
  'to_ping' => $post->to_ping,
1429
  'menu_order' => $post->menu_order,
1430
- )
1431
  );
1432
 
1433
  /**
@@ -1436,7 +1440,7 @@ function job_manager_duplicate_listing( $post_id ) {
1436
  $taxonomies = get_object_taxonomies( $post->post_type );
1437
 
1438
  foreach ( $taxonomies as $taxonomy ) {
1439
- $post_terms = wp_get_object_terms( $post_id, $taxonomy, array( 'fields' => 'slugs' ) );
1440
  wp_set_object_terms( $new_post_id, $post_terms, $taxonomy, false );
1441
  }
1442
 
@@ -1450,7 +1454,7 @@ function job_manager_duplicate_listing( $post_id ) {
1450
  if ( ! empty( $post_meta ) ) {
1451
  $post_meta = wp_list_pluck( $post_meta, 'meta_value', 'meta_key' );
1452
 
1453
- $default_duplicate_ignore_keys = array( '_filled', '_featured', '_job_expires', '_job_duration', '_package_id', '_user_package_id' );
1454
  $duplicate_ignore_keys = apply_filters( 'job_manager_duplicate_listing_ignore_keys', $default_duplicate_ignore_keys, true );
1455
 
1456
  foreach ( $post_meta as $meta_key => $meta_value ) {
15
  * @param string|array|object $args Arguments used to retrieve job listings.
16
  * @return WP_Query
17
  */
18
+ function get_job_listings( $args = [] ) {
19
  global $job_manager_keyword;
20
 
21
  $args = wp_parse_args(
22
  $args,
23
+ [
24
  'search_location' => '',
25
  'search_keywords' => '',
26
+ 'search_categories' => [],
27
+ 'job_types' => [],
28
+ 'post_status' => [],
29
  'offset' => 0,
30
  'posts_per_page' => 20,
31
  'orderby' => 'date',
33
  'featured' => null,
34
  'filled' => null,
35
  'fields' => 'all',
36
+ ]
37
  );
38
 
39
  /**
48
  if ( ! empty( $args['post_status'] ) ) {
49
  $post_status = $args['post_status'];
50
  } elseif ( 0 === intval( get_option( 'job_manager_hide_expired', get_option( 'job_manager_hide_expired_content', 1 ) ) ) ) {
51
+ $post_status = [ 'publish', 'expired' ];
52
  } else {
53
  $post_status = 'publish';
54
  }
55
 
56
+ $query_args = [
57
  'post_type' => 'job_listing',
58
  'post_status' => $post_status,
59
  'ignore_sticky_posts' => 1,
61
  'posts_per_page' => intval( $args['posts_per_page'] ),
62
  'orderby' => $args['orderby'],
63
  'order' => $args['order'],
64
+ 'tax_query' => [],
65
+ 'meta_query' => [],
66
  'update_post_term_cache' => false,
67
  'update_post_meta_cache' => false,
68
  'cache_results' => false,
69
  'fields' => $args['fields'],
70
+ ];
71
 
72
  if ( $args['posts_per_page'] < 0 ) {
73
  $query_args['no_found_rows'] = true;
74
  }
75
 
76
  if ( ! empty( $args['search_location'] ) ) {
77
+ $location_meta_keys = [ 'geolocation_formatted_address', '_job_location', 'geolocation_state_long' ];
78
+ $location_search = [ 'relation' => 'OR' ];
79
  foreach ( $location_meta_keys as $meta_key ) {
80
+ $location_search[] = [
81
  'key' => $meta_key,
82
  'value' => $args['search_location'],
83
  'compare' => 'like',
84
+ ];
85
  }
86
  $query_args['meta_query'][] = $location_search;
87
  }
88
 
89
  if ( ! is_null( $args['featured'] ) ) {
90
+ $query_args['meta_query'][] = [
91
  'key' => '_featured',
92
  'value' => '1',
93
  'compare' => $args['featured'] ? '=' : '!=',
94
+ ];
95
  }
96
 
97
  if ( ! is_null( $args['filled'] ) || 1 === absint( get_option( 'job_manager_hide_filled_positions' ) ) ) {
98
+ $query_args['meta_query'][] = [
99
  'key' => '_filled',
100
  'value' => '1',
101
  'compare' => $args['filled'] ? '=' : '!=',
102
+ ];
103
  }
104
 
105
  if ( ! empty( $args['job_types'] ) ) {
106
+ $query_args['tax_query'][] = [
107
  'taxonomy' => 'job_listing_type',
108
  'field' => 'slug',
109
  'terms' => $args['job_types'],
110
+ ];
111
  }
112
 
113
  if ( ! empty( $args['search_categories'] ) ) {
114
  $field = is_numeric( $args['search_categories'][0] ) ? 'term_id' : 'slug';
115
  $operator = 'all' === get_option( 'job_manager_category_filter_type', 'all' ) && count( $args['search_categories'] ) > 1 ? 'AND' : 'IN';
116
+ $query_args['tax_query'][] = [
117
  'taxonomy' => 'job_listing_category',
118
  'field' => $field,
119
  'terms' => array_values( $args['search_categories'] ),
120
  'include_children' => 'AND' !== $operator,
121
  'operator' => $operator,
122
+ ];
123
  }
124
 
125
  if ( 'featured' === $args['orderby'] ) {
126
+ $query_args['orderby'] = [
127
  'menu_order' => 'ASC',
128
  'date' => 'DESC',
129
  'ID' => 'DESC',
130
+ ];
131
  }
132
 
133
  if ( 'rand_featured' === $args['orderby'] ) {
134
+ $query_args['orderby'] = [
135
  'menu_order' => 'ASC',
136
  'rand' => 'ASC',
137
+ ];
138
  }
139
 
140
  $job_manager_keyword = sanitize_text_field( $args['search_keywords'] );
179
  && isset( $cached_query_posts->posts )
180
  && is_array( $cached_query_posts->posts )
181
  ) {
182
+ if ( in_array( $query_args['fields'], [ 'ids', 'id=>parent' ], true ) ) {
183
+ // For these special requests, just return the array of results as set.
184
+ $posts = $cached_query_posts->posts;
185
+ } else {
186
+ $posts = array_map( 'get_post', $cached_query_posts->posts );
187
+ }
188
+
189
  $result = new WP_Query();
190
  $result->parse_query( $query_args );
191
  $result->posts = $posts;
199
  $result = new WP_Query( $query_args );
200
  $cached_query_results = false;
201
 
202
+ $cacheable_result = [];
203
  $cacheable_result['posts'] = array_values( $result->posts );
204
  $cacheable_result['found_posts'] = $result->found_posts;
205
  $cacheable_result['max_num_pages'] = $result->max_num_pages;
264
  global $wpdb, $job_manager_keyword;
265
 
266
  // Searchable Meta Keys: set to empty to search all meta keys.
267
+ $searchable_meta_keys = [
268
  '_job_location',
269
  '_company_name',
270
  '_application',
272
  '_company_tagline',
273
  '_company_website',
274
  '_company_twitter',
275
+ ];
276
 
277
  $searchable_meta_keys = apply_filters( 'job_listing_searchable_meta_keys', $searchable_meta_keys );
278
 
279
  // Set Search DB Conditions.
280
+ $conditions = [];
281
 
282
  // Search Post Meta.
283
  if ( apply_filters( 'job_listing_search_post_meta', true ) ) {
330
  function get_job_listing_post_statuses() {
331
  return apply_filters(
332
  'job_listing_post_statuses',
333
+ [
334
  'draft' => _x( 'Draft', 'post status', 'wp-job-manager' ),
335
  'expired' => _x( 'Expired', 'post status', 'wp-job-manager' ),
336
  'preview' => _x( 'Preview', 'post status', 'wp-job-manager' ),
337
  'pending' => _x( 'Pending approval', 'post status', 'wp-job-manager' ),
338
  'pending_payment' => _x( 'Pending payment', 'post status', 'wp-job-manager' ),
339
  'publish' => _x( 'Active', 'post status', 'wp-job-manager' ),
340
+ ]
341
  );
342
  }
343
  endif;
351
  */
352
  function get_featured_job_ids() {
353
  return get_posts(
354
+ [
355
  'posts_per_page' => -1,
356
  'suppress_filters' => false,
357
  'post_type' => 'job_listing',
359
  'meta_key' => '_featured',
360
  'meta_value' => '1',
361
  'fields' => 'ids',
362
+ ]
363
  );
364
  }
365
  endif;
374
  */
375
  function get_job_listing_types( $fields = 'all' ) {
376
  if ( ! get_option( 'job_manager_enable_types' ) ) {
377
+ return [];
378
  } else {
379
+ $args = [
380
  'fields' => $fields,
381
  'hide_empty' => false,
382
  'order' => 'ASC',
383
  'orderby' => 'name',
384
+ ];
385
 
386
  $args = apply_filters( 'get_job_listing_types_args', $args );
387
 
402
  */
403
  function get_job_listing_categories() {
404
  if ( ! get_option( 'job_manager_enable_categories' ) ) {
405
+ return [];
406
  }
407
 
408
+ $args = [
409
  'orderby' => 'name',
410
  'order' => 'ASC',
411
  'hide_empty' => false,
412
+ ];
413
 
414
  /**
415
  * Change the category query arguments.
435
  * @param array $args
436
  * @return string
437
  */
438
+ function job_manager_get_filtered_links( $args = [] ) {
439
+ $job_categories = [];
440
  $types = get_job_listing_types();
441
 
442
  // Convert to slugs.
455
 
456
  $links = apply_filters(
457
  'job_manager_job_filters_showing_jobs_links',
458
+ [
459
+ 'reset' => [
460
  'name' => __( 'Reset', 'wp-job-manager' ),
461
  'url' => '#',
462
+ ],
463
+ 'rss_link' => [
464
  'name' => __( 'RSS', 'wp-job-manager' ),
465
  'url' => get_job_listing_rss_link(
466
  apply_filters(
467
  'job_manager_get_listings_custom_filter_rss_args',
468
+ [
469
  'job_types' => isset( $args['filter_job_types'] ) ? implode( ',', $args['filter_job_types'] ) : '',
470
  'search_location' => $args['search_location'],
471
  'job_categories' => implode( ',', $job_categories ),
472
  'search_keywords' => $args['search_keywords'],
473
+ ]
474
  )
475
  ),
476
+ ],
477
+ ],
478
  $args
479
  );
480
 
506
  * @param array $args
507
  * @return string
508
  */
509
+ function get_job_listing_rss_link( $args = [] ) {
510
+ $rss_link = add_query_arg( urlencode_deep( array_merge( [ 'feed' => WP_Job_Manager_Post_Types::get_job_feed_name() ], $args ) ), home_url() );
511
  return $rss_link;
512
  }
513
  endif;
548
  function wp_job_manager_create_account( $args, $deprecated = '' ) {
549
  // Soft Deprecated in 1.20.0.
550
  if ( ! is_array( $args ) ) {
551
+ $args = [
552
  'username' => '',
553
  'password' => false,
554
  'email' => $args,
555
  'role' => $deprecated,
556
+ ];
557
  } else {
558
+ $defaults = [
559
  'username' => '',
560
  'email' => '',
561
  'password' => false,
562
  'role' => get_option( 'default_role' ),
563
+ ];
564
 
565
  $args = wp_parse_args( $args, $defaults );
566
  }
604
  }
605
 
606
  // Create account.
607
+ $new_user = [
608
  'user_login' => $username,
609
  'user_pass' => $args['password'],
610
  'user_email' => $email,
611
  'role' => $args['role'],
612
+ ];
613
 
614
  // User is forced to set up account with email sent to them. This password will remain a secret.
615
  if ( empty( $new_user['user_pass'] ) ) {
756
 
757
  if ( ! $is_wpjm_page ) {
758
  $wpjm_page_ids = array_filter(
759
+ [
760
  get_option( 'job_manager_submit_job_form_page_id', false ),
761
  get_option( 'job_manager_job_dashboard_page_id', false ),
762
  get_option( 'job_manager_jobs_page_id', false ),
763
+ ]
764
  );
765
 
766
  /**
803
  }
804
 
805
  if ( ! empty( $content ) ) {
806
+ $wpjm_shortcodes = [ 'submit_job_form', 'job_dashboard', 'jobs', 'job', 'job_summary', 'job_apply' ];
807
  /**
808
  * Filters a list of all shortcodes associated with WPJM.
809
  *
815
 
816
  if ( null !== $tag ) {
817
  if ( ! is_array( $tag ) ) {
818
+ $tag = [ $tag ];
819
  }
820
  $wpjm_shortcodes = array_intersect( $wpjm_shortcodes, $tag );
821
  }
846
  * @return bool
847
  */
848
  function is_wpjm_job_listing() {
849
+ return is_singular( [ 'job_listing' ] );
850
  }
851
 
852
  /**
868
  * @return bool True if they are to use standard email, false to allow user to set password at first job creation.
869
  */
870
  function wpjm_use_standard_password_setup_email() {
871
+ $use_standard_password_setup_email = 1 === intval( get_option( 'job_manager_use_standard_password_setup_email' ) );
 
 
 
 
 
872
 
873
  /**
874
  * Allows an override of the setting for if a password should be auto-generated for new users.
889
  * @return array
890
  */
891
  function wpjm_job_listing_employment_type_options() {
892
+ $employment_types = [];
893
  $employment_types['FULL_TIME'] = __( 'Full Time', 'wp-job-manager' );
894
  $employment_types['PART_TIME'] = __( 'Part Time', 'wp-job-manager' );
895
  $employment_types['CONTRACTOR'] = __( 'Contractor', 'wp-job-manager' );
1031
  *
1032
  * @param bool $can_edit_published_submissions
1033
  */
1034
+ return apply_filters( 'job_manager_user_can_edit_published_submissions', in_array( get_option( 'job_manager_user_edit_published_submissions' ), [ 'yes', 'yes_moderated' ], true ) );
1035
  }
1036
 
1037
  /**
1064
  * @return string
1065
  */
1066
  function job_manager_dropdown_categories( $args = '' ) {
1067
+ $defaults = [
1068
  'orderby' => 'id',
1069
  'order' => 'ASC',
1070
  'show_count' => 0,
1086
  'placeholder' => __( 'Choose a category&hellip;', 'wp-job-manager' ),
1087
  'no_results_text' => __( 'No results match', 'wp-job-manager' ),
1088
  'multiple_text' => __( 'Select Some Options', 'wp-job-manager' ),
1089
+ ];
1090
 
1091
  $r = wp_parse_args( $args, $defaults );
1092
 
1103
 
1104
  if ( empty( $categories ) ) {
1105
  $categories = get_terms(
1106
+ [
1107
  'taxonomy' => $r['taxonomy'],
1108
  'orderby' => $r['orderby'],
1109
  'order' => $r['order'],
1112
  'child_of' => $r['child_of'],
1113
  'exclude' => $r['exclude'],
1114
  'hierarchical' => $r['hierarchical'],
1115
+ ]
1116
  );
1117
  set_transient( $categories_hash, $categories, DAY_IN_SECONDS * 7 );
1118
  }
1225
  * @return array
1226
  */
1227
  function job_manager_prepare_uploaded_files( $file_data ) {
1228
+ $files_to_upload = [];
1229
 
1230
  if ( is_array( $file_data['name'] ) ) {
1231
  foreach ( $file_data['name'] as $file_data_key => $file_data_value ) {
1232
  if ( $file_data['name'][ $file_data_key ] ) {
1233
  $type = wp_check_filetype( $file_data['name'][ $file_data_key ] ); // Map mime type to one WordPress recognises.
1234
+ $files_to_upload[] = [
1235
  'name' => $file_data['name'][ $file_data_key ],
1236
  'type' => $type['type'],
1237
  'tmp_name' => $file_data['tmp_name'][ $file_data_key ],
1238
  'error' => $file_data['error'][ $file_data_key ],
1239
  'size' => $file_data['size'][ $file_data_key ],
1240
+ ];
1241
  }
1242
  }
1243
  } else {
1257
  * @param string|array|object $args Optional arguments.
1258
  * @return stdClass|WP_Error Object containing file information, or error.
1259
  */
1260
+ function job_manager_upload_file( $file, $args = [] ) {
1261
  global $job_manager_upload, $job_manager_uploading_file;
1262
 
1263
  include_once ABSPATH . 'wp-admin/includes/file.php';
1265
 
1266
  $args = wp_parse_args(
1267
  $args,
1268
+ [
1269
  'file_key' => '',
1270
  'file_label' => '',
1271
  'allowed_mime_types' => '',
1272
+ ]
1273
  );
1274
 
1275
  $job_manager_upload = true;
1300
  }
1301
 
1302
  if ( ! in_array( $file['type'], $allowed_mime_types, true ) ) {
1303
+ // Replace pipe separating similar extensions (e.g. jpeg|jpg) to comma to match the list separator.
1304
+ $allowed_file_extensions = implode( ', ', str_replace( '|', ', ', array_keys( $allowed_mime_types ) ) );
1305
+
1306
  if ( $args['file_label'] ) {
1307
  // translators: %1$s is the file field label; %2$s is the file type; %3$s is the list of allowed file types.
1308
+ return new WP_Error( 'upload', sprintf( __( '"%1$s" (filetype %2$s) needs to be one of the following file types: %3$s', 'wp-job-manager' ), $args['file_label'], $file['type'], $allowed_file_extensions ) );
1309
  } else {
1310
  // translators: %s is the list of allowed file types.
1311
+ return new WP_Error( 'upload', sprintf( __( 'Uploaded files need to be one of the following file types: %s', 'wp-job-manager' ), $allowed_file_extensions ) );
1312
  }
1313
  } else {
1314
+ $upload = wp_handle_upload( $file, apply_filters( 'submit_job_wp_handle_upload_overrides', [ 'test_form' => false ] ) );
1315
  if ( ! empty( $upload['error'] ) ) {
1316
  return new WP_Error( 'upload', $upload['error'] );
1317
  } else {
1339
  */
1340
  function job_manager_get_allowed_mime_types( $field = '' ) {
1341
  if ( 'company_logo' === $field ) {
1342
+ $allowed_mime_types = [
1343
  'jpg|jpeg|jpe' => 'image/jpeg',
1344
  'gif' => 'image/gif',
1345
  'png' => 'image/png',
1346
+ ];
1347
  } else {
1348
+ $allowed_mime_types = [
1349
  'jpg|jpeg|jpe' => 'image/jpeg',
1350
  'gif' => 'image/gif',
1351
  'png' => 'image/png',
1352
  'pdf' => 'application/pdf',
1353
  'doc' => 'application/msword',
1354
  'docx' => 'application/vnd.openxmlformats-officedocument.wordprocessingml.document',
1355
+ ];
1356
  }
1357
 
1358
  /**
1417
  * Duplicate the post.
1418
  */
1419
  $new_post_id = wp_insert_post(
1420
+ [
1421
  'comment_status' => $post->comment_status,
1422
  'ping_status' => $post->ping_status,
1423
  'post_author' => $post->post_author,
1431
  'post_type' => $post->post_type,
1432
  'to_ping' => $post->to_ping,
1433
  'menu_order' => $post->menu_order,
1434
+ ]
1435
  );
1436
 
1437
  /**
1440
  $taxonomies = get_object_taxonomies( $post->post_type );
1441
 
1442
  foreach ( $taxonomies as $taxonomy ) {
1443
+ $post_terms = wp_get_object_terms( $post_id, $taxonomy, [ 'fields' => 'slugs' ] );
1444
  wp_set_object_terms( $new_post_id, $post_terms, $taxonomy, false );
1445
  }
1446
 
1454
  if ( ! empty( $post_meta ) ) {
1455
  $post_meta = wp_list_pluck( $post_meta, 'meta_value', 'meta_key' );
1456
 
1457
+ $default_duplicate_ignore_keys = [ '_filled', '_featured', '_job_expires', '_job_duration', '_package_id', '_user_package_id' ];
1458
  $duplicate_ignore_keys = apply_filters( 'job_manager_duplicate_listing_ignore_keys', $default_duplicate_ignore_keys, true );
1459
 
1460
  foreach ( $post_meta as $meta_key => $meta_value ) {
wp-job-manager-template.php CHANGED
@@ -19,7 +19,7 @@
19
  * @param string $template_path (default: '').
20
  * @param string $default_path (default: '').
21
  */
22
- function get_job_manager_template( $template_name, $args = array(), $template_path = 'job_manager', $default_path = '' ) {
23
  if ( $args && is_array( $args ) ) {
24
  // phpcs:ignore WordPress.PHP.DontExtract.extract_extract -- Please, forgive us.
25
  extract( $args );
@@ -45,10 +45,10 @@ function get_job_manager_template( $template_name, $args = array(), $template_pa
45
  function locate_job_manager_template( $template_name, $template_path = 'job_manager', $default_path = '' ) {
46
  // Look within passed path within the theme - this is priority.
47
  $template = locate_template(
48
- array(
49
  trailingslashit( $template_path ) . $template_name,
50
  $template_name,
51
- )
52
  );
53
 
54
  // Get default template.
@@ -117,10 +117,10 @@ function get_job_listing_pagination( $max_num_pages, $current_page = 1 ) {
117
  ob_start();
118
  get_job_manager_template(
119
  'job-pagination.php',
120
- array(
121
  'max_num_pages' => $max_num_pages,
122
  'current_page' => absint( $current_page ),
123
- )
124
  );
125
  return ob_get_clean();
126
  }
@@ -191,7 +191,7 @@ function is_position_featured( $post = null ) {
191
  */
192
  function candidates_can_apply( $post = null ) {
193
  $post = get_post( $post );
194
- return apply_filters( 'job_manager_candidates_can_apply', ( ! is_position_filled() && ! in_array( $post->post_status, array( 'preview', 'expired' ), true ) ), $post );
195
  }
196
 
197
  /**
@@ -270,7 +270,7 @@ function wpjm_get_job_employment_types( $post = null ) {
270
  if ( ! wpjm_job_listing_employment_type_enabled() ) {
271
  return false;
272
  }
273
- $employment_types = array();
274
  $job_types = wpjm_get_the_job_types( $post );
275
 
276
  if ( ! empty( $job_types ) ) {
@@ -367,7 +367,7 @@ function wpjm_get_job_listing_structured_data( $post = null ) {
367
  return false;
368
  }
369
 
370
- $data = array();
371
  $data['@context'] = 'http://schema.org/';
372
  $data['@type'] = 'JobPosting';
373
  $data['datePosted'] = get_post_time( 'c', false, $post );
@@ -385,7 +385,7 @@ function wpjm_get_job_listing_structured_data( $post = null ) {
385
  $data['employmentType'] = $employment_types;
386
  }
387
 
388
- $data['hiringOrganization'] = array();
389
  $data['hiringOrganization']['@type'] = 'Organization';
390
  $data['hiringOrganization']['name'] = get_the_company_name( $post );
391
 
@@ -400,14 +400,14 @@ function wpjm_get_job_listing_structured_data( $post = null ) {
400
  $data['hiringOrganization']['logo'] = $company_logo;
401
  }
402
 
403
- $data['identifier'] = array();
404
  $data['identifier']['@type'] = 'PropertyValue';
405
  $data['identifier']['name'] = get_the_company_name( $post );
406
  $data['identifier']['value'] = get_the_guid( $post );
407
 
408
  $location = get_the_job_location( $post );
409
  if ( ! empty( $location ) ) {
410
- $data['jobLocation'] = array();
411
  $data['jobLocation']['@type'] = 'Place';
412
  $data['jobLocation']['address'] = wpjm_get_job_listing_location_structured_data( $post );
413
  if ( empty( $data['jobLocation']['address'] ) ) {
@@ -441,18 +441,18 @@ function wpjm_get_job_listing_location_structured_data( $post ) {
441
  return false;
442
  }
443
 
444
- $mapping = array();
445
- $mapping['streetAddress'] = array( 'street_number', 'street' );
446
  $mapping['addressLocality'] = 'city';
447
  $mapping['addressRegion'] = 'state_short';
448
  $mapping['postalCode'] = 'postcode';
449
  $mapping['addressCountry'] = 'country_short';
450
 
451
- $address = array();
452
  $address['@type'] = 'PostalAddress';
453
  foreach ( $mapping as $schema_key => $geolocation_key ) {
454
  if ( is_array( $geolocation_key ) ) {
455
- $values = array();
456
  foreach ( $geolocation_key as $sub_geo_key ) {
457
  $geo_value = get_post_meta( $post->ID, 'geolocation_' . $sub_geo_key, true );
458
  if ( ! empty( $geo_value ) ) {
@@ -600,12 +600,12 @@ function wpjm_get_the_job_types( $post = null ) {
600
  $types = get_the_terms( $post->ID, 'job_listing_type' );
601
 
602
  if ( empty( $types ) || is_wp_error( $types ) ) {
603
- $types = array();
604
  }
605
 
606
  // Return single if not enabled.
607
  if ( ! empty( $types ) && ! job_manager_multi_job_type() ) {
608
- $types = array( current( $types ) );
609
  }
610
 
611
  /**
@@ -659,7 +659,7 @@ function wpjm_get_the_job_categories( $post = null ) {
659
  $categories = get_the_terms( $post->ID, 'job_listing_category' );
660
 
661
  if ( empty( $categories ) || is_wp_error( $categories ) ) {
662
- $categories = array();
663
  }
664
 
665
  /**
@@ -685,43 +685,43 @@ function wpjm_get_registration_fields() {
685
  $use_standard_password_setup_email = wpjm_use_standard_password_setup_email();
686
  $account_required = job_manager_user_requires_account();
687
 
688
- $registration_fields = array();
689
  if ( job_manager_enable_registration() ) {
 
 
 
 
 
 
 
 
690
  if ( ! $generate_username_from_email ) {
691
- $registration_fields['create_account_username'] = array(
692
  'type' => 'text',
693
  'label' => esc_html__( 'Username', 'wp-job-manager' ),
694
  'required' => $account_required,
695
  // phpcs:ignore WordPress.Security.NonceVerification.Missing -- Just used to populate value when validation failed.
696
  'value' => isset( $_POST['create_account_username'] ) ? sanitize_text_field( wp_unslash( $_POST['create_account_username'] ) ) : '',
697
- );
698
  }
699
  if ( ! $use_standard_password_setup_email ) {
700
- $registration_fields['create_account_password'] = array(
701
  'type' => 'password',
702
  'label' => esc_html__( 'Password', 'wp-job-manager' ),
703
  'autocomplete' => false,
704
  'required' => $account_required,
705
- );
706
  $password_hint = wpjm_get_password_rules_hint();
707
  if ( $password_hint ) {
708
  $registration_fields['create_account_password']['description'] = $password_hint;
709
  }
710
- $registration_fields['create_account_password_verify'] = array(
711
  'type' => 'password',
712
  'label' => esc_html__( 'Verify Password', 'wp-job-manager' ),
713
  'autocomplete' => false,
714
  'required' => $account_required,
715
- );
716
  }
717
- $registration_fields['create_account_email'] = array(
718
- 'type' => 'text',
719
- 'label' => esc_html__( 'Your email', 'wp-job-manager' ),
720
- 'placeholder' => __( 'you@yourdomain.com', 'wp-job-manager' ),
721
- 'required' => $account_required,
722
- // phpcs:ignore WordPress.Security.NonceVerification.Missing -- Just used to populate value when validation failed.
723
- 'value' => isset( $_POST['create_account_email'] ) ? sanitize_text_field( wp_unslash( $_POST['create_account_email'] ) ) : '',
724
- );
725
  }
726
 
727
  /**
@@ -789,7 +789,7 @@ function the_job_location( $map_link = true, $post = null ) {
789
  echo wp_kses_post(
790
  apply_filters(
791
  'the_job_location_map_link',
792
- '<a class="google_map_link" href="' . esc_url( 'http://maps.google.com/maps?q=' . rawurlencode( wp_strip_all_tags( $location ) ) . '&zoom=14&size=512x512&maptype=roadmap&sensor=false' ) . '">' . esc_html( wp_strip_all_tags( $location ) ) . '</a>',
793
  $location,
794
  $post
795
  )
@@ -881,10 +881,10 @@ function job_manager_get_resized_image( $logo, $size ) {
881
  if (
882
  'full' !== $size
883
  && strstr( $logo, WP_CONTENT_URL )
884
- && ( isset( $_wp_additional_image_sizes[ $size ] ) || in_array( $size, array( 'thumbnail', 'medium', 'large' ), true ) )
885
  ) {
886
 
887
- if ( in_array( $size, array( 'thumbnail', 'medium', 'large' ), true ) ) {
888
  $img_width = get_option( $size . '_size_w' );
889
  $img_height = get_option( $size . '_size_h' );
890
  $img_crop = get_option( $size . '_size_crop' );
@@ -895,7 +895,7 @@ function job_manager_get_resized_image( $logo, $size ) {
895
  }
896
 
897
  $upload_dir = wp_upload_dir();
898
- $logo_path = str_replace( array( $upload_dir['baseurl'], $upload_dir['url'], WP_CONTENT_URL ), array( $upload_dir['basedir'], $upload_dir['path'], WP_CONTENT_DIR ), $logo );
899
  $path_parts = pathinfo( $logo_path );
900
  $dims = $img_width . 'x' . $img_height;
901
  $resized_logo_path = str_replace( '.' . $path_parts['extension'], '-' . $dims . '.' . $path_parts['extension'], $logo_path );
@@ -948,7 +948,7 @@ function the_company_video( $post = null ) {
948
  if ( shortcode_exists( 'flowplayer' ) ) {
949
  $video_embed = '[flowplayer src="' . esc_url( $video ) . '"]';
950
  } elseif ( ! empty( $filetype['ext'] ) ) {
951
- $video_embed = wp_video_shortcode( array( 'src' => $video ) );
952
  } else {
953
  $video_embed = wp_oembed_get( $video );
954
  }
@@ -1164,10 +1164,10 @@ function get_job_listing_class( $class = '', $post_id = null ) {
1164
  $post = get_post( $post_id );
1165
 
1166
  if ( empty( $post ) || 'job_listing' !== $post->post_type ) {
1167
- return array();
1168
  }
1169
 
1170
- $classes = array();
1171
 
1172
  if ( ! empty( $class ) ) {
1173
  if ( ! is_array( $class ) ) {
@@ -1225,7 +1225,7 @@ add_action( 'post_class', 'wpjm_add_post_class', 10, 3 );
1225
  * @since 1.14.0
1226
  */
1227
  function job_listing_meta_display() {
1228
- get_job_manager_template( 'content-single-job_listing-meta.php', array() );
1229
  }
1230
  add_action( 'single_job_listing_start', 'job_listing_meta_display', 20 );
1231
 
@@ -1235,6 +1235,6 @@ add_action( 'single_job_listing_start', 'job_listing_meta_display', 20 );
1235
  * @since 1.14.0
1236
  */
1237
  function job_listing_company_display() {
1238
- get_job_manager_template( 'content-single-job_listing-company.php', array() );
1239
  }
1240
  add_action( 'single_job_listing_start', 'job_listing_company_display', 30 );
19
  * @param string $template_path (default: '').
20
  * @param string $default_path (default: '').
21
  */
22
+ function get_job_manager_template( $template_name, $args = [], $template_path = 'job_manager', $default_path = '' ) {
23
  if ( $args && is_array( $args ) ) {
24
  // phpcs:ignore WordPress.PHP.DontExtract.extract_extract -- Please, forgive us.
25
  extract( $args );
45
  function locate_job_manager_template( $template_name, $template_path = 'job_manager', $default_path = '' ) {
46
  // Look within passed path within the theme - this is priority.
47
  $template = locate_template(
48
+ [
49
  trailingslashit( $template_path ) . $template_name,
50
  $template_name,
51
+ ]
52
  );
53
 
54
  // Get default template.
117
  ob_start();
118
  get_job_manager_template(
119
  'job-pagination.php',
120
+ [
121
  'max_num_pages' => $max_num_pages,
122
  'current_page' => absint( $current_page ),
123
+ ]
124
  );
125
  return ob_get_clean();
126
  }
191
  */
192
  function candidates_can_apply( $post = null ) {
193
  $post = get_post( $post );
194
+ return apply_filters( 'job_manager_candidates_can_apply', ( ! is_position_filled() && ! in_array( $post->post_status, [ 'preview', 'expired' ], true ) ), $post );
195
  }
196
 
197
  /**
270
  if ( ! wpjm_job_listing_employment_type_enabled() ) {
271
  return false;
272
  }
273
+ $employment_types = [];
274
  $job_types = wpjm_get_the_job_types( $post );
275
 
276
  if ( ! empty( $job_types ) ) {
367
  return false;
368
  }
369
 
370
+ $data = [];
371
  $data['@context'] = 'http://schema.org/';
372
  $data['@type'] = 'JobPosting';
373
  $data['datePosted'] = get_post_time( 'c', false, $post );
385
  $data['employmentType'] = $employment_types;
386
  }
387
 
388
+ $data['hiringOrganization'] = [];
389
  $data['hiringOrganization']['@type'] = 'Organization';
390
  $data['hiringOrganization']['name'] = get_the_company_name( $post );
391
 
400
  $data['hiringOrganization']['logo'] = $company_logo;
401
  }
402
 
403
+ $data['identifier'] = [];
404
  $data['identifier']['@type'] = 'PropertyValue';
405
  $data['identifier']['name'] = get_the_company_name( $post );
406
  $data['identifier']['value'] = get_the_guid( $post );
407
 
408
  $location = get_the_job_location( $post );
409
  if ( ! empty( $location ) ) {
410
+ $data['jobLocation'] = [];
411
  $data['jobLocation']['@type'] = 'Place';
412
  $data['jobLocation']['address'] = wpjm_get_job_listing_location_structured_data( $post );
413
  if ( empty( $data['jobLocation']['address'] ) ) {
441
  return false;
442
  }
443
 
444
+ $mapping = [];
445
+ $mapping['streetAddress'] = [ 'street_number', 'street' ];
446
  $mapping['addressLocality'] = 'city';
447
  $mapping['addressRegion'] = 'state_short';
448
  $mapping['postalCode'] = 'postcode';
449
  $mapping['addressCountry'] = 'country_short';
450
 
451
+ $address = [];
452
  $address['@type'] = 'PostalAddress';
453
  foreach ( $mapping as $schema_key => $geolocation_key ) {
454
  if ( is_array( $geolocation_key ) ) {
455
+ $values = [];
456
  foreach ( $geolocation_key as $sub_geo_key ) {
457
  $geo_value = get_post_meta( $post->ID, 'geolocation_' . $sub_geo_key, true );
458
  if ( ! empty( $geo_value ) ) {
600
  $types = get_the_terms( $post->ID, 'job_listing_type' );
601
 
602
  if ( empty( $types ) || is_wp_error( $types ) ) {
603
+ $types = [];
604
  }
605
 
606
  // Return single if not enabled.
607
  if ( ! empty( $types ) && ! job_manager_multi_job_type() ) {
608
+ $types = [ current( $types ) ];
609
  }
610
 
611
  /**
659
  $categories = get_the_terms( $post->ID, 'job_listing_category' );
660
 
661
  if ( empty( $categories ) || is_wp_error( $categories ) ) {
662
+ $categories = [];
663
  }
664
 
665
  /**
685
  $use_standard_password_setup_email = wpjm_use_standard_password_setup_email();
686
  $account_required = job_manager_user_requires_account();
687
 
688
+ $registration_fields = [];
689
  if ( job_manager_enable_registration() ) {
690
+ $registration_fields['create_account_email'] = [
691
+ 'type' => 'text',
692
+ 'label' => esc_html__( 'Your email', 'wp-job-manager' ),
693
+ 'placeholder' => __( 'you@yourdomain.com', 'wp-job-manager' ),
694
+ 'required' => $account_required,
695
+ // phpcs:ignore WordPress.Security.NonceVerification.Missing -- Just used to populate value when validation failed.
696
+ 'value' => isset( $_POST['create_account_email'] ) ? sanitize_text_field( wp_unslash( $_POST['create_account_email'] ) ) : '',
697
+ ];
698
  if ( ! $generate_username_from_email ) {
699
+ $registration_fields['create_account_username'] = [
700
  'type' => 'text',
701
  'label' => esc_html__( 'Username', 'wp-job-manager' ),
702
  'required' => $account_required,
703
  // phpcs:ignore WordPress.Security.NonceVerification.Missing -- Just used to populate value when validation failed.
704
  'value' => isset( $_POST['create_account_username'] ) ? sanitize_text_field( wp_unslash( $_POST['create_account_username'] ) ) : '',
705
+ ];
706
  }
707
  if ( ! $use_standard_password_setup_email ) {
708
+ $registration_fields['create_account_password'] = [
709
  'type' => 'password',
710
  'label' => esc_html__( 'Password', 'wp-job-manager' ),
711
  'autocomplete' => false,
712
  'required' => $account_required,
713
+ ];
714
  $password_hint = wpjm_get_password_rules_hint();
715
  if ( $password_hint ) {
716
  $registration_fields['create_account_password']['description'] = $password_hint;
717
  }
718
+ $registration_fields['create_account_password_verify'] = [
719
  'type' => 'password',
720
  'label' => esc_html__( 'Verify Password', 'wp-job-manager' ),
721
  'autocomplete' => false,
722
  'required' => $account_required,
723
+ ];
724
  }
 
 
 
 
 
 
 
 
725
  }
726
 
727
  /**
789
  echo wp_kses_post(
790
  apply_filters(
791
  'the_job_location_map_link',
792
+ '<a class="google_map_link" href="' . esc_url( 'https://maps.google.com/maps?q=' . rawurlencode( wp_strip_all_tags( $location ) ) . '&zoom=14&size=512x512&maptype=roadmap&sensor=false' ) . '">' . esc_html( wp_strip_all_tags( $location ) ) . '</a>',
793
  $location,
794
  $post
795
  )
881
  if (
882
  'full' !== $size
883
  && strstr( $logo, WP_CONTENT_URL )
884
+ && ( isset( $_wp_additional_image_sizes[ $size ] ) || in_array( $size, [ 'thumbnail', 'medium', 'large' ], true ) )
885
  ) {
886
 
887
+ if ( in_array( $size, [ 'thumbnail', 'medium', 'large' ], true ) ) {
888
  $img_width = get_option( $size . '_size_w' );
889
  $img_height = get_option( $size . '_size_h' );
890
  $img_crop = get_option( $size . '_size_crop' );
895
  }
896
 
897
  $upload_dir = wp_upload_dir();
898
+ $logo_path = str_replace( [ $upload_dir['baseurl'], $upload_dir['url'], WP_CONTENT_URL ], [ $upload_dir['basedir'], $upload_dir['path'], WP_CONTENT_DIR ], $logo );
899
  $path_parts = pathinfo( $logo_path );
900
  $dims = $img_width . 'x' . $img_height;
901
  $resized_logo_path = str_replace( '.' . $path_parts['extension'], '-' . $dims . '.' . $path_parts['extension'], $logo_path );
948
  if ( shortcode_exists( 'flowplayer' ) ) {
949
  $video_embed = '[flowplayer src="' . esc_url( $video ) . '"]';
950
  } elseif ( ! empty( $filetype['ext'] ) ) {
951
+ $video_embed = wp_video_shortcode( [ 'src' => $video ] );
952
  } else {
953
  $video_embed = wp_oembed_get( $video );
954
  }
1164
  $post = get_post( $post_id );
1165
 
1166
  if ( empty( $post ) || 'job_listing' !== $post->post_type ) {
1167
+ return [];
1168
  }
1169
 
1170
+ $classes = [];
1171
 
1172
  if ( ! empty( $class ) ) {
1173
  if ( ! is_array( $class ) ) {
1225
  * @since 1.14.0
1226
  */
1227
  function job_listing_meta_display() {
1228
+ get_job_manager_template( 'content-single-job_listing-meta.php', [] );
1229
  }
1230
  add_action( 'single_job_listing_start', 'job_listing_meta_display', 20 );
1231
 
1235
  * @since 1.14.0
1236
  */
1237
  function job_listing_company_display() {
1238
+ get_job_manager_template( 'content-single-job_listing-company.php', [] );
1239
  }
1240
  add_action( 'single_job_listing_start', 'job_listing_company_display', 30 );
wp-job-manager.php CHANGED
@@ -3,7 +3,7 @@
3
  * Plugin Name: WP Job Manager
4
  * Plugin URI: https://wpjobmanager.com/
5
  * Description: Manage job listings from the WordPress admin panel, and allow users to post jobs directly to your site.
6
- * Version: 1.33.5
7
  * Author: Automattic
8
  * Author URI: https://wpjobmanager.com/
9
  * Requires at least: 4.9
@@ -21,7 +21,7 @@ if ( ! defined( 'ABSPATH' ) ) {
21
  }
22
 
23
  // Define constants.
24
- define( 'JOB_MANAGER_VERSION', '1.33.5' );
25
  define( 'JOB_MANAGER_PLUGIN_DIR', untrailingslashit( plugin_dir_path( __FILE__ ) ) );
26
  define( 'JOB_MANAGER_PLUGIN_URL', untrailingslashit( plugins_url( basename( plugin_dir_path( __FILE__ ) ), basename( __FILE__ ) ) ) );
27
  define( 'JOB_MANAGER_PLUGIN_BASENAME', plugin_basename( __FILE__ ) );
3
  * Plugin Name: WP Job Manager
4
  * Plugin URI: https://wpjobmanager.com/
5
  * Description: Manage job listings from the WordPress admin panel, and allow users to post jobs directly to your site.
6
+ * Version: 1.34.0
7
  * Author: Automattic
8
  * Author URI: https://wpjobmanager.com/
9
  * Requires at least: 4.9
21
  }
22
 
23
  // Define constants.
24
+ define( 'JOB_MANAGER_VERSION', '1.34.0' );
25
  define( 'JOB_MANAGER_PLUGIN_DIR', untrailingslashit( plugin_dir_path( __FILE__ ) ) );
26
  define( 'JOB_MANAGER_PLUGIN_URL', untrailingslashit( plugins_url( basename( plugin_dir_path( __FILE__ ) ), basename( __FILE__ ) ) ) );
27
  define( 'JOB_MANAGER_PLUGIN_BASENAME', plugin_basename( __FILE__ ) );