Version Description
- 2019-09-29 =
- Update : Some Information
- Fixed : Multisite warning
Download this release
Release Info
Developer | addonspress |
Plugin | Advanced Import : One Click Import for WordPress or Theme Demo Data |
Version | 1.0.2 |
Comparing to | |
See all releases |
Version 1.0.2
- LICENSE.txt +339 -0
- admin/class-advanced-import-admin.php +2256 -0
- admin/class-reset.php +192 -0
- admin/index.php +1 -0
- advanced-import.php +81 -0
- assets/css/advanced-import-admin.min.css +1 -0
- assets/js/advanced-import-admin.min.js +1 -0
- assets/library/isotope/isotope.pkgd.min.js +12 -0
- assets/library/sweetalert2/sweetalert2.all.js +2792 -0
- assets/library/sweetalert2/sweetalert2.all.min.js +2 -0
- example.php +199 -0
- includes/class-advanced-import-activator.php +36 -0
- includes/class-advanced-import-deactivator.php +36 -0
- includes/class-advanced-import-i18n.php +44 -0
- includes/class-advanced-import-loader.php +129 -0
- includes/class-advanced-import.php +286 -0
- includes/functions-advanced-import.php +12 -0
- includes/index.php +1 -0
- index.php +1 -0
- languages/advanced-import.pot +0 -0
- readme.txt +71 -0
- uninstall.php +25 -0
LICENSE.txt
ADDED
@@ -0,0 +1,339 @@
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
1 |
+
GNU GENERAL PUBLIC LICENSE
|
2 |
+
Version 2, June 1991
|
3 |
+
|
4 |
+
Copyright (C) 1989, 1991 Free Software Foundation, Inc.,
|
5 |
+
51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA
|
6 |
+
Everyone is permitted to copy and distribute verbatim copies
|
7 |
+
of this license document, but changing it is not allowed.
|
8 |
+
|
9 |
+
Preamble
|
10 |
+
|
11 |
+
The licenses for most software are designed to take away your
|
12 |
+
freedom to share and change it. By contrast, the GNU General Public
|
13 |
+
License is intended to guarantee your freedom to share and change free
|
14 |
+
software--to make sure the software is free for all its users. This
|
15 |
+
General Public License applies to most of the Free Software
|
16 |
+
Foundation's software and to any other program whose authors commit to
|
17 |
+
using it. (Some other Free Software Foundation software is covered by
|
18 |
+
the GNU Lesser General Public License instead.) You can apply it to
|
19 |
+
your programs, too.
|
20 |
+
|
21 |
+
When we speak of free software, we are referring to freedom, not
|
22 |
+
price. Our General Public Licenses are designed to make sure that you
|
23 |
+
have the freedom to distribute copies of free software (and charge for
|
24 |
+
this service if you wish), that you receive source code or can get it
|
25 |
+
if you want it, that you can change the software or use pieces of it
|
26 |
+
in new free programs; and that you know you can do these things.
|
27 |
+
|
28 |
+
To protect your rights, we need to make restrictions that forbid
|
29 |
+
anyone to deny you these rights or to ask you to surrender the rights.
|
30 |
+
These restrictions translate to certain responsibilities for you if you
|
31 |
+
distribute copies of the software, or if you modify it.
|
32 |
+
|
33 |
+
For example, if you distribute copies of such a program, whether
|
34 |
+
gratis or for a fee, you must give the recipients all the rights that
|
35 |
+
you have. You must make sure that they, too, receive or can get the
|
36 |
+
source code. And you must show them these terms so they know their
|
37 |
+
rights.
|
38 |
+
|
39 |
+
We protect your rights with two steps: (1) copyright the software, and
|
40 |
+
(2) offer you this license which gives you legal permission to copy,
|
41 |
+
distribute and/or modify the software.
|
42 |
+
|
43 |
+
Also, for each author's protection and ours, we want to make certain
|
44 |
+
that everyone understands that there is no warranty for this free
|
45 |
+
software. If the software is modified by someone else and passed on, we
|
46 |
+
want its recipients to know that what they have is not the original, so
|
47 |
+
that any problems introduced by others will not reflect on the original
|
48 |
+
authors' reputations.
|
49 |
+
|
50 |
+
Finally, any free program is threatened constantly by software
|
51 |
+
patents. We wish to avoid the danger that redistributors of a free
|
52 |
+
program will individually obtain patent licenses, in effect making the
|
53 |
+
program proprietary. To prevent this, we have made it clear that any
|
54 |
+
patent must be licensed for everyone's free use or not licensed at all.
|
55 |
+
|
56 |
+
The precise terms and conditions for copying, distribution and
|
57 |
+
modification follow.
|
58 |
+
|
59 |
+
GNU GENERAL PUBLIC LICENSE
|
60 |
+
TERMS AND CONDITIONS FOR COPYING, DISTRIBUTION AND MODIFICATION
|
61 |
+
|
62 |
+
0. This License applies to any program or other work which contains
|
63 |
+
a notice placed by the copyright holder saying it may be distributed
|
64 |
+
under the terms of this General Public License. The "Program", below,
|
65 |
+
refers to any such program or work, and a "work based on the Program"
|
66 |
+
means either the Program or any derivative work under copyright law:
|
67 |
+
that is to say, a work containing the Program or a portion of it,
|
68 |
+
either verbatim or with modifications and/or translated into another
|
69 |
+
language. (Hereinafter, translation is included without limitation in
|
70 |
+
the term "modification".) Each licensee is addressed as "you".
|
71 |
+
|
72 |
+
Activities other than copying, distribution and modification are not
|
73 |
+
covered by this License; they are outside its scope. The act of
|
74 |
+
running the Program is not restricted, and the output from the Program
|
75 |
+
is covered only if its contents constitute a work based on the
|
76 |
+
Program (independent of having been made by running the Program).
|
77 |
+
Whether that is true depends on what the Program does.
|
78 |
+
|
79 |
+
1. You may copy and distribute verbatim copies of the Program's
|
80 |
+
source code as you receive it, in any medium, provided that you
|
81 |
+
conspicuously and appropriately publish on each copy an appropriate
|
82 |
+
copyright notice and disclaimer of warranty; keep intact all the
|
83 |
+
notices that refer to this License and to the absence of any warranty;
|
84 |
+
and give any other recipients of the Program a copy of this License
|
85 |
+
along with the Program.
|
86 |
+
|
87 |
+
You may charge a fee for the physical act of transferring a copy, and
|
88 |
+
you may at your option offer warranty protection in exchange for a fee.
|
89 |
+
|
90 |
+
2. You may modify your copy or copies of the Program or any portion
|
91 |
+
of it, thus forming a work based on the Program, and copy and
|
92 |
+
distribute such modifications or work under the terms of Section 1
|
93 |
+
above, provided that you also meet all of these conditions:
|
94 |
+
|
95 |
+
a) You must cause the modified files to carry prominent notices
|
96 |
+
stating that you changed the files and the date of any change.
|
97 |
+
|
98 |
+
b) You must cause any work that you distribute or publish, that in
|
99 |
+
whole or in part contains or is derived from the Program or any
|
100 |
+
part thereof, to be licensed as a whole at no charge to all third
|
101 |
+
parties under the terms of this License.
|
102 |
+
|
103 |
+
c) If the modified program normally reads commands interactively
|
104 |
+
when run, you must cause it, when started running for such
|
105 |
+
interactive use in the most ordinary way, to print or display an
|
106 |
+
announcement including an appropriate copyright notice and a
|
107 |
+
notice that there is no warranty (or else, saying that you provide
|
108 |
+
a warranty) and that users may redistribute the program under
|
109 |
+
these conditions, and telling the user how to view a copy of this
|
110 |
+
License. (Exception: if the Program itself is interactive but
|
111 |
+
does not normally print such an announcement, your work based on
|
112 |
+
the Program is not required to print an announcement.)
|
113 |
+
|
114 |
+
These requirements apply to the modified work as a whole. If
|
115 |
+
identifiable sections of that work are not derived from the Program,
|
116 |
+
and can be reasonably considered independent and separate works in
|
117 |
+
themselves, then this License, and its terms, do not apply to those
|
118 |
+
sections when you distribute them as separate works. But when you
|
119 |
+
distribute the same sections as part of a whole which is a work based
|
120 |
+
on the Program, the distribution of the whole must be on the terms of
|
121 |
+
this License, whose permissions for other licensees extend to the
|
122 |
+
entire whole, and thus to each and every part regardless of who wrote it.
|
123 |
+
|
124 |
+
Thus, it is not the intent of this section to claim rights or contest
|
125 |
+
your rights to work written entirely by you; rather, the intent is to
|
126 |
+
exercise the right to control the distribution of derivative or
|
127 |
+
collective works based on the Program.
|
128 |
+
|
129 |
+
In addition, mere aggregation of another work not based on the Program
|
130 |
+
with the Program (or with a work based on the Program) on a volume of
|
131 |
+
a storage or distribution medium does not bring the other work under
|
132 |
+
the scope of this License.
|
133 |
+
|
134 |
+
3. You may copy and distribute the Program (or a work based on it,
|
135 |
+
under Section 2) in object code or executable form under the terms of
|
136 |
+
Sections 1 and 2 above provided that you also do one of the following:
|
137 |
+
|
138 |
+
a) Accompany it with the complete corresponding machine-readable
|
139 |
+
source code, which must be distributed under the terms of Sections
|
140 |
+
1 and 2 above on a medium customarily used for software interchange; or,
|
141 |
+
|
142 |
+
b) Accompany it with a written offer, valid for at least three
|
143 |
+
years, to give any third party, for a charge no more than your
|
144 |
+
cost of physically performing source distribution, a complete
|
145 |
+
machine-readable copy of the corresponding source code, to be
|
146 |
+
distributed under the terms of Sections 1 and 2 above on a medium
|
147 |
+
customarily used for software interchange; or,
|
148 |
+
|
149 |
+
c) Accompany it with the information you received as to the offer
|
150 |
+
to distribute corresponding source code. (This alternative is
|
151 |
+
allowed only for noncommercial distribution and only if you
|
152 |
+
received the program in object code or executable form with such
|
153 |
+
an offer, in accord with Subsection b above.)
|
154 |
+
|
155 |
+
The source code for a work means the preferred form of the work for
|
156 |
+
making modifications to it. For an executable work, complete source
|
157 |
+
code means all the source code for all modules it contains, plus any
|
158 |
+
associated interface definition files, plus the scripts used to
|
159 |
+
control compilation and installation of the executable. However, as a
|
160 |
+
special exception, the source code distributed need not include
|
161 |
+
anything that is normally distributed (in either source or binary
|
162 |
+
form) with the major components (compiler, kernel, and so on) of the
|
163 |
+
operating system on which the executable runs, unless that component
|
164 |
+
itself accompanies the executable.
|
165 |
+
|
166 |
+
If distribution of executable or object code is made by offering
|
167 |
+
access to copy from a designated place, then offering equivalent
|
168 |
+
access to copy the source code from the same place counts as
|
169 |
+
distribution of the source code, even though third parties are not
|
170 |
+
compelled to copy the source along with the object code.
|
171 |
+
|
172 |
+
4. You may not copy, modify, sublicense, or distribute the Program
|
173 |
+
except as expressly provided under this License. Any attempt
|
174 |
+
otherwise to copy, modify, sublicense or distribute the Program is
|
175 |
+
void, and will automatically terminate your rights under this License.
|
176 |
+
However, parties who have received copies, or rights, from you under
|
177 |
+
this License will not have their licenses terminated so long as such
|
178 |
+
parties remain in full compliance.
|
179 |
+
|
180 |
+
5. You are not required to accept this License, since you have not
|
181 |
+
signed it. However, nothing else grants you permission to modify or
|
182 |
+
distribute the Program or its derivative works. These actions are
|
183 |
+
prohibited by law if you do not accept this License. Therefore, by
|
184 |
+
modifying or distributing the Program (or any work based on the
|
185 |
+
Program), you indicate your acceptance of this License to do so, and
|
186 |
+
all its terms and conditions for copying, distributing or modifying
|
187 |
+
the Program or works based on it.
|
188 |
+
|
189 |
+
6. Each time you redistribute the Program (or any work based on the
|
190 |
+
Program), the recipient automatically receives a license from the
|
191 |
+
original licensor to copy, distribute or modify the Program subject to
|
192 |
+
these terms and conditions. You may not impose any further
|
193 |
+
restrictions on the recipients' exercise of the rights granted herein.
|
194 |
+
You are not responsible for enforcing compliance by third parties to
|
195 |
+
this License.
|
196 |
+
|
197 |
+
7. If, as a consequence of a court judgment or allegation of patent
|
198 |
+
infringement or for any other reason (not limited to patent issues),
|
199 |
+
conditions are imposed on you (whether by court order, agreement or
|
200 |
+
otherwise) that contradict the conditions of this License, they do not
|
201 |
+
excuse you from the conditions of this License. If you cannot
|
202 |
+
distribute so as to satisfy simultaneously your obligations under this
|
203 |
+
License and any other pertinent obligations, then as a consequence you
|
204 |
+
may not distribute the Program at all. For example, if a patent
|
205 |
+
license would not permit royalty-free redistribution of the Program by
|
206 |
+
all those who receive copies directly or indirectly through you, then
|
207 |
+
the only way you could satisfy both it and this License would be to
|
208 |
+
refrain entirely from distribution of the Program.
|
209 |
+
|
210 |
+
If any portion of this section is held invalid or unenforceable under
|
211 |
+
any particular circumstance, the balance of the section is intended to
|
212 |
+
apply and the section as a whole is intended to apply in other
|
213 |
+
circumstances.
|
214 |
+
|
215 |
+
It is not the purpose of this section to induce you to infringe any
|
216 |
+
patents or other property right claims or to contest validity of any
|
217 |
+
such claims; this section has the sole purpose of protecting the
|
218 |
+
integrity of the free software distribution system, which is
|
219 |
+
implemented by public license practices. Many people have made
|
220 |
+
generous contributions to the wide range of software distributed
|
221 |
+
through that system in reliance on consistent application of that
|
222 |
+
system; it is up to the author/donor to decide if he or she is willing
|
223 |
+
to distribute software through any other system and a licensee cannot
|
224 |
+
impose that choice.
|
225 |
+
|
226 |
+
This section is intended to make thoroughly clear what is believed to
|
227 |
+
be a consequence of the rest of this License.
|
228 |
+
|
229 |
+
8. If the distribution and/or use of the Program is restricted in
|
230 |
+
certain countries either by patents or by copyrighted interfaces, the
|
231 |
+
original copyright holder who places the Program under this License
|
232 |
+
may add an explicit geographical distribution limitation excluding
|
233 |
+
those countries, so that distribution is permitted only in or among
|
234 |
+
countries not thus excluded. In such case, this License incorporates
|
235 |
+
the limitation as if written in the body of this License.
|
236 |
+
|
237 |
+
9. The Free Software Foundation may publish revised and/or new versions
|
238 |
+
of the General Public License from time to time. Such new versions will
|
239 |
+
be similar in spirit to the present version, but may differ in detail to
|
240 |
+
address new problems or concerns.
|
241 |
+
|
242 |
+
Each version is given a distinguishing version number. If the Program
|
243 |
+
specifies a version number of this License which applies to it and "any
|
244 |
+
later version", you have the option of following the terms and conditions
|
245 |
+
either of that version or of any later version published by the Free
|
246 |
+
Software Foundation. If the Program does not specify a version number of
|
247 |
+
this License, you may choose any version ever published by the Free Software
|
248 |
+
Foundation.
|
249 |
+
|
250 |
+
10. If you wish to incorporate parts of the Program into other free
|
251 |
+
programs whose distribution conditions are different, write to the author
|
252 |
+
to ask for permission. For software which is copyrighted by the Free
|
253 |
+
Software Foundation, write to the Free Software Foundation; we sometimes
|
254 |
+
make exceptions for this. Our decision will be guided by the two goals
|
255 |
+
of preserving the free status of all derivatives of our free software and
|
256 |
+
of promoting the sharing and reuse of software generally.
|
257 |
+
|
258 |
+
NO WARRANTY
|
259 |
+
|
260 |
+
11. BECAUSE THE PROGRAM IS LICENSED FREE OF CHARGE, THERE IS NO WARRANTY
|
261 |
+
FOR THE PROGRAM, TO THE EXTENT PERMITTED BY APPLICABLE LAW. EXCEPT WHEN
|
262 |
+
OTHERWISE STATED IN WRITING THE COPYRIGHT HOLDERS AND/OR OTHER PARTIES
|
263 |
+
PROVIDE THE PROGRAM "AS IS" WITHOUT WARRANTY OF ANY KIND, EITHER EXPRESSED
|
264 |
+
OR IMPLIED, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES OF
|
265 |
+
MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE. THE ENTIRE RISK AS
|
266 |
+
TO THE QUALITY AND PERFORMANCE OF THE PROGRAM IS WITH YOU. SHOULD THE
|
267 |
+
PROGRAM PROVE DEFECTIVE, YOU ASSUME THE COST OF ALL NECESSARY SERVICING,
|
268 |
+
REPAIR OR CORRECTION.
|
269 |
+
|
270 |
+
12. IN NO EVENT UNLESS REQUIRED BY APPLICABLE LAW OR AGREED TO IN WRITING
|
271 |
+
WILL ANY COPYRIGHT HOLDER, OR ANY OTHER PARTY WHO MAY MODIFY AND/OR
|
272 |
+
REDISTRIBUTE THE PROGRAM AS PERMITTED ABOVE, BE LIABLE TO YOU FOR DAMAGES,
|
273 |
+
INCLUDING ANY GENERAL, SPECIAL, INCIDENTAL OR CONSEQUENTIAL DAMAGES ARISING
|
274 |
+
OUT OF THE USE OR INABILITY TO USE THE PROGRAM (INCLUDING BUT NOT LIMITED
|
275 |
+
TO LOSS OF DATA OR DATA BEING RENDERED INACCURATE OR LOSSES SUSTAINED BY
|
276 |
+
YOU OR THIRD PARTIES OR A FAILURE OF THE PROGRAM TO OPERATE WITH ANY OTHER
|
277 |
+
PROGRAMS), EVEN IF SUCH HOLDER OR OTHER PARTY HAS BEEN ADVISED OF THE
|
278 |
+
POSSIBILITY OF SUCH DAMAGES.
|
279 |
+
|
280 |
+
END OF TERMS AND CONDITIONS
|
281 |
+
|
282 |
+
How to Apply These Terms to Your New Programs
|
283 |
+
|
284 |
+
If you develop a new program, and you want it to be of the greatest
|
285 |
+
possible use to the public, the best way to achieve this is to make it
|
286 |
+
free software which everyone can redistribute and change under these terms.
|
287 |
+
|
288 |
+
To do so, attach the following notices to the program. It is safest
|
289 |
+
to attach them to the start of each source file to most effectively
|
290 |
+
convey the exclusion of warranty; and each file should have at least
|
291 |
+
the "copyright" line and a pointer to where the full notice is found.
|
292 |
+
|
293 |
+
<one line to give the program's name and a brief idea of what it does.>
|
294 |
+
Copyright (C) <year> <name of author>
|
295 |
+
|
296 |
+
This program is free software; you can redistribute it and/or modify
|
297 |
+
it under the terms of the GNU General Public License as published by
|
298 |
+
the Free Software Foundation; either version 2 of the License, or
|
299 |
+
(at your option) any later version.
|
300 |
+
|
301 |
+
This program is distributed in the hope that it will be useful,
|
302 |
+
but WITHOUT ANY WARRANTY; without even the implied warranty of
|
303 |
+
MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
|
304 |
+
GNU General Public License for more details.
|
305 |
+
|
306 |
+
You should have received a copy of the GNU General Public License along
|
307 |
+
with this program; if not, write to the Free Software Foundation, Inc.,
|
308 |
+
51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA.
|
309 |
+
|
310 |
+
Also add information on how to contact you by electronic and paper mail.
|
311 |
+
|
312 |
+
If the program is interactive, make it output a short notice like this
|
313 |
+
when it starts in an interactive mode:
|
314 |
+
|
315 |
+
Gnomovision version 69, Copyright (C) year name of author
|
316 |
+
Gnomovision comes with ABSOLUTELY NO WARRANTY; for details type `show w'.
|
317 |
+
This is free software, and you are welcome to redistribute it
|
318 |
+
under certain conditions; type `show c' for details.
|
319 |
+
|
320 |
+
The hypothetical commands `show w' and `show c' should show the appropriate
|
321 |
+
parts of the General Public License. Of course, the commands you use may
|
322 |
+
be called something other than `show w' and `show c'; they could even be
|
323 |
+
mouse-clicks or menu items--whatever suits your program.
|
324 |
+
|
325 |
+
You should also get your employer (if you work as a programmer) or your
|
326 |
+
school, if any, to sign a "copyright disclaimer" for the program, if
|
327 |
+
necessary. Here is a sample; alter the names:
|
328 |
+
|
329 |
+
Yoyodyne, Inc., hereby disclaims all copyright interest in the program
|
330 |
+
`Gnomovision' (which makes passes at compilers) written by James Hacker.
|
331 |
+
|
332 |
+
<signature of Ty Coon>, 1 April 1989
|
333 |
+
Ty Coon, President of Vice
|
334 |
+
|
335 |
+
This General Public License does not permit incorporating your program into
|
336 |
+
proprietary programs. If your program is a subroutine library, you may
|
337 |
+
consider it more useful to permit linking proprietary applications with the
|
338 |
+
library. If this is what you want to do, use the GNU Lesser General
|
339 |
+
Public License instead of this License.
|
admin/class-advanced-import-admin.php
ADDED
@@ -0,0 +1,2256 @@
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
1 |
+
<?php
|
2 |
+
|
3 |
+
/**
|
4 |
+
* The admin-specific functionality of the plugin.
|
5 |
+
*
|
6 |
+
* @link https://addonspress.com/
|
7 |
+
* @since 1.0.0
|
8 |
+
*
|
9 |
+
* @package Advanced_Import
|
10 |
+
* @subpackage Advanced_Import/admin
|
11 |
+
*/
|
12 |
+
|
13 |
+
/**
|
14 |
+
* The admin-specific functionality of the plugin.
|
15 |
+
*
|
16 |
+
* Defines the plugin name, version, and two examples hooks for how to
|
17 |
+
* enqueue the admin-specific stylesheet and JavaScript.
|
18 |
+
*
|
19 |
+
* @package Advanced_Import
|
20 |
+
* @subpackage Advanced_Import/admin
|
21 |
+
* @author Addons Press <addonspress.com>
|
22 |
+
*/
|
23 |
+
class Advanced_Import_Admin {
|
24 |
+
|
25 |
+
/**
|
26 |
+
* The Name of this plugin.
|
27 |
+
*
|
28 |
+
* @since 1.0.0
|
29 |
+
* @access private
|
30 |
+
* @var string $plugin_name The ID of this plugin.
|
31 |
+
*/
|
32 |
+
private $plugin_name;
|
33 |
+
|
34 |
+
/**
|
35 |
+
* The version of this plugin.
|
36 |
+
*
|
37 |
+
* @since 1.0.0
|
38 |
+
* @access private
|
39 |
+
* @var string $version The current version of this plugin.
|
40 |
+
*/
|
41 |
+
private $version;
|
42 |
+
|
43 |
+
/**
|
44 |
+
* The Current theme name
|
45 |
+
*
|
46 |
+
* @since 1.0.0
|
47 |
+
* @access public
|
48 |
+
* @var string $theme_name The Current theme name.
|
49 |
+
*/
|
50 |
+
public $theme_name = '';
|
51 |
+
|
52 |
+
/**
|
53 |
+
* Current step
|
54 |
+
*
|
55 |
+
* @since 1.0.0
|
56 |
+
* @access protected
|
57 |
+
* @var string $step Current step.
|
58 |
+
*/
|
59 |
+
protected $step = '';
|
60 |
+
|
61 |
+
/**
|
62 |
+
* Array of steps
|
63 |
+
*
|
64 |
+
* @since 1.0.0
|
65 |
+
* @access public
|
66 |
+
* @var array $steps Array of steps.
|
67 |
+
*/
|
68 |
+
protected $steps = array();
|
69 |
+
|
70 |
+
/**
|
71 |
+
* Demo lists
|
72 |
+
*
|
73 |
+
* @since 1.0.0
|
74 |
+
* @access public
|
75 |
+
* @var array $demo_lists Array of demo lists.
|
76 |
+
*/
|
77 |
+
protected $demo_lists = array();
|
78 |
+
|
79 |
+
|
80 |
+
/**
|
81 |
+
* Array of delayed post for late process
|
82 |
+
*
|
83 |
+
* @since 1.0.0
|
84 |
+
* @access public
|
85 |
+
* @var array $delay_posts Array of delayed post for late process.
|
86 |
+
*/
|
87 |
+
private $delay_posts = array();
|
88 |
+
|
89 |
+
/**
|
90 |
+
* Store logs and errors
|
91 |
+
*
|
92 |
+
* @since 1.0.0
|
93 |
+
* @access public
|
94 |
+
* @var array $logs Store logs and errors.
|
95 |
+
*/
|
96 |
+
public $logs = array();
|
97 |
+
|
98 |
+
|
99 |
+
/**
|
100 |
+
* Store errors
|
101 |
+
*
|
102 |
+
* @since 1.0.0
|
103 |
+
* @access public
|
104 |
+
* @var array $errors Store errors.
|
105 |
+
*/
|
106 |
+
public $errors = array();
|
107 |
+
|
108 |
+
|
109 |
+
/**
|
110 |
+
* current added Menu hook_suffix
|
111 |
+
*
|
112 |
+
* @since 1.0.0
|
113 |
+
* @access public
|
114 |
+
* @var array $logs Store logs and errors.
|
115 |
+
*/
|
116 |
+
public $hook_suffix;
|
117 |
+
|
118 |
+
/**
|
119 |
+
* Slug of the import page
|
120 |
+
*
|
121 |
+
* @since 1.0.0
|
122 |
+
* @access public
|
123 |
+
* @var string $logs Store logs and errors.
|
124 |
+
*/
|
125 |
+
private $current_template_type;
|
126 |
+
|
127 |
+
/**
|
128 |
+
* Slug of the import page
|
129 |
+
*
|
130 |
+
* @since 1.0.0
|
131 |
+
* @access public
|
132 |
+
* @var string $logs Store logs and errors.
|
133 |
+
*/
|
134 |
+
private $current_template_url;
|
135 |
+
|
136 |
+
/**
|
137 |
+
* Initialize the class and set its properties.
|
138 |
+
*
|
139 |
+
* @since 1.0.0
|
140 |
+
*/
|
141 |
+
public function __construct( ) {}
|
142 |
+
|
143 |
+
/**
|
144 |
+
* Main Advanced_Import_Admin Instance
|
145 |
+
* Initialize the class and set its properties.
|
146 |
+
*
|
147 |
+
* @since 1.0.0
|
148 |
+
* @param string $plugin_name The name of this plugin.
|
149 |
+
* @param string $version The version of this plugin.
|
150 |
+
* @return object $instance Advanced_Import_Admin Instance
|
151 |
+
*/
|
152 |
+
public static function instance() {
|
153 |
+
|
154 |
+
// Store the instance locally to avoid private static replication
|
155 |
+
static $instance = null;
|
156 |
+
|
157 |
+
// Only run these methods if they haven't been ran previously
|
158 |
+
if ( null === $instance ) {
|
159 |
+
$instance = new Advanced_Import_Admin;
|
160 |
+
$instance->plugin_name = ADVANCED_IMPORT_PLUGIN_NAME;
|
161 |
+
$instance->version = ADVANCED_IMPORT_VERSION;
|
162 |
+
|
163 |
+
/*page slug using theme name */
|
164 |
+
$instance->theme_name = sanitize_key( get_option('template') );
|
165 |
+
|
166 |
+
}
|
167 |
+
|
168 |
+
// Always return the instance
|
169 |
+
return $instance;
|
170 |
+
}
|
171 |
+
|
172 |
+
/**
|
173 |
+
* Register the stylesheets for the admin area.
|
174 |
+
*
|
175 |
+
* @since 1.0.0
|
176 |
+
*/
|
177 |
+
public function enqueue_styles( $hook_suffix ) {
|
178 |
+
if ( !is_array($this->hook_suffix) || !in_array( $hook_suffix, $this->hook_suffix )){
|
179 |
+
return;
|
180 |
+
}
|
181 |
+
wp_enqueue_style( $this->plugin_name, ADVANCED_IMPORT_URL . 'assets/css/advanced-import-admin' . ADVANCED_IMPORT_SCRIPT_PREFIX . '.css',array( 'wp-admin', 'dashicons' ), $this->version, 'all' );
|
182 |
+
wp_enqueue_media();
|
183 |
+
}
|
184 |
+
|
185 |
+
/**
|
186 |
+
* Register the JavaScript for the admin area.
|
187 |
+
*
|
188 |
+
* @since 1.0.0
|
189 |
+
*/
|
190 |
+
public function enqueue_scripts( $hook_suffix ) {
|
191 |
+
if ( !is_array($this->hook_suffix) || !in_array( $hook_suffix, $this->hook_suffix )){
|
192 |
+
return;
|
193 |
+
}
|
194 |
+
|
195 |
+
//Isotope Js
|
196 |
+
wp_enqueue_script(
|
197 |
+
'isotope', // Handle.
|
198 |
+
ADVANCED_IMPORT_URL . '/assets/library/isotope/isotope.pkgd' . ADVANCED_IMPORT_SCRIPT_PREFIX . '.js',
|
199 |
+
array('jquery'), // Dependencies, defined above.
|
200 |
+
'3.0.6', // Version: File modification time.
|
201 |
+
true // Enqueue the script in the footer.
|
202 |
+
);
|
203 |
+
|
204 |
+
//Isotope Js
|
205 |
+
wp_enqueue_script(
|
206 |
+
'sweetalert2', // Handle.
|
207 |
+
ADVANCED_IMPORT_URL . '/assets/library/sweetalert2/sweetalert2.all' . ADVANCED_IMPORT_SCRIPT_PREFIX . '.js',
|
208 |
+
array('jquery'), // Dependencies, defined above.
|
209 |
+
'3.0.6', // Version: File modification time.
|
210 |
+
true // Enqueue the script in the footer.
|
211 |
+
);
|
212 |
+
|
213 |
+
wp_enqueue_script( $this->plugin_name, ADVANCED_IMPORT_URL . 'assets/js/advanced-import-admin' . ADVANCED_IMPORT_SCRIPT_PREFIX . '.js', array( 'jquery'), $this->version, true );
|
214 |
+
wp_localize_script( $this->plugin_name, 'advanced_import_object', array(
|
215 |
+
'ajaxurl' => admin_url( 'admin-ajax.php' ),
|
216 |
+
'wpnonce' => wp_create_nonce( 'advanced_import_nonce' ),
|
217 |
+
'text' => array(
|
218 |
+
'failed' => esc_html__('Failed','advanced-import'),
|
219 |
+
'error' => esc_html__('Error','advanced-import'),
|
220 |
+
'skip' => esc_html__( 'Skipping','advanced-import' ),
|
221 |
+
'confirmImport' => array(
|
222 |
+
'title' => esc_html__( 'Advanced Import! Just a step away','advanced-import' ),
|
223 |
+
'html' => sprintf(
|
224 |
+
|
225 |
+
__( 'Importing demo data is the easiest way to setup your theme. It will allow you to quickly edit everything instead of creating content from scratch. Also, read following points before importing the demo: %1$s %2$s %3$s %4$s', 'advanced-import' ),
|
226 |
+
|
227 |
+
'<ol><li class="warning">' . __( 'It is highly recommended to import demo on fresh WordPress installation to exactly replicate the theme demo. If no important data on your site, you can reset it from Reset Wizard at the top', 'advanced-import' ) . '</li>',
|
228 |
+
|
229 |
+
'<li>' . __( 'No existing posts, pages, categories, images, custom post types or any other data will be deleted or modified.', 'advanced-import' ) . '</li>',
|
230 |
+
|
231 |
+
'<li>' . __( 'It will install the plugins required for demo and activate them. Also posts, pages, images, widgets, & other data will get imported.', 'advanced-import' ) . '</li>',
|
232 |
+
|
233 |
+
'<li>' . __( 'Please click on the Import button and wait, it will take some time to import the data.', 'advanced-import' ) . '</li></ol>'
|
234 |
+
|
235 |
+
),
|
236 |
+
'confirmButtonText' => esc_html__( 'Yes, Import Demo!','advanced-import' ),
|
237 |
+
'cancelButtonText' => esc_html__( 'Cancel','advanced-import' ),
|
238 |
+
),
|
239 |
+
'confirmReset' => array(
|
240 |
+
'title' => esc_html__( 'Are you sure?','advanced-import' ),
|
241 |
+
'text' => __( "You won't be able to revert this!",'advanced-import' ),
|
242 |
+
'confirmButtonText' => esc_html__( 'Yes, Reset','advanced-import' ),
|
243 |
+
'cancelButtonText' => esc_html__( 'Cancel','advanced-import' ),
|
244 |
+
),
|
245 |
+
'resetSuccess' => array(
|
246 |
+
'title' => esc_html__( 'Reset Successful','advanced-import' ),
|
247 |
+
'confirmButtonText' => esc_html__( 'Ok','advanced-import' ),
|
248 |
+
),
|
249 |
+
'failedImport' => array(
|
250 |
+
'code' => __( "Error Code:",'advanced-import' ),
|
251 |
+
'text' => __( "Contact theme author or try again",'advanced-import' ),
|
252 |
+
),
|
253 |
+
'successImport' => array(
|
254 |
+
'confirmButtonText' => esc_html__( 'Visit My Site','advanced-import' ),
|
255 |
+
'cancelButtonText' => esc_html__( 'Okay','advanced-import' ),
|
256 |
+
)
|
257 |
+
),
|
258 |
+
) );
|
259 |
+
}
|
260 |
+
|
261 |
+
/**
|
262 |
+
* @return array
|
263 |
+
*/
|
264 |
+
public function mime_types( $mimes ) {
|
265 |
+
$add_mimes = array(
|
266 |
+
'json' => 'text/plain'
|
267 |
+
);
|
268 |
+
|
269 |
+
return array_merge( $mimes, $add_mimes );
|
270 |
+
}
|
271 |
+
|
272 |
+
/**
|
273 |
+
* Determine if the user already has theme content installed.
|
274 |
+
* @access public
|
275 |
+
*/
|
276 |
+
public function is_possible_upgrade() {
|
277 |
+
return false;
|
278 |
+
}
|
279 |
+
|
280 |
+
/**
|
281 |
+
* Add admin menus
|
282 |
+
* @access public
|
283 |
+
*/
|
284 |
+
public function import_menu() {
|
285 |
+
$this->hook_suffix[] = add_theme_page( esc_html__( 'Demo Import ','advanced-import' ), esc_html__( 'Demo Import' ), 'manage_options', 'advanced-import', array( $this, 'demo_import_screen' ) );
|
286 |
+
$this->hook_suffix[] = add_management_page( esc_html__( 'Advanced Import', 'advanced-import' ), esc_html__( 'Advanced Import', 'advanced-import' ), 'manage_options', 'advanced-import-tool', array( $this, 'demo_import_screen' ) );
|
287 |
+
|
288 |
+
}
|
289 |
+
|
290 |
+
/**
|
291 |
+
* Show the setup
|
292 |
+
* @access public
|
293 |
+
* @return void
|
294 |
+
*/
|
295 |
+
public function demo_import_screen() {
|
296 |
+
|
297 |
+
$this->step = isset( $_GET['step'] ) ? sanitize_key( $_GET['step'] ) : current( array_keys( $this->steps ) );
|
298 |
+
|
299 |
+
|
300 |
+
echo '<div class="ai-body">';
|
301 |
+
|
302 |
+
$this->get_header();
|
303 |
+
|
304 |
+
echo '<div class="ai-content">';
|
305 |
+
echo '<div class="ai-content-blocker hidden">';
|
306 |
+
echo '<div class="ai-notification-title"><p>'.esc_html__( 'Processing... Please do not refresh this page or do not go to other url!' ,'advanced-import').'</p></div>';
|
307 |
+
echo '<div id="ai-demo-popup"></div>';
|
308 |
+
echo '</div>';
|
309 |
+
$this->init_demo_import();
|
310 |
+
echo '</div>';
|
311 |
+
echo '</div>';/*ai-body*/
|
312 |
+
}
|
313 |
+
|
314 |
+
/**
|
315 |
+
* get header of setup
|
316 |
+
* @access public
|
317 |
+
* @return void
|
318 |
+
*/
|
319 |
+
public function get_header(){
|
320 |
+
global $pagenow;
|
321 |
+
|
322 |
+
$welcome_msg = "<div class='ai-header'>";
|
323 |
+
$welcome_msg .= "<h1>".sprintf( esc_html__( 'Welcome to the Advanced Import for %s.','advanced-import' ), wp_get_theme() )."</h1>";
|
324 |
+
if( $pagenow != 'tools.php' ){
|
325 |
+
$welcome_msg .= " <p>".sprintf( esc_html__( 'Thank you for choosing the %s theme. This quick demo import setup will help you configure your new website like theme demo. It will install the required WordPress plugins, default content and tell you a little about Help & Support options. It should only take less than 5 minutes.','advanced-import' ), wp_get_theme() )."</p>";
|
326 |
+
}
|
327 |
+
$welcome_msg .= "</div>";
|
328 |
+
echo advanced_import_allowed_html( apply_filters('advanced_import_welcome_message', $welcome_msg ) );
|
329 |
+
|
330 |
+
if ( get_theme_mod( 'advanced_import_setup_complete', false ) && $pagenow != 'tools.php' ) {
|
331 |
+
?>
|
332 |
+
<p><?php esc_html_e( 'It looks like you have already run the demo import for this theme.','advanced-import' ); ?></p>
|
333 |
+
<?php
|
334 |
+
}
|
335 |
+
}
|
336 |
+
|
337 |
+
/**
|
338 |
+
* Handle the demo content upload and called to process
|
339 |
+
* Ajax callback
|
340 |
+
*
|
341 |
+
* @return void
|
342 |
+
*/
|
343 |
+
function upload_zip() {
|
344 |
+
if ( isset( $_FILES[ 'ai-upload-zip-archive' ][ 'name' ] ) && ! empty( $_FILES[ 'ai-upload-zip-archive' ][ 'name' ] ) ) {
|
345 |
+
/*check for security*/
|
346 |
+
if ( ! current_user_can( 'upload_files' ) ) {
|
347 |
+
wp_send_json_error(
|
348 |
+
array(
|
349 |
+
'message' => esc_html__( 'Sorry, you are not allowed to install demo on this site.','advanced-import' )
|
350 |
+
)
|
351 |
+
);
|
352 |
+
}
|
353 |
+
check_admin_referer( 'advanced-import' );
|
354 |
+
|
355 |
+
/*file process*/
|
356 |
+
require_once( ABSPATH . 'wp-admin/includes/file.php' );
|
357 |
+
WP_Filesystem();
|
358 |
+
global $wp_filesystem;
|
359 |
+
$wp_filesystem->rmdir( ADVANCED_IMPORT_TEMP, true );
|
360 |
+
$upload_zip_archive = $_FILES[ 'ai-upload-zip-archive' ];
|
361 |
+
$unzipfile = unzip_file( $upload_zip_archive['tmp_name'], ADVANCED_IMPORT_TEMP );
|
362 |
+
if ( is_wp_error( $unzipfile ) ) {
|
363 |
+
wp_send_json_error(
|
364 |
+
array(
|
365 |
+
'message' => esc_html__( 'Error on unzipping, Please try again','advanced-import')
|
366 |
+
)
|
367 |
+
);
|
368 |
+
}
|
369 |
+
/*(check) Zip should contain json file and uploads folder only*/
|
370 |
+
$dirlist = $wp_filesystem->dirlist( ADVANCED_IMPORT_TEMP );
|
371 |
+
foreach ( (array) $dirlist as $filename => $fileinfo ) {
|
372 |
+
if( $fileinfo['type'] == 'd'){
|
373 |
+
if( $filename == 'uploads' ){
|
374 |
+
continue;
|
375 |
+
}
|
376 |
+
else{
|
377 |
+
$wp_filesystem->rmdir( ADVANCED_IMPORT_TEMP, true );
|
378 |
+
wp_send_json_error(
|
379 |
+
array(
|
380 |
+
'message' => esc_html__( 'Invalid Zip File','advanced-import' )
|
381 |
+
)
|
382 |
+
);
|
383 |
+
}
|
384 |
+
}
|
385 |
+
else{
|
386 |
+
$filetype = wp_check_filetype($filename);
|
387 |
+
if( empty( $filetype['ext'] ) || $filetype['ext'] != 'json'){
|
388 |
+
$wp_filesystem->rmdir( ADVANCED_IMPORT_TEMP, true );
|
389 |
+
wp_send_json_error(
|
390 |
+
array(
|
391 |
+
'message' => esc_html__( 'Invalid Zip File','advanced-import' )
|
392 |
+
)
|
393 |
+
);
|
394 |
+
}
|
395 |
+
}
|
396 |
+
|
397 |
+
}
|
398 |
+
wp_send_json_success(
|
399 |
+
array(
|
400 |
+
'message' => esc_html__( 'Success','advanced-import' )
|
401 |
+
)
|
402 |
+
);
|
403 |
+
}
|
404 |
+
wp_send_json_error(
|
405 |
+
array(
|
406 |
+
'message' => esc_html__( 'No Zip File Found','advanced-import' )
|
407 |
+
)
|
408 |
+
);
|
409 |
+
}
|
410 |
+
|
411 |
+
/**
|
412 |
+
* Download Zip file/ Move it to temp import folder
|
413 |
+
* Ajax callback
|
414 |
+
*
|
415 |
+
* @return mixed
|
416 |
+
*/
|
417 |
+
function demo_download_and_unzip() {
|
418 |
+
/*check for security*/
|
419 |
+
if ( ! current_user_can( 'upload_files' ) ) {
|
420 |
+
wp_send_json_error(
|
421 |
+
array(
|
422 |
+
'message' => esc_html__( 'Sorry, you are not allowed to install demo on this site.','advanced-import' )
|
423 |
+
)
|
424 |
+
);
|
425 |
+
}
|
426 |
+
check_admin_referer( 'advanced-import' );
|
427 |
+
|
428 |
+
/*get file and what should do*/
|
429 |
+
$demo_file = is_array( $_POST['demo_file'] )? (array) $_POST['demo_file'] : sanitize_text_field( $_POST['demo_file'] );
|
430 |
+
$demo_file_type = sanitize_text_field( $_POST['demo_file_type'] );
|
431 |
+
|
432 |
+
/*from file*/
|
433 |
+
if( $demo_file_type == 'file' ){
|
434 |
+
require_once( ABSPATH . 'wp-admin/includes/file.php' );
|
435 |
+
WP_Filesystem();
|
436 |
+
global $wp_filesystem;
|
437 |
+
$wp_filesystem->rmdir( ADVANCED_IMPORT_TEMP, true );
|
438 |
+
$unzipfile = unzip_file( $demo_file, ADVANCED_IMPORT_TEMP );
|
439 |
+
if ( is_wp_error( $unzipfile ) ) {
|
440 |
+
wp_send_json_error(
|
441 |
+
array(
|
442 |
+
'message' => esc_html__( 'Error on unzipping, Please try again','advanced-import')
|
443 |
+
)
|
444 |
+
);
|
445 |
+
}
|
446 |
+
/*(check) Zip should contain json file and uploads folder only*/
|
447 |
+
$dirlist = $wp_filesystem->dirlist( ADVANCED_IMPORT_TEMP );
|
448 |
+
foreach ( (array) $dirlist as $filename => $fileinfo ) {
|
449 |
+
if( $fileinfo['type'] == 'd'){
|
450 |
+
if( $filename == 'uploads' ){
|
451 |
+
continue;
|
452 |
+
}
|
453 |
+
else{
|
454 |
+
$wp_filesystem->rmdir( ADVANCED_IMPORT_TEMP, true );
|
455 |
+
wp_send_json_error(
|
456 |
+
array(
|
457 |
+
'message' => esc_html__( 'Invalid Zip File','advanced-import' )
|
458 |
+
)
|
459 |
+
);
|
460 |
+
}
|
461 |
+
}
|
462 |
+
else{
|
463 |
+
$filetype = wp_check_filetype($filename);
|
464 |
+
if( empty( $filetype['ext'] ) || $filetype['ext'] != 'json'){
|
465 |
+
$wp_filesystem->rmdir( ADVANCED_IMPORT_TEMP, true );
|
466 |
+
wp_send_json_error(
|
467 |
+
array(
|
468 |
+
'message' => esc_html__( 'Invalid Zip File','advanced-import' )
|
469 |
+
)
|
470 |
+
);
|
471 |
+
}
|
472 |
+
}
|
473 |
+
|
474 |
+
}
|
475 |
+
wp_send_json_success(
|
476 |
+
array(
|
477 |
+
'message' => esc_html__( 'Success','advanced-import' )
|
478 |
+
)
|
479 |
+
);
|
480 |
+
}
|
481 |
+
elseif ( $demo_file_type == 'url' ){
|
482 |
+
|
483 |
+
/*finally fetch the file from remote*/
|
484 |
+
$response = wp_remote_get( $demo_file );
|
485 |
+
|
486 |
+
if ( is_array( $response ) && ! empty( $response['body'] ) && $response['response']['code'] == '200' ) {
|
487 |
+
require_once( ABSPATH . 'wp-admin/includes/file.php' );
|
488 |
+
WP_Filesystem();
|
489 |
+
global $wp_filesystem;
|
490 |
+
$file_permission = 0777;
|
491 |
+
if ( !file_exists( ADVANCED_IMPORT_TEMP_ZIP ) ) {
|
492 |
+
$wp_filesystem->mkdir(ADVANCED_IMPORT_TEMP_ZIP, $file_permission, true);
|
493 |
+
}
|
494 |
+
$temp_import_zip = trailingslashit(ADVANCED_IMPORT_TEMP_ZIP ). "temp-import.zip";
|
495 |
+
$wp_filesystem->put_contents( $temp_import_zip, $response['body'],0777 );
|
496 |
+
|
497 |
+
}
|
498 |
+
else {
|
499 |
+
/*required to download file failed.*/
|
500 |
+
wp_send_json_error(
|
501 |
+
array(
|
502 |
+
'error' => 1,
|
503 |
+
'message' => esc_html__( 'Remote server did not respond, Contact to Theme Author','advanced-import' )
|
504 |
+
)
|
505 |
+
);
|
506 |
+
}
|
507 |
+
|
508 |
+
$file_size = filesize( $temp_import_zip );
|
509 |
+
|
510 |
+
/*if file size is 0*/
|
511 |
+
if ( 0 == $file_size ) {
|
512 |
+
$wp_filesystem->rmdir( ADVANCED_IMPORT_TEMP_ZIP, true );
|
513 |
+
wp_send_json_error(
|
514 |
+
array(
|
515 |
+
'error' => 1,
|
516 |
+
'message' => esc_html__( 'Zero size file downloaded, Contact to Theme Author','advanced-import' )
|
517 |
+
)
|
518 |
+
);
|
519 |
+
}
|
520 |
+
|
521 |
+
/*if file is too large*/
|
522 |
+
if ( ! empty( $max_size ) && $file_size > $max_size ) {
|
523 |
+
$wp_filesystem->rmdir( ADVANCED_IMPORT_TEMP_ZIP, true );
|
524 |
+
wp_send_json_error(
|
525 |
+
array(
|
526 |
+
'error' => 1,
|
527 |
+
'message' => sprintf( esc_html__( 'Remote file is too large, limit is %s','advanced-import' ), size_format( $max_size ) )
|
528 |
+
)
|
529 |
+
);
|
530 |
+
}
|
531 |
+
|
532 |
+
/*if we are here then unzip file*/
|
533 |
+
$unzipfile = unzip_file( $temp_import_zip, ADVANCED_IMPORT_TEMP );
|
534 |
+
if ( is_wp_error( $unzipfile ) ) {
|
535 |
+
wp_send_json_error(
|
536 |
+
array(
|
537 |
+
'error' => 1,
|
538 |
+
'message' => esc_html__( 'Error on unzipping, Please try again','advanced-import')
|
539 |
+
)
|
540 |
+
);
|
541 |
+
}
|
542 |
+
$wp_filesystem->rmdir( ADVANCED_IMPORT_TEMP_ZIP, true );
|
543 |
+
|
544 |
+
/*(check) Zip should contain json file and uploads folder only*/
|
545 |
+
$dirlist = $wp_filesystem->dirlist( ADVANCED_IMPORT_TEMP );
|
546 |
+
foreach ( (array) $dirlist as $filename => $fileinfo ) {
|
547 |
+
if( $fileinfo['type'] == 'd'){
|
548 |
+
if( $filename == 'uploads' ){
|
549 |
+
continue;
|
550 |
+
}
|
551 |
+
else{
|
552 |
+
$wp_filesystem->rmdir( ADVANCED_IMPORT_TEMP, true );
|
553 |
+
wp_send_json_error(
|
554 |
+
array(
|
555 |
+
'message' => esc_html__( 'Invalid Zip File','advanced-import' )
|
556 |
+
)
|
557 |
+
);
|
558 |
+
}
|
559 |
+
}
|
560 |
+
else{
|
561 |
+
$filetype = wp_check_filetype($filename);
|
562 |
+
if( empty( $filetype['ext'] ) || $filetype['ext'] != 'json'){
|
563 |
+
$wp_filesystem->rmdir( ADVANCED_IMPORT_TEMP, true );
|
564 |
+
wp_send_json_error(
|
565 |
+
array(
|
566 |
+
'message' => esc_html__( 'Invalid Zip File','advanced-import' )
|
567 |
+
)
|
568 |
+
);
|
569 |
+
}
|
570 |
+
}
|
571 |
+
|
572 |
+
}
|
573 |
+
wp_send_json_success(
|
574 |
+
array(
|
575 |
+
'message' => esc_html__( 'Success','advanced-import' )
|
576 |
+
)
|
577 |
+
);
|
578 |
+
|
579 |
+
}
|
580 |
+
else{
|
581 |
+
wp_send_json_error(
|
582 |
+
array(
|
583 |
+
'error' => 1,
|
584 |
+
'message' => esc_html__( 'File not allowed','advanced-import' )
|
585 |
+
)
|
586 |
+
);
|
587 |
+
}
|
588 |
+
}
|
589 |
+
|
590 |
+
/**
|
591 |
+
* List Demo List
|
592 |
+
*
|
593 |
+
* @return void
|
594 |
+
*/
|
595 |
+
public function demo_list( $demo_lists, $total_demo ){
|
596 |
+
?>
|
597 |
+
<div class="ai-filter-header">
|
598 |
+
<div class="ai-filter-tabs">
|
599 |
+
<ul class="ai-types ai-filter-group" data-filter-group="secondary">
|
600 |
+
<li class="ai-filter-btn-active ai-filter-btn" data-filter="*">
|
601 |
+
<?php esc_html_e( 'All', 'advanced-import' ); ?>
|
602 |
+
<span class="ai-count"></span>
|
603 |
+
</li>
|
604 |
+
<?php
|
605 |
+
$types = array_column($demo_lists, 'type');
|
606 |
+
$unique_types = array_unique( $types );
|
607 |
+
foreach ( $unique_types as $cat_index => $single_type ){
|
608 |
+
?>
|
609 |
+
<li class="ai-filter-btn" data-filter=".<?php echo strtolower( esc_attr($single_type) );?>">
|
610 |
+
<?php echo ucfirst( esc_html($single_type) );?>
|
611 |
+
<span class="ai-count"></span>
|
612 |
+
|
613 |
+
</li>
|
614 |
+
<?php
|
615 |
+
}
|
616 |
+
?>
|
617 |
+
</ul>
|
618 |
+
<div class="ai-search-control">
|
619 |
+
<input id="ai-filter-search-input" class="ai-search-filter" type="text" placeholder="<?php esc_attr_e('Search...','advanced-import')?>">
|
620 |
+
</div>
|
621 |
+
<ul class="ai-form-type">
|
622 |
+
<li class="ai-form-file-import">
|
623 |
+
<?php esc_html_e( 'Upload zip', 'advanced-import' ); ?>
|
624 |
+
</li>
|
625 |
+
</ul>
|
626 |
+
</div>
|
627 |
+
</div>
|
628 |
+
<div class="ai-filter-content" id="ai-filter-content">
|
629 |
+
<div class="ai-actions ai-sidebar">
|
630 |
+
<div class="ai-import-available-categories">
|
631 |
+
<h3><?php esc_html_e( 'Categories', 'advanced-import' ); ?></h3>
|
632 |
+
<ul class="ai-import-available-categories-lists ai-filter-group" data-filter-group="primary">
|
633 |
+
<li class="ai-filter-btn-active ai-filter-btn" data-filter="*">
|
634 |
+
<?php esc_html_e( 'All Categories', 'advanced-import' ); ?>
|
635 |
+
<span class="ai-count"></span>
|
636 |
+
</li>
|
637 |
+
<?php
|
638 |
+
$categories = array_column($demo_lists, 'categories');
|
639 |
+
$unique_categories = array();
|
640 |
+
if( is_array( $categories) && !empty( $categories )){
|
641 |
+
foreach ( $categories as $demo_index => $demo_cats ){
|
642 |
+
foreach ( $demo_cats as $cat_index => $single_cat ){
|
643 |
+
if (in_array($single_cat, $unique_categories)){
|
644 |
+
continue;
|
645 |
+
}
|
646 |
+
$unique_categories[] = $single_cat;
|
647 |
+
?>
|
648 |
+
<li class="ai-filter-btn" data-filter=".<?php echo strtolower( esc_attr($single_cat) );?>">
|
649 |
+
<?php echo ucfirst( esc_html($single_cat) );?>
|
650 |
+
<span class="ai-count"></span>
|
651 |
+
</li>
|
652 |
+
<?php
|
653 |
+
}
|
654 |
+
}
|
655 |
+
}
|
656 |
+
?>
|
657 |
+
</ul>
|
658 |
+
</div>
|
659 |
+
|
660 |
+
</div>
|
661 |
+
<div class="ai-filter-content-wrapper">
|
662 |
+
<?php
|
663 |
+
foreach ( $demo_lists as $key => $demo_list ){
|
664 |
+
|
665 |
+
/*Check for required fields*/
|
666 |
+
if( !isset( $demo_list['title'] ) || !isset( $demo_list['template_url'] ) || !isset( $demo_list['screenshot_url'] ) || !isset( $demo_list['demo_url']) ){
|
667 |
+
continue;
|
668 |
+
}
|
669 |
+
|
670 |
+
$plugins = isset( $demo_list['plugins'] ) && is_array( $demo_list['plugins'] )?' data-plugins="'.esc_attr(json_encode($demo_list['plugins'])).'"':'';
|
671 |
+
|
672 |
+
$template_url = $demo_list['template_url'];
|
673 |
+
if( is_array( $template_url )){
|
674 |
+
$data_template = 'data-template_url="'.esc_attr(json_encode($template_url)).'"';
|
675 |
+
$data_template_type = 'data-template_type="array"';
|
676 |
+
}
|
677 |
+
else{
|
678 |
+
$data_template = 'data-template_url="'.esc_attr($template_url).'"';
|
679 |
+
if ( is_file( $template_url ) && filesize( $template_url ) > 0 ) {
|
680 |
+
$data_template_type = 'data-template_type="file"';
|
681 |
+
}
|
682 |
+
else{
|
683 |
+
$data_template_type = 'data-template_type="url"';
|
684 |
+
}
|
685 |
+
}
|
686 |
+
?>
|
687 |
+
<div aria-label="<?php echo esc_attr( $demo_list['title'])?>" class="<?php echo isset( $demo_list['categories'] )?esc_attr(implode(" ",$demo_list['categories'])):'';?> ai-item <?php echo isset( $demo_list['type'] )?esc_attr($demo_list['type']):'';?>" <?php echo $data_template.' '.$data_template_type;?>>
|
688 |
+
<?php
|
689 |
+
wp_nonce_field( 'advanced-import' );
|
690 |
+
?>
|
691 |
+
<div class="ai-item-preview">
|
692 |
+
<div class="ai-item-screenshot">
|
693 |
+
<img src="<?php echo esc_url( $demo_list['screenshot_url'])?>">
|
694 |
+
|
695 |
+
</div>
|
696 |
+
<h4 class="ai-author-info"><?php esc_html_e( 'Author: ', 'advanced-import' ) ?><?php echo esc_html( isset($demo_list['author'])?$demo_list['author']:wp_get_theme()->get( 'Author' ))?></h4>
|
697 |
+
<div class="ai-details"><?php esc_html_e( 'Details', 'advanced-import' ) ?></div>
|
698 |
+
<?php
|
699 |
+
if( isset( $demo_list['is_premium'] ) && $demo_list['is_premium'] ){
|
700 |
+
?>
|
701 |
+
<span class="ai-premium-label"><?php esc_html_e( 'Premium', 'advanced-import' ) ?></span>
|
702 |
+
<?php
|
703 |
+
}
|
704 |
+
?>
|
705 |
+
</div>
|
706 |
+
<div class="ai-item-footer">
|
707 |
+
<div class="ai-item-footer_meta">
|
708 |
+
<h3 class="theme-name"><?php echo esc_html( $demo_list['title'])?></h3>
|
709 |
+
<div class="ai-item-footer-actions">
|
710 |
+
<a class="button ai-item-demo-link" href="<?php echo esc_url( $demo_list['demo_url'])?>" target="_blank">
|
711 |
+
<span class="dashicons dashicons-visibility"></span><?php esc_html_e( 'Preview', 'advanced-import' );?>
|
712 |
+
</a>
|
713 |
+
<a class="button ai-demo-import ai-item-import is-button is-default is-primary is-large button-primary" href="#" aria-label="<?php esc_attr_e( 'Import', 'advanced-import' )?>" <?php echo $plugins;?>>
|
714 |
+
<span class="dashicons dashicons-download"></span><?php esc_html_e( 'Import', 'advanced-import' );?>
|
715 |
+
</a>
|
716 |
+
</div>
|
717 |
+
<?php
|
718 |
+
$keywords = isset( $demo_list['keywords'] )? $demo_list['keywords']:array();
|
719 |
+
If( !empty( $keywords )){
|
720 |
+
echo '<ul class="ai-keywords hidden">';
|
721 |
+
foreach ( $keywords as $cat_index => $single_keywords ){
|
722 |
+
?>
|
723 |
+
<li class="<?php echo strtolower( esc_attr($single_keywords) );?>"><?php echo ucfirst( esc_html($single_keywords) );?></li>
|
724 |
+
<?php
|
725 |
+
}
|
726 |
+
echo '</ul>';
|
727 |
+
}
|
728 |
+
?>
|
729 |
+
|
730 |
+
</div>
|
731 |
+
|
732 |
+
</div>
|
733 |
+
</div>
|
734 |
+
<?php
|
735 |
+
}
|
736 |
+
?>
|
737 |
+
</div>
|
738 |
+
</div>
|
739 |
+
<?php
|
740 |
+
}
|
741 |
+
/**
|
742 |
+
* List Demo Form
|
743 |
+
*
|
744 |
+
* @return void
|
745 |
+
*/
|
746 |
+
|
747 |
+
public function demo_import_form( $total_demo = 0 ){
|
748 |
+
?>
|
749 |
+
<div class="ai-form <?php echo $total_demo > 0?'hidden':''?>">
|
750 |
+
<form action="" method="post" enctype="multipart/form-data" id="ai-upload-zip-form">
|
751 |
+
<h3 class="media-title"><?php esc_html_e( 'Upload a zip file containing demo content', 'advanced-import' ); ?> </h3>
|
752 |
+
<div class="input-file"><input type="file" name="ai-upload-zip-archive" id="ai-upload-zip-archive" size="50" /></div>
|
753 |
+
<p>
|
754 |
+
<?php
|
755 |
+
wp_nonce_field( 'advanced-import' );
|
756 |
+
printf( __( 'Maximum upload file size: %s','advanced-import' ), size_format( wp_max_upload_size() ) );
|
757 |
+
?>
|
758 |
+
</p>
|
759 |
+
<div id='ai-empty-file' class="error hidden">
|
760 |
+
<p>
|
761 |
+
<?php esc_html_e('Select File and Try Again!','advanced-import')?>
|
762 |
+
</p>
|
763 |
+
</div>
|
764 |
+
<p class="ai-form-import-actions step">
|
765 |
+
<button class="button-primary button button-large button-upload-demo" type="submit">
|
766 |
+
<?php esc_html_e( 'Upload Demo Zip','advanced-import' ); ?>
|
767 |
+
</button>
|
768 |
+
<a href="<?php echo esc_url( wp_get_referer() && ! strpos( wp_get_referer(), 'update.php' ) ? wp_get_referer() : admin_url( '' ) ); ?>" class="button button-large">
|
769 |
+
<?php esc_html_e( 'Not right now','advanced-import' ); ?>
|
770 |
+
</a>
|
771 |
+
</p>
|
772 |
+
<div id='ai-ajax-install-result'></div>
|
773 |
+
</form>
|
774 |
+
</div>
|
775 |
+
<?php
|
776 |
+
}
|
777 |
+
|
778 |
+
/**
|
779 |
+
* 1st step of demo import view
|
780 |
+
* Upload Zip file
|
781 |
+
* Demo List
|
782 |
+
*/
|
783 |
+
public function init_demo_import(){
|
784 |
+
|
785 |
+
global $pagenow;
|
786 |
+
$total_demo = 0;
|
787 |
+
if( $pagenow != 'tools.php' ){
|
788 |
+
$this->demo_lists = apply_filters( 'advanced_import_demo_lists',array() );
|
789 |
+
$demo_lists = $this->demo_lists;
|
790 |
+
|
791 |
+
$total_demo = count( $demo_lists );
|
792 |
+
if( $total_demo >= 1 ){
|
793 |
+
$this->demo_list( $demo_lists, $total_demo );
|
794 |
+
}
|
795 |
+
}
|
796 |
+
|
797 |
+
$this->demo_import_form($total_demo);
|
798 |
+
}
|
799 |
+
|
800 |
+
/**
|
801 |
+
* 2nd step Plugin Installation step View
|
802 |
+
* return void || boolean
|
803 |
+
*/
|
804 |
+
public function plugin_screen() {
|
805 |
+
|
806 |
+
check_admin_referer( 'advanced-import' );
|
807 |
+
|
808 |
+
/*delete_transient(); for safety*/
|
809 |
+
delete_transient('content.json');
|
810 |
+
delete_transient('widgets.json');
|
811 |
+
delete_transient('options.json');
|
812 |
+
|
813 |
+
?>
|
814 |
+
<div class="ai-notification-title">
|
815 |
+
<p><?php esc_html_e( 'Your website needs a few essential plugins. We are installing them...','advanced-import' ); ?></p>
|
816 |
+
</div>
|
817 |
+
<ul class="ai-plugins-wrap hidden">
|
818 |
+
<?php
|
819 |
+
$recommended_plugins = (array) $_POST['recommendedPlugins'];
|
820 |
+
if ( count( $recommended_plugins ) ) {
|
821 |
+
foreach ( $recommended_plugins as $index => $recommended_plugin ) { ?>
|
822 |
+
<li data-slug="<?php echo esc_attr( $recommended_plugin['slug'] ); ?>" data-main_file ="<?php echo esc_attr( isset($recommended_plugin['main_file'])?$recommended_plugin['main_file']: $recommended_plugin['slug'].'.php'); ?>">
|
823 |
+
<?php echo esc_html( $recommended_plugin['name'] ); ?>
|
824 |
+
</li>
|
825 |
+
<?php
|
826 |
+
}
|
827 |
+
}
|
828 |
+
else{
|
829 |
+
?>
|
830 |
+
<li id="ai-no-recommended-plugins"><?php esc_html_e( 'No Recommended Plugins','advanced-import' ); ?></li>
|
831 |
+
<?php
|
832 |
+
}
|
833 |
+
?>
|
834 |
+
</ul>
|
835 |
+
<?php
|
836 |
+
exit;
|
837 |
+
}
|
838 |
+
|
839 |
+
/**
|
840 |
+
* 3rd steps helper functions
|
841 |
+
* Get json from json file
|
842 |
+
*
|
843 |
+
* @param string $file
|
844 |
+
* @return mixed
|
845 |
+
*/
|
846 |
+
public function get_json_data_from_file( $file ) {
|
847 |
+
|
848 |
+
if( get_transient ($file)){
|
849 |
+
return get_transient ($file);
|
850 |
+
}
|
851 |
+
|
852 |
+
If( $this->current_template_type == 'array'){
|
853 |
+
$type = strtok($file, '.');
|
854 |
+
if( isset( $this->current_template_url[$type])){
|
855 |
+
$request = wp_remote_get($this->current_template_url[$type]);
|
856 |
+
$response = wp_remote_retrieve_body( $request );
|
857 |
+
$result = json_decode( $response, true );
|
858 |
+
set_transient($file, $result, 1000 );
|
859 |
+
return $result;
|
860 |
+
}
|
861 |
+
return array();
|
862 |
+
}
|
863 |
+
|
864 |
+
if ( is_file( ADVANCED_IMPORT_TEMP . basename( $file ) ) ) {
|
865 |
+
require_once( ABSPATH . 'wp-admin/includes/file.php' );
|
866 |
+
WP_Filesystem();
|
867 |
+
global $wp_filesystem;
|
868 |
+
$file_name = ADVANCED_IMPORT_TEMP . basename( $file );
|
869 |
+
if ( file_exists( $file_name ) ) {
|
870 |
+
$result = json_decode( $wp_filesystem->get_contents( $file_name ), true );
|
871 |
+
set_transient($file, $result, 1000 );
|
872 |
+
return $result;
|
873 |
+
}
|
874 |
+
}
|
875 |
+
return array();
|
876 |
+
}
|
877 |
+
|
878 |
+
public function get_main_content_json( ) {
|
879 |
+
return $this->get_json_data_from_file( 'content.json' );
|
880 |
+
}
|
881 |
+
public function get_widgets_json(){
|
882 |
+
return $this->get_json_data_from_file( 'widgets.json' );
|
883 |
+
}
|
884 |
+
|
885 |
+
public function get_theme_options_json( ) {
|
886 |
+
return $this->get_json_data_from_file( 'options.json' );
|
887 |
+
}
|
888 |
+
|
889 |
+
/*
|
890 |
+
* return array
|
891 |
+
*/
|
892 |
+
private function advanced_import_setup_content_steps() {
|
893 |
+
|
894 |
+
$content = array();
|
895 |
+
|
896 |
+
/*check if there is files*/
|
897 |
+
$content_data = $this->get_main_content_json();
|
898 |
+
foreach ( $content_data as $post_type => $post_data ) {
|
899 |
+
if ( count( $post_data ) ) {
|
900 |
+
$first = current( $post_data );
|
901 |
+
$post_type_title = ! empty( $first['type_title'] ) ? $first['type_title'] : ucwords( $post_type ) . 's';
|
902 |
+
$content[ $post_type ] = array(
|
903 |
+
'title' => $post_type_title,
|
904 |
+
'description' => sprintf( esc_html__( 'This will create default %s as seen in the demo.','advanced-import' ), $post_type_title ),
|
905 |
+
'pending' => esc_html__( 'Pending.','advanced-import'),
|
906 |
+
'installing' => esc_html__( 'Installing.','advanced-import' ),
|
907 |
+
'success' => esc_html__( 'Success.','advanced-import' ),
|
908 |
+
'install_callback' => array( $this, 'import_content_post_type_data' ),
|
909 |
+
'checked' => $this->is_possible_upgrade() ? 0 : 1,
|
910 |
+
// dont check if already have content installed.
|
911 |
+
);
|
912 |
+
}
|
913 |
+
}
|
914 |
+
/*check if there is files*/
|
915 |
+
$widget_data = $this->get_widgets_json();
|
916 |
+
if( !empty( $widget_data ) ){
|
917 |
+
$content['widgets'] = array(
|
918 |
+
'title' => esc_html__( 'Widgets','advanced-import' ),
|
919 |
+
'description' => esc_html__( 'Insert default sidebar widgets as seen in the demo.','advanced-import' ),
|
920 |
+
'pending' => esc_html__( 'Pending.','advanced-import' ),
|
921 |
+
'installing' => esc_html__( 'Installing Default Widgets.','advanced-import' ),
|
922 |
+
'success' => esc_html__( 'Success.' ,'advanced-import'),
|
923 |
+
'install_callback' => array( $this, 'import_content_widgets_data' ),
|
924 |
+
'checked' => $this->is_possible_upgrade() ? 0 : 1,
|
925 |
+
// dont check if already have content installed.
|
926 |
+
);
|
927 |
+
}
|
928 |
+
$options_data = $this->get_theme_options_json();
|
929 |
+
if( !empty( $options_data ) ){
|
930 |
+
$content['settings'] = array(
|
931 |
+
'title' => esc_html__( 'Settings','advanced-import' ),
|
932 |
+
'description' => esc_html__( 'Configure default settings.','advanced-import' ),
|
933 |
+
'pending' => esc_html__( 'Pending.','advanced-import' ),
|
934 |
+
'installing' => esc_html__( 'Installing Default Settings.' ,'advanced-import'),
|
935 |
+
'success' => esc_html__( 'Success.','advanced-import' ),
|
936 |
+
'install_callback' => array( $this, 'import_menu_and_options' ),
|
937 |
+
'checked' => $this->is_possible_upgrade() ? 0 : 1,
|
938 |
+
// dont check if already have content installed.
|
939 |
+
);
|
940 |
+
}
|
941 |
+
$content = apply_filters( $this->theme_name . '_theme_view_setup_step_content', $content );
|
942 |
+
|
943 |
+
return $content;
|
944 |
+
|
945 |
+
}
|
946 |
+
|
947 |
+
/**
|
948 |
+
* 3rd Step Step for content, widget, setting import
|
949 |
+
* Page setup
|
950 |
+
*/
|
951 |
+
public function content_screen() {
|
952 |
+
check_admin_referer( 'advanced-import' );
|
953 |
+
|
954 |
+
$this->current_template_url = is_array( $_POST['template_url'] )? (array) $_POST['template_url'] : sanitize_text_field( $_POST['template_url'] );
|
955 |
+
$this->current_template_type = sanitize_text_field( $_POST['template_type'] );
|
956 |
+
?>
|
957 |
+
<div class="ai-notification-title">
|
958 |
+
<p>
|
959 |
+
<?php
|
960 |
+
esc_html_e( 'It\'s time to insert some demo content for your new WordPress Site. Once inserted, this content can be managed from the WordPress admin dashboard. ' )
|
961 |
+
?>
|
962 |
+
</p>
|
963 |
+
</div>
|
964 |
+
|
965 |
+
<table class="ai-pages hidden">
|
966 |
+
<thead>
|
967 |
+
<tr>
|
968 |
+
<th class="check"></th>
|
969 |
+
<th class="item"><?php esc_html_e( 'Item','advanced-import'); ?></th>
|
970 |
+
<th class="description"><?php esc_html_e( 'Description','advanced-import' ); ?></th>
|
971 |
+
<th class="status"><?php esc_html_e( 'Status','advanced-import' ); ?></th>
|
972 |
+
</tr>
|
973 |
+
</thead>
|
974 |
+
<tbody>
|
975 |
+
<?php
|
976 |
+
$setup_content_steps = $this->advanced_import_setup_content_steps();
|
977 |
+
foreach ( $setup_content_steps as $slug => $default ) { ?>
|
978 |
+
<tr class="ai-available-content" data-content="<?php echo esc_attr( $slug ); ?>">
|
979 |
+
<td>
|
980 |
+
<input type="checkbox" name="import_content[<?php echo esc_attr( $slug ); ?>]" class="ai-available-content" id="import_content_<?php echo esc_attr( $slug ); ?>" value="1" <?php echo ( ! isset( $default['checked'] ) || $default['checked'] ) ? ' checked' : ''; ?>>
|
981 |
+
</td>
|
982 |
+
<td>
|
983 |
+
<label for="import_content_<?php echo esc_attr( $slug ); ?>">
|
984 |
+
<?php echo esc_html( $default['title'] ); ?>
|
985 |
+
</label>
|
986 |
+
</td>
|
987 |
+
<td class="description">
|
988 |
+
<?php echo esc_html( $default['description'] ); ?>
|
989 |
+
</td>
|
990 |
+
<td class="status">
|
991 |
+
<span>
|
992 |
+
<?php echo esc_html( $default['pending'] ); ?>
|
993 |
+
</span>
|
994 |
+
</td>
|
995 |
+
</tr>
|
996 |
+
<?php } ?>
|
997 |
+
</tbody>
|
998 |
+
</table>
|
999 |
+
|
1000 |
+
<?php
|
1001 |
+
exit;
|
1002 |
+
}
|
1003 |
+
|
1004 |
+
/*import ajax content
|
1005 |
+
* return JSON
|
1006 |
+
*/
|
1007 |
+
public function import_content() {
|
1008 |
+
$this->current_template_url = is_array( $_POST['template_url'] )? (array) $_POST['template_url'] : sanitize_text_field( $_POST['template_url'] );
|
1009 |
+
$this->current_template_type = sanitize_text_field ( $_POST['template_type'] );
|
1010 |
+
|
1011 |
+
$content_slug = isset( $_POST['content'] )? sanitize_title( $_POST['content'] ): '';
|
1012 |
+
|
1013 |
+
$content = $this->advanced_import_setup_content_steps();
|
1014 |
+
if ( ! check_ajax_referer( 'advanced_import_nonce', 'wpnonce' ) || empty( $content_slug ) || !isset( $content[ $content_slug ] ) ) {
|
1015 |
+
wp_send_json_error(
|
1016 |
+
array(
|
1017 |
+
'error' => 1,
|
1018 |
+
'message' => esc_html__( 'No content Found','advanced-import' )
|
1019 |
+
)
|
1020 |
+
);
|
1021 |
+
}
|
1022 |
+
|
1023 |
+
$json = false;
|
1024 |
+
$this_content = $content[ $content_slug ];
|
1025 |
+
|
1026 |
+
if ( isset( $_POST['proceed'] ) ) {
|
1027 |
+
|
1028 |
+
/*install the content*/
|
1029 |
+
$this->log( esc_html__( 'Starting import for ','advanced-import') . $content_slug );
|
1030 |
+
|
1031 |
+
/*init delayed posts from transient.*/
|
1032 |
+
$this->delay_posts = get_transient( 'delayed_posts' );
|
1033 |
+
if ( ! is_array( $this->delay_posts ) ) {
|
1034 |
+
$this->delay_posts = array();
|
1035 |
+
}
|
1036 |
+
|
1037 |
+
if ( ! empty( $this_content['install_callback'] ) ) {
|
1038 |
+
/* install_callback includes following functions
|
1039 |
+
* import_content_post_type_data
|
1040 |
+
* import_content_widgets_data
|
1041 |
+
* import_menu_and_options
|
1042 |
+
* */
|
1043 |
+
if ( $result = call_user_func( $this_content['install_callback'] ) ) {
|
1044 |
+
|
1045 |
+
$this->log( esc_html__( 'Finish writing ','advanced-import' ) . count( $this->delay_posts, COUNT_RECURSIVE ) . esc_html__(' delayed posts to transient ','advanced-import') );
|
1046 |
+
set_transient( 'delayed_posts', $this->delay_posts, 60 * 60 * 24 );
|
1047 |
+
|
1048 |
+
/*if there is retry, retry it
|
1049 |
+
or finish it*/
|
1050 |
+
if ( is_array( $result ) && isset( $result['retry'] ) ) {
|
1051 |
+
/*we split the stuff up again.*/
|
1052 |
+
$json = array(
|
1053 |
+
'url' => admin_url( 'admin-ajax.php' ),
|
1054 |
+
'action' => 'import_content',
|
1055 |
+
'proceed' => 'true',
|
1056 |
+
'retry' => time(),
|
1057 |
+
'retry_count' => $result['retry_count'],
|
1058 |
+
'content' => $content_slug,
|
1059 |
+
'_wpnonce' => wp_create_nonce( 'advanced_import_nonce' ),
|
1060 |
+
'message' => $this_content['installing'],
|
1061 |
+
'logs' => $this->logs,
|
1062 |
+
'errors' => $this->errors,
|
1063 |
+
'template_url' => $this->current_template_url,
|
1064 |
+
'template_type' => $this->current_template_type,
|
1065 |
+
|
1066 |
+
);
|
1067 |
+
}
|
1068 |
+
else {
|
1069 |
+
$json = array(
|
1070 |
+
'done' => 1,
|
1071 |
+
'message' => $this_content['success'],
|
1072 |
+
'debug' => $result,
|
1073 |
+
'logs' => $this->logs,
|
1074 |
+
'errors' => $this->errors,
|
1075 |
+
);
|
1076 |
+
}
|
1077 |
+
}
|
1078 |
+
}
|
1079 |
+
}
|
1080 |
+
else {
|
1081 |
+
|
1082 |
+
$json = array(
|
1083 |
+
'url' => admin_url( 'admin-ajax.php' ),
|
1084 |
+
'action' => 'import_content',
|
1085 |
+
'proceed' => 'true',
|
1086 |
+
'content' => $content_slug,
|
1087 |
+
'_wpnonce' => wp_create_nonce( 'advanced_import_nonce' ),
|
1088 |
+
'message' => $this_content['installing'],
|
1089 |
+
'logs' => $this->logs,
|
1090 |
+
'errors' => $this->errors,
|
1091 |
+
'template_url' => $this->current_template_url,
|
1092 |
+
'template_type' => $this->current_template_type,
|
1093 |
+
);
|
1094 |
+
}
|
1095 |
+
|
1096 |
+
if ( $json ) {
|
1097 |
+
$json['hash'] = md5( serialize( $json ) ); /*used for checking if duplicates happen, move to next plugin*/
|
1098 |
+
wp_send_json( $json );
|
1099 |
+
}
|
1100 |
+
else {
|
1101 |
+
wp_send_json_error( array(
|
1102 |
+
'message' => esc_html__( 'Error','advanced-import' ),
|
1103 |
+
'logs' => $this->logs,
|
1104 |
+
'errors' => $this->errors,
|
1105 |
+
) );
|
1106 |
+
}
|
1107 |
+
exit;
|
1108 |
+
}
|
1109 |
+
|
1110 |
+
/* callback function to importing post type
|
1111 |
+
* all post type is imported from here
|
1112 |
+
* return mix
|
1113 |
+
* */
|
1114 |
+
private function import_content_post_type_data() {
|
1115 |
+
$post_type = ! empty( $_POST['content'] ) ? sanitize_text_field( $_POST['content'] ) : false;
|
1116 |
+
$all_data = $this->get_main_content_json();
|
1117 |
+
if ( ! $post_type || ! isset( $all_data[ $post_type ] ) ) {
|
1118 |
+
return false;
|
1119 |
+
}
|
1120 |
+
|
1121 |
+
/*Import 10 posts at a time*/
|
1122 |
+
$limit = 10 + ( isset( $_REQUEST['retry_count'] ) ? (int) $_REQUEST['retry_count'] : 0 );
|
1123 |
+
|
1124 |
+
$limit = apply_filters('advanced_import_limit_at_time', $limit );
|
1125 |
+
$x = 0;
|
1126 |
+
foreach ( $all_data[ $post_type ] as $post_data ) {
|
1127 |
+
|
1128 |
+
$this->process_import_single_post( $post_type, $post_data );
|
1129 |
+
|
1130 |
+
if ( $x ++ > $limit ) {
|
1131 |
+
return array(
|
1132 |
+
'retry' => 1,
|
1133 |
+
'retry_count' => $limit
|
1134 |
+
);
|
1135 |
+
}
|
1136 |
+
}
|
1137 |
+
|
1138 |
+
/*processed delayed posts*/
|
1139 |
+
$this->process_delayed_posts();
|
1140 |
+
|
1141 |
+
/*process child posts*/
|
1142 |
+
$this->processpost_orphans();
|
1143 |
+
|
1144 |
+
return true;
|
1145 |
+
|
1146 |
+
}
|
1147 |
+
|
1148 |
+
/*set and get transient imported_term_ids
|
1149 |
+
return mix*/
|
1150 |
+
private function imported_term_id( $original_term_id, $new_term_id = false ) {
|
1151 |
+
$terms = get_transient( 'imported_term_ids' );
|
1152 |
+
if ( ! is_array( $terms ) ) {
|
1153 |
+
$terms = array();
|
1154 |
+
}
|
1155 |
+
if ( $new_term_id ) {
|
1156 |
+
if ( ! isset( $terms[ $original_term_id ] ) ) {
|
1157 |
+
$this->log( esc_html__('Insert old TERM ID ','advanced-import') . $original_term_id .esc_html__(' as new TERM ID: ' ,'advanced-import'). $new_term_id );
|
1158 |
+
}
|
1159 |
+
else if ( $terms[ $original_term_id ] != $new_term_id ) {
|
1160 |
+
$this->error( 'Replacement OLD TERM ID ' . $original_term_id . ' overwritten by new TERM ID: ' . $new_term_id );
|
1161 |
+
}
|
1162 |
+
$terms[ $original_term_id ] = $new_term_id;
|
1163 |
+
set_transient( 'imported_term_ids', $terms, 60 * 60 * 24 );
|
1164 |
+
}
|
1165 |
+
else if ( $original_term_id && isset( $terms[ $original_term_id ] ) ) {
|
1166 |
+
return $terms[ $original_term_id ];
|
1167 |
+
}
|
1168 |
+
|
1169 |
+
return false;
|
1170 |
+
}
|
1171 |
+
|
1172 |
+
/*set and get imported_post_ids
|
1173 |
+
return mix*/
|
1174 |
+
private function imported_post_id( $original_id = false, $new_id = false ) {
|
1175 |
+
if ( is_array( $original_id ) || is_object( $original_id ) ) {
|
1176 |
+
return false;
|
1177 |
+
}
|
1178 |
+
$post_ids = get_transient( 'imported_post_ids' );
|
1179 |
+
if ( ! is_array( $post_ids ) ) {
|
1180 |
+
$post_ids = array();
|
1181 |
+
}
|
1182 |
+
if ( $new_id ) {
|
1183 |
+
if ( ! isset( $post_ids[ $original_id ] ) ) {
|
1184 |
+
$this->log( esc_html__('Insert old ID ','advanced-import') . $original_id . esc_html__(' as new ID: ','advanced-import') . $new_id );
|
1185 |
+
}
|
1186 |
+
else if ( $post_ids[ $original_id ] != $new_id ) {
|
1187 |
+
$this->error( esc_html__('Replacement OLD ID ','advanced-import'). $original_id . ' overwritten by new ID: ' . $new_id );
|
1188 |
+
}
|
1189 |
+
$post_ids[ $original_id ] = $new_id;
|
1190 |
+
set_transient( 'imported_post_ids', $post_ids, 60 * 60 * 24 );
|
1191 |
+
}
|
1192 |
+
else if ( $original_id && isset( $post_ids[ $original_id ] ) ) {
|
1193 |
+
return $post_ids[ $original_id ];
|
1194 |
+
}
|
1195 |
+
else if ( $original_id === false ) {
|
1196 |
+
return $post_ids;
|
1197 |
+
}
|
1198 |
+
return false;
|
1199 |
+
}
|
1200 |
+
|
1201 |
+
/*set and get post_orphans/post parent
|
1202 |
+
if parent is not already imported the child will be orphan
|
1203 |
+
return mix*/
|
1204 |
+
private function post_orphans( $original_id = false, $missing_parent_id = false ) {
|
1205 |
+
$post_ids = get_transient( 'post_orphans' );
|
1206 |
+
if ( ! is_array( $post_ids ) ) {
|
1207 |
+
$post_ids = array();
|
1208 |
+
}
|
1209 |
+
if ( $missing_parent_id ) {
|
1210 |
+
$post_ids[ $original_id ] = $missing_parent_id;
|
1211 |
+
set_transient( 'post_orphans', $post_ids, 60 * 60 * 24 );
|
1212 |
+
}
|
1213 |
+
else if ( $original_id && isset( $post_ids[ $original_id ] ) ) {
|
1214 |
+
return $post_ids[ $original_id ];
|
1215 |
+
}
|
1216 |
+
else if ( $original_id === false ) {
|
1217 |
+
return $post_ids;
|
1218 |
+
}
|
1219 |
+
return false;
|
1220 |
+
}
|
1221 |
+
|
1222 |
+
|
1223 |
+
/*set delayed post for later process*/
|
1224 |
+
private function delay_post_process( $post_type, $post_data ) {
|
1225 |
+
if ( ! isset( $this->delay_posts[$post_type] ) ) {
|
1226 |
+
$this->delay_posts[ $post_type ] = array();
|
1227 |
+
}
|
1228 |
+
$this->delay_posts[ $post_type ][ $post_data['post_id'] ] = $post_data;
|
1229 |
+
}
|
1230 |
+
|
1231 |
+
|
1232 |
+
/*return the difference in length between two strings
|
1233 |
+
https://www.w3schools.com/php/func_array_uksort.asp
|
1234 |
+
used in method parse_content_for_shortcode_image_etc
|
1235 |
+
*/
|
1236 |
+
public function uksort_strlen( $a, $b ) {
|
1237 |
+
return strlen( $b ) - strlen( $a );
|
1238 |
+
}
|
1239 |
+
|
1240 |
+
/*Important Function
|
1241 |
+
Import single Post/Content
|
1242 |
+
*/
|
1243 |
+
private function process_import_single_post( $post_type, $post_data, $delayed = 0 ) {
|
1244 |
+
|
1245 |
+
$this->log( esc_html__('Processing ','advanced-import' ) .$post_type.' '.$post_data['post_id'] );
|
1246 |
+
$original_post_data = $post_data;
|
1247 |
+
|
1248 |
+
/*if there is not post type return false*/
|
1249 |
+
if ( ! post_type_exists( $post_type ) ) {
|
1250 |
+
return false;
|
1251 |
+
}
|
1252 |
+
|
1253 |
+
/*if it is aready imported return*/
|
1254 |
+
if ( $this->imported_post_id( $post_data['post_id'] ) ) {
|
1255 |
+
return true; /*already done*/
|
1256 |
+
}
|
1257 |
+
|
1258 |
+
/*set post_name id for empty post name/title*/
|
1259 |
+
if ( empty( $post_data['post_title'] ) && empty( $post_data['post_name'] ) ) {
|
1260 |
+
$post_data['post_name'] = $post_data['post_id'];
|
1261 |
+
}
|
1262 |
+
|
1263 |
+
/*set post_type on $post_data*/
|
1264 |
+
$post_data['post_type'] = $post_type;
|
1265 |
+
|
1266 |
+
/*post_orphans/post parent management */
|
1267 |
+
$post_parent = isset( $post_data['post_parent'] )?absint( $post_data['post_parent'] ):false;
|
1268 |
+
if ( $post_parent ) {
|
1269 |
+
/*if we already know the parent, map it to the new local imported ID*/
|
1270 |
+
if ( $this->imported_post_id( $post_parent ) ) {
|
1271 |
+
$post_data['post_parent'] = $this->imported_post_id( $post_parent );
|
1272 |
+
}
|
1273 |
+
else {
|
1274 |
+
/*if there is not parent imported, child will be orphans*/
|
1275 |
+
$this->post_orphans( absint( $post_data['post_id'] ), $post_parent );
|
1276 |
+
$post_data['post_parent'] = 0;
|
1277 |
+
}
|
1278 |
+
}
|
1279 |
+
|
1280 |
+
/*check if already exists by post_name*/
|
1281 |
+
if ( empty( $post_data['post_title'] ) && ! empty( $post_data['post_name'] ) ) {
|
1282 |
+
global $wpdb;
|
1283 |
+
$sql = "
|
1284 |
+
SELECT ID, post_name, post_parent, post_type
|
1285 |
+
FROM $wpdb->posts
|
1286 |
+
WHERE post_name = %s
|
1287 |
+
AND post_type = %s
|
1288 |
+
";
|
1289 |
+
$pages = $wpdb->get_results( $wpdb->prepare( $sql, array(
|
1290 |
+
$post_data['post_name'],
|
1291 |
+
$post_type,
|
1292 |
+
) ), OBJECT_K );
|
1293 |
+
|
1294 |
+
$foundid = 0;
|
1295 |
+
foreach ( (array) $pages as $page ) {
|
1296 |
+
if ( $page->post_name == $post_data['post_name'] && empty( $page->post_title ) ) {
|
1297 |
+
$foundid = $page->ID;
|
1298 |
+
}
|
1299 |
+
}
|
1300 |
+
|
1301 |
+
/*if we have found id by post_name, imported_post_id and return*/
|
1302 |
+
if ( $foundid ) {
|
1303 |
+
$this->imported_post_id( $post_data['post_id'], $foundid );
|
1304 |
+
return true;
|
1305 |
+
}
|
1306 |
+
}
|
1307 |
+
|
1308 |
+
/*check if already exists by post_name and post_title*/
|
1309 |
+
/*don't use post_exists because it will dupe up on media with same name but different slug*/
|
1310 |
+
if ( ! empty( $post_data['post_title'] ) && ! empty( $post_data['post_name'] ) ) {
|
1311 |
+
global $wpdb;
|
1312 |
+
$sql = "
|
1313 |
+
SELECT ID, post_name, post_parent, post_type
|
1314 |
+
FROM $wpdb->posts
|
1315 |
+
WHERE post_name = %s
|
1316 |
+
AND post_title = %s
|
1317 |
+
AND post_type = %s
|
1318 |
+
";
|
1319 |
+
$pages = $wpdb->get_results( $wpdb->prepare( $sql, array(
|
1320 |
+
$post_data['post_name'],
|
1321 |
+
$post_data['post_title'],
|
1322 |
+
$post_type,
|
1323 |
+
) ), OBJECT_K );
|
1324 |
+
|
1325 |
+
$foundid = 0;
|
1326 |
+
foreach ( (array) $pages as $page ) {
|
1327 |
+
if ( $page->post_name == $post_data['post_name'] ) {
|
1328 |
+
$foundid = $page->ID;
|
1329 |
+
}
|
1330 |
+
}
|
1331 |
+
|
1332 |
+
/*if we have found id by post_name and post_title, imported_post_id and return*/
|
1333 |
+
if ( $foundid ) {
|
1334 |
+
$this->imported_post_id( $post_data['post_id'], $foundid );
|
1335 |
+
return true;
|
1336 |
+
}
|
1337 |
+
}
|
1338 |
+
|
1339 |
+
/*
|
1340 |
+
* todo it may not required
|
1341 |
+
* backwards compat with old import format.*/
|
1342 |
+
if ( isset( $post_data['meta'] ) ) {
|
1343 |
+
foreach ( $post_data['meta'] as $key => $meta ) {
|
1344 |
+
if(is_array($meta) && count($meta) == 1){
|
1345 |
+
$single_meta = current($meta);
|
1346 |
+
if(!is_array($single_meta)){
|
1347 |
+
$post_data['meta'][$key] = $single_meta;
|
1348 |
+
}
|
1349 |
+
}
|
1350 |
+
}
|
1351 |
+
}
|
1352 |
+
|
1353 |
+
/*finally process*/
|
1354 |
+
switch ( $post_type ) {
|
1355 |
+
|
1356 |
+
/*case attachment*/
|
1357 |
+
case 'attachment':
|
1358 |
+
|
1359 |
+
/*import media via url*/
|
1360 |
+
if ( isset( $post_data['guid'] ) && ! empty( $post_data['guid'] ) ) {
|
1361 |
+
|
1362 |
+
/*check if this has already been imported.*/
|
1363 |
+
$old_guid = $post_data['guid'];
|
1364 |
+
if ( $this->imported_post_id( $old_guid ) ) {
|
1365 |
+
return true; /*already done*/
|
1366 |
+
}
|
1367 |
+
|
1368 |
+
// ignore post parent, we haven't imported those yet.
|
1369 |
+
// $file_data = wp_remote_get($post_data['guid']);
|
1370 |
+
$remote_url = $post_data['guid'];
|
1371 |
+
|
1372 |
+
$post_data['upload_date'] = date( 'Y/m', strtotime( $post_data['post_date_gmt'] ) );
|
1373 |
+
|
1374 |
+
if ( isset( $post_data['meta'] ) ) {
|
1375 |
+
foreach ( $post_data['meta'] as $key => $meta ) {
|
1376 |
+
if ( $key == '_wp_attached_file' ) {
|
1377 |
+
foreach ( (array) $meta as $meta_val ) {
|
1378 |
+
if ( preg_match( '%^[0-9]{4}/[0-9]{2}%', $meta_val, $matches ) ) {
|
1379 |
+
$post_data['upload_date'] = $matches[0];
|
1380 |
+
}
|
1381 |
+
}
|
1382 |
+
}
|
1383 |
+
}
|
1384 |
+
}
|
1385 |
+
|
1386 |
+
/*upload the file*/
|
1387 |
+
$upload = $this->import_image_and_file( $remote_url, $post_data );
|
1388 |
+
|
1389 |
+
/*if error on upload*/
|
1390 |
+
if ( ! is_array( $upload ) || is_wp_error( $upload ) ) {
|
1391 |
+
/*todo: error*/
|
1392 |
+
return false;
|
1393 |
+
}
|
1394 |
+
|
1395 |
+
/*check file type, if file type not found return false*/
|
1396 |
+
if ( $info = wp_check_filetype( $upload['file'] ) ) {
|
1397 |
+
$post_data['post_mime_type'] = $info['type'];
|
1398 |
+
}
|
1399 |
+
else {
|
1400 |
+
return false;
|
1401 |
+
}
|
1402 |
+
|
1403 |
+
/*set guid file url*/
|
1404 |
+
$post_data['guid'] = $upload['url'];
|
1405 |
+
|
1406 |
+
/*
|
1407 |
+
* insert attachment
|
1408 |
+
*https://developer.wordpress.org/reference/functions/wp_insert_attachment/
|
1409 |
+
* */
|
1410 |
+
$attach_id = wp_insert_attachment( $post_data, $upload['file'] );
|
1411 |
+
if( $attach_id ) {
|
1412 |
+
|
1413 |
+
/*update meta*/
|
1414 |
+
if ( ! empty( $post_data['meta'] ) ) {
|
1415 |
+
foreach ( $post_data['meta'] as $meta_key => $meta_val ) {
|
1416 |
+
if( $meta_key != '_wp_attached_file' && !empty( $meta_val ) ) {
|
1417 |
+
update_post_meta( $attach_id, $meta_key, $meta_val );
|
1418 |
+
}
|
1419 |
+
}
|
1420 |
+
}
|
1421 |
+
/* Update metadata for an attachment.*/
|
1422 |
+
wp_update_attachment_metadata( $attach_id, wp_generate_attachment_metadata( $attach_id, $upload['file'] ) );
|
1423 |
+
|
1424 |
+
/*remap resized image URLs, works by stripping the extension and remapping the URL stub.*/
|
1425 |
+
if ( preg_match( '!^image/!', $info['type'] ) ) {
|
1426 |
+
$parts = pathinfo( $remote_url );
|
1427 |
+
$name = basename( $parts['basename'], ".{$parts['extension']}" ); // PATHINFO_FILENAME in PHP 5.2
|
1428 |
+
|
1429 |
+
$parts_new = pathinfo( $upload['url'] );
|
1430 |
+
$name_new = basename( $parts_new['basename'], ".{$parts_new['extension']}" );
|
1431 |
+
|
1432 |
+
$this->imported_post_id( $parts['dirname'] . '/' . $name, $parts_new['dirname'] . '/' . $name_new );
|
1433 |
+
}
|
1434 |
+
$this->imported_post_id( $post_data['post_id'], $attach_id );
|
1435 |
+
}
|
1436 |
+
}
|
1437 |
+
break;
|
1438 |
+
|
1439 |
+
default:
|
1440 |
+
|
1441 |
+
/*Process Post Meta*/
|
1442 |
+
if ( ! empty( $post_data['meta'] ) && is_array( $post_data['meta'] ) ) {
|
1443 |
+
|
1444 |
+
/*fix for double json encoded stuff*/
|
1445 |
+
foreach ( $post_data['meta'] as $meta_key => $meta_val ) {
|
1446 |
+
if ( is_string( $meta_val ) && strlen( $meta_val ) && $meta_val[0] == '[' ) {
|
1447 |
+
$test_json = @json_decode( $meta_val, true );
|
1448 |
+
if ( is_array( $test_json ) ) {
|
1449 |
+
$post_data['meta'][ $meta_key ] = $test_json;
|
1450 |
+
}
|
1451 |
+
}
|
1452 |
+
}
|
1453 |
+
/*todo gutenberg and page builders*/
|
1454 |
+
|
1455 |
+
/*replace menu data
|
1456 |
+
work out what we're replacing. a tax, page, term etc..*/
|
1457 |
+
//
|
1458 |
+
if( isset( $post_data['meta']['_menu_item_menu_item_parent'] ) && 0 != $post_data['meta']['_menu_item_menu_item_parent'] ) {
|
1459 |
+
$new_parent_id = $this->imported_post_id( $post_data['meta']['_menu_item_menu_item_parent'] );
|
1460 |
+
if( !$new_parent_id ) {
|
1461 |
+
if ( $delayed ) {
|
1462 |
+
/*already delayed, unable to find this meta value, skip inserting it*/
|
1463 |
+
$this->error( esc_html__('Unable to find replacement. Continue anyway.... content will most likely break..','advanced-import') );
|
1464 |
+
}
|
1465 |
+
else {
|
1466 |
+
/*not found , delay it*/
|
1467 |
+
$this->error( esc_html__('Unable to find replacement. Delaying....','advanced-import') );
|
1468 |
+
$this->delay_post_process( $post_type, $original_post_data );
|
1469 |
+
return false;
|
1470 |
+
}
|
1471 |
+
}
|
1472 |
+
$post_data['meta']['_menu_item_menu_item_parent'] = $new_parent_id;
|
1473 |
+
}
|
1474 |
+
|
1475 |
+
/*if _menu_item_type*/
|
1476 |
+
if( isset( $post_data['meta'][ '_menu_item_type' ] ) ){
|
1477 |
+
|
1478 |
+
switch( $post_data['meta'][ '_menu_item_type' ] ){
|
1479 |
+
case 'post_type':
|
1480 |
+
if( !empty( $post_data['meta']['_menu_item_object_id'] ) ) {
|
1481 |
+
$new_parent_id = $this->imported_post_id( $post_data['meta']['_menu_item_object_id'] );
|
1482 |
+
if( !$new_parent_id ) {
|
1483 |
+
if ( $delayed ) {
|
1484 |
+
/*already delayed, unable to find this meta value, skip inserting it*/
|
1485 |
+
$this->error( esc_html__('Unable to find replacement. Continue anyway.... content will most likely break..','advanced-import') );
|
1486 |
+
}
|
1487 |
+
else {
|
1488 |
+
/*not found , delay it*/
|
1489 |
+
$this->error( esc_html__('Unable to find replacement. Delaying....','advanced-import') );
|
1490 |
+
$this->delay_post_process( $post_type, $original_post_data );
|
1491 |
+
return false;
|
1492 |
+
}
|
1493 |
+
}
|
1494 |
+
$post_data['meta']['_menu_item_object_id'] = $new_parent_id;
|
1495 |
+
}
|
1496 |
+
break;
|
1497 |
+
|
1498 |
+
case 'taxonomy':
|
1499 |
+
if( !empty( $post_data['meta']['_menu_item_object_id'] ) ) {
|
1500 |
+
$new_parent_id = $this->imported_term_id( $post_data['meta']['_menu_item_object_id'] );
|
1501 |
+
if(!$new_parent_id) {
|
1502 |
+
if ( $delayed ) {
|
1503 |
+
/*already delayed, unable to find this meta value, skip inserting it*/
|
1504 |
+
$this->error( esc_html__('Unable to find replacement. Continue anyway.... content will most likely break..','advanced-import') );
|
1505 |
+
}
|
1506 |
+
else {
|
1507 |
+
/*not found , delay it*/
|
1508 |
+
$this->error( esc_html__('Unable to find replacement. Delaying....','advanced-import') );
|
1509 |
+
$this->delay_post_process( $post_type, $original_post_data );
|
1510 |
+
return false;
|
1511 |
+
}
|
1512 |
+
}
|
1513 |
+
$post_data['meta']['_menu_item_object_id'] = $new_parent_id;
|
1514 |
+
}
|
1515 |
+
break;
|
1516 |
+
}
|
1517 |
+
}
|
1518 |
+
}
|
1519 |
+
|
1520 |
+
/*post content parser*/
|
1521 |
+
$post_data['post_content'] = $this->parse_content_for_shortcode_image_etc( $post_data['post_content'] );
|
1522 |
+
|
1523 |
+
$replace_tax_id_keys = array(
|
1524 |
+
'taxonomies',
|
1525 |
+
);
|
1526 |
+
foreach ( $replace_tax_id_keys as $replace_key ) {
|
1527 |
+
if ( preg_match_all( '# ' . $replace_key . '="(\d+)"#', $post_data['post_content'], $matches ) ) {
|
1528 |
+
foreach ( $matches[0] as $match_id => $string ) {
|
1529 |
+
$new_id = $this->imported_term_id( $matches[1][ $match_id ] );
|
1530 |
+
if ( $new_id ) {
|
1531 |
+
$post_data['post_content'] = str_replace( $string, ' ' . $replace_key . '="' . $new_id . '"', $post_data['post_content'] );
|
1532 |
+
}
|
1533 |
+
else {
|
1534 |
+
$this->error( esc_html__('Unable to find TAXONOMY replacement for ','advanced-import' ) . $replace_key . '="' . $matches[1][ $match_id ]. esc_html__('in content.','advanced-import') );
|
1535 |
+
if ( $delayed ) {
|
1536 |
+
/*already delayed, unable to find this meta value, skip inserting it*/
|
1537 |
+
$this->error( esc_html__('Unable to find replacement. Continue anyway.... content will most likely break..','advanced-import') );
|
1538 |
+
}
|
1539 |
+
else {
|
1540 |
+
/*not found , delay it*/
|
1541 |
+
$this->delay_post_process( $post_type, $original_post_data );
|
1542 |
+
return false;
|
1543 |
+
}
|
1544 |
+
}
|
1545 |
+
}
|
1546 |
+
}
|
1547 |
+
}
|
1548 |
+
|
1549 |
+
/*do further filter if you need*/
|
1550 |
+
$post_data = apply_filters('advanced_import_post_data',$post_data );
|
1551 |
+
|
1552 |
+
/*finally insert post data*/
|
1553 |
+
$post_id = wp_insert_post( $post_data, true );
|
1554 |
+
if ( ! is_wp_error( $post_id ) ) {
|
1555 |
+
|
1556 |
+
/*set id on imported_post_id*/
|
1557 |
+
$this->imported_post_id( $post_data['post_id'], $post_id );
|
1558 |
+
|
1559 |
+
/*add/update post meta*/
|
1560 |
+
if ( ! empty( $post_data['meta'] ) ) {
|
1561 |
+
foreach ( $post_data['meta'] as $meta_key => $meta_val ) {
|
1562 |
+
/*if the post has a featured image, take note of this in case of remap*/
|
1563 |
+
if ( '_thumbnail_id' == $meta_key ) {
|
1564 |
+
/*find this inserted id and use that instead.*/
|
1565 |
+
$inserted_id = $this->imported_post_id( intval( $meta_val ) );
|
1566 |
+
if ( $inserted_id ) {
|
1567 |
+
$meta_val = $inserted_id;
|
1568 |
+
}
|
1569 |
+
}
|
1570 |
+
/*update meta*/
|
1571 |
+
update_post_meta( $post_id, $meta_key, $meta_val );
|
1572 |
+
}
|
1573 |
+
}
|
1574 |
+
|
1575 |
+
if ( ! empty( $post_data['terms'] ) ) {
|
1576 |
+
$terms_to_set = array();
|
1577 |
+
foreach ( $post_data['terms'] as $term_slug => $terms ) {
|
1578 |
+
foreach ( $terms as $term ) {
|
1579 |
+
$taxonomy = $term['taxonomy'];
|
1580 |
+
if ( taxonomy_exists( $taxonomy ) ) {
|
1581 |
+
$term_exists = term_exists( $term['slug'], $taxonomy );
|
1582 |
+
$term_id = is_array( $term_exists ) ? $term_exists['term_id'] : $term_exists;
|
1583 |
+
if ( ! $term_id ) {
|
1584 |
+
if ( ! empty( $term['parent'] ) ) {
|
1585 |
+
/*see if we have imported this yet?*/
|
1586 |
+
$term['parent'] = $this->imported_term_id( $term['parent'] );
|
1587 |
+
}
|
1588 |
+
$term_id_tax_id = wp_insert_term( $term['name'], $taxonomy, $term );
|
1589 |
+
if ( ! is_wp_error( $term_id_tax_id ) ) {
|
1590 |
+
$term_id = $term_id_tax_id['term_id'];
|
1591 |
+
}
|
1592 |
+
else {
|
1593 |
+
// todo - error
|
1594 |
+
continue;
|
1595 |
+
}
|
1596 |
+
}
|
1597 |
+
/*set term_id on imported_term_id*/
|
1598 |
+
$this->imported_term_id( $term['term_id'], $term_id );
|
1599 |
+
|
1600 |
+
/*add the term meta.*/
|
1601 |
+
if( $term_id && !empty( $term['meta'] ) && is_array( $term['meta'] ) ){
|
1602 |
+
foreach( $term['meta'] as $meta_key => $meta_val ){
|
1603 |
+
// we have to replace certain meta_key/meta_val
|
1604 |
+
// e.g. thumbnail id from woocommerce product categories.
|
1605 |
+
switch( $meta_key ){
|
1606 |
+
case 'thumbnail_id':
|
1607 |
+
if( $new_meta_val = $this->imported_post_id($meta_val) ){
|
1608 |
+
/*use this new id.*/
|
1609 |
+
$meta_val = $new_meta_val;
|
1610 |
+
}
|
1611 |
+
break;
|
1612 |
+
}
|
1613 |
+
update_term_meta( $term_id, $meta_key, $meta_val );
|
1614 |
+
}
|
1615 |
+
}
|
1616 |
+
$terms_to_set[ $taxonomy ][] = intval( $term_id );
|
1617 |
+
}
|
1618 |
+
}
|
1619 |
+
}
|
1620 |
+
foreach ( $terms_to_set as $tax => $ids ) {
|
1621 |
+
wp_set_post_terms( $post_id, $ids, $tax );
|
1622 |
+
}
|
1623 |
+
}
|
1624 |
+
}
|
1625 |
+
break;
|
1626 |
+
}
|
1627 |
+
|
1628 |
+
return true;
|
1629 |
+
}
|
1630 |
+
|
1631 |
+
/*helper function for post content
|
1632 |
+
return modified content*/
|
1633 |
+
private function parse_content_for_shortcode_image_etc( $content ){
|
1634 |
+
/*we have to format the post content. rewriting images and gallery stuff*/
|
1635 |
+
$replace = $this->imported_post_id();
|
1636 |
+
|
1637 |
+
/*filters urls for replace*/
|
1638 |
+
$urls_replace = array();
|
1639 |
+
foreach ( $replace as $key => $val ) {
|
1640 |
+
if ( $key && $val && ! is_numeric( $key ) && ! is_numeric( $val ) ) {
|
1641 |
+
$urls_replace[ $key ] = $val;
|
1642 |
+
}
|
1643 |
+
}
|
1644 |
+
/*replace image/file urls*/
|
1645 |
+
if ( $urls_replace ) {
|
1646 |
+
uksort( $urls_replace, array( &$this, 'uksort_strlen' ) );
|
1647 |
+
foreach ( $urls_replace as $from_url => $to_url ) {
|
1648 |
+
$content = str_replace( $from_url, $to_url, $content );
|
1649 |
+
}
|
1650 |
+
}
|
1651 |
+
|
1652 |
+
/*gallery fixed*/
|
1653 |
+
if ( preg_match_all( '#\[gallery[^\]]*\]#', $content, $matches ) ) {
|
1654 |
+
foreach ( $matches[0] as $match_id => $string ) {
|
1655 |
+
if ( preg_match( '#ids="([^"]+)"#', $string, $ids_matches ) ) {
|
1656 |
+
$ids = explode( ',', $ids_matches[1] );
|
1657 |
+
foreach ( $ids as $key => $val ) {
|
1658 |
+
$new_id = $val ? $this->imported_post_id( $val ) : false;
|
1659 |
+
if ( ! $new_id ) {
|
1660 |
+
unset( $ids[ $key ] );
|
1661 |
+
}
|
1662 |
+
else {
|
1663 |
+
$ids[ $key ] = $new_id;
|
1664 |
+
}
|
1665 |
+
}
|
1666 |
+
$new_ids = implode( ',', $ids );
|
1667 |
+
$content = str_replace( $ids_matches[0], 'ids="' . $new_ids . '"', $content );
|
1668 |
+
}
|
1669 |
+
}
|
1670 |
+
}
|
1671 |
+
|
1672 |
+
/*contact form 7 id fixes.*/
|
1673 |
+
if ( preg_match_all( '#\[contact-form-7[^\]]*\]#', $content, $matches ) ) {
|
1674 |
+
foreach ( $matches[0] as $match_id => $string ) {
|
1675 |
+
if ( preg_match( '#id="(\d+)"#', $string, $id_match ) ) {
|
1676 |
+
$new_id = $this->imported_post_id( $id_match[1] );
|
1677 |
+
if ( $new_id ) {
|
1678 |
+
$content = str_replace( $id_match[0], 'id="' . $new_id . '"', $content );
|
1679 |
+
}
|
1680 |
+
else {
|
1681 |
+
/*no imported ID found. remove this entry.*/
|
1682 |
+
$content = str_replace( $matches[0], '(insert contact form here)', $content );
|
1683 |
+
}
|
1684 |
+
}
|
1685 |
+
}
|
1686 |
+
}
|
1687 |
+
return $content;
|
1688 |
+
}
|
1689 |
+
|
1690 |
+
/*update parent page id for child page*/
|
1691 |
+
private function processpost_orphans() {
|
1692 |
+
|
1693 |
+
/*get post orphans to find it parent*/
|
1694 |
+
$orphans = $this->post_orphans();
|
1695 |
+
foreach ( $orphans as $original_post_id => $original_post_parent_id ) {
|
1696 |
+
if ( $original_post_parent_id ) {
|
1697 |
+
if ( $this->imported_post_id( $original_post_id ) && $this->imported_post_id( $original_post_parent_id ) ) {
|
1698 |
+
$post_data = array();
|
1699 |
+
$post_data['ID'] = $this->imported_post_id( $original_post_id );
|
1700 |
+
$post_data['post_parent'] = $this->imported_post_id( $original_post_parent_id );
|
1701 |
+
wp_update_post( $post_data );
|
1702 |
+
$this->post_orphans( $original_post_id, 0 ); /*ignore future*/
|
1703 |
+
}
|
1704 |
+
}
|
1705 |
+
}
|
1706 |
+
}
|
1707 |
+
|
1708 |
+
/*Process delayed post
|
1709 |
+
*/
|
1710 |
+
private function process_delayed_posts( $last_delay = false ) {
|
1711 |
+
|
1712 |
+
$this->log( esc_html__('Processing ','advanced-import'). count( $this->delay_posts, COUNT_RECURSIVE ) . esc_html__('delayed posts','advanced-import') );
|
1713 |
+
for ( $x = 1; $x < 4; $x ++ ) {
|
1714 |
+
foreach ( $this->delay_posts as $delayed_post_type => $delayed_post_data_s ) {
|
1715 |
+
foreach ( $delayed_post_data_s as $delayed_post_id => $delayed_post_data ) {
|
1716 |
+
|
1717 |
+
/*already processed*/
|
1718 |
+
if ( $this->imported_post_id( $delayed_post_data['post_id'] ) ) {
|
1719 |
+
$this->log( $x . esc_html__('- Successfully processed ','advanced-import') . $delayed_post_type . esc_html__(' ID ','advanced-import') . $delayed_post_data['post_id'] . esc_html__(' previously.','advanced-import') );
|
1720 |
+
|
1721 |
+
/*already processed, remove it from delay_posts*/
|
1722 |
+
unset( $this->delay_posts[ $delayed_post_type ][ $delayed_post_id ] );
|
1723 |
+
$this->log( esc_html__(' ( ','advanced-import') . count( $this->delay_posts, COUNT_RECURSIVE ) . esc_html__(' delayed posts remain ) ','advanced-import') );
|
1724 |
+
}
|
1725 |
+
/*Process it*/
|
1726 |
+
else if ( $this->process_import_single_post( $delayed_post_type, $delayed_post_data, $last_delay ) ) {
|
1727 |
+
$this->log( $x . esc_html__(' - Successfully found delayed replacement for ','advanced-import') . $delayed_post_type . esc_html__(' ID ','advanced-import') . $delayed_post_data['post_id'] );
|
1728 |
+
|
1729 |
+
/*successfully processed, remove it from delay_posts*/
|
1730 |
+
unset( $this->delay_posts[ $delayed_post_type ][ $delayed_post_id ] );
|
1731 |
+
$this->log( esc_html__(' ( ','advanced-import') . count( $this->delay_posts, COUNT_RECURSIVE ) .esc_html__(' delayed posts remain ) ','advanced-import') );
|
1732 |
+
}
|
1733 |
+
else{
|
1734 |
+
$this->log( $x . esc_html__(' - Not found delayed replacement for ','advanced-import') . $delayed_post_type .esc_html__(' ID ' ,'advanced-import'). $delayed_post_data['post_id'] );
|
1735 |
+
}
|
1736 |
+
}
|
1737 |
+
}
|
1738 |
+
}
|
1739 |
+
}
|
1740 |
+
|
1741 |
+
/*Get file from url , download it and add to local*/
|
1742 |
+
private function import_image_and_file( $url, $post ) {
|
1743 |
+
|
1744 |
+
/*extract the file name and extension from the url*/
|
1745 |
+
$file_name = basename( $url );
|
1746 |
+
$local_file = ADVANCED_IMPORT_TEMP_UPLOADS. $file_name;
|
1747 |
+
$upload = false;
|
1748 |
+
|
1749 |
+
/*if file is already on local, return file information
|
1750 |
+
It means media is on local, while exporting media*/
|
1751 |
+
if ( is_file( $local_file ) && filesize( $local_file ) > 0 ) {
|
1752 |
+
require_once( ABSPATH . 'wp-admin/includes/file.php' );
|
1753 |
+
WP_Filesystem();
|
1754 |
+
global $wp_filesystem;
|
1755 |
+
$file_data = $wp_filesystem->get_contents( $local_file );
|
1756 |
+
$upload = wp_upload_bits( $file_name, 0, $file_data, $post['upload_date'] );
|
1757 |
+
if ( $upload['error'] ) {
|
1758 |
+
return new WP_Error( 'upload_dir_error', $upload['error'] );
|
1759 |
+
}
|
1760 |
+
}
|
1761 |
+
|
1762 |
+
/*if there is no file on local or error on local file need to fetch it*/
|
1763 |
+
if ( ! $upload || $upload['error'] ) {
|
1764 |
+
|
1765 |
+
/*get placeholder file in the upload dir with a unique, sanitized filename*/
|
1766 |
+
$upload = wp_upload_bits( $file_name, 0, '', $post['upload_date'] );
|
1767 |
+
if ( $upload['error'] ) {
|
1768 |
+
return new WP_Error( 'upload_dir_error', $upload['error'] );
|
1769 |
+
}
|
1770 |
+
|
1771 |
+
$max_size = (int) apply_filters( 'import_attachment_size_limit', 0 );
|
1772 |
+
|
1773 |
+
/*finally fetch the file from remote*/
|
1774 |
+
$response = wp_remote_get( $url );
|
1775 |
+
if ( is_array( $response ) && ! empty( $response['body'] ) && $response['response']['code'] == '200' ) {
|
1776 |
+
require_once( ABSPATH . 'wp-admin/includes/file.php' );
|
1777 |
+
$headers = $response['headers'];
|
1778 |
+
WP_Filesystem();
|
1779 |
+
global $wp_filesystem;
|
1780 |
+
$wp_filesystem->put_contents( $upload['file'], $response['body'] );
|
1781 |
+
}
|
1782 |
+
else {
|
1783 |
+
/*required to download file failed.*/
|
1784 |
+
wp_delete_file( $upload['file'] );
|
1785 |
+
return new WP_Error( 'import_file_error', esc_html__( 'Remote server did not respond' ,'advanced-import') );
|
1786 |
+
}
|
1787 |
+
|
1788 |
+
$file_size = filesize( $upload['file'] );
|
1789 |
+
|
1790 |
+
/*check for size*/
|
1791 |
+
if ( isset( $headers['content-length'] ) && $file_size != $headers['content-length'] ) {
|
1792 |
+
wp_delete_file( $upload['file'] );
|
1793 |
+
return new WP_Error( 'import_file_error', esc_html__( 'Remote file is incorrect size','advanced-import' ) );
|
1794 |
+
}
|
1795 |
+
|
1796 |
+
/*if file size is 0*/
|
1797 |
+
if ( 0 == $file_size ) {
|
1798 |
+
wp_delete_file( $upload['file'] );
|
1799 |
+
return new WP_Error( 'import_file_error', esc_html__( 'Zero size file downloaded','advanced-import' ) );
|
1800 |
+
}
|
1801 |
+
|
1802 |
+
/*if file is too large*/
|
1803 |
+
if ( ! empty( $max_size ) && $file_size > $max_size ) {
|
1804 |
+
wp_delete_file( $upload['file'] );
|
1805 |
+
return new WP_Error( 'import_file_error', sprintf( esc_html__( 'Remote file is too large, limit is %s','advanced-import' ), size_format( $max_size ) ) );
|
1806 |
+
}
|
1807 |
+
}
|
1808 |
+
|
1809 |
+
/*keep track of the old and new urls so we can substitute them later*/
|
1810 |
+
$this->imported_post_id( $url, $upload['url'] );
|
1811 |
+
$this->imported_post_id( $post['guid'], $upload['url'] );
|
1812 |
+
|
1813 |
+
/*keep track of the destination if the remote url is redirected somewhere else*/
|
1814 |
+
if ( isset( $headers['x-final-location'] ) && $headers['x-final-location'] != $url ) {
|
1815 |
+
$this->imported_post_id( $headers['x-final-location'], $upload['url'] );
|
1816 |
+
}
|
1817 |
+
return $upload;
|
1818 |
+
}
|
1819 |
+
|
1820 |
+
/*Replace necessary ID by Local imported ID
|
1821 |
+
'Posts IDS : page_id','post_id','image_id','selectpage','page_on_front','page_for_posts'
|
1822 |
+
'Terms IDS : 'cat_id','nav_menu'
|
1823 |
+
*/
|
1824 |
+
private function replace_old_id_to_new( $option_value, $index_key = false ){
|
1825 |
+
|
1826 |
+
/*Post IDS*/
|
1827 |
+
$replace_post_ids = apply_filters('advanced_import_replace_post_ids',
|
1828 |
+
array(
|
1829 |
+
'page_id',
|
1830 |
+
'post_id',
|
1831 |
+
'image_id',
|
1832 |
+
'selectpage',
|
1833 |
+
'page_on_front',
|
1834 |
+
'page_for_posts',
|
1835 |
+
'first_page_id',
|
1836 |
+
'second_page_id',
|
1837 |
+
)
|
1838 |
+
);
|
1839 |
+
|
1840 |
+
/*Terms IDS*/
|
1841 |
+
$replace_term_ids = apply_filters('advanced_import_replace_term_ids',
|
1842 |
+
array(
|
1843 |
+
'cat_id',
|
1844 |
+
'nav_menu',
|
1845 |
+
'online_shop_featured_cats',
|
1846 |
+
'online_shop_wc_product_cat',
|
1847 |
+
'online_shop_wc_product_tag',
|
1848 |
+
) );
|
1849 |
+
|
1850 |
+
/*replace terms in keys*/
|
1851 |
+
|
1852 |
+
if( is_array( $option_value ) ){
|
1853 |
+
foreach ( $option_value as $key => $replace_old_value ){
|
1854 |
+
|
1855 |
+
if( is_array( $replace_old_value) && !is_null( $replace_old_value )){
|
1856 |
+
$option_value[$key] = $this->replace_old_id_to_new( $replace_old_value );
|
1857 |
+
}
|
1858 |
+
elseif ( $this->isJson( $replace_old_value ) && is_string( $replace_old_value ) && !is_null( $replace_old_value ) ){
|
1859 |
+
$value_array = json_decode( $replace_old_value, true );
|
1860 |
+
if( is_array( $value_array ) ){
|
1861 |
+
$option_value[$key]= json_encode( $this->replace_old_id_to_new( $value_array ) );
|
1862 |
+
}
|
1863 |
+
else{
|
1864 |
+
if ( in_array( $key, $replace_post_ids ) && $key !== 0 ) {
|
1865 |
+
$new_id = $this->imported_post_id( $replace_old_value );
|
1866 |
+
if ( $new_id ) {
|
1867 |
+
$option_value[$key] = $new_id;
|
1868 |
+
}
|
1869 |
+
}
|
1870 |
+
elseif ( in_array( $key, $replace_term_ids ) && $key !== 0 ) {
|
1871 |
+
$new_id = $this->imported_term_id( $replace_old_value );
|
1872 |
+
if ( $new_id ) {
|
1873 |
+
$option_value[$key] = $new_id;
|
1874 |
+
}
|
1875 |
+
}
|
1876 |
+
else{
|
1877 |
+
$option_value[$key] = $replace_old_value;
|
1878 |
+
}
|
1879 |
+
}
|
1880 |
+
}
|
1881 |
+
else{
|
1882 |
+
|
1883 |
+
if ( in_array( $key, $replace_post_ids ) && $key !== 0) {
|
1884 |
+
|
1885 |
+
$new_id = $this->imported_post_id( $replace_old_value );
|
1886 |
+
if ( ! $new_id ) {
|
1887 |
+
/**/
|
1888 |
+
} else {
|
1889 |
+
$option_value[$key] = $new_id;
|
1890 |
+
}
|
1891 |
+
}
|
1892 |
+
elseif ( in_array( $key, $replace_term_ids ) && $key !== 0 ) {
|
1893 |
+
$new_id = $this->imported_term_id( $replace_old_value );
|
1894 |
+
if ( $new_id ) {
|
1895 |
+
$option_value[$key] = $new_id;
|
1896 |
+
}
|
1897 |
+
}
|
1898 |
+
else{
|
1899 |
+
$option_value[$key] = $replace_old_value;
|
1900 |
+
}
|
1901 |
+
}
|
1902 |
+
}
|
1903 |
+
}
|
1904 |
+
elseif ( is_numeric( $option_value ) && $index_key ){
|
1905 |
+
|
1906 |
+
if ( in_array( $index_key, $replace_post_ids ) && $index_key !== 0) {
|
1907 |
+
|
1908 |
+
$new_id = $this->imported_post_id( $option_value );
|
1909 |
+
if ( ! $new_id ) {
|
1910 |
+
/**/
|
1911 |
+
} else {
|
1912 |
+
$option_value = $new_id;
|
1913 |
+
}
|
1914 |
+
}
|
1915 |
+
elseif ( in_array( $index_key, $replace_term_ids ) && $index_key !== 0 ) {
|
1916 |
+
$new_id = $this->imported_term_id( $option_value );
|
1917 |
+
if ( $new_id ) {
|
1918 |
+
$option_value = $new_id;
|
1919 |
+
}
|
1920 |
+
}
|
1921 |
+
}
|
1922 |
+
|
1923 |
+
return $option_value;
|
1924 |
+
}
|
1925 |
+
|
1926 |
+
/* callback function to importing widgets data
|
1927 |
+
* all widgets data is imported from here
|
1928 |
+
* return mix
|
1929 |
+
* */
|
1930 |
+
private function import_content_widgets_data() {
|
1931 |
+
$import_widget_data = $this->get_widgets_json();
|
1932 |
+
$import_widget_positions = $import_widget_data['widget_positions'];
|
1933 |
+
$import_widget_options = $import_widget_data['widget_options'];
|
1934 |
+
|
1935 |
+
/* get sidebars_widgets */
|
1936 |
+
$widget_positions = get_option( 'sidebars_widgets' );
|
1937 |
+
if ( ! is_array( $widget_positions ) ) {
|
1938 |
+
$widget_positions = array();
|
1939 |
+
}
|
1940 |
+
|
1941 |
+
foreach ( $import_widget_options as $widget_name => $widget_options ) {
|
1942 |
+
|
1943 |
+
/*replace $widget_options elements with updated imported entries.*/
|
1944 |
+
foreach ( $widget_options as $widget_option_id => $widget_option ) {
|
1945 |
+
$widget_options[$widget_option_id]= $this->replace_old_id_to_new( $widget_option, $widget_option_id );
|
1946 |
+
}
|
1947 |
+
$existing_options = get_option( 'widget_' . $widget_name, array() );
|
1948 |
+
if ( ! is_array( $existing_options ) ) {
|
1949 |
+
$existing_options = array();
|
1950 |
+
}
|
1951 |
+
$new_options = $widget_options + $existing_options ;
|
1952 |
+
|
1953 |
+
$new_options = apply_filters('advanced_import_new_options', $new_options );
|
1954 |
+
|
1955 |
+
update_option( 'widget_' . $widget_name, $new_options );
|
1956 |
+
}
|
1957 |
+
|
1958 |
+
$sidebars_widgets = array_merge( $widget_positions, $import_widget_positions );
|
1959 |
+
$sidebars_widgets = apply_filters('advanced_import_sidebars_widgets', $sidebars_widgets,$this );
|
1960 |
+
update_option( 'sidebars_widgets', $sidebars_widgets);
|
1961 |
+
|
1962 |
+
return true;
|
1963 |
+
|
1964 |
+
}
|
1965 |
+
|
1966 |
+
/*check if string is json*/
|
1967 |
+
function isJson( $string ) {
|
1968 |
+
$test_json = @json_decode( $string, true );
|
1969 |
+
if ( is_array( $test_json ) ) {
|
1970 |
+
return true;
|
1971 |
+
}
|
1972 |
+
return false;
|
1973 |
+
}
|
1974 |
+
|
1975 |
+
/* callback function to importing menus and options data
|
1976 |
+
* all menus and import data is imported from here
|
1977 |
+
* return mix
|
1978 |
+
* */
|
1979 |
+
public function import_menu_and_options() {
|
1980 |
+
|
1981 |
+
/*final wrap up of delayed posts.*/
|
1982 |
+
$this->process_delayed_posts( true );
|
1983 |
+
|
1984 |
+
/*it includes options and menu data*/
|
1985 |
+
$theme_options = $this->get_theme_options_json();
|
1986 |
+
|
1987 |
+
/*options data*/
|
1988 |
+
$custom_options = $theme_options['options'];
|
1989 |
+
|
1990 |
+
/*menu data*/
|
1991 |
+
$menu_ids = $theme_options['menu'];
|
1992 |
+
|
1993 |
+
/*we also want to update the widget area manager options.*/
|
1994 |
+
if( is_array( $custom_options )){
|
1995 |
+
foreach ( $custom_options as $option => $value ) {
|
1996 |
+
/*replace old entries with updated imported entries.*/
|
1997 |
+
$value= $this->replace_old_id_to_new( $value, $option );
|
1998 |
+
|
1999 |
+
/*we have to update widget page numbers with imported page numbers.*/
|
2000 |
+
if (
|
2001 |
+
preg_match( '#(wam__position_)(\d+)_#', $option, $matches ) ||
|
2002 |
+
preg_match( '#(wam__area_)(\d+)_#', $option, $matches )
|
2003 |
+
) {
|
2004 |
+
$new_page_id = $this->imported_post_id( $matches[2] );
|
2005 |
+
if ( $new_page_id ) {
|
2006 |
+
// we have a new page id for this one. import the new setting value.
|
2007 |
+
$option = str_replace( $matches[1] . $matches[2] . '_', $matches[1] . $new_page_id . '_', $option );
|
2008 |
+
}
|
2009 |
+
}
|
2010 |
+
if ( $value && ! empty( $value['custom_logo'] ) ) {
|
2011 |
+
$new_logo_id = $this->imported_post_id( $value['custom_logo'] );
|
2012 |
+
if ( $new_logo_id ) {
|
2013 |
+
$value['custom_logo'] = $new_logo_id;
|
2014 |
+
}
|
2015 |
+
}
|
2016 |
+
update_option( $option, $value );
|
2017 |
+
}
|
2018 |
+
}
|
2019 |
+
|
2020 |
+
/*Options completed
|
2021 |
+
Menu Start*/
|
2022 |
+
$save = array();
|
2023 |
+
foreach ( $menu_ids as $menu_id => $term_id ) {
|
2024 |
+
$new_term_id = $this->imported_term_id( $term_id );
|
2025 |
+
if ( $new_term_id ) {
|
2026 |
+
$save[ $menu_id ] = $new_term_id;
|
2027 |
+
}
|
2028 |
+
}
|
2029 |
+
|
2030 |
+
if ( $save ) {
|
2031 |
+
set_theme_mod( 'nav_menu_locations', array_map( 'absint', $save ) );
|
2032 |
+
}
|
2033 |
+
|
2034 |
+
global $wp_rewrite;
|
2035 |
+
$wp_rewrite->set_permalink_structure( '/%year%/%monthnum%/%day%/%postname%/' );
|
2036 |
+
update_option( 'rewrite_rules', false );
|
2037 |
+
$wp_rewrite->flush_rules( true );
|
2038 |
+
|
2039 |
+
return true;
|
2040 |
+
}
|
2041 |
+
|
2042 |
+
public function log( $message ) {
|
2043 |
+
$this->logs[] = $message;
|
2044 |
+
}
|
2045 |
+
|
2046 |
+
|
2047 |
+
public function error( $message ) {
|
2048 |
+
$this->logs[] = esc_html__('ERROR!!!! ' ,'advanced-import'). $message;
|
2049 |
+
}
|
2050 |
+
|
2051 |
+
/* callback function to completed
|
2052 |
+
* Show Completed Message
|
2053 |
+
* */
|
2054 |
+
public function complete_screen() {
|
2055 |
+
require_once( ABSPATH . 'wp-admin/includes/file.php' );
|
2056 |
+
WP_Filesystem();
|
2057 |
+
global $wp_filesystem;
|
2058 |
+
$wp_filesystem->rmdir( ADVANCED_IMPORT_TEMP, true );
|
2059 |
+
|
2060 |
+
set_theme_mod('advanced_import_setup_complete', time() );
|
2061 |
+
/*delete_transient();*/
|
2062 |
+
delete_transient('content.json');
|
2063 |
+
delete_transient('widgets.json');
|
2064 |
+
delete_transient('options.json');
|
2065 |
+
|
2066 |
+
$message = '<div class="ai-notification-title">';
|
2067 |
+
$message .= '<p>'.esc_html__( "Your Website is Ready!" ,'advanced-import').'</p>';
|
2068 |
+
$message .= '<p class="ai-actions-buttons">'.sprintf( esc_html__( ' %sVisit your Site%s ','advanced-import' ),'<a target="_blank" href="'.esc_url(home_url('/')).'">','</a>').'</p>';
|
2069 |
+
$message .= '<p>'.sprintf( esc_html__( 'Congratulations! All Data is imported successfully. From %s WordPress dashboard%s you can make changes and modify any of the default content to suit your needs.','advanced-import' ),'<a href="'.esc_url(admin_url()).'">','</a>').'</p>';
|
2070 |
+
$message .= '</div>';
|
2071 |
+
|
2072 |
+
apply_filters('advanced_import_complete_message', $message);
|
2073 |
+
|
2074 |
+
echo $message;
|
2075 |
+
exit;
|
2076 |
+
}
|
2077 |
+
|
2078 |
+
/*test*/
|
2079 |
+
|
2080 |
+
function install_plugin() {
|
2081 |
+
if ( empty( $_POST['plugin'] ) || empty( $_POST['slug'] ) ) {
|
2082 |
+
wp_send_json_error(
|
2083 |
+
array(
|
2084 |
+
'slug' => '',
|
2085 |
+
'errorCode' => 'no_plugin_specified',
|
2086 |
+
'errorMessage' => __( 'No plugin specified.', 'advanced-import' ),
|
2087 |
+
)
|
2088 |
+
);
|
2089 |
+
}
|
2090 |
+
|
2091 |
+
$slug = sanitize_key( wp_unslash( $_POST['slug'] ) );
|
2092 |
+
$plugin = plugin_basename( sanitize_text_field( wp_unslash( $_POST['plugin'] ) ) );
|
2093 |
+
|
2094 |
+
if ( is_plugin_active_for_network( $plugin ) || is_plugin_active( $plugin ) ) {
|
2095 |
+
// Plugin is activated
|
2096 |
+
wp_send_json_success();
|
2097 |
+
|
2098 |
+
}
|
2099 |
+
$status = array(
|
2100 |
+
'install' => 'plugin',
|
2101 |
+
'slug' => sanitize_key( wp_unslash( $_POST['slug'] ) ),
|
2102 |
+
);
|
2103 |
+
|
2104 |
+
if ( ! current_user_can( 'install_plugins' ) ) {
|
2105 |
+
$status['errorMessage'] = __( 'Sorry, you are not allowed to install plugins on this site.', 'advanced-import' );
|
2106 |
+
wp_send_json_error( $status );
|
2107 |
+
}
|
2108 |
+
|
2109 |
+
include_once ABSPATH . 'wp-admin/includes/class-wp-upgrader.php';
|
2110 |
+
include_once ABSPATH . 'wp-admin/includes/plugin-install.php';
|
2111 |
+
|
2112 |
+
// Looks like a plugin is installed, but not active.
|
2113 |
+
if ( file_exists( WP_PLUGIN_DIR . '/' . $slug ) ) {
|
2114 |
+
$plugin_data = get_plugin_data( WP_PLUGIN_DIR . '/' . $plugin );
|
2115 |
+
$status['plugin'] = $plugin;
|
2116 |
+
$status['pluginName'] = $plugin_data['Name'];
|
2117 |
+
|
2118 |
+
if ( current_user_can( 'activate_plugin', $plugin ) && is_plugin_inactive( $plugin ) ) {
|
2119 |
+
$result = activate_plugin( $plugin );
|
2120 |
+
|
2121 |
+
if ( is_wp_error( $result ) ) {
|
2122 |
+
$status['errorCode'] = $result->get_error_code();
|
2123 |
+
$status['errorMessage'] = $result->get_error_message();
|
2124 |
+
wp_send_json_error( $status );
|
2125 |
+
}
|
2126 |
+
|
2127 |
+
wp_send_json_success( $status );
|
2128 |
+
}
|
2129 |
+
}
|
2130 |
+
|
2131 |
+
$api = plugins_api(
|
2132 |
+
'plugin_information',
|
2133 |
+
array(
|
2134 |
+
'slug' => sanitize_key( wp_unslash( $_POST['slug'] ) ),
|
2135 |
+
'fields' => array(
|
2136 |
+
'sections' => false,
|
2137 |
+
),
|
2138 |
+
)
|
2139 |
+
);
|
2140 |
+
|
2141 |
+
if ( is_wp_error( $api ) ) {
|
2142 |
+
$status['errorMessage'] = $api->get_error_message();
|
2143 |
+
wp_send_json_error( $status );
|
2144 |
+
}
|
2145 |
+
|
2146 |
+
$status['pluginName'] = $api->name;
|
2147 |
+
|
2148 |
+
$skin = new WP_Ajax_Upgrader_Skin();
|
2149 |
+
$upgrader = new Plugin_Upgrader( $skin );
|
2150 |
+
$result = $upgrader->install( $api->download_link );
|
2151 |
+
|
2152 |
+
if ( defined( 'WP_DEBUG' ) && WP_DEBUG ) {
|
2153 |
+
$status['debug'] = $skin->get_upgrade_messages();
|
2154 |
+
}
|
2155 |
+
|
2156 |
+
if ( is_wp_error( $result ) ) {
|
2157 |
+
$status['errorCode'] = $result->get_error_code();
|
2158 |
+
$status['errorMessage'] = $result->get_error_message();
|
2159 |
+
wp_send_json_error( $status );
|
2160 |
+
} elseif ( is_wp_error( $skin->result ) ) {
|
2161 |
+
$status['errorCode'] = $skin->result->get_error_code();
|
2162 |
+
$status['errorMessage'] = $skin->result->get_error_message();
|
2163 |
+
wp_send_json_error( $status );
|
2164 |
+
} elseif ( $skin->get_errors()->get_error_code() ) {
|
2165 |
+
$status['errorMessage'] = $skin->get_error_messages();
|
2166 |
+
wp_send_json_error( $status );
|
2167 |
+
} elseif ( is_null( $result ) ) {
|
2168 |
+
require_once( ABSPATH . 'wp-admin/includes/file.php' );
|
2169 |
+
WP_Filesystem();
|
2170 |
+
global $wp_filesystem;
|
2171 |
+
|
2172 |
+
$status['errorCode'] = 'unable_to_connect_to_filesystem';
|
2173 |
+
$status['errorMessage'] = __( 'Unable to connect to the filesystem. Please confirm your credentials.', 'advanced-import' );
|
2174 |
+
|
2175 |
+
// Pass through the error from WP_Filesystem if one was raised.
|
2176 |
+
if ( $wp_filesystem instanceof WP_Filesystem_Base && is_wp_error( $wp_filesystem->errors ) && $wp_filesystem->errors->get_error_code() ) {
|
2177 |
+
$status['errorMessage'] = esc_html( $wp_filesystem->errors->get_error_message() );
|
2178 |
+
}
|
2179 |
+
|
2180 |
+
wp_send_json_error( $status );
|
2181 |
+
}
|
2182 |
+
|
2183 |
+
$install_status = install_plugin_install_status( $api );
|
2184 |
+
|
2185 |
+
if ( current_user_can( 'activate_plugin', $install_status['file'] ) && is_plugin_inactive( $install_status['file'] ) ) {
|
2186 |
+
$result = activate_plugin( $install_status['file'] );
|
2187 |
+
|
2188 |
+
if ( is_wp_error( $result ) ) {
|
2189 |
+
$status['errorCode'] = $result->get_error_code();
|
2190 |
+
$status['errorMessage'] = $result->get_error_message();
|
2191 |
+
wp_send_json_error( $status );
|
2192 |
+
}
|
2193 |
+
}
|
2194 |
+
|
2195 |
+
wp_send_json_success( $status );
|
2196 |
+
}
|
2197 |
+
|
2198 |
+
/* callback function to current_screen
|
2199 |
+
* Add help Text
|
2200 |
+
* @param $screen object screen
|
2201 |
+
* */
|
2202 |
+
public function help_tabs($screen) {
|
2203 |
+
if ( !is_array($this->hook_suffix) || !in_array( $screen->base, $this->hook_suffix )){
|
2204 |
+
return;
|
2205 |
+
}
|
2206 |
+
$current_url = advanced_import_current_url();
|
2207 |
+
|
2208 |
+
$screen->add_help_tab(
|
2209 |
+
array(
|
2210 |
+
'id' => 'ai_help_tab_info',
|
2211 |
+
'title' => __( 'Information', 'advanced-import' ),
|
2212 |
+
'content' =>
|
2213 |
+
'<h2>' . __( 'Information', 'advanced-import' ) . '</h2>' .
|
2214 |
+
'<p>' . sprintf(
|
2215 |
+
__( 'Export you content via, <a href="%s" target="_blank">Advanced Export</a>. You can import export content, widget, customizer and media files too.', 'advanced-import' ),
|
2216 |
+
'https://wordpress.org/plugins/advanced-export/'
|
2217 |
+
) . '</p>' .
|
2218 |
+
'<p>' . sprintf(
|
2219 |
+
__( 'The zip file exported via <a href="%1$s" target="_blank">Advanced Export</a>. can be imported from this plugin <a href="%2$s">Advanced Import</a>.', 'advanced-import' ),
|
2220 |
+
'https://wordpress.org/support/plugin/advanced-export',
|
2221 |
+
'https://wordpress.org/support/plugin/advanced-import'
|
2222 |
+
) . '</p>' .
|
2223 |
+
'<p><a href="' . 'https://wordpress.org/support/plugin/advanced-import' . '" class="button button-primary" target="_blank">' . __( 'Community forum', 'advanced-import' ) . '</a> <a href="' . 'https://www.addonspress.com/' . '" class="button" target="_blank">' . __( 'Author', 'advanced-import' ) . '</a></p>',
|
2224 |
+
)
|
2225 |
+
);
|
2226 |
+
|
2227 |
+
$screen->add_help_tab(
|
2228 |
+
array(
|
2229 |
+
'id' => 'ai_help_tab_reset',
|
2230 |
+
'title' => __( 'Reset wizard', 'advanced-import' ),
|
2231 |
+
'content' =>
|
2232 |
+
'<h2>'.__( '<strong>WordPress Reset</strong>', 'advanced-import' ).'</h2>'.
|
2233 |
+
'<p>'.__( 'If no important data on your site. You can reset the WordPress back to default again!', 'advanced-import' ).'</p>'.
|
2234 |
+
'<p class="submit"><a href="'.esc_url( add_query_arg( 'ai_reset_wordpress', true, $current_url ) ).'" class="button button-primary ai-wp-reset">'. __( 'Run the Reset Wizard', 'advanced-import' ).'</a></p>' )
|
2235 |
+
);
|
2236 |
+
|
2237 |
+
$screen->set_help_sidebar(
|
2238 |
+
'<p><strong>' . __( 'More information:', 'advanced-import' ) . '</strong></p>' .
|
2239 |
+
'<p><a href="' . 'https://wordpress.org/plugins/advanced-export/' . '" target="_blank">' . __( 'Advanced Export', 'advanced-import' ) . '</a></p>' .
|
2240 |
+
'<p><a href="' . 'https://wordpress.org/plugins/advanced-import/' . '" target="_blank">' . __( 'Advanced Import', 'advanced-import' ) . '</a></p>'
|
2241 |
+
);
|
2242 |
+
}
|
2243 |
+
}
|
2244 |
+
|
2245 |
+
/**
|
2246 |
+
* Begins execution of the plugin.
|
2247 |
+
*
|
2248 |
+
* Since everything within the plugin is registered via hooks,
|
2249 |
+
* then kicking off the plugin from this point in the file does
|
2250 |
+
* not affect the page life cycle.
|
2251 |
+
*
|
2252 |
+
* @since 1.0.0
|
2253 |
+
*/
|
2254 |
+
function advanced_import_admin( ) {
|
2255 |
+
return Advanced_Import_Admin::instance();
|
2256 |
+
}
|
admin/class-reset.php
ADDED
@@ -0,0 +1,192 @@
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
1 |
+
<?php
|
2 |
+
|
3 |
+
/**
|
4 |
+
* Reset WordPress
|
5 |
+
*
|
6 |
+
* @link https://addonspress.com/
|
7 |
+
* @since 1.0.0
|
8 |
+
*
|
9 |
+
* @package Advanced_Import
|
10 |
+
* @subpackage Advanced_Import/admin
|
11 |
+
*/
|
12 |
+
|
13 |
+
/**
|
14 |
+
* The admin-specific functionality of the plugin.
|
15 |
+
* Reset WordPress
|
16 |
+
* @package Advanced_Import
|
17 |
+
* @subpackage Advanced_Import/admin
|
18 |
+
* @author Addons Press <addonspress.com>
|
19 |
+
*/
|
20 |
+
class Advanced_Import_Reset_WordPress {
|
21 |
+
|
22 |
+
/**
|
23 |
+
* Initialize the class and set its properties.
|
24 |
+
*
|
25 |
+
* @since 1.0.0
|
26 |
+
*/
|
27 |
+
public function __construct( ) {}
|
28 |
+
|
29 |
+
/**
|
30 |
+
* Main Advanced_Import_Reset_WordPress Instance
|
31 |
+
* Initialize the class and set its properties.
|
32 |
+
*
|
33 |
+
* @since 1.0.0
|
34 |
+
* @return object $instance Advanced_Import_Reset_WordPress Instance
|
35 |
+
*/
|
36 |
+
public static function instance() {
|
37 |
+
|
38 |
+
// Store the instance locally to avoid private static replication
|
39 |
+
static $instance = null;
|
40 |
+
|
41 |
+
// Only run these methods if they haven't been ran previously
|
42 |
+
if ( null === $instance ) {
|
43 |
+
$instance = new Advanced_Import_Reset_WordPress;
|
44 |
+
|
45 |
+
}
|
46 |
+
|
47 |
+
// Always return the instance
|
48 |
+
return $instance;
|
49 |
+
}
|
50 |
+
|
51 |
+
/**
|
52 |
+
* Hide a notice if the GET variable is set.
|
53 |
+
*/
|
54 |
+
public function hide_reset_notice() {
|
55 |
+
if ( isset( $_GET['advanced-import-hide-notice'] ) && isset( $_GET['_advanced_import_notice_nonce'] ) ) {
|
56 |
+
if ( ! wp_verify_nonce( $_GET['_advanced_import_notice_nonce'], 'advanced_import_hide_notice_nonce' ) ) {
|
57 |
+
wp_die( __( 'Action failed. Please refresh the page and retry.', 'advanced-import' ) );
|
58 |
+
}
|
59 |
+
|
60 |
+
if ( ! current_user_can( 'manage_options' ) ) {
|
61 |
+
wp_die( __( 'Cheatin’ huh?', 'advanced-import' ) );
|
62 |
+
}
|
63 |
+
|
64 |
+
$hide_notice = sanitize_text_field( $_GET['advanced-import-hide-notice'] );
|
65 |
+
|
66 |
+
if ( ! empty( $hide_notice ) && 'reset_notice' == $hide_notice ) {
|
67 |
+
update_option( 'advanced_import_reset_notice', 1 );
|
68 |
+
}
|
69 |
+
}
|
70 |
+
}
|
71 |
+
|
72 |
+
/**
|
73 |
+
* Reset actions when a reset button is clicked.
|
74 |
+
*/
|
75 |
+
public function reset_wizard_actions() {
|
76 |
+
global $wpdb, $current_user;
|
77 |
+
|
78 |
+
if ( ! empty( $_GET['ai_reset_wordpress'] ) ) {
|
79 |
+
require_once ABSPATH . '/wp-admin/includes/upgrade.php';
|
80 |
+
|
81 |
+
$template = get_option( 'template' );
|
82 |
+
$blogname = get_option( 'blogname' );
|
83 |
+
$admin_email = get_option( 'admin_email' );
|
84 |
+
$blog_public = get_option( 'blog_public' );
|
85 |
+
|
86 |
+
$current_url = advanced_import_current_url();
|
87 |
+
|
88 |
+
if ( 'admin' != $current_user->user_login ) {
|
89 |
+
$user = get_user_by( 'login', 'admin' );
|
90 |
+
}
|
91 |
+
|
92 |
+
if ( empty( $user->user_level ) || $user->user_level < 10 ) {
|
93 |
+
$user = $current_user;
|
94 |
+
}
|
95 |
+
|
96 |
+
// Drop tables.
|
97 |
+
$drop_tables = $wpdb->get_col( sprintf( "SHOW TABLES LIKE '%s%%'", str_replace( '_', '\_', $wpdb->prefix ) ) );
|
98 |
+
foreach ( $drop_tables as $table ) {
|
99 |
+
$wpdb->query( "DROP TABLE IF EXISTS $table" );
|
100 |
+
}
|
101 |
+
|
102 |
+
// Installs the site.
|
103 |
+
$result = wp_install( $blogname, $user->user_login, $user->user_email, $blog_public );
|
104 |
+
|
105 |
+
// Updates the user password with a old one.
|
106 |
+
$wpdb->update(
|
107 |
+
$wpdb->users,
|
108 |
+
array(
|
109 |
+
'user_pass' => $user->user_pass,
|
110 |
+
'user_activation_key' => '',
|
111 |
+
),
|
112 |
+
array( 'ID' => $result['user_id'] )
|
113 |
+
);
|
114 |
+
|
115 |
+
// Set up the Password change nag.
|
116 |
+
$default_password_nag = get_user_option( 'default_password_nag', $result['user_id'] );
|
117 |
+
if ( $default_password_nag ) {
|
118 |
+
update_user_option( $result['user_id'], 'default_password_nag', false, true );
|
119 |
+
}
|
120 |
+
|
121 |
+
// Switch current theme.
|
122 |
+
$current_theme = wp_get_theme( $template );
|
123 |
+
if ( $current_theme->exists() ) {
|
124 |
+
switch_theme( $template );
|
125 |
+
}
|
126 |
+
|
127 |
+
// Activate required plugins.
|
128 |
+
$required_plugins = (array) apply_filters( 'advanced_import_' . $template . '_required_plugins', array() );
|
129 |
+
if ( is_array( $required_plugins ) ) {
|
130 |
+
if ( ! in_array( plugin_basename( ADVANCED_IMPORT_PATH.'/advanced-import.php'), $required_plugins ) ) {
|
131 |
+
$required_plugins = array_merge( $required_plugins, array( ADVANCED_IMPORT_PATH.'/advanced-import.php') );
|
132 |
+
}
|
133 |
+
activate_plugins( $required_plugins, '', is_network_admin(), true );
|
134 |
+
}
|
135 |
+
|
136 |
+
// Update the cookies.
|
137 |
+
wp_clear_auth_cookie();
|
138 |
+
wp_set_auth_cookie( $result['user_id'] );
|
139 |
+
|
140 |
+
// Redirect to demo importer page to display reset success notice.
|
141 |
+
wp_safe_redirect($current_url.'&reset=true&from=ai-reset-wp');
|
142 |
+
exit();
|
143 |
+
}
|
144 |
+
}
|
145 |
+
|
146 |
+
/**
|
147 |
+
* Reset wizard notice.
|
148 |
+
*/
|
149 |
+
public function reset_wizard_notice() {
|
150 |
+
|
151 |
+
|
152 |
+
$screen = get_current_screen();
|
153 |
+
if (!in_array( $screen->base, advanced_import_admin()->hook_suffix )){
|
154 |
+
return;
|
155 |
+
}
|
156 |
+
$current_url = advanced_import_current_url();
|
157 |
+
|
158 |
+
$demo_notice_dismiss = get_option( 'advanced_import_reset_notice' );
|
159 |
+
|
160 |
+
// Output reset wizard notice.
|
161 |
+
if ( ! $demo_notice_dismiss ) {
|
162 |
+
?>
|
163 |
+
<div id="message" class="updated ai-import-message">
|
164 |
+
<p><?php _e( '<strong>WordPress Reset</strong> – If no important data on your site. You can reset the WordPress back to default again!', 'advanced-import' ); ?></p>
|
165 |
+
<p class="submit"><a href="<?php echo esc_url( add_query_arg( 'ai_reset_wordpress', 'true', $current_url ) ); ?>" class="button button-primary ai-wp-reset"><?php esc_html_e( 'Run the Reset Wizard', 'advanced-import' ); ?></a> <a class="button-secondary skip" href="<?php echo esc_url( wp_nonce_url( add_query_arg( 'advanced-import-hide-notice', 'reset_notice', $current_url ), 'advanced_import_hide_notice_nonce', '_advanced_import_notice_nonce' ) ); ?>"><?php esc_attr_e( 'Hide this notice', 'advanced-import' ); ?></a></p>
|
166 |
+
</div>
|
167 |
+
<?php
|
168 |
+
} elseif ( isset( $_GET['reset'] ) && 'true' === $_GET['reset'] ) {
|
169 |
+
$user = get_user_by( 'id', 1 );
|
170 |
+
?>
|
171 |
+
<div id="message" class="notice notice-info is-dismissible">
|
172 |
+
<p><?php printf( __( 'WordPress has been reset back to defaults. The user <strong>"%1$s"</strong> was recreated with its previous password.', 'advanced-import' ), $user->user_login ); ?></p>
|
173 |
+
</div>
|
174 |
+
<?php
|
175 |
+
}
|
176 |
+
}
|
177 |
+
|
178 |
+
|
179 |
+
}
|
180 |
+
|
181 |
+
/**
|
182 |
+
* Begins execution of the plugin.
|
183 |
+
*
|
184 |
+
* Since everything within the plugin is registered via hooks,
|
185 |
+
* then kicking off the plugin from this point in the file does
|
186 |
+
* not affect the page life cycle.
|
187 |
+
*
|
188 |
+
* @since 1.0.0
|
189 |
+
*/
|
190 |
+
function advanced_import_reset_wordpress() {
|
191 |
+
return Advanced_Import_Reset_WordPress::instance();
|
192 |
+
}
|
admin/index.php
ADDED
@@ -0,0 +1 @@
|
|
|
1 |
+
<?php // Silence is golden
|
advanced-import.php
ADDED
@@ -0,0 +1,81 @@
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
1 |
+
<?php
|
2 |
+
// If this file is called directly, abort.
|
3 |
+
if ( ! defined( 'WPINC' ) ) {
|
4 |
+
echo 'Hi there! I\'m just a plugin, not much I can do when called directly.';
|
5 |
+
exit;
|
6 |
+
}
|
7 |
+
/**
|
8 |
+
*
|
9 |
+
* @link https://addonspress.com/
|
10 |
+
* @since 1.0.0
|
11 |
+
* @package Advanced_Import
|
12 |
+
*
|
13 |
+
* @wordpress-plugin
|
14 |
+
* Plugin Name: Advanced Import
|
15 |
+
* Plugin URI: https://addonspress.com/item/advanced-import
|
16 |
+
* Description: This is a short description of what the plugin does. It's displayed in the WordPress admin area.
|
17 |
+
* Version: 1.0.2
|
18 |
+
* Author: Addons Press
|
19 |
+
* Author URI: https://addonspress.com/
|
20 |
+
* License: GPL-2.0+
|
21 |
+
* License URI: http://www.gnu.org/licenses/gpl-2.0.txt
|
22 |
+
* Text Domain: advanced-import
|
23 |
+
* Domain Path: /languages
|
24 |
+
*/
|
25 |
+
|
26 |
+
/*Define Constants for this plugin*/
|
27 |
+
define( 'ADVANCED_IMPORT_VERSION', '1.0.2' );
|
28 |
+
define( 'ADVANCED_IMPORT_PLUGIN_NAME', 'advanced-import' );
|
29 |
+
define( 'ADVANCED_IMPORT_PATH', plugin_dir_path( __FILE__ ) );
|
30 |
+
define( 'ADVANCED_IMPORT_URL', plugin_dir_url( __FILE__ ) );
|
31 |
+
define( 'ADVANCED_IMPORT_SCRIPT_PREFIX', ( defined( 'SCRIPT_DEBUG' ) && SCRIPT_DEBUG ) ? '' : '.min' );
|
32 |
+
|
33 |
+
$upload_dir = wp_upload_dir();
|
34 |
+
$advanced_import_temp = $upload_dir['basedir'] . '/advanced-import-temp/';
|
35 |
+
$advanced_import_temp_zip = $upload_dir['basedir'] . '/advanced-import-temp-zip/';
|
36 |
+
$advanced_import_temp_uploads = $advanced_import_temp . '/uploads/';
|
37 |
+
|
38 |
+
define( 'ADVANCED_IMPORT_TEMP', $advanced_import_temp );
|
39 |
+
define( 'ADVANCED_IMPORT_TEMP_ZIP', $advanced_import_temp_zip );
|
40 |
+
define( 'ADVANCED_IMPORT_TEMP_UPLOADS', $advanced_import_temp_uploads );
|
41 |
+
|
42 |
+
/**
|
43 |
+
* The code that runs during plugin activation.
|
44 |
+
* This action is documented in includes/class-advanced-import-activator.php
|
45 |
+
*/
|
46 |
+
function activate_advanced_import() {
|
47 |
+
require_once ADVANCED_IMPORT_PATH . 'includes/class-advanced-import-activator.php';
|
48 |
+
Advanced_Import_Activator::activate();
|
49 |
+
}
|
50 |
+
|
51 |
+
/**
|
52 |
+
* The code that runs during plugin deactivation.
|
53 |
+
* This action is documented in includes/class-advanced-import-deactivator.php
|
54 |
+
*/
|
55 |
+
function deactivate_advanced_import() {
|
56 |
+
require_once ADVANCED_IMPORT_PATH . 'includes/class-advanced-import-deactivator.php';
|
57 |
+
Advanced_Import_Deactivator::deactivate();
|
58 |
+
}
|
59 |
+
|
60 |
+
register_activation_hook( __FILE__, 'activate_advanced_import' );
|
61 |
+
register_deactivation_hook( __FILE__, 'deactivate_advanced_import' );
|
62 |
+
|
63 |
+
/**
|
64 |
+
* The core plugin class that is used to define internationalization,
|
65 |
+
* admin-specific hooks, and public-facing site hooks.
|
66 |
+
*/
|
67 |
+
require ADVANCED_IMPORT_PATH . 'includes/class-advanced-import.php';
|
68 |
+
|
69 |
+
/**
|
70 |
+
* Begins execution of the plugin.
|
71 |
+
*
|
72 |
+
* Since everything within the plugin is registered via hooks,
|
73 |
+
* then kicking off the plugin from this point in the file does
|
74 |
+
* not affect the page life cycle.
|
75 |
+
*
|
76 |
+
* @since 1.0.0
|
77 |
+
*/
|
78 |
+
function advanced_import() {
|
79 |
+
return Advanced_Import::instance();
|
80 |
+
}
|
81 |
+
advanced_import();
|
assets/css/advanced-import-admin.min.css
ADDED
@@ -0,0 +1 @@
|
|
|
1 |
+
.ai-body{margin:40px 15px 0}.ai-body img{max-width:100%;height:auto}.ai-header{margin-bottom:40px}.ai-filter-tabs{display:flex;align-items:center;background:#fff;padding:10px 20px;margin-bottom:20px;box-shadow:0 1px 1px rgba(0,0,0,.04);border:1px solid #e5e5e5}.ai-filter-tabs ul{margin-top:0;margin-bottom:0}.ai-filter-tabs ul li{font-size:14px;cursor:pointer;font-weight:600}.ai-count{background:#ca4a1f;display:inline-block;padding:2px 10px;border-radius:50px;margin-left:5px;color:#fff;font-size:12px}.ai-types{display:flex}.ai-types li{margin:0 5px;padding:5px}.ai-form-file-import{cursor:pointer;background:#efefef;padding:8px 25px;margin:0;border-radius:3px;background:#0085ba;border-color:#0073aa #006799 #006799;box-shadow:0 1px 0 #006799;color:#fff;text-decoration:none;text-shadow:0 -1px 1px #006799,1px 0 1px #006799,0 1px 1px #006799,-1px 0 1px #006799}.ai-form-file-import:focus,.ai-form-file-import:hover{background:#0073aa;border-color:#006799}.ai-filter-content{background:#f8f8f8;display:flex}.ai-filter-content.hidden{display:none}.ai-sidebar{flex-basis:250px;min-width:270px;background:#f9f9f9;color:#999;padding-top:30px;border-right:1px solid #ddd;box-shadow:10px 0 10px -3px rgba(0,0,0,.1)}.ai-import-available-categories{margin-top:20px;overflow-y:auto;overflow-x:hidden;max-height:calc(100% - 23px)}.ai-import-available-categories h3{padding-left:30px;padding-right:30px}.ai-import-available-categories ul{margin-top:20px}.ai-import-available-categories ul li{cursor:pointer;font-weight:600;font-size:14px;padding:15px 30px;position:relative;z-index:1;margin:0;border-bottom:1px solid #f1f1f1}.ai-import-available-categories ul li:after{position:absolute;left:0;top:0;background:#f1f1f1;width:0;content:"";height:100%;z-index:-1;transition:all .5s ease-in-out 0s}.ai-import-available-categories ul li:focus,.ai-import-available-categories ul li:hover{border-color:#f1f1f1;color:#444}.ai-import-available-categories ul li span{float:right}.ai-import-available-categories ul li.ai-filter-btn-active{color:#444;border-color:#f1f1f1}.ai-import-available-categories ul li.ai-filter-btn-active:focus,.ai-import-available-categories ul li.ai-filter-btn-active:hover{border-color:#f1f1f1}.ai-import-available-categories ul li.ai-filter-btn-active:focus:after,.ai-import-available-categories ul li.ai-filter-btn-active:hover:after{width:100%}.ai-import-available-categories ul li.ai-filter-btn-active:after{width:100%;transition:all .5s ease-in-out 0s}.ai-search-control{margin-left:auto;margin-right:20px;width:200px}.ai-search-control .ai-search-filter{padding-left:10px;padding-right:10px}.ai-search-filter{height:36px;width:100%}.ai-filter-content-wrapper{flex-basis:calc(100% - 250px);padding:15px}.ai-item-preview{position:relative;z-index:1;line-height:0;border-top-right-radius:4px;border-top-left-radius:4px;background:#fff}.ai-item-preview:after{content:"";width:100%;height:100%;position:absolute;left:0;top:0;box-shadow:0 -130px 70px -42px rgba(0,0,0,.8) inset;z-index:2;opacity:0;visibility:hidden;transition:all .5s ease-in-out 0s}.ai-item-preview .ai-item-screenshot{border-top-right-radius:4px;border-top-left-radius:4px;overflow:hidden}.ai-item-preview .ai-author-info{position:absolute;left:0;right:0;bottom:-100px;width:100%;z-index:3;margin:0;transition:all .5s ease-in-out 0s;padding:20px;color:#fff;font-size:16px;opacity:0;visibility:hidden}.ai-item-preview .ai-details{position:absolute;left:0;right:0;margin:0 auto;top:50%;width:130px;margin:0 auto;background:rgba(0,0,0,.8);height:40px;line-height:40px;text-align:center;z-index:5;font-size:15px;font-weight:600;color:#fff;opacity:0;visibility:hidden;transition:all .5s ease-in-out 0s;transform:translateY(-50%)}.ai-item-preview .ai-premium-label{position:absolute;right:-10px;top:20px;background:#ca4a1f;display:block;z-index:2;line-height:16px;padding:10px 20px;height:16px;font-weight:600;color:#fff}.ai-item-preview .ai-premium-label:before{position:absolute;left:-18px;top:0;height:0;width:0;content:"";border-top:18px solid #ca4a1f;border-left:18px solid transparent;border-bottom:18px solid #ca4a1f}.ai-item-preview .ai-premium-label:after{position:absolute;right:0;content:"";bottom:-10px;width:0;height:0;border-top:10px solid #ca4a1f;border-right:10px solid transparent}.ai-item{display:inline-block;max-width:calc(100% / 3 - 40px);margin:15px;box-shadow:0 2px 15px -3px rgba(0,0,0,.2)}@media (min-width:1600px){.ai-item{max-width:calc(100% / 4 - 40px)}}.ai-item:hover .ai-item-preview:after{visibility:visible;opacity:1}.ai-item:hover .ai-author-info{bottom:10px;visibility:visible;opacity:1}.ai-item:hover .ai-details,.ai-item:hover .ai-item-footer-actions{visibility:visible;opacity:1}.ai-item-footer{padding:20px;background:#fff;position:relative;border-bottom-right-radius:4px;border-bottom-left-radius:4px}.ai-item-footer .theme-name{margin:0;white-space:nowrap;width:98%;overflow:hidden;text-overflow:ellipsis}.ai-item-footer-actions{position:absolute;right:0;text-align:center;z-index:4;top:0;height:calc(100% - 22px);background:red;padding:11px;opacity:0;transition:all .1s ease-in-out;background:rgba(244,244,244,.7);border-left:1px solid rgba(0,0,0,.05);visibility:hidden}.ai-item-footer-actions .button{line-height:32px;height:35px}.ai-item-footer-actions .button .dashicons:not(.dashicons-update){width:10px;height:10px;font-size:14px;vertical-align:middle;margin-right:10px;margin-top:-5px}.ai-item-footer-actions .button .dashicons.ai-update{animation:dashicons-spin 1s linear infinite;margin:17px 0 0 10px;width:auto;height:auto;font-size:16px}.ai-item-footer-actions .button .dashicons.dashicons-visibility{font-size:12px}.ai-form{padding:40px;background:#fff}.ai-form .media-title{margin-top:0}.ai-form .input-file{padding:100px;border:1px dashed #cdcdcd;margin:40px 0;background:#f8f8f8;text-align:center;clear:both}.ai-item.ai-action-importing .ai-item-preview:after{visibility:visible;opacity:1}.ai-item.ai-action-importing .ai-author-info{bottom:10px}.ai-item.ai-action-importing .ai-item-footer-actions{top:50%;transform:translateY(-50%)}.ai-item.ai-action-importing .ai-demo-import{padding-right:0}.ai-item.ai-action-importing .ai-item-footer-actions{opacity:1;visibility:visible}@keyframes dashicons-spin{0%{transform:translate3d(-50%,-50%,0) rotate(0)}100%{transform:translate3d(-50%,-50%,0) rotate(360deg)}}.ai-confirm-import-content #swal2-content{text-align:left!important;margin-top:20px}.swal2-actions{width:auto!important}#swal2-content p{padding-left:20px;padding-right:13px}
|
assets/js/advanced-import-admin.min.js
ADDED
@@ -0,0 +1 @@
|
|
|
1 |
+
!function(t){let e,n,i,o,a=t(document),r=!1,c=!1;const l=function(t){let e,n,i=window.location.search.substring(1).split("&");for(n=0;n<i.length;n++)if((e=i[n].split("="))[0]===t)return void 0===e[1]||decodeURIComponent(e[1])},u=Swal.mixin({position:"bottom-end",showConfirmButton:!1,allowOutsideClick:!1,allowEscapeKey:!1,toast:!0}),d=function(e){t("#ai-demo-popup").html(e),u.fire({type:"info",html:t("#ai-demo-popup .ai-notification-title").html()}),u.showLoading()},p=function(t=null,e=null,n=null,i=null){let o=advanced_import_object.text.failedImport.text;o+=t||e||n||i?"<br/>"+advanced_import_object.text.failedImport.code:"",o+=t||"",o+=e||"",o+=n||"",o+=i||"",u.fire({type:"error",html:o}),s()},f=function(e=!1){u.fire({type:"info",html:t(".ai-notification-title").html()}),u.showLoading(),r=!0,m(e)},s=function(){r=!1,_()},m=function(t){return!!t&&(!c&&((c=t).append('<span class="ai-update dashicons dashicons-update"></span>'),c.attr("disabled",!0),void c.closest(".ai-item").addClass("ai-action-importing")))},_=function(){if(!c)return!1;c.children(".ai-update").remove(),c.attr("disabled",!1),c.closest(".ai-item").removeClass("ai-action-importing"),c=!1};function h(){return t.ajax({type:"POST",url:advanced_import_object.ajaxurl,data:{action:"content_screen",_wpnonce:e.val(),_wp_http_referer:n.val(),template_url:o,template_type:i}}).done(function(e){d(e),(new function(){let e,n=0,a="",r="";function c(n){"object"==typeof n&&void 0!==n.message?(e.find("span").text(n.message),void 0!==n.url?n.hash===r?(e.find("span").text(advanced_import_object.text.failed),l()):(r=n.hash,t.ajax({type:"POST",url:n.url,data:n}).done(c).fail(c)):(n.done,l())):(e.find("span").text(advanced_import_object.text.error),l())}function l(){e&&(e.data("done-item")||(n++,e.attr("data-done-item",1)),e.find(".spinner").remove());let r=!1,u=t("tr.ai-available-content");u.each(function(){let n=t(this);""===a||r?(a=n.data("content"),e=n,function(){if(a){let n=e.find("input:checkbox");n.is(":checked")?t.ajax({type:"POST",url:advanced_import_object.ajaxurl,data:{action:"import_content",wpnonce:advanced_import_object.wpnonce,content:a,template_url:o,template_type:i}}).done(c).fail(c):(e.find("span").text(advanced_import_object.text.skip),setTimeout(l,300))}}(),r=!1):n.data("content")===a&&(r=!0)}),n>=u.length&&complete()}return{init:function(){let e=t(".ai-pages");e.addClass("installing"),e.find("input").prop("disabled",!0),complete=function(){return t.ajax({type:"POST",url:advanced_import_object.ajaxurl,data:{action:"complete_screen"}}).done(function(e){return t("#ai-demo-popup").html(e),Swal.fire({title:"Success",html:t("#ai-demo-popup .ai-notification-title").html(),type:"success",allowOutsideClick:!1,showCancelButton:!0,confirmButtonColor:"#3085d6",cancelButtonColor:"#d33",confirmButtonText:advanced_import_object.text.successImport.confirmButtonText,cancelButtonText:advanced_import_object.text.successImport.cancelButtonText}).then(e=>{e.value&&window.open(t("#ai-demo-popup .ai-actions-buttons a").attr("href"),"_blank")}),s(),!1}).fail(function(t,e,n){console.log(t+" :: "+e+" :: "+n)}),!1},l()}}}).init()}).fail(function(t,e,n){return p("",t,e,n),!1}),!1}function v(i){return t.ajax({type:"POST",url:advanced_import_object.ajaxurl,data:{action:"plugin_screen",_wpnonce:e.val(),_wp_http_referer:n.val(),recommendedPlugins:i}}).done(function(i){d(i),u.showLoading(),t("#ai-demo-popup .ai-plugins-wrap").find("li").each(function(){return function i(o){if("ai-no-recommended-plugins"===o.attr("id"))return h(),!1;t.ajax({type:"POST",url:advanced_import_object.ajaxurl,data:{action:"install_plugin",_wpnonce:e.val(),_wp_http_referer:n.val(),slug:o.data("slug"),plugin:o.data("slug")+"/"+o.data("main_file")}}).done(function(t){if("object"==typeof t&&void 0!==t.success){if(o.attr("data-completed",1),!o.next("li").length)return h(),!1;setTimeout(i(o.next("li")),1e3)}else setTimeout(i(o),1e3)}).fail(function(t,e,n){return p("",t,e,n),!1})}(t(this)),!1})}).fail(function(t,e,n){return p("",t,e,n),!1}),!1}a.ready(function(){a.on("submit","#ai-upload-zip-form",function(i){if(i.preventDefault(),r)return!1;!function(i){if(void 0===window.FormData)return!0;let o=new FormData,a=i.find("#ai-upload-zip-archive"),r=t("#ai-empty-file");if(!a.val())return r.show(),p(r.html()),!1;r.hide(),f();let c=a[0].files[0];e=i.find("input[name=_wpnonce]"),n=i.find("input[name=_wp_http_referer]"),o.append("ai-upload-zip-archive",c),o.append("action","advanced_import_ajax_setup"),o.append("_wpnonce",e.val()),o.append("_wp_http_referer",n.val()),a.val(""),t.ajax({type:"POST",url:advanced_import_object.ajaxurl,data:o,cache:!1,contentType:!1,processData:!1}).done(function(t){return"object"!=typeof t&&(t=JSON.parse(t)),t.success?(h(),!1):(p(t.data.message),!1)}).fail(function(t,e,n){return p("",t,e,n),!1})}(t(this))}),a.on("click",".ai-item .ai-demo-import",function(a){if(a.preventDefault(),r)return!1;let c=t(this),l=t(this).data("plugins");Swal.fire({title:advanced_import_object.text.confirmImport.title,html:advanced_import_object.text.confirmImport.html,width:"64rem",customClass:{content:"ai-confirm-import-content"},allowOutsideClick:!1,showCancelButton:!0,confirmButtonColor:"#3085d6",cancelButtonColor:"#d33",confirmButtonText:advanced_import_object.text.confirmImport.confirmButtonText,cancelButtonText:advanced_import_object.text.confirmImport.cancelButtonText}).then(a=>{a.value&&(f(c),function(a,r){let c=a.closest(".ai-item");i=c.data("template_type"),o=c.data("template_url"),e=c.find("input[name=_wpnonce]"),n=c.find("input[name=_wp_http_referer]"),"array"===i?v(r):t.ajax({type:"POST",url:advanced_import_object.ajaxurl,data:{action:"demo_download_and_unzip",_wpnonce:e.val(),_wp_http_referer:n.val(),demo_file:o,demo_file_type:i}}).done(function(t){return t.success?(v(r),!1):(p("",jqXHR,textStatus,errorThrown),!1)}).fail(function(t,e,n){return p("",t,e,n),!1})}(c,l))})}),a.on("click",".ai-wp-reset",function(e){e.preventDefault(),Swal.fire({title:advanced_import_object.text.confirmReset.title,text:advanced_import_object.text.confirmReset.text,type:"warning",allowOutsideClick:!1,showCancelButton:!0,confirmButtonColor:"#3085d6",cancelButtonColor:"#d33",confirmButtonText:advanced_import_object.text.confirmReset.confirmButtonText,cancelButtonText:advanced_import_object.text.confirmReset.cancelButtonText}).then(e=>{e.value&&(window.location.href=t(".ai-wp-reset").attr("href"))})}),a.on("click",".ai-filter-tabs li",function(e){if(e.preventDefault(),r)return!1;t(this).hasClass("ai-form-file-import")?(t(".ai-filter-content").addClass("hidden"),t(".ai-form").removeClass("hidden")):(t(".ai-form").addClass("hidden"),t(".ai-filter-content").removeClass("hidden"))});let c,u,d={};setTimeout(function(){let e=t(".ai-filter-content-wrapper").isotope({itemSelector:".ai-item",filter:function(){let e=t(this),n=!u||e.text().match(u),i=!c||e.is(c);return n&&i}});function n(){let n=e.isotope("getFilteredItemElements"),i=t(n);t(".ai-filter-btn").each(function(e,n){let o=t(n),a=o.attr("data-filter");if(!a)return;let r=i.filter(a).length;o.find(".ai-count").text(r)})}n(),t(".ai-filter-group").on("click",".ai-filter-btn",function(){t(this).siblings().removeClass("ai-filter-btn-active"),t(this).addClass("ai-filter-btn-active");let i=t(this),o=i.parents(".ai-filter-group").attr("data-filter-group");d[o]=i.attr("data-filter"),c=function(t){let e="";for(let n in t)e+=t[n];return e}(d),setTimeout(function(){e.isotope(),n()},1)});let i=t(".ai-search-filter").keyup(function(t,e){let n;return e=e||100,function(){clearTimeout(n);let i=arguments,o=this;n=setTimeout(function(){t.apply(o,i)},e)}}(function(){u=new RegExp(i.val(),"gi"),e.isotope(),n()}))},1),function(){let t=l("reset"),e=l("from");"true"===t&&"ai-reset-wp"===e&&Swal.fire({title:advanced_import_object.text.resetSuccess.title,type:"success",allowOutsideClick:!1,confirmButtonColor:"#3085d6",cancelButtonColor:"#d33",confirmButtonText:advanced_import_object.text.resetSuccess.confirmButtonText})}()})}(jQuery);
|
assets/library/isotope/isotope.pkgd.min.js
ADDED
@@ -0,0 +1,12 @@
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
1 |
+
/*!
|
2 |
+
* Isotope PACKAGED v3.0.6
|
3 |
+
*
|
4 |
+
* Licensed GPLv3 for open source use
|
5 |
+
* or Isotope Commercial License for commercial use
|
6 |
+
*
|
7 |
+
* https://isotope.metafizzy.co
|
8 |
+
* Copyright 2010-2018 Metafizzy
|
9 |
+
*/
|
10 |
+
|
11 |
+
!function(t,e){"function"==typeof define&&define.amd?define("jquery-bridget/jquery-bridget",["jquery"],function(i){return e(t,i)}):"object"==typeof module&&module.exports?module.exports=e(t,require("jquery")):t.jQueryBridget=e(t,t.jQuery)}(window,function(t,e){"use strict";function i(i,s,a){function u(t,e,o){var n,s="$()."+i+'("'+e+'")';return t.each(function(t,u){var h=a.data(u,i);if(!h)return void r(i+" not initialized. Cannot call methods, i.e. "+s);var d=h[e];if(!d||"_"==e.charAt(0))return void r(s+" is not a valid method");var l=d.apply(h,o);n=void 0===n?l:n}),void 0!==n?n:t}function h(t,e){t.each(function(t,o){var n=a.data(o,i);n?(n.option(e),n._init()):(n=new s(o,e),a.data(o,i,n))})}a=a||e||t.jQuery,a&&(s.prototype.option||(s.prototype.option=function(t){a.isPlainObject(t)&&(this.options=a.extend(!0,this.options,t))}),a.fn[i]=function(t){if("string"==typeof t){var e=n.call(arguments,1);return u(this,t,e)}return h(this,t),this},o(a))}function o(t){!t||t&&t.bridget||(t.bridget=i)}var n=Array.prototype.slice,s=t.console,r="undefined"==typeof s?function(){}:function(t){s.error(t)};return o(e||t.jQuery),i}),function(t,e){"function"==typeof define&&define.amd?define("ev-emitter/ev-emitter",e):"object"==typeof module&&module.exports?module.exports=e():t.EvEmitter=e()}("undefined"!=typeof window?window:this,function(){function t(){}var e=t.prototype;return e.on=function(t,e){if(t&&e){var i=this._events=this._events||{},o=i[t]=i[t]||[];return o.indexOf(e)==-1&&o.push(e),this}},e.once=function(t,e){if(t&&e){this.on(t,e);var i=this._onceEvents=this._onceEvents||{},o=i[t]=i[t]||{};return o[e]=!0,this}},e.off=function(t,e){var i=this._events&&this._events[t];if(i&&i.length){var o=i.indexOf(e);return o!=-1&&i.splice(o,1),this}},e.emitEvent=function(t,e){var i=this._events&&this._events[t];if(i&&i.length){i=i.slice(0),e=e||[];for(var o=this._onceEvents&&this._onceEvents[t],n=0;n<i.length;n++){var s=i[n],r=o&&o[s];r&&(this.off(t,s),delete o[s]),s.apply(this,e)}return this}},e.allOff=function(){delete this._events,delete this._onceEvents},t}),function(t,e){"function"==typeof define&&define.amd?define("get-size/get-size",e):"object"==typeof module&&module.exports?module.exports=e():t.getSize=e()}(window,function(){"use strict";function t(t){var e=parseFloat(t),i=t.indexOf("%")==-1&&!isNaN(e);return i&&e}function e(){}function i(){for(var t={width:0,height:0,innerWidth:0,innerHeight:0,outerWidth:0,outerHeight:0},e=0;e<h;e++){var i=u[e];t[i]=0}return t}function o(t){var e=getComputedStyle(t);return e||a("Style returned "+e+". Are you running this code in a hidden iframe on Firefox? See https://bit.ly/getsizebug1"),e}function n(){if(!d){d=!0;var e=document.createElement("div");e.style.width="200px",e.style.padding="1px 2px 3px 4px",e.style.borderStyle="solid",e.style.borderWidth="1px 2px 3px 4px",e.style.boxSizing="border-box";var i=document.body||document.documentElement;i.appendChild(e);var n=o(e);r=200==Math.round(t(n.width)),s.isBoxSizeOuter=r,i.removeChild(e)}}function s(e){if(n(),"string"==typeof e&&(e=document.querySelector(e)),e&&"object"==typeof e&&e.nodeType){var s=o(e);if("none"==s.display)return i();var a={};a.width=e.offsetWidth,a.height=e.offsetHeight;for(var d=a.isBorderBox="border-box"==s.boxSizing,l=0;l<h;l++){var f=u[l],c=s[f],m=parseFloat(c);a[f]=isNaN(m)?0:m}var p=a.paddingLeft+a.paddingRight,y=a.paddingTop+a.paddingBottom,g=a.marginLeft+a.marginRight,v=a.marginTop+a.marginBottom,_=a.borderLeftWidth+a.borderRightWidth,z=a.borderTopWidth+a.borderBottomWidth,I=d&&r,x=t(s.width);x!==!1&&(a.width=x+(I?0:p+_));var S=t(s.height);return S!==!1&&(a.height=S+(I?0:y+z)),a.innerWidth=a.width-(p+_),a.innerHeight=a.height-(y+z),a.outerWidth=a.width+g,a.outerHeight=a.height+v,a}}var r,a="undefined"==typeof console?e:function(t){console.error(t)},u=["paddingLeft","paddingRight","paddingTop","paddingBottom","marginLeft","marginRight","marginTop","marginBottom","borderLeftWidth","borderRightWidth","borderTopWidth","borderBottomWidth"],h=u.length,d=!1;return s}),function(t,e){"use strict";"function"==typeof define&&define.amd?define("desandro-matches-selector/matches-selector",e):"object"==typeof module&&module.exports?module.exports=e():t.matchesSelector=e()}(window,function(){"use strict";var t=function(){var t=window.Element.prototype;if(t.matches)return"matches";if(t.matchesSelector)return"matchesSelector";for(var e=["webkit","moz","ms","o"],i=0;i<e.length;i++){var o=e[i],n=o+"MatchesSelector";if(t[n])return n}}();return function(e,i){return e[t](i)}}),function(t,e){"function"==typeof define&&define.amd?define("fizzy-ui-utils/utils",["desandro-matches-selector/matches-selector"],function(i){return e(t,i)}):"object"==typeof module&&module.exports?module.exports=e(t,require("desandro-matches-selector")):t.fizzyUIUtils=e(t,t.matchesSelector)}(window,function(t,e){var i={};i.extend=function(t,e){for(var i in e)t[i]=e[i];return t},i.modulo=function(t,e){return(t%e+e)%e};var o=Array.prototype.slice;i.makeArray=function(t){if(Array.isArray(t))return t;if(null===t||void 0===t)return[];var e="object"==typeof t&&"number"==typeof t.length;return e?o.call(t):[t]},i.removeFrom=function(t,e){var i=t.indexOf(e);i!=-1&&t.splice(i,1)},i.getParent=function(t,i){for(;t.parentNode&&t!=document.body;)if(t=t.parentNode,e(t,i))return t},i.getQueryElement=function(t){return"string"==typeof t?document.querySelector(t):t},i.handleEvent=function(t){var e="on"+t.type;this[e]&&this[e](t)},i.filterFindElements=function(t,o){t=i.makeArray(t);var n=[];return t.forEach(function(t){if(t instanceof HTMLElement){if(!o)return void n.push(t);e(t,o)&&n.push(t);for(var i=t.querySelectorAll(o),s=0;s<i.length;s++)n.push(i[s])}}),n},i.debounceMethod=function(t,e,i){i=i||100;var o=t.prototype[e],n=e+"Timeout";t.prototype[e]=function(){var t=this[n];clearTimeout(t);var e=arguments,s=this;this[n]=setTimeout(function(){o.apply(s,e),delete s[n]},i)}},i.docReady=function(t){var e=document.readyState;"complete"==e||"interactive"==e?setTimeout(t):document.addEventListener("DOMContentLoaded",t)},i.toDashed=function(t){return t.replace(/(.)([A-Z])/g,function(t,e,i){return e+"-"+i}).toLowerCase()};var n=t.console;return i.htmlInit=function(e,o){i.docReady(function(){var s=i.toDashed(o),r="data-"+s,a=document.querySelectorAll("["+r+"]"),u=document.querySelectorAll(".js-"+s),h=i.makeArray(a).concat(i.makeArray(u)),d=r+"-options",l=t.jQuery;h.forEach(function(t){var i,s=t.getAttribute(r)||t.getAttribute(d);try{i=s&&JSON.parse(s)}catch(a){return void(n&&n.error("Error parsing "+r+" on "+t.className+": "+a))}var u=new e(t,i);l&&l.data(t,o,u)})})},i}),function(t,e){"function"==typeof define&&define.amd?define("outlayer/item",["ev-emitter/ev-emitter","get-size/get-size"],e):"object"==typeof module&&module.exports?module.exports=e(require("ev-emitter"),require("get-size")):(t.Outlayer={},t.Outlayer.Item=e(t.EvEmitter,t.getSize))}(window,function(t,e){"use strict";function i(t){for(var e in t)return!1;return e=null,!0}function o(t,e){t&&(this.element=t,this.layout=e,this.position={x:0,y:0},this._create())}function n(t){return t.replace(/([A-Z])/g,function(t){return"-"+t.toLowerCase()})}var s=document.documentElement.style,r="string"==typeof s.transition?"transition":"WebkitTransition",a="string"==typeof s.transform?"transform":"WebkitTransform",u={WebkitTransition:"webkitTransitionEnd",transition:"transitionend"}[r],h={transform:a,transition:r,transitionDuration:r+"Duration",transitionProperty:r+"Property",transitionDelay:r+"Delay"},d=o.prototype=Object.create(t.prototype);d.constructor=o,d._create=function(){this._transn={ingProperties:{},clean:{},onEnd:{}},this.css({position:"absolute"})},d.handleEvent=function(t){var e="on"+t.type;this[e]&&this[e](t)},d.getSize=function(){this.size=e(this.element)},d.css=function(t){var e=this.element.style;for(var i in t){var o=h[i]||i;e[o]=t[i]}},d.getPosition=function(){var t=getComputedStyle(this.element),e=this.layout._getOption("originLeft"),i=this.layout._getOption("originTop"),o=t[e?"left":"right"],n=t[i?"top":"bottom"],s=parseFloat(o),r=parseFloat(n),a=this.layout.size;o.indexOf("%")!=-1&&(s=s/100*a.width),n.indexOf("%")!=-1&&(r=r/100*a.height),s=isNaN(s)?0:s,r=isNaN(r)?0:r,s-=e?a.paddingLeft:a.paddingRight,r-=i?a.paddingTop:a.paddingBottom,this.position.x=s,this.position.y=r},d.layoutPosition=function(){var t=this.layout.size,e={},i=this.layout._getOption("originLeft"),o=this.layout._getOption("originTop"),n=i?"paddingLeft":"paddingRight",s=i?"left":"right",r=i?"right":"left",a=this.position.x+t[n];e[s]=this.getXValue(a),e[r]="";var u=o?"paddingTop":"paddingBottom",h=o?"top":"bottom",d=o?"bottom":"top",l=this.position.y+t[u];e[h]=this.getYValue(l),e[d]="",this.css(e),this.emitEvent("layout",[this])},d.getXValue=function(t){var e=this.layout._getOption("horizontal");return this.layout.options.percentPosition&&!e?t/this.layout.size.width*100+"%":t+"px"},d.getYValue=function(t){var e=this.layout._getOption("horizontal");return this.layout.options.percentPosition&&e?t/this.layout.size.height*100+"%":t+"px"},d._transitionTo=function(t,e){this.getPosition();var i=this.position.x,o=this.position.y,n=t==this.position.x&&e==this.position.y;if(this.setPosition(t,e),n&&!this.isTransitioning)return void this.layoutPosition();var s=t-i,r=e-o,a={};a.transform=this.getTranslate(s,r),this.transition({to:a,onTransitionEnd:{transform:this.layoutPosition},isCleaning:!0})},d.getTranslate=function(t,e){var i=this.layout._getOption("originLeft"),o=this.layout._getOption("originTop");return t=i?t:-t,e=o?e:-e,"translate3d("+t+"px, "+e+"px, 0)"},d.goTo=function(t,e){this.setPosition(t,e),this.layoutPosition()},d.moveTo=d._transitionTo,d.setPosition=function(t,e){this.position.x=parseFloat(t),this.position.y=parseFloat(e)},d._nonTransition=function(t){this.css(t.to),t.isCleaning&&this._removeStyles(t.to);for(var e in t.onTransitionEnd)t.onTransitionEnd[e].call(this)},d.transition=function(t){if(!parseFloat(this.layout.options.transitionDuration))return void this._nonTransition(t);var e=this._transn;for(var i in t.onTransitionEnd)e.onEnd[i]=t.onTransitionEnd[i];for(i in t.to)e.ingProperties[i]=!0,t.isCleaning&&(e.clean[i]=!0);if(t.from){this.css(t.from);var o=this.element.offsetHeight;o=null}this.enableTransition(t.to),this.css(t.to),this.isTransitioning=!0};var l="opacity,"+n(a);d.enableTransition=function(){if(!this.isTransitioning){var t=this.layout.options.transitionDuration;t="number"==typeof t?t+"ms":t,this.css({transitionProperty:l,transitionDuration:t,transitionDelay:this.staggerDelay||0}),this.element.addEventListener(u,this,!1)}},d.onwebkitTransitionEnd=function(t){this.ontransitionend(t)},d.onotransitionend=function(t){this.ontransitionend(t)};var f={"-webkit-transform":"transform"};d.ontransitionend=function(t){if(t.target===this.element){var e=this._transn,o=f[t.propertyName]||t.propertyName;if(delete e.ingProperties[o],i(e.ingProperties)&&this.disableTransition(),o in e.clean&&(this.element.style[t.propertyName]="",delete e.clean[o]),o in e.onEnd){var n=e.onEnd[o];n.call(this),delete e.onEnd[o]}this.emitEvent("transitionEnd",[this])}},d.disableTransition=function(){this.removeTransitionStyles(),this.element.removeEventListener(u,this,!1),this.isTransitioning=!1},d._removeStyles=function(t){var e={};for(var i in t)e[i]="";this.css(e)};var c={transitionProperty:"",transitionDuration:"",transitionDelay:""};return d.removeTransitionStyles=function(){this.css(c)},d.stagger=function(t){t=isNaN(t)?0:t,this.staggerDelay=t+"ms"},d.removeElem=function(){this.element.parentNode.removeChild(this.element),this.css({display:""}),this.emitEvent("remove",[this])},d.remove=function(){return r&&parseFloat(this.layout.options.transitionDuration)?(this.once("transitionEnd",function(){this.removeElem()}),void this.hide()):void this.removeElem()},d.reveal=function(){delete this.isHidden,this.css({display:""});var t=this.layout.options,e={},i=this.getHideRevealTransitionEndProperty("visibleStyle");e[i]=this.onRevealTransitionEnd,this.transition({from:t.hiddenStyle,to:t.visibleStyle,isCleaning:!0,onTransitionEnd:e})},d.onRevealTransitionEnd=function(){this.isHidden||this.emitEvent("reveal")},d.getHideRevealTransitionEndProperty=function(t){var e=this.layout.options[t];if(e.opacity)return"opacity";for(var i in e)return i},d.hide=function(){this.isHidden=!0,this.css({display:""});var t=this.layout.options,e={},i=this.getHideRevealTransitionEndProperty("hiddenStyle");e[i]=this.onHideTransitionEnd,this.transition({from:t.visibleStyle,to:t.hiddenStyle,isCleaning:!0,onTransitionEnd:e})},d.onHideTransitionEnd=function(){this.isHidden&&(this.css({display:"none"}),this.emitEvent("hide"))},d.destroy=function(){this.css({position:"",left:"",right:"",top:"",bottom:"",transition:"",transform:""})},o}),function(t,e){"use strict";"function"==typeof define&&define.amd?define("outlayer/outlayer",["ev-emitter/ev-emitter","get-size/get-size","fizzy-ui-utils/utils","./item"],function(i,o,n,s){return e(t,i,o,n,s)}):"object"==typeof module&&module.exports?module.exports=e(t,require("ev-emitter"),require("get-size"),require("fizzy-ui-utils"),require("./item")):t.Outlayer=e(t,t.EvEmitter,t.getSize,t.fizzyUIUtils,t.Outlayer.Item)}(window,function(t,e,i,o,n){"use strict";function s(t,e){var i=o.getQueryElement(t);if(!i)return void(u&&u.error("Bad element for "+this.constructor.namespace+": "+(i||t)));this.element=i,h&&(this.$element=h(this.element)),this.options=o.extend({},this.constructor.defaults),this.option(e);var n=++l;this.element.outlayerGUID=n,f[n]=this,this._create();var s=this._getOption("initLayout");s&&this.layout()}function r(t){function e(){t.apply(this,arguments)}return e.prototype=Object.create(t.prototype),e.prototype.constructor=e,e}function a(t){if("number"==typeof t)return t;var e=t.match(/(^\d*\.?\d*)(\w*)/),i=e&&e[1],o=e&&e[2];if(!i.length)return 0;i=parseFloat(i);var n=m[o]||1;return i*n}var u=t.console,h=t.jQuery,d=function(){},l=0,f={};s.namespace="outlayer",s.Item=n,s.defaults={containerStyle:{position:"relative"},initLayout:!0,originLeft:!0,originTop:!0,resize:!0,resizeContainer:!0,transitionDuration:"0.4s",hiddenStyle:{opacity:0,transform:"scale(0.001)"},visibleStyle:{opacity:1,transform:"scale(1)"}};var c=s.prototype;o.extend(c,e.prototype),c.option=function(t){o.extend(this.options,t)},c._getOption=function(t){var e=this.constructor.compatOptions[t];return e&&void 0!==this.options[e]?this.options[e]:this.options[t]},s.compatOptions={initLayout:"isInitLayout",horizontal:"isHorizontal",layoutInstant:"isLayoutInstant",originLeft:"isOriginLeft",originTop:"isOriginTop",resize:"isResizeBound",resizeContainer:"isResizingContainer"},c._create=function(){this.reloadItems(),this.stamps=[],this.stamp(this.options.stamp),o.extend(this.element.style,this.options.containerStyle);var t=this._getOption("resize");t&&this.bindResize()},c.reloadItems=function(){this.items=this._itemize(this.element.children)},c._itemize=function(t){for(var e=this._filterFindItemElements(t),i=this.constructor.Item,o=[],n=0;n<e.length;n++){var s=e[n],r=new i(s,this);o.push(r)}return o},c._filterFindItemElements=function(t){return o.filterFindElements(t,this.options.itemSelector)},c.getItemElements=function(){return this.items.map(function(t){return t.element})},c.layout=function(){this._resetLayout(),this._manageStamps();var t=this._getOption("layoutInstant"),e=void 0!==t?t:!this._isLayoutInited;this.layoutItems(this.items,e),this._isLayoutInited=!0},c._init=c.layout,c._resetLayout=function(){this.getSize()},c.getSize=function(){this.size=i(this.element)},c._getMeasurement=function(t,e){var o,n=this.options[t];n?("string"==typeof n?o=this.element.querySelector(n):n instanceof HTMLElement&&(o=n),this[t]=o?i(o)[e]:n):this[t]=0},c.layoutItems=function(t,e){t=this._getItemsForLayout(t),this._layoutItems(t,e),this._postLayout()},c._getItemsForLayout=function(t){return t.filter(function(t){return!t.isIgnored})},c._layoutItems=function(t,e){if(this._emitCompleteOnItems("layout",t),t&&t.length){var i=[];t.forEach(function(t){var o=this._getItemLayoutPosition(t);o.item=t,o.isInstant=e||t.isLayoutInstant,i.push(o)},this),this._processLayoutQueue(i)}},c._getItemLayoutPosition=function(){return{x:0,y:0}},c._processLayoutQueue=function(t){this.updateStagger(),t.forEach(function(t,e){this._positionItem(t.item,t.x,t.y,t.isInstant,e)},this)},c.updateStagger=function(){var t=this.options.stagger;return null===t||void 0===t?void(this.stagger=0):(this.stagger=a(t),this.stagger)},c._positionItem=function(t,e,i,o,n){o?t.goTo(e,i):(t.stagger(n*this.stagger),t.moveTo(e,i))},c._postLayout=function(){this.resizeContainer()},c.resizeContainer=function(){var t=this._getOption("resizeContainer");if(t){var e=this._getContainerSize();e&&(this._setContainerMeasure(e.width,!0),this._setContainerMeasure(e.height,!1))}},c._getContainerSize=d,c._setContainerMeasure=function(t,e){if(void 0!==t){var i=this.size;i.isBorderBox&&(t+=e?i.paddingLeft+i.paddingRight+i.borderLeftWidth+i.borderRightWidth:i.paddingBottom+i.paddingTop+i.borderTopWidth+i.borderBottomWidth),t=Math.max(t,0),this.element.style[e?"width":"height"]=t+"px"}},c._emitCompleteOnItems=function(t,e){function i(){n.dispatchEvent(t+"Complete",null,[e])}function o(){r++,r==s&&i()}var n=this,s=e.length;if(!e||!s)return void i();var r=0;e.forEach(function(e){e.once(t,o)})},c.dispatchEvent=function(t,e,i){var o=e?[e].concat(i):i;if(this.emitEvent(t,o),h)if(this.$element=this.$element||h(this.element),e){var n=h.Event(e);n.type=t,this.$element.trigger(n,i)}else this.$element.trigger(t,i)},c.ignore=function(t){var e=this.getItem(t);e&&(e.isIgnored=!0)},c.unignore=function(t){var e=this.getItem(t);e&&delete e.isIgnored},c.stamp=function(t){t=this._find(t),t&&(this.stamps=this.stamps.concat(t),t.forEach(this.ignore,this))},c.unstamp=function(t){t=this._find(t),t&&t.forEach(function(t){o.removeFrom(this.stamps,t),this.unignore(t)},this)},c._find=function(t){if(t)return"string"==typeof t&&(t=this.element.querySelectorAll(t)),t=o.makeArray(t)},c._manageStamps=function(){this.stamps&&this.stamps.length&&(this._getBoundingRect(),this.stamps.forEach(this._manageStamp,this))},c._getBoundingRect=function(){var t=this.element.getBoundingClientRect(),e=this.size;this._boundingRect={left:t.left+e.paddingLeft+e.borderLeftWidth,top:t.top+e.paddingTop+e.borderTopWidth,right:t.right-(e.paddingRight+e.borderRightWidth),bottom:t.bottom-(e.paddingBottom+e.borderBottomWidth)}},c._manageStamp=d,c._getElementOffset=function(t){var e=t.getBoundingClientRect(),o=this._boundingRect,n=i(t),s={left:e.left-o.left-n.marginLeft,top:e.top-o.top-n.marginTop,right:o.right-e.right-n.marginRight,bottom:o.bottom-e.bottom-n.marginBottom};return s},c.handleEvent=o.handleEvent,c.bindResize=function(){t.addEventListener("resize",this),this.isResizeBound=!0},c.unbindResize=function(){t.removeEventListener("resize",this),this.isResizeBound=!1},c.onresize=function(){this.resize()},o.debounceMethod(s,"onresize",100),c.resize=function(){this.isResizeBound&&this.needsResizeLayout()&&this.layout()},c.needsResizeLayout=function(){var t=i(this.element),e=this.size&&t;return e&&t.innerWidth!==this.size.innerWidth},c.addItems=function(t){var e=this._itemize(t);return e.length&&(this.items=this.items.concat(e)),e},c.appended=function(t){var e=this.addItems(t);e.length&&(this.layoutItems(e,!0),this.reveal(e))},c.prepended=function(t){var e=this._itemize(t);if(e.length){var i=this.items.slice(0);this.items=e.concat(i),this._resetLayout(),this._manageStamps(),this.layoutItems(e,!0),this.reveal(e),this.layoutItems(i)}},c.reveal=function(t){if(this._emitCompleteOnItems("reveal",t),t&&t.length){var e=this.updateStagger();t.forEach(function(t,i){t.stagger(i*e),t.reveal()})}},c.hide=function(t){if(this._emitCompleteOnItems("hide",t),t&&t.length){var e=this.updateStagger();t.forEach(function(t,i){t.stagger(i*e),t.hide()})}},c.revealItemElements=function(t){var e=this.getItems(t);this.reveal(e)},c.hideItemElements=function(t){var e=this.getItems(t);this.hide(e)},c.getItem=function(t){for(var e=0;e<this.items.length;e++){var i=this.items[e];if(i.element==t)return i}},c.getItems=function(t){t=o.makeArray(t);var e=[];return t.forEach(function(t){var i=this.getItem(t);i&&e.push(i)},this),e},c.remove=function(t){var e=this.getItems(t);this._emitCompleteOnItems("remove",e),e&&e.length&&e.forEach(function(t){t.remove(),o.removeFrom(this.items,t)},this)},c.destroy=function(){var t=this.element.style;t.height="",t.position="",t.width="",this.items.forEach(function(t){t.destroy()}),this.unbindResize();var e=this.element.outlayerGUID;delete f[e],delete this.element.outlayerGUID,h&&h.removeData(this.element,this.constructor.namespace)},s.data=function(t){t=o.getQueryElement(t);var e=t&&t.outlayerGUID;return e&&f[e]},s.create=function(t,e){var i=r(s);return i.defaults=o.extend({},s.defaults),o.extend(i.defaults,e),i.compatOptions=o.extend({},s.compatOptions),i.namespace=t,i.data=s.data,i.Item=r(n),o.htmlInit(i,t),h&&h.bridget&&h.bridget(t,i),i};var m={ms:1,s:1e3};return s.Item=n,s}),function(t,e){"function"==typeof define&&define.amd?define("isotope-layout/js/item",["outlayer/outlayer"],e):"object"==typeof module&&module.exports?module.exports=e(require("outlayer")):(t.Isotope=t.Isotope||{},t.Isotope.Item=e(t.Outlayer))}(window,function(t){"use strict";function e(){t.Item.apply(this,arguments)}var i=e.prototype=Object.create(t.Item.prototype),o=i._create;i._create=function(){this.id=this.layout.itemGUID++,o.call(this),this.sortData={}},i.updateSortData=function(){if(!this.isIgnored){this.sortData.id=this.id,this.sortData["original-order"]=this.id,this.sortData.random=Math.random();var t=this.layout.options.getSortData,e=this.layout._sorters;for(var i in t){var o=e[i];this.sortData[i]=o(this.element,this)}}};var n=i.destroy;return i.destroy=function(){n.apply(this,arguments),this.css({display:""})},e}),function(t,e){"function"==typeof define&&define.amd?define("isotope-layout/js/layout-mode",["get-size/get-size","outlayer/outlayer"],e):"object"==typeof module&&module.exports?module.exports=e(require("get-size"),require("outlayer")):(t.Isotope=t.Isotope||{},t.Isotope.LayoutMode=e(t.getSize,t.Outlayer))}(window,function(t,e){"use strict";function i(t){this.isotope=t,t&&(this.options=t.options[this.namespace],this.element=t.element,this.items=t.filteredItems,this.size=t.size)}var o=i.prototype,n=["_resetLayout","_getItemLayoutPosition","_manageStamp","_getContainerSize","_getElementOffset","needsResizeLayout","_getOption"];return n.forEach(function(t){o[t]=function(){return e.prototype[t].apply(this.isotope,arguments)}}),o.needsVerticalResizeLayout=function(){var e=t(this.isotope.element),i=this.isotope.size&&e;return i&&e.innerHeight!=this.isotope.size.innerHeight},o._getMeasurement=function(){this.isotope._getMeasurement.apply(this,arguments)},o.getColumnWidth=function(){this.getSegmentSize("column","Width")},o.getRowHeight=function(){this.getSegmentSize("row","Height")},o.getSegmentSize=function(t,e){var i=t+e,o="outer"+e;if(this._getMeasurement(i,o),!this[i]){var n=this.getFirstItemSize();this[i]=n&&n[o]||this.isotope.size["inner"+e]}},o.getFirstItemSize=function(){var e=this.isotope.filteredItems[0];return e&&e.element&&t(e.element)},o.layout=function(){this.isotope.layout.apply(this.isotope,arguments)},o.getSize=function(){this.isotope.getSize(),this.size=this.isotope.size},i.modes={},i.create=function(t,e){function n(){i.apply(this,arguments)}return n.prototype=Object.create(o),n.prototype.constructor=n,e&&(n.options=e),n.prototype.namespace=t,i.modes[t]=n,n},i}),function(t,e){"function"==typeof define&&define.amd?define("masonry-layout/masonry",["outlayer/outlayer","get-size/get-size"],e):"object"==typeof module&&module.exports?module.exports=e(require("outlayer"),require("get-size")):t.Masonry=e(t.Outlayer,t.getSize)}(window,function(t,e){var i=t.create("masonry");i.compatOptions.fitWidth="isFitWidth";var o=i.prototype;return o._resetLayout=function(){this.getSize(),this._getMeasurement("columnWidth","outerWidth"),this._getMeasurement("gutter","outerWidth"),this.measureColumns(),this.colYs=[];for(var t=0;t<this.cols;t++)this.colYs.push(0);this.maxY=0,this.horizontalColIndex=0},o.measureColumns=function(){if(this.getContainerWidth(),!this.columnWidth){var t=this.items[0],i=t&&t.element;this.columnWidth=i&&e(i).outerWidth||this.containerWidth}var o=this.columnWidth+=this.gutter,n=this.containerWidth+this.gutter,s=n/o,r=o-n%o,a=r&&r<1?"round":"floor";s=Math[a](s),this.cols=Math.max(s,1)},o.getContainerWidth=function(){var t=this._getOption("fitWidth"),i=t?this.element.parentNode:this.element,o=e(i);this.containerWidth=o&&o.innerWidth},o._getItemLayoutPosition=function(t){t.getSize();var e=t.size.outerWidth%this.columnWidth,i=e&&e<1?"round":"ceil",o=Math[i](t.size.outerWidth/this.columnWidth);o=Math.min(o,this.cols);for(var n=this.options.horizontalOrder?"_getHorizontalColPosition":"_getTopColPosition",s=this[n](o,t),r={x:this.columnWidth*s.col,y:s.y},a=s.y+t.size.outerHeight,u=o+s.col,h=s.col;h<u;h++)this.colYs[h]=a;return r},o._getTopColPosition=function(t){var e=this._getTopColGroup(t),i=Math.min.apply(Math,e);return{col:e.indexOf(i),y:i}},o._getTopColGroup=function(t){if(t<2)return this.colYs;for(var e=[],i=this.cols+1-t,o=0;o<i;o++)e[o]=this._getColGroupY(o,t);return e},o._getColGroupY=function(t,e){if(e<2)return this.colYs[t];var i=this.colYs.slice(t,t+e);return Math.max.apply(Math,i)},o._getHorizontalColPosition=function(t,e){var i=this.horizontalColIndex%this.cols,o=t>1&&i+t>this.cols;i=o?0:i;var n=e.size.outerWidth&&e.size.outerHeight;return this.horizontalColIndex=n?i+t:this.horizontalColIndex,{col:i,y:this._getColGroupY(i,t)}},o._manageStamp=function(t){var i=e(t),o=this._getElementOffset(t),n=this._getOption("originLeft"),s=n?o.left:o.right,r=s+i.outerWidth,a=Math.floor(s/this.columnWidth);a=Math.max(0,a);var u=Math.floor(r/this.columnWidth);u-=r%this.columnWidth?0:1,u=Math.min(this.cols-1,u);for(var h=this._getOption("originTop"),d=(h?o.top:o.bottom)+i.outerHeight,l=a;l<=u;l++)this.colYs[l]=Math.max(d,this.colYs[l])},o._getContainerSize=function(){this.maxY=Math.max.apply(Math,this.colYs);var t={height:this.maxY};return this._getOption("fitWidth")&&(t.width=this._getContainerFitWidth()),t},o._getContainerFitWidth=function(){for(var t=0,e=this.cols;--e&&0===this.colYs[e];)t++;return(this.cols-t)*this.columnWidth-this.gutter},o.needsResizeLayout=function(){var t=this.containerWidth;return this.getContainerWidth(),t!=this.containerWidth},i}),function(t,e){"function"==typeof define&&define.amd?define("isotope-layout/js/layout-modes/masonry",["../layout-mode","masonry-layout/masonry"],e):"object"==typeof module&&module.exports?module.exports=e(require("../layout-mode"),require("masonry-layout")):e(t.Isotope.LayoutMode,t.Masonry)}(window,function(t,e){"use strict";var i=t.create("masonry"),o=i.prototype,n={_getElementOffset:!0,layout:!0,_getMeasurement:!0};for(var s in e.prototype)n[s]||(o[s]=e.prototype[s]);var r=o.measureColumns;o.measureColumns=function(){this.items=this.isotope.filteredItems,r.call(this)};var a=o._getOption;return o._getOption=function(t){return"fitWidth"==t?void 0!==this.options.isFitWidth?this.options.isFitWidth:this.options.fitWidth:a.apply(this.isotope,arguments)},i}),function(t,e){"function"==typeof define&&define.amd?define("isotope-layout/js/layout-modes/fit-rows",["../layout-mode"],e):"object"==typeof exports?module.exports=e(require("../layout-mode")):e(t.Isotope.LayoutMode)}(window,function(t){"use strict";var e=t.create("fitRows"),i=e.prototype;return i._resetLayout=function(){this.x=0,this.y=0,this.maxY=0,this._getMeasurement("gutter","outerWidth")},i._getItemLayoutPosition=function(t){t.getSize();var e=t.size.outerWidth+this.gutter,i=this.isotope.size.innerWidth+this.gutter;0!==this.x&&e+this.x>i&&(this.x=0,this.y=this.maxY);var o={x:this.x,y:this.y};return this.maxY=Math.max(this.maxY,this.y+t.size.outerHeight),this.x+=e,o},i._getContainerSize=function(){return{height:this.maxY}},e}),function(t,e){"function"==typeof define&&define.amd?define("isotope-layout/js/layout-modes/vertical",["../layout-mode"],e):"object"==typeof module&&module.exports?module.exports=e(require("../layout-mode")):e(t.Isotope.LayoutMode)}(window,function(t){"use strict";var e=t.create("vertical",{horizontalAlignment:0}),i=e.prototype;return i._resetLayout=function(){this.y=0},i._getItemLayoutPosition=function(t){t.getSize();var e=(this.isotope.size.innerWidth-t.size.outerWidth)*this.options.horizontalAlignment,i=this.y;return this.y+=t.size.outerHeight,{x:e,y:i}},i._getContainerSize=function(){return{height:this.y}},e}),function(t,e){"function"==typeof define&&define.amd?define(["outlayer/outlayer","get-size/get-size","desandro-matches-selector/matches-selector","fizzy-ui-utils/utils","isotope-layout/js/item","isotope-layout/js/layout-mode","isotope-layout/js/layout-modes/masonry","isotope-layout/js/layout-modes/fit-rows","isotope-layout/js/layout-modes/vertical"],function(i,o,n,s,r,a){return e(t,i,o,n,s,r,a)}):"object"==typeof module&&module.exports?module.exports=e(t,require("outlayer"),require("get-size"),require("desandro-matches-selector"),require("fizzy-ui-utils"),require("isotope-layout/js/item"),require("isotope-layout/js/layout-mode"),require("isotope-layout/js/layout-modes/masonry"),require("isotope-layout/js/layout-modes/fit-rows"),require("isotope-layout/js/layout-modes/vertical")):t.Isotope=e(t,t.Outlayer,t.getSize,t.matchesSelector,t.fizzyUIUtils,t.Isotope.Item,t.Isotope.LayoutMode)}(window,function(t,e,i,o,n,s,r){function a(t,e){return function(i,o){for(var n=0;n<t.length;n++){var s=t[n],r=i.sortData[s],a=o.sortData[s];if(r>a||r<a){var u=void 0!==e[s]?e[s]:e,h=u?1:-1;return(r>a?1:-1)*h}}return 0}}var u=t.jQuery,h=String.prototype.trim?function(t){return t.trim()}:function(t){return t.replace(/^\s+|\s+$/g,"")},d=e.create("isotope",{layoutMode:"masonry",isJQueryFiltering:!0,sortAscending:!0});d.Item=s,d.LayoutMode=r;var l=d.prototype;l._create=function(){this.itemGUID=0,this._sorters={},this._getSorters(),e.prototype._create.call(this),this.modes={},this.filteredItems=this.items,this.sortHistory=["original-order"];for(var t in r.modes)this._initLayoutMode(t)},l.reloadItems=function(){this.itemGUID=0,e.prototype.reloadItems.call(this)},l._itemize=function(){for(var t=e.prototype._itemize.apply(this,arguments),i=0;i<t.length;i++){var o=t[i];o.id=this.itemGUID++}return this._updateItemsSortData(t),t},l._initLayoutMode=function(t){var e=r.modes[t],i=this.options[t]||{};this.options[t]=e.options?n.extend(e.options,i):i,this.modes[t]=new e(this)},l.layout=function(){return!this._isLayoutInited&&this._getOption("initLayout")?void this.arrange():void this._layout()},l._layout=function(){var t=this._getIsInstant();this._resetLayout(),this._manageStamps(),this.layoutItems(this.filteredItems,t),this._isLayoutInited=!0},l.arrange=function(t){this.option(t),this._getIsInstant();var e=this._filter(this.items);this.filteredItems=e.matches,this._bindArrangeComplete(),this._isInstant?this._noTransition(this._hideReveal,[e]):this._hideReveal(e),this._sort(),this._layout()},l._init=l.arrange,l._hideReveal=function(t){this.reveal(t.needReveal),this.hide(t.needHide)},l._getIsInstant=function(){var t=this._getOption("layoutInstant"),e=void 0!==t?t:!this._isLayoutInited;return this._isInstant=e,e},l._bindArrangeComplete=function(){function t(){e&&i&&o&&n.dispatchEvent("arrangeComplete",null,[n.filteredItems])}var e,i,o,n=this;this.once("layoutComplete",function(){e=!0,t()}),this.once("hideComplete",function(){i=!0,t()}),this.once("revealComplete",function(){o=!0,t()})},l._filter=function(t){var e=this.options.filter;e=e||"*";for(var i=[],o=[],n=[],s=this._getFilterTest(e),r=0;r<t.length;r++){var a=t[r];if(!a.isIgnored){var u=s(a);u&&i.push(a),u&&a.isHidden?o.push(a):u||a.isHidden||n.push(a)}}return{matches:i,needReveal:o,needHide:n}},l._getFilterTest=function(t){return u&&this.options.isJQueryFiltering?function(e){return u(e.element).is(t);
|
12 |
+
}:"function"==typeof t?function(e){return t(e.element)}:function(e){return o(e.element,t)}},l.updateSortData=function(t){var e;t?(t=n.makeArray(t),e=this.getItems(t)):e=this.items,this._getSorters(),this._updateItemsSortData(e)},l._getSorters=function(){var t=this.options.getSortData;for(var e in t){var i=t[e];this._sorters[e]=f(i)}},l._updateItemsSortData=function(t){for(var e=t&&t.length,i=0;e&&i<e;i++){var o=t[i];o.updateSortData()}};var f=function(){function t(t){if("string"!=typeof t)return t;var i=h(t).split(" "),o=i[0],n=o.match(/^\[(.+)\]$/),s=n&&n[1],r=e(s,o),a=d.sortDataParsers[i[1]];return t=a?function(t){return t&&a(r(t))}:function(t){return t&&r(t)}}function e(t,e){return t?function(e){return e.getAttribute(t)}:function(t){var i=t.querySelector(e);return i&&i.textContent}}return t}();d.sortDataParsers={parseInt:function(t){return parseInt(t,10)},parseFloat:function(t){return parseFloat(t)}},l._sort=function(){if(this.options.sortBy){var t=n.makeArray(this.options.sortBy);this._getIsSameSortBy(t)||(this.sortHistory=t.concat(this.sortHistory));var e=a(this.sortHistory,this.options.sortAscending);this.filteredItems.sort(e)}},l._getIsSameSortBy=function(t){for(var e=0;e<t.length;e++)if(t[e]!=this.sortHistory[e])return!1;return!0},l._mode=function(){var t=this.options.layoutMode,e=this.modes[t];if(!e)throw new Error("No layout mode: "+t);return e.options=this.options[t],e},l._resetLayout=function(){e.prototype._resetLayout.call(this),this._mode()._resetLayout()},l._getItemLayoutPosition=function(t){return this._mode()._getItemLayoutPosition(t)},l._manageStamp=function(t){this._mode()._manageStamp(t)},l._getContainerSize=function(){return this._mode()._getContainerSize()},l.needsResizeLayout=function(){return this._mode().needsResizeLayout()},l.appended=function(t){var e=this.addItems(t);if(e.length){var i=this._filterRevealAdded(e);this.filteredItems=this.filteredItems.concat(i)}},l.prepended=function(t){var e=this._itemize(t);if(e.length){this._resetLayout(),this._manageStamps();var i=this._filterRevealAdded(e);this.layoutItems(this.filteredItems),this.filteredItems=i.concat(this.filteredItems),this.items=e.concat(this.items)}},l._filterRevealAdded=function(t){var e=this._filter(t);return this.hide(e.needHide),this.reveal(e.matches),this.layoutItems(e.matches,!0),e.matches},l.insert=function(t){var e=this.addItems(t);if(e.length){var i,o,n=e.length;for(i=0;i<n;i++)o=e[i],this.element.appendChild(o.element);var s=this._filter(e).matches;for(i=0;i<n;i++)e[i].isLayoutInstant=!0;for(this.arrange(),i=0;i<n;i++)delete e[i].isLayoutInstant;this.reveal(s)}};var c=l.remove;return l.remove=function(t){t=n.makeArray(t);var e=this.getItems(t);c.call(this,t);for(var i=e&&e.length,o=0;i&&o<i;o++){var s=e[o];n.removeFrom(this.filteredItems,s)}},l.shuffle=function(){for(var t=0;t<this.items.length;t++){var e=this.items[t];e.sortData.random=Math.random()}this.options.sortBy="random",this._sort(),this._layout()},l._noTransition=function(t,e){var i=this.options.transitionDuration;this.options.transitionDuration=0;var o=t.apply(this,e);return this.options.transitionDuration=i,o},l.getFilteredItemElements=function(){return this.filteredItems.map(function(t){return t.element})},d});
|
assets/library/sweetalert2/sweetalert2.all.js
ADDED
@@ -0,0 +1,2792 @@
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
1 |
+
/*!
|
2 |
+
* sweetalert2 v8.11.8
|
3 |
+
* Released under the MIT License.
|
4 |
+
*/
|
5 |
+
(function (global, factory) {
|
6 |
+
typeof exports === 'object' && typeof module !== 'undefined' ? module.exports = factory() :
|
7 |
+
typeof define === 'function' && define.amd ? define(factory) :
|
8 |
+
(global.Sweetalert2 = factory());
|
9 |
+
}(this, (function () { 'use strict';
|
10 |
+
|
11 |
+
function _typeof(obj) {
|
12 |
+
if (typeof Symbol === "function" && typeof Symbol.iterator === "symbol") {
|
13 |
+
_typeof = function (obj) {
|
14 |
+
return typeof obj;
|
15 |
+
};
|
16 |
+
} else {
|
17 |
+
_typeof = function (obj) {
|
18 |
+
return obj && typeof Symbol === "function" && obj.constructor === Symbol && obj !== Symbol.prototype ? "symbol" : typeof obj;
|
19 |
+
};
|
20 |
+
}
|
21 |
+
|
22 |
+
return _typeof(obj);
|
23 |
+
}
|
24 |
+
|
25 |
+
function _classCallCheck(instance, Constructor) {
|
26 |
+
if (!(instance instanceof Constructor)) {
|
27 |
+
throw new TypeError("Cannot call a class as a function");
|
28 |
+
}
|
29 |
+
}
|
30 |
+
|
31 |
+
function _defineProperties(target, props) {
|
32 |
+
for (var i = 0; i < props.length; i++) {
|
33 |
+
var descriptor = props[i];
|
34 |
+
descriptor.enumerable = descriptor.enumerable || false;
|
35 |
+
descriptor.configurable = true;
|
36 |
+
if ("value" in descriptor) descriptor.writable = true;
|
37 |
+
Object.defineProperty(target, descriptor.key, descriptor);
|
38 |
+
}
|
39 |
+
}
|
40 |
+
|
41 |
+
function _createClass(Constructor, protoProps, staticProps) {
|
42 |
+
if (protoProps) _defineProperties(Constructor.prototype, protoProps);
|
43 |
+
if (staticProps) _defineProperties(Constructor, staticProps);
|
44 |
+
return Constructor;
|
45 |
+
}
|
46 |
+
|
47 |
+
function _extends() {
|
48 |
+
_extends = Object.assign || function (target) {
|
49 |
+
for (var i = 1; i < arguments.length; i++) {
|
50 |
+
var source = arguments[i];
|
51 |
+
|
52 |
+
for (var key in source) {
|
53 |
+
if (Object.prototype.hasOwnProperty.call(source, key)) {
|
54 |
+
target[key] = source[key];
|
55 |
+
}
|
56 |
+
}
|
57 |
+
}
|
58 |
+
|
59 |
+
return target;
|
60 |
+
};
|
61 |
+
|
62 |
+
return _extends.apply(this, arguments);
|
63 |
+
}
|
64 |
+
|
65 |
+
function _inherits(subClass, superClass) {
|
66 |
+
if (typeof superClass !== "function" && superClass !== null) {
|
67 |
+
throw new TypeError("Super expression must either be null or a function");
|
68 |
+
}
|
69 |
+
|
70 |
+
subClass.prototype = Object.create(superClass && superClass.prototype, {
|
71 |
+
constructor: {
|
72 |
+
value: subClass,
|
73 |
+
writable: true,
|
74 |
+
configurable: true
|
75 |
+
}
|
76 |
+
});
|
77 |
+
if (superClass) _setPrototypeOf(subClass, superClass);
|
78 |
+
}
|
79 |
+
|
80 |
+
function _getPrototypeOf(o) {
|
81 |
+
_getPrototypeOf = Object.setPrototypeOf ? Object.getPrototypeOf : function _getPrototypeOf(o) {
|
82 |
+
return o.__proto__ || Object.getPrototypeOf(o);
|
83 |
+
};
|
84 |
+
return _getPrototypeOf(o);
|
85 |
+
}
|
86 |
+
|
87 |
+
function _setPrototypeOf(o, p) {
|
88 |
+
_setPrototypeOf = Object.setPrototypeOf || function _setPrototypeOf(o, p) {
|
89 |
+
o.__proto__ = p;
|
90 |
+
return o;
|
91 |
+
};
|
92 |
+
|
93 |
+
return _setPrototypeOf(o, p);
|
94 |
+
}
|
95 |
+
|
96 |
+
function isNativeReflectConstruct() {
|
97 |
+
if (typeof Reflect === "undefined" || !Reflect.construct) return false;
|
98 |
+
if (Reflect.construct.sham) return false;
|
99 |
+
if (typeof Proxy === "function") return true;
|
100 |
+
|
101 |
+
try {
|
102 |
+
Date.prototype.toString.call(Reflect.construct(Date, [], function () {}));
|
103 |
+
return true;
|
104 |
+
} catch (e) {
|
105 |
+
return false;
|
106 |
+
}
|
107 |
+
}
|
108 |
+
|
109 |
+
function _construct(Parent, args, Class) {
|
110 |
+
if (isNativeReflectConstruct()) {
|
111 |
+
_construct = Reflect.construct;
|
112 |
+
} else {
|
113 |
+
_construct = function _construct(Parent, args, Class) {
|
114 |
+
var a = [null];
|
115 |
+
a.push.apply(a, args);
|
116 |
+
var Constructor = Function.bind.apply(Parent, a);
|
117 |
+
var instance = new Constructor();
|
118 |
+
if (Class) _setPrototypeOf(instance, Class.prototype);
|
119 |
+
return instance;
|
120 |
+
};
|
121 |
+
}
|
122 |
+
|
123 |
+
return _construct.apply(null, arguments);
|
124 |
+
}
|
125 |
+
|
126 |
+
function _assertThisInitialized(self) {
|
127 |
+
if (self === void 0) {
|
128 |
+
throw new ReferenceError("this hasn't been initialised - super() hasn't been called");
|
129 |
+
}
|
130 |
+
|
131 |
+
return self;
|
132 |
+
}
|
133 |
+
|
134 |
+
function _possibleConstructorReturn(self, call) {
|
135 |
+
if (call && (typeof call === "object" || typeof call === "function")) {
|
136 |
+
return call;
|
137 |
+
}
|
138 |
+
|
139 |
+
return _assertThisInitialized(self);
|
140 |
+
}
|
141 |
+
|
142 |
+
function _superPropBase(object, property) {
|
143 |
+
while (!Object.prototype.hasOwnProperty.call(object, property)) {
|
144 |
+
object = _getPrototypeOf(object);
|
145 |
+
if (object === null) break;
|
146 |
+
}
|
147 |
+
|
148 |
+
return object;
|
149 |
+
}
|
150 |
+
|
151 |
+
function _get(target, property, receiver) {
|
152 |
+
if (typeof Reflect !== "undefined" && Reflect.get) {
|
153 |
+
_get = Reflect.get;
|
154 |
+
} else {
|
155 |
+
_get = function _get(target, property, receiver) {
|
156 |
+
var base = _superPropBase(target, property);
|
157 |
+
|
158 |
+
if (!base) return;
|
159 |
+
var desc = Object.getOwnPropertyDescriptor(base, property);
|
160 |
+
|
161 |
+
if (desc.get) {
|
162 |
+
return desc.get.call(receiver);
|
163 |
+
}
|
164 |
+
|
165 |
+
return desc.value;
|
166 |
+
};
|
167 |
+
}
|
168 |
+
|
169 |
+
return _get(target, property, receiver || target);
|
170 |
+
}
|
171 |
+
|
172 |
+
var consolePrefix = 'SweetAlert2:';
|
173 |
+
/**
|
174 |
+
* Filter the unique values into a new array
|
175 |
+
* @param arr
|
176 |
+
*/
|
177 |
+
|
178 |
+
var uniqueArray = function uniqueArray(arr) {
|
179 |
+
var result = [];
|
180 |
+
|
181 |
+
for (var i = 0; i < arr.length; i++) {
|
182 |
+
if (result.indexOf(arr[i]) === -1) {
|
183 |
+
result.push(arr[i]);
|
184 |
+
}
|
185 |
+
}
|
186 |
+
|
187 |
+
return result;
|
188 |
+
};
|
189 |
+
/**
|
190 |
+
* Returns the array ob object values (Object.values isn't supported in IE11)
|
191 |
+
* @param obj
|
192 |
+
*/
|
193 |
+
|
194 |
+
var objectValues = function objectValues(obj) {
|
195 |
+
return Object.keys(obj).map(function (key) {
|
196 |
+
return obj[key];
|
197 |
+
});
|
198 |
+
};
|
199 |
+
/**
|
200 |
+
* Convert NodeList to Array
|
201 |
+
* @param nodeList
|
202 |
+
*/
|
203 |
+
|
204 |
+
var toArray = function toArray(nodeList) {
|
205 |
+
return Array.prototype.slice.call(nodeList);
|
206 |
+
};
|
207 |
+
/**
|
208 |
+
* Standardise console warnings
|
209 |
+
* @param message
|
210 |
+
*/
|
211 |
+
|
212 |
+
var warn = function warn(message) {
|
213 |
+
console.warn("".concat(consolePrefix, " ").concat(message));
|
214 |
+
};
|
215 |
+
/**
|
216 |
+
* Standardise console errors
|
217 |
+
* @param message
|
218 |
+
*/
|
219 |
+
|
220 |
+
var error = function error(message) {
|
221 |
+
console.error("".concat(consolePrefix, " ").concat(message));
|
222 |
+
};
|
223 |
+
/**
|
224 |
+
* Private global state for `warnOnce`
|
225 |
+
* @type {Array}
|
226 |
+
* @private
|
227 |
+
*/
|
228 |
+
|
229 |
+
var previousWarnOnceMessages = [];
|
230 |
+
/**
|
231 |
+
* Show a console warning, but only if it hasn't already been shown
|
232 |
+
* @param message
|
233 |
+
*/
|
234 |
+
|
235 |
+
var warnOnce = function warnOnce(message) {
|
236 |
+
if (!(previousWarnOnceMessages.indexOf(message) !== -1)) {
|
237 |
+
previousWarnOnceMessages.push(message);
|
238 |
+
warn(message);
|
239 |
+
}
|
240 |
+
};
|
241 |
+
/**
|
242 |
+
* Show a one-time console warning about deprecated params/methods
|
243 |
+
*/
|
244 |
+
|
245 |
+
var warnAboutDepreation = function warnAboutDepreation(deprecatedParam, useInstead) {
|
246 |
+
warnOnce("\"".concat(deprecatedParam, "\" is deprecated and will be removed in the next major release. Please use \"").concat(useInstead, "\" instead."));
|
247 |
+
};
|
248 |
+
/**
|
249 |
+
* If `arg` is a function, call it (with no arguments or context) and return the result.
|
250 |
+
* Otherwise, just pass the value through
|
251 |
+
* @param arg
|
252 |
+
*/
|
253 |
+
|
254 |
+
var callIfFunction = function callIfFunction(arg) {
|
255 |
+
return typeof arg === 'function' ? arg() : arg;
|
256 |
+
};
|
257 |
+
var isPromise = function isPromise(arg) {
|
258 |
+
return arg && Promise.resolve(arg) === arg;
|
259 |
+
};
|
260 |
+
|
261 |
+
var DismissReason = Object.freeze({
|
262 |
+
cancel: 'cancel',
|
263 |
+
backdrop: 'backdrop',
|
264 |
+
close: 'close',
|
265 |
+
esc: 'esc',
|
266 |
+
timer: 'timer'
|
267 |
+
});
|
268 |
+
|
269 |
+
var argsToParams = function argsToParams(args) {
|
270 |
+
var params = {};
|
271 |
+
|
272 |
+
switch (_typeof(args[0])) {
|
273 |
+
case 'object':
|
274 |
+
_extends(params, args[0]);
|
275 |
+
|
276 |
+
break;
|
277 |
+
|
278 |
+
default:
|
279 |
+
['title', 'html', 'type'].forEach(function (name, index) {
|
280 |
+
switch (_typeof(args[index])) {
|
281 |
+
case 'string':
|
282 |
+
params[name] = args[index];
|
283 |
+
break;
|
284 |
+
|
285 |
+
case 'undefined':
|
286 |
+
break;
|
287 |
+
|
288 |
+
default:
|
289 |
+
error("Unexpected type of ".concat(name, "! Expected \"string\", got ").concat(_typeof(args[index])));
|
290 |
+
}
|
291 |
+
});
|
292 |
+
}
|
293 |
+
|
294 |
+
return params;
|
295 |
+
};
|
296 |
+
|
297 |
+
var swalPrefix = 'swal2-';
|
298 |
+
var prefix = function prefix(items) {
|
299 |
+
var result = {};
|
300 |
+
|
301 |
+
for (var i in items) {
|
302 |
+
result[items[i]] = swalPrefix + items[i];
|
303 |
+
}
|
304 |
+
|
305 |
+
return result;
|
306 |
+
};
|
307 |
+
var swalClasses = prefix(['container', 'shown', 'height-auto', 'iosfix', 'popup', 'modal', 'no-backdrop', 'toast', 'toast-shown', 'toast-column', 'fade', 'show', 'hide', 'noanimation', 'close', 'title', 'header', 'content', 'actions', 'confirm', 'cancel', 'footer', 'icon', 'image', 'input', 'file', 'range', 'select', 'radio', 'checkbox', 'label', 'textarea', 'inputerror', 'validation-message', 'progress-steps', 'active-progress-step', 'progress-step', 'progress-step-line', 'loading', 'styled', 'top', 'top-start', 'top-end', 'top-left', 'top-right', 'center', 'center-start', 'center-end', 'center-left', 'center-right', 'bottom', 'bottom-start', 'bottom-end', 'bottom-left', 'bottom-right', 'grow-row', 'grow-column', 'grow-fullscreen', 'rtl']);
|
308 |
+
var iconTypes = prefix(['success', 'warning', 'info', 'question', 'error']);
|
309 |
+
|
310 |
+
var states = {
|
311 |
+
previousBodyPadding: null
|
312 |
+
};
|
313 |
+
var hasClass = function hasClass(elem, className) {
|
314 |
+
return elem.classList.contains(className);
|
315 |
+
};
|
316 |
+
var applyCustomClass = function applyCustomClass(elem, customClass, className) {
|
317 |
+
// Clean up previous custom classes
|
318 |
+
toArray(elem.classList).forEach(function (className) {
|
319 |
+
if (!(objectValues(swalClasses).indexOf(className) !== -1) && !(objectValues(iconTypes).indexOf(className) !== -1)) {
|
320 |
+
elem.classList.remove(className);
|
321 |
+
}
|
322 |
+
});
|
323 |
+
|
324 |
+
if (customClass && customClass[className]) {
|
325 |
+
addClass(elem, customClass[className]);
|
326 |
+
}
|
327 |
+
};
|
328 |
+
function getInput(content, inputType) {
|
329 |
+
if (!inputType) {
|
330 |
+
return null;
|
331 |
+
}
|
332 |
+
|
333 |
+
switch (inputType) {
|
334 |
+
case 'select':
|
335 |
+
case 'textarea':
|
336 |
+
case 'file':
|
337 |
+
return getChildByClass(content, swalClasses[inputType]);
|
338 |
+
|
339 |
+
case 'checkbox':
|
340 |
+
return content.querySelector(".".concat(swalClasses.checkbox, " input"));
|
341 |
+
|
342 |
+
case 'radio':
|
343 |
+
return content.querySelector(".".concat(swalClasses.radio, " input:checked")) || content.querySelector(".".concat(swalClasses.radio, " input:first-child"));
|
344 |
+
|
345 |
+
case 'range':
|
346 |
+
return content.querySelector(".".concat(swalClasses.range, " input"));
|
347 |
+
|
348 |
+
default:
|
349 |
+
return getChildByClass(content, swalClasses.input);
|
350 |
+
}
|
351 |
+
}
|
352 |
+
var focusInput = function focusInput(input) {
|
353 |
+
input.focus(); // place cursor at end of text in text input
|
354 |
+
|
355 |
+
if (input.type !== 'file') {
|
356 |
+
// http://stackoverflow.com/a/2345915
|
357 |
+
var val = input.value;
|
358 |
+
input.value = '';
|
359 |
+
input.value = val;
|
360 |
+
}
|
361 |
+
};
|
362 |
+
var toggleClass = function toggleClass(target, classList, condition) {
|
363 |
+
if (!target || !classList) {
|
364 |
+
return;
|
365 |
+
}
|
366 |
+
|
367 |
+
if (typeof classList === 'string') {
|
368 |
+
classList = classList.split(/\s+/).filter(Boolean);
|
369 |
+
}
|
370 |
+
|
371 |
+
classList.forEach(function (className) {
|
372 |
+
if (target.forEach) {
|
373 |
+
target.forEach(function (elem) {
|
374 |
+
condition ? elem.classList.add(className) : elem.classList.remove(className);
|
375 |
+
});
|
376 |
+
} else {
|
377 |
+
condition ? target.classList.add(className) : target.classList.remove(className);
|
378 |
+
}
|
379 |
+
});
|
380 |
+
};
|
381 |
+
var addClass = function addClass(target, classList) {
|
382 |
+
toggleClass(target, classList, true);
|
383 |
+
};
|
384 |
+
var removeClass = function removeClass(target, classList) {
|
385 |
+
toggleClass(target, classList, false);
|
386 |
+
};
|
387 |
+
var getChildByClass = function getChildByClass(elem, className) {
|
388 |
+
for (var i = 0; i < elem.childNodes.length; i++) {
|
389 |
+
if (hasClass(elem.childNodes[i], className)) {
|
390 |
+
return elem.childNodes[i];
|
391 |
+
}
|
392 |
+
}
|
393 |
+
};
|
394 |
+
var applyNumericalStyle = function applyNumericalStyle(elem, property, value) {
|
395 |
+
if (value || parseInt(value) === 0) {
|
396 |
+
elem.style[property] = typeof value === 'number' ? value + 'px' : value;
|
397 |
+
} else {
|
398 |
+
elem.style.removeProperty(property);
|
399 |
+
}
|
400 |
+
};
|
401 |
+
var show = function show(elem) {
|
402 |
+
var display = arguments.length > 1 && arguments[1] !== undefined ? arguments[1] : 'flex';
|
403 |
+
elem.style.opacity = '';
|
404 |
+
elem.style.display = display;
|
405 |
+
};
|
406 |
+
var hide = function hide(elem) {
|
407 |
+
elem.style.opacity = '';
|
408 |
+
elem.style.display = 'none';
|
409 |
+
};
|
410 |
+
var toggle = function toggle(elem, condition, display) {
|
411 |
+
condition ? show(elem, display) : hide(elem);
|
412 |
+
}; // borrowed from jquery $(elem).is(':visible') implementation
|
413 |
+
|
414 |
+
var isVisible = function isVisible(elem) {
|
415 |
+
return !!(elem && (elem.offsetWidth || elem.offsetHeight || elem.getClientRects().length));
|
416 |
+
};
|
417 |
+
var isScrollable = function isScrollable(elem) {
|
418 |
+
return !!(elem.scrollHeight > elem.clientHeight);
|
419 |
+
}; // borrowed from https://stackoverflow.com/a/46352119
|
420 |
+
|
421 |
+
var hasCssAnimation = function hasCssAnimation(elem) {
|
422 |
+
var style = window.getComputedStyle(elem);
|
423 |
+
var animDuration = parseFloat(style.getPropertyValue('animation-duration') || '0');
|
424 |
+
var transDuration = parseFloat(style.getPropertyValue('transition-duration') || '0');
|
425 |
+
return animDuration > 0 || transDuration > 0;
|
426 |
+
};
|
427 |
+
var contains = function contains(haystack, needle) {
|
428 |
+
if (typeof haystack.contains === 'function') {
|
429 |
+
return haystack.contains(needle);
|
430 |
+
}
|
431 |
+
};
|
432 |
+
|
433 |
+
var getContainer = function getContainer() {
|
434 |
+
return document.body.querySelector('.' + swalClasses.container);
|
435 |
+
};
|
436 |
+
var elementBySelector = function elementBySelector(selectorString) {
|
437 |
+
var container = getContainer();
|
438 |
+
return container ? container.querySelector(selectorString) : null;
|
439 |
+
};
|
440 |
+
|
441 |
+
var elementByClass = function elementByClass(className) {
|
442 |
+
return elementBySelector('.' + className);
|
443 |
+
};
|
444 |
+
|
445 |
+
var getPopup = function getPopup() {
|
446 |
+
return elementByClass(swalClasses.popup);
|
447 |
+
};
|
448 |
+
var getIcons = function getIcons() {
|
449 |
+
var popup = getPopup();
|
450 |
+
return toArray(popup.querySelectorAll('.' + swalClasses.icon));
|
451 |
+
};
|
452 |
+
var getIcon = function getIcon() {
|
453 |
+
var visibleIcon = getIcons().filter(function (icon) {
|
454 |
+
return isVisible(icon);
|
455 |
+
});
|
456 |
+
return visibleIcon.length ? visibleIcon[0] : null;
|
457 |
+
};
|
458 |
+
var getTitle = function getTitle() {
|
459 |
+
return elementByClass(swalClasses.title);
|
460 |
+
};
|
461 |
+
var getContent = function getContent() {
|
462 |
+
return elementByClass(swalClasses.content);
|
463 |
+
};
|
464 |
+
var getImage = function getImage() {
|
465 |
+
return elementByClass(swalClasses.image);
|
466 |
+
};
|
467 |
+
var getProgressSteps = function getProgressSteps() {
|
468 |
+
return elementByClass(swalClasses['progress-steps']);
|
469 |
+
};
|
470 |
+
var getValidationMessage = function getValidationMessage() {
|
471 |
+
return elementByClass(swalClasses['validation-message']);
|
472 |
+
};
|
473 |
+
var getConfirmButton = function getConfirmButton() {
|
474 |
+
return elementBySelector('.' + swalClasses.actions + ' .' + swalClasses.confirm);
|
475 |
+
};
|
476 |
+
var getCancelButton = function getCancelButton() {
|
477 |
+
return elementBySelector('.' + swalClasses.actions + ' .' + swalClasses.cancel);
|
478 |
+
};
|
479 |
+
var getActions = function getActions() {
|
480 |
+
return elementByClass(swalClasses.actions);
|
481 |
+
};
|
482 |
+
var getHeader = function getHeader() {
|
483 |
+
return elementByClass(swalClasses.header);
|
484 |
+
};
|
485 |
+
var getFooter = function getFooter() {
|
486 |
+
return elementByClass(swalClasses.footer);
|
487 |
+
};
|
488 |
+
var getCloseButton = function getCloseButton() {
|
489 |
+
return elementByClass(swalClasses.close);
|
490 |
+
};
|
491 |
+
var getFocusableElements = function getFocusableElements() {
|
492 |
+
var focusableElementsWithTabindex = toArray(getPopup().querySelectorAll('[tabindex]:not([tabindex="-1"]):not([tabindex="0"])')) // sort according to tabindex
|
493 |
+
.sort(function (a, b) {
|
494 |
+
a = parseInt(a.getAttribute('tabindex'));
|
495 |
+
b = parseInt(b.getAttribute('tabindex'));
|
496 |
+
|
497 |
+
if (a > b) {
|
498 |
+
return 1;
|
499 |
+
} else if (a < b) {
|
500 |
+
return -1;
|
501 |
+
}
|
502 |
+
|
503 |
+
return 0;
|
504 |
+
}); // https://github.com/jkup/focusable/blob/master/index.js
|
505 |
+
|
506 |
+
var otherFocusableElements = toArray(getPopup().querySelectorAll('a[href], area[href], input:not([disabled]), select:not([disabled]), textarea:not([disabled]), button:not([disabled]), iframe, object, embed, [tabindex="0"], [contenteditable], audio[controls], video[controls]')).filter(function (el) {
|
507 |
+
return el.getAttribute('tabindex') !== '-1';
|
508 |
+
});
|
509 |
+
return uniqueArray(focusableElementsWithTabindex.concat(otherFocusableElements)).filter(function (el) {
|
510 |
+
return isVisible(el);
|
511 |
+
});
|
512 |
+
};
|
513 |
+
var isModal = function isModal() {
|
514 |
+
return !isToast() && !document.body.classList.contains(swalClasses['no-backdrop']);
|
515 |
+
};
|
516 |
+
var isToast = function isToast() {
|
517 |
+
return document.body.classList.contains(swalClasses['toast-shown']);
|
518 |
+
};
|
519 |
+
var isLoading = function isLoading() {
|
520 |
+
return getPopup().hasAttribute('data-loading');
|
521 |
+
};
|
522 |
+
|
523 |
+
// Detect Node env
|
524 |
+
var isNodeEnv = function isNodeEnv() {
|
525 |
+
return typeof window === 'undefined' || typeof document === 'undefined';
|
526 |
+
};
|
527 |
+
|
528 |
+
var sweetHTML = "\n <div aria-labelledby=\"".concat(swalClasses.title, "\" aria-describedby=\"").concat(swalClasses.content, "\" class=\"").concat(swalClasses.popup, "\" tabindex=\"-1\">\n <div class=\"").concat(swalClasses.header, "\">\n <ul class=\"").concat(swalClasses['progress-steps'], "\"></ul>\n <div class=\"").concat(swalClasses.icon, " ").concat(iconTypes.error, "\">\n <span class=\"swal2-x-mark\"><span class=\"swal2-x-mark-line-left\"></span><span class=\"swal2-x-mark-line-right\"></span></span>\n </div>\n <div class=\"").concat(swalClasses.icon, " ").concat(iconTypes.question, "\"></div>\n <div class=\"").concat(swalClasses.icon, " ").concat(iconTypes.warning, "\"></div>\n <div class=\"").concat(swalClasses.icon, " ").concat(iconTypes.info, "\"></div>\n <div class=\"").concat(swalClasses.icon, " ").concat(iconTypes.success, "\">\n <div class=\"swal2-success-circular-line-left\"></div>\n <span class=\"swal2-success-line-tip\"></span> <span class=\"swal2-success-line-long\"></span>\n <div class=\"swal2-success-ring\"></div> <div class=\"swal2-success-fix\"></div>\n <div class=\"swal2-success-circular-line-right\"></div>\n </div>\n <img class=\"").concat(swalClasses.image, "\" />\n <h2 class=\"").concat(swalClasses.title, "\" id=\"").concat(swalClasses.title, "\"></h2>\n <button type=\"button\" class=\"").concat(swalClasses.close, "\">×</button>\n </div>\n <div class=\"").concat(swalClasses.content, "\">\n <div id=\"").concat(swalClasses.content, "\"></div>\n <input class=\"").concat(swalClasses.input, "\" />\n <input type=\"file\" class=\"").concat(swalClasses.file, "\" />\n <div class=\"").concat(swalClasses.range, "\">\n <input type=\"range\" />\n <output></output>\n </div>\n <select class=\"").concat(swalClasses.select, "\"></select>\n <div class=\"").concat(swalClasses.radio, "\"></div>\n <label for=\"").concat(swalClasses.checkbox, "\" class=\"").concat(swalClasses.checkbox, "\">\n <input type=\"checkbox\" />\n <span class=\"").concat(swalClasses.label, "\"></span>\n </label>\n <textarea class=\"").concat(swalClasses.textarea, "\"></textarea>\n <div class=\"").concat(swalClasses['validation-message'], "\" id=\"").concat(swalClasses['validation-message'], "\"></div>\n </div>\n <div class=\"").concat(swalClasses.actions, "\">\n <button type=\"button\" class=\"").concat(swalClasses.confirm, "\">OK</button>\n <button type=\"button\" class=\"").concat(swalClasses.cancel, "\">Cancel</button>\n </div>\n <div class=\"").concat(swalClasses.footer, "\">\n </div>\n </div>\n").replace(/(^|\n)\s*/g, '');
|
529 |
+
|
530 |
+
var resetOldContainer = function resetOldContainer() {
|
531 |
+
var oldContainer = getContainer();
|
532 |
+
|
533 |
+
if (!oldContainer) {
|
534 |
+
return;
|
535 |
+
}
|
536 |
+
|
537 |
+
oldContainer.parentNode.removeChild(oldContainer);
|
538 |
+
removeClass([document.documentElement, document.body], [swalClasses['no-backdrop'], swalClasses['toast-shown'], swalClasses['has-column']]);
|
539 |
+
};
|
540 |
+
|
541 |
+
var oldInputVal; // IE11 workaround, see #1109 for details
|
542 |
+
|
543 |
+
var resetValidationMessage = function resetValidationMessage(e) {
|
544 |
+
if (Swal.isVisible() && oldInputVal !== e.target.value) {
|
545 |
+
Swal.resetValidationMessage();
|
546 |
+
}
|
547 |
+
|
548 |
+
oldInputVal = e.target.value;
|
549 |
+
};
|
550 |
+
|
551 |
+
var addInputChangeListeners = function addInputChangeListeners() {
|
552 |
+
var content = getContent();
|
553 |
+
var input = getChildByClass(content, swalClasses.input);
|
554 |
+
var file = getChildByClass(content, swalClasses.file);
|
555 |
+
var range = content.querySelector(".".concat(swalClasses.range, " input"));
|
556 |
+
var rangeOutput = content.querySelector(".".concat(swalClasses.range, " output"));
|
557 |
+
var select = getChildByClass(content, swalClasses.select);
|
558 |
+
var checkbox = content.querySelector(".".concat(swalClasses.checkbox, " input"));
|
559 |
+
var textarea = getChildByClass(content, swalClasses.textarea);
|
560 |
+
input.oninput = resetValidationMessage;
|
561 |
+
file.onchange = resetValidationMessage;
|
562 |
+
select.onchange = resetValidationMessage;
|
563 |
+
checkbox.onchange = resetValidationMessage;
|
564 |
+
textarea.oninput = resetValidationMessage;
|
565 |
+
|
566 |
+
range.oninput = function (e) {
|
567 |
+
resetValidationMessage(e);
|
568 |
+
rangeOutput.value = range.value;
|
569 |
+
};
|
570 |
+
|
571 |
+
range.onchange = function (e) {
|
572 |
+
resetValidationMessage(e);
|
573 |
+
range.nextSibling.value = range.value;
|
574 |
+
};
|
575 |
+
};
|
576 |
+
|
577 |
+
var getTarget = function getTarget(target) {
|
578 |
+
return typeof target === 'string' ? document.querySelector(target) : target;
|
579 |
+
};
|
580 |
+
|
581 |
+
var setupAccessibility = function setupAccessibility(params) {
|
582 |
+
var popup = getPopup();
|
583 |
+
popup.setAttribute('role', params.toast ? 'alert' : 'dialog');
|
584 |
+
popup.setAttribute('aria-live', params.toast ? 'polite' : 'assertive');
|
585 |
+
|
586 |
+
if (!params.toast) {
|
587 |
+
popup.setAttribute('aria-modal', 'true');
|
588 |
+
}
|
589 |
+
};
|
590 |
+
|
591 |
+
var setupRTL = function setupRTL(targetElement) {
|
592 |
+
if (window.getComputedStyle(targetElement).direction === 'rtl') {
|
593 |
+
addClass(getContainer(), swalClasses.rtl);
|
594 |
+
}
|
595 |
+
};
|
596 |
+
/*
|
597 |
+
* Add modal + backdrop to DOM
|
598 |
+
*/
|
599 |
+
|
600 |
+
|
601 |
+
var init = function init(params) {
|
602 |
+
// Clean up the old popup container if it exists
|
603 |
+
resetOldContainer();
|
604 |
+
/* istanbul ignore if */
|
605 |
+
|
606 |
+
if (isNodeEnv()) {
|
607 |
+
error('SweetAlert2 requires document to initialize');
|
608 |
+
return;
|
609 |
+
}
|
610 |
+
|
611 |
+
var container = document.createElement('div');
|
612 |
+
container.className = swalClasses.container;
|
613 |
+
container.innerHTML = sweetHTML;
|
614 |
+
var targetElement = getTarget(params.target);
|
615 |
+
targetElement.appendChild(container);
|
616 |
+
setupAccessibility(params);
|
617 |
+
setupRTL(targetElement);
|
618 |
+
addInputChangeListeners();
|
619 |
+
};
|
620 |
+
|
621 |
+
var parseHtmlToContainer = function parseHtmlToContainer(param, target) {
|
622 |
+
// DOM element
|
623 |
+
if (param instanceof HTMLElement) {
|
624 |
+
target.appendChild(param); // JQuery element(s)
|
625 |
+
} else if (_typeof(param) === 'object') {
|
626 |
+
handleJqueryElem(target, param); // Plain string
|
627 |
+
} else if (param) {
|
628 |
+
target.innerHTML = param;
|
629 |
+
}
|
630 |
+
};
|
631 |
+
|
632 |
+
var handleJqueryElem = function handleJqueryElem(target, elem) {
|
633 |
+
target.innerHTML = '';
|
634 |
+
|
635 |
+
if (0 in elem) {
|
636 |
+
for (var i = 0; i in elem; i++) {
|
637 |
+
target.appendChild(elem[i].cloneNode(true));
|
638 |
+
}
|
639 |
+
} else {
|
640 |
+
target.appendChild(elem.cloneNode(true));
|
641 |
+
}
|
642 |
+
};
|
643 |
+
|
644 |
+
var animationEndEvent = function () {
|
645 |
+
// Prevent run in Node env
|
646 |
+
|
647 |
+
/* istanbul ignore if */
|
648 |
+
if (isNodeEnv()) {
|
649 |
+
return false;
|
650 |
+
}
|
651 |
+
|
652 |
+
var testEl = document.createElement('div');
|
653 |
+
var transEndEventNames = {
|
654 |
+
'WebkitAnimation': 'webkitAnimationEnd',
|
655 |
+
'OAnimation': 'oAnimationEnd oanimationend',
|
656 |
+
'animation': 'animationend'
|
657 |
+
};
|
658 |
+
|
659 |
+
for (var i in transEndEventNames) {
|
660 |
+
if (transEndEventNames.hasOwnProperty(i) && typeof testEl.style[i] !== 'undefined') {
|
661 |
+
return transEndEventNames[i];
|
662 |
+
}
|
663 |
+
}
|
664 |
+
|
665 |
+
return false;
|
666 |
+
}();
|
667 |
+
|
668 |
+
// Measure width of scrollbar
|
669 |
+
// https://github.com/twbs/bootstrap/blob/master/js/modal.js#L279-L286
|
670 |
+
var measureScrollbar = function measureScrollbar() {
|
671 |
+
var supportsTouch = 'ontouchstart' in window || navigator.msMaxTouchPoints;
|
672 |
+
|
673 |
+
if (supportsTouch) {
|
674 |
+
return 0;
|
675 |
+
}
|
676 |
+
|
677 |
+
var scrollDiv = document.createElement('div');
|
678 |
+
scrollDiv.style.width = '50px';
|
679 |
+
scrollDiv.style.height = '50px';
|
680 |
+
scrollDiv.style.overflow = 'scroll';
|
681 |
+
document.body.appendChild(scrollDiv);
|
682 |
+
var scrollbarWidth = scrollDiv.offsetWidth - scrollDiv.clientWidth;
|
683 |
+
document.body.removeChild(scrollDiv);
|
684 |
+
return scrollbarWidth;
|
685 |
+
};
|
686 |
+
|
687 |
+
function handleButtonsStyling(confirmButton, cancelButton, params) {
|
688 |
+
addClass([confirmButton, cancelButton], swalClasses.styled); // Buttons background colors
|
689 |
+
|
690 |
+
if (params.confirmButtonColor) {
|
691 |
+
confirmButton.style.backgroundColor = params.confirmButtonColor;
|
692 |
+
}
|
693 |
+
|
694 |
+
if (params.cancelButtonColor) {
|
695 |
+
cancelButton.style.backgroundColor = params.cancelButtonColor;
|
696 |
+
} // Loading state
|
697 |
+
|
698 |
+
|
699 |
+
var confirmButtonBackgroundColor = window.getComputedStyle(confirmButton).getPropertyValue('background-color');
|
700 |
+
confirmButton.style.borderLeftColor = confirmButtonBackgroundColor;
|
701 |
+
confirmButton.style.borderRightColor = confirmButtonBackgroundColor;
|
702 |
+
}
|
703 |
+
|
704 |
+
function renderButton(button, buttonType, params) {
|
705 |
+
toggle(button, params['showC' + buttonType.substring(1) + 'Button'], 'inline-block');
|
706 |
+
button.innerHTML = params[buttonType + 'ButtonText']; // Set caption text
|
707 |
+
|
708 |
+
button.setAttribute('aria-label', params[buttonType + 'ButtonAriaLabel']); // ARIA label
|
709 |
+
// Add buttons custom classes
|
710 |
+
|
711 |
+
button.className = swalClasses[buttonType];
|
712 |
+
applyCustomClass(button, params.customClass, buttonType + 'Button');
|
713 |
+
addClass(button, params[buttonType + 'ButtonClass']);
|
714 |
+
}
|
715 |
+
|
716 |
+
var renderActions = function renderActions(instance, params) {
|
717 |
+
var actions = getActions();
|
718 |
+
var confirmButton = getConfirmButton();
|
719 |
+
var cancelButton = getCancelButton(); // Actions (buttons) wrapper
|
720 |
+
|
721 |
+
if (!params.showConfirmButton && !params.showCancelButton) {
|
722 |
+
hide(actions);
|
723 |
+
} else {
|
724 |
+
show(actions);
|
725 |
+
} // Custom class
|
726 |
+
|
727 |
+
|
728 |
+
applyCustomClass(actions, params.customClass, 'actions'); // Render confirm button
|
729 |
+
|
730 |
+
renderButton(confirmButton, 'confirm', params); // render Cancel Button
|
731 |
+
|
732 |
+
renderButton(cancelButton, 'cancel', params);
|
733 |
+
|
734 |
+
if (params.buttonsStyling) {
|
735 |
+
handleButtonsStyling(confirmButton, cancelButton, params);
|
736 |
+
} else {
|
737 |
+
removeClass([confirmButton, cancelButton], swalClasses.styled);
|
738 |
+
confirmButton.style.backgroundColor = confirmButton.style.borderLeftColor = confirmButton.style.borderRightColor = '';
|
739 |
+
cancelButton.style.backgroundColor = cancelButton.style.borderLeftColor = cancelButton.style.borderRightColor = '';
|
740 |
+
}
|
741 |
+
};
|
742 |
+
|
743 |
+
function handleBackdropParam(container, backdrop) {
|
744 |
+
if (typeof backdrop === 'string') {
|
745 |
+
container.style.background = backdrop;
|
746 |
+
} else if (!backdrop) {
|
747 |
+
addClass([document.documentElement, document.body], swalClasses['no-backdrop']);
|
748 |
+
}
|
749 |
+
}
|
750 |
+
|
751 |
+
function handlePositionParam(container, position) {
|
752 |
+
if (position in swalClasses) {
|
753 |
+
addClass(container, swalClasses[position]);
|
754 |
+
} else {
|
755 |
+
warn('The "position" parameter is not valid, defaulting to "center"');
|
756 |
+
addClass(container, swalClasses.center);
|
757 |
+
}
|
758 |
+
}
|
759 |
+
|
760 |
+
function handleGrowParam(container, grow) {
|
761 |
+
if (grow && typeof grow === 'string') {
|
762 |
+
var growClass = 'grow-' + grow;
|
763 |
+
|
764 |
+
if (growClass in swalClasses) {
|
765 |
+
addClass(container, swalClasses[growClass]);
|
766 |
+
}
|
767 |
+
}
|
768 |
+
}
|
769 |
+
|
770 |
+
var renderContainer = function renderContainer(instance, params) {
|
771 |
+
var container = getContainer();
|
772 |
+
|
773 |
+
if (!container) {
|
774 |
+
return;
|
775 |
+
}
|
776 |
+
|
777 |
+
handleBackdropParam(container, params.backdrop);
|
778 |
+
|
779 |
+
if (!params.backdrop && params.allowOutsideClick) {
|
780 |
+
warn('"allowOutsideClick" parameter requires `backdrop` parameter to be set to `true`');
|
781 |
+
}
|
782 |
+
|
783 |
+
handlePositionParam(container, params.position);
|
784 |
+
handleGrowParam(container, params.grow); // Custom class
|
785 |
+
|
786 |
+
applyCustomClass(container, params.customClass, 'container');
|
787 |
+
|
788 |
+
if (params.customContainerClass) {
|
789 |
+
// @deprecated
|
790 |
+
addClass(container, params.customContainerClass);
|
791 |
+
}
|
792 |
+
};
|
793 |
+
|
794 |
+
/**
|
795 |
+
* This module containts `WeakMap`s for each effectively-"private property" that a `Swal` has.
|
796 |
+
* For example, to set the private property "foo" of `this` to "bar", you can `privateProps.foo.set(this, 'bar')`
|
797 |
+
* This is the approach that Babel will probably take to implement private methods/fields
|
798 |
+
* https://github.com/tc39/proposal-private-methods
|
799 |
+
* https://github.com/babel/babel/pull/7555
|
800 |
+
* Once we have the changes from that PR in Babel, and our core class fits reasonable in *one module*
|
801 |
+
* then we can use that language feature.
|
802 |
+
*/
|
803 |
+
var privateProps = {
|
804 |
+
promise: new WeakMap(),
|
805 |
+
innerParams: new WeakMap(),
|
806 |
+
domCache: new WeakMap()
|
807 |
+
};
|
808 |
+
|
809 |
+
var renderInput = function renderInput(instance, params) {
|
810 |
+
var innerParams = privateProps.innerParams.get(instance);
|
811 |
+
var rerender = !innerParams || params.input !== innerParams.input;
|
812 |
+
var content = getContent();
|
813 |
+
var inputTypes = ['input', 'file', 'range', 'select', 'radio', 'checkbox', 'textarea'];
|
814 |
+
|
815 |
+
for (var i = 0; i < inputTypes.length; i++) {
|
816 |
+
var inputClass = swalClasses[inputTypes[i]];
|
817 |
+
var inputContainer = getChildByClass(content, inputClass); // set attributes
|
818 |
+
|
819 |
+
setAttributes(inputTypes[i], params.inputAttributes); // set class
|
820 |
+
|
821 |
+
setClass(inputContainer, inputClass, params);
|
822 |
+
rerender && hide(inputContainer);
|
823 |
+
}
|
824 |
+
|
825 |
+
if (!params.input) {
|
826 |
+
return;
|
827 |
+
}
|
828 |
+
|
829 |
+
if (!renderInputType[params.input]) {
|
830 |
+
return error("Unexpected type of input! Expected \"text\", \"email\", \"password\", \"number\", \"tel\", \"select\", \"radio\", \"checkbox\", \"textarea\", \"file\" or \"url\", got \"".concat(params.input, "\""));
|
831 |
+
}
|
832 |
+
|
833 |
+
if (rerender) {
|
834 |
+
var input = renderInputType[params.input](params);
|
835 |
+
show(input);
|
836 |
+
}
|
837 |
+
};
|
838 |
+
|
839 |
+
var removeAttributes = function removeAttributes(input) {
|
840 |
+
for (var i = 0; i < input.attributes.length; i++) {
|
841 |
+
var attrName = input.attributes[i].name;
|
842 |
+
|
843 |
+
if (!(['type', 'value', 'style'].indexOf(attrName) !== -1)) {
|
844 |
+
input.removeAttribute(attrName);
|
845 |
+
}
|
846 |
+
}
|
847 |
+
};
|
848 |
+
|
849 |
+
var setAttributes = function setAttributes(inputType, inputAttributes) {
|
850 |
+
var input = getInput(getContent(), inputType);
|
851 |
+
|
852 |
+
if (!input) {
|
853 |
+
return;
|
854 |
+
}
|
855 |
+
|
856 |
+
removeAttributes(input);
|
857 |
+
|
858 |
+
for (var attr in inputAttributes) {
|
859 |
+
// Do not set a placeholder for <input type="range">
|
860 |
+
// it'll crash Edge, #1298
|
861 |
+
if (inputType === 'range' && attr === 'placeholder') {
|
862 |
+
continue;
|
863 |
+
}
|
864 |
+
|
865 |
+
input.setAttribute(attr, inputAttributes[attr]);
|
866 |
+
}
|
867 |
+
};
|
868 |
+
|
869 |
+
var setClass = function setClass(inputContainer, inputClass, params) {
|
870 |
+
inputContainer.className = inputClass;
|
871 |
+
|
872 |
+
if (params.inputClass) {
|
873 |
+
addClass(inputContainer, params.inputClass);
|
874 |
+
}
|
875 |
+
|
876 |
+
if (params.customClass) {
|
877 |
+
addClass(inputContainer, params.customClass.input);
|
878 |
+
}
|
879 |
+
};
|
880 |
+
|
881 |
+
var setInputPlaceholder = function setInputPlaceholder(input, params) {
|
882 |
+
if (!input.placeholder || params.inputPlaceholder) {
|
883 |
+
input.placeholder = params.inputPlaceholder;
|
884 |
+
}
|
885 |
+
};
|
886 |
+
|
887 |
+
var renderInputType = {};
|
888 |
+
|
889 |
+
renderInputType.text = renderInputType.email = renderInputType.password = renderInputType.number = renderInputType.tel = renderInputType.url = function (params) {
|
890 |
+
var input = getChildByClass(getContent(), swalClasses.input);
|
891 |
+
|
892 |
+
if (typeof params.inputValue === 'string' || typeof params.inputValue === 'number') {
|
893 |
+
input.value = params.inputValue;
|
894 |
+
} else if (!isPromise(params.inputValue)) {
|
895 |
+
warn("Unexpected type of inputValue! Expected \"string\", \"number\" or \"Promise\", got \"".concat(_typeof(params.inputValue), "\""));
|
896 |
+
}
|
897 |
+
|
898 |
+
setInputPlaceholder(input, params);
|
899 |
+
input.type = params.input;
|
900 |
+
return input;
|
901 |
+
};
|
902 |
+
|
903 |
+
renderInputType.file = function (params) {
|
904 |
+
var input = getChildByClass(getContent(), swalClasses.file);
|
905 |
+
setInputPlaceholder(input, params);
|
906 |
+
input.type = params.input;
|
907 |
+
return input;
|
908 |
+
};
|
909 |
+
|
910 |
+
renderInputType.range = function (params) {
|
911 |
+
var range = getChildByClass(getContent(), swalClasses.range);
|
912 |
+
var rangeInput = range.querySelector('input');
|
913 |
+
var rangeOutput = range.querySelector('output');
|
914 |
+
rangeInput.value = params.inputValue;
|
915 |
+
rangeInput.type = params.input;
|
916 |
+
rangeOutput.value = params.inputValue;
|
917 |
+
return range;
|
918 |
+
};
|
919 |
+
|
920 |
+
renderInputType.select = function (params) {
|
921 |
+
var select = getChildByClass(getContent(), swalClasses.select);
|
922 |
+
select.innerHTML = '';
|
923 |
+
|
924 |
+
if (params.inputPlaceholder) {
|
925 |
+
var placeholder = document.createElement('option');
|
926 |
+
placeholder.innerHTML = params.inputPlaceholder;
|
927 |
+
placeholder.value = '';
|
928 |
+
placeholder.disabled = true;
|
929 |
+
placeholder.selected = true;
|
930 |
+
select.appendChild(placeholder);
|
931 |
+
}
|
932 |
+
|
933 |
+
return select;
|
934 |
+
};
|
935 |
+
|
936 |
+
renderInputType.radio = function () {
|
937 |
+
var radio = getChildByClass(getContent(), swalClasses.radio);
|
938 |
+
radio.innerHTML = '';
|
939 |
+
return radio;
|
940 |
+
};
|
941 |
+
|
942 |
+
renderInputType.checkbox = function (params) {
|
943 |
+
var checkbox = getChildByClass(getContent(), swalClasses.checkbox);
|
944 |
+
var checkboxInput = getInput(getContent(), 'checkbox');
|
945 |
+
checkboxInput.type = 'checkbox';
|
946 |
+
checkboxInput.value = 1;
|
947 |
+
checkboxInput.id = swalClasses.checkbox;
|
948 |
+
checkboxInput.checked = Boolean(params.inputValue);
|
949 |
+
var label = checkbox.querySelector('span');
|
950 |
+
label.innerHTML = params.inputPlaceholder;
|
951 |
+
return checkbox;
|
952 |
+
};
|
953 |
+
|
954 |
+
renderInputType.textarea = function (params) {
|
955 |
+
var textarea = getChildByClass(getContent(), swalClasses.textarea);
|
956 |
+
textarea.value = params.inputValue;
|
957 |
+
setInputPlaceholder(textarea, params);
|
958 |
+
return textarea;
|
959 |
+
};
|
960 |
+
|
961 |
+
var renderContent = function renderContent(instance, params) {
|
962 |
+
var content = getContent().querySelector('#' + swalClasses.content); // Content as HTML
|
963 |
+
|
964 |
+
if (params.html) {
|
965 |
+
parseHtmlToContainer(params.html, content);
|
966 |
+
show(content, 'block'); // Content as plain text
|
967 |
+
} else if (params.text) {
|
968 |
+
content.textContent = params.text;
|
969 |
+
show(content, 'block'); // No content
|
970 |
+
} else {
|
971 |
+
hide(content);
|
972 |
+
}
|
973 |
+
|
974 |
+
renderInput(instance, params); // Custom class
|
975 |
+
|
976 |
+
applyCustomClass(getContent(), params.customClass, 'content');
|
977 |
+
};
|
978 |
+
|
979 |
+
var renderFooter = function renderFooter(instance, params) {
|
980 |
+
var footer = getFooter();
|
981 |
+
toggle(footer, params.footer);
|
982 |
+
|
983 |
+
if (params.footer) {
|
984 |
+
parseHtmlToContainer(params.footer, footer);
|
985 |
+
} // Custom class
|
986 |
+
|
987 |
+
|
988 |
+
applyCustomClass(footer, params.customClass, 'footer');
|
989 |
+
};
|
990 |
+
|
991 |
+
var renderCloseButton = function renderCloseButton(instance, params) {
|
992 |
+
var closeButton = getCloseButton(); // Custom class
|
993 |
+
|
994 |
+
applyCustomClass(closeButton, params.customClass, 'closeButton');
|
995 |
+
toggle(closeButton, params.showCloseButton);
|
996 |
+
closeButton.setAttribute('aria-label', params.closeButtonAriaLabel);
|
997 |
+
};
|
998 |
+
|
999 |
+
var renderIcon = function renderIcon(instance, params) {
|
1000 |
+
var innerParams = privateProps.innerParams.get(instance); // if the icon with the given type already rendered,
|
1001 |
+
// apply the custom class without re-rendering the icon
|
1002 |
+
|
1003 |
+
if (innerParams && params.type === innerParams.type && getIcon()) {
|
1004 |
+
applyCustomClass(getIcon(), params.customClass, 'icon');
|
1005 |
+
return;
|
1006 |
+
}
|
1007 |
+
|
1008 |
+
hideAllIcons();
|
1009 |
+
|
1010 |
+
if (!params.type) {
|
1011 |
+
return;
|
1012 |
+
}
|
1013 |
+
|
1014 |
+
adjustSuccessIconBackgoundColor();
|
1015 |
+
|
1016 |
+
if (Object.keys(iconTypes).indexOf(params.type) !== -1) {
|
1017 |
+
var icon = elementBySelector(".".concat(swalClasses.icon, ".").concat(iconTypes[params.type]));
|
1018 |
+
show(icon); // Custom class
|
1019 |
+
|
1020 |
+
applyCustomClass(icon, params.customClass, 'icon'); // Animate icon
|
1021 |
+
|
1022 |
+
toggleClass(icon, "swal2-animate-".concat(params.type, "-icon"), params.animation);
|
1023 |
+
} else {
|
1024 |
+
error("Unknown type! Expected \"success\", \"error\", \"warning\", \"info\" or \"question\", got \"".concat(params.type, "\""));
|
1025 |
+
}
|
1026 |
+
};
|
1027 |
+
|
1028 |
+
var hideAllIcons = function hideAllIcons() {
|
1029 |
+
var icons = getIcons();
|
1030 |
+
|
1031 |
+
for (var i = 0; i < icons.length; i++) {
|
1032 |
+
hide(icons[i]);
|
1033 |
+
}
|
1034 |
+
}; // Adjust success icon background color to match the popup background color
|
1035 |
+
|
1036 |
+
|
1037 |
+
var adjustSuccessIconBackgoundColor = function adjustSuccessIconBackgoundColor() {
|
1038 |
+
var popup = getPopup();
|
1039 |
+
var popupBackgroundColor = window.getComputedStyle(popup).getPropertyValue('background-color');
|
1040 |
+
var successIconParts = popup.querySelectorAll('[class^=swal2-success-circular-line], .swal2-success-fix');
|
1041 |
+
|
1042 |
+
for (var i = 0; i < successIconParts.length; i++) {
|
1043 |
+
successIconParts[i].style.backgroundColor = popupBackgroundColor;
|
1044 |
+
}
|
1045 |
+
};
|
1046 |
+
|
1047 |
+
var renderImage = function renderImage(instance, params) {
|
1048 |
+
var image = getImage();
|
1049 |
+
|
1050 |
+
if (!params.imageUrl) {
|
1051 |
+
return hide(image);
|
1052 |
+
}
|
1053 |
+
|
1054 |
+
show(image); // Src, alt
|
1055 |
+
|
1056 |
+
image.setAttribute('src', params.imageUrl);
|
1057 |
+
image.setAttribute('alt', params.imageAlt); // Width, height
|
1058 |
+
|
1059 |
+
applyNumericalStyle(image, 'width', params.imageWidth);
|
1060 |
+
applyNumericalStyle(image, 'height', params.imageHeight); // Class
|
1061 |
+
|
1062 |
+
image.className = swalClasses.image;
|
1063 |
+
applyCustomClass(image, params.customClass, 'image');
|
1064 |
+
|
1065 |
+
if (params.imageClass) {
|
1066 |
+
addClass(image, params.imageClass);
|
1067 |
+
}
|
1068 |
+
};
|
1069 |
+
|
1070 |
+
var createStepElement = function createStepElement(step) {
|
1071 |
+
var stepEl = document.createElement('li');
|
1072 |
+
addClass(stepEl, swalClasses['progress-step']);
|
1073 |
+
stepEl.innerHTML = step;
|
1074 |
+
return stepEl;
|
1075 |
+
};
|
1076 |
+
|
1077 |
+
var createLineElement = function createLineElement(params) {
|
1078 |
+
var lineEl = document.createElement('li');
|
1079 |
+
addClass(lineEl, swalClasses['progress-step-line']);
|
1080 |
+
|
1081 |
+
if (params.progressStepsDistance) {
|
1082 |
+
lineEl.style.width = params.progressStepsDistance;
|
1083 |
+
}
|
1084 |
+
|
1085 |
+
return lineEl;
|
1086 |
+
};
|
1087 |
+
|
1088 |
+
var renderProgressSteps = function renderProgressSteps(instance, params) {
|
1089 |
+
var progressStepsContainer = getProgressSteps();
|
1090 |
+
|
1091 |
+
if (!params.progressSteps || params.progressSteps.length === 0) {
|
1092 |
+
return hide(progressStepsContainer);
|
1093 |
+
}
|
1094 |
+
|
1095 |
+
show(progressStepsContainer);
|
1096 |
+
progressStepsContainer.innerHTML = '';
|
1097 |
+
var currentProgressStep = parseInt(params.currentProgressStep === null ? Swal.getQueueStep() : params.currentProgressStep);
|
1098 |
+
|
1099 |
+
if (currentProgressStep >= params.progressSteps.length) {
|
1100 |
+
warn('Invalid currentProgressStep parameter, it should be less than progressSteps.length ' + '(currentProgressStep like JS arrays starts from 0)');
|
1101 |
+
}
|
1102 |
+
|
1103 |
+
params.progressSteps.forEach(function (step, index) {
|
1104 |
+
var stepEl = createStepElement(step);
|
1105 |
+
progressStepsContainer.appendChild(stepEl);
|
1106 |
+
|
1107 |
+
if (index === currentProgressStep) {
|
1108 |
+
addClass(stepEl, swalClasses['active-progress-step']);
|
1109 |
+
}
|
1110 |
+
|
1111 |
+
if (index !== params.progressSteps.length - 1) {
|
1112 |
+
var lineEl = createLineElement(step);
|
1113 |
+
progressStepsContainer.appendChild(lineEl);
|
1114 |
+
}
|
1115 |
+
});
|
1116 |
+
};
|
1117 |
+
|
1118 |
+
var renderTitle = function renderTitle(instance, params) {
|
1119 |
+
var title = getTitle();
|
1120 |
+
toggle(title, params.title || params.titleText);
|
1121 |
+
|
1122 |
+
if (params.title) {
|
1123 |
+
parseHtmlToContainer(params.title, title);
|
1124 |
+
}
|
1125 |
+
|
1126 |
+
if (params.titleText) {
|
1127 |
+
title.innerText = params.titleText;
|
1128 |
+
} // Custom class
|
1129 |
+
|
1130 |
+
|
1131 |
+
applyCustomClass(title, params.customClass, 'title');
|
1132 |
+
};
|
1133 |
+
|
1134 |
+
var renderHeader = function renderHeader(instance, params) {
|
1135 |
+
var header = getHeader(); // Custom class
|
1136 |
+
|
1137 |
+
applyCustomClass(header, params.customClass, 'header'); // Progress steps
|
1138 |
+
|
1139 |
+
renderProgressSteps(instance, params); // Icon
|
1140 |
+
|
1141 |
+
renderIcon(instance, params); // Image
|
1142 |
+
|
1143 |
+
renderImage(instance, params); // Title
|
1144 |
+
|
1145 |
+
renderTitle(instance, params); // Close button
|
1146 |
+
|
1147 |
+
renderCloseButton(instance, params);
|
1148 |
+
};
|
1149 |
+
|
1150 |
+
var renderPopup = function renderPopup(instance, params) {
|
1151 |
+
var popup = getPopup(); // Width
|
1152 |
+
|
1153 |
+
applyNumericalStyle(popup, 'width', params.width); // Padding
|
1154 |
+
|
1155 |
+
applyNumericalStyle(popup, 'padding', params.padding); // Background
|
1156 |
+
|
1157 |
+
if (params.background) {
|
1158 |
+
popup.style.background = params.background;
|
1159 |
+
} // Default Class
|
1160 |
+
|
1161 |
+
|
1162 |
+
popup.className = swalClasses.popup;
|
1163 |
+
|
1164 |
+
if (params.toast) {
|
1165 |
+
addClass([document.documentElement, document.body], swalClasses['toast-shown']);
|
1166 |
+
addClass(popup, swalClasses.toast);
|
1167 |
+
} else {
|
1168 |
+
addClass(popup, swalClasses.modal);
|
1169 |
+
} // Custom class
|
1170 |
+
|
1171 |
+
|
1172 |
+
applyCustomClass(popup, params.customClass, 'popup');
|
1173 |
+
|
1174 |
+
if (typeof params.customClass === 'string') {
|
1175 |
+
addClass(popup, params.customClass);
|
1176 |
+
} // CSS animation
|
1177 |
+
|
1178 |
+
|
1179 |
+
toggleClass(popup, swalClasses.noanimation, !params.animation);
|
1180 |
+
};
|
1181 |
+
|
1182 |
+
var render = function render(instance, params) {
|
1183 |
+
renderPopup(instance, params);
|
1184 |
+
renderContainer(instance, params);
|
1185 |
+
renderHeader(instance, params);
|
1186 |
+
renderContent(instance, params);
|
1187 |
+
renderActions(instance, params);
|
1188 |
+
renderFooter(instance, params);
|
1189 |
+
};
|
1190 |
+
|
1191 |
+
/*
|
1192 |
+
* Global function to determine if SweetAlert2 popup is shown
|
1193 |
+
*/
|
1194 |
+
|
1195 |
+
var isVisible$1 = function isVisible$$1() {
|
1196 |
+
return isVisible(getPopup());
|
1197 |
+
};
|
1198 |
+
/*
|
1199 |
+
* Global function to click 'Confirm' button
|
1200 |
+
*/
|
1201 |
+
|
1202 |
+
var clickConfirm = function clickConfirm() {
|
1203 |
+
return getConfirmButton() && getConfirmButton().click();
|
1204 |
+
};
|
1205 |
+
/*
|
1206 |
+
* Global function to click 'Cancel' button
|
1207 |
+
*/
|
1208 |
+
|
1209 |
+
var clickCancel = function clickCancel() {
|
1210 |
+
return getCancelButton() && getCancelButton().click();
|
1211 |
+
};
|
1212 |
+
|
1213 |
+
function fire() {
|
1214 |
+
var Swal = this;
|
1215 |
+
|
1216 |
+
for (var _len = arguments.length, args = new Array(_len), _key = 0; _key < _len; _key++) {
|
1217 |
+
args[_key] = arguments[_key];
|
1218 |
+
}
|
1219 |
+
|
1220 |
+
return _construct(Swal, args);
|
1221 |
+
}
|
1222 |
+
|
1223 |
+
/**
|
1224 |
+
* Returns an extended version of `Swal` containing `params` as defaults.
|
1225 |
+
* Useful for reusing Swal configuration.
|
1226 |
+
*
|
1227 |
+
* For example:
|
1228 |
+
*
|
1229 |
+
* Before:
|
1230 |
+
* const textPromptOptions = { input: 'text', showCancelButton: true }
|
1231 |
+
* const {value: firstName} = await Swal.fire({ ...textPromptOptions, title: 'What is your first name?' })
|
1232 |
+
* const {value: lastName} = await Swal.fire({ ...textPromptOptions, title: 'What is your last name?' })
|
1233 |
+
*
|
1234 |
+
* After:
|
1235 |
+
* const TextPrompt = Swal.mixin({ input: 'text', showCancelButton: true })
|
1236 |
+
* const {value: firstName} = await TextPrompt('What is your first name?')
|
1237 |
+
* const {value: lastName} = await TextPrompt('What is your last name?')
|
1238 |
+
*
|
1239 |
+
* @param mixinParams
|
1240 |
+
*/
|
1241 |
+
function mixin(mixinParams) {
|
1242 |
+
var MixinSwal =
|
1243 |
+
/*#__PURE__*/
|
1244 |
+
function (_this) {
|
1245 |
+
_inherits(MixinSwal, _this);
|
1246 |
+
|
1247 |
+
function MixinSwal() {
|
1248 |
+
_classCallCheck(this, MixinSwal);
|
1249 |
+
|
1250 |
+
return _possibleConstructorReturn(this, _getPrototypeOf(MixinSwal).apply(this, arguments));
|
1251 |
+
}
|
1252 |
+
|
1253 |
+
_createClass(MixinSwal, [{
|
1254 |
+
key: "_main",
|
1255 |
+
value: function _main(params) {
|
1256 |
+
return _get(_getPrototypeOf(MixinSwal.prototype), "_main", this).call(this, _extends({}, mixinParams, params));
|
1257 |
+
}
|
1258 |
+
}]);
|
1259 |
+
|
1260 |
+
return MixinSwal;
|
1261 |
+
}(this);
|
1262 |
+
|
1263 |
+
return MixinSwal;
|
1264 |
+
}
|
1265 |
+
|
1266 |
+
// private global state for the queue feature
|
1267 |
+
var currentSteps = [];
|
1268 |
+
/*
|
1269 |
+
* Global function for chaining sweetAlert popups
|
1270 |
+
*/
|
1271 |
+
|
1272 |
+
var queue = function queue(steps) {
|
1273 |
+
var Swal = this;
|
1274 |
+
currentSteps = steps;
|
1275 |
+
|
1276 |
+
var resetAndResolve = function resetAndResolve(resolve, value) {
|
1277 |
+
currentSteps = [];
|
1278 |
+
document.body.removeAttribute('data-swal2-queue-step');
|
1279 |
+
resolve(value);
|
1280 |
+
};
|
1281 |
+
|
1282 |
+
var queueResult = [];
|
1283 |
+
return new Promise(function (resolve) {
|
1284 |
+
(function step(i, callback) {
|
1285 |
+
if (i < currentSteps.length) {
|
1286 |
+
document.body.setAttribute('data-swal2-queue-step', i);
|
1287 |
+
Swal.fire(currentSteps[i]).then(function (result) {
|
1288 |
+
if (typeof result.value !== 'undefined') {
|
1289 |
+
queueResult.push(result.value);
|
1290 |
+
step(i + 1, callback);
|
1291 |
+
} else {
|
1292 |
+
resetAndResolve(resolve, {
|
1293 |
+
dismiss: result.dismiss
|
1294 |
+
});
|
1295 |
+
}
|
1296 |
+
});
|
1297 |
+
} else {
|
1298 |
+
resetAndResolve(resolve, {
|
1299 |
+
value: queueResult
|
1300 |
+
});
|
1301 |
+
}
|
1302 |
+
})(0);
|
1303 |
+
});
|
1304 |
+
};
|
1305 |
+
/*
|
1306 |
+
* Global function for getting the index of current popup in queue
|
1307 |
+
*/
|
1308 |
+
|
1309 |
+
var getQueueStep = function getQueueStep() {
|
1310 |
+
return document.body.getAttribute('data-swal2-queue-step');
|
1311 |
+
};
|
1312 |
+
/*
|
1313 |
+
* Global function for inserting a popup to the queue
|
1314 |
+
*/
|
1315 |
+
|
1316 |
+
var insertQueueStep = function insertQueueStep(step, index) {
|
1317 |
+
if (index && index < currentSteps.length) {
|
1318 |
+
return currentSteps.splice(index, 0, step);
|
1319 |
+
}
|
1320 |
+
|
1321 |
+
return currentSteps.push(step);
|
1322 |
+
};
|
1323 |
+
/*
|
1324 |
+
* Global function for deleting a popup from the queue
|
1325 |
+
*/
|
1326 |
+
|
1327 |
+
var deleteQueueStep = function deleteQueueStep(index) {
|
1328 |
+
if (typeof currentSteps[index] !== 'undefined') {
|
1329 |
+
currentSteps.splice(index, 1);
|
1330 |
+
}
|
1331 |
+
};
|
1332 |
+
|
1333 |
+
/**
|
1334 |
+
* Show spinner instead of Confirm button and disable Cancel button
|
1335 |
+
*/
|
1336 |
+
|
1337 |
+
var showLoading = function showLoading() {
|
1338 |
+
var popup = getPopup();
|
1339 |
+
|
1340 |
+
if (!popup) {
|
1341 |
+
Swal.fire('');
|
1342 |
+
}
|
1343 |
+
|
1344 |
+
popup = getPopup();
|
1345 |
+
var actions = getActions();
|
1346 |
+
var confirmButton = getConfirmButton();
|
1347 |
+
var cancelButton = getCancelButton();
|
1348 |
+
show(actions);
|
1349 |
+
show(confirmButton);
|
1350 |
+
addClass([popup, actions], swalClasses.loading);
|
1351 |
+
confirmButton.disabled = true;
|
1352 |
+
cancelButton.disabled = true;
|
1353 |
+
popup.setAttribute('data-loading', true);
|
1354 |
+
popup.setAttribute('aria-busy', true);
|
1355 |
+
popup.focus();
|
1356 |
+
};
|
1357 |
+
|
1358 |
+
var RESTORE_FOCUS_TIMEOUT = 100;
|
1359 |
+
|
1360 |
+
var globalState = {};
|
1361 |
+
var focusPreviousActiveElement = function focusPreviousActiveElement() {
|
1362 |
+
if (globalState.previousActiveElement && globalState.previousActiveElement.focus) {
|
1363 |
+
globalState.previousActiveElement.focus();
|
1364 |
+
globalState.previousActiveElement = null;
|
1365 |
+
} else if (document.body) {
|
1366 |
+
document.body.focus();
|
1367 |
+
}
|
1368 |
+
}; // Restore previous active (focused) element
|
1369 |
+
|
1370 |
+
|
1371 |
+
var restoreActiveElement = function restoreActiveElement() {
|
1372 |
+
return new Promise(function (resolve) {
|
1373 |
+
var x = window.scrollX;
|
1374 |
+
var y = window.scrollY;
|
1375 |
+
globalState.restoreFocusTimeout = setTimeout(function () {
|
1376 |
+
focusPreviousActiveElement();
|
1377 |
+
resolve();
|
1378 |
+
}, RESTORE_FOCUS_TIMEOUT); // issues/900
|
1379 |
+
|
1380 |
+
if (typeof x !== 'undefined' && typeof y !== 'undefined') {
|
1381 |
+
// IE doesn't have scrollX/scrollY support
|
1382 |
+
window.scrollTo(x, y);
|
1383 |
+
}
|
1384 |
+
});
|
1385 |
+
};
|
1386 |
+
|
1387 |
+
/**
|
1388 |
+
* If `timer` parameter is set, returns number of milliseconds of timer remained.
|
1389 |
+
* Otherwise, returns undefined.
|
1390 |
+
*/
|
1391 |
+
|
1392 |
+
var getTimerLeft = function getTimerLeft() {
|
1393 |
+
return globalState.timeout && globalState.timeout.getTimerLeft();
|
1394 |
+
};
|
1395 |
+
/**
|
1396 |
+
* Stop timer. Returns number of milliseconds of timer remained.
|
1397 |
+
* If `timer` parameter isn't set, returns undefined.
|
1398 |
+
*/
|
1399 |
+
|
1400 |
+
var stopTimer = function stopTimer() {
|
1401 |
+
return globalState.timeout && globalState.timeout.stop();
|
1402 |
+
};
|
1403 |
+
/**
|
1404 |
+
* Resume timer. Returns number of milliseconds of timer remained.
|
1405 |
+
* If `timer` parameter isn't set, returns undefined.
|
1406 |
+
*/
|
1407 |
+
|
1408 |
+
var resumeTimer = function resumeTimer() {
|
1409 |
+
return globalState.timeout && globalState.timeout.start();
|
1410 |
+
};
|
1411 |
+
/**
|
1412 |
+
* Resume timer. Returns number of milliseconds of timer remained.
|
1413 |
+
* If `timer` parameter isn't set, returns undefined.
|
1414 |
+
*/
|
1415 |
+
|
1416 |
+
var toggleTimer = function toggleTimer() {
|
1417 |
+
var timer = globalState.timeout;
|
1418 |
+
return timer && (timer.running ? timer.stop() : timer.start());
|
1419 |
+
};
|
1420 |
+
/**
|
1421 |
+
* Increase timer. Returns number of milliseconds of an updated timer.
|
1422 |
+
* If `timer` parameter isn't set, returns undefined.
|
1423 |
+
*/
|
1424 |
+
|
1425 |
+
var increaseTimer = function increaseTimer(n) {
|
1426 |
+
return globalState.timeout && globalState.timeout.increase(n);
|
1427 |
+
};
|
1428 |
+
/**
|
1429 |
+
* Check if timer is running. Returns true if timer is running
|
1430 |
+
* or false if timer is paused or stopped.
|
1431 |
+
* If `timer` parameter isn't set, returns undefined
|
1432 |
+
*/
|
1433 |
+
|
1434 |
+
var isTimerRunning = function isTimerRunning() {
|
1435 |
+
return globalState.timeout && globalState.timeout.isRunning();
|
1436 |
+
};
|
1437 |
+
|
1438 |
+
var defaultParams = {
|
1439 |
+
title: '',
|
1440 |
+
titleText: '',
|
1441 |
+
text: '',
|
1442 |
+
html: '',
|
1443 |
+
footer: '',
|
1444 |
+
type: null,
|
1445 |
+
toast: false,
|
1446 |
+
customClass: '',
|
1447 |
+
customContainerClass: '',
|
1448 |
+
target: 'body',
|
1449 |
+
backdrop: true,
|
1450 |
+
animation: true,
|
1451 |
+
heightAuto: true,
|
1452 |
+
allowOutsideClick: true,
|
1453 |
+
allowEscapeKey: true,
|
1454 |
+
allowEnterKey: true,
|
1455 |
+
stopKeydownPropagation: true,
|
1456 |
+
keydownListenerCapture: false,
|
1457 |
+
showConfirmButton: true,
|
1458 |
+
showCancelButton: false,
|
1459 |
+
preConfirm: null,
|
1460 |
+
confirmButtonText: 'OK',
|
1461 |
+
confirmButtonAriaLabel: '',
|
1462 |
+
confirmButtonColor: null,
|
1463 |
+
confirmButtonClass: '',
|
1464 |
+
cancelButtonText: 'Cancel',
|
1465 |
+
cancelButtonAriaLabel: '',
|
1466 |
+
cancelButtonColor: null,
|
1467 |
+
cancelButtonClass: '',
|
1468 |
+
buttonsStyling: true,
|
1469 |
+
reverseButtons: false,
|
1470 |
+
focusConfirm: true,
|
1471 |
+
focusCancel: false,
|
1472 |
+
showCloseButton: false,
|
1473 |
+
closeButtonAriaLabel: 'Close this dialog',
|
1474 |
+
showLoaderOnConfirm: false,
|
1475 |
+
imageUrl: null,
|
1476 |
+
imageWidth: null,
|
1477 |
+
imageHeight: null,
|
1478 |
+
imageAlt: '',
|
1479 |
+
imageClass: '',
|
1480 |
+
timer: null,
|
1481 |
+
width: null,
|
1482 |
+
padding: null,
|
1483 |
+
background: null,
|
1484 |
+
input: null,
|
1485 |
+
inputPlaceholder: '',
|
1486 |
+
inputValue: '',
|
1487 |
+
inputOptions: {},
|
1488 |
+
inputAutoTrim: true,
|
1489 |
+
inputClass: '',
|
1490 |
+
inputAttributes: {},
|
1491 |
+
inputValidator: null,
|
1492 |
+
validationMessage: null,
|
1493 |
+
grow: false,
|
1494 |
+
position: 'center',
|
1495 |
+
progressSteps: [],
|
1496 |
+
currentProgressStep: null,
|
1497 |
+
progressStepsDistance: null,
|
1498 |
+
onBeforeOpen: null,
|
1499 |
+
onAfterClose: null,
|
1500 |
+
onOpen: null,
|
1501 |
+
onClose: null,
|
1502 |
+
scrollbarPadding: true
|
1503 |
+
};
|
1504 |
+
var updatableParams = ['title', 'titleText', 'text', 'html', 'type', 'customClass', 'showConfirmButton', 'showCancelButton', 'confirmButtonText', 'confirmButtonAriaLabel', 'confirmButtonColor', 'confirmButtonClass', 'cancelButtonText', 'cancelButtonAriaLabel', 'cancelButtonColor', 'cancelButtonClass', 'buttonsStyling', 'reverseButtons', 'imageUrl', 'imageWidth', 'imageHeigth', 'imageAlt', 'imageClass', 'progressSteps', 'currentProgressStep'];
|
1505 |
+
var deprecatedParams = {
|
1506 |
+
customContainerClass: 'customClass',
|
1507 |
+
confirmButtonClass: 'customClass',
|
1508 |
+
cancelButtonClass: 'customClass',
|
1509 |
+
imageClass: 'customClass',
|
1510 |
+
inputClass: 'customClass'
|
1511 |
+
};
|
1512 |
+
var toastIncompatibleParams = ['allowOutsideClick', 'allowEnterKey', 'backdrop', 'focusConfirm', 'focusCancel', 'heightAuto', 'keydownListenerCapture'];
|
1513 |
+
/**
|
1514 |
+
* Is valid parameter
|
1515 |
+
* @param {String} paramName
|
1516 |
+
*/
|
1517 |
+
|
1518 |
+
var isValidParameter = function isValidParameter(paramName) {
|
1519 |
+
return defaultParams.hasOwnProperty(paramName);
|
1520 |
+
};
|
1521 |
+
/**
|
1522 |
+
* Is valid parameter for Swal.update() method
|
1523 |
+
* @param {String} paramName
|
1524 |
+
*/
|
1525 |
+
|
1526 |
+
var isUpdatableParameter = function isUpdatableParameter(paramName) {
|
1527 |
+
return updatableParams.indexOf(paramName) !== -1;
|
1528 |
+
};
|
1529 |
+
/**
|
1530 |
+
* Is deprecated parameter
|
1531 |
+
* @param {String} paramName
|
1532 |
+
*/
|
1533 |
+
|
1534 |
+
var isDeprecatedParameter = function isDeprecatedParameter(paramName) {
|
1535 |
+
return deprecatedParams[paramName];
|
1536 |
+
};
|
1537 |
+
|
1538 |
+
var checkIfParamIsValid = function checkIfParamIsValid(param) {
|
1539 |
+
if (!isValidParameter(param)) {
|
1540 |
+
warn("Unknown parameter \"".concat(param, "\""));
|
1541 |
+
}
|
1542 |
+
};
|
1543 |
+
|
1544 |
+
var checkIfToastParamIsValid = function checkIfToastParamIsValid(param) {
|
1545 |
+
if (toastIncompatibleParams.indexOf(param) !== -1) {
|
1546 |
+
warn("The parameter \"".concat(param, "\" is incompatible with toasts"));
|
1547 |
+
}
|
1548 |
+
};
|
1549 |
+
|
1550 |
+
var checkIfParamIsDeprecated = function checkIfParamIsDeprecated(param) {
|
1551 |
+
if (isDeprecatedParameter(param)) {
|
1552 |
+
warnAboutDepreation(param, isDeprecatedParameter(param));
|
1553 |
+
}
|
1554 |
+
};
|
1555 |
+
/**
|
1556 |
+
* Show relevant warnings for given params
|
1557 |
+
*
|
1558 |
+
* @param params
|
1559 |
+
*/
|
1560 |
+
|
1561 |
+
|
1562 |
+
var showWarningsForParams = function showWarningsForParams(params) {
|
1563 |
+
for (var param in params) {
|
1564 |
+
checkIfParamIsValid(param);
|
1565 |
+
|
1566 |
+
if (params.toast) {
|
1567 |
+
checkIfToastParamIsValid(param);
|
1568 |
+
}
|
1569 |
+
|
1570 |
+
checkIfParamIsDeprecated();
|
1571 |
+
}
|
1572 |
+
};
|
1573 |
+
|
1574 |
+
|
1575 |
+
|
1576 |
+
var staticMethods = Object.freeze({
|
1577 |
+
isValidParameter: isValidParameter,
|
1578 |
+
isUpdatableParameter: isUpdatableParameter,
|
1579 |
+
isDeprecatedParameter: isDeprecatedParameter,
|
1580 |
+
argsToParams: argsToParams,
|
1581 |
+
isVisible: isVisible$1,
|
1582 |
+
clickConfirm: clickConfirm,
|
1583 |
+
clickCancel: clickCancel,
|
1584 |
+
getContainer: getContainer,
|
1585 |
+
getPopup: getPopup,
|
1586 |
+
getTitle: getTitle,
|
1587 |
+
getContent: getContent,
|
1588 |
+
getImage: getImage,
|
1589 |
+
getIcon: getIcon,
|
1590 |
+
getIcons: getIcons,
|
1591 |
+
getCloseButton: getCloseButton,
|
1592 |
+
getActions: getActions,
|
1593 |
+
getConfirmButton: getConfirmButton,
|
1594 |
+
getCancelButton: getCancelButton,
|
1595 |
+
getHeader: getHeader,
|
1596 |
+
getFooter: getFooter,
|
1597 |
+
getFocusableElements: getFocusableElements,
|
1598 |
+
getValidationMessage: getValidationMessage,
|
1599 |
+
isLoading: isLoading,
|
1600 |
+
fire: fire,
|
1601 |
+
mixin: mixin,
|
1602 |
+
queue: queue,
|
1603 |
+
getQueueStep: getQueueStep,
|
1604 |
+
insertQueueStep: insertQueueStep,
|
1605 |
+
deleteQueueStep: deleteQueueStep,
|
1606 |
+
showLoading: showLoading,
|
1607 |
+
enableLoading: showLoading,
|
1608 |
+
getTimerLeft: getTimerLeft,
|
1609 |
+
stopTimer: stopTimer,
|
1610 |
+
resumeTimer: resumeTimer,
|
1611 |
+
toggleTimer: toggleTimer,
|
1612 |
+
increaseTimer: increaseTimer,
|
1613 |
+
isTimerRunning: isTimerRunning
|
1614 |
+
});
|
1615 |
+
|
1616 |
+
/**
|
1617 |
+
* Enables buttons and hide loader.
|
1618 |
+
*/
|
1619 |
+
|
1620 |
+
function hideLoading() {
|
1621 |
+
var innerParams = privateProps.innerParams.get(this);
|
1622 |
+
var domCache = privateProps.domCache.get(this);
|
1623 |
+
|
1624 |
+
if (!innerParams.showConfirmButton) {
|
1625 |
+
hide(domCache.confirmButton);
|
1626 |
+
|
1627 |
+
if (!innerParams.showCancelButton) {
|
1628 |
+
hide(domCache.actions);
|
1629 |
+
}
|
1630 |
+
}
|
1631 |
+
|
1632 |
+
removeClass([domCache.popup, domCache.actions], swalClasses.loading);
|
1633 |
+
domCache.popup.removeAttribute('aria-busy');
|
1634 |
+
domCache.popup.removeAttribute('data-loading');
|
1635 |
+
domCache.confirmButton.disabled = false;
|
1636 |
+
domCache.cancelButton.disabled = false;
|
1637 |
+
}
|
1638 |
+
|
1639 |
+
function getInput$1(instance) {
|
1640 |
+
var innerParams = privateProps.innerParams.get(instance || this);
|
1641 |
+
var domCache = privateProps.domCache.get(instance || this);
|
1642 |
+
return getInput(domCache.content, innerParams.input);
|
1643 |
+
}
|
1644 |
+
|
1645 |
+
var fixScrollbar = function fixScrollbar() {
|
1646 |
+
// for queues, do not do this more than once
|
1647 |
+
if (states.previousBodyPadding !== null) {
|
1648 |
+
return;
|
1649 |
+
} // if the body has overflow
|
1650 |
+
|
1651 |
+
|
1652 |
+
if (document.body.scrollHeight > window.innerHeight) {
|
1653 |
+
// add padding so the content doesn't shift after removal of scrollbar
|
1654 |
+
states.previousBodyPadding = parseInt(window.getComputedStyle(document.body).getPropertyValue('padding-right'));
|
1655 |
+
document.body.style.paddingRight = states.previousBodyPadding + measureScrollbar() + 'px';
|
1656 |
+
}
|
1657 |
+
};
|
1658 |
+
var undoScrollbar = function undoScrollbar() {
|
1659 |
+
if (states.previousBodyPadding !== null) {
|
1660 |
+
document.body.style.paddingRight = states.previousBodyPadding + 'px';
|
1661 |
+
states.previousBodyPadding = null;
|
1662 |
+
}
|
1663 |
+
};
|
1664 |
+
|
1665 |
+
/* istanbul ignore next */
|
1666 |
+
|
1667 |
+
var iOSfix = function iOSfix() {
|
1668 |
+
var iOS = /iPad|iPhone|iPod/.test(navigator.userAgent) && !window.MSStream;
|
1669 |
+
|
1670 |
+
if (iOS && !hasClass(document.body, swalClasses.iosfix)) {
|
1671 |
+
var offset = document.body.scrollTop;
|
1672 |
+
document.body.style.top = offset * -1 + 'px';
|
1673 |
+
addClass(document.body, swalClasses.iosfix);
|
1674 |
+
lockBodyScroll();
|
1675 |
+
}
|
1676 |
+
};
|
1677 |
+
|
1678 |
+
var lockBodyScroll = function lockBodyScroll() {
|
1679 |
+
// #1246
|
1680 |
+
var container = getContainer();
|
1681 |
+
var preventTouchMove;
|
1682 |
+
|
1683 |
+
container.ontouchstart = function (e) {
|
1684 |
+
preventTouchMove = e.target === container || !isScrollable(container) && e.target.tagName !== 'INPUT' // #1603
|
1685 |
+
;
|
1686 |
+
};
|
1687 |
+
|
1688 |
+
container.ontouchmove = function (e) {
|
1689 |
+
if (preventTouchMove) {
|
1690 |
+
e.preventDefault();
|
1691 |
+
e.stopPropagation();
|
1692 |
+
}
|
1693 |
+
};
|
1694 |
+
};
|
1695 |
+
/* istanbul ignore next */
|
1696 |
+
|
1697 |
+
|
1698 |
+
var undoIOSfix = function undoIOSfix() {
|
1699 |
+
if (hasClass(document.body, swalClasses.iosfix)) {
|
1700 |
+
var offset = parseInt(document.body.style.top, 10);
|
1701 |
+
removeClass(document.body, swalClasses.iosfix);
|
1702 |
+
document.body.style.top = '';
|
1703 |
+
document.body.scrollTop = offset * -1;
|
1704 |
+
}
|
1705 |
+
};
|
1706 |
+
|
1707 |
+
var isIE11 = function isIE11() {
|
1708 |
+
return !!window.MSInputMethodContext && !!document.documentMode;
|
1709 |
+
}; // Fix IE11 centering sweetalert2/issues/933
|
1710 |
+
|
1711 |
+
/* istanbul ignore next */
|
1712 |
+
|
1713 |
+
|
1714 |
+
var fixVerticalPositionIE = function fixVerticalPositionIE() {
|
1715 |
+
var container = getContainer();
|
1716 |
+
var popup = getPopup();
|
1717 |
+
container.style.removeProperty('align-items');
|
1718 |
+
|
1719 |
+
if (popup.offsetTop < 0) {
|
1720 |
+
container.style.alignItems = 'flex-start';
|
1721 |
+
}
|
1722 |
+
};
|
1723 |
+
/* istanbul ignore next */
|
1724 |
+
|
1725 |
+
|
1726 |
+
var IEfix = function IEfix() {
|
1727 |
+
if (typeof window !== 'undefined' && isIE11()) {
|
1728 |
+
fixVerticalPositionIE();
|
1729 |
+
window.addEventListener('resize', fixVerticalPositionIE);
|
1730 |
+
}
|
1731 |
+
};
|
1732 |
+
/* istanbul ignore next */
|
1733 |
+
|
1734 |
+
var undoIEfix = function undoIEfix() {
|
1735 |
+
if (typeof window !== 'undefined' && isIE11()) {
|
1736 |
+
window.removeEventListener('resize', fixVerticalPositionIE);
|
1737 |
+
}
|
1738 |
+
};
|
1739 |
+
|
1740 |
+
// Adding aria-hidden="true" to elements outside of the active modal dialog ensures that
|
1741 |
+
// elements not within the active modal dialog will not be surfaced if a user opens a screen
|
1742 |
+
// reader’s list of elements (headings, form controls, landmarks, etc.) in the document.
|
1743 |
+
|
1744 |
+
var setAriaHidden = function setAriaHidden() {
|
1745 |
+
var bodyChildren = toArray(document.body.children);
|
1746 |
+
bodyChildren.forEach(function (el) {
|
1747 |
+
if (el === getContainer() || contains(el, getContainer())) {
|
1748 |
+
return;
|
1749 |
+
}
|
1750 |
+
|
1751 |
+
if (el.hasAttribute('aria-hidden')) {
|
1752 |
+
el.setAttribute('data-previous-aria-hidden', el.getAttribute('aria-hidden'));
|
1753 |
+
}
|
1754 |
+
|
1755 |
+
el.setAttribute('aria-hidden', 'true');
|
1756 |
+
});
|
1757 |
+
};
|
1758 |
+
var unsetAriaHidden = function unsetAriaHidden() {
|
1759 |
+
var bodyChildren = toArray(document.body.children);
|
1760 |
+
bodyChildren.forEach(function (el) {
|
1761 |
+
if (el.hasAttribute('data-previous-aria-hidden')) {
|
1762 |
+
el.setAttribute('aria-hidden', el.getAttribute('data-previous-aria-hidden'));
|
1763 |
+
el.removeAttribute('data-previous-aria-hidden');
|
1764 |
+
} else {
|
1765 |
+
el.removeAttribute('aria-hidden');
|
1766 |
+
}
|
1767 |
+
});
|
1768 |
+
};
|
1769 |
+
|
1770 |
+
/**
|
1771 |
+
* This module containts `WeakMap`s for each effectively-"private property" that a `Swal` has.
|
1772 |
+
* For example, to set the private property "foo" of `this` to "bar", you can `privateProps.foo.set(this, 'bar')`
|
1773 |
+
* This is the approach that Babel will probably take to implement private methods/fields
|
1774 |
+
* https://github.com/tc39/proposal-private-methods
|
1775 |
+
* https://github.com/babel/babel/pull/7555
|
1776 |
+
* Once we have the changes from that PR in Babel, and our core class fits reasonable in *one module*
|
1777 |
+
* then we can use that language feature.
|
1778 |
+
*/
|
1779 |
+
var privateMethods = {
|
1780 |
+
swalPromiseResolve: new WeakMap()
|
1781 |
+
};
|
1782 |
+
|
1783 |
+
/*
|
1784 |
+
* Instance method to close sweetAlert
|
1785 |
+
*/
|
1786 |
+
|
1787 |
+
function removePopupAndResetState(container, isToast, onAfterClose) {
|
1788 |
+
if (isToast) {
|
1789 |
+
triggerOnAfterClose(onAfterClose);
|
1790 |
+
} else {
|
1791 |
+
restoreActiveElement().then(function () {
|
1792 |
+
return triggerOnAfterClose(onAfterClose);
|
1793 |
+
});
|
1794 |
+
globalState.keydownTarget.removeEventListener('keydown', globalState.keydownHandler, {
|
1795 |
+
capture: globalState.keydownListenerCapture
|
1796 |
+
});
|
1797 |
+
globalState.keydownHandlerAdded = false;
|
1798 |
+
} // Unset globalState props so GC will dispose globalState (#1569)
|
1799 |
+
|
1800 |
+
|
1801 |
+
delete globalState.keydownHandler;
|
1802 |
+
delete globalState.keydownTarget;
|
1803 |
+
|
1804 |
+
if (container.parentNode) {
|
1805 |
+
container.parentNode.removeChild(container);
|
1806 |
+
}
|
1807 |
+
|
1808 |
+
removeBodyClasses();
|
1809 |
+
|
1810 |
+
if (isModal()) {
|
1811 |
+
undoScrollbar();
|
1812 |
+
undoIOSfix();
|
1813 |
+
undoIEfix();
|
1814 |
+
unsetAriaHidden();
|
1815 |
+
}
|
1816 |
+
}
|
1817 |
+
|
1818 |
+
function removeBodyClasses() {
|
1819 |
+
removeClass([document.documentElement, document.body], [swalClasses.shown, swalClasses['height-auto'], swalClasses['no-backdrop'], swalClasses['toast-shown'], swalClasses['toast-column']]);
|
1820 |
+
}
|
1821 |
+
|
1822 |
+
function swalCloseEventFinished(popup, container, isToast, onAfterClose) {
|
1823 |
+
if (hasClass(popup, swalClasses.hide)) {
|
1824 |
+
removePopupAndResetState(container, isToast, onAfterClose);
|
1825 |
+
} // Unset WeakMaps so GC will be able to dispose them (#1569)
|
1826 |
+
|
1827 |
+
|
1828 |
+
unsetWeakMaps(privateProps);
|
1829 |
+
unsetWeakMaps(privateMethods);
|
1830 |
+
}
|
1831 |
+
|
1832 |
+
function close(resolveValue) {
|
1833 |
+
var container = getContainer();
|
1834 |
+
var popup = getPopup();
|
1835 |
+
|
1836 |
+
if (!popup || hasClass(popup, swalClasses.hide)) {
|
1837 |
+
return;
|
1838 |
+
}
|
1839 |
+
|
1840 |
+
var innerParams = privateProps.innerParams.get(this);
|
1841 |
+
var swalPromiseResolve = privateMethods.swalPromiseResolve.get(this);
|
1842 |
+
var onClose = innerParams.onClose;
|
1843 |
+
var onAfterClose = innerParams.onAfterClose;
|
1844 |
+
removeClass(popup, swalClasses.show);
|
1845 |
+
addClass(popup, swalClasses.hide); // If animation is supported, animate
|
1846 |
+
|
1847 |
+
if (animationEndEvent && hasCssAnimation(popup)) {
|
1848 |
+
popup.addEventListener(animationEndEvent, function (e) {
|
1849 |
+
if (e.target === popup) {
|
1850 |
+
swalCloseEventFinished(popup, container, isToast(), onAfterClose);
|
1851 |
+
}
|
1852 |
+
});
|
1853 |
+
} else {
|
1854 |
+
// Otherwise, remove immediately
|
1855 |
+
removePopupAndResetState(container, isToast(), onAfterClose);
|
1856 |
+
}
|
1857 |
+
|
1858 |
+
if (onClose !== null && typeof onClose === 'function') {
|
1859 |
+
onClose(popup);
|
1860 |
+
} // Resolve Swal promise
|
1861 |
+
|
1862 |
+
|
1863 |
+
swalPromiseResolve(resolveValue || {}); // Unset this.params so GC will dispose it (#1569)
|
1864 |
+
|
1865 |
+
delete this.params;
|
1866 |
+
}
|
1867 |
+
|
1868 |
+
var unsetWeakMaps = function unsetWeakMaps(obj) {
|
1869 |
+
for (var i in obj) {
|
1870 |
+
obj[i] = new WeakMap();
|
1871 |
+
}
|
1872 |
+
};
|
1873 |
+
|
1874 |
+
var triggerOnAfterClose = function triggerOnAfterClose(onAfterClose) {
|
1875 |
+
if (onAfterClose !== null && typeof onAfterClose === 'function') {
|
1876 |
+
setTimeout(function () {
|
1877 |
+
onAfterClose();
|
1878 |
+
});
|
1879 |
+
}
|
1880 |
+
};
|
1881 |
+
|
1882 |
+
function setButtonsDisabled(instance, buttons, disabled) {
|
1883 |
+
var domCache = privateProps.domCache.get(instance);
|
1884 |
+
buttons.forEach(function (button) {
|
1885 |
+
domCache[button].disabled = disabled;
|
1886 |
+
});
|
1887 |
+
}
|
1888 |
+
|
1889 |
+
function setInputDisabled(input, disabled) {
|
1890 |
+
if (!input) {
|
1891 |
+
return false;
|
1892 |
+
}
|
1893 |
+
|
1894 |
+
if (input.type === 'radio') {
|
1895 |
+
var radiosContainer = input.parentNode.parentNode;
|
1896 |
+
var radios = radiosContainer.querySelectorAll('input');
|
1897 |
+
|
1898 |
+
for (var i = 0; i < radios.length; i++) {
|
1899 |
+
radios[i].disabled = disabled;
|
1900 |
+
}
|
1901 |
+
} else {
|
1902 |
+
input.disabled = disabled;
|
1903 |
+
}
|
1904 |
+
}
|
1905 |
+
|
1906 |
+
function enableButtons() {
|
1907 |
+
setButtonsDisabled(this, ['confirmButton', 'cancelButton'], false);
|
1908 |
+
}
|
1909 |
+
function disableButtons() {
|
1910 |
+
setButtonsDisabled(this, ['confirmButton', 'cancelButton'], true);
|
1911 |
+
} // @deprecated
|
1912 |
+
|
1913 |
+
function enableConfirmButton() {
|
1914 |
+
warnAboutDepreation('Swal.disableConfirmButton()', "Swal.getConfirmButton().removeAttribute('disabled')");
|
1915 |
+
setButtonsDisabled(this, ['confirmButton'], false);
|
1916 |
+
} // @deprecated
|
1917 |
+
|
1918 |
+
function disableConfirmButton() {
|
1919 |
+
warnAboutDepreation('Swal.enableConfirmButton()', "Swal.getConfirmButton().setAttribute('disabled', '')");
|
1920 |
+
setButtonsDisabled(this, ['confirmButton'], true);
|
1921 |
+
}
|
1922 |
+
function enableInput() {
|
1923 |
+
return setInputDisabled(this.getInput(), false);
|
1924 |
+
}
|
1925 |
+
function disableInput() {
|
1926 |
+
return setInputDisabled(this.getInput(), true);
|
1927 |
+
}
|
1928 |
+
|
1929 |
+
function showValidationMessage(error) {
|
1930 |
+
var domCache = privateProps.domCache.get(this);
|
1931 |
+
domCache.validationMessage.innerHTML = error;
|
1932 |
+
var popupComputedStyle = window.getComputedStyle(domCache.popup);
|
1933 |
+
domCache.validationMessage.style.marginLeft = "-".concat(popupComputedStyle.getPropertyValue('padding-left'));
|
1934 |
+
domCache.validationMessage.style.marginRight = "-".concat(popupComputedStyle.getPropertyValue('padding-right'));
|
1935 |
+
show(domCache.validationMessage);
|
1936 |
+
var input = this.getInput();
|
1937 |
+
|
1938 |
+
if (input) {
|
1939 |
+
input.setAttribute('aria-invalid', true);
|
1940 |
+
input.setAttribute('aria-describedBy', swalClasses['validation-message']);
|
1941 |
+
focusInput(input);
|
1942 |
+
addClass(input, swalClasses.inputerror);
|
1943 |
+
}
|
1944 |
+
} // Hide block with validation message
|
1945 |
+
|
1946 |
+
function resetValidationMessage$1() {
|
1947 |
+
var domCache = privateProps.domCache.get(this);
|
1948 |
+
|
1949 |
+
if (domCache.validationMessage) {
|
1950 |
+
hide(domCache.validationMessage);
|
1951 |
+
}
|
1952 |
+
|
1953 |
+
var input = this.getInput();
|
1954 |
+
|
1955 |
+
if (input) {
|
1956 |
+
input.removeAttribute('aria-invalid');
|
1957 |
+
input.removeAttribute('aria-describedBy');
|
1958 |
+
removeClass(input, swalClasses.inputerror);
|
1959 |
+
}
|
1960 |
+
}
|
1961 |
+
|
1962 |
+
function getProgressSteps$1() {
|
1963 |
+
warnAboutDepreation('Swal.getProgressSteps()', "const swalInstance = Swal.fire({progressSteps: ['1', '2', '3']}); const progressSteps = swalInstance.params.progressSteps");
|
1964 |
+
var innerParams = privateProps.innerParams.get(this);
|
1965 |
+
return innerParams.progressSteps;
|
1966 |
+
}
|
1967 |
+
function setProgressSteps(progressSteps) {
|
1968 |
+
warnAboutDepreation('Swal.setProgressSteps()', 'Swal.update()');
|
1969 |
+
var innerParams = privateProps.innerParams.get(this);
|
1970 |
+
|
1971 |
+
var updatedParams = _extends({}, innerParams, {
|
1972 |
+
progressSteps: progressSteps
|
1973 |
+
});
|
1974 |
+
|
1975 |
+
renderProgressSteps(this, updatedParams);
|
1976 |
+
privateProps.innerParams.set(this, updatedParams);
|
1977 |
+
}
|
1978 |
+
function showProgressSteps() {
|
1979 |
+
var domCache = privateProps.domCache.get(this);
|
1980 |
+
show(domCache.progressSteps);
|
1981 |
+
}
|
1982 |
+
function hideProgressSteps() {
|
1983 |
+
var domCache = privateProps.domCache.get(this);
|
1984 |
+
hide(domCache.progressSteps);
|
1985 |
+
}
|
1986 |
+
|
1987 |
+
var Timer =
|
1988 |
+
/*#__PURE__*/
|
1989 |
+
function () {
|
1990 |
+
function Timer(callback, delay) {
|
1991 |
+
_classCallCheck(this, Timer);
|
1992 |
+
|
1993 |
+
this.callback = callback;
|
1994 |
+
this.remaining = delay;
|
1995 |
+
this.running = false;
|
1996 |
+
this.start();
|
1997 |
+
}
|
1998 |
+
|
1999 |
+
_createClass(Timer, [{
|
2000 |
+
key: "start",
|
2001 |
+
value: function start() {
|
2002 |
+
if (!this.running) {
|
2003 |
+
this.running = true;
|
2004 |
+
this.started = new Date();
|
2005 |
+
this.id = setTimeout(this.callback, this.remaining);
|
2006 |
+
}
|
2007 |
+
|
2008 |
+
return this.remaining;
|
2009 |
+
}
|
2010 |
+
}, {
|
2011 |
+
key: "stop",
|
2012 |
+
value: function stop() {
|
2013 |
+
if (this.running) {
|
2014 |
+
this.running = false;
|
2015 |
+
clearTimeout(this.id);
|
2016 |
+
this.remaining -= new Date() - this.started;
|
2017 |
+
}
|
2018 |
+
|
2019 |
+
return this.remaining;
|
2020 |
+
}
|
2021 |
+
}, {
|
2022 |
+
key: "increase",
|
2023 |
+
value: function increase(n) {
|
2024 |
+
var running = this.running;
|
2025 |
+
|
2026 |
+
if (running) {
|
2027 |
+
this.stop();
|
2028 |
+
}
|
2029 |
+
|
2030 |
+
this.remaining += n;
|
2031 |
+
|
2032 |
+
if (running) {
|
2033 |
+
this.start();
|
2034 |
+
}
|
2035 |
+
|
2036 |
+
return this.remaining;
|
2037 |
+
}
|
2038 |
+
}, {
|
2039 |
+
key: "getTimerLeft",
|
2040 |
+
value: function getTimerLeft() {
|
2041 |
+
if (this.running) {
|
2042 |
+
this.stop();
|
2043 |
+
this.start();
|
2044 |
+
}
|
2045 |
+
|
2046 |
+
return this.remaining;
|
2047 |
+
}
|
2048 |
+
}, {
|
2049 |
+
key: "isRunning",
|
2050 |
+
value: function isRunning() {
|
2051 |
+
return this.running;
|
2052 |
+
}
|
2053 |
+
}]);
|
2054 |
+
|
2055 |
+
return Timer;
|
2056 |
+
}();
|
2057 |
+
|
2058 |
+
var defaultInputValidators = {
|
2059 |
+
email: function email(string, validationMessage) {
|
2060 |
+
return /^[a-zA-Z0-9.+_-]+@[a-zA-Z0-9.-]+\.[a-zA-Z0-9-]{2,24}$/.test(string) ? Promise.resolve() : Promise.resolve(validationMessage ? validationMessage : 'Invalid email address');
|
2061 |
+
},
|
2062 |
+
url: function url(string, validationMessage) {
|
2063 |
+
// taken from https://stackoverflow.com/a/3809435 with a small change from #1306
|
2064 |
+
return /^https?:\/\/(www\.)?[-a-zA-Z0-9@:%._+~#=]{2,256}\.[a-z]{2,63}\b([-a-zA-Z0-9@:%_+.~#?&/=]*)$/.test(string) ? Promise.resolve() : Promise.resolve(validationMessage ? validationMessage : 'Invalid URL');
|
2065 |
+
}
|
2066 |
+
};
|
2067 |
+
|
2068 |
+
/**
|
2069 |
+
* Set type, text and actions on popup
|
2070 |
+
*
|
2071 |
+
* @param params
|
2072 |
+
* @returns {boolean}
|
2073 |
+
*/
|
2074 |
+
|
2075 |
+
function setParameters(params) {
|
2076 |
+
// Use default `inputValidator` for supported input types if not provided
|
2077 |
+
if (!params.inputValidator) {
|
2078 |
+
Object.keys(defaultInputValidators).forEach(function (key) {
|
2079 |
+
if (params.input === key) {
|
2080 |
+
params.inputValidator = defaultInputValidators[key];
|
2081 |
+
}
|
2082 |
+
});
|
2083 |
+
} // showLoaderOnConfirm && preConfirm
|
2084 |
+
|
2085 |
+
|
2086 |
+
if (params.showLoaderOnConfirm && !params.preConfirm) {
|
2087 |
+
warn('showLoaderOnConfirm is set to true, but preConfirm is not defined.\n' + 'showLoaderOnConfirm should be used together with preConfirm, see usage example:\n' + 'https://sweetalert2.github.io/#ajax-request');
|
2088 |
+
} // params.animation will be actually used in renderPopup.js
|
2089 |
+
// but in case when params.animation is a function, we need to call that function
|
2090 |
+
// before popup (re)initialization, so it'll be possible to check Swal.isVisible()
|
2091 |
+
// inside the params.animation function
|
2092 |
+
|
2093 |
+
|
2094 |
+
params.animation = callIfFunction(params.animation); // Determine if the custom target element is valid
|
2095 |
+
|
2096 |
+
if (!params.target || typeof params.target === 'string' && !document.querySelector(params.target) || typeof params.target !== 'string' && !params.target.appendChild) {
|
2097 |
+
warn('Target parameter is not valid, defaulting to "body"');
|
2098 |
+
params.target = 'body';
|
2099 |
+
} // Replace newlines with <br> in title
|
2100 |
+
|
2101 |
+
|
2102 |
+
if (typeof params.title === 'string') {
|
2103 |
+
params.title = params.title.split('\n').join('<br />');
|
2104 |
+
}
|
2105 |
+
|
2106 |
+
var oldPopup = getPopup();
|
2107 |
+
var targetElement = typeof params.target === 'string' ? document.querySelector(params.target) : params.target;
|
2108 |
+
|
2109 |
+
if (!oldPopup || // If the model target has changed, refresh the popup
|
2110 |
+
oldPopup && targetElement && oldPopup.parentNode !== targetElement.parentNode) {
|
2111 |
+
init(params);
|
2112 |
+
}
|
2113 |
+
}
|
2114 |
+
|
2115 |
+
function swalOpenAnimationFinished(popup, container) {
|
2116 |
+
popup.removeEventListener(animationEndEvent, swalOpenAnimationFinished);
|
2117 |
+
container.style.overflowY = 'auto';
|
2118 |
+
}
|
2119 |
+
/**
|
2120 |
+
* Open popup, add necessary classes and styles, fix scrollbar
|
2121 |
+
*
|
2122 |
+
* @param {Array} params
|
2123 |
+
*/
|
2124 |
+
|
2125 |
+
|
2126 |
+
var openPopup = function openPopup(params) {
|
2127 |
+
var container = getContainer();
|
2128 |
+
var popup = getPopup();
|
2129 |
+
|
2130 |
+
if (params.onBeforeOpen !== null && typeof params.onBeforeOpen === 'function') {
|
2131 |
+
params.onBeforeOpen(popup);
|
2132 |
+
}
|
2133 |
+
|
2134 |
+
if (params.animation) {
|
2135 |
+
addClass(popup, swalClasses.show);
|
2136 |
+
addClass(container, swalClasses.fade);
|
2137 |
+
}
|
2138 |
+
|
2139 |
+
show(popup); // scrolling is 'hidden' until animation is done, after that 'auto'
|
2140 |
+
|
2141 |
+
if (animationEndEvent && hasCssAnimation(popup)) {
|
2142 |
+
container.style.overflowY = 'hidden';
|
2143 |
+
popup.addEventListener(animationEndEvent, swalOpenAnimationFinished.bind(null, popup, container));
|
2144 |
+
} else {
|
2145 |
+
container.style.overflowY = 'auto';
|
2146 |
+
}
|
2147 |
+
|
2148 |
+
addClass([document.documentElement, document.body, container], swalClasses.shown);
|
2149 |
+
|
2150 |
+
if (params.heightAuto && params.backdrop && !params.toast) {
|
2151 |
+
addClass([document.documentElement, document.body], swalClasses['height-auto']);
|
2152 |
+
}
|
2153 |
+
|
2154 |
+
if (isModal()) {
|
2155 |
+
if (params.scrollbarPadding) {
|
2156 |
+
fixScrollbar();
|
2157 |
+
}
|
2158 |
+
|
2159 |
+
iOSfix();
|
2160 |
+
IEfix();
|
2161 |
+
setAriaHidden(); // sweetalert2/issues/1247
|
2162 |
+
|
2163 |
+
setTimeout(function () {
|
2164 |
+
container.scrollTop = 0;
|
2165 |
+
});
|
2166 |
+
}
|
2167 |
+
|
2168 |
+
if (!isToast() && !globalState.previousActiveElement) {
|
2169 |
+
globalState.previousActiveElement = document.activeElement;
|
2170 |
+
}
|
2171 |
+
|
2172 |
+
if (params.onOpen !== null && typeof params.onOpen === 'function') {
|
2173 |
+
setTimeout(function () {
|
2174 |
+
params.onOpen(popup);
|
2175 |
+
});
|
2176 |
+
}
|
2177 |
+
};
|
2178 |
+
|
2179 |
+
var _this = undefined;
|
2180 |
+
|
2181 |
+
var handleInputOptions = function handleInputOptions(instance, params) {
|
2182 |
+
var content = getContent();
|
2183 |
+
|
2184 |
+
var processInputOptions = function processInputOptions(inputOptions) {
|
2185 |
+
return populateInputOptions[params.input](content, formatInputOptions(inputOptions), params);
|
2186 |
+
};
|
2187 |
+
|
2188 |
+
if (isPromise(params.inputOptions)) {
|
2189 |
+
showLoading();
|
2190 |
+
params.inputOptions.then(function (inputOptions) {
|
2191 |
+
instance.hideLoading();
|
2192 |
+
processInputOptions(inputOptions);
|
2193 |
+
});
|
2194 |
+
} else if (_typeof(params.inputOptions) === 'object') {
|
2195 |
+
processInputOptions(params.inputOptions);
|
2196 |
+
} else {
|
2197 |
+
error("Unexpected type of inputOptions! Expected object, Map or Promise, got ".concat(_typeof(params.inputOptions)));
|
2198 |
+
}
|
2199 |
+
};
|
2200 |
+
var handleInputValue = function handleInputValue(instance, params) {
|
2201 |
+
var input = instance.getInput();
|
2202 |
+
hide(input);
|
2203 |
+
params.inputValue.then(function (inputValue) {
|
2204 |
+
input.value = params.input === 'number' ? parseFloat(inputValue) || 0 : inputValue + '';
|
2205 |
+
show(input);
|
2206 |
+
input.focus();
|
2207 |
+
instance.hideLoading();
|
2208 |
+
})["catch"](function (err) {
|
2209 |
+
error('Error in inputValue promise: ' + err);
|
2210 |
+
input.value = '';
|
2211 |
+
show(input);
|
2212 |
+
input.focus();
|
2213 |
+
|
2214 |
+
_this.hideLoading();
|
2215 |
+
});
|
2216 |
+
};
|
2217 |
+
var populateInputOptions = {
|
2218 |
+
select: function select(content, inputOptions, params) {
|
2219 |
+
var select = getChildByClass(content, swalClasses.select);
|
2220 |
+
inputOptions.forEach(function (inputOption) {
|
2221 |
+
var optionValue = inputOption[0];
|
2222 |
+
var optionLabel = inputOption[1];
|
2223 |
+
var option = document.createElement('option');
|
2224 |
+
option.value = optionValue;
|
2225 |
+
option.innerHTML = optionLabel;
|
2226 |
+
|
2227 |
+
if (params.inputValue.toString() === optionValue.toString()) {
|
2228 |
+
option.selected = true;
|
2229 |
+
}
|
2230 |
+
|
2231 |
+
select.appendChild(option);
|
2232 |
+
});
|
2233 |
+
select.focus();
|
2234 |
+
},
|
2235 |
+
radio: function radio(content, inputOptions, params) {
|
2236 |
+
var radio = getChildByClass(content, swalClasses.radio);
|
2237 |
+
inputOptions.forEach(function (inputOption) {
|
2238 |
+
var radioValue = inputOption[0];
|
2239 |
+
var radioLabel = inputOption[1];
|
2240 |
+
var radioInput = document.createElement('input');
|
2241 |
+
var radioLabelElement = document.createElement('label');
|
2242 |
+
radioInput.type = 'radio';
|
2243 |
+
radioInput.name = swalClasses.radio;
|
2244 |
+
radioInput.value = radioValue;
|
2245 |
+
|
2246 |
+
if (params.inputValue.toString() === radioValue.toString()) {
|
2247 |
+
radioInput.checked = true;
|
2248 |
+
}
|
2249 |
+
|
2250 |
+
var label = document.createElement('span');
|
2251 |
+
label.innerHTML = radioLabel;
|
2252 |
+
label.className = swalClasses.label;
|
2253 |
+
radioLabelElement.appendChild(radioInput);
|
2254 |
+
radioLabelElement.appendChild(label);
|
2255 |
+
radio.appendChild(radioLabelElement);
|
2256 |
+
});
|
2257 |
+
var radios = radio.querySelectorAll('input');
|
2258 |
+
|
2259 |
+
if (radios.length) {
|
2260 |
+
radios[0].focus();
|
2261 |
+
}
|
2262 |
+
}
|
2263 |
+
/**
|
2264 |
+
* Converts `inputOptions` into an array of `[value, label]`s
|
2265 |
+
* @param inputOptions
|
2266 |
+
*/
|
2267 |
+
|
2268 |
+
};
|
2269 |
+
|
2270 |
+
var formatInputOptions = function formatInputOptions(inputOptions) {
|
2271 |
+
var result = [];
|
2272 |
+
|
2273 |
+
if (typeof Map !== 'undefined' && inputOptions instanceof Map) {
|
2274 |
+
inputOptions.forEach(function (value, key) {
|
2275 |
+
result.push([key, value]);
|
2276 |
+
});
|
2277 |
+
} else {
|
2278 |
+
Object.keys(inputOptions).forEach(function (key) {
|
2279 |
+
result.push([key, inputOptions[key]]);
|
2280 |
+
});
|
2281 |
+
}
|
2282 |
+
|
2283 |
+
return result;
|
2284 |
+
};
|
2285 |
+
|
2286 |
+
function _main(userParams) {
|
2287 |
+
var _this = this;
|
2288 |
+
|
2289 |
+
showWarningsForParams(userParams);
|
2290 |
+
|
2291 |
+
var innerParams = _extends({}, defaultParams, userParams);
|
2292 |
+
|
2293 |
+
setParameters(innerParams);
|
2294 |
+
Object.freeze(innerParams); // clear the previous timer
|
2295 |
+
|
2296 |
+
if (globalState.timeout) {
|
2297 |
+
globalState.timeout.stop();
|
2298 |
+
delete globalState.timeout;
|
2299 |
+
} // clear the restore focus timeout
|
2300 |
+
|
2301 |
+
|
2302 |
+
clearTimeout(globalState.restoreFocusTimeout);
|
2303 |
+
var domCache = {
|
2304 |
+
popup: getPopup(),
|
2305 |
+
container: getContainer(),
|
2306 |
+
content: getContent(),
|
2307 |
+
actions: getActions(),
|
2308 |
+
confirmButton: getConfirmButton(),
|
2309 |
+
cancelButton: getCancelButton(),
|
2310 |
+
closeButton: getCloseButton(),
|
2311 |
+
validationMessage: getValidationMessage(),
|
2312 |
+
progressSteps: getProgressSteps()
|
2313 |
+
};
|
2314 |
+
privateProps.domCache.set(this, domCache);
|
2315 |
+
render(this, innerParams);
|
2316 |
+
privateProps.innerParams.set(this, innerParams);
|
2317 |
+
var constructor = this.constructor;
|
2318 |
+
return new Promise(function (resolve) {
|
2319 |
+
// functions to handle all closings/dismissals
|
2320 |
+
var succeedWith = function succeedWith(value) {
|
2321 |
+
_this.closePopup({
|
2322 |
+
value: value
|
2323 |
+
});
|
2324 |
+
};
|
2325 |
+
|
2326 |
+
var dismissWith = function dismissWith(dismiss) {
|
2327 |
+
_this.closePopup({
|
2328 |
+
dismiss: dismiss
|
2329 |
+
});
|
2330 |
+
};
|
2331 |
+
|
2332 |
+
privateMethods.swalPromiseResolve.set(_this, resolve); // Close on timer
|
2333 |
+
|
2334 |
+
if (innerParams.timer) {
|
2335 |
+
globalState.timeout = new Timer(function () {
|
2336 |
+
dismissWith('timer');
|
2337 |
+
delete globalState.timeout;
|
2338 |
+
}, innerParams.timer);
|
2339 |
+
} // Get the value of the popup input
|
2340 |
+
|
2341 |
+
|
2342 |
+
var getInputValue = function getInputValue() {
|
2343 |
+
var input = _this.getInput();
|
2344 |
+
|
2345 |
+
if (!input) {
|
2346 |
+
return null;
|
2347 |
+
}
|
2348 |
+
|
2349 |
+
switch (innerParams.input) {
|
2350 |
+
case 'checkbox':
|
2351 |
+
return input.checked ? 1 : 0;
|
2352 |
+
|
2353 |
+
case 'radio':
|
2354 |
+
return input.checked ? input.value : null;
|
2355 |
+
|
2356 |
+
case 'file':
|
2357 |
+
return input.files.length ? input.files[0] : null;
|
2358 |
+
|
2359 |
+
default:
|
2360 |
+
return innerParams.inputAutoTrim ? input.value.trim() : input.value;
|
2361 |
+
}
|
2362 |
+
}; // input autofocus
|
2363 |
+
|
2364 |
+
|
2365 |
+
if (innerParams.input) {
|
2366 |
+
setTimeout(function () {
|
2367 |
+
var input = _this.getInput();
|
2368 |
+
|
2369 |
+
if (input) {
|
2370 |
+
focusInput(input);
|
2371 |
+
}
|
2372 |
+
}, 0);
|
2373 |
+
}
|
2374 |
+
|
2375 |
+
var confirm = function confirm(value) {
|
2376 |
+
if (innerParams.showLoaderOnConfirm) {
|
2377 |
+
constructor.showLoading(); // TODO: make showLoading an *instance* method
|
2378 |
+
}
|
2379 |
+
|
2380 |
+
if (innerParams.preConfirm) {
|
2381 |
+
_this.resetValidationMessage();
|
2382 |
+
|
2383 |
+
var preConfirmPromise = Promise.resolve().then(function () {
|
2384 |
+
return innerParams.preConfirm(value, innerParams.validationMessage);
|
2385 |
+
});
|
2386 |
+
preConfirmPromise.then(function (preConfirmValue) {
|
2387 |
+
if (isVisible(domCache.validationMessage) || preConfirmValue === false) {
|
2388 |
+
_this.hideLoading();
|
2389 |
+
} else {
|
2390 |
+
succeedWith(typeof preConfirmValue === 'undefined' ? value : preConfirmValue);
|
2391 |
+
}
|
2392 |
+
});
|
2393 |
+
} else {
|
2394 |
+
succeedWith(value);
|
2395 |
+
}
|
2396 |
+
}; // Mouse interactions
|
2397 |
+
|
2398 |
+
|
2399 |
+
var onButtonEvent = function onButtonEvent(e) {
|
2400 |
+
var target = e.target;
|
2401 |
+
var confirmButton = domCache.confirmButton,
|
2402 |
+
cancelButton = domCache.cancelButton;
|
2403 |
+
var targetedConfirm = confirmButton && (confirmButton === target || confirmButton.contains(target));
|
2404 |
+
var targetedCancel = cancelButton && (cancelButton === target || cancelButton.contains(target));
|
2405 |
+
|
2406 |
+
switch (e.type) {
|
2407 |
+
case 'click':
|
2408 |
+
// Clicked 'confirm'
|
2409 |
+
if (targetedConfirm) {
|
2410 |
+
_this.disableButtons();
|
2411 |
+
|
2412 |
+
if (innerParams.input) {
|
2413 |
+
var inputValue = getInputValue();
|
2414 |
+
|
2415 |
+
if (innerParams.inputValidator) {
|
2416 |
+
_this.disableInput();
|
2417 |
+
|
2418 |
+
var validationPromise = Promise.resolve().then(function () {
|
2419 |
+
return innerParams.inputValidator(inputValue, innerParams.validationMessage);
|
2420 |
+
});
|
2421 |
+
validationPromise.then(function (validationMessage) {
|
2422 |
+
_this.enableButtons();
|
2423 |
+
|
2424 |
+
_this.enableInput();
|
2425 |
+
|
2426 |
+
if (validationMessage) {
|
2427 |
+
_this.showValidationMessage(validationMessage);
|
2428 |
+
} else {
|
2429 |
+
confirm(inputValue);
|
2430 |
+
}
|
2431 |
+
});
|
2432 |
+
} else if (!_this.getInput().checkValidity()) {
|
2433 |
+
_this.enableButtons();
|
2434 |
+
|
2435 |
+
_this.showValidationMessage(innerParams.validationMessage);
|
2436 |
+
} else {
|
2437 |
+
confirm(inputValue);
|
2438 |
+
}
|
2439 |
+
} else {
|
2440 |
+
confirm(true);
|
2441 |
+
} // Clicked 'cancel'
|
2442 |
+
|
2443 |
+
} else if (targetedCancel) {
|
2444 |
+
_this.disableButtons();
|
2445 |
+
|
2446 |
+
dismissWith(constructor.DismissReason.cancel);
|
2447 |
+
}
|
2448 |
+
|
2449 |
+
break;
|
2450 |
+
|
2451 |
+
default:
|
2452 |
+
}
|
2453 |
+
};
|
2454 |
+
|
2455 |
+
var buttons = domCache.popup.querySelectorAll('button');
|
2456 |
+
|
2457 |
+
for (var i = 0; i < buttons.length; i++) {
|
2458 |
+
buttons[i].onclick = onButtonEvent;
|
2459 |
+
buttons[i].onmouseover = onButtonEvent;
|
2460 |
+
buttons[i].onmouseout = onButtonEvent;
|
2461 |
+
buttons[i].onmousedown = onButtonEvent;
|
2462 |
+
} // Closing popup by close button
|
2463 |
+
|
2464 |
+
|
2465 |
+
domCache.closeButton.onclick = function () {
|
2466 |
+
dismissWith(constructor.DismissReason.close);
|
2467 |
+
};
|
2468 |
+
|
2469 |
+
if (innerParams.toast) {
|
2470 |
+
// Closing popup by internal click
|
2471 |
+
domCache.popup.onclick = function () {
|
2472 |
+
if (innerParams.showConfirmButton || innerParams.showCancelButton || innerParams.showCloseButton || innerParams.input) {
|
2473 |
+
return;
|
2474 |
+
}
|
2475 |
+
|
2476 |
+
dismissWith(constructor.DismissReason.close);
|
2477 |
+
};
|
2478 |
+
} else {
|
2479 |
+
var ignoreOutsideClick = false; // Ignore click events that had mousedown on the popup but mouseup on the container
|
2480 |
+
// This can happen when the user drags a slider
|
2481 |
+
|
2482 |
+
domCache.popup.onmousedown = function () {
|
2483 |
+
domCache.container.onmouseup = function (e) {
|
2484 |
+
domCache.container.onmouseup = undefined; // We only check if the mouseup target is the container because usually it doesn't
|
2485 |
+
// have any other direct children aside of the popup
|
2486 |
+
|
2487 |
+
if (e.target === domCache.container) {
|
2488 |
+
ignoreOutsideClick = true;
|
2489 |
+
}
|
2490 |
+
};
|
2491 |
+
}; // Ignore click events that had mousedown on the container but mouseup on the popup
|
2492 |
+
|
2493 |
+
|
2494 |
+
domCache.container.onmousedown = function () {
|
2495 |
+
domCache.popup.onmouseup = function (e) {
|
2496 |
+
domCache.popup.onmouseup = undefined; // We also need to check if the mouseup target is a child of the popup
|
2497 |
+
|
2498 |
+
if (e.target === domCache.popup || domCache.popup.contains(e.target)) {
|
2499 |
+
ignoreOutsideClick = true;
|
2500 |
+
}
|
2501 |
+
};
|
2502 |
+
};
|
2503 |
+
|
2504 |
+
domCache.container.onclick = function (e) {
|
2505 |
+
if (ignoreOutsideClick) {
|
2506 |
+
ignoreOutsideClick = false;
|
2507 |
+
return;
|
2508 |
+
}
|
2509 |
+
|
2510 |
+
if (e.target !== domCache.container) {
|
2511 |
+
return;
|
2512 |
+
}
|
2513 |
+
|
2514 |
+
if (callIfFunction(innerParams.allowOutsideClick)) {
|
2515 |
+
dismissWith(constructor.DismissReason.backdrop);
|
2516 |
+
}
|
2517 |
+
};
|
2518 |
+
} // Reverse buttons (Confirm on the right side)
|
2519 |
+
|
2520 |
+
|
2521 |
+
if (innerParams.reverseButtons) {
|
2522 |
+
domCache.confirmButton.parentNode.insertBefore(domCache.cancelButton, domCache.confirmButton);
|
2523 |
+
} else {
|
2524 |
+
domCache.confirmButton.parentNode.insertBefore(domCache.confirmButton, domCache.cancelButton);
|
2525 |
+
} // Focus handling
|
2526 |
+
|
2527 |
+
|
2528 |
+
var setFocus = function setFocus(index, increment) {
|
2529 |
+
var focusableElements = getFocusableElements(innerParams.focusCancel); // search for visible elements and select the next possible match
|
2530 |
+
|
2531 |
+
for (var _i = 0; _i < focusableElements.length; _i++) {
|
2532 |
+
index = index + increment; // rollover to first item
|
2533 |
+
|
2534 |
+
if (index === focusableElements.length) {
|
2535 |
+
index = 0; // go to last item
|
2536 |
+
} else if (index === -1) {
|
2537 |
+
index = focusableElements.length - 1;
|
2538 |
+
}
|
2539 |
+
|
2540 |
+
return focusableElements[index].focus();
|
2541 |
+
} // no visible focusable elements, focus the popup
|
2542 |
+
|
2543 |
+
|
2544 |
+
domCache.popup.focus();
|
2545 |
+
};
|
2546 |
+
|
2547 |
+
var keydownHandler = function keydownHandler(e, innerParams) {
|
2548 |
+
if (innerParams.stopKeydownPropagation) {
|
2549 |
+
e.stopPropagation();
|
2550 |
+
}
|
2551 |
+
|
2552 |
+
var arrowKeys = ['ArrowLeft', 'ArrowRight', 'ArrowUp', 'ArrowDown', 'Left', 'Right', 'Up', 'Down' // IE11
|
2553 |
+
];
|
2554 |
+
|
2555 |
+
if (e.key === 'Enter' && !e.isComposing) {
|
2556 |
+
if (e.target && _this.getInput() && e.target.outerHTML === _this.getInput().outerHTML) {
|
2557 |
+
if (['textarea', 'file'].indexOf(innerParams.input) !== -1) {
|
2558 |
+
return; // do not submit
|
2559 |
+
}
|
2560 |
+
|
2561 |
+
constructor.clickConfirm();
|
2562 |
+
e.preventDefault();
|
2563 |
+
} // TAB
|
2564 |
+
|
2565 |
+
} else if (e.key === 'Tab') {
|
2566 |
+
var targetElement = e.target;
|
2567 |
+
var focusableElements = getFocusableElements(innerParams.focusCancel);
|
2568 |
+
var btnIndex = -1;
|
2569 |
+
|
2570 |
+
for (var _i2 = 0; _i2 < focusableElements.length; _i2++) {
|
2571 |
+
if (targetElement === focusableElements[_i2]) {
|
2572 |
+
btnIndex = _i2;
|
2573 |
+
break;
|
2574 |
+
}
|
2575 |
+
}
|
2576 |
+
|
2577 |
+
if (!e.shiftKey) {
|
2578 |
+
// Cycle to the next button
|
2579 |
+
setFocus(btnIndex, 1);
|
2580 |
+
} else {
|
2581 |
+
// Cycle to the prev button
|
2582 |
+
setFocus(btnIndex, -1);
|
2583 |
+
}
|
2584 |
+
|
2585 |
+
e.stopPropagation();
|
2586 |
+
e.preventDefault(); // ARROWS - switch focus between buttons
|
2587 |
+
} else if (arrowKeys.indexOf(e.key) !== -1) {
|
2588 |
+
// focus Cancel button if Confirm button is currently focused
|
2589 |
+
if (document.activeElement === domCache.confirmButton && isVisible(domCache.cancelButton)) {
|
2590 |
+
domCache.cancelButton.focus(); // and vice versa
|
2591 |
+
} else if (document.activeElement === domCache.cancelButton && isVisible(domCache.confirmButton)) {
|
2592 |
+
domCache.confirmButton.focus();
|
2593 |
+
} // ESC
|
2594 |
+
|
2595 |
+
} else if ((e.key === 'Escape' || e.key === 'Esc') && callIfFunction(innerParams.allowEscapeKey) === true) {
|
2596 |
+
e.preventDefault();
|
2597 |
+
dismissWith(constructor.DismissReason.esc);
|
2598 |
+
}
|
2599 |
+
};
|
2600 |
+
|
2601 |
+
if (globalState.keydownTarget && globalState.keydownHandlerAdded) {
|
2602 |
+
globalState.keydownTarget.removeEventListener('keydown', globalState.keydownHandler, {
|
2603 |
+
capture: globalState.keydownListenerCapture
|
2604 |
+
});
|
2605 |
+
globalState.keydownHandlerAdded = false;
|
2606 |
+
}
|
2607 |
+
|
2608 |
+
if (!innerParams.toast) {
|
2609 |
+
globalState.keydownHandler = function (e) {
|
2610 |
+
return keydownHandler(e, innerParams);
|
2611 |
+
};
|
2612 |
+
|
2613 |
+
globalState.keydownTarget = innerParams.keydownListenerCapture ? window : domCache.popup;
|
2614 |
+
globalState.keydownListenerCapture = innerParams.keydownListenerCapture;
|
2615 |
+
globalState.keydownTarget.addEventListener('keydown', globalState.keydownHandler, {
|
2616 |
+
capture: globalState.keydownListenerCapture
|
2617 |
+
});
|
2618 |
+
globalState.keydownHandlerAdded = true;
|
2619 |
+
}
|
2620 |
+
|
2621 |
+
_this.enableButtons();
|
2622 |
+
|
2623 |
+
_this.hideLoading();
|
2624 |
+
|
2625 |
+
_this.resetValidationMessage();
|
2626 |
+
|
2627 |
+
if (innerParams.toast && (innerParams.input || innerParams.footer || innerParams.showCloseButton)) {
|
2628 |
+
addClass(document.body, swalClasses['toast-column']);
|
2629 |
+
} else {
|
2630 |
+
removeClass(document.body, swalClasses['toast-column']);
|
2631 |
+
} // inputOptions, inputValue
|
2632 |
+
|
2633 |
+
|
2634 |
+
if (innerParams.input === 'select' || innerParams.input === 'radio') {
|
2635 |
+
handleInputOptions(_this, innerParams);
|
2636 |
+
} else if (['text', 'email', 'number', 'tel', 'textarea'].indexOf(innerParams.input) !== -1 && isPromise(innerParams.inputValue)) {
|
2637 |
+
handleInputValue(_this, innerParams);
|
2638 |
+
}
|
2639 |
+
|
2640 |
+
openPopup(innerParams);
|
2641 |
+
|
2642 |
+
if (!innerParams.toast) {
|
2643 |
+
if (!callIfFunction(innerParams.allowEnterKey)) {
|
2644 |
+
if (document.activeElement && typeof document.activeElement.blur === 'function') {
|
2645 |
+
document.activeElement.blur();
|
2646 |
+
}
|
2647 |
+
} else if (innerParams.focusCancel && isVisible(domCache.cancelButton)) {
|
2648 |
+
domCache.cancelButton.focus();
|
2649 |
+
} else if (innerParams.focusConfirm && isVisible(domCache.confirmButton)) {
|
2650 |
+
domCache.confirmButton.focus();
|
2651 |
+
} else {
|
2652 |
+
setFocus(-1, 1);
|
2653 |
+
}
|
2654 |
+
} // fix scroll
|
2655 |
+
|
2656 |
+
|
2657 |
+
domCache.container.scrollTop = 0;
|
2658 |
+
});
|
2659 |
+
}
|
2660 |
+
|
2661 |
+
/**
|
2662 |
+
* Updates popup parameters.
|
2663 |
+
*/
|
2664 |
+
|
2665 |
+
function update(params) {
|
2666 |
+
var validUpdatableParams = {}; // assign valid params from `params` to `defaults`
|
2667 |
+
|
2668 |
+
Object.keys(params).forEach(function (param) {
|
2669 |
+
if (Swal.isUpdatableParameter(param)) {
|
2670 |
+
validUpdatableParams[param] = params[param];
|
2671 |
+
} else {
|
2672 |
+
warn("Invalid parameter to update: \"".concat(param, "\". Updatable params are listed here: https://github.com/sweetalert2/sweetalert2/blob/master/src/utils/params.js"));
|
2673 |
+
}
|
2674 |
+
});
|
2675 |
+
var innerParams = privateProps.innerParams.get(this);
|
2676 |
+
|
2677 |
+
var updatedParams = _extends({}, innerParams, validUpdatableParams);
|
2678 |
+
|
2679 |
+
render(this, updatedParams);
|
2680 |
+
privateProps.innerParams.set(this, updatedParams);
|
2681 |
+
Object.defineProperties(this, {
|
2682 |
+
params: {
|
2683 |
+
value: _extends({}, this.params, params),
|
2684 |
+
writable: false,
|
2685 |
+
enumerable: true
|
2686 |
+
}
|
2687 |
+
});
|
2688 |
+
}
|
2689 |
+
|
2690 |
+
|
2691 |
+
|
2692 |
+
var instanceMethods = Object.freeze({
|
2693 |
+
hideLoading: hideLoading,
|
2694 |
+
disableLoading: hideLoading,
|
2695 |
+
getInput: getInput$1,
|
2696 |
+
close: close,
|
2697 |
+
closePopup: close,
|
2698 |
+
closeModal: close,
|
2699 |
+
closeToast: close,
|
2700 |
+
enableButtons: enableButtons,
|
2701 |
+
disableButtons: disableButtons,
|
2702 |
+
enableConfirmButton: enableConfirmButton,
|
2703 |
+
disableConfirmButton: disableConfirmButton,
|
2704 |
+
enableInput: enableInput,
|
2705 |
+
disableInput: disableInput,
|
2706 |
+
showValidationMessage: showValidationMessage,
|
2707 |
+
resetValidationMessage: resetValidationMessage$1,
|
2708 |
+
getProgressSteps: getProgressSteps$1,
|
2709 |
+
setProgressSteps: setProgressSteps,
|
2710 |
+
showProgressSteps: showProgressSteps,
|
2711 |
+
hideProgressSteps: hideProgressSteps,
|
2712 |
+
_main: _main,
|
2713 |
+
update: update
|
2714 |
+
});
|
2715 |
+
|
2716 |
+
var currentInstance; // SweetAlert constructor
|
2717 |
+
|
2718 |
+
function SweetAlert() {
|
2719 |
+
// Prevent run in Node env
|
2720 |
+
|
2721 |
+
/* istanbul ignore if */
|
2722 |
+
if (typeof window === 'undefined') {
|
2723 |
+
return;
|
2724 |
+
} // Check for the existence of Promise
|
2725 |
+
|
2726 |
+
/* istanbul ignore if */
|
2727 |
+
|
2728 |
+
|
2729 |
+
if (typeof Promise === 'undefined') {
|
2730 |
+
error('This package requires a Promise library, please include a shim to enable it in this browser (See: https://github.com/sweetalert2/sweetalert2/wiki/Migration-from-SweetAlert-to-SweetAlert2#1-ie-support)');
|
2731 |
+
}
|
2732 |
+
|
2733 |
+
currentInstance = this;
|
2734 |
+
|
2735 |
+
for (var _len = arguments.length, args = new Array(_len), _key = 0; _key < _len; _key++) {
|
2736 |
+
args[_key] = arguments[_key];
|
2737 |
+
}
|
2738 |
+
|
2739 |
+
var outerParams = Object.freeze(this.constructor.argsToParams(args));
|
2740 |
+
Object.defineProperties(this, {
|
2741 |
+
params: {
|
2742 |
+
value: outerParams,
|
2743 |
+
writable: false,
|
2744 |
+
enumerable: true,
|
2745 |
+
configurable: true
|
2746 |
+
}
|
2747 |
+
});
|
2748 |
+
|
2749 |
+
var promise = this._main(this.params);
|
2750 |
+
|
2751 |
+
privateProps.promise.set(this, promise);
|
2752 |
+
} // `catch` cannot be the name of a module export, so we define our thenable methods here instead
|
2753 |
+
|
2754 |
+
|
2755 |
+
SweetAlert.prototype.then = function (onFulfilled) {
|
2756 |
+
var promise = privateProps.promise.get(this);
|
2757 |
+
return promise.then(onFulfilled);
|
2758 |
+
};
|
2759 |
+
|
2760 |
+
SweetAlert.prototype["finally"] = function (onFinally) {
|
2761 |
+
var promise = privateProps.promise.get(this);
|
2762 |
+
return promise["finally"](onFinally);
|
2763 |
+
}; // Assign instance methods from src/instanceMethods/*.js to prototype
|
2764 |
+
|
2765 |
+
|
2766 |
+
_extends(SweetAlert.prototype, instanceMethods); // Assign static methods from src/staticMethods/*.js to constructor
|
2767 |
+
|
2768 |
+
|
2769 |
+
_extends(SweetAlert, staticMethods); // Proxy to instance methods to constructor, for now, for backwards compatibility
|
2770 |
+
|
2771 |
+
|
2772 |
+
Object.keys(instanceMethods).forEach(function (key) {
|
2773 |
+
SweetAlert[key] = function () {
|
2774 |
+
if (currentInstance) {
|
2775 |
+
var _currentInstance;
|
2776 |
+
|
2777 |
+
return (_currentInstance = currentInstance)[key].apply(_currentInstance, arguments);
|
2778 |
+
}
|
2779 |
+
};
|
2780 |
+
});
|
2781 |
+
SweetAlert.DismissReason = DismissReason;
|
2782 |
+
SweetAlert.version = '8.11.8';
|
2783 |
+
|
2784 |
+
var Swal = SweetAlert;
|
2785 |
+
Swal["default"] = Swal;
|
2786 |
+
|
2787 |
+
return Swal;
|
2788 |
+
|
2789 |
+
})));
|
2790 |
+
if (typeof window !== 'undefined' && window.Sweetalert2){ window.swal = window.sweetAlert = window.Swal = window.SweetAlert = window.Sweetalert2}
|
2791 |
+
|
2792 |
+
"undefined"!=typeof document&&function(e,t){var n=e.createElement("style");if(e.getElementsByTagName("head")[0].appendChild(n),n.styleSheet)n.styleSheet.disabled||(n.styleSheet.cssText=t);else try{n.innerHTML=t}catch(e){n.innerText=t}}(document,"@charset \"UTF-8\";@-webkit-keyframes swal2-show{0%{-webkit-transform:scale(.7);transform:scale(.7)}45%{-webkit-transform:scale(1.05);transform:scale(1.05)}80%{-webkit-transform:scale(.95);transform:scale(.95)}100%{-webkit-transform:scale(1);transform:scale(1)}}@keyframes swal2-show{0%{-webkit-transform:scale(.7);transform:scale(.7)}45%{-webkit-transform:scale(1.05);transform:scale(1.05)}80%{-webkit-transform:scale(.95);transform:scale(.95)}100%{-webkit-transform:scale(1);transform:scale(1)}}@-webkit-keyframes swal2-hide{0%{-webkit-transform:scale(1);transform:scale(1);opacity:1}100%{-webkit-transform:scale(.5);transform:scale(.5);opacity:0}}@keyframes swal2-hide{0%{-webkit-transform:scale(1);transform:scale(1);opacity:1}100%{-webkit-transform:scale(.5);transform:scale(.5);opacity:0}}@-webkit-keyframes swal2-animate-success-line-tip{0%{top:1.1875em;left:.0625em;width:0}54%{top:1.0625em;left:.125em;width:0}70%{top:2.1875em;left:-.375em;width:3.125em}84%{top:3em;left:1.3125em;width:1.0625em}100%{top:2.8125em;left:.875em;width:1.5625em}}@keyframes swal2-animate-success-line-tip{0%{top:1.1875em;left:.0625em;width:0}54%{top:1.0625em;left:.125em;width:0}70%{top:2.1875em;left:-.375em;width:3.125em}84%{top:3em;left:1.3125em;width:1.0625em}100%{top:2.8125em;left:.875em;width:1.5625em}}@-webkit-keyframes swal2-animate-success-line-long{0%{top:3.375em;right:2.875em;width:0}65%{top:3.375em;right:2.875em;width:0}84%{top:2.1875em;right:0;width:3.4375em}100%{top:2.375em;right:.5em;width:2.9375em}}@keyframes swal2-animate-success-line-long{0%{top:3.375em;right:2.875em;width:0}65%{top:3.375em;right:2.875em;width:0}84%{top:2.1875em;right:0;width:3.4375em}100%{top:2.375em;right:.5em;width:2.9375em}}@-webkit-keyframes swal2-rotate-success-circular-line{0%{-webkit-transform:rotate(-45deg);transform:rotate(-45deg)}5%{-webkit-transform:rotate(-45deg);transform:rotate(-45deg)}12%{-webkit-transform:rotate(-405deg);transform:rotate(-405deg)}100%{-webkit-transform:rotate(-405deg);transform:rotate(-405deg)}}@keyframes swal2-rotate-success-circular-line{0%{-webkit-transform:rotate(-45deg);transform:rotate(-45deg)}5%{-webkit-transform:rotate(-45deg);transform:rotate(-45deg)}12%{-webkit-transform:rotate(-405deg);transform:rotate(-405deg)}100%{-webkit-transform:rotate(-405deg);transform:rotate(-405deg)}}@-webkit-keyframes swal2-animate-error-x-mark{0%{margin-top:1.625em;-webkit-transform:scale(.4);transform:scale(.4);opacity:0}50%{margin-top:1.625em;-webkit-transform:scale(.4);transform:scale(.4);opacity:0}80%{margin-top:-.375em;-webkit-transform:scale(1.15);transform:scale(1.15)}100%{margin-top:0;-webkit-transform:scale(1);transform:scale(1);opacity:1}}@keyframes swal2-animate-error-x-mark{0%{margin-top:1.625em;-webkit-transform:scale(.4);transform:scale(.4);opacity:0}50%{margin-top:1.625em;-webkit-transform:scale(.4);transform:scale(.4);opacity:0}80%{margin-top:-.375em;-webkit-transform:scale(1.15);transform:scale(1.15)}100%{margin-top:0;-webkit-transform:scale(1);transform:scale(1);opacity:1}}@-webkit-keyframes swal2-animate-error-icon{0%{-webkit-transform:rotateX(100deg);transform:rotateX(100deg);opacity:0}100%{-webkit-transform:rotateX(0);transform:rotateX(0);opacity:1}}@keyframes swal2-animate-error-icon{0%{-webkit-transform:rotateX(100deg);transform:rotateX(100deg);opacity:0}100%{-webkit-transform:rotateX(0);transform:rotateX(0);opacity:1}}body.swal2-toast-shown .swal2-container{background-color:transparent}body.swal2-toast-shown .swal2-container.swal2-shown{background-color:transparent}body.swal2-toast-shown .swal2-container.swal2-top{top:0;right:auto;bottom:auto;left:50%;-webkit-transform:translateX(-50%);transform:translateX(-50%)}body.swal2-toast-shown .swal2-container.swal2-top-end,body.swal2-toast-shown .swal2-container.swal2-top-right{top:0;right:0;bottom:auto;left:auto}body.swal2-toast-shown .swal2-container.swal2-top-left,body.swal2-toast-shown .swal2-container.swal2-top-start{top:0;right:auto;bottom:auto;left:0}body.swal2-toast-shown .swal2-container.swal2-center-left,body.swal2-toast-shown .swal2-container.swal2-center-start{top:50%;right:auto;bottom:auto;left:0;-webkit-transform:translateY(-50%);transform:translateY(-50%)}body.swal2-toast-shown .swal2-container.swal2-center{top:50%;right:auto;bottom:auto;left:50%;-webkit-transform:translate(-50%,-50%);transform:translate(-50%,-50%)}body.swal2-toast-shown .swal2-container.swal2-center-end,body.swal2-toast-shown .swal2-container.swal2-center-right{top:50%;right:0;bottom:auto;left:auto;-webkit-transform:translateY(-50%);transform:translateY(-50%)}body.swal2-toast-shown .swal2-container.swal2-bottom-left,body.swal2-toast-shown .swal2-container.swal2-bottom-start{top:auto;right:auto;bottom:0;left:0}body.swal2-toast-shown .swal2-container.swal2-bottom{top:auto;right:auto;bottom:0;left:50%;-webkit-transform:translateX(-50%);transform:translateX(-50%)}body.swal2-toast-shown .swal2-container.swal2-bottom-end,body.swal2-toast-shown .swal2-container.swal2-bottom-right{top:auto;right:0;bottom:0;left:auto}body.swal2-toast-column .swal2-toast{flex-direction:column;align-items:stretch}body.swal2-toast-column .swal2-toast .swal2-actions{flex:1;align-self:stretch;height:2.2em;margin-top:.3125em}body.swal2-toast-column .swal2-toast .swal2-loading{justify-content:center}body.swal2-toast-column .swal2-toast .swal2-input{height:2em;margin:.3125em auto;font-size:1em}body.swal2-toast-column .swal2-toast .swal2-validation-message{font-size:1em}.swal2-popup.swal2-toast{flex-direction:row;align-items:center;width:auto;padding:.625em;overflow-y:hidden;box-shadow:0 0 .625em #d9d9d9}.swal2-popup.swal2-toast .swal2-header{flex-direction:row}.swal2-popup.swal2-toast .swal2-title{flex-grow:1;justify-content:flex-start;margin:0 .6em;font-size:1em}.swal2-popup.swal2-toast .swal2-footer{margin:.5em 0 0;padding:.5em 0 0;font-size:.8em}.swal2-popup.swal2-toast .swal2-close{position:static;width:.8em;height:.8em;line-height:.8}.swal2-popup.swal2-toast .swal2-content{justify-content:flex-start;font-size:1em}.swal2-popup.swal2-toast .swal2-icon{width:2em;min-width:2em;height:2em;margin:0}.swal2-popup.swal2-toast .swal2-icon::before{display:flex;align-items:center;font-size:2em;font-weight:700}@media all and (-ms-high-contrast:none),(-ms-high-contrast:active){.swal2-popup.swal2-toast .swal2-icon::before{font-size:.25em}}.swal2-popup.swal2-toast .swal2-icon.swal2-success .swal2-success-ring{width:2em;height:2em}.swal2-popup.swal2-toast .swal2-icon.swal2-error [class^=swal2-x-mark-line]{top:.875em;width:1.375em}.swal2-popup.swal2-toast .swal2-icon.swal2-error [class^=swal2-x-mark-line][class$=left]{left:.3125em}.swal2-popup.swal2-toast .swal2-icon.swal2-error [class^=swal2-x-mark-line][class$=right]{right:.3125em}.swal2-popup.swal2-toast .swal2-actions{flex-basis:auto!important;height:auto;margin:0 .3125em}.swal2-popup.swal2-toast .swal2-styled{margin:0 .3125em;padding:.3125em .625em;font-size:1em}.swal2-popup.swal2-toast .swal2-styled:focus{box-shadow:0 0 0 .0625em #fff,0 0 0 .125em rgba(50,100,150,.4)}.swal2-popup.swal2-toast .swal2-success{border-color:#a5dc86}.swal2-popup.swal2-toast .swal2-success [class^=swal2-success-circular-line]{position:absolute;width:1.6em;height:3em;-webkit-transform:rotate(45deg);transform:rotate(45deg);border-radius:50%}.swal2-popup.swal2-toast .swal2-success [class^=swal2-success-circular-line][class$=left]{top:-.8em;left:-.5em;-webkit-transform:rotate(-45deg);transform:rotate(-45deg);-webkit-transform-origin:2em 2em;transform-origin:2em 2em;border-radius:4em 0 0 4em}.swal2-popup.swal2-toast .swal2-success [class^=swal2-success-circular-line][class$=right]{top:-.25em;left:.9375em;-webkit-transform-origin:0 1.5em;transform-origin:0 1.5em;border-radius:0 4em 4em 0}.swal2-popup.swal2-toast .swal2-success .swal2-success-ring{width:2em;height:2em}.swal2-popup.swal2-toast .swal2-success .swal2-success-fix{top:0;left:.4375em;width:.4375em;height:2.6875em}.swal2-popup.swal2-toast .swal2-success [class^=swal2-success-line]{height:.3125em}.swal2-popup.swal2-toast .swal2-success [class^=swal2-success-line][class$=tip]{top:1.125em;left:.1875em;width:.75em}.swal2-popup.swal2-toast .swal2-success [class^=swal2-success-line][class$=long]{top:.9375em;right:.1875em;width:1.375em}.swal2-popup.swal2-toast.swal2-show{-webkit-animation:swal2-toast-show .5s;animation:swal2-toast-show .5s}.swal2-popup.swal2-toast.swal2-hide{-webkit-animation:swal2-toast-hide .1s forwards;animation:swal2-toast-hide .1s forwards}.swal2-popup.swal2-toast .swal2-animate-success-icon .swal2-success-line-tip{-webkit-animation:swal2-toast-animate-success-line-tip .75s;animation:swal2-toast-animate-success-line-tip .75s}.swal2-popup.swal2-toast .swal2-animate-success-icon .swal2-success-line-long{-webkit-animation:swal2-toast-animate-success-line-long .75s;animation:swal2-toast-animate-success-line-long .75s}@-webkit-keyframes swal2-toast-show{0%{-webkit-transform:translateY(-.625em) rotateZ(2deg);transform:translateY(-.625em) rotateZ(2deg)}33%{-webkit-transform:translateY(0) rotateZ(-2deg);transform:translateY(0) rotateZ(-2deg)}66%{-webkit-transform:translateY(.3125em) rotateZ(2deg);transform:translateY(.3125em) rotateZ(2deg)}100%{-webkit-transform:translateY(0) rotateZ(0);transform:translateY(0) rotateZ(0)}}@keyframes swal2-toast-show{0%{-webkit-transform:translateY(-.625em) rotateZ(2deg);transform:translateY(-.625em) rotateZ(2deg)}33%{-webkit-transform:translateY(0) rotateZ(-2deg);transform:translateY(0) rotateZ(-2deg)}66%{-webkit-transform:translateY(.3125em) rotateZ(2deg);transform:translateY(.3125em) rotateZ(2deg)}100%{-webkit-transform:translateY(0) rotateZ(0);transform:translateY(0) rotateZ(0)}}@-webkit-keyframes swal2-toast-hide{100%{-webkit-transform:rotateZ(1deg);transform:rotateZ(1deg);opacity:0}}@keyframes swal2-toast-hide{100%{-webkit-transform:rotateZ(1deg);transform:rotateZ(1deg);opacity:0}}@-webkit-keyframes swal2-toast-animate-success-line-tip{0%{top:.5625em;left:.0625em;width:0}54%{top:.125em;left:.125em;width:0}70%{top:.625em;left:-.25em;width:1.625em}84%{top:1.0625em;left:.75em;width:.5em}100%{top:1.125em;left:.1875em;width:.75em}}@keyframes swal2-toast-animate-success-line-tip{0%{top:.5625em;left:.0625em;width:0}54%{top:.125em;left:.125em;width:0}70%{top:.625em;left:-.25em;width:1.625em}84%{top:1.0625em;left:.75em;width:.5em}100%{top:1.125em;left:.1875em;width:.75em}}@-webkit-keyframes swal2-toast-animate-success-line-long{0%{top:1.625em;right:1.375em;width:0}65%{top:1.25em;right:.9375em;width:0}84%{top:.9375em;right:0;width:1.125em}100%{top:.9375em;right:.1875em;width:1.375em}}@keyframes swal2-toast-animate-success-line-long{0%{top:1.625em;right:1.375em;width:0}65%{top:1.25em;right:.9375em;width:0}84%{top:.9375em;right:0;width:1.125em}100%{top:.9375em;right:.1875em;width:1.375em}}body.swal2-shown:not(.swal2-no-backdrop):not(.swal2-toast-shown){overflow:hidden}body.swal2-height-auto{height:auto!important}body.swal2-no-backdrop .swal2-shown{top:auto;right:auto;bottom:auto;left:auto;max-width:calc(100% - .625em * 2);background-color:transparent}body.swal2-no-backdrop .swal2-shown>.swal2-modal{box-shadow:0 0 10px rgba(0,0,0,.4)}body.swal2-no-backdrop .swal2-shown.swal2-top{top:0;left:50%;-webkit-transform:translateX(-50%);transform:translateX(-50%)}body.swal2-no-backdrop .swal2-shown.swal2-top-left,body.swal2-no-backdrop .swal2-shown.swal2-top-start{top:0;left:0}body.swal2-no-backdrop .swal2-shown.swal2-top-end,body.swal2-no-backdrop .swal2-shown.swal2-top-right{top:0;right:0}body.swal2-no-backdrop .swal2-shown.swal2-center{top:50%;left:50%;-webkit-transform:translate(-50%,-50%);transform:translate(-50%,-50%)}body.swal2-no-backdrop .swal2-shown.swal2-center-left,body.swal2-no-backdrop .swal2-shown.swal2-center-start{top:50%;left:0;-webkit-transform:translateY(-50%);transform:translateY(-50%)}body.swal2-no-backdrop .swal2-shown.swal2-center-end,body.swal2-no-backdrop .swal2-shown.swal2-center-right{top:50%;right:0;-webkit-transform:translateY(-50%);transform:translateY(-50%)}body.swal2-no-backdrop .swal2-shown.swal2-bottom{bottom:0;left:50%;-webkit-transform:translateX(-50%);transform:translateX(-50%)}body.swal2-no-backdrop .swal2-shown.swal2-bottom-left,body.swal2-no-backdrop .swal2-shown.swal2-bottom-start{bottom:0;left:0}body.swal2-no-backdrop .swal2-shown.swal2-bottom-end,body.swal2-no-backdrop .swal2-shown.swal2-bottom-right{right:0;bottom:0}.swal2-container{display:flex;position:fixed;z-index:1060;top:0;right:0;bottom:0;left:0;flex-direction:row;align-items:center;justify-content:center;padding:.625em;overflow-x:hidden;background-color:transparent;-webkit-overflow-scrolling:touch}.swal2-container.swal2-top{align-items:flex-start}.swal2-container.swal2-top-left,.swal2-container.swal2-top-start{align-items:flex-start;justify-content:flex-start}.swal2-container.swal2-top-end,.swal2-container.swal2-top-right{align-items:flex-start;justify-content:flex-end}.swal2-container.swal2-center{align-items:center}.swal2-container.swal2-center-left,.swal2-container.swal2-center-start{align-items:center;justify-content:flex-start}.swal2-container.swal2-center-end,.swal2-container.swal2-center-right{align-items:center;justify-content:flex-end}.swal2-container.swal2-bottom{align-items:flex-end}.swal2-container.swal2-bottom-left,.swal2-container.swal2-bottom-start{align-items:flex-end;justify-content:flex-start}.swal2-container.swal2-bottom-end,.swal2-container.swal2-bottom-right{align-items:flex-end;justify-content:flex-end}.swal2-container.swal2-bottom-end>:first-child,.swal2-container.swal2-bottom-left>:first-child,.swal2-container.swal2-bottom-right>:first-child,.swal2-container.swal2-bottom-start>:first-child,.swal2-container.swal2-bottom>:first-child{margin-top:auto}.swal2-container.swal2-grow-fullscreen>.swal2-modal{display:flex!important;flex:1;align-self:stretch;justify-content:center}.swal2-container.swal2-grow-row>.swal2-modal{display:flex!important;flex:1;align-content:center;justify-content:center}.swal2-container.swal2-grow-column{flex:1;flex-direction:column}.swal2-container.swal2-grow-column.swal2-bottom,.swal2-container.swal2-grow-column.swal2-center,.swal2-container.swal2-grow-column.swal2-top{align-items:center}.swal2-container.swal2-grow-column.swal2-bottom-left,.swal2-container.swal2-grow-column.swal2-bottom-start,.swal2-container.swal2-grow-column.swal2-center-left,.swal2-container.swal2-grow-column.swal2-center-start,.swal2-container.swal2-grow-column.swal2-top-left,.swal2-container.swal2-grow-column.swal2-top-start{align-items:flex-start}.swal2-container.swal2-grow-column.swal2-bottom-end,.swal2-container.swal2-grow-column.swal2-bottom-right,.swal2-container.swal2-grow-column.swal2-center-end,.swal2-container.swal2-grow-column.swal2-center-right,.swal2-container.swal2-grow-column.swal2-top-end,.swal2-container.swal2-grow-column.swal2-top-right{align-items:flex-end}.swal2-container.swal2-grow-column>.swal2-modal{display:flex!important;flex:1;align-content:center;justify-content:center}.swal2-container:not(.swal2-top):not(.swal2-top-start):not(.swal2-top-end):not(.swal2-top-left):not(.swal2-top-right):not(.swal2-center-start):not(.swal2-center-end):not(.swal2-center-left):not(.swal2-center-right):not(.swal2-bottom):not(.swal2-bottom-start):not(.swal2-bottom-end):not(.swal2-bottom-left):not(.swal2-bottom-right):not(.swal2-grow-fullscreen)>.swal2-modal{margin:auto}@media all and (-ms-high-contrast:none),(-ms-high-contrast:active){.swal2-container .swal2-modal{margin:0!important}}.swal2-container.swal2-fade{transition:background-color .1s}.swal2-container.swal2-shown{background-color:rgba(0,0,0,.4)}.swal2-popup{display:none;position:relative;box-sizing:border-box;flex-direction:column;justify-content:center;width:32em;max-width:100%;padding:1.25em;border:none;border-radius:.3125em;background:#fff;font-family:inherit;font-size:1rem}.swal2-popup:focus{outline:0}.swal2-popup.swal2-loading{overflow-y:hidden}.swal2-header{display:flex;flex-direction:column;align-items:center}.swal2-title{position:relative;max-width:100%;margin:0 0 .4em;padding:0;color:#595959;font-size:1.875em;font-weight:600;text-align:center;text-transform:none;word-wrap:break-word}.swal2-actions{z-index:1;flex-wrap:wrap;align-items:center;justify-content:center;width:100%;margin:1.25em auto 0}.swal2-actions:not(.swal2-loading) .swal2-styled[disabled]{opacity:.4}.swal2-actions:not(.swal2-loading) .swal2-styled:hover{background-image:linear-gradient(rgba(0,0,0,.1),rgba(0,0,0,.1))}.swal2-actions:not(.swal2-loading) .swal2-styled:active{background-image:linear-gradient(rgba(0,0,0,.2),rgba(0,0,0,.2))}.swal2-actions.swal2-loading .swal2-styled.swal2-confirm{box-sizing:border-box;width:2.5em;height:2.5em;margin:.46875em;padding:0;-webkit-animation:swal2-rotate-loading 1.5s linear 0s infinite normal;animation:swal2-rotate-loading 1.5s linear 0s infinite normal;border:.25em solid transparent;border-radius:100%;border-color:transparent;background-color:transparent!important;color:transparent;cursor:default;-webkit-user-select:none;-moz-user-select:none;-ms-user-select:none;user-select:none}.swal2-actions.swal2-loading .swal2-styled.swal2-cancel{margin-right:30px;margin-left:30px}.swal2-actions.swal2-loading :not(.swal2-styled).swal2-confirm::after{content:\"\";display:inline-block;width:15px;height:15px;margin-left:5px;-webkit-animation:swal2-rotate-loading 1.5s linear 0s infinite normal;animation:swal2-rotate-loading 1.5s linear 0s infinite normal;border:3px solid #999;border-radius:50%;border-right-color:transparent;box-shadow:1px 1px 1px #fff}.swal2-styled{margin:.3125em;padding:.625em 2em;box-shadow:none;font-weight:500}.swal2-styled:not([disabled]){cursor:pointer}.swal2-styled.swal2-confirm{border:0;border-radius:.25em;background:initial;background-color:#3085d6;color:#fff;font-size:1.0625em}.swal2-styled.swal2-cancel{border:0;border-radius:.25em;background:initial;background-color:#aaa;color:#fff;font-size:1.0625em}.swal2-styled:focus{outline:0;box-shadow:0 0 0 2px #fff,0 0 0 4px rgba(50,100,150,.4)}.swal2-styled::-moz-focus-inner{border:0}.swal2-footer{justify-content:center;margin:1.25em 0 0;padding:1em 0 0;border-top:1px solid #eee;color:#545454;font-size:1em}.swal2-image{max-width:100%;margin:1.25em auto}.swal2-close{position:absolute;top:0;right:0;justify-content:center;width:1.2em;height:1.2em;padding:0;overflow:hidden;transition:color .1s ease-out;border:none;border-radius:0;outline:initial;background:0 0;color:#ccc;font-family:serif;font-size:2.5em;line-height:1.2;cursor:pointer}.swal2-close:hover{-webkit-transform:none;transform:none;background:0 0;color:#f27474}.swal2-content{z-index:1;justify-content:center;margin:0;padding:0;color:#545454;font-size:1.125em;font-weight:300;line-height:normal;word-wrap:break-word}#swal2-content{text-align:center}.swal2-checkbox,.swal2-file,.swal2-input,.swal2-radio,.swal2-select,.swal2-textarea{margin:1em auto}.swal2-file,.swal2-input,.swal2-textarea{box-sizing:border-box;width:100%;transition:border-color .3s,box-shadow .3s;border:1px solid #d9d9d9;border-radius:.1875em;background:inherit;box-shadow:inset 0 1px 1px rgba(0,0,0,.06);color:inherit;font-size:1.125em}.swal2-file.swal2-inputerror,.swal2-input.swal2-inputerror,.swal2-textarea.swal2-inputerror{border-color:#f27474!important;box-shadow:0 0 2px #f27474!important}.swal2-file:focus,.swal2-input:focus,.swal2-textarea:focus{border:1px solid #b4dbed;outline:0;box-shadow:0 0 3px #c4e6f5}.swal2-file::-webkit-input-placeholder,.swal2-input::-webkit-input-placeholder,.swal2-textarea::-webkit-input-placeholder{color:#ccc}.swal2-file::-moz-placeholder,.swal2-input::-moz-placeholder,.swal2-textarea::-moz-placeholder{color:#ccc}.swal2-file:-ms-input-placeholder,.swal2-input:-ms-input-placeholder,.swal2-textarea:-ms-input-placeholder{color:#ccc}.swal2-file::-ms-input-placeholder,.swal2-input::-ms-input-placeholder,.swal2-textarea::-ms-input-placeholder{color:#ccc}.swal2-file::placeholder,.swal2-input::placeholder,.swal2-textarea::placeholder{color:#ccc}.swal2-range{margin:1em auto;background:inherit}.swal2-range input{width:80%}.swal2-range output{width:20%;color:inherit;font-weight:600;text-align:center}.swal2-range input,.swal2-range output{height:2.625em;padding:0;font-size:1.125em;line-height:2.625em}.swal2-input{height:2.625em;padding:0 .75em}.swal2-input[type=number]{max-width:10em}.swal2-file{background:inherit;font-size:1.125em}.swal2-textarea{height:6.75em;padding:.75em}.swal2-select{min-width:50%;max-width:100%;padding:.375em .625em;background:inherit;color:inherit;font-size:1.125em}.swal2-checkbox,.swal2-radio{align-items:center;justify-content:center;background:inherit;color:inherit}.swal2-checkbox label,.swal2-radio label{margin:0 .6em;font-size:1.125em}.swal2-checkbox input,.swal2-radio input{margin:0 .4em}.swal2-validation-message{display:none;align-items:center;justify-content:center;padding:.625em;overflow:hidden;background:#f0f0f0;color:#666;font-size:1em;font-weight:300}.swal2-validation-message::before{content:\"!\";display:inline-block;width:1.5em;min-width:1.5em;height:1.5em;margin:0 .625em;zoom:normal;border-radius:50%;background-color:#f27474;color:#fff;font-weight:600;line-height:1.5em;text-align:center}@supports (-ms-accelerator:true){.swal2-range input{width:100%!important}.swal2-range output{display:none}}@media all and (-ms-high-contrast:none),(-ms-high-contrast:active){.swal2-range input{width:100%!important}.swal2-range output{display:none}}@-moz-document url-prefix(){.swal2-close:focus{outline:2px solid rgba(50,100,150,.4)}}.swal2-icon{position:relative;box-sizing:content-box;justify-content:center;width:5em;height:5em;margin:1.25em auto 1.875em;zoom:normal;border:.25em solid transparent;border-radius:50%;line-height:5em;cursor:default;-webkit-user-select:none;-moz-user-select:none;-ms-user-select:none;user-select:none}.swal2-icon::before{display:flex;align-items:center;height:92%;font-size:3.75em}.swal2-icon.swal2-error{border-color:#f27474}.swal2-icon.swal2-error .swal2-x-mark{position:relative;flex-grow:1}.swal2-icon.swal2-error [class^=swal2-x-mark-line]{display:block;position:absolute;top:2.3125em;width:2.9375em;height:.3125em;border-radius:.125em;background-color:#f27474}.swal2-icon.swal2-error [class^=swal2-x-mark-line][class$=left]{left:1.0625em;-webkit-transform:rotate(45deg);transform:rotate(45deg)}.swal2-icon.swal2-error [class^=swal2-x-mark-line][class$=right]{right:1em;-webkit-transform:rotate(-45deg);transform:rotate(-45deg)}.swal2-icon.swal2-warning{border-color:#facea8;color:#f8bb86}.swal2-icon.swal2-warning::before{content:\"!\"}.swal2-icon.swal2-info{border-color:#9de0f6;color:#3fc3ee}.swal2-icon.swal2-info::before{content:\"i\"}.swal2-icon.swal2-question{border-color:#c9dae1;color:#87adbd}.swal2-icon.swal2-question::before{content:\"?\"}.swal2-icon.swal2-question.swal2-arabic-question-mark::before{content:\"؟\"}.swal2-icon.swal2-success{border-color:#a5dc86}.swal2-icon.swal2-success [class^=swal2-success-circular-line]{position:absolute;width:3.75em;height:7.5em;-webkit-transform:rotate(45deg);transform:rotate(45deg);border-radius:50%}.swal2-icon.swal2-success [class^=swal2-success-circular-line][class$=left]{top:-.4375em;left:-2.0635em;-webkit-transform:rotate(-45deg);transform:rotate(-45deg);-webkit-transform-origin:3.75em 3.75em;transform-origin:3.75em 3.75em;border-radius:7.5em 0 0 7.5em}.swal2-icon.swal2-success [class^=swal2-success-circular-line][class$=right]{top:-.6875em;left:1.875em;-webkit-transform:rotate(-45deg);transform:rotate(-45deg);-webkit-transform-origin:0 3.75em;transform-origin:0 3.75em;border-radius:0 7.5em 7.5em 0}.swal2-icon.swal2-success .swal2-success-ring{position:absolute;z-index:2;top:-.25em;left:-.25em;box-sizing:content-box;width:100%;height:100%;border:.25em solid rgba(165,220,134,.3);border-radius:50%}.swal2-icon.swal2-success .swal2-success-fix{position:absolute;z-index:1;top:.5em;left:1.625em;width:.4375em;height:5.625em;-webkit-transform:rotate(-45deg);transform:rotate(-45deg)}.swal2-icon.swal2-success [class^=swal2-success-line]{display:block;position:absolute;z-index:2;height:.3125em;border-radius:.125em;background-color:#a5dc86}.swal2-icon.swal2-success [class^=swal2-success-line][class$=tip]{top:2.875em;left:.875em;width:1.5625em;-webkit-transform:rotate(45deg);transform:rotate(45deg)}.swal2-icon.swal2-success [class^=swal2-success-line][class$=long]{top:2.375em;right:.5em;width:2.9375em;-webkit-transform:rotate(-45deg);transform:rotate(-45deg)}.swal2-progress-steps{align-items:center;margin:0 0 1.25em;padding:0;background:inherit;font-weight:600}.swal2-progress-steps li{display:inline-block;position:relative}.swal2-progress-steps .swal2-progress-step{z-index:20;width:2em;height:2em;border-radius:2em;background:#3085d6;color:#fff;line-height:2em;text-align:center}.swal2-progress-steps .swal2-progress-step.swal2-active-progress-step{background:#3085d6}.swal2-progress-steps .swal2-progress-step.swal2-active-progress-step~.swal2-progress-step{background:#add8e6;color:#fff}.swal2-progress-steps .swal2-progress-step.swal2-active-progress-step~.swal2-progress-step-line{background:#add8e6}.swal2-progress-steps .swal2-progress-step-line{z-index:10;width:2.5em;height:.4em;margin:0 -1px;background:#3085d6}[class^=swal2]{-webkit-tap-highlight-color:transparent}.swal2-show{-webkit-animation:swal2-show .3s;animation:swal2-show .3s}.swal2-show.swal2-noanimation{-webkit-animation:none;animation:none}.swal2-hide{-webkit-animation:swal2-hide .15s forwards;animation:swal2-hide .15s forwards}.swal2-hide.swal2-noanimation{-webkit-animation:none;animation:none}.swal2-rtl .swal2-close{right:auto;left:0}.swal2-animate-success-icon .swal2-success-line-tip{-webkit-animation:swal2-animate-success-line-tip .75s;animation:swal2-animate-success-line-tip .75s}.swal2-animate-success-icon .swal2-success-line-long{-webkit-animation:swal2-animate-success-line-long .75s;animation:swal2-animate-success-line-long .75s}.swal2-animate-success-icon .swal2-success-circular-line-right{-webkit-animation:swal2-rotate-success-circular-line 4.25s ease-in;animation:swal2-rotate-success-circular-line 4.25s ease-in}.swal2-animate-error-icon{-webkit-animation:swal2-animate-error-icon .5s;animation:swal2-animate-error-icon .5s}.swal2-animate-error-icon .swal2-x-mark{-webkit-animation:swal2-animate-error-x-mark .5s;animation:swal2-animate-error-x-mark .5s}@-webkit-keyframes swal2-rotate-loading{0%{-webkit-transform:rotate(0);transform:rotate(0)}100%{-webkit-transform:rotate(360deg);transform:rotate(360deg)}}@keyframes swal2-rotate-loading{0%{-webkit-transform:rotate(0);transform:rotate(0)}100%{-webkit-transform:rotate(360deg);transform:rotate(360deg)}}@media print{body.swal2-shown:not(.swal2-no-backdrop):not(.swal2-toast-shown){overflow-y:scroll!important}body.swal2-shown:not(.swal2-no-backdrop):not(.swal2-toast-shown)>[aria-hidden=true]{display:none}body.swal2-shown:not(.swal2-no-backdrop):not(.swal2-toast-shown) .swal2-container{position:static!important}}");
|
assets/library/sweetalert2/sweetalert2.all.min.js
ADDED
@@ -0,0 +1,2 @@
|
|
|
|
|
1 |
+
!function(t,e){"object"==typeof exports&&"undefined"!=typeof module?module.exports=e():"function"==typeof define&&define.amd?define(e):t.Sweetalert2=e()}(this,function(){"use strict";function f(t){return(f="function"==typeof Symbol&&"symbol"==typeof Symbol.iterator?function(t){return typeof t}:function(t){return t&&"function"==typeof Symbol&&t.constructor===Symbol&&t!==Symbol.prototype?"symbol":typeof t})(t)}function o(t,e){if(!(t instanceof e))throw new TypeError("Cannot call a class as a function")}function i(t,e){for(var n=0;n<e.length;n++){var o=e[n];o.enumerable=o.enumerable||!1,o.configurable=!0,"value"in o&&(o.writable=!0),Object.defineProperty(t,o.key,o)}}function r(t,e,n){return e&&i(t.prototype,e),n&&i(t,n),t}function a(){return(a=Object.assign||function(t){for(var e=1;e<arguments.length;e++){var n=arguments[e];for(var o in n)Object.prototype.hasOwnProperty.call(n,o)&&(t[o]=n[o])}return t}).apply(this,arguments)}function s(t){return(s=Object.setPrototypeOf?Object.getPrototypeOf:function(t){return t.__proto__||Object.getPrototypeOf(t)})(t)}function u(t,e){return(u=Object.setPrototypeOf||function(t,e){return t.__proto__=e,t})(t,e)}function c(t,e,n){return(c=function(){if("undefined"==typeof Reflect||!Reflect.construct)return!1;if(Reflect.construct.sham)return!1;if("function"==typeof Proxy)return!0;try{return Date.prototype.toString.call(Reflect.construct(Date,[],function(){})),!0}catch(t){return!1}}()?Reflect.construct:function(t,e,n){var o=[null];o.push.apply(o,e);var i=new(Function.bind.apply(t,o));return n&&u(i,n.prototype),i}).apply(null,arguments)}function l(t,e){return!e||"object"!=typeof e&&"function"!=typeof e?function(t){if(void 0===t)throw new ReferenceError("this hasn't been initialised - super() hasn't been called");return t}(t):e}function d(t,e,n){return(d="undefined"!=typeof Reflect&&Reflect.get?Reflect.get:function(t,e,n){var o=function(t,e){for(;!Object.prototype.hasOwnProperty.call(t,e)&&null!==(t=s(t)););return t}(t,e);if(o){var i=Object.getOwnPropertyDescriptor(o,e);return i.get?i.get.call(n):i.value}})(t,e,n||t)}function p(e){return Object.keys(e).map(function(t){return e[t]})}function m(t){return Array.prototype.slice.call(t)}function g(t){console.error("".concat(e," ").concat(t))}function h(t,e){!function(t){-1===n.indexOf(t)&&(n.push(t),y(t))}('"'.concat(t,'" is deprecated and will be removed in the next major release. Please use "').concat(e,'" instead.'))}function v(t){return t&&Promise.resolve(t)===t}function t(t){var e={};for(var n in t)e[t[n]]="swal2-"+t[n];return e}function b(e,t,n){m(e.classList).forEach(function(t){-1===p(k).indexOf(t)&&-1===p(B).indexOf(t)&&e.classList.remove(t)}),t&&t[n]&&nt(e,t[n])}var e="SweetAlert2:",y=function(t){console.warn("".concat(e," ").concat(t))},n=[],w=function(t){return"function"==typeof t?t():t},C=Object.freeze({cancel:"cancel",backdrop:"backdrop",close:"close",esc:"esc",timer:"timer"}),k=t(["container","shown","height-auto","iosfix","popup","modal","no-backdrop","toast","toast-shown","toast-column","fade","show","hide","noanimation","close","title","header","content","actions","confirm","cancel","footer","icon","image","input","file","range","select","radio","checkbox","label","textarea","inputerror","validation-message","progress-steps","active-progress-step","progress-step","progress-step-line","loading","styled","top","top-start","top-end","top-left","top-right","center","center-start","center-end","center-left","center-right","bottom","bottom-start","bottom-end","bottom-left","bottom-right","grow-row","grow-column","grow-fullscreen","rtl"]),B=t(["success","warning","info","question","error"]),x={previousBodyPadding:null},S=function(t,e){return t.classList.contains(e)};function P(t,e){if(!e)return null;switch(e){case"select":case"textarea":case"file":return it(t,k[e]);case"checkbox":return t.querySelector(".".concat(k.checkbox," input"));case"radio":return t.querySelector(".".concat(k.radio," input:checked"))||t.querySelector(".".concat(k.radio," input:first-child"));case"range":return t.querySelector(".".concat(k.range," input"));default:return it(t,k.input)}}function A(t){if(t.focus(),"file"!==t.type){var e=t.value;t.value="",t.value=e}}function L(t,e,n){t&&e&&("string"==typeof e&&(e=e.split(/\s+/).filter(Boolean)),e.forEach(function(e){t.forEach?t.forEach(function(t){n?t.classList.add(e):t.classList.remove(e)}):n?t.classList.add(e):t.classList.remove(e)}))}function E(t,e,n){n||0===parseInt(n)?t.style[e]="number"==typeof n?n+"px":n:t.style.removeProperty(e)}function T(t,e){var n=1<arguments.length&&void 0!==e?e:"flex";t.style.opacity="",t.style.display=n}function O(t){t.style.opacity="",t.style.display="none"}function M(t,e,n){e?T(t,n):O(t)}function V(t){return!(!t||!(t.offsetWidth||t.offsetHeight||t.getClientRects().length))}function j(t){var e=window.getComputedStyle(t),n=parseFloat(e.getPropertyValue("animation-duration")||"0"),o=parseFloat(e.getPropertyValue("transition-duration")||"0");return 0<n||0<o}function q(){return document.body.querySelector("."+k.container)}function H(t){var e=q();return e?e.querySelector(t):null}function I(t){return H("."+t)}function R(){var t=rt();return m(t.querySelectorAll("."+k.icon))}function N(){var t=R().filter(function(t){return V(t)});return t.length?t[0]:null}function D(){return I(k.title)}function U(){return I(k.content)}function _(){return I(k.image)}function z(){return I(k["progress-steps"])}function W(){return I(k["validation-message"])}function K(){return H("."+k.actions+" ."+k.confirm)}function F(){return H("."+k.actions+" ."+k.cancel)}function Z(){return I(k.actions)}function Q(){return I(k.header)}function Y(){return I(k.footer)}function $(){return I(k.close)}function J(){var t=m(rt().querySelectorAll('[tabindex]:not([tabindex="-1"]):not([tabindex="0"])')).sort(function(t,e){return t=parseInt(t.getAttribute("tabindex")),(e=parseInt(e.getAttribute("tabindex")))<t?1:t<e?-1:0}),e=m(rt().querySelectorAll('a[href], area[href], input:not([disabled]), select:not([disabled]), textarea:not([disabled]), button:not([disabled]), iframe, object, embed, [tabindex="0"], [contenteditable], audio[controls], video[controls]')).filter(function(t){return"-1"!==t.getAttribute("tabindex")});return function(t){for(var e=[],n=0;n<t.length;n++)-1===e.indexOf(t[n])&&e.push(t[n]);return e}(t.concat(e)).filter(function(t){return V(t)})}function X(){return"undefined"==typeof window||"undefined"==typeof document}function G(t){ce.isVisible()&&et!==t.target.value&&ce.resetValidationMessage(),et=t.target.value}function tt(t,e){t instanceof HTMLElement?e.appendChild(t):"object"===f(t)?lt(e,t):t&&(e.innerHTML=t)}var et,nt=function(t,e){L(t,e,!0)},ot=function(t,e){L(t,e,!1)},it=function(t,e){for(var n=0;n<t.childNodes.length;n++)if(S(t.childNodes[n],e))return t.childNodes[n]},rt=function(){return I(k.popup)},at=function(){return!st()&&!document.body.classList.contains(k["no-backdrop"])},st=function(){return document.body.classList.contains(k["toast-shown"])},ut='\n <div aria-labelledby="'.concat(k.title,'" aria-describedby="').concat(k.content,'" class="').concat(k.popup,'" tabindex="-1">\n <div class="').concat(k.header,'">\n <ul class="').concat(k["progress-steps"],'"></ul>\n <div class="').concat(k.icon," ").concat(B.error,'">\n <span class="swal2-x-mark"><span class="swal2-x-mark-line-left"></span><span class="swal2-x-mark-line-right"></span></span>\n </div>\n <div class="').concat(k.icon," ").concat(B.question,'"></div>\n <div class="').concat(k.icon," ").concat(B.warning,'"></div>\n <div class="').concat(k.icon," ").concat(B.info,'"></div>\n <div class="').concat(k.icon," ").concat(B.success,'">\n <div class="swal2-success-circular-line-left"></div>\n <span class="swal2-success-line-tip"></span> <span class="swal2-success-line-long"></span>\n <div class="swal2-success-ring"></div> <div class="swal2-success-fix"></div>\n <div class="swal2-success-circular-line-right"></div>\n </div>\n <img class="').concat(k.image,'" />\n <h2 class="').concat(k.title,'" id="').concat(k.title,'"></h2>\n <button type="button" class="').concat(k.close,'">×</button>\n </div>\n <div class="').concat(k.content,'">\n <div id="').concat(k.content,'"></div>\n <input class="').concat(k.input,'" />\n <input type="file" class="').concat(k.file,'" />\n <div class="').concat(k.range,'">\n <input type="range" />\n <output></output>\n </div>\n <select class="').concat(k.select,'"></select>\n <div class="').concat(k.radio,'"></div>\n <label for="').concat(k.checkbox,'" class="').concat(k.checkbox,'">\n <input type="checkbox" />\n <span class="').concat(k.label,'"></span>\n </label>\n <textarea class="').concat(k.textarea,'"></textarea>\n <div class="').concat(k["validation-message"],'" id="').concat(k["validation-message"],'"></div>\n </div>\n <div class="').concat(k.actions,'">\n <button type="button" class="').concat(k.confirm,'">OK</button>\n <button type="button" class="').concat(k.cancel,'">Cancel</button>\n </div>\n <div class="').concat(k.footer,'">\n </div>\n </div>\n').replace(/(^|\n)\s*/g,""),ct=function(t){if(function(){var t=q();t&&(t.parentNode.removeChild(t),ot([document.documentElement,document.body],[k["no-backdrop"],k["toast-shown"],k["has-column"]]))}(),X())g("SweetAlert2 requires document to initialize");else{var e=document.createElement("div");e.className=k.container,e.innerHTML=ut;var n=function(t){return"string"==typeof t?document.querySelector(t):t}(t.target);n.appendChild(e),function(t){var e=rt();e.setAttribute("role",t.toast?"alert":"dialog"),e.setAttribute("aria-live",t.toast?"polite":"assertive"),t.toast||e.setAttribute("aria-modal","true")}(t),function(t){"rtl"===window.getComputedStyle(t).direction&&nt(q(),k.rtl)}(n),function(){var t=U(),e=it(t,k.input),n=it(t,k.file),o=t.querySelector(".".concat(k.range," input")),i=t.querySelector(".".concat(k.range," output")),r=it(t,k.select),a=t.querySelector(".".concat(k.checkbox," input")),s=it(t,k.textarea);e.oninput=G,n.onchange=G,r.onchange=G,a.onchange=G,s.oninput=G,o.oninput=function(t){G(t),i.value=o.value},o.onchange=function(t){G(t),o.nextSibling.value=o.value}}()}},lt=function(t,e){if(t.innerHTML="",0 in e)for(var n=0;n in e;n++)t.appendChild(e[n].cloneNode(!0));else t.appendChild(e.cloneNode(!0))},dt=function(){if(X())return!1;var t=document.createElement("div"),e={WebkitAnimation:"webkitAnimationEnd",OAnimation:"oAnimationEnd oanimationend",animation:"animationend"};for(var n in e)if(e.hasOwnProperty(n)&&void 0!==t.style[n])return e[n];return!1}();function pt(t,e,n){M(t,n["showC"+e.substring(1)+"Button"],"inline-block"),t.innerHTML=n[e+"ButtonText"],t.setAttribute("aria-label",n[e+"ButtonAriaLabel"]),t.className=k[e],b(t,n.customClass,e+"Button"),nt(t,n[e+"ButtonClass"])}function ft(t,e){var n=Z(),o=K(),i=F();e.showConfirmButton||e.showCancelButton?T(n):O(n),b(n,e.customClass,"actions"),pt(o,"confirm",e),pt(i,"cancel",e),e.buttonsStyling?function(t,e,n){nt([t,e],k.styled),n.confirmButtonColor&&(t.style.backgroundColor=n.confirmButtonColor),n.cancelButtonColor&&(e.style.backgroundColor=n.cancelButtonColor);var o=window.getComputedStyle(t).getPropertyValue("background-color");t.style.borderLeftColor=o,t.style.borderRightColor=o}(o,i,e):(ot([o,i],k.styled),o.style.backgroundColor=o.style.borderLeftColor=o.style.borderRightColor="",i.style.backgroundColor=i.style.borderLeftColor=i.style.borderRightColor="")}function mt(t,e){var n=q();n&&(function(t,e){"string"==typeof e?t.style.background=e:e||nt([document.documentElement,document.body],k["no-backdrop"])}(n,e.backdrop),!e.backdrop&&e.allowOutsideClick&&y('"allowOutsideClick" parameter requires `backdrop` parameter to be set to `true`'),function(t,e){e in k?nt(t,k[e]):(y('The "position" parameter is not valid, defaulting to "center"'),nt(t,k.center))}(n,e.position),function(t,e){if(e&&"string"==typeof e){var n="grow-"+e;n in k&&nt(t,k[n])}}(n,e.grow),b(n,e.customClass,"container"),e.customContainerClass&&nt(n,e.customContainerClass))}function gt(t,e){t.placeholder&&!e.inputPlaceholder||(t.placeholder=e.inputPlaceholder)}var ht={promise:new WeakMap,innerParams:new WeakMap,domCache:new WeakMap},vt=function(t,e){var n=P(U(),t);if(n)for(var o in function(t){for(var e=0;e<t.attributes.length;e++){var n=t.attributes[e].name;-1===["type","value","style"].indexOf(n)&&t.removeAttribute(n)}}(n),e)"range"===t&&"placeholder"===o||n.setAttribute(o,e[o])},bt=function(t,e,n){t.className=e,n.inputClass&&nt(t,n.inputClass),n.customClass&&nt(t,n.customClass.input)},yt={};yt.text=yt.email=yt.password=yt.number=yt.tel=yt.url=function(t){var e=it(U(),k.input);return"string"==typeof t.inputValue||"number"==typeof t.inputValue?e.value=t.inputValue:v(t.inputValue)||y('Unexpected type of inputValue! Expected "string", "number" or "Promise", got "'.concat(f(t.inputValue),'"')),gt(e,t),e.type=t.input,e},yt.file=function(t){var e=it(U(),k.file);return gt(e,t),e.type=t.input,e},yt.range=function(t){var e=it(U(),k.range),n=e.querySelector("input"),o=e.querySelector("output");return n.value=t.inputValue,n.type=t.input,o.value=t.inputValue,e},yt.select=function(t){var e=it(U(),k.select);if(e.innerHTML="",t.inputPlaceholder){var n=document.createElement("option");n.innerHTML=t.inputPlaceholder,n.value="",n.disabled=!0,n.selected=!0,e.appendChild(n)}return e},yt.radio=function(){var t=it(U(),k.radio);return t.innerHTML="",t},yt.checkbox=function(t){var e=it(U(),k.checkbox),n=P(U(),"checkbox");return n.type="checkbox",n.value=1,n.id=k.checkbox,n.checked=Boolean(t.inputValue),e.querySelector("span").innerHTML=t.inputPlaceholder,e},yt.textarea=function(t){var e=it(U(),k.textarea);return e.value=t.inputValue,gt(e,t),e};function wt(t,e){var n=U().querySelector("#"+k.content);e.html?(tt(e.html,n),T(n,"block")):e.text?(n.textContent=e.text,T(n,"block")):O(n),function(t,e){for(var n=ht.innerParams.get(t),o=!n||e.input!==n.input,i=U(),r=["input","file","range","select","radio","checkbox","textarea"],a=0;a<r.length;a++){var s=k[r[a]],u=it(i,s);vt(r[a],e.inputAttributes),bt(u,s,e),o&&O(u)}if(e.input){if(!yt[e.input])return g('Unexpected type of input! Expected "text", "email", "password", "number", "tel", "select", "radio", "checkbox", "textarea", "file" or "url", got "'.concat(e.input,'"'));if(o){var c=yt[e.input](e);T(c)}}}(t,e),b(U(),e.customClass,"content")}function Ct(t,i){var r=z();if(!i.progressSteps||0===i.progressSteps.length)return O(r);T(r),r.innerHTML="";var a=parseInt(null===i.currentProgressStep?ce.getQueueStep():i.currentProgressStep);a>=i.progressSteps.length&&y("Invalid currentProgressStep parameter, it should be less than progressSteps.length (currentProgressStep like JS arrays starts from 0)"),i.progressSteps.forEach(function(t,e){var n=function(t){var e=document.createElement("li");return nt(e,k["progress-step"]),e.innerHTML=t,e}(t);if(r.appendChild(n),e===a&&nt(n,k["active-progress-step"]),e!==i.progressSteps.length-1){var o=function(t){var e=document.createElement("li");return nt(e,k["progress-step-line"]),t.progressStepsDistance&&(e.style.width=t.progressStepsDistance),e}(t);r.appendChild(o)}})}function kt(t,e){var n=Q();b(n,e.customClass,"header"),Ct(0,e),function(t,e){var n=ht.innerParams.get(t);if(n&&e.type===n.type&&N())b(N(),e.customClass,"icon");else if(xt(),e.type)if(St(),-1!==Object.keys(B).indexOf(e.type)){var o=H(".".concat(k.icon,".").concat(B[e.type]));T(o),b(o,e.customClass,"icon"),L(o,"swal2-animate-".concat(e.type,"-icon"),e.animation)}else g('Unknown type! Expected "success", "error", "warning", "info" or "question", got "'.concat(e.type,'"'))}(t,e),function(t,e){var n=_();if(!e.imageUrl)return O(n);T(n),n.setAttribute("src",e.imageUrl),n.setAttribute("alt",e.imageAlt),E(n,"width",e.imageWidth),E(n,"height",e.imageHeight),n.className=k.image,b(n,e.customClass,"image"),e.imageClass&&nt(n,e.imageClass)}(0,e),function(t,e){var n=D();M(n,e.title||e.titleText),e.title&&tt(e.title,n),e.titleText&&(n.innerText=e.titleText),b(n,e.customClass,"title")}(0,e),function(t,e){var n=$();b(n,e.customClass,"closeButton"),M(n,e.showCloseButton),n.setAttribute("aria-label",e.closeButtonAriaLabel)}(0,e)}function Bt(t,e){!function(t,e){var n=rt();E(n,"width",e.width),E(n,"padding",e.padding),e.background&&(n.style.background=e.background),n.className=k.popup,e.toast?(nt([document.documentElement,document.body],k["toast-shown"]),nt(n,k.toast)):nt(n,k.modal),b(n,e.customClass,"popup"),"string"==typeof e.customClass&&nt(n,e.customClass),L(n,k.noanimation,!e.animation)}(0,e),mt(0,e),kt(t,e),wt(t,e),ft(0,e),function(t,e){var n=Y();M(n,e.footer),e.footer&&tt(e.footer,n),b(n,e.customClass,"footer")}(0,e)}var xt=function(){for(var t=R(),e=0;e<t.length;e++)O(t[e])},St=function(){for(var t=rt(),e=window.getComputedStyle(t).getPropertyValue("background-color"),n=t.querySelectorAll("[class^=swal2-success-circular-line], .swal2-success-fix"),o=0;o<n.length;o++)n[o].style.backgroundColor=e};function Pt(){var t=rt();t||ce.fire(""),t=rt();var e=Z(),n=K(),o=F();T(e),T(n),nt([t,e],k.loading),n.disabled=!0,o.disabled=!0,t.setAttribute("data-loading",!0),t.setAttribute("aria-busy",!0),t.focus()}function At(t){return Mt.hasOwnProperty(t)}function Lt(t){return jt[t]}var Et=[],Tt={},Ot=function(){return new Promise(function(t){var e=window.scrollX,n=window.scrollY;Tt.restoreFocusTimeout=setTimeout(function(){Tt.previousActiveElement&&Tt.previousActiveElement.focus?(Tt.previousActiveElement.focus(),Tt.previousActiveElement=null):document.body&&document.body.focus(),t()},100),void 0!==e&&void 0!==n&&window.scrollTo(e,n)})},Mt={title:"",titleText:"",text:"",html:"",footer:"",type:null,toast:!1,customClass:"",customContainerClass:"",target:"body",backdrop:!0,animation:!0,heightAuto:!0,allowOutsideClick:!0,allowEscapeKey:!0,allowEnterKey:!0,stopKeydownPropagation:!0,keydownListenerCapture:!1,showConfirmButton:!0,showCancelButton:!1,preConfirm:null,confirmButtonText:"OK",confirmButtonAriaLabel:"",confirmButtonColor:null,confirmButtonClass:"",cancelButtonText:"Cancel",cancelButtonAriaLabel:"",cancelButtonColor:null,cancelButtonClass:"",buttonsStyling:!0,reverseButtons:!1,focusConfirm:!0,focusCancel:!1,showCloseButton:!1,closeButtonAriaLabel:"Close this dialog",showLoaderOnConfirm:!1,imageUrl:null,imageWidth:null,imageHeight:null,imageAlt:"",imageClass:"",timer:null,width:null,padding:null,background:null,input:null,inputPlaceholder:"",inputValue:"",inputOptions:{},inputAutoTrim:!0,inputClass:"",inputAttributes:{},inputValidator:null,validationMessage:null,grow:!1,position:"center",progressSteps:[],currentProgressStep:null,progressStepsDistance:null,onBeforeOpen:null,onAfterClose:null,onOpen:null,onClose:null,scrollbarPadding:!0},Vt=["title","titleText","text","html","type","customClass","showConfirmButton","showCancelButton","confirmButtonText","confirmButtonAriaLabel","confirmButtonColor","confirmButtonClass","cancelButtonText","cancelButtonAriaLabel","cancelButtonColor","cancelButtonClass","buttonsStyling","reverseButtons","imageUrl","imageWidth","imageHeigth","imageAlt","imageClass","progressSteps","currentProgressStep"],jt={customContainerClass:"customClass",confirmButtonClass:"customClass",cancelButtonClass:"customClass",imageClass:"customClass",inputClass:"customClass"},qt=["allowOutsideClick","allowEnterKey","backdrop","focusConfirm","focusCancel","heightAuto","keydownListenerCapture"],Ht=Object.freeze({isValidParameter:At,isUpdatableParameter:function(t){return-1!==Vt.indexOf(t)},isDeprecatedParameter:Lt,argsToParams:function(n){var o={};switch(f(n[0])){case"object":a(o,n[0]);break;default:["title","html","type"].forEach(function(t,e){switch(f(n[e])){case"string":o[t]=n[e];break;case"undefined":break;default:g("Unexpected type of ".concat(t,'! Expected "string", got ').concat(f(n[e])))}})}return o},isVisible:function(){return V(rt())},clickConfirm:function(){return K()&&K().click()},clickCancel:function(){return F()&&F().click()},getContainer:q,getPopup:rt,getTitle:D,getContent:U,getImage:_,getIcon:N,getIcons:R,getCloseButton:$,getActions:Z,getConfirmButton:K,getCancelButton:F,getHeader:Q,getFooter:Y,getFocusableElements:J,getValidationMessage:W,isLoading:function(){return rt().hasAttribute("data-loading")},fire:function(){for(var t=arguments.length,e=new Array(t),n=0;n<t;n++)e[n]=arguments[n];return c(this,e)},mixin:function(n){return function(t){function e(){return o(this,e),l(this,s(e).apply(this,arguments))}return function(t,e){if("function"!=typeof e&&null!==e)throw new TypeError("Super expression must either be null or a function");t.prototype=Object.create(e&&e.prototype,{constructor:{value:t,writable:!0,configurable:!0}}),e&&u(t,e)}(e,t),r(e,[{key:"_main",value:function(t){return d(s(e.prototype),"_main",this).call(this,a({},n,t))}}]),e}(this)},queue:function(t){var r=this;Et=t;function a(t,e){Et=[],document.body.removeAttribute("data-swal2-queue-step"),t(e)}var s=[];return new Promise(function(i){!function e(n,o){n<Et.length?(document.body.setAttribute("data-swal2-queue-step",n),r.fire(Et[n]).then(function(t){void 0!==t.value?(s.push(t.value),e(n+1,o)):a(i,{dismiss:t.dismiss})})):a(i,{value:s})}(0)})},getQueueStep:function(){return document.body.getAttribute("data-swal2-queue-step")},insertQueueStep:function(t,e){return e&&e<Et.length?Et.splice(e,0,t):Et.push(t)},deleteQueueStep:function(t){void 0!==Et[t]&&Et.splice(t,1)},showLoading:Pt,enableLoading:Pt,getTimerLeft:function(){return Tt.timeout&&Tt.timeout.getTimerLeft()},stopTimer:function(){return Tt.timeout&&Tt.timeout.stop()},resumeTimer:function(){return Tt.timeout&&Tt.timeout.start()},toggleTimer:function(){var t=Tt.timeout;return t&&(t.running?t.stop():t.start())},increaseTimer:function(t){return Tt.timeout&&Tt.timeout.increase(t)},isTimerRunning:function(){return Tt.timeout&&Tt.timeout.isRunning()}});function It(){var t=ht.innerParams.get(this),e=ht.domCache.get(this);t.showConfirmButton||(O(e.confirmButton),t.showCancelButton||O(e.actions)),ot([e.popup,e.actions],k.loading),e.popup.removeAttribute("aria-busy"),e.popup.removeAttribute("data-loading"),e.confirmButton.disabled=!1,e.cancelButton.disabled=!1}function Rt(){null===x.previousBodyPadding&&document.body.scrollHeight>window.innerHeight&&(x.previousBodyPadding=parseInt(window.getComputedStyle(document.body).getPropertyValue("padding-right")),document.body.style.paddingRight=x.previousBodyPadding+function(){if("ontouchstart"in window||navigator.msMaxTouchPoints)return 0;var t=document.createElement("div");t.style.width="50px",t.style.height="50px",t.style.overflow="scroll",document.body.appendChild(t);var e=t.offsetWidth-t.clientWidth;return document.body.removeChild(t),e}()+"px")}function Nt(){return!!window.MSInputMethodContext&&!!document.documentMode}function Dt(){var t=q(),e=rt();t.style.removeProperty("align-items"),e.offsetTop<0&&(t.style.alignItems="flex-start")}var Ut=function(){null!==x.previousBodyPadding&&(document.body.style.paddingRight=x.previousBodyPadding+"px",x.previousBodyPadding=null)},_t=function(){var e,n=q();n.ontouchstart=function(t){e=t.target===n||!function(t){return!!(t.scrollHeight>t.clientHeight)}(n)&&"INPUT"!==t.target.tagName},n.ontouchmove=function(t){e&&(t.preventDefault(),t.stopPropagation())}},zt=function(){if(S(document.body,k.iosfix)){var t=parseInt(document.body.style.top,10);ot(document.body,k.iosfix),document.body.style.top="",document.body.scrollTop=-1*t}},Wt=function(){"undefined"!=typeof window&&Nt()&&window.removeEventListener("resize",Dt)},Kt=function(){m(document.body.children).forEach(function(t){t.hasAttribute("data-previous-aria-hidden")?(t.setAttribute("aria-hidden",t.getAttribute("data-previous-aria-hidden")),t.removeAttribute("data-previous-aria-hidden")):t.removeAttribute("aria-hidden")})},Ft={swalPromiseResolve:new WeakMap};function Zt(t,e,n){e?$t(n):(Ot().then(function(){return $t(n)}),Tt.keydownTarget.removeEventListener("keydown",Tt.keydownHandler,{capture:Tt.keydownListenerCapture}),Tt.keydownHandlerAdded=!1),delete Tt.keydownHandler,delete Tt.keydownTarget,t.parentNode&&t.parentNode.removeChild(t),ot([document.documentElement,document.body],[k.shown,k["height-auto"],k["no-backdrop"],k["toast-shown"],k["toast-column"]]),at()&&(Ut(),zt(),Wt(),Kt())}function Qt(t){var e=q(),n=rt();if(n&&!S(n,k.hide)){var o=ht.innerParams.get(this),i=Ft.swalPromiseResolve.get(this),r=o.onClose,a=o.onAfterClose;ot(n,k.show),nt(n,k.hide),dt&&j(n)?n.addEventListener(dt,function(t){t.target===n&&function(t,e,n,o){S(t,k.hide)&&Zt(e,n,o),Yt(ht),Yt(Ft)}(n,e,st(),a)}):Zt(e,st(),a),null!==r&&"function"==typeof r&&r(n),i(t||{}),delete this.params}}var Yt=function(t){for(var e in t)t[e]=new WeakMap},$t=function(t){null!==t&&"function"==typeof t&&setTimeout(function(){t()})};function Jt(t,e,n){var o=ht.domCache.get(t);e.forEach(function(t){o[t].disabled=n})}function Xt(t,e){if(!t)return!1;if("radio"===t.type)for(var n=t.parentNode.parentNode.querySelectorAll("input"),o=0;o<n.length;o++)n[o].disabled=e;else t.disabled=e}var Gt=function(){function n(t,e){o(this,n),this.callback=t,this.remaining=e,this.running=!1,this.start()}return r(n,[{key:"start",value:function(){return this.running||(this.running=!0,this.started=new Date,this.id=setTimeout(this.callback,this.remaining)),this.remaining}},{key:"stop",value:function(){return this.running&&(this.running=!1,clearTimeout(this.id),this.remaining-=new Date-this.started),this.remaining}},{key:"increase",value:function(t){var e=this.running;return e&&this.stop(),this.remaining+=t,e&&this.start(),this.remaining}},{key:"getTimerLeft",value:function(){return this.running&&(this.stop(),this.start()),this.remaining}},{key:"isRunning",value:function(){return this.running}}]),n}(),te={email:function(t,e){return/^[a-zA-Z0-9.+_-]+@[a-zA-Z0-9.-]+\.[a-zA-Z0-9-]{2,24}$/.test(t)?Promise.resolve():Promise.resolve(e||"Invalid email address")},url:function(t,e){return/^https?:\/\/(www\.)?[-a-zA-Z0-9@:%._+~#=]{2,256}\.[a-z]{2,63}\b([-a-zA-Z0-9@:%_+.~#?&/=]*)$/.test(t)?Promise.resolve():Promise.resolve(e||"Invalid URL")}};function ee(t,e){t.removeEventListener(dt,ee),e.style.overflowY="auto"}function ne(t){var e=q(),n=rt();null!==t.onBeforeOpen&&"function"==typeof t.onBeforeOpen&&t.onBeforeOpen(n),t.animation&&(nt(n,k.show),nt(e,k.fade)),T(n),dt&&j(n)?(e.style.overflowY="hidden",n.addEventListener(dt,ee.bind(null,n,e))):e.style.overflowY="auto",nt([document.documentElement,document.body,e],k.shown),t.heightAuto&&t.backdrop&&!t.toast&&nt([document.documentElement,document.body],k["height-auto"]),at()&&(t.scrollbarPadding&&Rt(),function(){if(/iPad|iPhone|iPod/.test(navigator.userAgent)&&!window.MSStream&&!S(document.body,k.iosfix)){var t=document.body.scrollTop;document.body.style.top=-1*t+"px",nt(document.body,k.iosfix),_t()}}(),"undefined"!=typeof window&&Nt()&&(Dt(),window.addEventListener("resize",Dt)),m(document.body.children).forEach(function(t){t===q()||function(t,e){if("function"==typeof t.contains)return t.contains(e)}(t,q())||(t.hasAttribute("aria-hidden")&&t.setAttribute("data-previous-aria-hidden",t.getAttribute("aria-hidden")),t.setAttribute("aria-hidden","true"))}),setTimeout(function(){e.scrollTop=0})),st()||Tt.previousActiveElement||(Tt.previousActiveElement=document.activeElement),null!==t.onOpen&&"function"==typeof t.onOpen&&setTimeout(function(){t.onOpen(n)})}var oe=void 0,ie={select:function(t,e,i){var r=it(t,k.select);e.forEach(function(t){var e=t[0],n=t[1],o=document.createElement("option");o.value=e,o.innerHTML=n,i.inputValue.toString()===e.toString()&&(o.selected=!0),r.appendChild(o)}),r.focus()},radio:function(t,e,a){var s=it(t,k.radio);e.forEach(function(t){var e=t[0],n=t[1],o=document.createElement("input"),i=document.createElement("label");o.type="radio",o.name=k.radio,o.value=e,a.inputValue.toString()===e.toString()&&(o.checked=!0);var r=document.createElement("span");r.innerHTML=n,r.className=k.label,i.appendChild(o),i.appendChild(r),s.appendChild(i)});var n=s.querySelectorAll("input");n.length&&n[0].focus()}},re=function(e){var n=[];return"undefined"!=typeof Map&&e instanceof Map?e.forEach(function(t,e){n.push([e,t])}):Object.keys(e).forEach(function(t){n.push([t,e[t]])}),n};var ae,se=Object.freeze({hideLoading:It,disableLoading:It,getInput:function(t){var e=ht.innerParams.get(t||this);return P(ht.domCache.get(t||this).content,e.input)},close:Qt,closePopup:Qt,closeModal:Qt,closeToast:Qt,enableButtons:function(){Jt(this,["confirmButton","cancelButton"],!1)},disableButtons:function(){Jt(this,["confirmButton","cancelButton"],!0)},enableConfirmButton:function(){h("Swal.disableConfirmButton()","Swal.getConfirmButton().removeAttribute('disabled')"),Jt(this,["confirmButton"],!1)},disableConfirmButton:function(){h("Swal.enableConfirmButton()","Swal.getConfirmButton().setAttribute('disabled', '')"),Jt(this,["confirmButton"],!0)},enableInput:function(){return Xt(this.getInput(),!1)},disableInput:function(){return Xt(this.getInput(),!0)},showValidationMessage:function(t){var e=ht.domCache.get(this);e.validationMessage.innerHTML=t;var n=window.getComputedStyle(e.popup);e.validationMessage.style.marginLeft="-".concat(n.getPropertyValue("padding-left")),e.validationMessage.style.marginRight="-".concat(n.getPropertyValue("padding-right")),T(e.validationMessage);var o=this.getInput();o&&(o.setAttribute("aria-invalid",!0),o.setAttribute("aria-describedBy",k["validation-message"]),A(o),nt(o,k.inputerror))},resetValidationMessage:function(){var t=ht.domCache.get(this);t.validationMessage&&O(t.validationMessage);var e=this.getInput();e&&(e.removeAttribute("aria-invalid"),e.removeAttribute("aria-describedBy"),ot(e,k.inputerror))},getProgressSteps:function(){return h("Swal.getProgressSteps()","const swalInstance = Swal.fire({progressSteps: ['1', '2', '3']}); const progressSteps = swalInstance.params.progressSteps"),ht.innerParams.get(this).progressSteps},setProgressSteps:function(t){h("Swal.setProgressSteps()","Swal.update()");var e=a({},ht.innerParams.get(this),{progressSteps:t});Ct(0,e),ht.innerParams.set(this,e)},showProgressSteps:function(){var t=ht.domCache.get(this);T(t.progressSteps)},hideProgressSteps:function(){var t=ht.domCache.get(this);O(t.progressSteps)},_main:function(t){var c=this;!function(t){for(var e in t)At(i=e)||y('Unknown parameter "'.concat(i,'"')),t.toast&&(o=e,-1!==qt.indexOf(o)&&y('The parameter "'.concat(o,'" is incompatible with toasts'))),Lt(n=void 0)&&h(n,Lt(n));var n,o,i}(t);var l=a({},Mt,t);!function(e){e.inputValidator||Object.keys(te).forEach(function(t){e.input===t&&(e.inputValidator=te[t])}),e.showLoaderOnConfirm&&!e.preConfirm&&y("showLoaderOnConfirm is set to true, but preConfirm is not defined.\nshowLoaderOnConfirm should be used together with preConfirm, see usage example:\nhttps://sweetalert2.github.io/#ajax-request"),e.animation=w(e.animation),e.target&&("string"!=typeof e.target||document.querySelector(e.target))&&("string"==typeof e.target||e.target.appendChild)||(y('Target parameter is not valid, defaulting to "body"'),e.target="body"),"string"==typeof e.title&&(e.title=e.title.split("\n").join("<br />"));var t=rt(),n="string"==typeof e.target?document.querySelector(e.target):e.target;(!t||t&&n&&t.parentNode!==n.parentNode)&&ct(e)}(l),Object.freeze(l),Tt.timeout&&(Tt.timeout.stop(),delete Tt.timeout),clearTimeout(Tt.restoreFocusTimeout);var d={popup:rt(),container:q(),content:U(),actions:Z(),confirmButton:K(),cancelButton:F(),closeButton:$(),validationMessage:W(),progressSteps:z()};ht.domCache.set(this,d),Bt(this,l),ht.innerParams.set(this,l);var p=this.constructor;return new Promise(function(t){function n(t){c.closePopup({value:t})}function s(t){c.closePopup({dismiss:t})}Ft.swalPromiseResolve.set(c,t),l.timer&&(Tt.timeout=new Gt(function(){s("timer"),delete Tt.timeout},l.timer));l.input&&setTimeout(function(){var t=c.getInput();t&&A(t)},0);for(var u=function(e){(l.showLoaderOnConfirm&&p.showLoading(),l.preConfirm)?(c.resetValidationMessage(),Promise.resolve().then(function(){return l.preConfirm(e,l.validationMessage)}).then(function(t){V(d.validationMessage)||!1===t?c.hideLoading():n(void 0===t?e:t)})):n(e)},e=function(t){var e=t.target,n=d.confirmButton,o=d.cancelButton,i=n&&(n===e||n.contains(e)),r=o&&(o===e||o.contains(e));switch(t.type){case"click":if(i)if(c.disableButtons(),l.input){var a=function(){var t=c.getInput();if(!t)return null;switch(l.input){case"checkbox":return t.checked?1:0;case"radio":return t.checked?t.value:null;case"file":return t.files.length?t.files[0]:null;default:return l.inputAutoTrim?t.value.trim():t.value}}();if(l.inputValidator)c.disableInput(),Promise.resolve().then(function(){return l.inputValidator(a,l.validationMessage)}).then(function(t){c.enableButtons(),c.enableInput(),t?c.showValidationMessage(t):u(a)});else c.getInput().checkValidity()?u(a):(c.enableButtons(),c.showValidationMessage(l.validationMessage))}else u(!0);else r&&(c.disableButtons(),s(p.DismissReason.cancel))}},o=d.popup.querySelectorAll("button"),i=0;i<o.length;i++)o[i].onclick=e,o[i].onmouseover=e,o[i].onmouseout=e,o[i].onmousedown=e;if(d.closeButton.onclick=function(){s(p.DismissReason.close)},l.toast)d.popup.onclick=function(){l.showConfirmButton||l.showCancelButton||l.showCloseButton||l.input||s(p.DismissReason.close)};else{var r=!1;d.popup.onmousedown=function(){d.container.onmouseup=function(t){d.container.onmouseup=void 0,t.target===d.container&&(r=!0)}},d.container.onmousedown=function(){d.popup.onmouseup=function(t){d.popup.onmouseup=void 0,t.target!==d.popup&&!d.popup.contains(t.target)||(r=!0)}},d.container.onclick=function(t){r?r=!1:t.target===d.container&&w(l.allowOutsideClick)&&s(p.DismissReason.backdrop)}}l.reverseButtons?d.confirmButton.parentNode.insertBefore(d.cancelButton,d.confirmButton):d.confirmButton.parentNode.insertBefore(d.confirmButton,d.cancelButton);function a(t,e){for(var n=J(l.focusCancel),o=0;o<n.length;o++)return(t+=e)===n.length?t=0:-1===t&&(t=n.length-1),n[t].focus();d.popup.focus()}Tt.keydownTarget&&Tt.keydownHandlerAdded&&(Tt.keydownTarget.removeEventListener("keydown",Tt.keydownHandler,{capture:Tt.keydownListenerCapture}),Tt.keydownHandlerAdded=!1),l.toast||(Tt.keydownHandler=function(t){return function(t,e){e.stopKeydownPropagation&&t.stopPropagation();if("Enter"!==t.key||t.isComposing)if("Tab"===t.key){for(var n=t.target,o=J(e.focusCancel),i=-1,r=0;r<o.length;r++)if(n===o[r]){i=r;break}t.shiftKey?a(i,-1):a(i,1),t.stopPropagation(),t.preventDefault()}else-1!==["ArrowLeft","ArrowRight","ArrowUp","ArrowDown","Left","Right","Up","Down"].indexOf(t.key)?document.activeElement===d.confirmButton&&V(d.cancelButton)?d.cancelButton.focus():document.activeElement===d.cancelButton&&V(d.confirmButton)&&d.confirmButton.focus():"Escape"!==t.key&&"Esc"!==t.key||!0!==w(e.allowEscapeKey)||(t.preventDefault(),s(p.DismissReason.esc));else if(t.target&&c.getInput()&&t.target.outerHTML===c.getInput().outerHTML){if(-1!==["textarea","file"].indexOf(e.input))return;p.clickConfirm(),t.preventDefault()}}(t,l)},Tt.keydownTarget=l.keydownListenerCapture?window:d.popup,Tt.keydownListenerCapture=l.keydownListenerCapture,Tt.keydownTarget.addEventListener("keydown",Tt.keydownHandler,{capture:Tt.keydownListenerCapture}),Tt.keydownHandlerAdded=!0),c.enableButtons(),c.hideLoading(),c.resetValidationMessage(),l.toast&&(l.input||l.footer||l.showCloseButton)?nt(document.body,k["toast-column"]):ot(document.body,k["toast-column"]),"select"===l.input||"radio"===l.input?function(e,n){function o(t){return ie[n.input](i,re(t),n)}var i=U();v(n.inputOptions)?(Pt(),n.inputOptions.then(function(t){e.hideLoading(),o(t)})):"object"===f(n.inputOptions)?o(n.inputOptions):g("Unexpected type of inputOptions! Expected object, Map or Promise, got ".concat(f(n.inputOptions)))}(c,l):-1!==["text","email","number","tel","textarea"].indexOf(l.input)&&v(l.inputValue)&&function(e,n){var o=e.getInput();O(o),n.inputValue.then(function(t){o.value="number"===n.input?parseFloat(t)||0:t+"",T(o),o.focus(),e.hideLoading()}).catch(function(t){g("Error in inputValue promise: "+t),o.value="",T(o),o.focus(),oe.hideLoading()})}(c,l),ne(l),l.toast||(w(l.allowEnterKey)?l.focusCancel&&V(d.cancelButton)?d.cancelButton.focus():l.focusConfirm&&V(d.confirmButton)?d.confirmButton.focus():a(-1,1):document.activeElement&&"function"==typeof document.activeElement.blur&&document.activeElement.blur()),d.container.scrollTop=0})},update:function(e){var n={};Object.keys(e).forEach(function(t){ce.isUpdatableParameter(t)?n[t]=e[t]:y('Invalid parameter to update: "'.concat(t,'". Updatable params are listed here: https://github.com/sweetalert2/sweetalert2/blob/master/src/utils/params.js'))});var t=a({},ht.innerParams.get(this),n);Bt(this,t),ht.innerParams.set(this,t),Object.defineProperties(this,{params:{value:a({},this.params,e),writable:!1,enumerable:!0}})}});function ue(){if("undefined"!=typeof window){"undefined"==typeof Promise&&g("This package requires a Promise library, please include a shim to enable it in this browser (See: https://github.com/sweetalert2/sweetalert2/wiki/Migration-from-SweetAlert-to-SweetAlert2#1-ie-support)"),ae=this;for(var t=arguments.length,e=new Array(t),n=0;n<t;n++)e[n]=arguments[n];var o=Object.freeze(this.constructor.argsToParams(e));Object.defineProperties(this,{params:{value:o,writable:!1,enumerable:!0,configurable:!0}});var i=this._main(this.params);ht.promise.set(this,i)}}ue.prototype.then=function(t){return ht.promise.get(this).then(t)},ue.prototype.finally=function(t){return ht.promise.get(this).finally(t)},a(ue.prototype,se),a(ue,Ht),Object.keys(se).forEach(function(e){ue[e]=function(){var t;if(ae)return(t=ae)[e].apply(t,arguments)}}),ue.DismissReason=C,ue.version="8.11.8";var ce=ue;return ce.default=ce}),"undefined"!=typeof window&&window.Sweetalert2&&(window.swal=window.sweetAlert=window.Swal=window.SweetAlert=window.Sweetalert2);
|
2 |
+
"undefined"!=typeof document&&function(e,t){var n=e.createElement("style");if(e.getElementsByTagName("head")[0].appendChild(n),n.styleSheet)n.styleSheet.disabled||(n.styleSheet.cssText=t);else try{n.innerHTML=t}catch(e){n.innerText=t}}(document,"@charset \"UTF-8\";@-webkit-keyframes swal2-show{0%{-webkit-transform:scale(.7);transform:scale(.7)}45%{-webkit-transform:scale(1.05);transform:scale(1.05)}80%{-webkit-transform:scale(.95);transform:scale(.95)}100%{-webkit-transform:scale(1);transform:scale(1)}}@keyframes swal2-show{0%{-webkit-transform:scale(.7);transform:scale(.7)}45%{-webkit-transform:scale(1.05);transform:scale(1.05)}80%{-webkit-transform:scale(.95);transform:scale(.95)}100%{-webkit-transform:scale(1);transform:scale(1)}}@-webkit-keyframes swal2-hide{0%{-webkit-transform:scale(1);transform:scale(1);opacity:1}100%{-webkit-transform:scale(.5);transform:scale(.5);opacity:0}}@keyframes swal2-hide{0%{-webkit-transform:scale(1);transform:scale(1);opacity:1}100%{-webkit-transform:scale(.5);transform:scale(.5);opacity:0}}@-webkit-keyframes swal2-animate-success-line-tip{0%{top:1.1875em;left:.0625em;width:0}54%{top:1.0625em;left:.125em;width:0}70%{top:2.1875em;left:-.375em;width:3.125em}84%{top:3em;left:1.3125em;width:1.0625em}100%{top:2.8125em;left:.875em;width:1.5625em}}@keyframes swal2-animate-success-line-tip{0%{top:1.1875em;left:.0625em;width:0}54%{top:1.0625em;left:.125em;width:0}70%{top:2.1875em;left:-.375em;width:3.125em}84%{top:3em;left:1.3125em;width:1.0625em}100%{top:2.8125em;left:.875em;width:1.5625em}}@-webkit-keyframes swal2-animate-success-line-long{0%{top:3.375em;right:2.875em;width:0}65%{top:3.375em;right:2.875em;width:0}84%{top:2.1875em;right:0;width:3.4375em}100%{top:2.375em;right:.5em;width:2.9375em}}@keyframes swal2-animate-success-line-long{0%{top:3.375em;right:2.875em;width:0}65%{top:3.375em;right:2.875em;width:0}84%{top:2.1875em;right:0;width:3.4375em}100%{top:2.375em;right:.5em;width:2.9375em}}@-webkit-keyframes swal2-rotate-success-circular-line{0%{-webkit-transform:rotate(-45deg);transform:rotate(-45deg)}5%{-webkit-transform:rotate(-45deg);transform:rotate(-45deg)}12%{-webkit-transform:rotate(-405deg);transform:rotate(-405deg)}100%{-webkit-transform:rotate(-405deg);transform:rotate(-405deg)}}@keyframes swal2-rotate-success-circular-line{0%{-webkit-transform:rotate(-45deg);transform:rotate(-45deg)}5%{-webkit-transform:rotate(-45deg);transform:rotate(-45deg)}12%{-webkit-transform:rotate(-405deg);transform:rotate(-405deg)}100%{-webkit-transform:rotate(-405deg);transform:rotate(-405deg)}}@-webkit-keyframes swal2-animate-error-x-mark{0%{margin-top:1.625em;-webkit-transform:scale(.4);transform:scale(.4);opacity:0}50%{margin-top:1.625em;-webkit-transform:scale(.4);transform:scale(.4);opacity:0}80%{margin-top:-.375em;-webkit-transform:scale(1.15);transform:scale(1.15)}100%{margin-top:0;-webkit-transform:scale(1);transform:scale(1);opacity:1}}@keyframes swal2-animate-error-x-mark{0%{margin-top:1.625em;-webkit-transform:scale(.4);transform:scale(.4);opacity:0}50%{margin-top:1.625em;-webkit-transform:scale(.4);transform:scale(.4);opacity:0}80%{margin-top:-.375em;-webkit-transform:scale(1.15);transform:scale(1.15)}100%{margin-top:0;-webkit-transform:scale(1);transform:scale(1);opacity:1}}@-webkit-keyframes swal2-animate-error-icon{0%{-webkit-transform:rotateX(100deg);transform:rotateX(100deg);opacity:0}100%{-webkit-transform:rotateX(0);transform:rotateX(0);opacity:1}}@keyframes swal2-animate-error-icon{0%{-webkit-transform:rotateX(100deg);transform:rotateX(100deg);opacity:0}100%{-webkit-transform:rotateX(0);transform:rotateX(0);opacity:1}}body.swal2-toast-shown .swal2-container{background-color:transparent}body.swal2-toast-shown .swal2-container.swal2-shown{background-color:transparent}body.swal2-toast-shown .swal2-container.swal2-top{top:0;right:auto;bottom:auto;left:50%;-webkit-transform:translateX(-50%);transform:translateX(-50%)}body.swal2-toast-shown .swal2-container.swal2-top-end,body.swal2-toast-shown .swal2-container.swal2-top-right{top:0;right:0;bottom:auto;left:auto}body.swal2-toast-shown .swal2-container.swal2-top-left,body.swal2-toast-shown .swal2-container.swal2-top-start{top:0;right:auto;bottom:auto;left:0}body.swal2-toast-shown .swal2-container.swal2-center-left,body.swal2-toast-shown .swal2-container.swal2-center-start{top:50%;right:auto;bottom:auto;left:0;-webkit-transform:translateY(-50%);transform:translateY(-50%)}body.swal2-toast-shown .swal2-container.swal2-center{top:50%;right:auto;bottom:auto;left:50%;-webkit-transform:translate(-50%,-50%);transform:translate(-50%,-50%)}body.swal2-toast-shown .swal2-container.swal2-center-end,body.swal2-toast-shown .swal2-container.swal2-center-right{top:50%;right:0;bottom:auto;left:auto;-webkit-transform:translateY(-50%);transform:translateY(-50%)}body.swal2-toast-shown .swal2-container.swal2-bottom-left,body.swal2-toast-shown .swal2-container.swal2-bottom-start{top:auto;right:auto;bottom:0;left:0}body.swal2-toast-shown .swal2-container.swal2-bottom{top:auto;right:auto;bottom:0;left:50%;-webkit-transform:translateX(-50%);transform:translateX(-50%)}body.swal2-toast-shown .swal2-container.swal2-bottom-end,body.swal2-toast-shown .swal2-container.swal2-bottom-right{top:auto;right:0;bottom:0;left:auto}body.swal2-toast-column .swal2-toast{flex-direction:column;align-items:stretch}body.swal2-toast-column .swal2-toast .swal2-actions{flex:1;align-self:stretch;height:2.2em;margin-top:.3125em}body.swal2-toast-column .swal2-toast .swal2-loading{justify-content:center}body.swal2-toast-column .swal2-toast .swal2-input{height:2em;margin:.3125em auto;font-size:1em}body.swal2-toast-column .swal2-toast .swal2-validation-message{font-size:1em}.swal2-popup.swal2-toast{flex-direction:row;align-items:center;width:auto;padding:.625em;overflow-y:hidden;box-shadow:0 0 .625em #d9d9d9}.swal2-popup.swal2-toast .swal2-header{flex-direction:row}.swal2-popup.swal2-toast .swal2-title{flex-grow:1;justify-content:flex-start;margin:0 .6em;font-size:1em}.swal2-popup.swal2-toast .swal2-footer{margin:.5em 0 0;padding:.5em 0 0;font-size:.8em}.swal2-popup.swal2-toast .swal2-close{position:static;width:.8em;height:.8em;line-height:.8}.swal2-popup.swal2-toast .swal2-content{justify-content:flex-start;font-size:1em}.swal2-popup.swal2-toast .swal2-icon{width:2em;min-width:2em;height:2em;margin:0}.swal2-popup.swal2-toast .swal2-icon::before{display:flex;align-items:center;font-size:2em;font-weight:700}@media all and (-ms-high-contrast:none),(-ms-high-contrast:active){.swal2-popup.swal2-toast .swal2-icon::before{font-size:.25em}}.swal2-popup.swal2-toast .swal2-icon.swal2-success .swal2-success-ring{width:2em;height:2em}.swal2-popup.swal2-toast .swal2-icon.swal2-error [class^=swal2-x-mark-line]{top:.875em;width:1.375em}.swal2-popup.swal2-toast .swal2-icon.swal2-error [class^=swal2-x-mark-line][class$=left]{left:.3125em}.swal2-popup.swal2-toast .swal2-icon.swal2-error [class^=swal2-x-mark-line][class$=right]{right:.3125em}.swal2-popup.swal2-toast .swal2-actions{flex-basis:auto!important;height:auto;margin:0 .3125em}.swal2-popup.swal2-toast .swal2-styled{margin:0 .3125em;padding:.3125em .625em;font-size:1em}.swal2-popup.swal2-toast .swal2-styled:focus{box-shadow:0 0 0 .0625em #fff,0 0 0 .125em rgba(50,100,150,.4)}.swal2-popup.swal2-toast .swal2-success{border-color:#a5dc86}.swal2-popup.swal2-toast .swal2-success [class^=swal2-success-circular-line]{position:absolute;width:1.6em;height:3em;-webkit-transform:rotate(45deg);transform:rotate(45deg);border-radius:50%}.swal2-popup.swal2-toast .swal2-success [class^=swal2-success-circular-line][class$=left]{top:-.8em;left:-.5em;-webkit-transform:rotate(-45deg);transform:rotate(-45deg);-webkit-transform-origin:2em 2em;transform-origin:2em 2em;border-radius:4em 0 0 4em}.swal2-popup.swal2-toast .swal2-success [class^=swal2-success-circular-line][class$=right]{top:-.25em;left:.9375em;-webkit-transform-origin:0 1.5em;transform-origin:0 1.5em;border-radius:0 4em 4em 0}.swal2-popup.swal2-toast .swal2-success .swal2-success-ring{width:2em;height:2em}.swal2-popup.swal2-toast .swal2-success .swal2-success-fix{top:0;left:.4375em;width:.4375em;height:2.6875em}.swal2-popup.swal2-toast .swal2-success [class^=swal2-success-line]{height:.3125em}.swal2-popup.swal2-toast .swal2-success [class^=swal2-success-line][class$=tip]{top:1.125em;left:.1875em;width:.75em}.swal2-popup.swal2-toast .swal2-success [class^=swal2-success-line][class$=long]{top:.9375em;right:.1875em;width:1.375em}.swal2-popup.swal2-toast.swal2-show{-webkit-animation:swal2-toast-show .5s;animation:swal2-toast-show .5s}.swal2-popup.swal2-toast.swal2-hide{-webkit-animation:swal2-toast-hide .1s forwards;animation:swal2-toast-hide .1s forwards}.swal2-popup.swal2-toast .swal2-animate-success-icon .swal2-success-line-tip{-webkit-animation:swal2-toast-animate-success-line-tip .75s;animation:swal2-toast-animate-success-line-tip .75s}.swal2-popup.swal2-toast .swal2-animate-success-icon .swal2-success-line-long{-webkit-animation:swal2-toast-animate-success-line-long .75s;animation:swal2-toast-animate-success-line-long .75s}@-webkit-keyframes swal2-toast-show{0%{-webkit-transform:translateY(-.625em) rotateZ(2deg);transform:translateY(-.625em) rotateZ(2deg)}33%{-webkit-transform:translateY(0) rotateZ(-2deg);transform:translateY(0) rotateZ(-2deg)}66%{-webkit-transform:translateY(.3125em) rotateZ(2deg);transform:translateY(.3125em) rotateZ(2deg)}100%{-webkit-transform:translateY(0) rotateZ(0);transform:translateY(0) rotateZ(0)}}@keyframes swal2-toast-show{0%{-webkit-transform:translateY(-.625em) rotateZ(2deg);transform:translateY(-.625em) rotateZ(2deg)}33%{-webkit-transform:translateY(0) rotateZ(-2deg);transform:translateY(0) rotateZ(-2deg)}66%{-webkit-transform:translateY(.3125em) rotateZ(2deg);transform:translateY(.3125em) rotateZ(2deg)}100%{-webkit-transform:translateY(0) rotateZ(0);transform:translateY(0) rotateZ(0)}}@-webkit-keyframes swal2-toast-hide{100%{-webkit-transform:rotateZ(1deg);transform:rotateZ(1deg);opacity:0}}@keyframes swal2-toast-hide{100%{-webkit-transform:rotateZ(1deg);transform:rotateZ(1deg);opacity:0}}@-webkit-keyframes swal2-toast-animate-success-line-tip{0%{top:.5625em;left:.0625em;width:0}54%{top:.125em;left:.125em;width:0}70%{top:.625em;left:-.25em;width:1.625em}84%{top:1.0625em;left:.75em;width:.5em}100%{top:1.125em;left:.1875em;width:.75em}}@keyframes swal2-toast-animate-success-line-tip{0%{top:.5625em;left:.0625em;width:0}54%{top:.125em;left:.125em;width:0}70%{top:.625em;left:-.25em;width:1.625em}84%{top:1.0625em;left:.75em;width:.5em}100%{top:1.125em;left:.1875em;width:.75em}}@-webkit-keyframes swal2-toast-animate-success-line-long{0%{top:1.625em;right:1.375em;width:0}65%{top:1.25em;right:.9375em;width:0}84%{top:.9375em;right:0;width:1.125em}100%{top:.9375em;right:.1875em;width:1.375em}}@keyframes swal2-toast-animate-success-line-long{0%{top:1.625em;right:1.375em;width:0}65%{top:1.25em;right:.9375em;width:0}84%{top:.9375em;right:0;width:1.125em}100%{top:.9375em;right:.1875em;width:1.375em}}body.swal2-shown:not(.swal2-no-backdrop):not(.swal2-toast-shown){overflow:hidden}body.swal2-height-auto{height:auto!important}body.swal2-no-backdrop .swal2-shown{top:auto;right:auto;bottom:auto;left:auto;max-width:calc(100% - .625em * 2);background-color:transparent}body.swal2-no-backdrop .swal2-shown>.swal2-modal{box-shadow:0 0 10px rgba(0,0,0,.4)}body.swal2-no-backdrop .swal2-shown.swal2-top{top:0;left:50%;-webkit-transform:translateX(-50%);transform:translateX(-50%)}body.swal2-no-backdrop .swal2-shown.swal2-top-left,body.swal2-no-backdrop .swal2-shown.swal2-top-start{top:0;left:0}body.swal2-no-backdrop .swal2-shown.swal2-top-end,body.swal2-no-backdrop .swal2-shown.swal2-top-right{top:0;right:0}body.swal2-no-backdrop .swal2-shown.swal2-center{top:50%;left:50%;-webkit-transform:translate(-50%,-50%);transform:translate(-50%,-50%)}body.swal2-no-backdrop .swal2-shown.swal2-center-left,body.swal2-no-backdrop .swal2-shown.swal2-center-start{top:50%;left:0;-webkit-transform:translateY(-50%);transform:translateY(-50%)}body.swal2-no-backdrop .swal2-shown.swal2-center-end,body.swal2-no-backdrop .swal2-shown.swal2-center-right{top:50%;right:0;-webkit-transform:translateY(-50%);transform:translateY(-50%)}body.swal2-no-backdrop .swal2-shown.swal2-bottom{bottom:0;left:50%;-webkit-transform:translateX(-50%);transform:translateX(-50%)}body.swal2-no-backdrop .swal2-shown.swal2-bottom-left,body.swal2-no-backdrop .swal2-shown.swal2-bottom-start{bottom:0;left:0}body.swal2-no-backdrop .swal2-shown.swal2-bottom-end,body.swal2-no-backdrop .swal2-shown.swal2-bottom-right{right:0;bottom:0}.swal2-container{display:flex;position:fixed;z-index:1060;top:0;right:0;bottom:0;left:0;flex-direction:row;align-items:center;justify-content:center;padding:.625em;overflow-x:hidden;background-color:transparent;-webkit-overflow-scrolling:touch}.swal2-container.swal2-top{align-items:flex-start}.swal2-container.swal2-top-left,.swal2-container.swal2-top-start{align-items:flex-start;justify-content:flex-start}.swal2-container.swal2-top-end,.swal2-container.swal2-top-right{align-items:flex-start;justify-content:flex-end}.swal2-container.swal2-center{align-items:center}.swal2-container.swal2-center-left,.swal2-container.swal2-center-start{align-items:center;justify-content:flex-start}.swal2-container.swal2-center-end,.swal2-container.swal2-center-right{align-items:center;justify-content:flex-end}.swal2-container.swal2-bottom{align-items:flex-end}.swal2-container.swal2-bottom-left,.swal2-container.swal2-bottom-start{align-items:flex-end;justify-content:flex-start}.swal2-container.swal2-bottom-end,.swal2-container.swal2-bottom-right{align-items:flex-end;justify-content:flex-end}.swal2-container.swal2-bottom-end>:first-child,.swal2-container.swal2-bottom-left>:first-child,.swal2-container.swal2-bottom-right>:first-child,.swal2-container.swal2-bottom-start>:first-child,.swal2-container.swal2-bottom>:first-child{margin-top:auto}.swal2-container.swal2-grow-fullscreen>.swal2-modal{display:flex!important;flex:1;align-self:stretch;justify-content:center}.swal2-container.swal2-grow-row>.swal2-modal{display:flex!important;flex:1;align-content:center;justify-content:center}.swal2-container.swal2-grow-column{flex:1;flex-direction:column}.swal2-container.swal2-grow-column.swal2-bottom,.swal2-container.swal2-grow-column.swal2-center,.swal2-container.swal2-grow-column.swal2-top{align-items:center}.swal2-container.swal2-grow-column.swal2-bottom-left,.swal2-container.swal2-grow-column.swal2-bottom-start,.swal2-container.swal2-grow-column.swal2-center-left,.swal2-container.swal2-grow-column.swal2-center-start,.swal2-container.swal2-grow-column.swal2-top-left,.swal2-container.swal2-grow-column.swal2-top-start{align-items:flex-start}.swal2-container.swal2-grow-column.swal2-bottom-end,.swal2-container.swal2-grow-column.swal2-bottom-right,.swal2-container.swal2-grow-column.swal2-center-end,.swal2-container.swal2-grow-column.swal2-center-right,.swal2-container.swal2-grow-column.swal2-top-end,.swal2-container.swal2-grow-column.swal2-top-right{align-items:flex-end}.swal2-container.swal2-grow-column>.swal2-modal{display:flex!important;flex:1;align-content:center;justify-content:center}.swal2-container:not(.swal2-top):not(.swal2-top-start):not(.swal2-top-end):not(.swal2-top-left):not(.swal2-top-right):not(.swal2-center-start):not(.swal2-center-end):not(.swal2-center-left):not(.swal2-center-right):not(.swal2-bottom):not(.swal2-bottom-start):not(.swal2-bottom-end):not(.swal2-bottom-left):not(.swal2-bottom-right):not(.swal2-grow-fullscreen)>.swal2-modal{margin:auto}@media all and (-ms-high-contrast:none),(-ms-high-contrast:active){.swal2-container .swal2-modal{margin:0!important}}.swal2-container.swal2-fade{transition:background-color .1s}.swal2-container.swal2-shown{background-color:rgba(0,0,0,.4)}.swal2-popup{display:none;position:relative;box-sizing:border-box;flex-direction:column;justify-content:center;width:32em;max-width:100%;padding:1.25em;border:none;border-radius:.3125em;background:#fff;font-family:inherit;font-size:1rem}.swal2-popup:focus{outline:0}.swal2-popup.swal2-loading{overflow-y:hidden}.swal2-header{display:flex;flex-direction:column;align-items:center}.swal2-title{position:relative;max-width:100%;margin:0 0 .4em;padding:0;color:#595959;font-size:1.875em;font-weight:600;text-align:center;text-transform:none;word-wrap:break-word}.swal2-actions{z-index:1;flex-wrap:wrap;align-items:center;justify-content:center;width:100%;margin:1.25em auto 0}.swal2-actions:not(.swal2-loading) .swal2-styled[disabled]{opacity:.4}.swal2-actions:not(.swal2-loading) .swal2-styled:hover{background-image:linear-gradient(rgba(0,0,0,.1),rgba(0,0,0,.1))}.swal2-actions:not(.swal2-loading) .swal2-styled:active{background-image:linear-gradient(rgba(0,0,0,.2),rgba(0,0,0,.2))}.swal2-actions.swal2-loading .swal2-styled.swal2-confirm{box-sizing:border-box;width:2.5em;height:2.5em;margin:.46875em;padding:0;-webkit-animation:swal2-rotate-loading 1.5s linear 0s infinite normal;animation:swal2-rotate-loading 1.5s linear 0s infinite normal;border:.25em solid transparent;border-radius:100%;border-color:transparent;background-color:transparent!important;color:transparent;cursor:default;-webkit-user-select:none;-moz-user-select:none;-ms-user-select:none;user-select:none}.swal2-actions.swal2-loading .swal2-styled.swal2-cancel{margin-right:30px;margin-left:30px}.swal2-actions.swal2-loading :not(.swal2-styled).swal2-confirm::after{content:\"\";display:inline-block;width:15px;height:15px;margin-left:5px;-webkit-animation:swal2-rotate-loading 1.5s linear 0s infinite normal;animation:swal2-rotate-loading 1.5s linear 0s infinite normal;border:3px solid #999;border-radius:50%;border-right-color:transparent;box-shadow:1px 1px 1px #fff}.swal2-styled{margin:.3125em;padding:.625em 2em;box-shadow:none;font-weight:500}.swal2-styled:not([disabled]){cursor:pointer}.swal2-styled.swal2-confirm{border:0;border-radius:.25em;background:initial;background-color:#3085d6;color:#fff;font-size:1.0625em}.swal2-styled.swal2-cancel{border:0;border-radius:.25em;background:initial;background-color:#aaa;color:#fff;font-size:1.0625em}.swal2-styled:focus{outline:0;box-shadow:0 0 0 2px #fff,0 0 0 4px rgba(50,100,150,.4)}.swal2-styled::-moz-focus-inner{border:0}.swal2-footer{justify-content:center;margin:1.25em 0 0;padding:1em 0 0;border-top:1px solid #eee;color:#545454;font-size:1em}.swal2-image{max-width:100%;margin:1.25em auto}.swal2-close{position:absolute;top:0;right:0;justify-content:center;width:1.2em;height:1.2em;padding:0;overflow:hidden;transition:color .1s ease-out;border:none;border-radius:0;outline:initial;background:0 0;color:#ccc;font-family:serif;font-size:2.5em;line-height:1.2;cursor:pointer}.swal2-close:hover{-webkit-transform:none;transform:none;background:0 0;color:#f27474}.swal2-content{z-index:1;justify-content:center;margin:0;padding:0;color:#545454;font-size:1.125em;font-weight:300;line-height:normal;word-wrap:break-word}#swal2-content{text-align:center}.swal2-checkbox,.swal2-file,.swal2-input,.swal2-radio,.swal2-select,.swal2-textarea{margin:1em auto}.swal2-file,.swal2-input,.swal2-textarea{box-sizing:border-box;width:100%;transition:border-color .3s,box-shadow .3s;border:1px solid #d9d9d9;border-radius:.1875em;background:inherit;box-shadow:inset 0 1px 1px rgba(0,0,0,.06);color:inherit;font-size:1.125em}.swal2-file.swal2-inputerror,.swal2-input.swal2-inputerror,.swal2-textarea.swal2-inputerror{border-color:#f27474!important;box-shadow:0 0 2px #f27474!important}.swal2-file:focus,.swal2-input:focus,.swal2-textarea:focus{border:1px solid #b4dbed;outline:0;box-shadow:0 0 3px #c4e6f5}.swal2-file::-webkit-input-placeholder,.swal2-input::-webkit-input-placeholder,.swal2-textarea::-webkit-input-placeholder{color:#ccc}.swal2-file::-moz-placeholder,.swal2-input::-moz-placeholder,.swal2-textarea::-moz-placeholder{color:#ccc}.swal2-file:-ms-input-placeholder,.swal2-input:-ms-input-placeholder,.swal2-textarea:-ms-input-placeholder{color:#ccc}.swal2-file::-ms-input-placeholder,.swal2-input::-ms-input-placeholder,.swal2-textarea::-ms-input-placeholder{color:#ccc}.swal2-file::placeholder,.swal2-input::placeholder,.swal2-textarea::placeholder{color:#ccc}.swal2-range{margin:1em auto;background:inherit}.swal2-range input{width:80%}.swal2-range output{width:20%;color:inherit;font-weight:600;text-align:center}.swal2-range input,.swal2-range output{height:2.625em;padding:0;font-size:1.125em;line-height:2.625em}.swal2-input{height:2.625em;padding:0 .75em}.swal2-input[type=number]{max-width:10em}.swal2-file{background:inherit;font-size:1.125em}.swal2-textarea{height:6.75em;padding:.75em}.swal2-select{min-width:50%;max-width:100%;padding:.375em .625em;background:inherit;color:inherit;font-size:1.125em}.swal2-checkbox,.swal2-radio{align-items:center;justify-content:center;background:inherit;color:inherit}.swal2-checkbox label,.swal2-radio label{margin:0 .6em;font-size:1.125em}.swal2-checkbox input,.swal2-radio input{margin:0 .4em}.swal2-validation-message{display:none;align-items:center;justify-content:center;padding:.625em;overflow:hidden;background:#f0f0f0;color:#666;font-size:1em;font-weight:300}.swal2-validation-message::before{content:\"!\";display:inline-block;width:1.5em;min-width:1.5em;height:1.5em;margin:0 .625em;zoom:normal;border-radius:50%;background-color:#f27474;color:#fff;font-weight:600;line-height:1.5em;text-align:center}@supports (-ms-accelerator:true){.swal2-range input{width:100%!important}.swal2-range output{display:none}}@media all and (-ms-high-contrast:none),(-ms-high-contrast:active){.swal2-range input{width:100%!important}.swal2-range output{display:none}}@-moz-document url-prefix(){.swal2-close:focus{outline:2px solid rgba(50,100,150,.4)}}.swal2-icon{position:relative;box-sizing:content-box;justify-content:center;width:5em;height:5em;margin:1.25em auto 1.875em;zoom:normal;border:.25em solid transparent;border-radius:50%;line-height:5em;cursor:default;-webkit-user-select:none;-moz-user-select:none;-ms-user-select:none;user-select:none}.swal2-icon::before{display:flex;align-items:center;height:92%;font-size:3.75em}.swal2-icon.swal2-error{border-color:#f27474}.swal2-icon.swal2-error .swal2-x-mark{position:relative;flex-grow:1}.swal2-icon.swal2-error [class^=swal2-x-mark-line]{display:block;position:absolute;top:2.3125em;width:2.9375em;height:.3125em;border-radius:.125em;background-color:#f27474}.swal2-icon.swal2-error [class^=swal2-x-mark-line][class$=left]{left:1.0625em;-webkit-transform:rotate(45deg);transform:rotate(45deg)}.swal2-icon.swal2-error [class^=swal2-x-mark-line][class$=right]{right:1em;-webkit-transform:rotate(-45deg);transform:rotate(-45deg)}.swal2-icon.swal2-warning{border-color:#facea8;color:#f8bb86}.swal2-icon.swal2-warning::before{content:\"!\"}.swal2-icon.swal2-info{border-color:#9de0f6;color:#3fc3ee}.swal2-icon.swal2-info::before{content:\"i\"}.swal2-icon.swal2-question{border-color:#c9dae1;color:#87adbd}.swal2-icon.swal2-question::before{content:\"?\"}.swal2-icon.swal2-question.swal2-arabic-question-mark::before{content:\"؟\"}.swal2-icon.swal2-success{border-color:#a5dc86}.swal2-icon.swal2-success [class^=swal2-success-circular-line]{position:absolute;width:3.75em;height:7.5em;-webkit-transform:rotate(45deg);transform:rotate(45deg);border-radius:50%}.swal2-icon.swal2-success [class^=swal2-success-circular-line][class$=left]{top:-.4375em;left:-2.0635em;-webkit-transform:rotate(-45deg);transform:rotate(-45deg);-webkit-transform-origin:3.75em 3.75em;transform-origin:3.75em 3.75em;border-radius:7.5em 0 0 7.5em}.swal2-icon.swal2-success [class^=swal2-success-circular-line][class$=right]{top:-.6875em;left:1.875em;-webkit-transform:rotate(-45deg);transform:rotate(-45deg);-webkit-transform-origin:0 3.75em;transform-origin:0 3.75em;border-radius:0 7.5em 7.5em 0}.swal2-icon.swal2-success .swal2-success-ring{position:absolute;z-index:2;top:-.25em;left:-.25em;box-sizing:content-box;width:100%;height:100%;border:.25em solid rgba(165,220,134,.3);border-radius:50%}.swal2-icon.swal2-success .swal2-success-fix{position:absolute;z-index:1;top:.5em;left:1.625em;width:.4375em;height:5.625em;-webkit-transform:rotate(-45deg);transform:rotate(-45deg)}.swal2-icon.swal2-success [class^=swal2-success-line]{display:block;position:absolute;z-index:2;height:.3125em;border-radius:.125em;background-color:#a5dc86}.swal2-icon.swal2-success [class^=swal2-success-line][class$=tip]{top:2.875em;left:.875em;width:1.5625em;-webkit-transform:rotate(45deg);transform:rotate(45deg)}.swal2-icon.swal2-success [class^=swal2-success-line][class$=long]{top:2.375em;right:.5em;width:2.9375em;-webkit-transform:rotate(-45deg);transform:rotate(-45deg)}.swal2-progress-steps{align-items:center;margin:0 0 1.25em;padding:0;background:inherit;font-weight:600}.swal2-progress-steps li{display:inline-block;position:relative}.swal2-progress-steps .swal2-progress-step{z-index:20;width:2em;height:2em;border-radius:2em;background:#3085d6;color:#fff;line-height:2em;text-align:center}.swal2-progress-steps .swal2-progress-step.swal2-active-progress-step{background:#3085d6}.swal2-progress-steps .swal2-progress-step.swal2-active-progress-step~.swal2-progress-step{background:#add8e6;color:#fff}.swal2-progress-steps .swal2-progress-step.swal2-active-progress-step~.swal2-progress-step-line{background:#add8e6}.swal2-progress-steps .swal2-progress-step-line{z-index:10;width:2.5em;height:.4em;margin:0 -1px;background:#3085d6}[class^=swal2]{-webkit-tap-highlight-color:transparent}.swal2-show{-webkit-animation:swal2-show .3s;animation:swal2-show .3s}.swal2-show.swal2-noanimation{-webkit-animation:none;animation:none}.swal2-hide{-webkit-animation:swal2-hide .15s forwards;animation:swal2-hide .15s forwards}.swal2-hide.swal2-noanimation{-webkit-animation:none;animation:none}.swal2-rtl .swal2-close{right:auto;left:0}.swal2-animate-success-icon .swal2-success-line-tip{-webkit-animation:swal2-animate-success-line-tip .75s;animation:swal2-animate-success-line-tip .75s}.swal2-animate-success-icon .swal2-success-line-long{-webkit-animation:swal2-animate-success-line-long .75s;animation:swal2-animate-success-line-long .75s}.swal2-animate-success-icon .swal2-success-circular-line-right{-webkit-animation:swal2-rotate-success-circular-line 4.25s ease-in;animation:swal2-rotate-success-circular-line 4.25s ease-in}.swal2-animate-error-icon{-webkit-animation:swal2-animate-error-icon .5s;animation:swal2-animate-error-icon .5s}.swal2-animate-error-icon .swal2-x-mark{-webkit-animation:swal2-animate-error-x-mark .5s;animation:swal2-animate-error-x-mark .5s}@-webkit-keyframes swal2-rotate-loading{0%{-webkit-transform:rotate(0);transform:rotate(0)}100%{-webkit-transform:rotate(360deg);transform:rotate(360deg)}}@keyframes swal2-rotate-loading{0%{-webkit-transform:rotate(0);transform:rotate(0)}100%{-webkit-transform:rotate(360deg);transform:rotate(360deg)}}@media print{body.swal2-shown:not(.swal2-no-backdrop):not(.swal2-toast-shown){overflow-y:scroll!important}body.swal2-shown:not(.swal2-no-backdrop):not(.swal2-toast-shown)>[aria-hidden=true]{display:none}body.swal2-shown:not(.swal2-no-backdrop):not(.swal2-toast-shown) .swal2-container{position:static!important}}");
|
example.php
ADDED
@@ -0,0 +1,199 @@
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
1 |
+
<?php
|
2 |
+
function prefix_demo_import_lists(){
|
3 |
+
$demo_lists = array(
|
4 |
+
'demo1' =>array(
|
5 |
+
'title' => __( 'Title', 'text-domain' ),/*Title*/
|
6 |
+
'is_premium' => true,/*Premium*/
|
7 |
+
'type' => 'gutentor',/*Optional eg gutentor, elementor or other page builders*/
|
8 |
+
'author' => __( 'Gutentor', 'gutentor' ),/*Author Name*/
|
9 |
+
'keywords' => array( 'about-block', 'about 3' ),/*Search keyword*/
|
10 |
+
'categories' => array( 'about' ),/*Categories*/
|
11 |
+
'template_url' => 'https://github.com/addonspress/advanced-import/blob/master/online-shop-data.zip?raw=true',/*Json file url */
|
12 |
+
'screenshot_url' => '//ts.w.org/wp-content/themes/twentysixteen/screenshot.png?ver=1.6',/*Screenshot of block*/
|
13 |
+
'demo_url' => 'https://www.demo-doamin.com/',/*Demo Url*/
|
14 |
+
/**/
|
15 |
+
'plugins' => array(
|
16 |
+
array(
|
17 |
+
'name' => 'Gutentor',
|
18 |
+
'slug' => 'gutentor',
|
19 |
+
),
|
20 |
+
array(
|
21 |
+
'name' => 'WooCommerce',
|
22 |
+
'slug' => 'woocommerce',
|
23 |
+
),
|
24 |
+
array(
|
25 |
+
'name' => 'YITH WooCommerce Wishlist',
|
26 |
+
'slug' => 'yith-woocommerce-wishlist',
|
27 |
+
'main_file' => 'init.php',
|
28 |
+
),
|
29 |
+
)
|
30 |
+
|
31 |
+
),
|
32 |
+
'demo2' =>array(
|
33 |
+
'title' =>esc_html__('Demo 2', 'text-domain'),
|
34 |
+
'type' => 'elementor',/*Optional eg gutentor, elementor or other page builders*/
|
35 |
+
'categories' => array('medical'),
|
36 |
+
'template_url' => array(
|
37 |
+
'content' => 'https://raw.githubusercontent.com/addonspress/advanced-import/master/content.json',
|
38 |
+
'options' => 'https://raw.githubusercontent.com/addonspress/advanced-import/master/options.json',
|
39 |
+
'widgets' => 'https://raw.githubusercontent.com/addonspress/advanced-import/master/widgets.json'
|
40 |
+
),
|
41 |
+
'screenshot_url' =>'//ts.w.org/wp-content/themes/twentysixteen/screenshot.png?ver=1.6',
|
42 |
+
'demo_url' =>'http://demo.domain.com/demo2/',
|
43 |
+
'plugins' => array(
|
44 |
+
array(
|
45 |
+
'name' => 'Gutentor',
|
46 |
+
'slug' => 'gutentor',
|
47 |
+
),
|
48 |
+
array(
|
49 |
+
'name' => 'WooCommerce',
|
50 |
+
'slug' => 'woocommerce',
|
51 |
+
),
|
52 |
+
array(
|
53 |
+
'name' => 'YITH WooCommerce Wishlist',
|
54 |
+
'slug' => 'yith-woocommerce-wishlist',
|
55 |
+
'main_file' => 'init.php',
|
56 |
+
),
|
57 |
+
)
|
58 |
+
|
59 |
+
),
|
60 |
+
'demo3' =>array(
|
61 |
+
'title' =>esc_html__('Demo 3', 'text-domain'),
|
62 |
+
'type' => 'gutentor',/*Optional eg gutentor, elementor or other page builders*/
|
63 |
+
'categories' => array('education'),
|
64 |
+
'template_url' => get_template_directory().'/index.php',
|
65 |
+
'screenshot_url' =>'//ts.w.org/wp-content/themes/twentyseventeen/screenshot.png?ver=1.6',
|
66 |
+
'demo_url' =>'http://demo.domain.com/medical-circle/'
|
67 |
+
),
|
68 |
+
'demo4' =>array(
|
69 |
+
'title' => __( 'Title', 'text-domain' ),/*Title*/
|
70 |
+
'type' => 'gutentor',/*Optional eg gutentor, elementor or other page builders*/
|
71 |
+
'author' => __( 'Gutentor', 'gutentor' ),/*Author Name*/
|
72 |
+
'keywords' => array( 'about-block', 'about 3' ),/*Search keyword*/
|
73 |
+
'categories' => array( 'about' ),/*Categories*/
|
74 |
+
'template_url' => 'https://github.com/addonspress/advanced-import/blob/master/online-shop-data.zip?raw=true',/*Json file url */
|
75 |
+
'screenshot_url' => '//ts.w.org/wp-content/themes/twentysixteen/screenshot.png?ver=1.6',/*Screenshot of block*/
|
76 |
+
'demo_url' => 'https://www.demo-doamin.com/',/*Demo Url*/
|
77 |
+
/**/
|
78 |
+
'plugins' => array(
|
79 |
+
array(
|
80 |
+
'name' => 'Gutentor',
|
81 |
+
'slug' => 'gutentor',
|
82 |
+
),
|
83 |
+
array(
|
84 |
+
'name' => 'WooCommerce',
|
85 |
+
'slug' => 'woocommerce',
|
86 |
+
),
|
87 |
+
array(
|
88 |
+
'name' => 'YITH WooCommerce Wishlist',
|
89 |
+
'slug' => 'yith-woocommerce-wishlist',
|
90 |
+
'main_file' => 'init.php',
|
91 |
+
),
|
92 |
+
)
|
93 |
+
|
94 |
+
),
|
95 |
+
'demo5' =>array(
|
96 |
+
'title' =>esc_html__('Demo 2', 'text-domain'),
|
97 |
+
'type' => 'elementor',/*Optional eg gutentor, elementor or other page builders*/
|
98 |
+
'categories' => array('medical'),
|
99 |
+
'template_url' => array(
|
100 |
+
'content' => 'https://raw.githubusercontent.com/addonspress/advanced-import/master/content.json',
|
101 |
+
'options' => 'https://raw.githubusercontent.com/addonspress/advanced-import/master/options.json',
|
102 |
+
'widgets' => 'https://raw.githubusercontent.com/addonspress/advanced-import/master/widgets.json'
|
103 |
+
),
|
104 |
+
'screenshot_url' =>'//ts.w.org/wp-content/themes/twentysixteen/screenshot.png?ver=1.6',
|
105 |
+
'demo_url' =>'http://demo.domain.com/demo2/',
|
106 |
+
'plugins' => array(
|
107 |
+
array(
|
108 |
+
'name' => 'Gutentor',
|
109 |
+
'slug' => 'gutentor',
|
110 |
+
),
|
111 |
+
array(
|
112 |
+
'name' => 'WooCommerce',
|
113 |
+
'slug' => 'woocommerce',
|
114 |
+
),
|
115 |
+
array(
|
116 |
+
'name' => 'YITH WooCommerce Wishlist',
|
117 |
+
'slug' => 'yith-woocommerce-wishlist',
|
118 |
+
'main_file' => 'init.php',
|
119 |
+
),
|
120 |
+
)
|
121 |
+
|
122 |
+
),
|
123 |
+
'demo6' =>array(
|
124 |
+
'title' =>esc_html__('Demo 3', 'text-domain'),
|
125 |
+
'type' => 'gutentor',/*Optional eg gutentor, elementor or other page builders*/
|
126 |
+
'categories' => array('education'),
|
127 |
+
'template_url' => get_template_directory().'/index.php',
|
128 |
+
'screenshot_url' =>'//ts.w.org/wp-content/themes/twentyseventeen/screenshot.png?ver=1.6',
|
129 |
+
'demo_url' =>'http://demo.domain.com/medical-circle/'
|
130 |
+
),
|
131 |
+
'demo7' =>array(
|
132 |
+
'title' => __( 'Title', 'text-domain' ),/*Title*/
|
133 |
+
'type' => 'gutentor',/*Optional eg gutentor, elementor or other page builders*/
|
134 |
+
'author' => __( 'Gutentor', 'gutentor' ),/*Author Name*/
|
135 |
+
'keywords' => array( 'about-block', 'about 3' ),/*Search keyword*/
|
136 |
+
'categories' => array( 'about' ),/*Categories*/
|
137 |
+
'template_url' => 'https://github.com/addonspress/advanced-import/blob/master/online-shop-data.zip?raw=true',/*Json file url */
|
138 |
+
'screenshot_url' => '//ts.w.org/wp-content/themes/twentysixteen/screenshot.png?ver=1.6',/*Screenshot of block*/
|
139 |
+
'demo_url' => 'https://www.demo-doamin.com/',/*Demo Url*/
|
140 |
+
/**/
|
141 |
+
'plugins' => array(
|
142 |
+
array(
|
143 |
+
'name' => 'Gutentor',
|
144 |
+
'slug' => 'gutentor',
|
145 |
+
),
|
146 |
+
array(
|
147 |
+
'name' => 'WooCommerce',
|
148 |
+
'slug' => 'woocommerce',
|
149 |
+
),
|
150 |
+
array(
|
151 |
+
'name' => 'YITH WooCommerce Wishlist',
|
152 |
+
'slug' => 'yith-woocommerce-wishlist',
|
153 |
+
'main_file' => 'init.php',
|
154 |
+
),
|
155 |
+
)
|
156 |
+
|
157 |
+
),
|
158 |
+
'demo8' =>array(
|
159 |
+
'title' =>esc_html__('Demo 2', 'text-domain'),
|
160 |
+
'type' => 'elementor',/*Optional eg gutentor, elementor or other page builders*/
|
161 |
+
'categories' => array('medical'),
|
162 |
+
'template_url' => array(
|
163 |
+
'content' => 'https://raw.githubusercontent.com/addonspress/advanced-import/master/content.json',
|
164 |
+
'options' => 'https://raw.githubusercontent.com/addonspress/advanced-import/master/options.json',
|
165 |
+
'widgets' => 'https://raw.githubusercontent.com/addonspress/advanced-import/master/widgets.json'
|
166 |
+
),
|
167 |
+
'screenshot_url' =>'//ts.w.org/wp-content/themes/twentysixteen/screenshot.png?ver=1.6',
|
168 |
+
'demo_url' =>'http://demo.domain.com/demo2/',
|
169 |
+
'plugins' => array(
|
170 |
+
array(
|
171 |
+
'name' => 'Gutentor',
|
172 |
+
'slug' => 'gutentor',
|
173 |
+
),
|
174 |
+
array(
|
175 |
+
'name' => 'WooCommerce',
|
176 |
+
'slug' => 'woocommerce',
|
177 |
+
),
|
178 |
+
array(
|
179 |
+
'name' => 'YITH WooCommerce Wishlist',
|
180 |
+
'slug' => 'yith-woocommerce-wishlist',
|
181 |
+
'main_file' => 'init.php',
|
182 |
+
),
|
183 |
+
)
|
184 |
+
|
185 |
+
),
|
186 |
+
'demo9' =>array(
|
187 |
+
'title' =>esc_html__('Demo 3', 'text-domain'),
|
188 |
+
'is_premium' => true,/*Premium*/
|
189 |
+
'type' => 'gutentor',/*Optional eg gutentor, elementor or other page builders*/
|
190 |
+
'categories' => array('education'),
|
191 |
+
'template_url' => get_template_directory().'/index.php',
|
192 |
+
'screenshot_url' =>'//ts.w.org/wp-content/themes/twentyseventeen/screenshot.png?ver=1.6',
|
193 |
+
'demo_url' =>'http://demo.domain.com/medical-circle/'
|
194 |
+
),
|
195 |
+
|
196 |
+
);
|
197 |
+
return $demo_lists;
|
198 |
+
}
|
199 |
+
add_filter('advanced_import_demo_lists','prefix_demo_import_lists');
|
includes/class-advanced-import-activator.php
ADDED
@@ -0,0 +1,36 @@
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
1 |
+
<?php
|
2 |
+
|
3 |
+
/**
|
4 |
+
* Fired during plugin activation
|
5 |
+
*
|
6 |
+
* @link https://addonspress.com/
|
7 |
+
* @since 1.0.0
|
8 |
+
*
|
9 |
+
* @package Advanced_Import
|
10 |
+
* @subpackage Advanced_Import/includes
|
11 |
+
*/
|
12 |
+
|
13 |
+
/**
|
14 |
+
* Fired during plugin activation.
|
15 |
+
*
|
16 |
+
* This class defines all code necessary to run during the plugin's activation.
|
17 |
+
*
|
18 |
+
* @since 1.0.0
|
19 |
+
* @package Advanced_Import
|
20 |
+
* @subpackage Advanced_Import/includes
|
21 |
+
* @author Addons Press <addonspress.com>
|
22 |
+
*/
|
23 |
+
class Advanced_Import_Activator {
|
24 |
+
|
25 |
+
/**
|
26 |
+
* Short Description. (use period)
|
27 |
+
*
|
28 |
+
* Long Description.
|
29 |
+
*
|
30 |
+
* @since 1.0.0
|
31 |
+
*/
|
32 |
+
public static function activate() {
|
33 |
+
|
34 |
+
}
|
35 |
+
|
36 |
+
}
|
includes/class-advanced-import-deactivator.php
ADDED
@@ -0,0 +1,36 @@
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
1 |
+
<?php
|
2 |
+
|
3 |
+
/**
|
4 |
+
* Fired during plugin deactivation
|
5 |
+
*
|
6 |
+
* @link https://addonspress.com/
|
7 |
+
* @since 1.0.0
|
8 |
+
*
|
9 |
+
* @package Advanced_Import
|
10 |
+
* @subpackage Advanced_Import/includes
|
11 |
+
*/
|
12 |
+
|
13 |
+
/**
|
14 |
+
* Fired during plugin deactivation.
|
15 |
+
*
|
16 |
+
* This class defines all code necessary to run during the plugin's deactivation.
|
17 |
+
*
|
18 |
+
* @since 1.0.0
|
19 |
+
* @package Advanced_Import
|
20 |
+
* @subpackage Advanced_Import/includes
|
21 |
+
* @author Addons Press <addonspress.com>
|
22 |
+
*/
|
23 |
+
class Advanced_Import_Deactivator {
|
24 |
+
|
25 |
+
/**
|
26 |
+
* Short Description. (use period)
|
27 |
+
*
|
28 |
+
* Long Description.
|
29 |
+
*
|
30 |
+
* @since 1.0.0
|
31 |
+
*/
|
32 |
+
public static function deactivate() {
|
33 |
+
|
34 |
+
}
|
35 |
+
|
36 |
+
}
|
includes/class-advanced-import-i18n.php
ADDED
@@ -0,0 +1,44 @@
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
1 |
+
<?php
|
2 |
+
|
3 |
+
/**
|
4 |
+
* Define the internationalization functionality
|
5 |
+
*
|
6 |
+
* Loads and defines the internationalization files for this plugin
|
7 |
+
* so that it is ready for translation.
|
8 |
+
*
|
9 |
+
* @link https://addonspress.com/
|
10 |
+
* @since 1.0.0
|
11 |
+
*
|
12 |
+
* @package Advanced_Import
|
13 |
+
* @subpackage Advanced_Import/includes
|
14 |
+
*/
|
15 |
+
|
16 |
+
/**
|
17 |
+
* Define the internationalization functionality.
|
18 |
+
*
|
19 |
+
* Loads and defines the internationalization files for this plugin
|
20 |
+
* so that it is ready for translation.
|
21 |
+
*
|
22 |
+
* @since 1.0.0
|
23 |
+
* @package Advanced_Import
|
24 |
+
* @subpackage Advanced_Import/includes
|
25 |
+
* @author Addons Press <addonspress.com>
|
26 |
+
*/
|
27 |
+
class Advanced_Import_i18n {
|
28 |
+
|
29 |
+
|
30 |
+
/**
|
31 |
+
* Load the plugin text domain for translation.
|
32 |
+
*
|
33 |
+
* @since 1.0.0
|
34 |
+
*/
|
35 |
+
public function load_plugin_textdomain() {
|
36 |
+
|
37 |
+
load_plugin_textdomain(
|
38 |
+
'advanced-import',
|
39 |
+
false,
|
40 |
+
dirname( dirname( plugin_basename( __FILE__ ) ) ) . '/languages/'
|
41 |
+
);
|
42 |
+
|
43 |
+
}
|
44 |
+
}
|
includes/class-advanced-import-loader.php
ADDED
@@ -0,0 +1,129 @@
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
1 |
+
<?php
|
2 |
+
|
3 |
+
/**
|
4 |
+
* Register all actions and filters for the plugin
|
5 |
+
*
|
6 |
+
* @link https://addonspress.com/
|
7 |
+
* @since 1.0.0
|
8 |
+
*
|
9 |
+
* @package Advanced_Import
|
10 |
+
* @subpackage Advanced_Import/includes
|
11 |
+
*/
|
12 |
+
|
13 |
+
/**
|
14 |
+
* Register all actions and filters for the plugin.
|
15 |
+
*
|
16 |
+
* Maintain a list of all hooks that are registered throughout
|
17 |
+
* the plugin, and register them with the WordPress API. Call the
|
18 |
+
* run function to execute the list of actions and filters.
|
19 |
+
*
|
20 |
+
* @package Advanced_Import
|
21 |
+
* @subpackage Advanced_Import/includes
|
22 |
+
* @author Addons Press <addonspress.com>
|
23 |
+
*/
|
24 |
+
class Advanced_Import_Loader {
|
25 |
+
|
26 |
+
/**
|
27 |
+
* The array of actions registered with WordPress.
|
28 |
+
*
|
29 |
+
* @since 1.0.0
|
30 |
+
* @access protected
|
31 |
+
* @var array $actions The actions registered with WordPress to fire when the plugin loads.
|
32 |
+
*/
|
33 |
+
protected $actions;
|
34 |
+
|
35 |
+
/**
|
36 |
+
* The array of filters registered with WordPress.
|
37 |
+
*
|
38 |
+
* @since 1.0.0
|
39 |
+
* @access protected
|
40 |
+
* @var array $filters The filters registered with WordPress to fire when the plugin loads.
|
41 |
+
*/
|
42 |
+
protected $filters;
|
43 |
+
|
44 |
+
/**
|
45 |
+
* Initialize the collections used to maintain the actions and filters.
|
46 |
+
*
|
47 |
+
* @since 1.0.0
|
48 |
+
*/
|
49 |
+
public function __construct() {
|
50 |
+
|
51 |
+
$this->actions = array();
|
52 |
+
$this->filters = array();
|
53 |
+
|
54 |
+
}
|
55 |
+
|
56 |
+
/**
|
57 |
+
* Add a new action to the collection to be registered with WordPress.
|
58 |
+
*
|
59 |
+
* @since 1.0.0
|
60 |
+
* @param string $hook The name of the WordPress action that is being registered.
|
61 |
+
* @param object $component A reference to the instance of the object on which the action is defined.
|
62 |
+
* @param string $callback The name of the function definition on the $component.
|
63 |
+
* @param int $priority Optional. The priority at which the function should be fired. Default is 10.
|
64 |
+
* @param int $accepted_args Optional. The number of arguments that should be passed to the $callback. Default is 1.
|
65 |
+
*/
|
66 |
+
public function add_action( $hook, $component, $callback, $priority = 10, $accepted_args = 1 ) {
|
67 |
+
$this->actions = $this->add( $this->actions, $hook, $component, $callback, $priority, $accepted_args );
|
68 |
+
}
|
69 |
+
|
70 |
+
/**
|
71 |
+
* Add a new filter to the collection to be registered with WordPress.
|
72 |
+
*
|
73 |
+
* @since 1.0.0
|
74 |
+
* @param string $hook The name of the WordPress filter that is being registered.
|
75 |
+
* @param object $component A reference to the instance of the object on which the filter is defined.
|
76 |
+
* @param string $callback The name of the function definition on the $component.
|
77 |
+
* @param int $priority Optional. The priority at which the function should be fired. Default is 10.
|
78 |
+
* @param int $accepted_args Optional. The number of arguments that should be passed to the $callback. Default is 1
|
79 |
+
*/
|
80 |
+
public function add_filter( $hook, $component, $callback, $priority = 10, $accepted_args = 1 ) {
|
81 |
+
$this->filters = $this->add( $this->filters, $hook, $component, $callback, $priority, $accepted_args );
|
82 |
+
}
|
83 |
+
|
84 |
+
/**
|
85 |
+
* A utility function that is used to register the actions and hooks into a single
|
86 |
+
* collection.
|
87 |
+
*
|
88 |
+
* @since 1.0.0
|
89 |
+
* @access private
|
90 |
+
* @param array $hooks The collection of hooks that is being registered (that is, actions or filters).
|
91 |
+
* @param string $hook The name of the WordPress filter that is being registered.
|
92 |
+
* @param object $component A reference to the instance of the object on which the filter is defined.
|
93 |
+
* @param string $callback The name of the function definition on the $component.
|
94 |
+
* @param int $priority The priority at which the function should be fired.
|
95 |
+
* @param int $accepted_args The number of arguments that should be passed to the $callback.
|
96 |
+
* @return array The collection of actions and filters registered with WordPress.
|
97 |
+
*/
|
98 |
+
private function add( $hooks, $hook, $component, $callback, $priority, $accepted_args ) {
|
99 |
+
|
100 |
+
$hooks[] = array(
|
101 |
+
'hook' => $hook,
|
102 |
+
'component' => $component,
|
103 |
+
'callback' => $callback,
|
104 |
+
'priority' => $priority,
|
105 |
+
'accepted_args' => $accepted_args
|
106 |
+
);
|
107 |
+
|
108 |
+
return $hooks;
|
109 |
+
|
110 |
+
}
|
111 |
+
|
112 |
+
/**
|
113 |
+
* Register the filters and actions with WordPress.
|
114 |
+
*
|
115 |
+
* @since 1.0.0
|
116 |
+
*/
|
117 |
+
public function run() {
|
118 |
+
|
119 |
+
foreach ( $this->filters as $hook ) {
|
120 |
+
add_filter( $hook['hook'], array( $hook['component'], $hook['callback'] ), $hook['priority'], $hook['accepted_args'] );
|
121 |
+
}
|
122 |
+
|
123 |
+
foreach ( $this->actions as $hook ) {
|
124 |
+
add_action( $hook['hook'], array( $hook['component'], $hook['callback'] ), $hook['priority'], $hook['accepted_args'] );
|
125 |
+
}
|
126 |
+
|
127 |
+
}
|
128 |
+
|
129 |
+
}
|
includes/class-advanced-import.php
ADDED
@@ -0,0 +1,286 @@
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
1 |
+
<?php
|
2 |
+
|
3 |
+
/**
|
4 |
+
* The file that defines the core plugin class
|
5 |
+
*
|
6 |
+
* A class definition that includes attributes and functions used across both the
|
7 |
+
* public-facing side of the site and the admin area.
|
8 |
+
*
|
9 |
+
* @link https://addonspress.com/
|
10 |
+
* @since 1.0.0
|
11 |
+
*
|
12 |
+
* @package Advanced_Import
|
13 |
+
* @subpackage Advanced_Import/includes
|
14 |
+
*/
|
15 |
+
|
16 |
+
/**
|
17 |
+
* The core plugin class.
|
18 |
+
*
|
19 |
+
* This is used to define internationalization, admin-specific hooks, and
|
20 |
+
* public-facing site hooks.
|
21 |
+
*
|
22 |
+
* Also maintains the unique identifier of this plugin as well as the current
|
23 |
+
* version of the plugin.
|
24 |
+
*
|
25 |
+
* @since 1.0.0
|
26 |
+
* @package Advanced_Import
|
27 |
+
* @subpackage Advanced_Import/includes
|
28 |
+
* @author Addons Press <addonspress.com>
|
29 |
+
*/
|
30 |
+
class Advanced_Import {
|
31 |
+
|
32 |
+
/**
|
33 |
+
* The loader that's responsible for maintaining and registering all hooks that power
|
34 |
+
* the plugin.
|
35 |
+
*
|
36 |
+
* @since 1.0.0
|
37 |
+
* @access protected
|
38 |
+
* @var Advanced_Import_Loader $loader Maintains and registers all hooks for the plugin.
|
39 |
+
*/
|
40 |
+
protected $loader;
|
41 |
+
|
42 |
+
/**
|
43 |
+
* The unique identifier of this plugin.
|
44 |
+
*
|
45 |
+
* @since 1.0.0
|
46 |
+
* @access protected
|
47 |
+
* @var string $plugin_name The string used to uniquely identify this plugin.
|
48 |
+
*/
|
49 |
+
protected $plugin_name;
|
50 |
+
|
51 |
+
/**
|
52 |
+
* The current version of the plugin.
|
53 |
+
*
|
54 |
+
* @since 1.0.0
|
55 |
+
* @access protected
|
56 |
+
* @var string $version The current version of the plugin.
|
57 |
+
*/
|
58 |
+
protected $version;
|
59 |
+
|
60 |
+
/**
|
61 |
+
* The admin class object of the plugin.
|
62 |
+
*
|
63 |
+
* @since 1.0.0
|
64 |
+
* @access public
|
65 |
+
* @var object Advanced_Import_Admin $admin
|
66 |
+
*/
|
67 |
+
public $admin;
|
68 |
+
|
69 |
+
/**
|
70 |
+
* The language object of the plugin.
|
71 |
+
*
|
72 |
+
* @since 1.0.0
|
73 |
+
* @access public
|
74 |
+
* @var object Advanced_Import_i18n $plugin_i18n
|
75 |
+
*/
|
76 |
+
public $plugin_i18n;
|
77 |
+
|
78 |
+
/**
|
79 |
+
* Main Advanced_Import Instance
|
80 |
+
*
|
81 |
+
* Insures that only one instance of Advanced_Import exists in memory at any one
|
82 |
+
* time. Also prevents needing to define globals all over the place.
|
83 |
+
*
|
84 |
+
* @since 1.0.0
|
85 |
+
* @access public
|
86 |
+
*
|
87 |
+
* @uses Advanced_Import::setup_globals() Setup the globals needed
|
88 |
+
* @uses Advanced_Import::load_dependencies() Include the required files
|
89 |
+
* @uses Advanced_Import::set_locale() Setup language
|
90 |
+
* @uses Advanced_Import::define_admin_hooks() Setup admin hooks and actions
|
91 |
+
* @uses Advanced_Import::run() run
|
92 |
+
* @return object
|
93 |
+
*/
|
94 |
+
public static function instance() {
|
95 |
+
|
96 |
+
// Store the instance locally to avoid private static replication
|
97 |
+
static $instance = null;
|
98 |
+
|
99 |
+
// Only run these methods if they haven't been ran previously
|
100 |
+
if ( null === $instance ) {
|
101 |
+
$instance = new Advanced_Import;
|
102 |
+
|
103 |
+
$instance->setup_globals();
|
104 |
+
$instance->load_dependencies();
|
105 |
+
$instance->set_locale();
|
106 |
+
$instance->define_admin_hooks();
|
107 |
+
$instance->run();
|
108 |
+
}
|
109 |
+
|
110 |
+
// Always return the instance
|
111 |
+
return $instance;
|
112 |
+
}
|
113 |
+
|
114 |
+
/**
|
115 |
+
* Empty construct
|
116 |
+
*
|
117 |
+
* @since 1.0.0
|
118 |
+
*/
|
119 |
+
public function __construct() { }
|
120 |
+
/**
|
121 |
+
* Define the locale for this plugin for internationalization.
|
122 |
+
*
|
123 |
+
* Uses the Advanced_Import_i18n class in order to set the domain and to register the hook
|
124 |
+
* with WordPress.
|
125 |
+
*
|
126 |
+
* @since 1.0.0
|
127 |
+
* @access private
|
128 |
+
*/
|
129 |
+
private function setup_globals() {
|
130 |
+
|
131 |
+
$this->version = defined('ADVANCED_IMPORT_VERSION')?ADVANCED_IMPORT_VERSION:'1.0.0';
|
132 |
+
$this->plugin_name = ADVANCED_IMPORT_PLUGIN_NAME;
|
133 |
+
|
134 |
+
//The array of actions and filters registered with this plugins.
|
135 |
+
$this->actions = array();
|
136 |
+
$this->filters = array();
|
137 |
+
|
138 |
+
// Misc
|
139 |
+
$this->domain = 'advanced-import'; // Unique identifier for retrieving translated strings
|
140 |
+
$this->errors = new WP_Error(); // errors
|
141 |
+
}
|
142 |
+
|
143 |
+
/**
|
144 |
+
* Load the required dependencies for this plugin.
|
145 |
+
*
|
146 |
+
* Include the following files that make up the plugin:
|
147 |
+
*
|
148 |
+
* - Advanced_Import_Loader. Orchestrates the hooks of the plugin.
|
149 |
+
* - Advanced_Import_i18n. Defines internationalization functionality.
|
150 |
+
* - Advanced_Import_Admin. Defines all hooks for the admin area.
|
151 |
+
* - Advanced_Import_Public. Defines all hooks for the public side of the site.
|
152 |
+
*
|
153 |
+
* Create an instance of the loader which will be used to register the hooks
|
154 |
+
* with WordPress.
|
155 |
+
*
|
156 |
+
* @since 1.0.0
|
157 |
+
* @access private
|
158 |
+
*/
|
159 |
+
private function load_dependencies() {
|
160 |
+
|
161 |
+
/**
|
162 |
+
* The class responsible for orchestrating the actions and filters of the
|
163 |
+
* core plugin.
|
164 |
+
*/
|
165 |
+
require_once ADVANCED_IMPORT_PATH . 'includes/class-advanced-import-loader.php';
|
166 |
+
|
167 |
+
/**
|
168 |
+
* The class responsible for defining internationalization functionality
|
169 |
+
* of the plugin.
|
170 |
+
*/
|
171 |
+
require_once ADVANCED_IMPORT_PATH . 'includes/class-advanced-import-i18n.php';
|
172 |
+
|
173 |
+
/**
|
174 |
+
* The class responsible for defining common functions
|
175 |
+
* of the plugin.
|
176 |
+
*/
|
177 |
+
require_once ADVANCED_IMPORT_PATH . 'includes/functions-advanced-import.php';
|
178 |
+
|
179 |
+
/**
|
180 |
+
* The class responsible for defining all actions that occur in the admin area.
|
181 |
+
*/
|
182 |
+
require_once ADVANCED_IMPORT_PATH . 'admin/class-advanced-import-admin.php';
|
183 |
+
|
184 |
+
/**
|
185 |
+
* The class responsible for WordPress rset
|
186 |
+
*/
|
187 |
+
require_once ADVANCED_IMPORT_PATH . 'admin/class-reset.php';
|
188 |
+
|
189 |
+
$this->loader = new Advanced_Import_Loader();
|
190 |
+
|
191 |
+
}
|
192 |
+
|
193 |
+
/**
|
194 |
+
* Define the locale for this plugin for internationalization.
|
195 |
+
*
|
196 |
+
* Uses the Advanced_Import_i18n class in order to set the domain and to register the hook
|
197 |
+
* with WordPress.
|
198 |
+
*
|
199 |
+
* @since 1.0.0
|
200 |
+
* @access private
|
201 |
+
*/
|
202 |
+
private function set_locale() {
|
203 |
+
|
204 |
+
$this->plugin_i18n = new Advanced_Import_i18n();
|
205 |
+
|
206 |
+
$this->loader->add_action( 'plugins_loaded', $this->plugin_i18n, 'load_plugin_textdomain' );
|
207 |
+
|
208 |
+
}
|
209 |
+
|
210 |
+
/**
|
211 |
+
* Register all of the hooks related to the admin area functionality
|
212 |
+
* of the plugin.
|
213 |
+
*
|
214 |
+
* @since 1.0.0
|
215 |
+
* @access private
|
216 |
+
*/
|
217 |
+
private function define_admin_hooks() {
|
218 |
+
|
219 |
+
$this->admin = advanced_import_admin();
|
220 |
+
|
221 |
+
$this->loader->add_action( 'admin_enqueue_scripts', $this->admin, 'enqueue_styles' );
|
222 |
+
$this->loader->add_action( 'admin_enqueue_scripts', $this->admin, 'enqueue_scripts' );
|
223 |
+
|
224 |
+
/*add mime types*/
|
225 |
+
$this->loader->add_action( 'mime_types', $this->admin, 'mime_types' );
|
226 |
+
|
227 |
+
/*add menu*/
|
228 |
+
$this->loader->add_action( 'admin_menu', $this->admin, 'import_menu' );
|
229 |
+
$this->loader->add_action( 'current_screen', $this->admin, 'help_tabs' );
|
230 |
+
|
231 |
+
/*ajax process*/
|
232 |
+
$this->loader->add_action( 'wp_ajax_advanced_import_ajax_setup', $this->admin, 'upload_zip' );
|
233 |
+
$this->loader->add_action( 'wp_ajax_demo_download_and_unzip', $this->admin, 'demo_download_and_unzip' );
|
234 |
+
$this->loader->add_action( 'wp_ajax_plugin_screen', $this->admin, 'plugin_screen' );
|
235 |
+
$this->loader->add_action( 'wp_ajax_install_plugin', $this->admin, 'install_plugin' );
|
236 |
+
$this->loader->add_action( 'wp_ajax_content_screen', $this->admin, 'content_screen' );
|
237 |
+
$this->loader->add_action( 'wp_ajax_import_content', $this->admin, 'import_content' );
|
238 |
+
$this->loader->add_action( 'wp_ajax_complete_screen', $this->admin, 'complete_screen' );
|
239 |
+
|
240 |
+
/*Reset Process*/
|
241 |
+
$this->loader->add_action( 'wp_loaded', advanced_import_reset_wordpress(), 'hide_reset_notice',-1 );
|
242 |
+
$this->loader->add_action( 'admin_init', advanced_import_reset_wordpress(), 'reset_wizard_actions', -1 );
|
243 |
+
$this->loader->add_action( 'admin_notices', advanced_import_reset_wordpress(), 'reset_wizard_notice' ,-1);
|
244 |
+
|
245 |
+
}
|
246 |
+
|
247 |
+
/**
|
248 |
+
* Run the loader to execute all of the hooks with WordPress.
|
249 |
+
*
|
250 |
+
* @since 1.0.0
|
251 |
+
*/
|
252 |
+
public function run() {
|
253 |
+
$this->loader->run();
|
254 |
+
}
|
255 |
+
|
256 |
+
/**
|
257 |
+
* The name of the plugin used to uniquely identify it within the context of
|
258 |
+
* WordPress and to define internationalization functionality.
|
259 |
+
*
|
260 |
+
* @since 1.0.0
|
261 |
+
* @return string The name of the plugin.
|
262 |
+
*/
|
263 |
+
public function get_plugin_name() {
|
264 |
+
return $this->plugin_name;
|
265 |
+
}
|
266 |
+
|
267 |
+
/**
|
268 |
+
* The reference to the class that orchestrates the hooks with the plugin.
|
269 |
+
*
|
270 |
+
* @since 1.0.0
|
271 |
+
* @return Advanced_Import_Loader Orchestrates the hooks of the plugin.
|
272 |
+
*/
|
273 |
+
public function get_loader() {
|
274 |
+
return $this->loader;
|
275 |
+
}
|
276 |
+
|
277 |
+
/**
|
278 |
+
* Retrieve the version number of the plugin.
|
279 |
+
*
|
280 |
+
* @since 1.0.0
|
281 |
+
* @return string The version number of the plugin.
|
282 |
+
*/
|
283 |
+
public function get_version() {
|
284 |
+
return $this->version;
|
285 |
+
}
|
286 |
+
}
|
includes/functions-advanced-import.php
ADDED
@@ -0,0 +1,12 @@
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
1 |
+
<?php
|
2 |
+
function advanced_import_allowed_html ( $input ) {
|
3 |
+
$allowed_html = wp_kses_allowed_html('post');
|
4 |
+
$output = wp_kses($input, $allowed_html );
|
5 |
+
return $output;
|
6 |
+
}
|
7 |
+
|
8 |
+
function advanced_import_current_url () {
|
9 |
+
global $pagenow;
|
10 |
+
$current_url = $pagenow == 'tools.php'?admin_url( 'tools.php?page=advanced-import-tool'):admin_url( 'themes.php?page=advanced-import');
|
11 |
+
return $current_url;
|
12 |
+
}
|
includes/index.php
ADDED
@@ -0,0 +1 @@
|
|
|
1 |
+
<?php // Silence is golden
|
index.php
ADDED
@@ -0,0 +1 @@
|
|
|
1 |
+
<?php // Silence is golden
|
languages/advanced-import.pot
ADDED
File without changes
|
readme.txt
ADDED
@@ -0,0 +1,71 @@
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
1 |
+
=== Advanced Import : One Click Import for WordPress or Theme Demo Data ===
|
2 |
+
|
3 |
+
Contributors: addonspress
|
4 |
+
Donate link: https://addonspress.com/
|
5 |
+
Tags: import, advanced import, demo import, theme import, widget import, customizer import
|
6 |
+
Requires at least: 4.5
|
7 |
+
Tested up to: 5.2.3
|
8 |
+
Requires PHP: 5.6.20
|
9 |
+
Stable tag: 1.0.2
|
10 |
+
License: GPLv2 or later
|
11 |
+
License URI: http://www.gnu.org/licenses/gpl-2.0.html
|
12 |
+
|
13 |
+
Advanced Import is very flexible plugin which convenient user to import site data( posts, page, media and even widget and customizer option ).
|
14 |
+
|
15 |
+
== Description ==
|
16 |
+
|
17 |
+
Import Data or Demo Content which is exported by [Advanced Export](https://wordpress.org/plugins/advanced-export/)
|
18 |
+
|
19 |
+
Advanced Import is one of the best and powerful data importer plugin. It has number of features which make more manageable and convenient to WordPress user to import their WordPress site data from another website.
|
20 |
+
|
21 |
+
It is designed specially for theme developer who want to provide demo data to their customer but it can be also use for migration purpose too.
|
22 |
+
|
23 |
+
Some listed features of Advanced Import are given below :
|
24 |
+
|
25 |
+
* Import widget
|
26 |
+
* Import option
|
27 |
+
* Import media,
|
28 |
+
* Import pages,
|
29 |
+
* Import post
|
30 |
+
* Import custom post type
|
31 |
+
* Import actual media files
|
32 |
+
|
33 |
+
== Dashboard Location ==
|
34 |
+
|
35 |
+
= Theme Demo Import Screen =
|
36 |
+
|
37 |
+
Dashboard -> Appearance -> Demo Import
|
38 |
+
|
39 |
+
= Zip File Import Screen =
|
40 |
+
|
41 |
+
Dashboard -> Tool -> Advanced Import
|
42 |
+
|
43 |
+
== Installation ==
|
44 |
+
There are two ways to install any Advanced Import Plugin:-
|
45 |
+
1.Upload zip file from Dashboard->Plugin->Add New "upload plugin".
|
46 |
+
2.Exact Advanced Import and placed it to the "/wp-content/plugins/" directory.
|
47 |
+
- Activate the plugin through the "Plugins" menu in WordPress.
|
48 |
+
|
49 |
+
|
50 |
+
== Frequently Asked Questions ==
|
51 |
+
|
52 |
+
= Is Advanced Import is free plugin ? =
|
53 |
+
|
54 |
+
Yes, it is free plugin.
|
55 |
+
|
56 |
+
= Why my demo zip file is not importing ? =
|
57 |
+
|
58 |
+
Please make sure it is exported using [Advanced Export](https://wordpress.org/plugins/advanced-export/) plugin
|
59 |
+
|
60 |
+
== Changelog ==
|
61 |
+
|
62 |
+
= 1.0.2 - 2019-09-29 =
|
63 |
+
* Update : Some Information
|
64 |
+
* Fixed : Multisite warning
|
65 |
+
|
66 |
+
= 1.0.1 - 2019-09-26 =
|
67 |
+
* Fixed : Tools => Advanced Import
|
68 |
+
* Fixed : Minor Changes
|
69 |
+
|
70 |
+
= 1.0.0 =
|
71 |
+
* Initial release.
|
uninstall.php
ADDED
@@ -0,0 +1,25 @@
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
1 |
+
<?php
|
2 |
+
|
3 |
+
/**
|
4 |
+
* Fired when the plugin is uninstalled.
|
5 |
+
*
|
6 |
+
* When populating this file, consider the following flow
|
7 |
+
* of control:
|
8 |
+
*
|
9 |
+
* - This method should be static
|
10 |
+
* - Check if the $_REQUEST content actually is the plugin name
|
11 |
+
* - Run an admin referrer check to make sure it goes through authentication
|
12 |
+
* - Verify the output of $_GET makes sense
|
13 |
+
* - Repeat with other user roles. Best directly by using the links/query string parameters.
|
14 |
+
* - Repeat things for multisite. Once for a single site in the network, once sitewide.
|
15 |
+
*
|
16 |
+
* @link https://addonspress.com/
|
17 |
+
* @since 1.0.0
|
18 |
+
*
|
19 |
+
* @package Advanced_Import
|
20 |
+
*/
|
21 |
+
|
22 |
+
// If uninstall not called from WordPress, then exit.
|
23 |
+
if ( ! defined( 'WP_UNINSTALL_PLUGIN' ) ) {
|
24 |
+
exit;
|
25 |
+
}
|