WooCommerce Checkout Manager - Version 4.3.1

Version Description

  • Notice: Plugin ownership change
  • Fix: Admin redirect after options reset
Download this release

Release Info

Developer quadlayers
Plugin Icon 128x128 WooCommerce Checkout Manager
Version 4.3.1
Comparing to
See all releases

Code changes from version 4.3 to 4.3.1

Files changed (86) hide show
  1. LICENSE.txt +0 -339
  2. assets/img/logo.jpg +0 -0
  3. includes/admin.php +1844 -1934
  4. includes/export.php +937 -960
  5. includes/pickers/di18n/jquery-ui-i18n.js +0 -1646
  6. includes/pickers/di18n/jquery.ui.datepicker-af.js +0 -23
  7. includes/pickers/di18n/jquery.ui.datepicker-ar-DZ.js +0 -23
  8. includes/pickers/di18n/jquery.ui.datepicker-ar.js +0 -23
  9. includes/pickers/di18n/jquery.ui.datepicker-az.js +0 -23
  10. includes/pickers/di18n/jquery.ui.datepicker-bg.js +0 -24
  11. includes/pickers/di18n/jquery.ui.datepicker-bs.js +0 -23
  12. includes/pickers/di18n/jquery.ui.datepicker-ca.js +0 -23
  13. includes/pickers/di18n/jquery.ui.datepicker-cs.js +0 -23
  14. includes/pickers/di18n/jquery.ui.datepicker-cy-GB.js +0 -23
  15. includes/pickers/di18n/jquery.ui.datepicker-da.js +0 -23
  16. includes/pickers/di18n/jquery.ui.datepicker-de.js +0 -23
  17. includes/pickers/di18n/jquery.ui.datepicker-el.js +0 -23
  18. includes/pickers/di18n/jquery.ui.datepicker-en-AU.js +0 -23
  19. includes/pickers/di18n/jquery.ui.datepicker-en-GB.js +0 -23
  20. includes/pickers/di18n/jquery.ui.datepicker-en-NZ.js +0 -23
  21. includes/pickers/di18n/jquery.ui.datepicker-eo.js +0 -23
  22. includes/pickers/di18n/jquery.ui.datepicker-es.js +0 -23
  23. includes/pickers/di18n/jquery.ui.datepicker-et.js +0 -23
  24. includes/pickers/di18n/jquery.ui.datepicker-eu.js +0 -23
  25. includes/pickers/di18n/jquery.ui.datepicker-fa.js +0 -59
  26. includes/pickers/di18n/jquery.ui.datepicker-fi.js +0 -23
  27. includes/pickers/di18n/jquery.ui.datepicker-fo.js +0 -23
  28. includes/pickers/di18n/jquery.ui.datepicker-fr-CH.js +0 -23
  29. includes/pickers/di18n/jquery.ui.datepicker-fr.js +0 -25
  30. includes/pickers/di18n/jquery.ui.datepicker-gl.js +0 -23
  31. includes/pickers/di18n/jquery.ui.datepicker-he.js +0 -23
  32. includes/pickers/di18n/jquery.ui.datepicker-hi.js +0 -23
  33. includes/pickers/di18n/jquery.ui.datepicker-hr.js +0 -23
  34. includes/pickers/di18n/jquery.ui.datepicker-hu.js +0 -23
  35. includes/pickers/di18n/jquery.ui.datepicker-hy.js +0 -23
  36. includes/pickers/di18n/jquery.ui.datepicker-id.js +0 -23
  37. includes/pickers/di18n/jquery.ui.datepicker-is.js +0 -23
  38. includes/pickers/di18n/jquery.ui.datepicker-it.js +0 -23
  39. includes/pickers/di18n/jquery.ui.datepicker-ja.js +0 -23
  40. includes/pickers/di18n/jquery.ui.datepicker-ka.js +0 -21
  41. includes/pickers/di18n/jquery.ui.datepicker-kk.js +0 -23
  42. includes/pickers/di18n/jquery.ui.datepicker-km.js +0 -23
  43. includes/pickers/di18n/jquery.ui.datepicker-ko.js +0 -23
  44. includes/pickers/di18n/jquery.ui.datepicker-lb.js +0 -23
  45. includes/pickers/di18n/jquery.ui.datepicker-lt.js +0 -23
  46. includes/pickers/di18n/jquery.ui.datepicker-lv.js +0 -23
  47. includes/pickers/di18n/jquery.ui.datepicker-mk.js +0 -23
  48. includes/pickers/di18n/jquery.ui.datepicker-ml.js +0 -23
  49. includes/pickers/di18n/jquery.ui.datepicker-ms.js +0 -23
  50. includes/pickers/di18n/jquery.ui.datepicker-nl-BE.js +0 -23
  51. includes/pickers/di18n/jquery.ui.datepicker-nl.js +0 -23
  52. includes/pickers/di18n/jquery.ui.datepicker-no.js +0 -23
  53. includes/pickers/di18n/jquery.ui.datepicker-pl.js +0 -23
  54. includes/pickers/di18n/jquery.ui.datepicker-pt-BR.js +0 -23
  55. includes/pickers/di18n/jquery.ui.datepicker-pt.js +0 -22
  56. includes/pickers/di18n/jquery.ui.datepicker-rm.js +0 -21
  57. includes/pickers/di18n/jquery.ui.datepicker-ro.js +0 -26
  58. includes/pickers/di18n/jquery.ui.datepicker-ru.js +0 -23
  59. includes/pickers/di18n/jquery.ui.datepicker-sk.js +0 -23
  60. includes/pickers/di18n/jquery.ui.datepicker-sl.js +0 -24
  61. includes/pickers/di18n/jquery.ui.datepicker-sq.js +0 -23
  62. includes/pickers/di18n/jquery.ui.datepicker-sr-SR.js +0 -23
  63. includes/pickers/di18n/jquery.ui.datepicker-sr.js +0 -23
  64. includes/pickers/di18n/jquery.ui.datepicker-sv.js +0 -23
  65. includes/pickers/di18n/jquery.ui.datepicker-ta.js +0 -23
  66. includes/pickers/di18n/jquery.ui.datepicker-th.js +0 -23
  67. includes/pickers/di18n/jquery.ui.datepicker-tj.js +0 -23
  68. includes/pickers/di18n/jquery.ui.datepicker-tr.js +0 -23
  69. includes/pickers/di18n/jquery.ui.datepicker-uk.js +0 -24
  70. includes/pickers/di18n/jquery.ui.datepicker-vi.js +0 -23
  71. includes/pickers/di18n/jquery.ui.datepicker-zh-CN.js +0 -23
  72. includes/pickers/di18n/jquery.ui.datepicker-zh-HK.js +0 -23
  73. includes/pickers/di18n/jquery.ui.datepicker-zh-TW.js +0 -23
  74. includes/pickers/i18n/{jquery.ui.timepicker-pt-BR.js → jquery.ui.timepicker-pt.js} +0 -0
  75. includes/pickers/jquery.ui.css +0 -1225
  76. includes/templates/admin/woocheckout-additional.php +3 -3
  77. includes/templates/admin/woocheckout-billing.php +3 -3
  78. includes/templates/admin/woocheckout-general-switches.php +2 -5
  79. includes/templates/admin/woocheckout-general.php +7 -7
  80. includes/templates/admin/woocheckout-shipping.php +3 -3
  81. includes/templates/functions/add_wooccmupload.php +1 -1
  82. includes/templates/functions/billing_wooccmupload.php +1 -1
  83. includes/templates/functions/shipping_wooccmupload.php +1 -1
  84. includes/templates/functions/{woocm_editing_wrapper.php → wooccm_editing_wrapper.php} +0 -0
  85. readme.txt +11 -7
  86. woocommerce-checkout-manager.php +326 -238
LICENSE.txt DELETED
@@ -1,339 +0,0 @@
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.
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
assets/img/logo.jpg ADDED
Binary file
includes/admin.php CHANGED
@@ -1,1955 +1,1862 @@
1
  <?php
2
- if( is_admin() ) {
3
-
4
- // backend scripts
5
- add_action( 'admin_enqueue_scripts', 'wooccm_admin_enqueue_scripts' );
6
- // List of action links on the Plugins screen
7
- add_filter( sprintf( 'plugin_action_links_%s', WOOCCM_RELPATH ), 'wooccm_admin_plugin_actions' );
8
- // WordPress Settings screen for WooCheckout
9
- add_action( 'admin_init', 'wooccm_register_settings' );
10
- // WP Admin Actions
11
- add_action( 'admin_init', 'wooccm_admin_actions' );
12
- add_action( 'admin_init', 'wooccm_admin_woocheckout_actions' );
13
- // Updater notice
14
- add_action( 'admin_notices', 'wooccm_admin_notices' );
15
- // Add fields to the Edit Order screen
16
- add_action( 'woocommerce_admin_order_data_after_order_details', 'wooccm_admin_edit_order_additional_details' );
17
- add_action( 'woocommerce_admin_order_data_after_billing_address', 'wooccm_admin_edit_order_billing_details' );
18
- add_action( 'woocommerce_admin_order_data_after_shipping_address', 'wooccm_admin_edit_order_shipping_details' );
19
-
20
  }
21
 
22
  // Display admin notice on screen load
23
- function wooccm_admin_notice( $message = '', $priority = 'updated', $screen = '' ) {
24
-
25
- if( $priority == false || $priority == '' )
26
- $priority = 'updated';
27
- if( $message <> '' ) {
28
- ob_start();
29
- wooccm_admin_notice_html( $message, $priority, $screen );
30
- $output = ob_get_contents();
31
- ob_end_clean();
32
- // Check if an existing notice is already in queue
33
- $existing_notice = get_transient( WOOCCM_PREFIX . '_notice' );
34
- if( $existing_notice !== false ) {
35
- $existing_notice = base64_decode( $existing_notice );
36
- $output = $existing_notice . $output;
37
- }
38
- set_transient( WOOCCM_PREFIX . '_notice', base64_encode( $output ), MINUTE_IN_SECONDS );
39
- add_action( 'admin_notices', WOOCCM_PREFIX . '_admin_notice_print' );
40
- }
41
-
42
  }
43
 
44
  // HTML template for admin notice
45
- function wooccm_admin_notice_html( $message = '', $priority = 'updated', $screen = '' ) {
46
-
47
- // Display admin notice on specific screen
48
- if( !empty( $screen ) ) {
49
-
50
- global $pagenow;
51
-
52
- if( is_array( $screen ) ) {
53
- if( in_array( $pagenow, $screen ) == false )
54
- return;
55
- } else {
56
- if( $pagenow <> $screen )
57
- return;
58
- }
59
-
60
- } ?>
61
- <div id="message" class="<?php echo $priority; ?>">
62
- <p><?php echo $message; ?></p>
63
- </div>
64
- <?php
65
-
66
  }
67
 
68
  // Grabs the WordPress transient that holds the admin notice and prints it
69
  function wooccm_admin_notice_print() {
70
 
71
- $output = get_transient( WOOCCM_PREFIX . '_notice' );
72
- if( $output !== false ) {
73
- delete_transient( WOOCCM_PREFIX . '_notice' );
74
- $output = base64_decode( $output );
75
- echo $output;
76
- }
77
-
78
  }
79
 
80
  // WordPress Administration menu
81
  function wooccm_admin_menu() {
82
 
83
- add_menu_page( 'WooCheckout', 'WooCheckout', 'manage_options', 'woocommerce-checkout-manager' , 'wooccm_options_page', 'dashicons-businessman', 57);
84
- // @mod - Remove until exports are fixed...
85
- // add_submenu_page( 'woocommerce-checkout-manager', 'Export', 'Export', 'manage_options', 'wooccm-advance-export', 'wooccm_advance_export' );
86
-
87
  }
88
- add_action( 'admin_menu', 'wooccm_admin_menu' );
89
-
90
- function wooccm_admin_enqueue_scripts( $hook_suffix ) {
91
-
92
- if( $hook_suffix == 'toplevel_page_woocommerce-checkout-manager' ) {
93
- wp_enqueue_style( 'farbtastic' );
94
- // @mod - We need to check that farbtastic exists
95
- wp_enqueue_script( 'farbtastic', site_url( '/wp-admin/js/farbtastic.js' ) );
96
- wp_enqueue_style( 'wooccm-backend-css', plugins_url( 'includes/pickers/css/backend_css.css', WOOCCM_RELPATH ) );
97
- wp_enqueue_script( 'script_wccs', plugins_url( 'includes/templates/js/script_wccs.js', WOOCCM_RELPATH ), array( 'jquery' ), '1.2' );
98
- wp_enqueue_script( 'billing_script_wccs', plugins_url( 'includes/templates/js/billing_script_wccs.js', WOOCCM_RELPATH ), array( 'jquery' ), '1.2' );
99
- wp_enqueue_script( 'shipping_script_wccs', plugins_url( 'includes/templates/js/shipping_script_wccs.js', WOOCCM_RELPATH ), array( 'jquery' ), '1.2' );
100
- if( wp_script_is( 'jquery-ui-sortable', 'queue' ) == false )
101
- wp_enqueue_script('jquery-ui-sortable');
102
- }
103
- if( $hook_suffix === 'woocheckout_page_wooccm-advance-export' ) {
104
- wp_enqueue_style( 'export', plugins_url( 'includes/templates/admin/woocheckout-export.css', WOOCCM_RELPATH ) );
105
- }
106
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
107
  }
108
 
109
  // List of action links on the Plugins screen
110
- function wooccm_admin_plugin_actions( $links ) {
111
 
112
- $page_url = add_query_arg( 'page', 'woocommerce-checkout-manager', 'admin.php' );
113
- $support_url = 'https://wordpress.org/support/plugin/woocommerce-checkout-manager/';
114
 
115
- $plugin_links = array(
116
- '<a href="' . $page_url . '">' . __( 'Settings', 'woocommerce-checkout-manager' ) . '</a>',
117
- '<a href="' . $support_url . '">' . __( 'Support', 'woocommerce-checkout-manager' ) . '</a>',
118
- );
119
- return array_merge( $plugin_links, $links );
120
 
121
- }
122
 
123
  function wooccm_deactivate_plugin_conditional() {
124
 
125
- $name = 'woocommerce-checkout-manager/woocommerce-checkout-manager.php';
126
- if( !is_plugin_active( 'woocommerce/woocommerce.php' ) ) {
127
- add_action('admin_notices', 'wooccm_admin_notice_woo');
128
- deactivate_plugins( $name );
129
- }
130
-
131
  }
132
- add_action( 'admin_init', 'wooccm_deactivate_plugin_conditional' );
133
 
134
- function wooccm_admin_notice_woo() {
135
 
136
- $message = __( 'WooCommerce is not active. WooCommerce Checkout Manager requires WooCommerce to be active.', 'woocommerce-checkout-manager' );
137
- echo '<div class="error"><p><strong>' . $message . '</strong></p></div>';
138
 
 
 
139
  }
140
 
141
  // Global actions
142
  function wooccm_admin_actions() {
143
 
144
- // Check the User has the manage_options capability
145
- if( current_user_can( 'manage_options' ) == false )
146
- return;
147
-
148
- // Process any actions
149
- $action = ( function_exists( 'woo_get_action' ) ? woo_get_action() : false );
150
- switch( $action ) {
151
-
152
- case 'wooccm_dismiss_beta_notice':
153
- // We need to verify the nonce.
154
- if( !empty( $_GET ) && check_admin_referer( 'wooccm_dismiss_beta_notice' ) ) {
155
- add_option( WOOCCM_PREFIX . '_beta_notice', 1 );
156
- $url = add_query_arg( array( 'action' => null, '_wpnonce' => null ) );
157
- wp_redirect( $url );
158
- exit();
159
- }
160
- break;
161
-
162
- case 'wooccm_dismiss_update_notice':
163
- // We need to verify the nonce.
164
- if( !empty( $_GET ) && check_admin_referer( 'wooccm_dismiss_update_notice' ) ) {
165
- update_option( WOOCCM_PREFIX . '_update_notice', 1 );
166
- $url = add_query_arg( array( 'action' => null, '_wpnonce' => null ) );
167
- wp_redirect( $url );
168
- exit();
169
- }
170
- break;
171
-
172
- }
173
-
174
  }
175
 
176
  // Actions limited to the WooCheckout screen
177
  function wooccm_admin_woocheckout_actions() {
178
 
179
- // Check the User has the manage_options capability
180
- if( current_user_can( 'manage_options' ) == false )
181
- return;
182
-
183
- // Check that we are on the WooCheckout screen
184
- $page = ( isset($_GET['page'] ) ? sanitize_text_field( $_GET['page'] ) : false );
185
- if( $page != 'woocommerce-checkout-manager' )
186
- return;
187
-
188
- // Process any actions
189
- $action = ( function_exists( 'woo_get_action' ) ? woo_get_action() : false );
190
- switch( $action ) {
191
-
192
- // Reset the Run the updater notice
193
- case 'wooccm_reset_update_notice':
194
- // We need to verify the nonce.
195
- if( !empty( $_GET ) && check_admin_referer( 'wooccm_reset_update_notice' ) ) {
196
- delete_option( WOOCCM_PREFIX . '_update_notice' );
197
- $url = add_query_arg( array( 'action' => null, '_wpnonce' => null ) );
198
- wp_redirect( $url );
199
- exit();
200
- }
201
- break;
202
-
203
- case 'wooccm_nuke_options':
204
- // We need to verify the nonce.
205
- if( !empty( $_GET ) && check_admin_referer( 'wooccm_nuke_options' ) ) {
206
- // Delete the default options
207
- $options = array( 'settings', 'settings2', 'settings3' );
208
- foreach( $options as $option )
209
- delete_option( 'wccs_' . $option );
210
- // Delete any notices
211
- $notices = array( 'update_notice', 'beta_notice' );
212
- foreach( $notices as $notice )
213
- delete_option( WOOCCM_PREFIX . '_' . $notice );
214
- $url = add_query_arg( array( 'action' => null, '_wpnonce' => null ) );
215
- wp_redirect( $url );
216
- exit();
217
- }
218
- break;
219
-
220
- case 'wooccm_nuke_order_meta':
221
- // We need to verify the nonce.
222
- if( !empty( $_GET ) && check_admin_referer( 'wooccm_nuke_order_meta' ) ) {
223
- $post_type = 'shop_order';
224
- $args = array(
225
- 'post_type' => $post_type,
226
- 'post_status' => ( function_exists( 'wc_get_order_statuses()' ) ? wc_get_order_statuses() : false ),
227
- 'fields' => 'ids',
228
- 'numberposts' => -1
229
- );
230
- $orders = get_posts( $args );
231
- if( !empty( $orders ) ) {
232
- // Prepare the Post meta name lists for only custom fields
233
- $meta_keys = array();
234
-
235
- // Additional section
236
- $options = get_option( 'wccs_settings' );
237
- $buttons = ( isset( $options['buttons'] ) ? $options['buttons'] : false );
238
- if( !empty( $buttons ) ) {
239
- foreach( $buttons as $btn ) {
240
- if( strstr( $btn['cow'], 'myfield' ) )
241
- $meta_keys[] = $btn['cow'];
242
- }
243
- }
244
- // Billing section
245
- $options = get_option( 'wccs_settings3' );
246
- $buttons = ( isset( $options['billing_buttons'] ) ? $options['billing_buttons'] : false );
247
- if( !empty( $buttons ) ) {
248
- foreach( $buttons as $btn ) {
249
- if( strstr( $btn['cow'], 'myfield' ) )
250
- $meta_keys[] = sprintf( '_billing_%s', $btn['cow'] );
251
- }
252
- }
253
- // Shipping section
254
- $options = get_option( 'wccs_settings2' );
255
- $buttons = ( isset( $options['shipping_buttons'] ) ? $options['shipping_buttons'] : false );
256
- if( !empty( $buttons ) ) {
257
- foreach( $buttons as $btn ) {
258
- if( strstr( $btn['cow'], 'myfield' ) )
259
- $meta_keys[] = sprintf( '_shipping_%s', $btn['cow'] );
260
- }
261
- }
262
-
263
- // Do the deed
264
- if( !empty( $meta_keys ) ) {
265
- foreach( $orders as $order_id ) {
266
- if( !empty( $order_id ) ) {
267
- foreach( $meta_keys as $meta_key )
268
- delete_post_meta( $order_id, $meta_key );
269
- }
270
- }
271
- }
272
- }
273
- $url = add_query_arg( array( 'action' => null, '_wpnonce' => null ) );
274
- wp_redirect( $url );
275
- exit();
276
- }
277
- break;
278
-
279
- case 'wooccm_nuke_user_meta':
280
- // We need to verify the nonce.
281
- if( !empty( $_GET ) && check_admin_referer( 'wooccm_nuke_user_meta' ) ) {
282
- $args = array(
283
- 'fields' => array( 'ID' )
284
- );
285
- $users = get_users( $args );
286
- if( !empty( $users ) ) {
287
- // Prepare the Post meta name lists for only custom fields
288
- $meta_keys = array();
289
-
290
- // Additional section
291
- $options = get_option( 'wccs_settings' );
292
- $buttons = ( isset( $options['buttons'] ) ? $options['buttons'] : false );
293
- if( !empty( $buttons ) ) {
294
- foreach( $buttons as $btn ) {
295
- if( strstr( $btn['cow'], 'myfield' ) )
296
- $meta_keys[] = $btn['cow'];
297
- }
298
- }
299
- // Billing section
300
- $options = get_option( 'wccs_settings3' );
301
- $buttons = ( isset( $options['billing_buttons'] ) ? $options['billing_buttons'] : false );
302
- if( !empty( $buttons ) ) {
303
- foreach( $buttons as $btn ) {
304
- if( strstr( $btn['cow'], 'myfield' ) )
305
- $meta_keys[] = sprintf( 'billing_%s', $btn['cow'] );
306
- }
307
- }
308
- // Shipping section
309
- $options = get_option( 'wccs_settings2' );
310
- $buttons = ( isset( $options['shipping_buttons'] ) ? $options['shipping_buttons'] : false );
311
- if( !empty( $buttons ) ) {
312
- foreach( $buttons as $btn ) {
313
- if( strstr( $btn['cow'], 'myfield' ) )
314
- $meta_keys[] = sprintf( 'shipping_%s', $btn['cow'] );
315
- }
316
- }
317
-
318
- // Do the deed
319
- if( !empty( $meta_keys ) ) {
320
- foreach( $users as $user_id ) {
321
- foreach( $meta_keys as $meta_key )
322
- delete_user_meta( $user_id->ID, $meta_key );
323
- }
324
- }
325
- }
326
- $url = add_query_arg( array( 'action' => null, '_wpnonce' => null ) );
327
- wp_redirect( $url );
328
- exit();
329
- }
330
- break;
331
-
332
- case 'wooccm_dismiss_beta_notice':
333
- // We need to verify the nonce.
334
- if( !empty( $_GET ) && check_admin_referer( 'wooccm_dismiss_beta_notice' ) ) {
335
- add_option( WOOCCM_PREFIX . '_beta_notice', 1 );
336
- $url = add_query_arg( array( 'action' => null, '_wpnonce' => null ) );
337
- wp_redirect( $url );
338
- exit();
339
- }
340
- break;
341
-
342
- case 'wooccm_dismiss_update_notice':
343
- // We need to verify the nonce.
344
- if( !empty( $_GET ) && check_admin_referer( 'wooccm_dismiss_update_notice' ) ) {
345
- add_option( WOOCCM_PREFIX . '_update_notice', 1 );
346
- $url = add_query_arg( array( 'action' => null, '_wpnonce' => null ) );
347
- wp_redirect( $url );
348
- exit();
349
- }
350
- break;
351
-
352
- }
353
-
354
  }
355
 
356
- if( !function_exists( 'woo_get_action' ) ) {
357
- function woo_get_action( $prefer_get = false ) {
 
358
 
359
- if( isset( $_GET['action'] ) && $prefer_get )
360
- return sanitize_text_field( $_GET['action'] );
361
 
362
- if( isset( $_POST['action'] ) )
363
- return sanitize_text_field( $_POST['action'] );
364
 
365
- if( isset( $_GET['action'] ) )
366
- return sanitize_text_field( $_GET['action'] );
367
 
368
- return;
 
369
 
370
- }
371
  }
372
 
373
  // WordPress Settings screen for WooCheckout
374
  function wooccm_register_settings() {
375
 
376
- register_setting( 'wccs_options', 'wccs_settings', 'wooccm_options_validate' );
377
- register_setting( 'wccs_options2', 'wccs_settings2', 'wooccm_options_validate_shipping' );
378
- register_setting( 'wccs_options3', 'wccs_settings3', 'wooccm_options_validate_billing' );
379
-
380
  }
381
 
382
  function wooccm_options_page() {
383
 
384
- if ( !current_user_can('manage_options') )
385
- wp_die( __( 'You do not have sufficient permissions to access this page.', 'woocommerce-checkout-manager' ) );
386
-
387
- $htmlshippingabbr = array( 'country', 'first_name', 'last_name', 'company', 'address_1', 'address_2', 'city', 'state', 'postcode' );
388
- $htmlbillingabbr = array( 'country', 'first_name', 'last_name', 'company', 'address_1', 'address_2', 'city', 'state', 'postcode', 'email', 'phone' );
389
- $upload_dir = wp_upload_dir();
390
- $hidden_field_name = 'mccs_submit_hidden';
391
- $hidden_wccs_reset = "my_new_field_reset";
392
-
393
- // Additional details
394
- $options = get_option( 'wccs_settings' );
395
- // Shipping details
396
- $options2 = get_option( 'wccs_settings2' );
397
- // Billing details
398
- $options3 = get_option( 'wccs_settings3' );
399
-
400
- // Check if the reset button has been clicked
401
- if(
402
- isset( $_POST[ $hidden_wccs_reset ] ) &&
403
- sanitize_text_field( $_POST[ $hidden_wccs_reset ] ) == 'Y'
404
- ) {
405
- delete_option('wccs_settings');
406
- delete_option('wccs_settings2');
407
- delete_option('wccs_settings3');
408
- $defaults = array(
409
- 'checkness' => array(
410
- 'position' => 'after_billing_form',
411
- 'wooccm_notification_email' => get_option( 'admin_email' ),
412
- 'payment_method_t' => true,
413
- 'shipping_method_t' => true,
414
- 'payment_method_d' => __( 'Payment Method','woocommerce-checkout-manager' ),
415
- 'shipping_method_d' => __( 'Shipping Method','woocommerce-checkout-manager' ),
416
- 'time_stamp_title' => __( 'Order Time','woocommerce-checkout-manager' ),
417
- ),
418
- );
419
-
420
- $shipping = array(
421
- 'country' => __( 'Country', 'woocommerce-checkout-manager' ),
422
- 'first_name' => __( 'First Name', 'woocommerce-checkout-manager' ),
423
- 'last_name' => __( 'Last Name', 'woocommerce-checkout-manager' ),
424
- 'company' => __( 'Company Name', 'woocommerce-checkout-manager' ),
425
- 'address_1' => __( 'Address', 'woocommerce-checkout-manager' ),
426
- 'address_2' => '',
427
- 'city' => __( 'Town/ City', 'woocommerce-checkout-manager' ),
428
- 'state' => __( 'State', 'woocommerce-checkout-manager' ),
429
- 'postcode' => __( 'Zip', 'woocommerce-checkout-manager' )
430
- );
431
- $ship = 0;
432
- foreach( $shipping as $name => $value ) {
433
-
434
- $defaults2['shipping_buttons'][$ship]['label'] = ( !empty( $value ) ? __( $value, 'woocommerce-checkout-manager' ) : false );
435
- $defaults2['shipping_buttons'][$ship]['cow'] = $name;
436
- $defaults2['shipping_buttons'][$ship]['checkbox'] = 'true';
437
- $defaults2['shipping_buttons'][$ship]['order'] = $ship + 1;
438
- $defaults2['shipping_buttons'][$ship]['type'] = 'wooccmtext';
439
-
440
- switch( $name ) {
441
-
442
- case 'country':
443
- $defaults2['shipping_buttons'][$ship]['position'] = 'form-row-wide';
444
- break;
445
-
446
- case 'first_name':
447
- $defaults2['shipping_buttons'][$ship]['position'] = 'form-row-first';
448
- break;
449
-
450
- case 'last_name':
451
- $defaults2['shipping_buttons'][$ship]['position'] = 'form-row-last';
452
- $defaults2['shipping_buttons'][$ship]['clear_row'] = true;
453
- break;
454
-
455
- case 'company':
456
- $defaults2['shipping_buttons'][$ship]['position'] = 'form-row-wide';
457
- break;
458
-
459
- case 'address_1':
460
- $defaults2['shipping_buttons'][$ship]['position'] = 'form-row-wide';
461
- $defaults2['shipping_buttons'][$ship]['placeholder'] = __('Street address', 'woocommerce-checkout-manager');
462
- break;
463
-
464
- case 'address_2':
465
- $defaults2['shipping_buttons'][$ship]['position'] = 'form-row-wide';
466
- $defaults2['shipping_buttons'][$ship]['placeholder'] = __('Apartment, suite, unit etc. (optional)', 'woocommerce-checkout-manager');
467
- break;
468
-
469
- case 'city':
470
- $defaults2['shipping_buttons'][$ship]['position'] = 'form-row-wide';
471
- $defaults2['shipping_buttons'][$ship]['placeholder'] = __('Town / City', 'woocommerce-checkout-manager');
472
- break;
473
-
474
- case 'state':
475
- $defaults2['shipping_buttons'][$ship]['position'] = 'form-row-first';
476
- break;
477
-
478
- }
479
-
480
- $ship++;
481
-
482
- }
483
-
484
- $billing = array(
485
- 'country' => __( 'Country', 'woocommerce-checkout-manager' ),
486
- 'first_name' => __( 'First Name', 'woocommerce-checkout-manager' ),
487
- 'last_name' => __( 'Last Name', 'woocommerce-checkout-manager' ),
488
- 'company' => __( 'Company Name', 'woocommerce-checkout-manager' ),
489
- 'address_1' => __( 'Address', 'woocommerce-checkout-manager' ),
490
- 'address_2' => '',
491
- 'city' => __( 'Town/ City', 'woocommerce-checkout-manager' ),
492
- 'state' => __( 'State', 'woocommerce-checkout-manager' ),
493
- 'postcode' => __( 'Zip', 'woocommerce-checkout-manager' ),
494
- 'email' => __( 'Email Address', 'woocommerce-checkout-manager' ),
495
- 'phone' => __( 'Phone', 'woocommerce-checkout-manager' )
496
- );
497
-
498
- $bill = 0;
499
-
500
- foreach( $billing as $name => $value ) {
501
-
502
- $defaults3['billing_buttons'][$bill]['label'] = ( !empty( $value ) ? __( $value, 'woocommerce-checkout-manager' ) : false );
503
- $defaults3['billing_buttons'][$bill]['cow'] = $name;
504
- $defaults3['billing_buttons'][$bill]['checkbox'] = 'true';
505
- $defaults3['billing_buttons'][$bill]['order'] = $bill + 1;
506
- $defaults3['billing_buttons'][$bill]['type'] = 'wooccmtext';
507
-
508
- switch( $name ) {
509
-
510
- case 'country':
511
- $defaults3['billing_buttons'][$bill]['position'] = 'form-row-wide';
512
- break;
513
-
514
- case 'first_name':
515
- $defaults3['billing_buttons'][$bill]['position'] = 'form-row-first';
516
- break;
517
-
518
- case 'last_name':
519
- $defaults3['billing_buttons'][$bill]['position'] = 'form-row-last';
520
- $defaults3['billing_buttons'][$bill]['clear_row'] = true;
521
- break;
522
-
523
- case 'company':
524
- $defaults3['billing_buttons'][$bill]['position'] = 'form-row-wide';
525
- break;
526
-
527
- case 'address_1':
528
- $defaults3['billing_buttons'][$bill]['position'] = 'form-row-wide';
529
- $defaults3['billing_buttons'][$bill]['placeholder'] = __('Street address', 'woocommerce-checkout-manager');
530
- break;
531
-
532
- case 'address_2':
533
- $defaults3['billing_buttons'][$bill]['position'] = 'form-row-wide';
534
- $defaults3['billing_buttons'][$bill]['placeholder'] = __('Apartment, suite, unit etc. (optional)', 'woocommerce-checkout-manager');
535
- break;
536
-
537
- case 'city':
538
- $defaults3['billing_buttons'][$bill]['position'] = 'form-row-wide';
539
- $defaults3['billing_buttons'][$bill]['placeholder'] = __('Town / City', 'woocommerce-checkout-manager');
540
- break;
541
-
542
- case 'state':
543
- $defaults3['billing_buttons'][$bill]['position'] = 'form-row-first';
544
- break;
545
-
546
- case 'postcode':
547
- $defaults3['billing_buttons'][$bill]['position'] = 'form-row-last';
548
- $defaults3['billing_buttons'][$bill]['placeholder'] = __('Postcode / Zip', 'woocommerce-checkout-manager');
549
- $defaults3['billing_buttons'][$bill]['clear_row'] = true;
550
- break;
551
-
552
- case 'email':
553
- $defaults3['billing_buttons'][$bill]['position'] = 'form-row-first';
554
- break;
555
-
556
- case 'phone':
557
- $defaults3['billing_buttons'][$bill]['position'] = 'form-row-last';
558
- $defaults3['billing_buttons'][$bill]['clear_row'] = true;
559
- break;
560
-
561
- }
562
-
563
- $bill++;
564
-
565
- }
566
- add_option( 'wccs_settings' , $defaults );
567
- add_option( 'wccs_settings2' , $defaults2 );
568
- add_option( 'wccs_settings3' , $defaults3 );
569
-
570
- // @mod - Change this to add_query_arg()
571
- echo '
572
- <script type="text/javascript">window.location.href="'.$_SERVER['PHP_SELF'].'?page=woocommerce-checkout-manager";</script>';
573
- echo '
574
- <noscript><meta http-equiv="refresh" content="0;url='.$_SERVER['PHP_SELF'].'?page=woocommerce-checkout-manager" /></noscript>';
575
- exit;
576
-
577
- }
578
- echo '
579
- <script type="text/javascript" src="'.plugins_url( '/woocommerce/assets/js/jquery-blockui/jquery.blockUI.js' ).'"></script>';
580
- echo '
581
  <div class="refreshwooccm">
582
  ';
583
 
584
- // display error
585
- settings_errors();
586
-
587
- // Now display the settings editing screen
588
-
589
- // header
590
- ?>
591
- <h2><?php _e( 'WooCommerce Checkout Manager', 'woocommerce-checkout-manager' ); ?></h2>
592
- <div id="content">
593
-
594
- <h2 class="nav-tab-wrapper add_tip_wrap">
595
- <a class="nav-tab general-tab nav-tab-active"><?php _e( 'General', 'woocommerce-checkout-manager' ); ?></a>
596
- <a class="nav-tab billing-tab"><?php _e( 'Billing', 'woocommerce-checkout-manager' ); ?></a>
597
- <a class="nav-tab shipping-tab"><?php _e( 'Shipping', 'woocommerce-checkout-manager' ); ?></a>
598
- <a class="nav-tab additional-tab"><?php _e( 'Additional', 'woocommerce-checkout-manager' ); ?></a>
599
- <a class="nav-tab star" href="https://wordpress.org/support/view/plugin-reviews/woocommerce-checkout-manager?filter=5" target="_blank">
600
- <div id="star-five" title="<?php _e('Like the plugin? Rate it! On WordPress.org', 'woocommerce-checkout-manager' ); ?>">
601
- <div class="star-rating">
602
- <div class="star star-full"></div>
603
- <div class="star star-full"></div>
604
- <div class="star star-full"></div>
605
- <div class="star star-full"></div>
606
- <div class="star star-full"></div>
607
- </div>
608
- <!-- .star-rating -->
609
- </div>
610
- <!-- #star-five -->
611
- </a>
612
- </h2>
613
- <!-- .nav-tab-wrapper -->
614
-
615
- <?php do_action('wooccm_run_color_innerpicker'); ?>
616
-
617
- <form name="reset_form" class="reset_form" method="post" action="">
618
- <input type="hidden" name="<?php echo esc_attr( $hidden_wccs_reset ); ?>" value="Y">
619
- <input type="submit" name="submit" id="wccs_reset_submit" class="button button-hero" value="Reset">
620
- </form>
621
- <script type="text/javascript">
622
- jQuery( '#wccs_reset_submit' ).click( 'click', function() {
623
- return window.confirm( '<?php echo esc_js( __( 'Are you sure you wish to reset the settings on this tab for WooCommerce Checkout Manager?', 'woocommerce-checkout-manager' ) ); ?>' );
624
- });
625
- </script>
626
 
627
- <?php require( WOOCCM_PATH.'includes/classes/import.php'); ?>
 
 
 
 
628
 
629
- <div class="wrap">
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
630
 
631
- <!-- Shipping section -->
632
- <form name="wooccmform2" method="post" action="options.php" id="frm2">
633
 
634
- <?php settings_fields( 'wccs_options2' ); ?>
 
 
 
635
 
636
- <input type="submit" id="wccs_submit_button" style="display:none;" name="Submit" class="save-shipping wccs_submit_button button button-primary button-hero" value="<?php _e( 'Save Changes', 'woocommerce-checkout-manager' ); ?>" />
 
 
 
 
637
 
638
- <?php require( WOOCCM_PATH.'includes/templates/admin/woocheckout-shipping.php' ); ?>
639
 
640
- </form>
641
- <!-- #frm2 -->
642
 
643
- <!-- Billing section -->
644
- <form name="wooccmform3" method="post" action="options.php" id="frm3">
645
 
646
- <?php settings_fields( 'wccs_options3' ); ?>
647
 
648
- <input type="submit" id="wccs_submit_button" name="Submit" style="display:none;" class="save-billing wccs_submit_button button button-primary button-hero" value="<?php _e( 'Save Changes', 'woocommerce-checkout-manager' ); ?>" />
649
 
650
- <?php require( WOOCCM_PATH.'includes/templates/admin/woocheckout-billing.php' ); ?>
651
 
652
- </form>
653
- <!-- #frm3 -->
654
 
655
- <!-- Additional section -->
656
- <form name="wooccmform" method="post" action="options.php" id="frm1">
657
 
658
- <?php settings_fields( 'wccs_options' ); ?>
659
 
660
- <input type="submit" id="wccs_submit_button" name="Submit" class="save-additional wccs_submit_button button button-primary button-hero" value="<?php _e( 'Save Changes', 'woocommerce-checkout-manager' ); ?>" />
661
 
662
- <!-- Additional section -->
663
- <?php require( WOOCCM_PATH.'includes/templates/admin/woocheckout-additional.php' ); ?>
664
 
665
- <!-- General section -->
666
- <?php require( WOOCCM_PATH.'includes/templates/admin/woocheckout-general.php' ); ?>
667
 
668
- </form>
669
- <!-- #frm1 -->
670
 
671
- </div>
672
- <!-- .wrap -->
673
 
674
- </div>
675
- <!-- #content -->
676
 
677
- </div>
678
- <!-- #refreshwooccm -->
679
 
680
- <?php
 
681
 
682
- }
683
-
684
- function wooccm_options_validate( $input ) {
685
-
686
- $detect_error = 0;
687
- // translate additional fields
688
- if( !empty( $input['buttons'] ) ) {
689
- foreach( $input['buttons'] as $i => $btn ) {
690
-
691
- if( function_exists( 'icl_register_string' ) ) {
692
- if( !empty($btn['label']) ) {
693
- icl_register_string( 'WooCommerce Checkout Manager', $btn['label'], $btn['label'] );
694
- }
695
- if( !empty($btn['placeholder']) ) {
696
- icl_register_string( 'WooCommerce Checkout Manager', $btn['placeholder'], $btn['placeholder'] );
697
- }
698
-
699
- if( !empty($btn['option_array']) ) {
700
- $mysecureop = explode( '||', $btn['option_array']);
701
- foreach( $mysecureop as $one ) {
702
- icl_register_string( 'WooCommerce Checkout Manager', $one, $one );
703
- }
704
- }
705
- }
706
 
707
- if( !empty($btn['role_options']) && !empty($btn['role_options2']) ) {
708
- $input['buttons'][$i]['role_options2'] = '';
709
- add_settings_error(
710
- 'wooccm_settings_errors',
711
- esc_attr( 'settings_updated' ),
712
- __( 'Sorry! An error occurred. WooCommerce Checkout Manager requires you to not have values in both role options. OK.', 'woocommerce-checkout-manager' ),
713
- 'error'
714
- );
715
- }
716
-
717
- if( !empty($btn['single_p']) && !empty($btn['single_px']) ) {
718
- $input['buttons'][$i]['single_px'] = '';
719
- add_settings_error(
720
- 'wooccm_settings_errors',
721
- esc_attr( 'settings_updated' ),
722
- __( 'Sorry! An error occurred. WooCommerce Checkout Manager requires you to not have values in both hidden product options. OK.', 'woocommerce-checkout-manager' ),
723
- 'error'
724
- );
725
- }
726
-
727
- if( !empty($btn['single_p_cat']) && !empty($btn['single_px_cat']) ) {
728
- $input['buttons'][$i]['single_px_cat'] = '';
729
- add_settings_error(
730
- 'wooccm_settings_errors',
731
- esc_attr( 'settings_updated' ),
732
- __( 'Sorry! An error occurred. WooCommerce Checkout Manager requires you to not have values in both hidden category options. OK.', 'woocommerce-checkout-manager' ),
733
- 'error'
734
- );
735
- }
736
-
737
- if( empty( $btn['cow'] ) && empty( $btn['label'] ) && empty( $btn['placeholder'] ) ) {
738
- unset( $input['buttons'][$i] );
739
-
740
- if( $i != 999 ) {
741
- $detect_error++;
742
- $fieldnum = $i + 1;
743
- add_settings_error(
744
- 'wooccm_settings_errors',
745
- esc_attr( 'settings_updated' ),
746
- __( 'Sorry! An error occurred. WooCommerce Checkout Manager removed Additional field #'.$fieldnum.' because no Label or Placeholder name was provided.', 'woocommerce-checkout-manager' ),
747
- 'error'
748
- );
749
- }
750
- }
751
-
752
- if ( empty( $btn['cow'] ) && (!empty( $btn['label'] ) || !empty( $btn['placeholder'] )) ) {
753
- $newNum = $i + 1;
754
- if( wooccm_mul_array( 'myfield'.$newNum , $input['buttons'] ) ) {
755
- $input['buttons'][$i]['cow'] = 'myfield'.$newNum.'c';
756
- } else {
757
- $input['buttons'][$i]['cow'] = 'myfield'.$newNum;
758
- }
759
- }
760
 
761
- if( !empty( $btn['cow'] ) && empty( $btn['label'] ) && empty( $btn['placeholder'] ) ) {
762
- unset( $input['buttons'][$i] );
763
-
764
- if( $i != 999 ) {
765
- $detect_error++;
766
- $fieldnum = $i + 1;
767
- add_settings_error(
768
- 'wooccm_settings_errors',
769
- esc_attr( 'settings_updated' ),
770
- __( 'Sorry! An error occurred. WooCommerce Checkout Manager removed Additional field #'.$fieldnum.' because no Label or Placeholder name was provided.', 'woocommerce-checkout-manager' ),
771
- 'error'
772
- );
773
- }
774
- }
775
 
776
- }
777
- }
778
- if( $detect_error == 0 ) {
779
- add_settings_error(
780
- 'wooccm_settings_errors',
781
- esc_attr( 'settings_updated' ),
782
- __( 'Your changes have been saved.', 'woocommerce-checkout-manager' ),
783
- 'updated'
784
- );
785
- }
786
- return $input;
787
 
 
788
  }
789
 
790
- function wooccm_options_validate_shipping( $input ) {
791
-
792
- $detect_error = 0;
793
- // translate shipping fields
794
- if( !empty( $input['shipping_buttons'] ) ) {
795
- foreach( $input['shipping_buttons'] as $i => $btn ) {
796
-
797
- if( function_exists( 'icl_register_string' ) ) {
798
- if( !empty($btn['label']) ) {
799
- icl_register_string( 'WooCommerce Checkout Manager', $btn['label'], $btn['label'] );
800
- }
801
- if( !empty($btn['placeholder']) ) {
802
- icl_register_string( 'WooCommerce Checkout Manager', $btn['placeholder'], $btn['placeholder'] );
803
- }
804
-
805
- if( !empty($btn['option_array']) ) {
806
- $mysecureop = explode( '||', $btn['option_array']);
807
- foreach( $mysecureop as $one ) {
808
- icl_register_string( 'WooCommerce Checkout Manager', $one, $one );
809
- }
810
- }
811
- }
812
-
813
- if( !empty($btn['role_options']) && !empty($btn['role_options2']) ) {
814
- $input['buttons'][$i]['role_options2'] = '';
815
- add_settings_error(
816
- 'wooccm_settings_errors',
817
- esc_attr( 'settings_updated' ),
818
- __( 'Sorry! An error occurred. WooCommerce Checkout Manager requires you to not have values in both role options.', 'woocommerce-checkout-manager' ),
819
- 'error'
820
- );
821
- }
822
-
823
- if( !empty($btn['single_p']) && !empty($btn['single_px']) ) {
824
- $input['buttons'][$i]['single_px'] = '';
825
- add_settings_error(
826
- 'wooccm_settings_errors',
827
- esc_attr( 'settings_updated' ),
828
- __( 'Sorry! An error occurred. WooCommerce Checkout Manager requires you to not have values in both hidden product options.', 'woocommerce-checkout-manager' ),
829
- 'error'
830
- );
831
- }
832
-
833
- if( !empty($btn['single_p_cat']) && !empty($btn['single_px_cat']) ) {
834
- $input['buttons'][$i]['single_px_cat'] = '';
835
- add_settings_error(
836
- 'wooccm_settings_errors',
837
- esc_attr( 'settings_updated' ),
838
- __( 'Sorry! An error occurred. WooCommerce Checkout Manager requires you to not have values in both hidden category options.', 'woocommerce-checkout-manager' ),
839
- 'error'
840
- );
841
- }
842
-
843
- if( empty( $btn['cow'] ) && empty( $btn['label'] ) && empty( $btn['placeholder'] ) ) {
844
- unset( $input['shipping_buttons'][$i] );
845
-
846
- if( $i != 999 ) {
847
- $detect_error++;
848
- $fieldnum = $i + 1;
849
- add_settings_error(
850
- 'wooccm_settings_errors',
851
- esc_attr( 'settings_updated' ),
852
- __( 'Sorry! An error occurred. WooCommerce Checkout Manager removed Shipping field #'.$fieldnum.' because no Label or Placeholder name was provided.', 'woocommerce-checkout-manager' ),
853
- 'error'
854
- );
855
- }
856
- }
857
-
858
- if( empty( $btn['cow'] ) && (!empty( $btn['label'] ) || !empty( $btn['placeholder'] )) ) {
859
- $newNum = $i + 1;
860
- if( wooccm_mul_array( 'myfield'.$newNum , $input['shipping_buttons'] ) ) {
861
- $input['shipping_buttons'][$i]['cow'] = 'myfield'.$newNum.'c';
862
- } else {
863
- $input['shipping_buttons'][$i]['cow'] = 'myfield'.$newNum;
864
- }
865
- }
866
-
867
- if( !empty( $btn['cow'] ) && empty( $btn['label'] ) && empty( $btn['placeholder'] ) ) {
868
- unset( $input['shipping_buttons'][$i] );
869
-
870
- if( $i != 999 ) {
871
- $detect_error++;
872
- $fieldnum = $i + 1;
873
- add_settings_error(
874
- 'wooccm_settings_errors',
875
- esc_attr( 'settings_updated' ),
876
- __( 'Sorry! An error occurred. WooCommerce Checkout Manager removed Shipping field #'.$fieldnum.' because no Label or Placeholder name was provided.', 'woocommerce-checkout-manager' ),
877
- 'error'
878
- );
879
- }
880
- }
881
-
882
- }
883
- }
884
-
885
- if( $detect_error == 0 ) {
886
- add_settings_error(
887
- 'wooccm_settings_errors',
888
- esc_attr( 'settings_updated' ),
889
- __( 'Your changes have been saved.', 'woocommerce-checkout-manager' ),
890
- 'updated'
891
- );
892
- }
893
-
894
- return $input;
895
-
896
  }
897
 
898
- function wooccm_options_validate_billing( $input ) {
899
-
900
- $detect_error = 0;
901
-
902
- // translate billing fields
903
- if( !empty( $input['billing_buttons'] ) ) {
904
- foreach( $input['billing_buttons'] as $i => $btn ) {
905
-
906
- if( function_exists( 'icl_register_string' ) ) {
907
- if( !empty($btn['label']) ) {
908
- icl_register_string( 'WooCommerce Checkout Manager', $btn['label'], $btn['label'] );
909
- }
910
- if( !empty($btn['placeholder']) ) {
911
- icl_register_string( 'WooCommerce Checkout Manager', $btn['placeholder'], $btn['placeholder'] );
912
- }
913
-
914
- if( !empty($btn['option_array']) ) {
915
- $mysecureop = explode( '||', $btn['option_array']);
916
- foreach( $mysecureop as $one ) {
917
- icl_register_string( 'WooCommerce Checkout Manager', $one, $one );
918
- }
919
- }
920
- }
921
-
922
- if( !empty($btn['role_options']) && !empty($btn['role_options2']) ) {
923
- $input['buttons'][$i]['role_options2'] = '';
924
- add_settings_error(
925
- 'wooccm_settings_errors',
926
- esc_attr( 'settings_updated' ),
927
- __( 'Sorry! An error occurred. WooCommerce Checkout Manager requires you to not have values in both role options.', 'woocommerce-checkout-manager' ),
928
- 'error'
929
- );
930
- }
931
-
932
- if( !empty($btn['single_p']) && !empty($btn['single_px']) ) {
933
- $input['buttons'][$i]['single_px'] = '';
934
- add_settings_error(
935
- 'wooccm_settings_errors',
936
- esc_attr( 'settings_updated' ),
937
- __( 'Sorry! An error occurred. WooCommerce Checkout Manager requires you to not have values in both hidden product options.', 'woocommerce-checkout-manager' ),
938
- 'error'
939
- );
940
- }
941
-
942
- if( !empty($btn['single_p_cat']) && !empty($btn['single_px_cat']) ) {
943
- $input['buttons'][$i]['single_px_cat'] = '';
944
- add_settings_error(
945
- 'wooccm_settings_errors',
946
- esc_attr( 'settings_updated' ),
947
- __( 'Sorry! An error occurred. WooCommerce Checkout Manager requires you to not have values in both hidden category options.', 'woocommerce-checkout-manager' ),
948
- 'error'
949
- );
950
- }
951
-
952
- if( empty( $btn['cow'] ) && empty( $btn['label'] ) && empty( $btn['placeholder'] ) ) {
953
- unset( $input['billing_buttons'][$i] );
954
-
955
- if( $i != 999 ) {
956
- $detect_error++;
957
- $fieldnum = $i + 1;
958
- add_settings_error(
959
- 'wooccm_settings_errors',
960
- esc_attr( 'settings_updated' ),
961
- __( 'Sorry! An error occurred. WooCommerce Checkout Manager removed Billing field #'.$fieldnum.' because no Label or Placeholder name was provided.', 'woocommerce-checkout-manager' ),
962
- 'error'
963
- );
964
- }
965
- }
966
-
967
- if( empty( $btn['cow'] ) && (!empty( $btn['label'] ) || !empty( $btn['placeholder'] )) ) {
968
- $newNum = $i + 1;
969
- if( wooccm_mul_array( 'myfield'.$newNum, $input['billing_buttons'] ) ) {
970
- $input['billing_buttons'][$i]['cow'] = 'myfield'.$newNum.'c';
971
- } else {
972
- $input['billing_buttons'][$i]['cow'] = 'myfield'.$newNum;
973
- }
974
- }
975
-
976
- if( !empty( $btn['cow'] ) && empty( $btn['label'] ) && empty( $btn['placeholder'] ) ) {
977
- $detect_error++;
978
- unset( $input['billing_buttons'][$i] );
979
-
980
- if( $i != 999 ) {
981
- $detect_error++;
982
- $fieldnum = $i + 1;
983
- add_settings_error(
984
- 'wooccm_settings_errors',
985
- esc_attr( 'settings_updated' ),
986
- __( 'Sorry! An error occurred. WooCommerce Checkout Manager removed Billing field #'.$fieldnum.' because no Label or Placeholder name was provided.', 'woocommerce-checkout-manager' ),
987
- 'error'
988
- );
989
- }
990
- }
991
-
992
- }
993
- }
994
-
995
- if( $detect_error == 0 ) {
996
- add_settings_error(
997
- 'wooccm_settings_errors',
998
- esc_attr( 'settings_updated' ),
999
- __( 'Your changes have been saved.', 'woocommerce-checkout-manager' ),
1000
- 'updated'
1001
- );
1002
- }
1003
-
1004
- return $input;
1005
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1006
  }
1007
 
1008
  function wooccm_admin_notices() {
1009
 
1010
- // Check the User has the manage_options capability
1011
- if( current_user_can( 'manage_options' ) == false )
1012
- return;
1013
-
1014
- // @mod - Removed as it tends to blow people Options up...
1015
- // Data update from legacy (<3.0)
1016
- // wooccm_admin_updater_notice();
1017
 
1018
- // Check whether we are on the WooCommerce Checkout Manager screen
1019
- $screen = get_current_screen();
 
 
 
1020
 
1021
- if( get_option( 'wooccm_beta_notice' ) == false ) {
1022
- $beta_url = 'https://www.visser.com.au/plugins/woocommerce-checkout-manager/#beta';
1023
- $support_url = 'https://wordpress.org/support/plugin/woocommerce-checkout-manager#postform';
1024
- $dismiss_url = add_query_arg( array( 'action' => 'wooccm_dismiss_beta_notice', '_wpnonce' => wp_create_nonce( 'wooccm_dismiss_beta_notice' ) ) );
1025
 
1026
- $message = '<span style="float:right;"><a href="' . $dismiss_url . '" class="woocommerce-message-close notice-dismiss">' . __( 'Dismiss', 'woocommerce-checkout-manager' ) . '</a></span>';
1027
- $message .= __( '<strong>WooCommerce Checkout Manager Notice:</strong> We urgently need developers, integrators and interested store owners to test early Plugin releases and provide feedback to help stabilise the 4.0+ series. Can you help?', 'woocommerce-checkout-manager' );
1028
- $message .= '
1029
  <p class="submit">
1030
- <a href="' . $beta_url . '" target="_blank" class="button-primary button-hero">' . __( 'Join the Developers list', 'woocommerce-checkout-manager' ) . '</a>
1031
- <a href="' . $support_url . '" target="_blank" class="button-secondary button-hero">' . __( 'Send feedback', 'woocommerce-checkout-manager' ) . '</a>
1032
  </p>';
1033
- echo wooccm_admin_notice_html( $message );
1034
- }
1035
-
1036
  }
1037
 
1038
  function wooccm_admin_updater_notice() {
1039
 
1040
- if( in_array( get_option( WOOCCM_PREFIX . '_update_notice' ), array( 1, 'yep' ) ) == true )
1041
- return;
1042
-
1043
- $dismiss_url = add_query_arg( array( 'action' => 'wooccm_dismiss_update_notice', '_wpnonce' => wp_create_nonce( 'wooccm_dismiss_update_notice' ) ) );
1044
-
1045
- ?>
1046
- <form method="post" name="clickhere" action="">
1047
- <div id="message" class="updated settings-error click-here-wooccm">
1048
- <p>
1049
- <span style="float:right;"><a href="<?php echo $dismiss_url; ?>" class="woocommerce-message-close notice-dismiss"><?php _e( 'Dismiss', 'woocommerce-checkout-manager' ); ?></a></span>
1050
- <?php _e( '<strong>WooCommerce Checkout Manager Data Update Required</strong> &#8211; We just need to update the settings for WooCommerce Checkout Manager to the latest version.', 'woocommerce-checkout-manager' ); ?>
1051
- </p>
1052
- <?php
1053
- // Check whether we are on the WooCommerce Checkout Manager screen
1054
- $screen = get_current_screen();
1055
- if( strstr( $screen->base, 'woocommerce-checkout-manager' ) ) {
1056
- ?>
1057
- <p class="submit">
1058
- <input type="submit" class="wooccm-update-now button-primary button-hero" value="<?php _e( 'Run the updater', 'woocommerce-checkout-manager' ); ?>" />
1059
- </p>
1060
- <?php
1061
- } else {
1062
- ?>
1063
- <p class="submit">
1064
- <a href="<?php echo add_query_arg( 'page', 'woocommerce-checkout-manager' ); ?>" class="button-primary button-hero "><?php _e( 'Open WooCheckout', 'woocommerce-checkout-manager' ); ?></a>
1065
- </p>
1066
- <?php
1067
- }
1068
- ?>
1069
- </div>
1070
- <!-- #message -->
1071
- <input type="hidden" name="click-here-wooccm" value="y" />
1072
- </form>
1073
- <?php
1074
- if( strstr( $screen->base, 'woocommerce-checkout-manager' ) ) {
1075
- ?>
1076
- <script type="text/javascript">
1077
- jQuery( '.wooccm-update-now' ).click( 'click', function() {
1078
- return window.confirm( '<?php echo esc_js( __( 'It is strongly recommended that you backup your database before proceeding. Are you sure you wish to run the updater now?', 'woocommerce-checkout-manager' ) ); ?>' );
1079
- });
1080
- </script>
1081
- <?php
1082
-
1083
- if(
1084
- isset( $_POST['click-here-wooccm'] ) &&
1085
- sanitize_text_field( $_POST['click-here-wooccm'] ) == 'y'
1086
- ) {
1087
- // @mod - We need to check this file exists
1088
- ?>
1089
-
1090
- <!-- First Use -->
1091
- <script type="text/javascript">
1092
- jQuery(document).ready(function($) {
1093
-
1094
- $( '#wpbody-content' ).block({message:null,overlayCSS:{background:"#fff url(<?php echo plugins_url( 'woocommerce/assets/images/ajax-loader.gif' ); ?> ) no-repeat center",opacity:.6}});
1095
-
1096
- var form = $('#frm1');
1097
- data = $('#frm1');
1098
- forma = $('#frm2');
1099
- dataa = $('#frm2');
1100
- formb = $('#frm3');
1101
- datab = $('#frm3');
1102
-
1103
- $.ajax( {
1104
- type: "POST",
1105
- url: form.attr( 'action' ),
1106
- data: data.serialize(),
1107
- success: function( response ) {
1108
-
1109
- $.ajax( {
1110
- type: "POST",
1111
- url: forma.attr( 'action' ),
1112
- data: dataa.serialize(),
1113
- success: function( response ) {}
1114
- });
1115
-
1116
- $.ajax( {
1117
- type: "POST",
1118
- url: formb.attr( 'action' ),
1119
- data: datab.serialize(),
1120
- success: function( response ) {}
1121
- });
1122
- $('.settings-error.click-here-wooccm').hide();
1123
- $('#wpbody-content').unblock();
1124
-
1125
- }
1126
- });
1127
-
1128
- });
1129
- </script>
1130
-
1131
- <?php
1132
- update_option( WOOCCM_PREFIX . '_update_notice', 1 );
1133
- }
1134
-
1135
- }
1136
-
1137
  }
1138
 
1139
  // Additional details
1140
- function wooccm_admin_edit_order_additional_details( $order ) {
1141
 
1142
- global $post;
1143
 
1144
- if( version_compare( wooccm_get_woo_version(), '2.7', '>=' ) ) {
1145
- $order_id = ( method_exists( $order, 'get_id' ) ? $order->get_id() : $order->id );
1146
- } else {
1147
- $order_id = ( isset( $order->id ) ? $order->id : 0 );
1148
- }
1149
 
1150
- $options = get_option( 'wccs_settings' );
1151
- $buttons = ( isset( $options['buttons'] ) ? $options['buttons'] : false );
1152
- if( !empty( $buttons ) ) {
1153
- echo '
1154
  <p>&nbsp;</p>
1155
- <h4>' . __( 'Additional Details', 'woocommerce-checkout-manager' ) . '</h4>';
1156
- foreach( $buttons as $btn ) {
1157
-
1158
- if(
1159
- ( get_post_meta( $order_id , $btn['cow'], true ) !== '' ) &&
1160
- !empty( $btn['label'] ) &&
1161
- $btn['type'] !== 'heading' &&
1162
- $btn['type'] !== 'multiselect' &&
1163
- $btn['type'] !== 'wooccmupload' &&
1164
- $btn['type'] !== 'multicheckbox'
1165
- ) {
1166
- echo '
1167
  <p id="additional_' . $btn['cow'] . '" class="form-field form-field-wide form-field-type-' . $btn['type'] . '">
1168
- <strong title="' . sprintf( __( 'ID: %s | Field Type: %s', 'woocommerce-checkout-manager' ), $btn['cow'], __( 'Generic', 'woocommerce-checkout-manager' ) ) . '">
1169
- '.wooccm_wpml_string( trim( $btn['label'] ) ).':</strong><br />' . nl2br( get_post_meta( $order_id , $btn['cow'], true ) ) . '
1170
  </p>
1171
  <!-- .form-field-type-... -->';
1172
- } elseif(
1173
- !empty( $btn['label'] ) &&
1174
- $btn['type'] !== 'wooccmupload' &&
1175
- $btn['type'] !== 'multiselect' &&
1176
- $btn['type'] !== 'multicheckbox' &&
1177
- $btn['type'] == 'heading'
1178
- ) {
1179
- echo '
1180
- <h4>' .wooccm_wpml_string( trim( $btn['label'] ) ). '</h4>';
1181
- } elseif(
1182
- ( get_post_meta( $order_id , $btn['cow'], true ) !== '' ) &&
1183
- !empty( $btn['label'] ) &&
1184
- $btn['type'] !== 'heading' &&
1185
- $btn['type'] !== 'wooccmupload' &&
1186
- (
1187
- $btn['type'] == 'multiselect' || $btn['type'] == 'multicheckbox'
1188
- )
1189
- ) {
1190
- $value = get_post_meta( $order_id, $btn['cow'], true );
1191
- $strings = maybe_unserialize( $value );
1192
- echo '
1193
  <p class="form-field form-field-wide form-field-type-' . $btn['type'] . '">
1194
- <strong title="' . sprintf( __( 'ID: %s | Field Type: %s', 'woocommerce-checkout-manager' ), $btn['cow'], __( 'Multi-Select or Multi-Checkbox', 'woocommerce-checkout-manager' ) ) . '">'.wooccm_wpml_string( trim( $btn['label'] ) ).':</strong> ';
1195
- if( !empty( $strings ) ) {
1196
- if( is_array( $strings ) ) {
1197
- $iww = 0;
1198
- $len = count($strings);
1199
- foreach( $strings as $key ) {
1200
- if( $iww == $len - 1 ) {
1201
- echo '' . wooccm_wpml_string( $key );
1202
- } else {
1203
- echo '' . wooccm_wpml_string( $key ) . ', ';
1204
- }
1205
- $iww++;
1206
- }
1207
- }
1208
- } else {
1209
- echo '-';
1210
- }
1211
- echo '
1212
  </p>
1213
  <!-- .form-field-type-multiselect .form-field-type-multicheckbox -->';
1214
- } elseif(
1215
- ( get_post_meta( $order_id , $btn['cow'], true ) !== '' ) &&
1216
- $btn['type'] == 'wooccmupload'
1217
- ) {
1218
- $attachments = get_post_meta( $order_id, $btn['cow'], true );
1219
- if( !empty( $attachments ) ) {
1220
- // Check for delimiter
1221
- if( strstr( $attachments, '||' ) !== false )
1222
- $attachments = explode( '||', $attachments );
1223
- else if( strstr( $attachments, ',' ) !== false )
1224
- $attachments = explode( ',', $attachments );
1225
- else if( is_numeric( $attachments ) )
1226
- $attachments = array( $attachments );
1227
- }
1228
- echo '
1229
  <p class="form-field form-field-wide form-field-type-wooccmupload">
1230
- <strong>'.wooccm_wpml_string( trim( $btn['label'] ) ).':</strong>';
1231
- if( empty( $attachments ) ) {
1232
- echo '<br />';
1233
- echo '-';
1234
- }
1235
- echo '
1236
  </p>' . "\n";
1237
- if( !empty( $attachments ) ) {
1238
- echo '<ul>' . "\n";
1239
- foreach( $attachments as $attachment ) {
1240
- $attachment_url = wp_get_attachment_url( $attachment );
1241
- if( !empty( $attachment_url ) )
1242
- echo '<li><a href="' . $attachment_url . '" target="_blank">' . basename( $attachment_url ) . '</a></li>' . "\n";
1243
- }
1244
- echo '</ul>';
1245
- }
1246
- echo '
1247
  <!-- .form-field-type-wooccmupload -->';
1248
- }
1249
-
1250
- }
1251
- }
1252
-
1253
  }
1254
 
1255
  // Billing details
1256
- function wooccm_admin_edit_order_billing_details( $order ) {
1257
-
1258
- global $post;
1259
-
1260
- $order_id = ( isset( $post->ID ) ? $post->ID : false );
1261
-
1262
- $options = get_option( 'wccs_settings3' );
1263
- $buttons = ( isset( $options['billing_buttons'] ) ? $options['billing_buttons'] : false );
1264
- if( !empty( $buttons ) ) {
1265
- $fields = array(
1266
- 'country',
1267
- 'first_name',
1268
- 'last_name',
1269
- 'company',
1270
- 'address_1',
1271
- 'address_2',
1272
- 'city',
1273
- 'state',
1274
- 'postcode',
1275
- 'email',
1276
- 'phone'
1277
- );
1278
- foreach( $buttons as $btn ) {
1279
-
1280
- if( !in_array( $btn['cow'], $fields ) ) {
1281
- if(
1282
- ( get_post_meta( $order_id , sprintf( '_billing_%s', $btn['cow'] ), true ) !== '' ) &&
1283
- !empty( $btn['label'] ) &&
1284
- $btn['type'] !== 'heading' &&
1285
- $btn['type'] !== 'multiselect' &&
1286
- $btn['type'] !== 'wooccmupload' &&
1287
- $btn['type'] !== 'multicheckbox'
1288
- ) {
1289
- echo '
1290
  <p id="billing_' . $btn['cow'] . '" class="form-field form-field-wide form-field-type-' . $btn['type'] . '">
1291
- <strong title="' . sprintf( __( 'ID: %s | Field Type: %s', 'woocommerce-checkout-manager' ), sprintf( '_billing_%s', $btn['cow'] ), __( 'Generic', 'woocommerce-checkout-manager' ) ) . '">
1292
- '.wooccm_wpml_string( trim( $btn['label'] ) ).':</strong><br />'.nl2br( get_post_meta( $order_id , sprintf( '_billing_%s', $btn['cow'] ), true ) ).'
1293
  </p>
1294
  <!-- .form-field-type-... -->';
1295
- } elseif(
1296
- !empty( $btn['label'] ) &&
1297
- $btn['type'] !== 'wooccmupload' &&
1298
- $btn['type'] !== 'multiselect' &&
1299
- $btn['type'] !== 'multicheckbox' &&
1300
- $btn['type'] == 'heading'
1301
- ) {
1302
- echo '
1303
- <h4>' .wooccm_wpml_string( trim( $btn['label'] ) ). '</h4>';
1304
- } elseif(
1305
- ( get_post_meta( $order_id , sprintf( '_billing_%s', $btn['cow'] ), true ) !== '' ) &&
1306
- !empty( $btn['label'] ) &&
1307
- $btn['type'] !== 'heading' &&
1308
- $btn['type'] !== 'wooccmupload' &&
1309
- (
1310
- $btn['type'] == 'multiselect' || $btn['type'] == 'multicheckbox'
1311
- )
1312
- ) {
1313
- $value = get_post_meta( $order_id , sprintf( '_billing_%s', $btn['cow'] ), true );
1314
- $strings = maybe_unserialize( $value );
1315
-
1316
- echo '
1317
  <p class="form-field form-field-wide form-field-type-' . $btn['type'] . '">
1318
- <strong title="' . sprintf( __( 'ID: %s | Field Type: %s', 'woocommerce-checkout-manager' ), sprintf( '_billing_%s', $btn['cow'] ), __( 'Multi-Select or Multi-Checkbox', 'woocommerce-checkout-manager' ) ) . '">'.wooccm_wpml_string( trim( $btn['label'] ) ).':</strong> ';
1319
- if( !empty( $strings ) ) {
1320
- if( is_array( $strings ) ) {
1321
- $iww = 0;
1322
- $len = count( $strings );
1323
- foreach( $strings as $key ) {
1324
- if( $iww == $len - 1 ) {
1325
- echo wooccm_wpml_string( $key );
1326
- } else {
1327
- echo wooccm_wpml_string( $key ) . ', ';
1328
- }
1329
- $iww++;
1330
- }
1331
- } else {
1332
- echo $strings;
1333
- }
1334
- } else {
1335
- echo '-';
1336
- }
1337
- echo '
1338
  </p>
1339
  <!-- .form-field-type-multiselect .form-field-type-multicheckbox -->';
1340
- } elseif(
1341
- ( get_post_meta( $order_id , sprintf( '_billing_%s', $btn['cow'] ), true ) !== '' ) &&
1342
- $btn['type'] == 'wooccmupload'
1343
- ) {
1344
- $attachments = get_post_meta( $order_id, sprintf( '_billing_%s', $btn['cow'] ), true );
1345
- if( !empty( $attachments ) ) {
1346
- // Check for delimiter
1347
- if( strstr( $attachments, '||' ) !== false )
1348
- $attachments = explode( '||', $attachments );
1349
- else if( strstr( $attachments, ',' ) !== false )
1350
- $attachments = explode( ',', $attachments );
1351
- else if( is_numeric( $attachments ) )
1352
- $attachments = array( $attachments );
1353
- }
1354
- $btn['label'] = ( !empty( $btn['force_title2'] ) ? $btn['force_title2'] : $btn['label'] );
1355
- echo '
1356
  <p class="form-field form-field-wide form-field-type-wooccmupload">
1357
- <strong>'.wooccm_wpml_string( trim( $btn['label'] ) ).':</strong>';
1358
- if( empty( $attachments ) ) {
1359
- echo '<br />';
1360
- echo '-';
1361
- }
1362
- echo '
1363
  </p>' . "\n";
1364
- if( !empty( $attachments ) ) {
1365
- echo '<ul>' . "\n";
1366
- foreach( $attachments as $attachment ) {
1367
- $attachment_url = wp_get_attachment_url( $attachment );
1368
- if( !empty( $attachment_url ) )
1369
- echo '<li><a href="' . $attachment_url . '" target="_blank">' . basename( $attachment_url ) . '</a></li>' . "\n";
1370
- }
1371
- echo '</ul>';
1372
- }
1373
- echo '
1374
  <!-- .form-field-type-wooccmupload -->';
1375
- }
1376
- }
1377
-
1378
- }
1379
- }
1380
-
1381
  }
1382
 
1383
  // Shipping details
1384
- function wooccm_admin_edit_order_shipping_details( $order ) {
1385
-
1386
- global $post;
1387
-
1388
- $order_id = ( isset( $post->ID ) ? $post->ID : false );
1389
-
1390
- $options = get_option( 'wccs_settings2' );
1391
- $buttons = ( isset( $options['shipping_buttons'] ) ? $options['shipping_buttons'] : false );
1392
- if( !empty( $buttons ) ) {
1393
- $fields = array(
1394
- 'country',
1395
- 'first_name',
1396
- 'last_name',
1397
- 'company',
1398
- 'address_1',
1399
- 'address_2',
1400
- 'city',
1401
- 'state',
1402
- 'postcode'
1403
- );
1404
- foreach( $buttons as $btn ) {
1405
-
1406
- if( !in_array( $btn['cow'], $fields ) ) {
1407
- if(
1408
- ( get_post_meta( $order_id , sprintf( '_shipping_%s', $btn['cow'] ), true ) !== '' ) &&
1409
- !empty( $btn['label'] ) &&
1410
- $btn['type'] !== 'wooccmupload' &&
1411
- $btn['type'] !== 'heading' &&
1412
- $btn['type'] !== 'multiselect' &&
1413
- $btn['type'] !== 'multicheckbox'
1414
- ) {
1415
- echo '
1416
  <p id="shipping_' . $btn['cow'] . '" class="form-field form-field-wide form-field-type-' . $btn['type'] . '">
1417
- <strong title="' . sprintf( __( 'ID: %s | Field Type: %s', 'woocommerce-checkout-manager' ), sprintf( '_shipping_%s', $btn['cow'] ), __( 'Generic', 'woocommerce-checkout-manager' ) ) . '">
1418
- '.wooccm_wpml_string( trim( $btn['label'] ) ).':</strong><br />'.nl2br( get_post_meta( $order_id , sprintf( '_shipping_%s', $btn['cow'] ), true ) ).'
1419
  </p>
1420
  <!-- .form-field-type-... -->';
1421
- } elseif(
1422
- !empty( $btn['label'] ) &&
1423
- $btn['type'] !== 'multiselect' &&
1424
- $btn['type'] !== 'multicheckbox' &&
1425
- $btn['type'] == 'heading'
1426
- ) {
1427
- echo '
1428
- <h4>' .wooccm_wpml_string( trim( $btn['label'] ) ). '</h4>';
1429
- } elseif(
1430
- ( get_post_meta( $order_id, sprintf( '_shipping_%s', $btn['cow'] ), true ) !== '' ) &&
1431
- !empty( $btn['label'] ) &&
1432
- $btn['type'] !== 'heading' &&
1433
- $btn['type'] !== 'wooccmupload' &&
1434
- (
1435
- $btn['type'] == 'multiselect' || $btn['type'] == 'multicheckbox'
1436
- )
1437
- ) {
1438
- $value = get_post_meta( $order_id, sprintf( '_shipping_%s', $btn['cow'] ), true );
1439
- $strings = maybe_unserialize( $value );
1440
- echo '
1441
  <p class="form-field form-field-wide form-field-type-' . $btn['type'] . '">
1442
- <strong title="' . sprintf( __( 'ID: %s | Field Type: %s', 'woocommerce-checkout-manager' ), sprintf( '_shipping_%s', $btn['cow'] ), __( 'Multi-Select or Multi-Checkbox', 'woocommerce-checkout-manager' ) ) . '">'.wooccm_wpml_string( trim( $btn['label'] ) ).':</strong> ';
1443
- if( !empty( $strings ) ) {
1444
- if( is_array( $strings ) ) {
1445
- $iww = 0;
1446
- $len = count( $strings );
1447
- foreach( $strings as $key ) {
1448
- if( $iww == $len - 1 ) {
1449
- echo wooccm_wpml_string($key);
1450
- } else {
1451
- echo wooccm_wpml_string($key).', ';
1452
- }
1453
- $iww++;
1454
- }
1455
- } else {
1456
- echo $strings;
1457
- }
1458
- } else {
1459
- echo '-';
1460
- }
1461
- echo '
1462
  </p>
1463
  <!-- .form-field-type-multiselect .form-field-type-multicheckbox -->';
1464
- } elseif(
1465
- ( get_post_meta( $order_id , sprintf( '_shipping_%s', $btn['cow'] ), true ) !== '' ) &&
1466
- $btn['type'] == 'wooccmupload'
1467
- ) {
1468
- $attachments = get_post_meta( $order_id, sprintf( '_shipping_%s', $btn['cow'] ), true );
1469
- if( !empty( $attachments ) ) {
1470
- // Check for delimiter
1471
- if( strstr( $attachments, '||' ) !== false )
1472
- $attachments = explode( '||', $attachments );
1473
- else if( strstr( $attachments, ',' ) !== false )
1474
- $attachments = explode( ',', $attachments );
1475
- else if( is_numeric( $attachments ) )
1476
- $attachments = array( $attachments );
1477
- }
1478
- $btn['label'] = ( !empty( $btn['force_title2'] ) ? $btn['force_title2'] : $btn['label'] );
1479
- echo '
1480
  <p class="form-field form-field-wide form-field-type-wooccmupload">
1481
- <strong>'.wooccm_wpml_string( trim( $btn['label'] ) ).':</strong>';
1482
- echo '
1483
  </p>' . "\n";
1484
- if( !empty( $attachments ) && is_array( $attachments ) ) {
1485
- echo '<ul>' . "\n";
1486
- foreach( $attachments as $attachment ) {
1487
- $attachment_url = wp_get_attachment_url( $attachment );
1488
- if( !empty( $attachment_url ) )
1489
- echo '<li><a href="' . $attachment_url . '" target="_blank">' . basename( $attachment_url ) . '</a></li>' . "\n";
1490
- }
1491
- echo '</ul>';
1492
- } else {
1493
- echo '<br />';
1494
- echo '-';
1495
- }
1496
- echo '
1497
  <!-- .form-field-type-wooccmupload -->';
1498
- }
1499
- }
1500
-
1501
- }
1502
- }
1503
-
1504
  }
1505
 
1506
  function wooccm_validate_upload_process_customer() {
1507
 
1508
- $options = get_option( 'wccs_settings' );
1509
-
1510
- if( !empty($options['checkness']['enable_file_upload'])) {
1511
- return true;
1512
- } else {
1513
- return false;
1514
- }
1515
 
 
 
 
 
 
1516
  }
1517
 
1518
  // Check if the customer can upload images
1519
  // @mod - This disables the Order Uploaded Files meta box even for Administrators...?
1520
- if( wooccm_validate_upload_process_customer() ) {
1521
- add_action( 'woocommerce_view_order', 'wooccm_file_uploader_front_end' );
1522
- add_action( 'add_meta_boxes', 'wooccm_admin_edit_order_metaboxes' );
1523
  }
1524
 
1525
  function wooccm_admin_edit_order_metaboxes() {
1526
 
1527
- global $post;
1528
-
1529
- $post_type = 'shop_order';
1530
- add_meta_box( 'woocommerce-order-files', __( 'Order Uploaded Files', 'woocommerce-checkout-manager' ), 'wooccm_admin_edit_order_uploaded_files_meta_box', $post_type, 'normal', 'default' );
1531
 
 
 
1532
  }
1533
 
1534
- function wooccm_admin_edit_order_uploaded_files_meta_box( $post ) {
1535
-
1536
- global $wpdb, $thepostid, $theorder, $woocommerce, $post;
1537
-
1538
- $order_id = ( isset( $post->ID ) ? $post->ID : false );
1539
-
1540
- $options = get_option( 'wccs_settings' );
1541
-
1542
- $upload_dir = wp_upload_dir();
1543
-
1544
- $array = array();
1545
- $default_wccm_values = '';
1546
- $product_image_gallery = '';
1547
-
1548
- $post_type = 'attachment';
1549
- $args = array(
1550
- 'post_type' => $post_type,
1551
- 'numberposts' => -1,
1552
- 'post_status' => null,
1553
- 'post_parent' => $order_id
1554
- );
1555
- $posts = get_posts( $args );
1556
- // wooccm_error_log( 'posts: ' . print_r( $posts, true ) );
1557
- // @mod - Legacy versions were not correctly saving Post Parent so let's do a search if no results were returned
1558
- if( empty( $posts ) ) {
1559
-
1560
- $meta_keys = array();
1561
-
1562
- // Additional section
1563
- $options = get_option( 'wccs_settings' );
1564
- $buttons = ( isset( $options['buttons'] ) ? $options['buttons'] : false );
1565
- if( !empty( $buttons ) ) {
1566
- foreach( $buttons as $btn ) {
1567
- if( $btn['type'] == 'wooccmupload' )
1568
- $meta_keys[] = $btn['cow'];
1569
- }
1570
- }
1571
- // Billing section
1572
- $options = get_option( 'wccs_settings3' );
1573
- $buttons = ( isset( $options['billing_buttons'] ) ? $options['billing_buttons'] : false );
1574
- if( !empty( $buttons ) ) {
1575
- foreach( $buttons as $btn ) {
1576
- if( $btn['type'] == 'wooccmupload' )
1577
- $meta_keys[] = sprintf( '_billing_%s', $btn['cow'] );
1578
- }
1579
- }
1580
- // Shipping section
1581
- $options = get_option( 'wccs_settings2' );
1582
- $buttons = ( isset( $options['shipping_buttons'] ) ? $options['shipping_buttons'] : false );
1583
- if( !empty( $buttons ) ) {
1584
- foreach( $buttons as $btn ) {
1585
- if( $btn['type'] == 'wooccmupload' )
1586
- $meta_keys[] = sprintf( '_shipping_%s', $btn['cow'] );
1587
- }
1588
- }
1589
-
1590
- if( !empty( $meta_keys ) ) {
1591
- $values = array();
1592
- // Check the Order for these meta keys
1593
- foreach( $meta_keys as $meta_key ) {
1594
- $value = get_post_meta( $order_id, $meta_key, true );
1595
- if( !empty( $value ) ) {
1596
- if( is_array( $value ) )
1597
- $array[] = implode( ',', $value );
1598
- else
1599
- $array[] = $value;
1600
- }
1601
- }
1602
- }
1603
-
1604
- }
1605
- // Check if there are any attachments
1606
- if( !empty( $posts ) || !empty( $array ) ) {
1607
- if( !empty( $posts ) ) {
1608
- foreach( $posts as $attachment ) {
1609
- $array[] = $attachment->ID;
1610
- }
1611
- }
1612
- $default_wccm_values = implode( ',', $array );
1613
- $product_image_gallery = implode( ',', $array );
1614
- // wooccm_error_log( 'default_wccm_values: ' . print_r( $default_wccm_values, true ) );
1615
- // wooccm_error_log( 'product_image_gallery: ' . print_r( $product_image_gallery, true ) );
1616
- }
1617
-
1618
- $attachments = array_filter( explode( ',', $product_image_gallery ) );
1619
- // wooccm_error_log( 'attachments: ' . print_r( $attachments, true ) );
1620
- ?>
1621
-
1622
- <script type="text/javascript">
1623
- jQuery(document).ready(function($) {
1624
-
1625
- $('#wccm_save_order_submit').click(function() {
1626
- $(".wccm_results").html( "<?php _e( 'Saving, please wait...', 'woocommerce-checkout-manager' ); ?>" );
1627
- var data = {
1628
- action: 'update_attachment_wccm',
1629
- post_id : '<?php echo $post->ID; ?>',
1630
- product_image_gallery : $('#product_image_gallery').val(),
1631
- wccm_default_keys_load : $('#wccm_default_keys_load').val()
1632
- };
1633
-
1634
- // since 2.8 ajaxurl is always defined in the admin header and points to admin-ajax.php
1635
- $.post(ajaxurl, data, function(response) {
1636
- $(".wccm_results").html(response);
1637
- });
1638
- });
1639
-
1640
- });
1641
- </script>
1642
-
1643
- <?php wp_enqueue_style( 'wccm_upload_file_style', plugins_url( 'includes/templates/admin/edit-order-uploads-file_editing_table.css', WOOCCM_RELPATH ) ); ?>
1644
-
1645
- <div class="woocommerce_order_items_wrapper">
1646
- <table class="woocommerce_order_items back_end">
1647
-
1648
- <thead>
1649
- <tr>
1650
- <th nowrap>
1651
- <attr title="<?php _e( 'Attachment ID', 'woocommerce-checkout-manager' ); ?>"><?php _e('ID','woocommerce-checkout-manager'); ?></attr>
1652
- </th>
1653
- <th><?php _e( 'Image', 'woocommerce-checkout-manager' ); ?></th>
1654
- <th><?php _e( 'Filename', 'woocommerce-checkout-manager' ); ?></th>
1655
- <th><?php _e( 'Dimensions', 'woocommerce-checkout-manager' ); ?></th>
1656
- <th><?php _e( 'Extension',' woocommerce-checkout-manager' ); ?></th>
1657
- <th class="column-actions"><?php _e( 'Actions', 'woocommerce-checkout-manager' ); ?></th>
1658
- </tr>
1659
- </thead>
1660
-
1661
- <tbody class="product_images">
1662
- <?php
1663
- if( !empty( $attachments ) ) {
1664
- foreach ( $attachments as $attachment_id ) {
1665
-
1666
- $image_attributes = wp_get_attachment_url( $attachment_id );
1667
- $image_attributes2 = wp_get_attachment_image_src( $attachment_id );
1668
- $filename = basename( $image_attributes );
1669
- $wp_filetype = wp_check_filetype( $filename );
1670
-
1671
- $value_declear = array_diff( explode( ',',$default_wccm_values ), explode( ',', $attachment_id ) );
1672
-
1673
- echo '
1674
- <tr class="image wccm_filesli wccmv_' . esc_attr( $attachment_id ) . '">
1675
  <script type="text/javascript">
1676
  jQuery(document).ready(function(){
1677
- jQuery(".wccmx_' . esc_attr( $attachment_id ) . '").click(function(){
1678
 
1679
- jQuery(".wccmv_' . esc_attr( $attachment_id ) . '").hide();
1680
- jQuery("#product_image_gallery").val(jQuery("#product_image_gallery").val().replace("'.esc_attr( $attachment_id ).'", ""));
1681
 
1682
  });
1683
  });
1684
  </script>
1685
  <td>' . $attachment_id . '</td>
1686
- <td>' . wp_get_attachment_link( $attachment_id, '' , false, false, wp_get_attachment_image( $attachment_id, array( 75, 75 ), false ) ) . '</td>
1687
- <td>' . wp_get_attachment_link( $attachment_id, '' , false, false, preg_replace( '/\.[^.]+$/', '', $filename ) ) . '</td>
1688
  <td>';
1689
- if( $image_attributes2[1] == '' ) {
1690
- echo '-';
1691
- } else {
1692
- echo $image_attributes2[1] . ' x ' . $image_attributes2[2];
1693
- }
1694
- echo '</td>
1695
- <td>' . strtoupper( $wp_filetype['ext'] ) . '</td>
1696
  <td class="column-actions" nowrap>
1697
- <a href="' . $image_attributes2[0] . '" target="_blank" class="button">' . __( 'Download', 'woocommerce-checkout-manager' ) . '</a>
1698
- <a class="delete tips wccm_delete wccmx_' . esc_attr( $attachment_id ) . ' button" data-tip="' . __( 'Delete file', 'woocommerce-checkout-manager' ) . '">' . __( 'Delete file', 'woocommerce-checkout-manager' ) . '</a>
1699
  </td>
1700
  </tr>
1701
  ';
1702
-
1703
- }
1704
- } else {
1705
- echo '
1706
  <tr>
1707
- <td colspan="6" style="text-align:left;">' . __( 'No files have been uploaded to this Order.', 'woocommerce-checkout-manager' ) . '</td>
1708
  </tr>';
1709
- }
1710
- ?>
1711
- </tbody>
1712
- </table>
1713
- <input type="hidden" class="wccm_add_to_list" id="product_image_gallery" name="product_image_gallery" value="<?php echo esc_attr( $product_image_gallery ); ?>" />
1714
- <input type="hidden" id="wccm_default_keys_load" name="wccm_default_keys_load" value="<?php echo esc_attr( $default_wccm_values ); ?>" />
1715
- <!-- .woocommerce_order_items -->
1716
-
1717
- <p class="add_product_images hide-if-no-js">
1718
- <form method="POST" action="">
1719
- <span class="btn button-primary wccm_add_order_link fileinput-button">
1720
- <span><?php _e( 'Add Order Files', 'woocommerce-checkout-manager' ); ?></span>
1721
- <input type="file" name="files_wccm" id="files_wccm" multiple />
1722
- <button type="button" id="files_button_wccm"><?php _e( 'Upload Files!', 'woocommerce-checkout-manager' ); ?></button>
1723
- </span>
1724
- </form>
1725
- </p>
1726
-
1727
- <!-- Edit Order: File upload -->
1728
- <script type="text/javascript">
1729
- jQuery(document).ready(function($){(
1730
-
1731
- function post_image_content() {