WP eCommerce - Version 3.12.4

Version Description

[2017-9-23] =

  • Fix: Disable Theme Engine V2 by default. (Not yet released)
Download this release

Release Info

Developer JustinSainton
Plugin Icon 128x128 WP eCommerce
Version 3.12.4
Comparing to
See all releases

Code changes from version 3.12.3 to 3.12.4

Files changed (93) hide show
  1. readme.txt +6 -2
  2. trunk/bin/install-wp-tests.sh +0 -78
  3. trunk/images/cc.gif +0 -0
  4. trunk/images/cc.png +0 -0
  5. trunk/images/icon_window_collapse.gif +0 -0
  6. trunk/images/icon_window_expand.gif +0 -0
  7. trunk/images/indicator.gif +0 -0
  8. trunk/images/paypal.gif +0 -0
  9. trunk/license.txt +0 -281
  10. trunk/readme.txt +0 -945
  11. trunk/screenshot-1.png +0 -0
  12. trunk/screenshot-2.png +0 -0
  13. trunk/screenshot-3.png +0 -0
  14. trunk/screenshot-4.png +0 -0
  15. trunk/wp-shopping-cart.php +0 -353
  16. trunk/wpsc-admin/admin-form-functions.php +0 -265
  17. trunk/wpsc-admin/admin.php +0 -1588
  18. trunk/wpsc-admin/ajax-and-init.php +0 -221
  19. trunk/wpsc-admin/ajax.php +0 -1394
  20. trunk/wpsc-admin/css/admin.css +0 -2676
  21. trunk/wpsc-admin/css/arrows.png +0 -0
  22. trunk/wpsc-admin/css/jquery.ui.datepicker-classic.css +0 -579
  23. trunk/wpsc-admin/css/jquery.ui.datepicker-fresh.css +0 -579
  24. trunk/wpsc-admin/css/jquery.ui.tabs.css +0 -152
  25. trunk/wpsc-admin/css/loading-small.gif +0 -0
  26. trunk/wpsc-admin/css/media.css +0 -26
  27. trunk/wpsc-admin/css/settingspage.css +0 -485
  28. trunk/wpsc-admin/css/ui-images/ui-icons_21759b_256x240.png +0 -0
  29. trunk/wpsc-admin/css/ui-images/ui-icons_333333_256x240.png +0 -0
  30. trunk/wpsc-admin/css/ui-images/ui-icons_999999_256x240.png +0 -0
  31. trunk/wpsc-admin/css/ui-images/ui-icons_cc0000_256x240.png +0 -0
  32. trunk/wpsc-admin/css/xit.gif +0 -0
  33. trunk/wpsc-admin/db-upgrades/routines/1.php +0 -142
  34. trunk/wpsc-admin/db-upgrades/routines/10.php +0 -134
  35. trunk/wpsc-admin/db-upgrades/routines/11.php +0 -83
  36. trunk/wpsc-admin/db-upgrades/routines/12.php +0 -55
  37. trunk/wpsc-admin/db-upgrades/routines/13.php +0 -54
  38. trunk/wpsc-admin/db-upgrades/routines/14.php +0 -28
  39. trunk/wpsc-admin/db-upgrades/routines/2.php +0 -430
  40. trunk/wpsc-admin/db-upgrades/routines/3.php +0 -18
  41. trunk/wpsc-admin/db-upgrades/routines/4.php +0 -53
  42. trunk/wpsc-admin/db-upgrades/routines/5.php +0 -49
  43. trunk/wpsc-admin/db-upgrades/routines/6.php +0 -12
  44. trunk/wpsc-admin/db-upgrades/routines/7.php +0 -36
  45. trunk/wpsc-admin/db-upgrades/routines/8.php +0 -12
  46. trunk/wpsc-admin/db-upgrades/routines/9.php +0 -13
  47. trunk/wpsc-admin/db-upgrades/upgrade.php +0 -155
  48. trunk/wpsc-admin/db-upgrades/views/main.php +0 -11
  49. trunk/wpsc-admin/display-coupon-add.php +0 -133
  50. trunk/wpsc-admin/display-coupon-edit.php +0 -183
  51. trunk/wpsc-admin/display-coupons.php +0 -140
  52. trunk/wpsc-admin/display-items.page.php +0 -584
  53. trunk/wpsc-admin/display-options-settings.page.php +0 -72
  54. trunk/wpsc-admin/display-sales-logs.php +0 -824
  55. trunk/wpsc-admin/display-update.page.php +0 -122
  56. trunk/wpsc-admin/display-upgrades.page.php +0 -180
  57. trunk/wpsc-admin/includes/coupon-list-table-class.php +0 -484
  58. trunk/wpsc-admin/includes/display-items-functions.php +0 -1687
  59. trunk/wpsc-admin/includes/duplicate-product-class.php +0 -446
  60. trunk/wpsc-admin/includes/product-functions.php +0 -1231
  61. trunk/wpsc-admin/includes/product-variation-list-table.class.php +0 -678
  62. trunk/wpsc-admin/includes/product-variations-manage.page.php +0 -13
  63. trunk/wpsc-admin/includes/product-variations-page.class.php +0 -437
  64. trunk/wpsc-admin/includes/product-variations-setup.page.php +0 -40
  65. trunk/wpsc-admin/includes/product-variations.page.php +0 -59
  66. trunk/wpsc-admin/includes/products.php +0 -1
  67. trunk/wpsc-admin/includes/purchase-log-action-links.php +0 -482
  68. trunk/wpsc-admin/includes/purchase-log-list-table-class.php +0 -872
  69. trunk/wpsc-admin/includes/purchase-logs-page/bulk-delete-confirm.php +0 -9
  70. trunk/wpsc-admin/includes/purchase-logs-page/item-details.php +0 -120
  71. trunk/wpsc-admin/includes/purchase-logs-page/list-table.php +0 -83
  72. trunk/wpsc-admin/includes/purchase-logs-page/packing-slip.php +0 -162
  73. trunk/wpsc-admin/includes/purchase-logs-page/upgrade.php +0 -45
  74. trunk/wpsc-admin/includes/save-data.functions.php +0 -577
  75. trunk/wpsc-admin/includes/settings-tabs/admin.php +0 -153
  76. trunk/wpsc-admin/includes/settings-tabs/checkout.php +0 -525
  77. trunk/wpsc-admin/includes/settings-tabs/gateway.php +0 -168
  78. trunk/wpsc-admin/includes/settings-tabs/general.php +0 -240
  79. trunk/wpsc-admin/includes/settings-tabs/import.php +0 -367
  80. trunk/wpsc-admin/includes/settings-tabs/marketing.php +0 -210
  81. trunk/wpsc-admin/includes/settings-tabs/shipping.php +0 -344
  82. trunk/wpsc-admin/includes/settings-tabs/taxes.php +0 -221
  83. trunk/wpsc-admin/includes/tax_and_shipping.php +0 -67
  84. trunk/wpsc-admin/includes/updating-functions.php +0 -898
  85. trunk/wpsc-admin/includes/walker-variation-checklist.php +0 -57
  86. trunk/wpsc-admin/init.php +0 -894
  87. trunk/wpsc-admin/js/admin-legacy.js +0 -1066
  88. trunk/wpsc-admin/js/admin.js +0 -665
  89. trunk/wpsc-admin/js/media.js +0 -401
  90. trunk/wpsc-admin/js/product-variations.js +0 -249
  91. trunk/wpsc-admin/js/purchase-log-action-links.js +0 -126
  92. trunk/wpsc-admin/js/purchase-logs.js +0 -693
  93. trunk/wpsc-admin/js/quick-edit.js +0 -17
readme.txt CHANGED
@@ -3,8 +3,8 @@ Contributors: JustinSainton
3
  Donate link: https://wpecommerce.org
4
  Tags: e-commerce, digital downloads, wp-e-commerce, shop, cart, paypal, authorize, stock control, ecommerce, shipping, tax
5
  Requires at least: 4.5
6
- Tested up to: 4.8.1
7
- Stable tag: 3.12.3
8
 
9
  WP eCommerce is a free, powerful plugin that empowers you to sell anything online, quickly and easily.
10
 
@@ -36,6 +36,10 @@ After upgrading from earlier versions look for link "Update Store". This will up
36
 
37
  == Changelog ==
38
 
 
 
 
 
39
  = 3.12.3 [2017-9-16] =
40
 
41
  * Fix: When using the Capture workflow on a previously Authorized transaction and it failed the wrong error message was returned.
3
  Donate link: https://wpecommerce.org
4
  Tags: e-commerce, digital downloads, wp-e-commerce, shop, cart, paypal, authorize, stock control, ecommerce, shipping, tax
5
  Requires at least: 4.5
6
+ Tested up to: 4.8.2
7
+ Stable tag: 3.12.4
8
 
9
  WP eCommerce is a free, powerful plugin that empowers you to sell anything online, quickly and easily.
10
 
36
 
37
  == Changelog ==
38
 
39
+ = 3.12.4 [2017-9-23] =
40
+
41
+ * Fix: Disable Theme Engine V2 by default. (Not yet released)
42
+
43
  = 3.12.3 [2017-9-16] =
44
 
45
  * Fix: When using the Capture workflow on a previously Authorized transaction and it failed the wrong error message was returned.
trunk/bin/install-wp-tests.sh DELETED
@@ -1,78 +0,0 @@
1
- #!/usr/bin/env bash
2
-
3
- if [ $# -lt 3 ]; then
4
- echo "usage: $0 <db-name> <db-user> <db-pass> [db-host] [wp-version]"
5
- exit 1
6
- fi
7
-
8
- DB_NAME=$1
9
- DB_USER=$2
10
- DB_PASS=$3
11
- DB_HOST=${4-localhost}
12
- WP_VERSION=${5-latest}
13
-
14
- WP_TESTS_DIR=${WP_TESTS_DIR-/tmp/wordpress-tests-lib}
15
- WP_CORE_DIR=/tmp/wordpress/
16
-
17
- set -ex
18
-
19
- install_wp() {
20
- mkdir -p $WP_CORE_DIR
21
-
22
- if [ $WP_VERSION == 'latest' ]; then
23
- local ARCHIVE_NAME='latest'
24
- else
25
- local ARCHIVE_NAME="wordpress-$WP_VERSION"
26
- fi
27
-
28
- wget -nv -O /tmp/wordpress.tar.gz http://wordpress.org/${ARCHIVE_NAME}.tar.gz
29
- tar --strip-components=1 -zxmf /tmp/wordpress.tar.gz -C $WP_CORE_DIR
30
-
31
- wget -nv -O $WP_CORE_DIR/wp-content/db.php https://raw.github.com/markoheijnen/wp-mysqli/master/db.php
32
- }
33
-
34
- install_test_suite() {
35
- # portable in-place argument for both GNU sed and Mac OSX sed
36
- if [[ $(uname -s) == 'Darwin' ]]; then
37
- local ioption='-i .bak'
38
- else
39
- local ioption='-i'
40
- fi
41
-
42
- # set up testing suite
43
- mkdir -p $WP_TESTS_DIR
44
- cd $WP_TESTS_DIR
45
- svn co --quiet http://develop.svn.wordpress.org/trunk/tests/phpunit/includes/
46
-
47
- wget -nv -O wp-tests-config.php http://develop.svn.wordpress.org/trunk/wp-tests-config-sample.php
48
- sed $ioption "s:dirname( __FILE__ ) . '/src/':'$WP_CORE_DIR':" wp-tests-config.php
49
- sed $ioption "s/youremptytestdbnamehere/$DB_NAME/" wp-tests-config.php
50
- sed $ioption "s/yourusernamehere/$DB_USER/" wp-tests-config.php
51
- sed $ioption "s/yourpasswordhere/$DB_PASS/" wp-tests-config.php
52
- sed $ioption "s|localhost|${DB_HOST}|" wp-tests-config.php
53
- }
54
-
55
- install_db() {
56
- # parse DB_HOST for port or socket references
57
- local PARTS=(${DB_HOST//\:/ })
58
- local DB_HOSTNAME=${PARTS[0]};
59
- local DB_SOCK_OR_PORT=${PARTS[1]};
60
- local EXTRA=""
61
-
62
- if ! [ -z $DB_HOSTNAME ] ; then
63
- if [[ "$DB_SOCK_OR_PORT" =~ ^[0-9]+$ ]] ; then
64
- EXTRA=" --host=$DB_HOSTNAME --port=$DB_SOCK_OR_PORT --protocol=tcp"
65
- elif ! [ -z $DB_SOCK_OR_PORT ] ; then
66
- EXTRA=" --socket=$DB_SOCK_OR_PORT"
67
- elif ! [ -z $DB_HOSTNAME ] ; then
68
- EXTRA=" --host=$DB_HOSTNAME --protocol=tcp"
69
- fi
70
- fi
71
-
72
- # create database
73
- mysqladmin create $DB_NAME --user="$DB_USER" --password="$DB_PASS"$EXTRA
74
- }
75
-
76
- install_wp
77
- install_test_suite
78
- install_db
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
trunk/images/cc.gif DELETED
Binary file
trunk/images/cc.png DELETED
Binary file
trunk/images/icon_window_collapse.gif DELETED
Binary file
trunk/images/icon_window_expand.gif DELETED
Binary file
trunk/images/indicator.gif DELETED
Binary file
trunk/images/paypal.gif DELETED
Binary file
trunk/license.txt DELETED
@@ -1,281 +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 St, Fifth Floor, Boston, MA 02110, USA
6
-
7
- Everyone is permitted to copy and distribute verbatim copies
8
- of this license document, but changing it is not allowed.
9
-
10
- Preamble
11
-
12
- The licenses for most software are designed to take away your
13
- freedom to share and change it. By contrast, the GNU General Public
14
- License is intended to guarantee your freedom to share and change free
15
- software--to make sure the software is free for all its users. This
16
- General Public License applies to most of the Free Software
17
- Foundation's software and to any other program whose authors commit to
18
- using it. (Some other Free Software Foundation software is covered by
19
- the GNU Library General Public License instead.) You can apply it to
20
- your programs, too.
21
-
22
- When we speak of free software, we are referring to freedom, not
23
- price. Our General Public Licenses are designed to make sure that you
24
- have the freedom to distribute copies of free software (and charge for
25
- this service if you wish), that you receive source code or can get it
26
- if you want it, that you can change the software or use pieces of it
27
- in new free programs; and that you know you can do these things.
28
-
29
- To protect your rights, we need to make restrictions that forbid
30
- anyone to deny you these rights or to ask you to surrender the rights.
31
- These restrictions translate to certain responsibilities for you if you
32
- distribute copies of the software, or if you modify it.
33
-
34
- For example, if you distribute copies of such a program, whether
35
- gratis or for a fee, you must give the recipients all the rights that
36
- you have. You must make sure that they, too, receive or can get the
37
- source code. And you must show them these terms so they know their
38
- rights.
39
-
40
- We protect your rights with two steps: (1) copyright the software, and
41
- (2) offer you this license which gives you legal permission to copy,
42
- distribute and/or modify the software.
43
-
44
- Also, for each author's protection and ours, we want to make certain
45
- that everyone understands that there is no warranty for this free
46
- software. If the software is modified by someone else and passed on, we
47
- want its recipients to know that what they have is not the original, so
48
- that any problems introduced by others will not reflect on the original
49
- authors' reputations.
50
-
51
- Finally, any free program is threatened constantly by software
52
- patents. We wish to avoid the danger that redistributors of a free
53
- program will individually obtain patent licenses, in effect making the
54
- program proprietary. To prevent this, we have made it clear that any
55
- patent must be licensed for everyone's free use or not licensed at all.
56
-
57
- The precise terms and conditions for copying, distribution and
58
- modification follow.
59
-
60
- GNU GENERAL PUBLIC LICENSE
61
- TERMS AND CONDITIONS FOR COPYING, DISTRIBUTION AND MODIFICATION
62
-
63
- 0. This License applies to any program or other work which contains
64
- a notice placed by the copyright holder saying it may be distributed
65
- under the terms of this General Public License. The "Program", below,
66
- refers to any such program or work, and a "work based on the Program"
67
- means either the Program or any derivative work under copyright law:
68
- that is to say, a work containing the Program or a portion of it,
69
- either verbatim or with modifications and/or translated into another
70
- language. (Hereinafter, translation is included without limitation in
71
- the term "modification".) Each licensee is addressed as "you".
72
-
73
- Activities other than copying, distribution and modification are not
74
- covered by this License; they are outside its scope. The act of
75
- running the Program is not restricted, and the output from the Program
76
- is covered only if its contents constitute a work based on the
77
- Program (independent of having been made by running the Program).
78
- Whether that is true depends on what the Program does.
79
-
80
- 1. You may copy and distribute verbatim copies of the Program's
81
- source code as you receive it, in any medium, provided that you
82
- conspicuously and appropriately publish on each copy an appropriate
83
- copyright notice and disclaimer of warranty; keep intact all the
84
- notices that refer to this License and to the absence of any warranty;
85
- and give any other recipients of the Program a copy of this License
86
- along with the Program.
87
-
88
- You may charge a fee for the physical act of transferring a copy, and
89
- you may at your option offer warranty protection in exchange for a fee.
90
-
91
- 2. You may modify your copy or copies of the Program or any portion
92
- of it, thus forming a work based on the Program, and copy and
93
- distribute such modifications or work under the terms of Section 1
94
- above, provided that you also meet all of these conditions:
95
-
96
- a) You must cause the modified files to carry prominent notices
97
- stating that you changed the files and the date of any change.
98
-
99
- b) You must cause any work that you distribute or publish, that in
100
- whole or in part contains or is derived from the Program or any
101
- part thereof, to be licensed as a whole at no charge to all third
102
- parties under the terms of this License.
103
-
104
- c) If the modified program normally reads commands interactively
105
- when run, you must cause it, when started running for such
106
- interactive use in the most ordinary way, to print or display an
107
- announcement including an appropriate copyright notice and a
108
- notice that there is no warranty (or else, saying that you provide
109
- a warranty) and that users may redistribute the program under
110
- these conditions, and telling the user how to view a copy of this
111
- License. (Exception: if the Program itself is interactive but
112
- does not normally print such an announcement, your work based on
113
- the Program is not required to print an announcement.)
114
-
115
- These requirements apply to the modified work as a whole. If
116
- identifiable sections of that work are not derived from the Program,
117
- and can be reasonably considered independent and separate works in
118
- themselves, then this License, and its terms, do not apply to those
119
- sections when you distribute them as separate works. But when you
120
- distribute the same sections as part of a whole which is a work based
121
- on the Program, the distribution of the whole must be on the terms of
122
- this License, whose permissions for other licensees extend to the
123
- entire whole, and thus to each and every part regardless of who wrote it.
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
-
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
trunk/readme.txt DELETED
@@ -1,945 +0,0 @@
1
- === WP eCommerce ===
2
- Contributors: JustinSainton
3
- Donate link: https://wpecommerce.org
4
- Tags: e-commerce, digital downloads, wp-e-commerce, shop, cart, paypal, authorize, stock control, ecommerce, shipping, tax
5
- Requires at least: 4.5
6
- Tested up to: 4.8.1
7
- Stable tag: 3.12.3
8
-
9
- WP eCommerce is a free, powerful plugin that empowers you to sell anything online, quickly and easily.
10
-
11
- == Description ==
12
-
13
- Since 2006, we've been helping entrepreneurs just like you realize their goal of selling online. Whether you're hoping to sell digital downloads, physical inventory, or subscriptions and memberships - with WP eCommerce, you're only minutes away from your next sale.
14
-
15
- * Make the plugin your own with CSS and HTML customizations
16
- * Learn quickly with our [video tutorials](http://docs.wpecommerce.org/category/video-tutorials/)
17
- * Integration with [dozens of different payment gateways](https://wpecommerce.org/store/)
18
- * Integrate with many popular WordPress plugins
19
- * Use built-in marketing tools to sell more
20
- * Shipping is easy with built in shipping tools and integration with popular couriers
21
- * Secure check-out with SSL
22
- * Manage your orders and catalogues with powerful built-in tools
23
- * Extend your eCommerce site with [additional modules](https://wpecommerce.org/store/)
24
- * Integrate with WordPress multisite
25
- * With hundreds of available hooks, developers can make WP eCommerce do anything you can imagine
26
-
27
- == Installation ==
28
-
29
- 1. Upload the folder 'wp-e-commerce' to the '/wp-content/plugins/' directory
30
- 2. Activate the plugin through the 'Plugins' menu in WordPress
31
-
32
- = Updating =
33
-
34
- Before updating please make a backup of your existing files and database. Just in case.
35
- After upgrading from earlier versions look for link "Update Store". This will update your database structure to work with new version.
36
-
37
- == Changelog ==
38
-
39
- = 3.12.3 [2017-9-16] =
40
-
41
- * Fix: When using the Capture workflow on a previously Authorized transaction and it failed the wrong error message was returned.
42
- * Fix: When using the Refund feature and doing a full refund the correct ajax response will be returned.
43
- * Fix: When an order has been fully refunded doesn't show the Refund button anymore.
44
- * Enhancement: Updated pot file.
45
- * Enhancement: Payment Gateway API can use default credit card fields for Theme Engine 1.0 and they can be filtered too.
46
- * Enhancement: Several Theme Engine 2.0 style changes.
47
-
48
- = 3.12.2 [2017-3-25] =
49
-
50
- * Enhancement: Default PayPal Credit to On, and ensure it is functional for our 1.0 theme engine.
51
-
52
- = 3.12.1 [2017-3-24] =
53
-
54
- * New: Addition of PayPal Credit to PayPal Express Checkout.
55
- * Fix: Ensure WPEC works via WP-CLI.
56
-
57
- = 3.12.0 [2017-2-17] =
58
-
59
- * Fix: When updating a pending order, ensure that the order object's total price is updated as well.
60
- * Fix: Update admin.js to not use deprecated size() method.
61
- * Fix: Currency code was incorrectly cached.
62
- * Fix: Express Checkout 3.0 JavaScript now properly enqueued.
63
- * Enhancement: 2.0 Theme Engine now supports floating labels.
64
- * Enhancement: Payment Gateway API now fully supports Auth/Capture workflows, in addition to refunds and partial refunds introduced in 3.11.5
65
- * New: Addition of ProPay (TSYS) Gateway.
66
-
67
- = 3.11.7 [2017-2-05] =
68
-
69
- * Fix: In PHP versions prior to 5.5, we caused a fatal error. Our apologies are sincere, but update your PHP! Literally the same problem resolved in 3.11.6, just in a different context. We'll get better at supporting EOL PHP, the WordPress way.
70
-
71
- = 3.11.6 [2017-2-05] =
72
-
73
- * Fix: In PHP versions prior to 5.5, we caused a fatal error. Our apologies are sincere, but update your PHP!
74
-
75
- = 3.11.5 [2017-2-04] =
76
-
77
- * Fix: Our extension page had some dated code which, in a bizarre turn of events, caused bulk select to break for all list tables. Mystery of mysteries, solved.
78
- * Fix: Fix PHPMailer issue for emails failing to send when admin email is empty.
79
- * Enhancement: Addition of In-Context Checkout for PayPal Express (3.0)
80
- * Enhancement: Addition of Order Notes API
81
- * Enhancement: Addition of Refund API (including partial refunds)
82
- * Enhancement: Addition of ability to edit pending orders.
83
-
84
- = 3.11.4 [2016-11-11] =
85
-
86
- * Security Fix: Under specific conditions (Gold Cart enabled, using eWay as a payment processor, and using the yet-to-be-released 2.0 Theme Engine) - a SQL vulnerability has been patched.
87
-
88
- = 3.11.3 [2016-5-23] =
89
-
90
- * Fix: WordPress 4.4 introduced changes to the WPDB class that caused loosely typed data to fail upon insert, causing empty cart contents entries when taxes were applied and coupons not being created.
91
- * Fix: Pagination on purchase logs was broken. Now, it's not.
92
- * Fix: Now, you can upload category images when editing product categories, not just when adding them.
93
- * Fix: A random and quite awful bug was causing the "collapse menu" toggle to be perpetually collapsed if you collapsed it even once. No more!
94
- * Enhancement: Addition of premium product license activation functionality on licensing page.
95
-
96
- = 3.11.2 =
97
-
98
- * Fix: WordPress 4.4 introduced changes to the WPDB class that caused loosely typed data to fail upon insert, causing empty purchase logs.
99
-
100
- = 3.11.1 =
101
-
102
- * Fix: Amazon Payments caused fatal errors on PHP 5.2. See [#2026](https://github.com/wp-e-commerce/WP-e-Commerce/issues/2026).
103
- * Fix: Our translation update was too fast, too furious. We accidentally replaced a string we didn't intend to replace. This broke pagination for products. We feel pretty bad about that.
104
-
105
- = 3.11.0 =
106
-
107
- * _Potentially breaking change_: wpsc_add_to_cart() now checks the `$_REQUEST` super global, rather than `$_POST`. This allows for future features, such as populating carts from a URL token, etc. Anywhere you may have code that checks for $_POST, in this context, it should now check $_REQUEST. See [#1852](https://github.com/wp-e-commerce/WP-e-Commerce/issues/1852).
108
- * Fix: Improvements to internationalization across the board, including updates to introduce compatibility for translate.wordpress.org.
109
- * Fix: Show admin notice if administrator has not set any target markets. See [#711](https://github.com/wp-e-commerce/WP-e-Commerce/issues/711).
110
- * Fix: Check post_status more stringently in single page template controller. See [#844](https://github.com/wp-e-commerce/WP-e-Commerce/issues/844).
111
- * Fix: The Google Analytics integration was calculating products once, not once per quantity in the cart. See [#1718](https://github.com/wp-e-commerce/WP-e-Commerce/issues/1718).
112
- * Fix: The Google Analytics integration was incompatible with the Yoast Analytics plugin. See [#1736](https://github.com/wp-e-commerce/WP-e-Commerce/issues/1736).
113
- * Fix: Resolve scenarios where variation combinations for products that were unavailable could still allow for cart addition (adding the parent product, rather than the variation). See [#1373](https://github.com/wp-e-commerce/WP-e-Commerce/issues/1373).
114
- * Fix: Order totals on sales log page did not count Closed Orders, but did Orders Received. This has been reversed, as that is the paradigm used throughout the rest of the project. See [#1728](https://github.com/wp-e-commerce/WP-e-Commerce/issues/1728).
115
- * Fix: Deleting a purchase log now also deletes the purchase meta associated with that log. See [#1877](https://github.com/wp-e-commerce/WP-e-Commerce/issues/1877).
116
- * Fix: Deleting a purchase log now also deletes the download status entries for that log. See [#1964](https://github.com/wp-e-commerce/WP-e-Commerce/issues/1964).
117
- * Fix: In the rare occurrence that an insert for a purchase log entry fails, we now return an error saying so. See [#1892](https://github.com/wp-e-commerce/WP-e-Commerce/issues/1892).
118
- * Fix: When creating a variation, you should be limited to selecting only variation sets as parents, not other variations. See [#1893](https://github.com/wp-e-commerce/WP-e-Commerce/issues/1893).
119
- * Enhancement: General performance improvements surrounding meta retreival, especially for countries. Including caching, cache invalidation, etc. See [#1894](https://github.com/wp-e-commerce/WP-e-Commerce/issues/1894).
120
- * Enhancement: New 3.0 Payment Gateway API now has a method that checks for currencies that don't use fractions. Our code formally had several areas these currencies were hard-coded, and egregiously incomplete. See [#1917](https://github.com/wp-e-commerce/WP-e-Commerce/issues/1917).
121
- * Enhancement: Mass improvements to 2.0 theme engine. Bug fixes, rich markup support, and much more. Want to test it out before 4.0? We have a filter for that.
122
- * Enhancement: Filter bulk messages to reflect that users are updating products, not posts. See [#844](https://github.com/wp-e-commerce/WP-e-Commerce/issues/844).
123
- * Enhancement: Improvements to code for Australia Post. See [#1337](https://github.com/wp-e-commerce/WP-e-Commerce/issues/1337).
124
- * Enhancement: Standardize on a single, filterable method for checking the completion status of an order. See [#1360](https://github.com/wp-e-commerce/WP-e-Commerce/issues/1360).
125
- * Enhancement: Significant improvements to how digital downloads are handled and made available. See [#37](https://github.com/wp-e-commerce/WP-e-Commerce/issues/37).
126
- * Enhancement: Improve admin performance for sorted product categories. See [#1389](https://github.com/wp-e-commerce/WP-e-Commerce/issues/1389).
127
- * Enhancement: Regions are now filtered. See [#1930](https://github.com/wp-e-commerce/WP-e-Commerce/issues/1930).
128
- * Enhancement: Improve flexibility of product duplication functionality. Ensures that post meta tied to specific IDs have the available filters to update those IDs. See [#1672](https://github.com/wp-e-commerce/WP-e-Commerce/issues/1672).
129
- * Enhancement: All front-end AJAX responses are now filtered. See [#1698](https://github.com/wp-e-commerce/WP-e-Commerce/issues/1698).
130
- * New: Introducing Amazon Payments as an available payment gateway.
131
- * New: Introduced better filtering mechanisms for custom purchase statuses and related bulk actions and labels for those statuses. See [#1525](https://github.com/wp-e-commerce/WP-e-Commerce/issues/1525) and related issues/PRs.
132
- * New: Introduced a new filter, `wpsc_checkout_get_fields`, allowing you to add, remove, and modify checkout form fields. See [#1837](https://github.com/wp-e-commerce/WP-e-Commerce/issues/1837).
133
-
134
-
135
- = 3.10.1 =
136
-
137
- * Fix: Uses version_compare() for comparing wpsc_version constant in legacy code (from 5 years ago). Using comparators was causing 3.10.0 to be "less than" 3.8, resulting in an unnecessary admin notice.
138
- * Fix: Changes internal mechanism for detecting which theme engine is in use. The way we were checking for it before caused many core actions to be unhooked, leading to unsavory results, like Fancy Notifications no longer working.
139
- * Fix: Patched in a few fixes for incorrect usage of esc_url(). This resolves scenarios like the selecting a custom checkout form in the Dashboard failing because of double-encoded ampersands.
140
-
141
- = 3.10.0 =
142
-
143
- * Enhancement: Added updated PayPal gateways. We now support Digital Goods and Pro Hosted, and have updated the Express Checkout gateway. We now recommend all existing users of the 2.0 Express Checkout gateway update to the 3.0 version.
144
-
145
- = 3.9.5 =
146
-
147
- * Fix: 4.3 Compatibility w/ WP_Widget constructors.
148
-
149
- = 3.9.4 =
150
-
151
- * Security Fix: Harden several instances of $_POST input that were not sanitized properly. Specifically, PayPal settings and Quick Edit fields for products.
152
- * Security Fix: Do not return visitor meta if WP eCommerce presumes a user to be a bot.
153
- * Enhancement: Provide a notice for users to repair their WP eCommerce tables if visitor and visitor meta tables are in need of repair. See [#1901](https://github.com/wp-e-commerce/WP-e-Commerce/issues/1901).
154
- * Fix: Notices on stats saving for products.
155
-
156
- = 3.9.3 =
157
-
158
- * Fix: Fix potential reflexive XSS issue with add_query_arg() and remove_query_arg() usage. Update is _highly_ recommended.
159
-
160
- = 3.9.2 =
161
-
162
- * Fix: Reverted pre_get_posts hook. See [#1444](https://github.com/wp-e-commerce/WP-e-Commerce/issues/1444). This was causing issues with template redirection and selection on search templates.
163
- * Fix: Shipping conflict with target market restrictions on specific categories. See [#1711](https://github.com/wp-e-commerce/WP-e-Commerce/issues/1711).
164
- * Fix: Taxes were broken following some refactoring of the admin saving callbacks.
165
- * Fix: Quick edit was overwriting variation SKUs and sale prices.
166
- * Fix: RSS Feed error.
167
-
168
- = 3.9.1 =
169
-
170
- * Fix: Disable 3.0 payment gateway API gateways. Will be re-enabled after more vigorous testing.
171
- * Fix: Check that $wpsc_cart->cart_items is an array, not an object.
172
- * Fix: Improve shipping method property checks in wpsc_cart class. See [#1683](https://github.com/wp-e-commerce/WP-e-Commerce/issues/1683).
173
- * Fix: Add asterix class to required fields for PayPal Pro 2.0.
174
- * Fix: Ensure taxable checkbox can be unchecked. 3.9 regression. See [#1685](https://github.com/wp-e-commerce/WP-e-Commerce/issues/1685).
175
- * Fix: Only show completed purchases in the user account area.
176
- * Fix: Use is_email(), rather than a faulty regex, for checkout email field validation.
177
- * Fix: More than a [handful of faulty variables](https://github.com/wp-e-commerce/WP-e-Commerce/commit/58f2d3ad9698ef496a27a701e5a926e412d55c05) were referenced in wpsc_coupons.
178
- * Fix: Function `wpsc_string_to_boolean` was essentially non functional.
179
- * Fix: Send country and state through to PayPal only if they actually exist.
180
- * Fix: Broken theme-engine activation routine. Would always fail, running 1.0 engine.
181
-
182
- = 3.9 =
183
-
184
- * Fix: Eliminate most usage of number-based inputs in product UI.
185
- * Fix: Fall back to product ID if SKU is not set for Google Analytics reporting.
186
- * Fix: Restored inadvertently removed filter, `wpsc_add_advanced_options`.
187
- * Fix: Ensure price entered for "Free Shipping" threshold is locale-aware.
188
- * Fix: Generally improved metadata saving routines for quick/bulk edit areas.
189
- * Fix: Ensure "Combination of product variants is not available" message is hidden from Grid View.
190
- * Fix: Don't require a shipping method to be selected if you qualify for free shipping.
191
- * Fix: When "Buy Now" button is used, it is now disabled if item is out of stock.
192
- * New: Introduced `wpsc_get_countries` and `wpsc_get_countries_array` filters.
193
- * New: Introduced `wpsc_google_analytics_pushed_product` filter.
194
- * New: Introduced `wpsc_get_downloadable_links` filter.
195
- * New: Added screen option for number of purchase logs to show on a page.
196
- * New: Introduced WPSC_Logging class. Based on WP_Logging.
197
- * New: Customers may now checkout with carts that have a value of $0.
198
- * New: Introduces `wpsc_is_free_cart` filter.
199
- * New: Added 2.0 theme engine component. Defaults off until the 4.0 release, but can be enabled via filter for testing.
200
- * New: Added marketplace component.
201
- * New: Added 3.0 payment gateway API component.
202
- * New: PayPal Digital Goods gateway, updated PayPal Express Checkout, PayPal Pro and Manual Payment gateways.
203
- * New: Product Tags now have proper body classes.
204
- * New: Meta updates, kind of a big deal: We're now using X.X.Y versioning (like WordPress) and we now have unit tests.
205
- * New: Introduce attachments method and filter for WPSC_Purchase_Log_Notification class.
206
- * New: Single Product pages now have ID-based body classes.
207
- * New: Supports Universal Analytics in Google Analytics.
208
- * New: Added `wpsc_checkout_fields` filter for filtering checkout form fields.
209
- * Change: Dates are now optional on coupons. Expiration, specifically, is no longer required. Validation is filterable via `wpsc_coupons_validate_coupon`.
210
- * Change: Refactored purchase log action links, introduced new API for adding links.
211
- * Change: Product page shortcodes, e.g. [productspage], are now stripped from the_excerpt(). Helpful for cleaner looking search results.
212
- * Change: Limit Google Product ID to 50 characters in Google Product Feed. Introduced `wpsc_google_product_feed_product_id`.
213
- * Change: When only one shipping rate is available, it will automatically be selected as the default rate.
214
-
215
- = 3.8.14.4 =
216
-
217
- * Fix: Significant security vulnerability whereby some admin actions were exploitable by unauthorized users. Props to Sucuri for the responsible disclosure.
218
- * Fix: Other less significant security hardening and minor code maintenance.
219
-
220
- = 3.8.14.3 =
221
-
222
- * Fix: Resolve PHP warning in stats logging class.
223
-
224
- = 3.8.14.2 =
225
-
226
- * Fix: Clear country cache automatically.
227
- * Fix: Fixed notices when using quick edit.
228
- * Fix: Fixed html in checkout form.
229
- * Fix: Fixed shipping results not being displayed.
230
- * Fix: Does not show errors when deprecated google checkout is used.
231
- * Fix: Makes sure countries are validated if mandatory.
232
- * Fix: Makes sure the payment gateway checks for first and last name.
233
- * Fix: Only output html for shipping error page.
234
- * Fix: Updated shipping calculator to check for new checkout information and made the calculator more efficient.
235
- * Fix: USPS shipping now works for servers that don't support curl.
236
- * Fix: Personalization forms are correctly initialized in database.
237
- * Fix: Display of products in admin product gallery will display in the order admins want them to.
238
- * New: Updated Polish and Russian language files.
239
- * New: Added filter wpsc_uncategorized_product_category to change uncategorized section.
240
- * New: New hook - wpsc_coupon_add_top and wpsc_coupon_add_bottom for the add coupon section.
241
- * New: New hook - wpsc_element_is_visible to check and see if an element is visible.
242
- * Change: Show region on shipping calculator.
243
- * Change: Billing was accidentally referred to as shipping when billing state and region was a drop down.
244
-
245
- = 3.8.14.1 =
246
-
247
- * Fix: For users with older (3.7.x and older) templates copied into their theme directory, we inadvertently broke the visibility of the shipping calculator.
248
- * Fix: Under similar circumstances, taxes would not properly calculate.
249
- * Fix: Ensured compatibility with the popular "Weight and Destination" shipping module. Note: You may need to go to your Target Markets and re-save the values there to properly flush the cache for this compatibility.
250
- * Fix: Edge case where $0.00 could be returned for a shipping rate.
251
- * Fix: Race condition on AJAX save while submitting purchase.
252
- * Fix: Restored proper functionality on digital downloads.
253
- * Fix: Ensure that UPS and USPS always return proper and expected values. Incrementally improved error handling here.
254
- * Fix: Ensure that shipping method is properly retained if checkout page is refreshed.
255
- * Change: Added "County" as the region label for the UK.
256
-
257
- = 3.8.14 =
258
- * Fix: Improved visitor profiles performance, new infrastructure does not use WordPress Users.
259
- * Fix: When page caching is being used, probability of empty or superfluous visitor profiles being created drastically diminished.
260
- * Fix: Send appropriate addresses to PayPal via PayPal Standard.
261
- * Fix: Ensure that sales tax is not added to non-tax items when using a coupon.
262
- * Fix: Ensure state text field is not visible at the same time as state dropdown.
263
- * Fix: Ensure shortcodes respect display type as overridden by categories. Note: Requires latest Gold Cart release.
264
- * Fix: Ensure that adding a new item to the cart after a coupon code properly reflects that coupon code.
265
- * Fix: Don't create cron events for unknown schedules.
266
- * Fix: Shipping options were disappearing when "same as billing address" were selected.
267
- * Fix: Protect against "Price From: " being zero if a sales price was set without a normal price.
268
- * Fix: Added programmatic and UX checks for conflict where grid/list view could show products with variations without the variation drop-downs, adding an improper product to the cart.
269
- * Fix: Improved shipping rate quote retrieval performance.
270
- * Fix: Sends proper tax amount to PayPal Standard when carts are aggregated.
271
- * Fix: Fixed pagination bug where improper number of paged links were returned.
272
- * Fix: Ensure UPS Environment test mode works.
273
- * Fix: Downloadable products were not being properly added as attachments.
274
- * Fix: "Shipping Same as Billing" could cause products to be shipped to countries which are not allowed.
275
- * Fix: Eliminate undefined index errors on sales log page when checkout fields are removed.
276
- * Fix: Address edge case where purchase notifications are not sent when there are multiple email fields in different checkout form sets.
277
- * Fix: Improved bbPress compatibility.
278
- * Fix: Ensure User Account pages are properly overridable in the template stack.
279
- * Fix: Properly escape classes for Buy Now button classes.
280
- * Fix: Fix IE8 javascript conflicts.
281
- * Fix: Shored up backwards compatibility for Session usage
282
- * Fix: Ensure cart items with variations that are out of stock (and stock limited) don't return a fatal error.
283
- * Fix: Address malformed XML output for shipping quotes from UPS and USPS.
284
- * Fix: Ensure PayPal Express does not show coupons as an empty line item when discounts are not used.
285
- * Fix: A redirection error on our wpsc_scale_image fallback was resolved.
286
- * Fix: Ensure only available countries are shown as available in PayPal Express.
287
- * Fix: Resolved issue whereby amounts over 1,000 (in a given currency) would be incorrectly sent to Google Analytics.
288
- * Fix: Shipping calculator uses information set in user account profile, if set.
289
- * Fix: When PATHINFO Permalinks ("Almost Pretty"), product pages would 404.
290
- * Fix: Ensure 3.7.x -> 3.8.x upgrade routine uses wpdb::prepare() properly.
291
- * New: AJAX API to get and set information about customers.
292
- * New: Visitor API to get and set information about current and past visits.
293
- * New: Introduced WPSC_Claimed_Stock class.
294
- * New: Introduced WPSC_Stats class.
295
- * New: Introduced WPSC_Product/WPSC_Products class.
296
- * New: Introduced WPSC_Countries / WPSC_Region class.
297
- * New: Totally revamped product editing and adding user interface.
298
- * New: Added new Purchase Meta API.
299
- * New: Some compatibility fixes for WordPress 3.9.
300
- * New: Improved extendibility of the Import Settings area.
301
- * New: Improved extendibility for our conditional coupon callbacks.
302
- * Change: Iterated upon WPSC_Country class.
303
- * Change: Improved UK Country Display.
304
- * Change: Improved upgrade routines for currencies and countries.
305
- * Change: Introduced filter for themeable packing slips.
306
- * Change: Modified calculation for total price to ensure coupons don't reduce shipping and tax.
307
- * Change: Improved Checkout workflow and UI.
308
- * Change: Fully remove Google Checkout from WP eCommerce, as it has been deprecated.
309
- * Change: Don't show transaction results to anyone but the purchaser
310
- * Change: Eliminated usage of dynamic CSS and javascript in front-end and admin.
311
- * Change: Couldn't use decimals in product's variation sale price.
312
- * Change: Tons of performance improvements to USPS and UPS.
313
- * Change: Add condition as parameter to wpsc_coupon_rule_property_options action.
314
- * Change: Improved security for our customer cookie hash.
315
- * Change: Don't default to base country of store in checkout fields.
316
- * Change: Taxes class previously regarded regions as unique, when they are not. We now check both region and country where applicable.
317
- * Change: By default, quantity boxes will be shown on new installs.
318
-
319
- = 3.8.13.3 =
320
- * Fix: Users disappear in Network Admin -> Users page (for multisite).
321
- * Fix: User counts are incorrect when there are thousands separators.
322
- * Fix: "Save Product Files" button doesn't like being clicked on.
323
-
324
-
325
- = 3.8.13.2 =
326
- * Fix: Anonymous customers should not be visible in admin UI.
327
- * Fix: Cronjob to purge anonymous customers doesn't work due to memory issues.
328
- * Fix: Anonymous cart items will be lost after signing in.
329
-
330
- = 3.8.13.1 =
331
- * Security and maintenance release
332
-
333
- = 3.8.13 =
334
-
335
- * New: Product Media UI.
336
- * New: Cart Item Meta API
337
- * New: 'wpsc_after_checkout_cart_rows' action.
338
- * New: Add 'wpsc_default_dimension_unit' and 'wpsc_default_weight_unit' filters.
339
- * New: Add 'wpsc_save_product_order' action and use it to save category product order in the term_relationships table.
340
- * New: Add logic filter for coupons. We currently have one for properties, this should sufficiently round out the extensibility for the UI.
341
- * New: Allow gateway images to be filtered.
342
- * New: Allow multiple comma-separated categories in coupon conditions.
343
- * New: Product Gallery metabox.
344
- * Change: Better Customer API.
345
- * Change: Prepend (WPEC) to widget names in wp-admin
346
- * Change: Replace default noimage.png with a better image.
347
- * Change: Updated NL language
348
- * Change: Updated german language strings
349
- * Change: Use new spinner image in WordPress 3.8
350
- * Fix: Add preg_quote() to coupon regexes that intend to parse strings. Fixes issue where unexpected results occur when strings contain slashes, or really, any regex-oriented characters.
351
- * Fix: Change wpsc_get_remaining_quantity() to call the method dynamically, rather than statically. The previous behaviour caused a strict standards warning.
352
- * Fix: Database Upgrade Routine to rename old _wpsc_* product metadata array keys so they no longer include the '_wpsc_' prefix
353
- * Fix: In Purchase log admin screen, item count is sum of quantity field rather than count of rows
354
- * Fix: Invert logic on shipping ZIP code check in core theme files.
355
- * Fix: Modify behavior in Download CSV functionality to properly convert region IDs to regions.
356
- * Fix: Modify wpsc_update_item_quantity() to listen for wpsc_quantity_update, reverting to $_POST['quantity'] only if it exists.
357
- * Fix: PHP strict warnings.
358
- * Fix: Properly quote SKUs in CSV file.
359
- * Fix: Rename generically named function.
360
- * Fix: Stock and sale price empty values should be preserved.
361
- * Fix: Variation thumbnail size in admin screen.
362
- * Fix: cart is not initialized when some shipping modules are triggered
363
- * Fix: redundant product thumbnail is displayed on category / single product list.
364
- * Fix: variation checkbox column width in WP 3.7.
365
- * Fix: Out of stock message for variations now correctly shows variation of product for the title, rather than main product.
366
- * Fix: Use proper link in checkout for variation products.
367
- * Fix: Return tax information in switchmethod() JS function.
368
- * Fix: Resolve conflict with Advanced Custom Fields on save_post hook for products.
369
- * Fix: Update Bulgarian Currency symbol.
370
- * Fix: Resolve issue where updating pages causes rewrite rule conflicts when pretty permalinks are enabled.
371
-
372
- = 3.8.12.1 =
373
- * Fix: Fatal error in wpsc_product_list_exclude_child_categories() due to other themes
374
- or plugins calling get_posts() before the main query is set up
375
-
376
- = 3.8.12 =
377
- * New: Filter to hide drafts on the front-end: "wpsc_product_display_status"
378
- * New: Shipwire staging / production option
379
- * Change: Remove deprecated and unused javascript (and by extension, CSS) from core
380
- * Change: Remove nusoap
381
- * Change: Improvements to Marketing admin panel
382
- * Change: Improvements to Products List Admin Page
383
- * Fix: WP eCommerce pagination breaks WordPress pagination
384
- * Fix: Wrong thumbnail size in Product Specials widget
385
- * Fix: Filtering by a category also shows all products in subcategories
386
- * Fix: admin.js throwing a Parse Error in Safari
387
- * Fix: Product Image Links not working when over HTTPS
388
- * Fix: If AJAX_URL returns HTTPS and Add to Cart is on HTTP, errors
389
- * Fix: Add to Cart button doesn't work
390
- * Fix: Can no longer upload customer attachments
391
- * Fix: Deprecated warning for wp_convert_bytes_to_hr() function in WordPress 3.6
392
-
393
-
394
- = 3.8.11.1 =
395
- * Fix: Some users had theme compatibilities and other configurations that caused "Add to Cart" to no longer function as expected.
396
- * Fix: Customer uploads for products broke with JS overhaul
397
- * Fix: Product image links broke.
398
-
399
- = 3.8.11 =
400
- * New: Payment Gateway UI is revamped.
401
- * New: Sales Log UI is revamped.
402
- * New: wpsc_single_purchase_log_date_time_format and wpsc_single_purchase_log_date_format (Used in new Sales Log UI).
403
- * New: Added 'wpsc_usps_domestic_rate' and 'wpsc_usps_intl_rate' filters.
404
- * New: 'wpsc_country_get_property' filter.
405
- * New: WPSC_Country::get_data() method and 'wpsc_country_get_data' filter.
406
- * New: Added generic 'wpsc_save_' . $this->current_tab_id . '_settings' action.
407
- * New: 'wpsc_shipping_module_settings_form' filter on admin shipping module form output.
408
- * New: Choose either AND or OR for coupon conditions logic.
409
- * Change: Reduced internal usage of get_option( 'siteurl' ) in favor of home_url().
410
- * Change: Updated Colorbox.js to v.1.4.15.
411
- * Change: Eliminated internal usage of 'index.php' as an AJAX callback URL. Nginx users, rejoice.
412
- * Change: Eliminated internal usage of eval() in javascript.
413
- * Change: wpsc_get_country() uses WPSC_Country now.
414
- * Change: .on() is now used in place of .livequery(), .bind(), .live() and .delegate().
415
- * Change: Minor cleanup of Marketing settings tab UI.
416
- * Change: wpsc_the_product_image() optimized to utilize the product thumbnail earlier in the function.
417
- * Change: wpsc_the_variation_price() output is now filtered through wpsc_do_convert_price filter.
418
- * Change: Submitted_Form_Data table now has a value field with a LONGTEXT data type, rather than varchar(255).
419
- * Change: Continued internal cleanup of coding standards and documentation.
420
- * Fix: Properly substitute placeholder in "Out of stock" email to administrator.
421
- * Fix: Fixed PHP notices when accessing Dashboard as subscriber.
422
- * Fix: Coupon logic improvements (edge case of using 'not_contains" logic with item_quantity).
423
- * Fix: Automated fix when possible, and nag when not, for 3.8.10 regression in User Management templates.
424
- * Fix: Error notices on category functions.
425
- * Fix: fetch_feed() error on GetShopped news.
426
- * Fix: Variation terms were not being applied to the parent product.
427
- * Fix: If you emptied variation sale price, the stock levels would not work any more.
428
- * Fix: A notice was thrown if you had UPS selected but had not saved settings for it.
429
- * Fix: USPS Shipping Module now correctly respects testing environement settings.
430
- * Fix: Correcting casting price value to float instead of integer in coupon logic conditions for sub_total.
431
- * Fix: 'wpsc_transaction_result_content' now returns the $cart_item as an array instead of an object (which was a regression).
432
-
433
- = 3.8.10 =
434
- * New: Coupon UI is revamped.
435
- * New: [Shipwire] Addition of Shipping Services, Economy, Plus & Premium.
436
- * Change: After filling out a registration form, the user is logged in.
437
- * Change: Limit quantity of individual products that can be added to the cart. Default value is filterable.
438
- * Change: Remove FPDF which is not used any more.
439
- * Change: Return cart item messages as key => value array rather than HTML.
440
- * Change: Variation table class orderby to 'menu_order title'
441
- * Change: When displaying packing slip, form data should be output in the same order as that of checkout page.
442
- * Fix: "you save" prices are not correct on variations with a value over 1000
443
- * Fix: Cart widget missing closing </div> tag.
444
- * Fix: Display the "You save" price as a currency, not just a raw unformatted number
445
- * Fix: Ensure all variations are deleted when deleting a product.
446
- * Fix: Foreign characters are not displayed correctly in packing slip.
447
- * Fix: Improved performance with variations.
448
- * Fix: JavaScript error when no variations exist in admin.
449
- * Fix: Make sure Add / Edit Product page respects decimal and thousands separators set in Settings->Store->General.
450
- * Fix: Manual / Test Payment instructions don't appear on transaction results page and email.
451
- * Fix: Only print Google Analytics scripts on transaction results footer
452
- * Fix: PHP Warnings when bulk editing variations.
453
- * Fix: Prevent old paypal express from hijacking new paypal express callback.
454
- * Fix: Product category pages don't respect pagination and sort order settings.
455
- * Fix: Re-generate products pages' IDs after plugin reactivation.
456
- * Fix: Refactor user account page
457
- * Fix: SQL IN error in wpsc_populate_also_bought_list().
458
- * Fix: Switching a purchase log status to "Closed Order" doesn't reduce stocks.
459
- * Fix: WPML compatibility
460
- * Fix: Wrong cache set for checkout form data.
461
- * Fix: split() deprecation notice in PHP 5.3+
462
- * Fix: stripslashes issues when duplicating products.
463
-
464
- = 3.8.9.5 =
465
- * New: Polish translation.
466
- * Fix: Attempt to regenerate customer ID if it's invalid to avoid fatal errors.
467
- * Fix: Australia Post doesn't return any quotes if the products' dimensions are not specified.
468
- * Fix: Billing state is set to shipping state upon checkout.
469
- * Fix: Cannot resent purchase receipt any more.
470
- * Fix: Custom Cart Messages on Sales Log need stripslashes.
471
- * Fix: Error message when changing purchase log status via AJAX.
472
- * Fix: Fatal error in merchant.class.php.
473
- * Fix: Giving stock or price of a product a 4 figure number will screw it up when the product is updated again.
474
- * Fix: Invalid zipcode is displayed even when the zipcode is not specified yet.
475
- * Fix: Quick editing a product doesn't work.
476
- * Fix: Transaction result emails are sent when an order is closed.
477
- * Fix: More native css support for product variations in WP 3.5+.
478
-
479
- = 3.8.9.4 =
480
- * Fix: "No shipping quotes" error is displayed when selecting "Shipping same as billing".
481
- * Fix: Avoid flooding transient data when site's feed is being visited by bots.
482
- * Fix: Blank Checkout page for some certain installation when Shipping is enabled.
483
- * Fix: Can't add to cart on some server.
484
- * Fix: Fatal error when viewing product variation iframe, because _wp_admin_html_begin() does not exist on older WordPress versions.
485
- * Fix: MySQL error/warning in _wpsc_filter_special_widget_where().
486
- * Fix: Only show attachment fields when viewed on an edit product page.
487
- * Fix: PHP Notice in cart.class.php.
488
- * Fix: Properly escape columns in admin products page.
489
- * Fix: Purchase log's item names are not translatable via qTranslate.
490
- * Fix: Shipping same as billing saves "State" field label as the shipping region.
491
- * Fix: Shipwire settings are not updated.
492
- * Fix: Shipwire syncing doesn't take into consideration products in trash, or multiple products using the same SKUs (as in WPML)
493
- * Fix: Specials widget is empty when there are no product with variation sales.
494
- * Fix: Variation sets are not being sorted on the front-end.
495
- * Fix: WPEC doesn't cooperate with WP 3.5 media UI.
496
- * Fix: wpsc_pre_transaction_results filter is ignored.
497
- * Make sure admin styles are enqueued for product variations iframe in older version of WordPress.
498
-
499
- = 3.8.9.3 =
500
- * New: Add support for quantity field in default grid view template.
501
- * New: Let plugins add new column to product variation list table via filter 'wpsc_manage_product_variations_custom_column'.
502
- * Fix: Blank transaction results page when using paypal gateways.
503
- * Fix: Comment form is displayed even though comment is closed on products page.
504
- * Fix: Fatal error in formatting.php for some sites.
505
- * Fix: New countries in 3.8.9 automatically added to target market list.
506
- * Fix: PayPal Standard doesnt' take care of coupons.
507
- * Fix: Punctuation in pending transaction email.
508
-
509
- = 3.8.9.2 =
510
- * Fix: Admin cannot download file from product edit page.
511
- * Fix: Compatibility issues with Jetpack.
512
- * Fix: Google Analytics is printed out even when it's not active. Also, PHP notice when the product doesn't have a category.
513
- * Fix: Make sure PayPal Standard works with 100% discount.
514
- * Fix: Product page title is not properly replaced with the category or tag title in WP 3.5.
515
- * Fix: Products are sometimes displayed even when products page is set to only display list of categories.
516
- * Fix: Products thumbnail sizes are inconsistent with the settings.
517
- * Fix: Properly flush outdated customer meta from the transient table.
518
- * Fix: Typo in wpsc_cart::update_location().
519
- * Fix: Wrong class attribute for price display.
520
-
521
- = 3.8.9.1 =
522
- * Fix: Fatal error in Shipwire.
523
- * Fix: Fatal error with customer meta on multisite.
524
- * Fix: Fatal error with get_the_product_tags().
525
- * Fix: Pagination in admin product list doesn't work.
526
- * Fix: Permalinks are incorrect when products page is set as home page and permalink scheme is set to %post_name%.
527
- * Fix: Rewrite rules are not regenerated correctly when switching from "Default" to "Post name".
528
- * Fix: Shipwire and Google Analytics are not working properly.
529
- * Fix: Shipwire request is sent even when Shipwire is not active.
530
- * Fix: States are displayed as numbers in admin purchase report.
531
- * Fix: Transaction results displaying cart content twice as well as "Oops, there is nothing in your cart".
532
- * Fix: Use customer meta instead of $_SESSION for eway and payflow message.
533
- * Fix: Variation pagination doesn't work.
534
-
535
- = 3.8.9 =
536
- * New: Additional columns can now be added to Store Sales page via filter hook.
537
- * New: Additional filters for purchase log notification classes.
538
- * New: Allow devs to filter the list of accepted credit cards in PayPal Pro.
539
- * New: Filters to enable image scaling (versus cropping).
540
- * New: Hook to modify the product table on transaction results and purchase receipts.
541
- * New: Make buy now button's html output filterable.
542
- * New: More flexibility in role management.
543
- * New: New Hook for cancelling subscriptions with Memebers Access.
544
- * New: Pagination UI for product variations.
545
- * New: Users can bulk edit products' stock, price, sales price etc.
546
- * New: Users can now choose to "Notify site owner" and "Unpublish product" separately when stock runs out.
547
- * New: Users can now delete checkout form sets.
548
- * New: Users can now set product sorting direction in Settings->Presentation.
549
- * New: Variation UI enhancements.
550
- * Change: "Registration required" and "Anyone can register" are now synchronized.
551
- * Change: Default checkout shipping option to lowest shipping cost of all choices.
552
- * Fix: "Variation Controls" anchor in metabox leads nowhere.
553
- * Fix: AJAX code audit (security)
554
- * Fix: Activating WP eCommerce on a vanilla WordPress installation with pretty permalinks enabled messes up the rewrite rules.
555
- * Fix: Add a space after tilde character to avoid confusion in admin product list.
556
- * Fix: Add new variation sets and terms from Edit Product page doesn't work properly.
557
- * Fix: Additional description is double escaped in product edit page.
558
- * Fix: Alignment of checkboxes and radios in product category edit page is a bit off.
559
- * Fix: Avoid using query_posts() which could break themes.
560
- * Fix: Backslashes are sometimes added to UPS and USPS settings.
561
- * Fix: Base_region option remains set if base country is switched.
562
- * Fix: Billing phone number not accessible via wpsc_merchant::$cart_data.
563
- * Fix: Buy Now feature doesn't properly create and update sales log.
564
- * Fix: Can't add variations on new products.
565
- * Fix: Can't delete coupon conditions.
566
- * Fix: Can't order products properly in Products admin page.
567
- * Fix: Can't upload product category image when adding a new category.
568
- * Fix: Cannot set thumbnail for variations.
569
- * Fix: Cart item name is not updated when corresponding variation name is changed.
570
- * Fix: Cart items are not translated for qTranslate.
571
- * Fix: Cart mix up when multisite is enabled.
572
- * Fix: Category image size metadata are not used properly on templates.
573
- * Fix: Category title is replaced with the first product's title, and pagination does not work correctly on Category page.
574
- * Fix: Changing an order status in Sales Log page incorrectly updates the views and pagination links.
575
- * Fix: Changing checkout field sort order doesn't work.
576
- * Fix: Checkout- Parent Product Thumbnail Displayed Instead of Product Variation Thumbnail.
577
- * Fix: Claimed stock cronjob doesn't take into consideration timezone.
578
- * Fix: Collapse product variation sets by default on Manage tab.
579
- * Fix: Colorbox Gallery doesn't work.
580
- * Fix: Country dropdown lists disregard Target Market option.
581
- * Fix: Coupon is not invalid is displayed even when there's no coupon applied.
582
- * Fix: Coupon start and expiry date don't take into account local timezone.
583
- * Fix: Currency converter doesn't work for some particular currencies.
584
- * Fix: Custom fields are missing in purchase log if they have the same name as other fields.
585
- * Fix: Customers are able able to purchase scheduled but unpublished products.
586
- * Fix: Database upgrade routines.
587
- * Fix: Division by zero in product-template.php.
588
- * Fix: Dollar signs are used in flat rate settings regardless of the main currency.
589
- * Fix: Duplicating a Product doesn't duplicate the images correctly.
590
- * Fix: Email information in "Admin" settings tab is not displayed properly.
591
- * Fix: Enabling shipping but not selecting any shipping methods causes frustrating unexpected issues.
592
- * Fix: Fatal error in PayPal Pro settings page.
593
- * Fix: Fatal error in checkout page form validation.
594
- * Fix: Fatal error when quick editing products.
595
- * Fix: Fatal error when upgrading from 3.7.x.
596
- * Fix: Final breadcrumb id tag is not W3C Compliant.
597
- * Fix: Free shipping discount is not updated when shipping method is changed.
598
- * Fix: Free shipping doesn't reset individual cart items' shipping amounts when submitted to PayPal.
599
- * Fix: Free-shipping doesn't work on PayPal Pro if the discount amount > item total.
600
- * Fix: Google Analytics is now tracking correctly.
601
- * Fix: Great Britain is redundant in country list (we already have U.K. and North Ireland).
602
- * Fix: Improper escaping of user input.
603
- * Fix: Inaccurate dimension calculation in Australia Post.
604
- * Fix: Incompatibility with $_SESSION.
605
- * Fix: Incorrect i18n in Presentation tab.
606
- * Fix: Increase gateway timeout settings across the board.
607
- * Fix: Inefficient pinging when product is updated.
608
- * Fix: Infinite loop on single product page.
609
- * Fix: Infinite loop when using PayPal Pro.
610
- * Fix: Issue with SSL and Share This URL.
611
- * Fix: Latest product widget doesn't show image.
612
- * Fix: Logic error in function wpsc_product_has_stock.
613
- * Fix: Make it clear that the sidebar widget doesn't include discount.
614
- * Fix: More flexibility in role management.
615
- * Fix: New coupon conditions are added below the first condition instead of the last.
616
- * Fix: Number of products per page field in shortcode generator doesn't work.
617
- * Fix: On user details page, switching country to a country without region won't display the State (Region) text field.
618
- * Fix: Only display permalink double save warning if WordPress version is earlier than 3.3.
619
- * Fix: Outdated country codes and currency codes.
620
- * Fix: Pagination does not work with price range widget.
621
- * Fix: Pagination for category short codes does not work.
622
- * Fix: Pagination for tags does not work.
623
- * Fix: Pagination links generated with unnecessary "page/" portion for WP 3.4.
624
- * Fix: Pagination links in Category shortcode page are not consistent.
625
- * Fix: Parent product is still treated as if it had variations even though all its variations have been moved to trash or hidden (set to draft).
626
- * Fix: PayPal Express Checkout doesn't take into account free shipping.
627
- * Fix: PayPal Standard Subscriptions produce unexpected product title in PayPal cart and receipts.
628
- * Fix: Performance improvement for dynamic stylesheet.
629
- * Fix: Placeholder image is missing for products without thumbnails.
630
- * Fix: Potential height issue with variation edit iframe (parent hidden overflow, expand/collapse checkboxes).
631
- * Fix: Prevent segmentation fault when using wpsc-products shortcode.
632
- * Fix: Product Specials Widget does not work with product variations on sale.
633
- * Fix: Product page URLs are sometimes not updated properly.
634
- * Fix: Product permalinks in single product view are not using current category path.
635
- * Fix: Products page pagination fails if the products page is set as the homepage.
636
- * Fix: Products with variations on sale does not display the prices correctly.
637
- * Fix: Purchase logs list table doesn't have Total line as before 3.8.8.
638
- * Fix: Refactor purchase log notifications to fix various issues:
639
- * Fix: Region field is not consistently updated or displayed when selecting a country without regions on checkout form.
640
- * Fix: SKU should be sent to PayPal Standard instead of Product ID if that's available.
641
- * Fix: Shipping error is reported when "Shipping same as billing" is selected on the checkout page, even when shipping is disabled.
642
- * Fix: Shipping location error message is displayed before the customer has a chance to specify state and zip code.
643
- * Fix: Shipping method and option are not displayed on Sales Log single page if there is no shipping form fields.
644
- * Fix: Shipping options not refreshed when "shipping same as billing" causes new quotes.
645
- * Fix: Shipping rate choice not correctly encoded during checkout.
646
- * Fix: Shipwire settings are broken.
647
- * Fix: Shortcode button doesn't work in visual mode if WP folder configuration is different from default.
648
- * Fix: Table rate shipping doesn't accept $0 amount.
649
- * Fix: Target makret restrictions for product categories is broken.
650
- * Fix: Tax bands not working.
651
- * Fix: Template tags for product tags don't work.
652
- * Fix: Terms & Conditions validation code is broken.
653
- * Fix: Total Price not properly reflective of the total after $1,000.
654
- * Fix: Transaction results refactor.
655
- * Fix: Updating purchase log status doesn't update pagination count
656
- * Fix: Unnecessary thumbnail regeneration on product single page.
657
- * Fix: Update message is displayed even when the db has bene updated.
658
- * Fix: Updating region when "Same shipping as billing" is checked doesn't update the shipping quote.
659
- * Fix: Use $cart_item->get_title() instead of $cart_item->product_name.
660
- * Fix: Use array instead of strings when calling WP_Query in wpsc_the_variation_price.
661
- * Fix: Users are now warned that setting products per row for grid view to 0 would probably lead to layout breakage.
662
- * Fix: Using 2 checkout sets shows incorrect order on Purchase History and Your details pages.
663
- * Fix: Valid checkout fields are not preserved when there are invalid fields.
664
- * Fix: Variation drag'n'drop sorting is not working.
665
- * Fix: Various bugs and inconsistencies with coupon conditions.
666
- * Fix: WPEC loads product image then scales to thumbnail size in the backend products list.
667
- * Fix: Weird Taxable Amount column.
668
- * Fix: When "Free Shipping" is enabled in Settings->Shipping, shipping is always set to 0 even when shipping discount value is set to 0 or empty.
669
- * Fix: Wrong alternate row class for variation inline shipping editor.
670
- * Fix: Wrong documentation link for Chronopay.
671
- * Fix: Wrong logic in deprecated function nzshpcrt_currency_display().
672
- * Fix: _wpsc_process_transaction_coupon() contains typos.
673
- * Fix: also bought image path is supposed to be fixed already.
674
- * Fix: i18n audit.
675
- * Fix: improper escaping in Price metabox.
676
- * Fix: post_status is not formatted correctly in wpsc_start_the_query().
677
- * Fix: private products are listed on the /products/ page.
678
- * Fix: wpsc_list_dir() should return empty array if directory is empty.
679
- * Fix: wpsc_shopping_cart() function call doesn't work.
680
- * Fix: wpsc_the_product_thumbnail() ignores custom width and height.
681
-
682
- = 3.8.8.5 =
683
- * Fix: Order Closed status does not count in the sales log totals on dashboard widget.
684
- * Fix: PHP preg_replace warning.
685
-
686
- = 3.8.8.4 =
687
- * Fix: Also bought product image doesn't display correctly.
688
- * Fix: Pagination fails when hierarchical category URL is enabled.
689
- * Fix: Product Specials Widget causes 404 errors. Props Chris Jean.
690
- * Fix: Product category slug beginning with a digit doesn't work.
691
- * Updated localization.
692
-
693
- = 3.8.8.3 =
694
- * Fix: Incompatibility between WPEC products page pagination and WordPress 3.4.
695
-
696
- = 3.8.8.2 =
697
- * Change: CSV sales export now puts the item quanity in a separate column from the product title.
698
- * Fix: Core checkout fields cannot be restored if they were deleted before upgrading to 3.8.8.
699
- * Fix: Insecure SSL resources when WordPress is using SSL, or "Force SSL Checkout" is enabled.
700
- * Fix: Issue with WPML and Variations.
701
- * Fix: Shipping & Total Order values are wrong on Sales Log page.
702
- * Fix: Terms and Conditions - Checkout page breaks if you read the terms and conditions.
703
- * Fix: Total shipping value and total price incorrect in transaction results.
704
- * Fix: Variation sales prices are inaccurate in Product Specials Widget
705
-
706
- = 3.8.8.1 =
707
- * Fix: CSV import not working in 3.8.8.
708
- * Fix: Category page display setting does not override default Presentation settings.
709
- * Fix: Clicking All/None in Category target market settings doesn't work.
710
- * Fix: Non-SSL stylesheet is loaded even when force SSL for checkout page is on.
711
- * Fix: PHP Warning and Notice in sales log page.
712
- * Fix: PayPal currency converter is wrong.
713
- * Fix: Sales logs are not displayed for some installations.
714
- * Fix: Sales logs page sometimes display empty customers' names.
715
- * Fix: Saving payment gateway settings erase Shipping settings.
716
- * Fix: Sometimes clicking Save doesn't save tracking ID on sales log page.
717
-
718
- = 3.8.8 =
719
- * New: Actions for bulk actions on sales page: wpsc_sales_log_process_bulk_action, wpsc_sales_log_extra_tablenav
720
- * New: Allow variation checkboxes to be collapsed & expanded without having to tick the variation set checkbox itself.
721
- * New: Digital Download UI improvement.
722
- * New: Extra hooks during checkout cart display: wpsc_before_checkout_cart_row, wpsc_before_checkout_cart_item_image, wpsc_after_checkout_cart_item_image, wpsc_before_checkout_cart_item_name, wpsc_after_checkout_cart_item_name, wpsc_after_checkout_cart_row
723
- * New: Filter for ordering the sales logs: wpsc_purchase_logs_orderby.
724
- * New: Filter wpsc_cart_shipping.
725
- * New: Filter wpsc_default_shipping_quote.
726
- * New: Filter wpsc_item_shipping_amount_db.
727
- * New: Filter wpsc_paypal_standard_post_data.
728
- * New: Filter wpsc_product_permalink_cat_slug.
729
- * New: Filter wpsc_product_postage_and_packaging.
730
- * New: Filter wpsc_shipping_quote_value.
731
- * New: Filters wpsc_calculate_total_tax, wpsc_coupons_amount.
732
- * New: 4 new filters for user meta in profile page and during checkout.class.php - wpsc_checkout_user_profile_get - wpsc_checkout_user_profile_update - wpsc_user_log_get - wpsc_user_log_update.
733
- * New: Settings Page API.
734
- * New: Some helpful filters to download_csv function: wpsc_purchase_log_start_end_csv, wpsc_purchase_log_month_year_csv, wpsc_purchase_log_month_year_csv, wpsc_purchase_log_csv_headers, wpsc_purchas_log_csv_output
735
- * New: Variation Drag & Drop sorting.
736
- * Change: Display file names instead of the product name on the downloads page.
737
- * Change: Improved variation UI in Product Edit page.
738
- * Change: In General Settings page, when changing country, load region / state list using AJAX instead of page reload.
739
- * Change: Only display variants' associated terms in Product Edit page rather than including the parent product name, which is redundant and cluttered.
740
- * Change: PayPal Standard settings now just offer dropdown of "live" / "sandbox" rather than URL entry.
741
- * Change: Subtle UX tweaks for Store Settings page.
742
- * Fix: %-based shipping cost is not working internationally.
743
- * Fix: $wpsc_query->query_vars['wpsc_product_category'] not always set on product page with hierarchical category permalinks.
744
- * Fix: Cannot add new Checkout field.
745
- * Fix: Cannot re-re-send buyer receipt.
746
- * Fix: 3.7 -> 3.8 Database Upgrade Routine causes some products with variations to display a $0.00 price.
747
- * Fix: Double <p> tag with wpec_taxes_display_tax_bands() on product edit page.
748
- * Fix: Fatal error when trying to include a non-existent admin file.
749
- * Fix: Hide Google Feed information from display
750
- * Fix: Incompatibility with Genesis framework in Product Edit page.
751
- * Fix: Make the WP eCommerce 3.8.x activation/installation routine much more efficient.
752
- * Fix: Mandatory fields in user_log_functions.php are not properly validated.
753
- * Fix: Memory improvement for productfeed.
754
- * Fix: Purchase logs have incorrect time if a timezone is specified in Settings->General.
755
- * Fix: Summary line does not get updated when sales log status is changed.
756
- * Fix: Total Quantity check fails for coupon codes.
757
- * Fix: USPS: "FLATE RATE ENVELOPE" should be changed to "VARIABLE" to allow for shipping quotes to be based on weight.
758
- * Fix: Use ->add_help_tab() to support WP 3.3 admin screen API.
759
- * Fix: Using discount causes Paypal Express to calculate wrong total amount.
760
- * Fix: get_the_content() is not enough in product feed.
761
- * Fix: settings page JS compatibility issue with Firefox.
762
- * Fix: wpsc_get_template_file_url() function is inefficient and causes 10 extra SQL queries per page load.
763
-
764
- = 3.8.7.6.1 =
765
- * Fix: PHP Warning for 'wpsc_load_settings_page' callback.
766
- * Fix: PHP Warning in wpsc-transaction_results_functions.php.
767
- * Fix: get_current_screen() is not available in WP 3.0.
768
-
769
- = 3.8.7.6 =
770
- * New: Default hook to filter sessionid for previously selected payment gateways.
771
- * Change: Stock notification emails are now sent to "purchase log email address" rather than admin address.
772
- * Fix: SQL injection vulnerability.
773
- * Fix: 3.7 -> 3.8 Database Upgrade Routine fails when importing variations sets with the same name.
774
- * Fix: Category link structure is not correct in pagination links with hierarchical category permalink.
775
- * Fix: Fix SQL error when using "?items_per_page=all" query.
776
- * Fix: Missing "Use as product thumbnail" on WordPress 3.3.
777
- * Fix: Products Page does not support custom page template - uses page.php instead.
778
- * Fix: Products page, category items per page is broken, relies on 'posts per page' setting in Settings -> reading.
779
- * Fix: Sticky post view broken due to deprecated query_string filter.
780
- * Fix: Sub-pages of Products Page aren't supported.
781
- * Fix: Total Quantity check for coupons.
782
- * Fix: Use ->add_help_tab() to support WP 3.3 admin screen API.
783
- * Fix: [wpsc_products] shortcode does not use 'Sort Product By' setting - it defaults to date-based ordering.
784
- * Fix: dashboard.css is loaded for WordPress > 3.3 (404 error).
785
-
786
- = 3.8.7.5 =
787
- * Fix XSS vulnerability.
788
-
789
- = 3.8.7.4 =
790
- * Fix: "Session expired" error when viewing Customer Account page.
791
-
792
- = 3.8.7.3 =
793
- * Security fixes.
794
-
795
- = 3.8.7.2 =
796
- * New: Support for g:availability to Google Merchant Centre feed. Props bbaskets & longercat
797
- * Fix: Admin product page sorting by column was not working.
798
- * Fix: Call to undefined function wpsc_clear_stock_claims().
799
- * Fix: Checkbox and Radio buttons have unexpected issues in checkout.
800
- * Fix: Checkout field options' values are mutilated before getting inserted into the database.
801
- * Fix: PayPal standard IPN fails if data used to validate the IPN POST contains ' or ".
802
- * Fix: Price incorrectly updated when multiple products with variations exist on the same page.
803
- * Fix: Security vulnerability.
804
- * Fix: ShareThis integration does not properl respect HTTPS connections.
805
- * Fix: The Terms and conditions checkbox on the checkout page should have a required field asterisk, just like all other required checkout fields do.
806
- * Fix: Wrong login URL for [userlog] page.
807
- * Fix: Zero shipping price doesn't work in flatrate.php.
808
- * Fix: invalid HTML on checkout page for default theme.
809
- * Fix: wpsc_coupons::uses_coupons() needs optimization.
810
-
811
- = 3.8.7.1 =
812
- * Fix: Fancy notifications not being displayed on single product page.
813
- * Fix: Sale and normal prices are switched around.
814
-
815
- = 3.8.7 =
816
- * New: 'insert_child_product_meta' filter to allow customising of meta data when a variation product (child product) is created.
817
- * New: 'wpsc_variation_groups' and 'wpsc_all_associated_variations' filters. Allows customising order of variation menu items etc.
818
- * New: Add hook "wpsc_product_form_fields_end" and rename "wpsc_product_form_fields" to "wpsc_product_form_fields_begin" to offer more flexibility when adding new fields to the product form.
819
- * New: Add hooks "wpsc_add_to_cart_button_form_begin" and "wpsc_add_to_cart_button_form_end" when outputting [add_to_cart] shortcode. wpsc_add_to_cart_button() is also refactored to get rid of ugly repetitive "$output .= ".
820
- * New: Additional hooks for adding extra FORM fields to the add to cart form.
821
- * New: Additional filter hooks for product price and transaction result messages.
822
- * New: Allow hierarchical product category URL.
823
- * New: Hooks 'wpsc_product_form_fields_begin' and 'wpsc_product_form_fields_end' for list and grid views.
824
- * New: Option to set claimed stock clearance interval (Store Settings -> General).
825
- * New: filterable g:shipping_weight to google product feed. Thanks to Rudy Hassall.
826
- * Change: Proper post updated messages - now says "Product updated" instead or "Post updated".
827
- * Change: Settings tabs are restyled to conform with WordPress UI. Props Pippin.
828
- * Fix: A product is displayed as "sold out" when its variations' stock control options are turned off.
829
- * Fix: Additional Checkout Form Fields Not Showing with Variation. Props jRayx.
830
- * Fix: Australia Post shipping quote caching by reducing the transient key length from 51 to 41 characters.
831
- * Fix: AJAX error when changing country with a coupon applied.
832
- * Fix: Breadcrumbs not showing for empty product categories.
833
- * Fix: Discounts / coupons not passing to Paypal Standard.
834
- * Fix: Error with merging image metadata in Media popup. Props Ben Huson.
835
- * Fix: Fancy notifications are sometimes output twice.
836
- * Fix: Fatal memory allocation error in Add Product page when WPEC downloadable folder is not created yet.
837
- * Fix: Incompatibility with WP 3.3-dev (dashboard.css is merged into wp-admin.css).
838
- * Fix: JavaScript globals not properly escaped, causing fatal JS errors due to internationalized strings that have single quotes in them.
839
- * Fix: Paypal Express Checkout fails if product names contain unicode special characters.
840
- * Fix: Paypal Standard passes wrong discount amount.
841
- * Fix: PHP Notice when activating wpec, resulting in 'unexpected output' error message.
842
- * Fix: PHP Notice when editing product category.
843
- * Fix: PHP notice in wpsc-functions.php.
844
- * Fix: Product categories sometimes disappear in admin (but still show on front end).
845
- * Fix: Product variations not deleted when deleting a product from the trash.
846
- * Fix: Products with variations display 'from' even if all prices are the same. Change: Product that have variations will display "from" price regardless of whether the variations are in stock or not (to avoid inconsistency).
847
- * Fix: Removing additional description of a product doesn't have any effect. Props groques.
848
- * Fix: SQL error when updating from 3.7.
849
- * Fix: Saving thumbnail settings caused PHP timeout.
850
- * Fix: Single product image is not re-generated properly sometimes.
851
- * Fix: User submitted data is double-escaped, causing slashes to be stored in database table and sent to payment gateways.
852
- * Fix: Variations are not cloned properly when duplicating a product, causing error / hang in wp-admin.
853
- * Fix: WP Menus items don't apply current-menu-item (and ancestor) for product categories.
854
- * Fix: When on the edit products page, the filter by category menu does not show subcategories if the parent has no products. Props benjaminhuson.
855
- * Fix: for paypal express, coupons being included when there are none
856
- * Fix: is_home() is true when viewing default category on products page.
857
- * Fix: login redirect on checkout page if WordPress files are in a subfolder.
858
- * Fix: $wpsc_cart->use_shipping() returns true even when shipping is disabled.
859
- * Fix: wpsc_display_purchlog_totalprice() returns wrong value. Props dlingren for initial patch.
860
- * Fix: wpsc_is_single_product() returns false even when viewing a single product. Props Ben Huson for initial patch.
861
- * Fix: wpsc_the_product_thumbnail() sometimes returns relative URL instead of absolute URL, which causes image failure in Google Product Feed.
862
-
863
-
864
- = 3.8.6.1 =
865
- * Fix: Security vulnerability in chronopay.
866
-
867
- = 3.8.6 =
868
- * New: Filter for 'wpsc_display_product_multicurrency'.
869
- * New: Additional filters for compatibility with WPML.
870
- * Change: Discount information is now displayed on the Packing Slip.
871
- * Fix: Sometimes wpsc_product_has_multicurrency() returns true when it should return false.
872
- * Fix: Edit product page makes many database queries if you have lots of variations.
873
- * Fix: Variation prices are not calculated correctly.
874
- * Fix: Request-URI Too Large error when searching on the Admin Products page with lots of products.
875
- * Fix: Add to cart shortcode doesn't display fancy notifications, and also doesn't check whether variations are selected.
876
- * Fix: Infinite AJAX loop on checkout page when Same as Billing is checked.
877
- * Fix: Per-item shipping total is calculated incorrectly in various places (Packing Slip, Sales Report etc.).
878
- * Fix: Wrong product link when the product is assigned multiple categories.
879
- * Fix: Canonical tags are not generated correctly for products with multiple categories.
880
- * Fix: Edit variations inline messes up columns when stock limitation is disabled.
881
- * Fix: Product with no category selected is not automatically assigned a default category when sort by drag&drop is enabled.
882
- * Fix: Unnecessary use of livequery in variations.js causes Product edit page to freeze when there are many variation sets.
883
- * Fix: Slashes added to checkout form field that has single quotes in it (e.g: O\'Connor).
884
- * Fix: Multicurrency price is truncated when displayed.
885
- * Fix: Checkout page keeps refreshing without displaying Google Checkout Button.
886
- * Fix: Discount doesn't work with Paypal Standard.
887
- * Fix: wpsc_single_template is not removed from the_content after it's run, causing subsequent the_content() calls to output the single product again.
888
- * Fix: Sorting product categories is broken.
889
- * Fix: Coupon rule "In Category" not taken into consideration.
890
- * Fix: WPEC default stylesheet imposes #content font-size.
891
- * Fix: Incompatibility with Prototype JS library.
892
- * Fix: Checking (or unchecking) Stock checkbox when editing product causes variation table columns to break.
893
- * Fix: jQuery 1.6 incompatibility with attr( 'className' ).
894
-
895
- == Frequently Asked Questions ==
896
-
897
- = How do I customize WP eCommerce =
898
-
899
- First of all, you should check out the Presentation settings which are in the Settings -> Store page.
900
-
901
- For advanced users, all of our eCommerce templates and CSS can be moved into your active theme folder for customization. Less advanced users have [several fantastic WP eCommerce consultants](https://wpecommerce.org/hire-an-expert/) to get help from.
902
-
903
- = What payment gateways does WP eCommerce integrate with? =
904
-
905
- Our [Gold Cart plugin](https://wpecommerce.org/store/premium-plugins/gold-cart/) contains nearly a dozen payment gateway options, including Authorize.net, LinkPoint and DPS. Our [Mirijeh integration plugin](https://wpecommerce.org/store/premium-plugins/mijireh-99-payment-gateways-pack/) provides access to nearly one hundred different gateway options. Beyond that, we have individual integration plugins for [Braintree](https://wpecommerce.org/store/product/paypal-powered-by-braintree/), [Stripe](https://wpecommerce.org/store/premium-plugins/stripe/), [Authorize.net SIM](https://wpecommerce.org/store/premium-plugins/authorize-net-sim-payment-gateway-for-wordpress/) and more.
906
-
907
- = I want to integrate a payment gateway that you don't support. Can you help with that? =
908
-
909
- Absolutely! We have a [growing list of trusted consultants](https://wpecommerce.org/hire-an-expert/) who would be happy to partner with you to build a custom gateway. Alternatively, you're more than welcome to request that we build it as a plugin or part of our core plugin. The more requests we get, the more likely we are to build it. If you happen to be a talented developer, we have a great documentation site with helpful information on building payment gateways
910
-
911
- = Which couriers does the plugin integrate with? =
912
-
913
- We have table rate, weight rate and flat rate shipping calculators.
914
-
915
- We also currently integrate with UPS, USPS, Australia Post and Shipwire for real-time shipping rates. We have a premium plugin for [FedEx](https://wpecommerce.org/store/product/fedex-shipping-module/) as well.
916
-
917
- = Which multi-lingual plugins is WP eCommerce compatible with? =
918
-
919
- We currently provide basic support for WPML and qTranslate. We're excited about an up-and-coming multi-lingual project called [Babble](https://github.com/cftp/babble). We intend to fully and canonically support Babble as our primary multi-lingual partner in releases to come.
920
-
921
- = Which additional modules are available for use with WP eCommerce? =
922
-
923
- * [Gold Cart](https://wpecommerce.org/store/premium-plugins/gold-cart/) - adds more options, gateways and functionality to your store
924
- * [MP3 Audio Player](https://wpecommerce.org/store/premium-plugins/mp3-player-plugin/) - Preview audio clips on your website
925
- * [Members Plugin](https://wpecommerce.org/store/product/membership-subscriptions/) - Integrates with PayPal Standard and Authorize.Net, allows you to create a Subscription-Based Product, as well as a "Members-Only" website with paid access to restricted content.
926
-
927
- = How do you provide support? =
928
-
929
- Each Addon comes with a license key that you can use to receive high-touch, 1-on-1 support from our trained support staff for any issues related to the addon in question. If you submit a support request here, you'll get a helpful response within 24 hours or less (during business hours).
930
-
931
- You can also receive premium support for general WP eCommerce issue if you purchase and have a valid Premium Support subscription (https://wpecommerce.org/premium-support-pricing/)
932
-
933
- For the rest of our users, we do our best to monitor the WordPress.org support forums and respond in as timely a manner as we are able. We appreciate the countless helpful volunteers who also take time to respond to forum posts here.
934
-
935
- == Screenshots ==
936
-
937
- 1. Products list in WordPress backend
938
- 2. Edit Product screen
939
- 3. Single product page
940
- 4. Checkout page
941
-
942
- == Upgrade Notice ==
943
-
944
- = 3.8.1 =
945
- This version addresses several urgent issues when upgrading from 3.7.x to 3.8.
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
trunk/screenshot-1.png DELETED
Binary file
trunk/screenshot-2.png DELETED
Binary file
trunk/screenshot-3.png DELETED
Binary file
trunk/screenshot-4.png DELETED
Binary file
trunk/wp-shopping-cart.php DELETED
@@ -1,353 +0,0 @@
1
- <?php
2
- /**
3
- * Plugin Name: WP eCommerce
4
- * Plugin URI: http://wpecommerce.org/
5
- * Description: A plugin that provides a WordPress Shopping Cart. See also: <a href="http://wpecommerce.org" target="_blank">WPeCommerce.org</a> | <a href="https://wordpress.org/support/plugin/wp-e-commerce/" target="_blank">Support Forum</a> | <a href="http://docs.wpecommerce.org/" target="_blank">Documentation</a>
6
- * Version: 3.12.3
7
- * Author: WP eCommerce
8
- * Author URI: http://wpecommerce.org/
9
- * Text Domain: wp-e-commerce
10
- **/
11
-
12
- /**
13
- * WP_eCommerce
14
- *
15
- * Main WPEC Plugin Class
16
- *
17
- * @package wp-e-commerce
18
- */
19
- class WP_eCommerce {
20
- private $components = array(
21
- 'merchant' => array(),
22
- 'marketplace' => array(),
23
- 'theme-engine' => array(),
24
- );
25
-
26
- /**
27
- * Start WPEC on plugins loaded
28
- *
29
- * @uses add_action() Attaches to 'plugins_loaded' hook
30
- * @uses add_filter() Attaches to 'wpsc_components' hook
31
- */
32
- public function __construct() {
33
- add_action( 'plugins_loaded' , array( $this, 'init' ), 8 );
34
- add_filter( 'wpsc_components', array( $this, '_register_core_components' ) );
35
- }
36
-
37
- /**
38
- * Takes care of loading up WPEC
39
- *
40
- * @uses WP_eCommerce::start() Initializes basic WPEC constants
41
- * @uses WP_eCommerce::constants() Setup WPEC core constants
42
- * @uses WP_eCommerce::includes() Includes the WPEC files
43
- * @uses WP_eCommerce::load() Setup WPEC Core
44
- * @uses do_action() Calls 'wpsc_pre_init' which runs before WPEC initializes
45
- * @uses do_action() Calls 'wpsc_init' runs just after WPEC initializes
46
- */
47
- public function init() {
48
- // Previous to initializing
49
- do_action( 'wpsc_pre_init' );
50
-
51
- // Initialize
52
- $this->start();
53
- $this->constants();
54
- $this->includes();
55
- $this->load();
56
-
57
- // Finished initializing
58
- do_action( 'wpsc_init' );
59
- }
60
-
61
- /**
62
- * New WPSC components API.
63
- *
64
- * Allows for modular coupling of different functionalities within WPSC.
65
- * This is the way we'll be introducing cutting-edge APIs.
66
- *
67
- * @since 3.8.9.5
68
- *
69
- * @param array $components
70
- * @return array $components
71
- */
72
- public function _register_core_components( $components ) {
73
- $components['merchant']['core-v2'] = array(
74
- 'title' => __( 'WP eCommerce Merchant API v2', 'wp-e-commerce' ),
75
- 'includes' =>
76
- WPSC_FILE_PATH . '/wpsc-components/merchant-core-v2/merchant-core-v2.php'
77
- );
78
-
79
- $components['merchant']['core-v3'] = array(
80
- 'title' => __( 'WP eCommerce Merchant API v3', 'wp-e-commerce' ),
81
- 'includes' =>
82
- WPSC_FILE_PATH . '/wpsc-components/merchant-core-v3/merchant-core-v3.php'
83
- );
84
-
85
- $components['marketplace']['core-v1'] = array(
86
- 'title' => __( 'WP eCommerce Marketplace API v1', 'wp-e-commerce' ),
87
- 'includes' =>
88
- WPSC_FILE_PATH . '/wpsc-components/marketplace-core-v1/marketplace-core-v1.php'
89
- );
90
-
91
- $components['fancy-notifications']['fancy-notifications-v1'] = array(
92
- 'title' => __( 'Fancy Notifications v1', 'wpsc' ),
93
- 'includes' => WPSC_FILE_PATH . '/wpsc-components/fancy-notifications/fancy-notifications.php'
94
- );
95
-
96
- return $components;
97
- }
98
-
99
- /**
100
- * Initialize the basic WP eCommerce constants
101
- *
102
- * @uses plugins_url() Retrieves url to plugins directory
103
- * @uses load_plugin_textdomain() Loads plugin transations strings
104
- * @uses plugin_basename() Gets the basename of a plugin (extracts the name of a plugin from its filename)
105
- * @uses do_action() Calls 'wpsc_started' which runs after WPEC has started
106
- */
107
- public function start() {
108
- // Set the core file path
109
- define( 'WPSC_FILE_PATH', dirname( __FILE__ ) );
110
-
111
- // Define the path to the plugin folder
112
- define( 'WPSC_DIR_NAME', basename( WPSC_FILE_PATH ) );
113
- define( 'WPSC_PLUGIN_BASENAME', plugin_basename( __FILE__ ) );
114
-
115
- // Define the URL to the plugin folder
116
- define( 'WPSC_FOLDER', dirname( WPSC_PLUGIN_BASENAME ) );
117
- define( 'WPSC_URL', plugins_url( '', __FILE__ ) );
118
-
119
- add_filter( 'load_textdomain_mofile', array( $this, 'load_old_textdomain' ), 10, 2 );
120
-
121
- //load text domain
122
- if ( ! load_plugin_textdomain( 'wp-e-commerce', false, '../languages/' ) ) {
123
- load_plugin_textdomain( 'wp-e-commerce', false, dirname( WPSC_PLUGIN_BASENAME ) . '/wpsc-languages/' );
124
- }
125
-
126
- // Finished starting
127
- do_action( 'wpsc_started' );
128
- }
129
-
130
- /**
131
- * Load a .mo file for the old textdomain if one exists
132
- * Necessary to maintain backwards compatibility after changing text-domains.
133
- *
134
- * @since 3.11.0
135
- * @link: https://github.com/10up/grunt-wp-plugin/issues/21#issuecomment-62003284
136
- */
137
- public function load_old_textdomain( $mofile, $textdomain ) {
138
- if ( $textdomain === 'wp-e-commerce' && ! file_exists( $mofile ) ) {
139
- $mofile = dirname( $mofile ) . DIRECTORY_SEPARATOR . str_replace( $textdomain, 'wpsc', basename( $mofile ) );
140
- }
141
- return $mofile;
142
- }
143
-
144
- /**
145
- * Sets table names as WPDB properties.
146
- *
147
- * @since 3.11.5
148
- * @return array Array of custom tables
149
- */
150
- public function setup_table_names() {
151
- global $wpdb;
152
-
153
- $wpdb->wpsc_meta = WPSC_TABLE_META;
154
- $wpdb->wpsc_also_bought = WPSC_TABLE_ALSO_BOUGHT;
155
- $wpdb->wpsc_region_tax = WPSC_TABLE_REGION_TAX;
156
- $wpdb->wpsc_coupon_codes = WPSC_TABLE_COUPON_CODES;
157
- $wpdb->wpsc_cart_contents = WPSC_TABLE_CART_CONTENTS;
158
- $wpdb->wpsc_claimed_stock = WPSC_TABLE_CLAIMED_STOCK;
159
- $wpdb->wpsc_currency_list = WPSC_TABLE_CURRENCY_LIST;
160
- $wpdb->wpsc_purchase_logs = WPSC_TABLE_PURCHASE_LOGS;
161
- $wpdb->wpsc_checkout_forms = WPSC_TABLE_CHECKOUT_FORMS;
162
- $wpdb->wpsc_product_rating = WPSC_TABLE_PRODUCT_RATING;
163
- $wpdb->wpsc_download_status = WPSC_TABLE_DOWNLOAD_STATUS;
164
- $wpdb->wpsc_submitted_form_data = WPSC_TABLE_SUBMITTED_FORM_DATA;
165
- $wpdb->wpsc_cart_itemmeta = WPSC_TABLE_CART_ITEM_META;
166
- $wpdb->wpsc_purchasemeta = WPSC_TABLE_PURCHASE_META;
167
- $wpdb->wpsc_visitors = WPSC_TABLE_VISITORS;
168
- $wpdb->wpsc_visitormeta = WPSC_TABLE_VISITOR_META;
169
-
170
- return array(
171
- $wpdb->wpsc_meta ,
172
- $wpdb->wpsc_also_bought ,
173
- $wpdb->wpsc_region_tax ,
174
- $wpdb->wpsc_coupon_codes ,
175
- $wpdb->wpsc_cart_contents ,
176
- $wpdb->wpsc_claimed_stock ,
177
- $wpdb->wpsc_currency_list ,
178
- $wpdb->wpsc_purchase_logs ,
179
- $wpdb->wpsc_checkout_forms ,
180
- $wpdb->wpsc_product_rating ,
181
- $wpdb->wpsc_download_status ,
182
- $wpdb->wpsc_submitted_form_data,
183
- $wpdb->wpsc_cart_itemmeta ,
184
- $wpdb->wpsc_purchasemeta ,
185
- $wpdb->wpsc_visitors ,
186
- $wpdb->wpsc_visitormeta ,
187
- );
188
- }
189
-
190
- /**
191
- * Setup the WPEC core constants
192
- *
193
- * @uses wpsc_core_constants() Loads the WPEC Core constants
194
- * @uses wpsc_core_is_multisite() Checks if this is a multisite install. True if is multisite
195
- * @uses wpsc_core_load_session() Loads the WPEC core session
196
- * @uses wpsc_core_constants_version_processing() Checks and sets a constant for WordPress version
197
- * @uses wpsc_core_constants_table_names() Sets constants for WPEC table names
198
- * @uses wpsc_core_constants_uploads() Set the upload related constants
199
- * @uses do_action() Calls 'wpsc_constants' which runs after the WPEC constants are defined
200
- */
201
- public function constants() {
202
- // Define globals and constants used by wp-e-commerce
203
- require_once( WPSC_FILE_PATH . '/wpsc-core/wpsc-constants.php' );
204
-
205
- // Load the WPEC core constants
206
- wpsc_core_constants();
207
-
208
- // Is WordPress Multisite
209
- wpsc_core_is_multisite();
210
-
211
- // Start the wpsc session
212
- wpsc_core_load_session();
213
-
214
- // Which version of WPEC
215
- wpsc_core_constants_version_processing();
216
-
217
- // WPEC Table names and related constants
218
- wpsc_core_constants_table_names();
219
-
220
- // setup wpdb table name attributes
221
- $this->setup_table_names();
222
-
223
- // Uploads directory info
224
- wpsc_core_constants_uploads();
225
-
226
- // Any additional constants can hook in here
227
- do_action( 'wpsc_constants' );
228
- }
229
-
230
- /**
231
- * Include the rest of WPEC's files
232
- *
233
- * @uses apply_filters() Calls 'wpsc_components' private merchant components
234
- * @uses do_action() Calls 'wpsc_includes' which runs after WPEC files have been included
235
- */
236
- public function includes() {
237
- require_once( WPSC_FILE_PATH . '/wpsc-includes/wpsc-meta-util.php' );
238
- require_once( WPSC_FILE_PATH . '/wpsc-includes/customer.php' );
239
- require_once( WPSC_FILE_PATH . '/wpsc-includes/wpsc-meta-customer.php' );
240
- require_once( WPSC_FILE_PATH . '/wpsc-includes/wpsc-meta-visitor.php' );
241
- require_once( WPSC_FILE_PATH . '/wpsc-includes/wpsc-meta-cart-item.php' );
242
- require_once( WPSC_FILE_PATH . '/wpsc-core/wpsc-functions.php' );
243
- require_once( WPSC_FILE_PATH . '/wpsc-core/wpsc-installer.php' );
244
- require_once( WPSC_FILE_PATH . '/wpsc-core/wpsc-includes.php' );
245
-
246
- $this->components = apply_filters( 'wpsc_components', $this->components );
247
-
248
- foreach ( $this->components as $type => $registered ) {
249
- foreach ( $registered as $component ) {
250
-
251
- if ( ! is_array( $component['includes'] ) ) {
252
- $component['includes'] = array( $component['includes'] );
253
- }
254
-
255
- foreach ( $component['includes'] as $include ) {
256
- require_once( $include );
257
- }
258
- }
259
- }
260
-
261
- // Any additional file includes can hook in here
262
- do_action( 'wpsc_includes' );
263
- }
264
-
265
- /**
266
- * Setup the WPEC core
267
- *
268
- * @uses do_action() Calls 'wpsc_pre_load' which runs before WPEC setup
269
- * @uses do_action() Calls 'wpsc_before_init' which is a legacy action
270
- * @uses _wpsc_action_create_customer_id() Sets up a customer id just in case we don't have it
271
- * @uses wpsc_core_setup_globals() Sets up the WPEC core globals
272
- * @uses wpsc_core_setup_cart() Sets up the WPEC core cart
273
- * @uses wpsc_core_load_thumbnail_sizes() Sets up the core WPEC thumbnail sizes
274
- * @uses wpsc_core_load_purchase_log_statuses() Loads the statuses for the purchase logs
275
- * @uses wpsc_core_load_checkout_data() Sets up the core WPEC form checkout data
276
- * @uses wpsc_core_load_gateways() Loads the merchants from the directory
277
- * @uses wpsc_core_load_shipping_modules() Gets shipping modules from the shipping directory
278
- * @uses wpsc_core_load_page_titles() Loads the core WPEC pagetitles
279
- * @uses do_action() Calls 'wpsc_loaded' which runs after WPEC is fully loaded
280
- */
281
- public function load() {
282
- // Before setup
283
- do_action( 'wpsc_pre_load' );
284
-
285
- // Legacy action
286
- do_action( 'wpsc_before_init' );
287
-
288
- // Setup the core WPEC globals
289
- wpsc_core_setup_globals();
290
-
291
- add_action( 'init', '_wpsc_action_setup_customer', 1 );
292
-
293
- // WPEC is ready to use as soon as WordPress and customer is setup and loaded
294
- add_action( 'init', array( $this, '_wpsc_fire_ready_action' ), 100 );
295
-
296
- // Load the purchase log statuses
297
- wpsc_core_load_purchase_log_statuses();
298
-
299
- // Load unique names and checkout form types
300
- wpsc_core_load_checkout_data();
301
-
302
- // Load the gateways
303
- wpsc_core_load_gateways();
304
-
305
- // Load the shipping modules
306
- wpsc_core_load_shipping_modules();
307
-
308
- // WPEC is fully loaded
309
- do_action( 'wpsc_loaded' );
310
- }
311
-
312
- public function _wpsc_fire_ready_action() {
313
- // WPEC is ready to use as soon as WordPress and customer is setup and loaded
314
- do_action( 'wpsc_ready' );
315
- }
316
-
317
- /**
318
- * WPEC Activation Hook
319
- *
320
- * @uses deactivate_plugins() Deactivates plugins by string
321
- * @uses wp_die() Kills loading and returns the HTML
322
- * @uses wpsc_install() Performs checks to see if this is a clean install or not
323
- */
324
- public function install() {
325
-
326
- if ( ! defined( 'WPSC_FILE_PATH' ) ) {
327
- define( 'WPSC_FILE_PATH', dirname( __FILE__ ) );
328
- }
329
-
330
- require_once( WPSC_FILE_PATH . '/wpsc-core/wpsc-installer.php' );
331
- $this->constants();
332
- wpsc_install();
333
- }
334
-
335
- /**
336
- * Runs the WPEC deactivation routines.
337
- *
338
- * @uses wp_get_schedules() Retrieves all filtered WP_Cron recurrences
339
- * @uses wp_clear_scheduled_hook() Removes any hooks on WP_Cron
340
- */
341
- public function deactivate() {
342
- foreach ( wp_get_schedules() as $cron => $schedule ) {
343
- wp_clear_scheduled_hook( "wpsc_{$cron}_cron_task" );
344
- }
345
- }
346
- }
347
-
348
- // Start WPEC
349
- $wpec = new WP_eCommerce();
350
-
351
- // Activation
352
- register_activation_hook( __FILE__ , array( $wpec, 'install' ) );
353
- register_deactivation_hook( __FILE__, array( $wpec, 'deactivate' ) );
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
trunk/wpsc-admin/admin-form-functions.php DELETED
@@ -1,265 +0,0 @@
1
- <?php
2
- /**
3
- * The Admin Form Functions
4
- *
5
- * These are the functions that power administrative forms in the WordPress admin
6
- *
7
- * @package wp-e-commerce
8
- */
9
- function coupon_edit_form($coupon) {
10
-
11
- $conditions = maybe_unserialize($coupon['condition']);
12
-
13
- $start_timestamp = strtotime($coupon['start']);
14
- $end_timestamp = strtotime($coupon['expiry']);
15
- $id = $coupon['id'];
16
- $output = '';
17
- $output .= "<form name='edit_coupon' id='".$coupon['coupon_code']."' method='post' action=''>\n\r";
18
- $output .= "<table class='add-coupon'>\n\r";
19
- $output .= " <tr>\n\r";
20
- $output .= " <th>".esc_html__('Coupon Code', 'wp-e-commerce')."</th>\n\r";
21
- $output .= " <th>".esc_html__('Discount', 'wp-e-commerce')."</th>\n\r";
22
- $output .= " <th>".esc_html__('Start', 'wp-e-commerce')."</th>\n\r";
23
- $output .= " <th>".esc_html__('Expiry', 'wp-e-commerce')."</th>\n\r";
24
- $output .= " <th>".esc_html__('Use Once', 'wp-e-commerce')."</th>\n\r";
25
- $output .= " <th>".esc_html__('Active', 'wp-e-commerce')."</th>\n\r";
26
- $output .= " <th>".esc_html__('Apply On All Products', 'wp-e-commerce')."</th>\n\r";
27
- $output .= " <th></th>\n\r";
28
- $output .= " </tr>\n\r";
29
- $output .= " <tr>\n\r";
30
- $output .= " <td>\n\r";
31
- $output .= " <input type='hidden' value='true' name='is_edit_coupon' />\n\r";
32
- $output .= " <input type='text' size='11' value='".$coupon['coupon_code']."' name='edit_coupon[".$id."][coupon_code]' />\n\r";
33
- $output .= " </td>\n\r";
34
- $output .= " <td>\n\r";
35
-
36
- $output .= " <input type='text' size='3' value='".$coupon['value']."' name=edit_coupon[".$id."][value]' />";
37
- $output .= " <select name='edit_coupon[".$id."][is-percentage]'>";
38
- $output .= " <option value='0' ".(($coupon['is-percentage'] == 0) ? "selected='true'" : '')." >$</option>\n\r";//
39
- $output .= " <option value='1' ".(($coupon['is-percentage'] == 1) ? "selected='true'" : '')." >%</option>\n\r";
40
- $output .= " <option value='2' ".(($coupon['is-percentage'] == 2) ? "selected='true'" : '')." >" . esc_html__( 'Free shipping', 'wp-e-commerce' ) . "</option>\n\r";
41
- $output .= " </select>\n\r";
42
- $output .= " </td>\n\r";
43
- $output .= " <td>\n\r";
44
- $coupon_start = get_date_from_gmt( $coupon['start'], 'Y-m-d' );
45
- $output .= "<input type='text' class='pickdate' size='11' name='edit_coupon[".$id."][start]' value='{$coupon_start}'>";
46
- $output .= " </td>\n\r";
47
- $output .= " <td>\n\r";
48
- $coupon_expiry = get_date_from_gmt( $coupon['expiry'], 'Y-m-d' );
49
- $output .= "<input type='text' class='pickdate' size='11' name='edit_coupon[".$id."][expiry]' value='{$coupon_expiry}'>";
50
- $output .= " </td>\n\r";
51
- $output .= " <td>\n\r";
52
- $output .= " <input type='hidden' value='0' name='edit_coupon[".$id."][use-once]' />\n\r";
53
- $output .= " <input type='checkbox' value='1' ".(($coupon['use-once'] == 1) ? "checked='checked'" : '')." name='edit_coupon[".$id."][use-once]' />\n\r";
54
- $output .= " </td>\n\r";
55
- $output .= " <td>\n\r";
56
- $output .= " <input type='hidden' value='0' name='edit_coupon[".$id."][active]' />\n\r";
57
- $output .= " <input type='checkbox' value='1' ".(($coupon['active'] == 1) ? "checked='checked'" : '')." name='edit_coupon[".$id."][active]' />\n\r";
58
- $output .= " </td>\n\r";
59
- $output .= " <td>\n\r";
60
- $output .= " <input type='hidden' value='0' name='edit_coupon[".$id."][add_every_product]' />\n\r";
61
- $output .= " <input type='checkbox' value='1' ".(($coupon['every_product'] == 1) ? "checked='checked'" : '')." name='edit_coupon[".$id."][add_every_product]' />\n\r";
62
- $output .= " </td>\n\r";
63
- $output .= " <td>\n\r";
64
- $output .= " <input type='hidden' value='".$id."' name='edit_coupon[".$id."][id]' />\n\r";
65
- $output .= " </td>\n\r";
66
- $output .= " </tr>\n\r";
67
-
68
- if($conditions != null){
69
- $output .= "<tr>";
70
- $output .= "<th>";
71
- $output .= esc_html__("Conditions", 'wp-e-commerce');
72
- $output .= "</th>";
73
- $output .= "</tr>";
74
- $output .= "<th>";
75
- $output .= esc_html__("Delete", 'wp-e-commerce');
76
- $output .= "</th>";
77
- $output .= "<th>";
78
- $output .= esc_html__("Property", 'wp-e-commerce');
79
- $output .= "</th>";
80
- $output .= "<th>";
81
- $output .= esc_html__("Logic", 'wp-e-commerce');
82
- $output .= "</th>";
83
- $output .= "<th>";
84
- $output .= esc_html__("Value", 'wp-e-commerce');
85
- $output .= "</th>";
86
- $output .= " </tr>\n\r";
87
-
88
- foreach ($conditions as $i => $condition){
89
- $output .= "<tr>";
90
- $output .= "<td>";
91
- $output .= "<input type='hidden' name='coupon_id' value='".$id."' />";
92
- $output .= "<input type='submit' id='delete_condition".$i."' style='display:none;' value='".$i."' name='delete_condition' />";
93
- $output .= "<span style='cursor:pointer;' class='delete_button' onclick='jQuery(\"#delete_condition".$i."\").click()'>" . esc_html__('Delete', 'wp-e-commerce' ) . "</span>";
94
- $output .= "</td>";
95
- $output .= "<td>";
96
- $output .= $condition['property'];
97
- $output .= "</td>";
98
- $output .= "<td>";
99
- $output .= $condition['logic'];
100
- $output .= "</td>";
101
- $output .= "<td>";
102
- $output .= $condition['value'];
103
- $output .= "</td>";
104
- $output .= "</tr>";
105
- $i++;
106
- }
107
- $output .= wpsc_coupons_conditions( $id);
108
- }elseif($conditions == null){
109
- $output .= wpsc_coupons_conditions( $id);
110
-
111
- }
112
- $output .= "</table>\n\r";
113
- $output .= "</form>\n\r";
114
- echo $output;
115
- return $output;
116
- }
117
- function wpsc_coupons_conditions($id){
118
- ?>
119
-
120
- <?php
121
-
122
- $output ='
123
- <input type="hidden" name="coupon_id" value="'.$id.'" />
124
- <tr><td colspan="3"><b>' . esc_html__( 'Add Conditions', 'wp-e-commerce') . '</b></td></tr>
125
- <tr><td colspan="6">
126
- <div class="coupon_condition">
127
- <div>
128
- <select class="ruleprops" name="rules[property][]">
129
- <option value="item_name" rel="order">' . esc_html__( 'Item name', 'wp-e-commerce') . '</option>
130
- <option value="item_quantity" rel="order">' . esc_html__( 'Item quantity', 'wp-e-commerce') . '</option>
131
- <option value="total_quantity" rel="order">' . esc_html__( 'Total quantity', 'wp-e-commerce') . '</option>
132
- <option value="subtotal_amount" rel="order">' . esc_html__( 'Subtotal amount', 'wp-e-commerce') . '</option>
133
- ' . apply_filters( 'wpsc_coupon_rule_property_options', '' ) . '
134
- </select>
135
- <select name="rules[logic][]">
136
- <option value="equal">' . esc_html__( 'Is equal to', 'wp-e-commerce') . '</option>
137
- <option value="greater">' . esc_html__( 'Is greater than', 'wp-e-commerce') . '</option>
138
- <option value="less">' . esc_html__( 'Is less than', 'wp-e-commerce') . '</option>
139
- <option value="contains">' . esc_html__( 'Contains', 'wp-e-commerce') . '</option>
140
- <option value="not_contain">' . esc_html__( 'Does not contain', 'wp-e-commerce') . '</option>
141
- <option value="begins">' . esc_html__( 'Begins with', 'wp-e-commerce') . '</option>
142
- <option value="ends">' . esc_html__( 'Ends with', 'wp-e-commerce') . '</option>
143
- </select>
144
- <span>
145
- <input type="text" name="rules[value][]"/>
146
- </span>
147
-
148
-
149
- </div>
150
- </div>
151
- </td>
152
- <td>
153
- </td>
154
- <td colspan="3">
155
- <input type="submit" value="'.esc_attr__("Update Coupon", 'wp-e-commerce').'" class="button-primary" name="edit_coupon['.$id.'][submit_coupon]" />';
156
-
157
- $nonced_url = admin_url( 'admin.php' );
158
- $nonced_url = add_query_arg(
159
- array(
160
- 'wpsc_admin_action' => 'wpsc-delete-coupon',
161
- 'delete_id' => $id,
162
- '_wp_http_referer' => urlencode( admin_url( 'edit.php?post_type=wpsc-product&page=wpsc-edit-coupons' ) ),
163
- ),
164
- $nonced_url
165
- );
166
- $nonced_url = wp_nonce_url( $nonced_url, 'delete-coupon' );
167
-
168
- $output.= "<a class='delete_button' style='text-decoration:none;' href=" .$nonced_url.">" . esc_html__( 'Delete', 'wp-e-commerce' ) . "</a>";
169
-
170
- $output.='
171
- </td>
172
- </tr>
173
- ';
174
- return $output;
175
-
176
- }
177
- function setting_button(){
178
- $next_url = 'http://' . $_SERVER['HTTP_HOST'] . $_SERVER['PHP_SELF']."?page=wpsc-edit-products";
179
-
180
- $output = '';
181
- $output .= "<div style='float: right; margin-top: 0px; position: relative;'> | <a href='#' onclick='display_settings_button(); return false;' style='text-decoration: underline;'>".esc_html__('Settings', 'wp-e-commerce')." &raquo;</a>";
182
- $output .= "<span id='settings_button' style='width:180px;background-color:#f1f1f1;position:absolute; right: 10px; border:1px solid black; display:none;'>";
183
- $output .= "<ul class='settings_button'>";
184
-
185
- $output .= "<li><a href='admin.php?page=wpsc-settings'>".__('Shop Settings', 'wp-e-commerce')."</a></li>";
186
- $output .= "<li><a href='admin.php?page=wpsc-settings&amp;tab=gateway'>".__('Money and Payment', 'wp-e-commerce')."</a></li>";
187
- $output .= "<li><a href='admin.php?page=wpsc-settings&amp;tab=checkout'>".__('Checkout Page Settings', 'wp-e-commerce')."</a></li>";
188
- $output .= "</ul>";
189
- $output .= "</span>&emsp;&emsp;</div>";
190
-
191
- return $output;
192
- }
193
-
194
- function wpsc_right_now() {
195
- global $wpdb;
196
- $year = date("Y");
197
- $month = date("m");
198
- $start_timestamp = mktime(0, 0, 0, $month, 1, $year);
199
- $end_timestamp = mktime(0, 0, 0, ($month+1), 0, $year);
200
- $product_count = $wpdb->get_var("SELECT COUNT(*)
201
- FROM `".$wpdb->posts."`
202
- WHERE `post_status` = 'publish'
203
- AND `post_type` = 'wpsc-product'"
204
- );
205
- $group_count = count(get_terms("wpsc_product_category"));
206
- $sales_count = $wpdb->get_var("SELECT COUNT(*) FROM `".WPSC_TABLE_PURCHASE_LOGS."` WHERE `date` BETWEEN '".$start_timestamp."' AND '".$end_timestamp."'");
207
- $monthtotal = wpsc_currency_display( admin_display_total_price( $start_timestamp,$end_timestamp ) );
208
- $overaltotal = wpsc_currency_display( admin_display_total_price() );
209
- $variation_count = count(get_terms("wpsc-variation", array('parent' => 0)));
210
- $pending_sales = $wpdb->get_var("SELECT COUNT(*) FROM `".WPSC_TABLE_PURCHASE_LOGS."` WHERE `processed` IN ('1','2')");
211
- $accept_sales = $wpdb->get_var("SELECT COUNT(*) FROM `".WPSC_TABLE_PURCHASE_LOGS."` WHERE `processed` IN ('3' ,'4', '5')");
212
- $theme = get_option('wpsc_selected_theme');
213
- ?>
214
- <div class='table'>
215
- <p class='sub'><?php esc_html_e( 'At a Glance', 'wp-e-commerce' ); ?></p>
216
- <table style='border-top:1px solid #ececec;'>
217
- <tr class='first'>
218
- <td class='first b'>
219
- <?php echo $product_count; ?>
220
- </td>
221
- <td class='t'>
222
- <?php echo _nx( 'Product', 'Products', $product_count, 'dashboard widget', 'wp-e-commerce' ); ?>
223
- </td>
224
- <td class='b'>
225
- <?php echo $sales_count; ?>
226
- </td>
227
- <td class='last'>
228
- <?php echo _nx( 'Sale', 'Sales', $sales_count, 'dashboard widget', 'wp-e-commerce' ); ?>
229
- </td>
230
- </tr>
231
- <tr>
232
- <td class='first b'>
233
- <?php echo $group_count; ?>
234
- </td>
235
- <td class='t'>
236
- <?php echo _nx( 'Category', 'Categories', $group_count, 'dashboard widget', 'wp-e-commerce' ); ?>
237
- </td>
238
- <td class='b'>
239
- <?php echo $pending_sales; ?>
240
- </td>
241
- <td class='last t waiting'>
242
- <?php echo _n( 'Pending sale', 'Pending sales', $pending_sales, 'wp-e-commerce' ); ?>
243
- </td>
244
- </tr>
245
- <tr>
246
- <td class='first b'>
247
- <?php echo $variation_count; ?>
248
- </td>
249
- <td class='t'>
250
- <?php echo _nx( 'Variation', 'Variations', $variation_count, 'dashboard widget', 'wp-e-commerce' ); ?>
251
- </td>
252
- <td class='b'>
253
- <?php echo $accept_sales; ?>
254
- </td>
255
- <td class='last t approved'>
256
- <?php echo _n( 'Closed sale', 'Closed sales', $accept_sales, 'wp-e-commerce'); ?>
257
- </td>
258
- </tr>
259
- </table>
260
- </div>
261
- <?php
262
- }
263
-
264
- function wpsc_product_item_row() {
265
- }
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
trunk/wpsc-admin/admin.php DELETED
@@ -1,1588 +0,0 @@
1
- <?php
2
- /**
3
- * WP eCommerce Main Admin functions
4
- *
5
- * These are the main WPSC Admin functions
6
- *
7
- * @package wp-e-commerce
8
- * @since 3.7.0
9
- */
10
-
11
- // admin includes
12
- require_once( WPSC_FILE_PATH . '/wpsc-admin/display-update.page.php' );
13
- require_once( WPSC_FILE_PATH . '/wpsc-admin/display-items.page.php' );
14
- require_once( WPSC_FILE_PATH . '/wpsc-admin/display-upgrades.page.php' );
15
- require_once( WPSC_FILE_PATH . '/wpsc-admin/includes/display-items-functions.php' );
16
- require_once( WPSC_FILE_PATH . '/wpsc-admin/includes/product-functions.php' );
17
- require_once( WPSC_FILE_PATH . '/wpsc-admin/includes/save-data.functions.php' );
18
- require_once( WPSC_FILE_PATH . '/wpsc-admin/includes/duplicate-product-class.php' );
19
- require_once( WPSC_FILE_PATH . '/wpsc-admin/includes/updating-functions.php' );
20
- require_once( WPSC_FILE_PATH . '/wpsc-admin/display-coupons.php' );
21
- require_once( WPSC_FILE_PATH . '/wpsc-includes/purchaselogs.functions.php' );
22
- require_once( WPSC_FILE_PATH . '/wpsc-includes/purchaselogs.class.php' );
23
- require_once( WPSC_FILE_PATH . '/wpsc-includes/purchaselogs-items.class.php' );
24
- require_once( WPSC_FILE_PATH . '/wpsc-includes/theming.class.php' );
25
- require_once( WPSC_FILE_PATH . '/wpsc-admin/ajax.php' );
26
- require_once( WPSC_FILE_PATH . '/wpsc-admin/init.php' );
27
- require_once( WPSC_FILE_PATH . '/wpsc-admin/ajax-and-init.php' );
28
- require_once( WPSC_FILE_PATH . '/wpsc-admin/display-options-settings.page.php' );
29
- require_once( WPSC_FILE_PATH . '/wpsc-admin/db-upgrades/upgrade.php' );
30
- require_once( WPSC_FILE_PATH . '/wpsc-admin/media.php' );
31
-
32
- if ( ! get_option( 'wpsc_checkout_form_sets' ) ) {
33
- $form_sets = array( __( 'Default Checkout Forms', 'wp-e-commerce' ) );
34
- update_option( 'wpsc_checkout_form_sets', $form_sets );
35
- }
36
-
37
- // if we add and wpec admin javascript will add the localizations
38
- add_filter( 'wpsc_javascript_localizations', '_wpsc_admin_localizations', 1 );
39
-
40
- /**
41
- * wpsc_query_vars_product_list sets the ordering for the edit-products page list
42
- *
43
- * @since 3.8.0
44
- * @access public
45
- *
46
- * @uses get_option() Gets option from the DB given key
47
- *
48
- * @param array $vars req Default query arguments
49
- * @return array $vars Modified query arguments
50
- */
51
- function wpsc_query_vars_product_list( $vars ){
52
-
53
- if( 'wpsc-product' != $vars['post_type'] || in_array( $vars['orderby'], array( 'meta_value_num', 'meta_value' ) ) )
54
- return $vars;
55
-
56
- $vars['posts_per_archive_page'] = 0;
57
-
58
- if( 'dragndrop' == get_option( 'wpsc_sort_by' ) ){
59
- $vars['orderby'] = 'menu_order title';
60
- $vars['order'] = 'desc';
61
- $vars['nopaging'] = true;
62
- }
63
-
64
- return $vars;
65
- }
66
-
67
- /**
68
- * Admin Edit Posts Order
69
- *
70
- * @since 3.8.12
71
- * @access public
72
- *
73
- * @param string $orderby_sql Order by SQL.
74
- * @return string Filtered order by SQL.
75
- */
76
- function wpsc_admin_edit_posts_orderby( $orderby_sql ) {
77
- global $wp_query, $wpdb;
78
- if ( 'dragndrop' == get_option( 'wpsc_sort_by' ) ) {
79
- if ( function_exists( 'is_main_query' ) && is_main_query() && 'wpsc-product' == get_query_var( 'post_type' ) && is_tax( 'wpsc_product_category' ) ) {
80
- if ( ! empty( $orderby_sql ) )
81
- $orderby_sql = ', ' . $orderby_sql;
82
- $orderby_sql = " {$wpdb->term_relationships}.term_order ASC" . $orderby_sql;
83
- remove_filter( 'posts_orderby', 'wpsc_admin_edit_posts_orderby' );
84
- }
85
- }
86
- return $orderby_sql;
87
- }
88
- add_filter( 'posts_orderby', 'wpsc_admin_edit_posts_orderby' );
89
-
90
- /**
91
- * setting the product & variations per page screen option to between 1 and 999
92
- *
93
- * @since 3.8.0
94
- * @access public
95
- *
96
- * @uses update_user_option() Updates user option given userid, key, value
97
- *
98
- * @param $status
99
- * @param string $option req Name of option being saved
100
- * @param string $value req Value of option being saved
101
- * @return $value after changes...
102
- */
103
- function wpsc_set_screen_option($status, $option, $value){
104
- if( in_array($option, array ("edit_wpsc_variation_per_page","edit_wpsc_product_per_page", "wpsc_purchases_per_page" )) ){
105
- if ( "edit_wpsc_variation_per_page" == $option ){
106
- global $user_ID;
107
- update_user_option($user_ID,'edit_wpsc-variation_per_page',$value);
108
- }
109
- return $value;
110
- }
111
- }
112
- add_filter('set-screen-option', 'wpsc_set_screen_option', 99, 3);
113
-
114
- /**
115
- * Limit admin variation dropdown to show variantion sets only.
116
- *
117
- * @param array $args Dropdown args.
118
- * @param string $taxonomy Taxonomy.
119
- * @param string $context Context.
120
- *
121
- * @since 3.11.5
122
- *
123
- * @return array Filtered dropdown args.
124
- */
125
- function wpsc_variation_parent_dropdown_args( $args, $taxonomy, $context ) {
126
-
127
- if ( 'wpsc-variation' == $taxonomy && 'edit' == $context ) {
128
- $args['depth'] = 1;
129
- }
130
-
131
- return $args;
132
-
133
- }
134
- add_filter( 'taxonomy_parent_dropdown_args', 'wpsc_variation_parent_dropdown_args', 10, 3 );
135
-
136
- /**
137
- * When rearranging the products for drag and drop it is easiest to arrange them when they are all on the same page...
138
- * @access public
139
- *
140
- * @since 3.8.0
141
- * @access public
142
- *
143
- * @uses get_option() Gets option from the database given key
144
- *
145
- * @param int $per_page req number of products per page
146
- * @param string $post_type req name of current post type
147
- * @return $per_page after changes...
148
- */
149
- function wpsc_drag_and_drop_ordering($per_page, $post_type){
150
- global $wpdb;
151
- if ( 'wpsc-product' == $post_type && 'dragndrop' == get_option( 'wpsc_sort_by' ) && $count = $wpdb->get_var( "SELECT COUNT(*) FROM {$wpdb->posts} WHERE `post_type`='wpsc-product' AND `post_parent`=0" ) )
152
- $per_page = $count;
153
- return $per_page;
154
- }
155
- add_filter( 'request', 'wpsc_query_vars_product_list' );
156
- add_filter( 'edit_posts_per_page' , 'wpsc_drag_and_drop_ordering', 10, 2 );
157
-
158
- /**
159
- * Checks whether to display or hide the update wp-e-commerce link
160
- *
161
- * @since 3.8.0
162
- * @access public
163
- *
164
- * @uses get_option() Gets option from DB given key
165
- *
166
- * @return boolean true - show link, false- hide link
167
- */
168
- function wpsc_show_update_link() {
169
- global $wpdb;
170
- // Check if old product_list table exists
171
- // If it exists AND get_option wpsc_upgrade_complete is not true then return true
172
- $sql = 'SHOW TABLES LIKE "'.$wpdb->prefix.'wpsc_product_list"';
173
- $var = $wpdb->get_var( $sql );
174
- if ( !empty( $var ) && false == get_option( 'wpsc_hide_update' ) )
175
- return true;
176
- else
177
- return false;
178
- }
179
-
180
- /**
181
- * wpsc_admin_pages function, all the definitons of admin pages are stores here.
182
- * No parameters, returns nothing
183
- *
184
- * Fairly standard wordpress plugin API stuff for adding the admin pages, rearrange the order to rearrange the pages
185
- * The bits to display the options page first on first use may be buggy, but tend not to stick around long enough to be identified and fixed
186
- * if you find bugs, feel free to fix them.
187
- *
188
- * If the permissions are changed here, they will likewise need to be changed for the other sections of the admin that either use ajax
189
- * or bypass the normal download system.
190
- *
191
- * @access public
192
- *
193
- * @uses wpsc_show_update_link() Decides whether or not to show the update link
194
- * @uses add_submenu_page() Adds a WordPress submenu page
195
- * @uses apply_filters() Calls wpsc_upgrades_cap allows hooking caps for adiministrator
196
- * @uses apply_filters() Calls wpsc_coupon_cap allows filtering for the coupon caps
197
- * @uses add_options_page() Adds a submenu to the settings page
198
- * @uses add_action() Calls 'admin_print_scripts.$edit_options_page prints out WPEC admin scripts
199
- * @uses apply_filters() Calls 'wpsc_additional_pages' Passes the page_hooks and product_page URL
200
- * @uses do_action() Calls 'wpsc_add_submenu' Allows you to hook in to the WPEC menu
201
- * @uses update_option() Updates option given key and value
202
- */
203
- function wpsc_admin_pages() {
204
-
205
- // Code to enable or disable the debug page
206
- if ( isset( $_GET['wpsc_activate_debug_page'] ) ) {
207
- if ( 'true' == $_GET['wpsc_activate_debug_page'] ) {
208
- $_SESSION['wpsc_activate_debug_page'] = true;
209
- } else if ( 'false' == $_GET['wpsc_activate_debug_page'] ) {
210
- $_SESSION['wpsc_activate_debug_page'] = false;
211
- }
212
- }
213
-
214
- $store_upgrades_cap = apply_filters( 'wpsc_upgrades_cap', 'administrator' );
215
-
216
- $page_hooks = array();
217
-
218
- if ( wpsc_show_update_link() ) {
219
- $page_hooks[] = add_submenu_page( 'index.php', __( 'Update Store', 'wp-e-commerce' ), __( 'Store Update', 'wp-e-commerce' ), $store_upgrades_cap, 'wpsc-update', 'wpsc_display_update_page' );
220
- }
221
-
222
- $purchase_logs_cap = apply_filters( 'wpsc_purchase_logs_cap', 'administrator' );
223
- $page_hooks[] = $purchase_logs_page = add_submenu_page( 'index.php', __( 'Store Sales', 'wp-e-commerce' ), __( 'Store Sales', 'wp-e-commerce' ), $purchase_logs_cap, 'wpsc-purchase-logs', 'wpsc_display_purchase_logs_page' );
224
-
225
- $page_hooks[] = add_submenu_page( 'index.php', __( 'WPeC License', 'wp-e-commerce' ), __( 'WPeC Licensing', 'wp-e-commerce' ), $store_upgrades_cap, 'wpsc-upgrades', 'wpsc_display_upgrades_page' );
226
-
227
- // Set the base page for Products
228
- $products_page = 'edit.php?post_type=wpsc-product';
229
-
230
- $manage_coupon_cap = apply_filters( 'wpsc_coupon_cap', 'administrator' );
231
- $page_hooks[] = $edit_coupons_page = add_submenu_page( $products_page , __( 'Coupons', 'wp-e-commerce' ), __( 'Coupons', 'wp-e-commerce' ), $manage_coupon_cap, 'wpsc-edit-coupons', 'wpsc_display_coupons_page' );
232
-
233
- // Add Settings pages
234
- $page_hooks[] = $edit_options_page = add_options_page( __( 'Store Settings', 'wp-e-commerce' ), __( 'Store', 'wp-e-commerce' ), 'administrator', 'wpsc-settings', 'wpsc_display_settings_page' );
235
- add_action( 'admin_print_scripts-' . $edit_options_page , 'wpsc_print_admin_scripts' );
236
-
237
- $page_hooks = apply_filters( 'wpsc_additional_pages', $page_hooks, $products_page );
238
-
239
- do_action( 'wpsc_add_submenu' );
240
-
241
- // Include the javascript and CSS for this page
242
- // This is so important that I can't even express it in one line
243
-
244
- foreach ( $page_hooks as $page_hook ) {
245
- add_action( 'load-' . $page_hook, 'wpsc_admin_include_css_and_js_refac' );
246
-
247
- switch ( $page_hook ) {
248
-
249
- case $edit_options_page :
250
- add_action( 'load-' . $page_hook, 'wpsc_admin_include_optionspage_css_and_js' );
251
- break;
252
-
253
- case $purchase_logs_page :
254
- add_action( 'admin_head', 'wpsc_product_log_rss_feed' );
255
- add_action( 'load-' . $page_hook, 'wpsc_admin_include_purchase_logs_css_and_js' );
256
- break;
257
-
258
- case $edit_coupons_page :
259
- add_action( 'load-' . $page_hook, 'wpsc_admin_include_coupon_js' );
260
- break;
261
- }
262
- }
263
-
264
- // Some updating code is run from here, is as good a place as any, and better than some
265
- if ( ( null == get_option( 'wpsc_trackingid_subject' ) ) && ( null == get_option( 'wpsc_trackingid_message' ) ) ) {
266
- update_option( 'wpsc_trackingid_subject', __( 'Product Tracking Email', 'wp-e-commerce' ) );
267
- update_option( 'wpsc_trackingid_message', __( "Track & Trace means you may track the progress of your parcel with our online parcel tracker, just login to our website and enter the following Tracking ID to view the status of your order.\n\nTracking ID: %trackid%\n", 'wp-e-commerce' ) );
268
- }
269
-
270
- add_action( 'load-' . $edit_options_page, 'wpsc_load_settings_page', 1 );
271
-
272
- // only load the purchase log list table and page classes when it's necessary
273
- // also, the WPSC_Purchase_Logs_List_Table needs to be initializied before admin_header.php
274
- // is loaded, therefore wpsc_load_purchase_logs_page needs to do this as well
275
- add_action( 'load-' . $purchase_logs_page, 'wpsc_load_purchase_logs_page', 1 );
276
-
277
- // Help tabs
278
- add_action( 'load-' . $edit_options_page , 'wpsc_add_help_tabs' );
279
- add_action( 'load-' . $purchase_logs_page , 'wpsc_add_help_tabs' );
280
- add_action( 'load-' . $edit_coupons_page , 'wpsc_add_help_tabs' );
281
- add_action( 'load-edit.php' , 'wpsc_add_help_tabs' );
282
- add_action( 'load-post.php' , 'wpsc_add_help_tabs' );
283
- add_action( 'load-post-new.php' , 'wpsc_add_help_tabs' );
284
- add_action( 'load-edit-tags.php' , 'wpsc_add_help_tabs' );
285
-
286
- // screen options on Sales Log
287
- add_action( 'load-' . $purchase_logs_page , 'wpsc_add_purchase_logs_screen_option' );
288
- }
289
-
290
- /**
291
- * This function adds contextual help to all WPEC screens.
292
- * add_contextual_help() is supported as well as $screen->add_help_tab().
293
- *
294
- * @since 3.8.8
295
- * @access public
296
- *
297
- * @uses get_current_screen() Returns WordPress admin screen object
298
- * @uses get_bloginfo() Returns information about the WordPress site
299
- * @uses add_help_tab() Used to add a tab to the contextual help menu
300
- */
301
- function wpsc_add_help_tabs() {
302
- $tabs = array(
303
- // Store Settings Page
304
- 'settings_page_wpsc-settings' => array(
305
- 'title' => _x( 'Store Settings', 'contextual help tab', 'wp-e-commerce' ),
306
- 'links' => array(
307
- 'category/configuring-your-store/store-settings/' => _x( 'Store Settings Overview' , 'contextual help link', 'wp-e-commerce' ),
308
- 'category/configuring-your-store/payment-gateways/' => _x( 'Configuring Your Payment Gateways', 'contextual help link', 'wp-e-commerce' ),
309
- 'category/configuring-your-store/shipping/' => _x( 'Configuring Your Shipping Modules', 'contextual help link', 'wp-e-commerce' ),
310
- ),
311
- ),
312
-
313
- // Sales Log Page
314
- 'dashboard_page_wpsc-purchase-logs' => array(
315
- 'title' => _x( 'Sales Log', 'contextual help tab', 'wp-e-commerce' ),
316
- 'links' => array(
317
- 'documentation/sales/' => _x( 'Monitor and Manage Your Sales', 'contextual help link', 'wp-e-commerce' ),
318
- ),
319
- ),
320
-
321
- // Main Products Listing Admin Page (edit.php?post_type=wpsc-product)
322
- 'edit-wpsc-product' => array(
323
- 'title' => _x( 'Product Catalog', 'contextual help tab', 'wp-e-commerce' ),
324
- 'links' => array(
325
- 'category/managing-your-store/' => _x( 'Managing Your Store', 'contextual help link', 'wp-e-commerce' ),
326
- ),
327
- ),
328
-
329
- // Add and Edit Product Pages
330
- 'wpsc-product' => array(
331
- 'title' => _x( 'Add and Edit Product', 'contextual help tab', 'wp-e-commerce' ),
332
- 'links' => array(
333
- 'category/managing-your-store/' => _x( 'Managing Your Store' , 'contextual help link', 'wp-e-commerce' ),
334
- 'resource/video-adding-products/' => _x( 'Video: Adding Products', 'contextual help link', 'wp-e-commerce' ),
335
- ),
336
- ),
337
-
338
- // Product Tags Page
339
- 'edit-product_tag' => array(
340
- 'title' => _x( 'Product Tags', 'contextual help tab', 'wp-e-commerce' ),
341
- 'links' =>array(
342
- 'resource/video-product-tags/' => _x( 'Video: Product Tags', 'contextual help link', 'wp-e-commerce' ),
343
- ),
344
- ),
345
-
346
- // Product Category Page
347
- 'edit-wpsc_product_category' => array(
348
- 'title' => _x( 'Product Categories', 'contextual help tab', 'wp-e-commerce' ),
349
- 'links' => array(
350
- 'resource/video-creating-product-categories/' => _x( 'Video: Creating Product Categories', 'contextual help link', 'wp-e-commerce' ),
351
- ),
352
- ),
353
-
354
- // Product Variations Page
355
- 'edit-wpsc-variation' => array(
356
- 'title' => _x( 'Product Variations', 'contextual help tab', 'wp-e-commerce' ),
357
- 'links' => array(
358
- 'category/managing-your-store/' => _x( 'Managing Your Store', 'contextual help link', 'wp-e-commerce' ),
359
- ),
360
- ),
361
-
362
- // Coupon Page
363
- 'wpsc-product_page_wpsc-edit-coupons' => array(
364
- 'title' => _x( 'Coupons', 'contextual help tab', 'wp-e-commerce' ),
365
- 'links' => array(
366
- 'resource/video-creating-coupons/' => _x( 'Video: Creating Coupons', 'contextual help link', 'wp-e-commerce' ),
367
- ),
368
- ),
369
- );
370
-
371
- $screen = get_current_screen();
372
- if ( array_key_exists( $screen->id, $tabs ) ) {
373
- $tab = $tabs[$screen->id];
374
- $content = '<p><strong>' . __( 'For More Information', 'wp-e-commerce' ) . '</strong></p>';
375
- $links = array();
376
- foreach( $tab['links'] as $link => $link_title ) {
377
- $link = 'http://docs.wpecommerce.org/' . $link;
378
- $links[] = '<a target="_blank" href="' . esc_url( $link ) . '">' . esc_html( $link_title ) . '</a>';
379
- }
380
- $content .= '<p>' . implode( '<br />', $links ) . '</p>';
381
-
382
- $screen->add_help_tab( array(
383
- 'id' => $screen->id . '_help',
384
- 'title' => $tab['title'],
385
- 'content' => $content,
386
- ) );
387
-
388
- }
389
- }
390
-
391
- /**
392
- * This function allows change in number of purchase logs shown on Sales Log (Screen Options).
393
- *
394
- * @since 3.9.0
395
- * @access public
396
- *
397
- * @uses add_screen_option()
398
- */
399
- function wpsc_add_purchase_logs_screen_option(){
400
-
401
- // setup Screen Option for purchase logs per page
402
- add_screen_option( 'per_page', array(
403
- 'label' => __("Sales Orders", 'wp-e-commerce'),
404
- 'default' => 20,
405
- 'option' => 'wpsc_purchases_per_page'
406
- ) );
407
- }
408
-
409
- /**
410
- * Includes purchase logs CSS and JS
411
- *
412
- * @acces public
413
- *
414
- * @uses wp_enqueue_script() Recommended way of adding scripts in WordPress
415
- * @uses wp_localize_script() Adds noncing and other data to the logs script
416
- */
417
- function wpsc_admin_include_purchase_logs_css_and_js() {
418
-
419
- _wpsc_enqueue_wp_e_commerce_admin();
420
-
421
- $dependencies = array( 'jquery' );
422
-
423
- if ( isset( $_REQUEST['id'] ) && is_numeric( $_REQUEST['id'] ) ) {
424
- wp_enqueue_style( 'wp-admin' );
425
- $dependencies[] = 'postbox';
426
- }
427
-
428
- wp_enqueue_script( 'wp-e-commerce-purchase-logs', WPSC_URL . '/wpsc-admin/js/purchase-logs.js', $dependencies, WPSC_VERSION . '.' . WPSC_MINOR_VERSION, true );
429
- wp_localize_script( 'wp-e-commerce-purchase-logs', 'WPSC_Purchase_Logs_Admin', array(
430
- 'nonce' => wp_create_nonce( 'wpsc_purchase_logs' ),
431
- 'change_purchase_log_status_nonce' => _wpsc_create_ajax_nonce( 'change_purchase_log_status' ),
432
- 'purchase_log_save_tracking_id_nonce' => _wpsc_create_ajax_nonce( 'purchase_log_save_tracking_id' ),
433
- 'purchase_log_send_tracking_email_nonce' => _wpsc_create_ajax_nonce( 'purchase_log_send_tracking_email' ),
434
- 'purchase_log_refund_items_nonce' => _wpsc_create_ajax_nonce( 'purchase_log_refund_items' ),
435
- 'purchase_log_capture_payment_nonce' => _wpsc_create_ajax_nonce( 'purchase_log_capture_payment' ),
436
- 'remove_log_item_nonce' => _wpsc_create_ajax_nonce( 'remove_log_item' ),
437
- 'update_log_item_qty_nonce' => _wpsc_create_ajax_nonce( 'update_log_item_qty' ),
438
- 'add_log_item_nonce' => _wpsc_create_ajax_nonce( 'add_log_item' ),
439
- 'edit_contact_details_nonce' => _wpsc_create_ajax_nonce( 'edit_contact_details' ),
440
- 'add_note_nonce' => _wpsc_create_ajax_nonce( 'add_note' ),
441
- 'delete_note_nonce' => _wpsc_create_ajax_nonce( 'delete_note' ),
442
- 'search_products_nonce' => _wpsc_create_ajax_nonce( 'search_products' ),
443
- 'sending_message' => _x( 'sending...', 'sending tracking email for purchase log', 'wp-e-commerce' ),
444
- 'sent_message' => _x( 'Email Sent!', 'sending tracking email for purchase log', 'wp-e-commerce' ),
445
- 'current_view' => empty( $_REQUEST['status'] ) ? 'all' : $_REQUEST['status'],
446
- 'current_filter' => empty( $_REQUEST['m'] ) ? '' : $_REQUEST['m'],
447
- 'current_page' => empty( $_REQUEST['paged'] ) ? '' : $_REQUEST['paged'],
448
- 'log_id' => isset( $_REQUEST['id'] ) ? absint( $_REQUEST['id'] ) : 0,
449
- 'strings' => array(
450
- 'confirm_delete_item' => esc_html__( 'Are you sure you want to remove this item?', 'wp-e-commerce' ),
451
- 'confirm_delete_note' => esc_html__( 'Are you sure you want to delete this note?', 'wp-e-commerce' ),
452
- 'confirm_refund_order' => esc_html__( 'Are you sure you want to refund this order?', 'wp-e-commerce' ),
453
- 'confirm_refund_order_manually' => esc_html__( 'Are you sure you want to refund this order manually? Note: this only affects your on-site records, it does not interface with any payment gateway to return funds to the customer.', 'wp-e-commerce' ),
454
- 'search_head' => esc_html__( 'Search for Products to Add', 'wp-e-commerce' ),
455
- 'cancel_btn' => esc_html__( 'Cancel', 'wp-e-commerce' ),
456
- ),
457
- ) );
458
-
459
- // Purchase Log Action Links
460
- wp_enqueue_script( 'wpsc-purchase-log-action-links', WPSC_URL . '/wpsc-admin/js/purchase-log-action-links.js', array( 'jquery' ), WPSC_VERSION . '.' . WPSC_MINOR_VERSION, true );
461
- wp_localize_script( 'wpsc-purchase-log-action-links', 'WPSC_Purchase_Log_Action_Links', array(
462
- 'purchase_log_action_link_nonce' => _wpsc_create_ajax_nonce( 'purchase_log_action_link' ),
463
- 'log_id' => empty( $_REQUEST['id'] ) ? '' : absint( $_REQUEST['id'] )
464
- ) );
465
-
466
- }
467
-
468
- /**
469
- * Loads the WPEC settings page
470
- *
471
- * @access public
472
- *
473
- * @uses WPSC_Settings_Page::get_instance() Gets instance of WPEC settings page
474
- */
475
- function wpsc_load_settings_page() {
476
- require_once('settings-page.php');
477
- WPSC_Settings_Page::get_instance();
478
- }
479
-
480
- /**
481
- * Leads the purchase logs page
482
- *
483
- * @uses WPSC_Purchase_Log_Page() Loads the edit and view sales page
484
- */
485
- function wpsc_load_purchase_logs_page() {
486
- require_once( WPSC_FILE_PATH . '/wpsc-admin/includes/purchase-log-list-table-class.php' );
487
- require_once( WPSC_FILE_PATH . '/wpsc-admin/display-sales-logs.php' );
488
- $page = new WPSC_Purchase_Log_Page();
489
- }
490
-
491
- /**
492
- * Displays the WPEC purchase logs
493
- *
494
- * @uses do_action() Calls 'wpsc_display_purchase_logs_page' allows hooking of the sales log page
495
- */
496
- function wpsc_display_purchase_logs_page() {
497
- do_action( 'wpsc_display_purchase_logs_page' );
498
- }
499
-
500
- /**
501
- * Produces an RSS feed for the product log
502
- *
503
- * @uses add_query_arg() Allows you to add arguments to the end of a URL
504
- * @uses admin_url() Retrieves URL to the WordPress admin
505
- */
506
- function wpsc_product_log_rss_feed() {
507
- echo "<link type='application/rss+xml' href='" . add_query_arg( array( 'rss' => 'true', 'rss_key' => 'key', 'action' => 'purchase_log', 'type' => 'rss' ), admin_url( 'index.php' ) ) . "' title='" . esc_attr__( 'WP eCommerce Purchase Log RSS', 'wp-e-commerce' ) . "' rel='alternate' />";
508
- }
509
-
510
- /**
511
- * Includes and enqueues scripts and styles for coupons
512
- *
513
- * @uses wp_enqueue_style() Includes and prints styles for WPEC in the WordPress admin
514
- * @uses wp_enqueue_script() Includes and prints scripts for WPEC in the WordPress admin
515
- */
516
- function wpsc_admin_include_coupon_js() {
517
-
518
- // Variables
519
- $version_identifier = WPSC_VERSION . '.' . WPSC_MINOR_VERSION;
520
-
521
- // global js
522
- _wpsc_enqueue_wp_e_commerce_admin();
523
-
524
- // Coupon CSS
525
- wp_enqueue_style( 'wp-e-commerce-admin_2.7', WPSC_URL . '/wpsc-admin/css/settingspage.css', false, false, 'all' );
526
- wp_enqueue_style( 'wp-e-commerce-admin', WPSC_URL . '/wpsc-admin/css/admin.css', false, $version_identifier, 'all' );
527
-
528
- // Coupon JS
529
- wp_enqueue_script( 'jquery-ui-datepicker' );
530
- wp_enqueue_style( 'jquery-ui-datepicker' );
531
-
532
- wp_enqueue_script( 'wp-e-commerce-admin_legacy', WPSC_URL . '/wpsc-admin/js/admin-legacy.js', array( 'jquery', 'jquery-ui-core', 'jquery-ui-sortable', 'jquery-ui-datepicker' ), $version_identifier );
533
-
534
- $admin_color = get_user_option( 'admin_color' );
535
- $scheme = 'classic' === $admin_color ? $admin_color : 'fresh';
536
-
537
- wp_enqueue_style( 'wpsc-jquery-ui-datepicker', WPSC_URL . '/wpsc-admin/css/jquery.ui.datepicker-' . $scheme . '.css', false, $version_identifier );
538
- }
539
-
540
- /**
541
- * Includes and enqueues scripts and styles for the WPEC options page
542
- *
543
- * @uses wp_enqueue_script() Includes and prints out the JS for the WPEC options page
544
- * @uses wp_localize_script() Sets up the JS vars needed
545
- * @uses _wpsc_create_ajax_nonce() Alias for wp_create_nonce, creates a random one time use token
546
- * @uses get_current_tab_id() Returns the current tab id
547
- * @uses wp_enqueue_style() Includes and prints out the CSS for the WPEC options page
548
- */
549
- function wpsc_admin_include_optionspage_css_and_js() {
550
-
551
- _wpsc_enqueue_wp_e_commerce_admin();
552
-
553
- $version_identifier = WPSC_VERSION . "." . WPSC_MINOR_VERSION;
554
- wp_enqueue_script( 'wp-e-commerce-admin-settings-page', WPSC_URL . '/wpsc-admin/js/settings-page.js', array( 'jquery-query' ), $version_identifier );
555
-
556
- wp_localize_script( 'wp-e-commerce-admin-settings-page', 'WPSC_Settings_Page', array(
557
- 'navigate_settings_tab_nonce' => _wpsc_create_ajax_nonce( 'navigate_settings_tab' ),
558
- 'payment_gateway_settings_form_nonce' => _wpsc_create_ajax_nonce( 'payment_gateway_settings_form' ),
559
- 'shipping_module_settings_form_nonce' => _wpsc_create_ajax_nonce( 'shipping_module_settings_form' ),
560
- 'display_region_list_nonce' => _wpsc_create_ajax_nonce( 'display_region_list' ),
561
- 'update_checkout_fields_order_nonce' => _wpsc_create_ajax_nonce( 'update_checkout_fields_order' ),
562
- 'add_tax_rate_nonce' => _wpsc_create_ajax_nonce( 'add_tax_rate' ),
563
- 'current_tab' => WPSC_Settings_Page::get_instance()->get_current_tab_id(),
564
- 'before_unload_dialog' => __( 'The changes you made will be lost if you navigate away from this page.', 'wp-e-commerce' ),
565
- 'ajax_navigate_confirm_dialog' => __( 'The changes you made will be lost if you navigate away from this page.', 'wp-e-commerce' ) . "\n\n" . __( 'Click OK to discard your changes, or Cancel to remain on this page.', 'wp-e-commerce' ),
566
- 'edit_field_options' => __( 'Edit Options', 'wp-e-commerce' ),
567
- 'hide_edit_field_options' => __( 'Hide Options', 'wp-e-commerce' ),
568
- 'delete_form_set_confirm' => __( 'Are you sure you want to delete %s? Submitted data of this form set will also be removed from sales logs.', 'wp-e-commerce' ),
569
- ) );
570
-
571
- wp_enqueue_style( 'wp-e-commerce-admin_2.7', WPSC_URL . '/wpsc-admin/css/settingspage.css', false, false, 'all' );
572
- wp_enqueue_style( 'wp-e-commerce-ui-tabs', WPSC_URL . '/wpsc-admin/css/jquery.ui.tabs.css', false, $version_identifier, 'all' );
573
- }
574
-
575
- /**
576
- * Sets up the WPEC metaboxes
577
- *
578
- * @uses remove_meta_box() Removes the default taxonomy meta box so our own can be added
579
- * @uses add_meta_bax() Adds metaboxes to the WordPress admin interface
580
- */
581
- function wpsc_meta_boxes() {
582
- global $post;
583
- $pagename = 'wpsc-product';
584
- remove_meta_box( 'wpsc-variationdiv', 'wpsc-product', 'side' );
585
-
586
- //if a variation page do not show these metaboxes
587
- if ( is_object( $post ) && $post->post_parent == 0 ) {
588
- add_meta_box( 'wpsc_product_variation_forms' , __( 'Variations', 'wp-e-commerce' ) , 'wpsc_product_variation_forms' , $pagename, 'normal', 'high' );
589
- } else if( is_object( $post ) && $post->post_status == "inherit" ) {
590
- remove_meta_box( 'tagsdiv-product_tag' , 'wpsc-product', 'core' );
591
- remove_meta_box( 'wpsc_product_categorydiv' , 'wpsc-product', 'core' );
592
- }
593
-
594
- add_meta_box( 'wpsc_price_control_forms', __('Product Pricing', 'wp-e-commerce'), 'wpsc_price_control_forms', $pagename, 'side', 'low' );
595
- add_meta_box( 'wpsc_stock_control_forms', __('Stock Inventory', 'wp-e-commerce'), 'wpsc_stock_control_forms', $pagename, 'side', 'low' );
596
- add_meta_box( 'wpsc_product_taxes_forms', __('Taxes', 'wp-e-commerce'), 'wpsc_product_taxes_forms', $pagename, 'side', 'low' );
597
- add_meta_box( 'wpsc_product_delivery_forms', __('Product Delivery', 'wp-e-commerce'), 'wpsc_product_delivery_forms', $pagename, 'normal', 'high' );
598
- add_meta_box( 'wpsc_product_details_forms', __('Product Details', 'wp-e-commerce'), 'wpsc_product_details_forms', $pagename, 'normal', 'high' );
599
- }
600
-
601
- add_action( 'admin_footer', 'wpsc_meta_boxes' );
602
- add_action( 'admin_enqueue_scripts', 'wpsc_admin_include_css_and_js_refac' );
603
-
604
- /**
605
- * Includes the JS and CSS
606
- *
607
- * @param string $pagehook The pagehook for the currently viewing page, provided by the 'admin_enqueue_scripts' action
608
- *
609
- * @uses wp_admin_css() Enqueues or prints a stylesheet in the admin
610
- * @uses wp_enqueue_script() Enqueues the specified script
611
- * @uses wp_localize_script() Sets up the JS vars needed
612
- * @uses wp_enqueue_style() Enqueues the styles
613
- * @uses wp_dequeue_script() Removes a previously enqueued script by handle
614
- * @uses _wpsc_create_ajax_nonce() Alias for wp_create_nonce, creates a random one time use token
615
- */
616
- function wpsc_admin_include_css_and_js_refac( $pagehook ) {
617
- global $post_type, $post;
618
-
619
- $current_screen = get_current_screen();
620
- $version_identifier = WPSC_VERSION . "." . WPSC_MINOR_VERSION;
621
- $pages = array( 'index.php', 'options-general.php', 'edit.php', 'post.php', 'post-new.php' );
622
-
623
- _wpsc_enqueue_wp_e_commerce_admin();
624
-
625
- if ( ! is_customize_preview() ) {
626
- wp_enqueue_script( 'wp-e-commerce-admin', WPSC_URL . '/wpsc-admin/js/admin.js', array( 'jquery', 'jquery-ui-core', 'jquery-ui-sortable' ), $version_identifier, false );
627
- }
628
-
629
- if ( 'dashboard_page_wpsc-sales-logs' == $current_screen->id ) {
630
- // jQuery
631
- wp_enqueue_script( 'jquery' );
632
- wp_enqueue_script( 'jquery-ui-draggable' );
633
- wp_enqueue_script( 'jquery-ui-droppable' );
634
- wp_enqueue_script( 'jquery-ui-sortable' );
635
-
636
- // Metaboxes
637
- wp_enqueue_script( 'common' );
638
- wp_enqueue_script( 'wp-lists' );
639
- wp_enqueue_script( 'postbox' );
640
- }
641
-
642
- if ( ( in_array( $pagehook, $pages ) && $post_type == 'wpsc-product' ) || $current_screen->id == 'edit-wpsc_product_category' || $current_screen->id == 'dashboard_page_wpsc-sales-logs' || $current_screen->id == 'dashboard_page_wpsc-purchase-logs' || $current_screen->id == 'settings_page_wpsc-settings' || $current_screen->id == 'wpsc-product_page_wpsc-edit-coupons' || $current_screen->id == 'edit-wpsc-variation' || $current_screen->id == 'wpsc-product-variations-iframe' || ( $pagehook == 'media-upload-popup' && get_post_type( $_REQUEST['post_id'] ) == 'wpsc-product' ) ) {
643
-
644
- wp_enqueue_script( 'wpsc-sortable-table', WPSC_URL . '/wpsc-admin/js/sortable-table.js', array( 'jquery' ) );
645
-
646
- if ( in_array( $current_screen->id, array( 'wpsc-product', 'edit-wpsc-variation', 'wpsc-product' ) ) ) {
647
- wp_enqueue_script( 'wp-e-commerce-variations', WPSC_URL . '/wpsc-admin/js/variations.js', array( 'jquery', 'wpsc-sortable-table' ), $version_identifier );
648
- wp_localize_script(
649
- 'wp-e-commerce-variations', // handle
650
- 'WPSC_Variations', // variable name
651
- array( // args
652
- 'thickbox_title' => __( 'Add Media - %s', 'wp-e-commerce' ),
653
- )
654
- );
655
- }
656
- wp_enqueue_style( 'wp-e-commerce-admin', WPSC_URL . '/wpsc-admin/css/admin.css', false, $version_identifier, 'all' );
657
-
658
- }
659
-
660
- static $_wpsc_admin_l10n_loaded;
661
-
662
- if ( ! $_wpsc_admin_l10n_loaded ) {
663
- // Localize scripts
664
- wp_localize_script( 'wp-e-commerce-admin', 'wpsc_adminL10n', array(
665
- 'dragndrop_set' => ( get_option( 'wpsc_sort_by' ) == 'dragndrop' ? 'true' : 'false' ),
666
- 'save_product_order_nonce' => _wpsc_create_ajax_nonce( 'save_product_order' ),
667
- 'l10n_print_after' => 'try{convertEntities(wpsc_adminL10n);}catch(e){};',
668
- 'empty_coupon' => esc_html__( 'Please enter a coupon code.', 'wp-e-commerce' ),
669
- 'bulk_edit_no_vars' => esc_html__( 'Quick Edit options are limited when editing products that have variations. You will need to edit the variations themselves.', 'wp-e-commerce' ),
670
- 'wpsc_core_images_url' => WPSC_CORE_IMAGES_URL,
671
- 'variation_parent_swap' => esc_html_x( 'New Variation Set', 'Variation taxonomy parent', 'wp-e-commerce' ),
672
- /* translators : This string is prepended to the 'New Variation Set' string */
673
- 'variation_helper_text' => esc_html_x( 'Choose the Variation Set you want to add variants to. If you\'re creating a new variation set, then select', 'Variation helper text', 'wp-e-commerce' ),
674
- 'variations_tutorial' => esc_html__( 'Variations allow you to create options for your products. For example, if you\'re selling T-Shirts, they will generally have a "Size" option. Size will be the Variation Set name, and it will be a "New Variant Set". You will then create variants (small, medium, large) which will have the "Variation Set" of Size. Once you have made your set you can use the table on the right to manage them (edit, delete). You will be able to order your variants by dragging and dropping them within their Variation Set.', 'wp-e-commerce' ),
675
- /* translators : These strings are dynamically inserted as a drop-down for the Coupon comparison conditions */
676
- 'coupons_compare_or' => esc_html_x( 'OR' , 'Coupon comparison logic', 'wp-e-commerce' ),
677
- 'coupons_compare_and' => esc_html_x( 'AND' , 'Coupon comparison logic', 'wp-e-commerce' ),
678
- 'meta_downloads_plural' => _x( ' downloads', 'live preview for downloads metabox', 'wp-e-commerce' ),
679
- 'meta_downloads_singular' => _x( ' download' , 'live preview for downloads metabox', 'wp-e-commerce' ),
680
- 'wpsc_inline_css_error' => __( 'It is not possible to change the state of the inline CSS without also changing the common CSS.', 'wp-e-commerce' )
681
- ) );
682
-
683
- $_wpsc_admin_l10n_loaded = true;
684
- }
685
-
686
- if ( $pagehook == 'wpsc-product-variations-iframe' ) {
687
- _wpsc_enqueue_wp_e_commerce_admin();
688
-
689
- wp_enqueue_script( 'wp-e-commerce-product-variations', WPSC_URL . '/wpsc-admin/js/product-variations.js', array( 'jquery' ), $version_identifier );
690
- wp_localize_script( 'wp-e-commerce-product-variations', 'WPSC_Product_Variations', array(
691
- 'product_id' => absint( $_REQUEST['product_id'] ),
692
- 'add_variation_set_nonce' => _wpsc_create_ajax_nonce( 'add_variation_set' ),
693
- ) );
694
- }
695
-
696
- if ( $pagehook == 'media-upload-popup' ) {
697
-
698
- $post = get_post( $_REQUEST['post_id'] );
699
- if ( $post->post_type == 'wpsc-product' && $post->post_parent ) {
700
- _wpsc_enqueue_wp_e_commerce_admin();
701
-
702
- wp_dequeue_script( 'set-post-thumbnail' );
703
- wp_enqueue_script( 'wpsc-set-post-thumbnail', WPSC_URL . '/wpsc-admin/js/set-post-thumbnail.js', array( 'jquery', 'wp-e-commerce-admin' ), $version_identifier );
704
- wp_localize_script( 'wpsc-set-post-thumbnail', 'WPSC_Set_Post_Thumbnail', array(
705
- 'link_text' => __( 'Use as Product Thumbnail', 'wp-e-commerce' ),
706
- 'saving' => __( 'Saving...', 'wp-e-commerce' ),
707
- 'error' => __( 'Could not set that as the thumbnail image. Try a different attachment.', 'wp-e-commerce' ),
708
- 'done' => __( 'Done', 'wp-e-commerce' ),
709
- 'nonce' => _wpsc_create_ajax_nonce( 'set_variation_product_thumbnail' ),
710
- ) );
711
- }
712
- }
713
-
714
- if ( 'dashboard_page_wpsc-upgrades' == $pagehook || 'dashboard_page_wpsc-update' == $pagehook )
715
- wp_enqueue_style( 'wp-e-commerce-admin', WPSC_URL . '/wpsc-admin/css/admin.css', false, $version_identifier, 'all' );
716
- }
717
-
718
-
719
- /**
720
- * Adds admin javascript to the wp-e-commerce-admin javascript
721
- *
722
- * @since 3.8.14
723
- *
724
- * @param array array containing key value pairs, keys are turned into javascript globals with thier associated values
725
- *
726
- */
727
- function _wpsc_admin_localizations( $localizations ) {
728
-
729
- $hidden_boxes = get_option( 'wpsc_hidden_box' );
730
- $hidden_boxes = implode( ',', (array)$hidden_boxes );
731
-
732
- $form_types_option = get_option( 'wpsc_checkout_form_fields' );
733
- if ( ! $form_types_option || ! is_array( $form_types_option ) ) {
734
- $form_types_option = array();
735
- }
736
-
737
- $unique_names_option = get_option( 'wpsc_checkout_unique_names' );
738
- if ( ! $unique_names_option || ! is_array( $unique_names_option ) ) {
739
- $unique_names_option = array();
740
- }
741
-
742
- $form_types = '';
743
- foreach ( $form_types_option as $form_type ) {
744
- $form_types .= '<option value="' . $form_type . '">' . $form_type . '</option>';
745
- }
746
-
747
- $unique_names = '<option value="-1">' . __( 'Select a Unique Name', 'wp-e-commerce' ) . '</option>';
748
- foreach ( $unique_names_option as $unique_name ) {
749
- $unique_names .= '<option value="' . $unique_name . '">' . $unique_name . '</option>';
750
- }
751
-
752
- $localizations['ajaxurl'] = admin_url( 'admin-ajax.php', 'relative' );
753
- $localizations['hidden_boxes'] = '"' . esc_js( $hidden_boxes ) . '"';
754
- $localizations['IS_WP27'] = '"' . esc_js( IS_WP27 ) . '"';
755
- $localizations['TXT_WPSC_DELETE'] = '"' . esc_js( __( 'Delete', 'wp-e-commerce' ) ) . '"';
756
- $localizations['TXT_WPSC_TEXT'] = '"' . esc_js( __( 'Text', 'wp-e-commerce' ) ) . '"';
757
- $localizations['TXT_WPSC_EMAIL'] = '"' . esc_js( __( 'Email', 'wp-e-commerce' ) ) . '"';
758
- $localizations['TXT_WPSC_COUNTRY'] = '"' . esc_js( __( 'Country', 'wp-e-commerce' ) ) . '"';
759
- $localizations['TXT_WPSC_TEXTAREA'] = '"' . esc_js( __( 'Textarea', 'wp-e-commerce' ) ) . '"';
760
- $localizations['TXT_WPSC_HEADING'] = '"' . esc_js( __( 'Heading', 'wp-e-commerce' ) ) . '"';
761
- $localizations['TXT_WPSC_COUPON'] = '"' . esc_js( __( 'Coupon', 'wp-e-commerce' ) ) . '"';
762
-
763
- $localizations['HTML_FORM_FIELD_TYPES'] = '"' . esc_js( $form_types ) . '"';
764
- $localizations['HTML_FORM_FIELD_UNIQUE_NAMES'] = '"' . esc_js( $unique_names ) . '"';
765
-
766
- $localizations['TXT_WPSC_LABEL'] = '"' . esc_js( __( 'Label', 'wp-e-commerce' ) ) . '"';
767
- $localizations['TXT_WPSC_LABEL_DESC'] = '"' . esc_js( __( 'Label Description', 'wp-e-commerce' ) ) . '"';
768
- $localizations['TXT_WPSC_ITEM_NUMBER'] = '"' . esc_js( __( 'Item Number', 'wp-e-commerce' ) ) . '"';
769
- $localizations['TXT_WPSC_LIFE_NUMBER'] = '"' . esc_js( __( 'Life Number', 'wp-e-commerce' ) ) . '"';
770
- $localizations['TXT_WPSC_PRODUCT_CODE'] = '"' . esc_js( __( 'Product Code', 'wp-e-commerce' ) ) . '"';
771
- $localizations['TXT_WPSC_PDF'] = '"' . esc_js( __( 'PDF', 'wp-e-commerce' ) ) . '"';
772
-
773
- $localizations['TXT_WPSC_AND_ABOVE'] = '"' . esc_js( __( ' and above', 'wp-e-commerce' ) ) . '"';
774
- $localizations['TXT_WPSC_IF_PRICE_IS'] = '"' . esc_js( __( 'If price is ', 'wp-e-commerce' ) ) . '"';
775
- $localizations['TXT_WPSC_IF_WEIGHT_IS'] = '"' . esc_js( __( 'If weight is ', 'wp-e-commerce' ) ) . '"';
776
-
777
- // we only want to add these localizations once, it should happen on the first admin script load
778
- remove_filter( 'wpsc_javascript_localizations', '_wpsc_admin_localizations', 1 );
779
-
780
- return $localizations;
781
- }
782
-
783
- /*
784
- * Enqueue the admin script that applies to applies to all wpsc admin pages
785
- */
786
- function _wpsc_enqueue_wp_e_commerce_admin( ) {
787
- static $already_enqueued = false;
788
- if ( ! $already_enqueued ) {
789
- $version_identifier = WPSC_VERSION . '.' . WPSC_MINOR_VERSION;
790
- wp_enqueue_script( 'wp-e-commerce-admin-js', WPSC_URL . '/wpsc-admin/js/wp-e-commerce-admin.js', false, false, $version_identifier );
791
- wp_localize_script( 'wp-e-commerce-admin-js', 'wpsc_admin_vars', wpsc_javascript_localizations() );
792
- $already_enqueued = true;
793
- }
794
- }
795
-
796
- add_action( 'admin_menu', 'wpsc_admin_pages' );
797
-
798
- /**
799
- * Displays latest activity in the Dashboard widget
800
- *
801
- * @uses $wpdb WordPress database object for queries
802
- * @uses get_var() Returns single variable from the database
803
- * @uses esc_html__() Gets translation of $text and escapes it for HTML output
804
- * @uses wpsc_currency_display() Displays the currency
805
- * @uses admin_display_total_price() Displays the total price
806
- * @uses esc_html_x()
807
- * @uses _n() Retrieves the singular or plural version
808
- */
809
- function wpsc_admin_latest_activity() {
810
- global $wpdb;
811
- $totalOrders = $wpdb->get_var( "SELECT COUNT(*) FROM `" . WPSC_TABLE_PURCHASE_LOGS . "`" );
812
-
813
- /*
814
- * This is the right hand side for the past 30 days revenue on the wp dashboard
815
- */
816
- echo "<div id='leftDashboard'>";
817
- echo "<strong class='dashboardHeading'>" . esc_html__( 'Current Month', 'wp-e-commerce' ) . "</strong><br />";
818
- echo "<p class='dashboardWidgetSpecial'>";
819
- // calculates total amount of orders for the month
820
- $year = date( "Y" );
821
- $month = date( "m" );
822
- $start_timestamp = mktime( 0, 0, 0, $month, 1, $year );
823
- $end_timestamp = mktime( 0, 0, 0, ( $month + 1 ), 0, $year );
824
- $sql = "SELECT COUNT(*) FROM `" . WPSC_TABLE_PURCHASE_LOGS . "` WHERE `date` BETWEEN '$start_timestamp' AND '$end_timestamp' AND `processed` IN (2,3,4) ORDER BY `date` DESC";
825
- $currentMonthOrders = $wpdb->get_var( $sql );
826
-
827
- //calculates amount of money made for the month
828
- $currentMonthsSales = wpsc_currency_display( admin_display_total_price( $start_timestamp, $end_timestamp ) );
829
- echo $currentMonthsSales;
830
- echo "<span class='dashboardWidget'>" . esc_html_x( 'Sales', 'the total value of sales in dashboard widget', 'wp-e-commerce' ) . "</span>";
831
- echo "</p>";
832
- echo "<p class='dashboardWidgetSpecial'>";
833
- echo "<span class='pricedisplay'>";
834
- echo $currentMonthOrders;
835
- echo "</span>";
836
- echo "<span class='dashboardWidget'>" . _n( 'Order', 'Orders', $currentMonthOrders, 'wp-e-commerce' ) . "</span>";
837
- echo "</p>";
838
- echo "<p class='dashboardWidgetSpecial'>";
839
- //calculates average sales amount per order for the month
840
- if ( $currentMonthOrders > 0 ) {
841
- $monthsAverage = ( (int)admin_display_total_price( $start_timestamp, $end_timestamp ) / (int)$currentMonthOrders );
842
- echo wpsc_currency_display( $monthsAverage );
843
- }
844
- //echo "</span>";
845
- echo "<span class='dashboardWidget'>" . esc_html__( 'Avg Order', 'wp-e-commerce' ) . "</span>";
846
- echo "</p>";
847
- echo "</div>";
848
- /*
849
- * This is the left side for the total life time revenue on the wp dashboard
850
- */
851
-
852
- echo "<div id='rightDashboard' >";
853
- echo "<strong class='dashboardHeading'>" . esc_html__( 'Total Income', 'wp-e-commerce' ) . "</strong><br />";
854
-
855
- echo "<p class='dashboardWidgetSpecial'>";
856
- echo wpsc_currency_display( admin_display_total_price() );
857
- echo "<span class='dashboardWidget'>" . esc_html_x( 'Sales', 'the total value of sales in dashboard widget', 'wp-e-commerce' ) . "</span>";
858
- echo "</p>";
859
- echo "<p class='dashboardWidgetSpecial'>";
860
- echo "<span class='pricedisplay'>";
861
- echo $totalOrders;
862
- echo "</span>";
863
- echo "<span class='dashboardWidget'>" . _n( 'Order', 'Orders', $totalOrders, 'wp-e-commerce' ) . "</span>";
864
- echo "</p>";
865
- echo "<p class='dashboardWidgetSpecial'>";
866
- //calculates average sales amount per order for the month
867
- if ( ( admin_display_total_price() > 0 ) && ( $totalOrders > 0 ) ) {
868
- $totalAverage = ( (int)admin_display_total_price() / (int)$totalOrders );
869
- } else {
870
- $totalAverage = 0;
871
- }
872
- echo wpsc_currency_display( $totalAverage );
873
- //echo "</span>";
874
- echo "<span class='dashboardWidget'>" . esc_html__( 'Avg Order', 'wp-e-commerce' ) . "</span>";
875
- echo "</p>";
876
- echo "</div>";
877
- echo "<div style='clear:both'></div>";
878
- }
879
- add_action( 'wpsc_admin_pre_activity', 'wpsc_admin_latest_activity' );
880
-
881
- /*
882
- * Dashboard Widget Setup
883
- * Adds the dashboard widgets if the user is an admin
884
- *
885
- * Since 3.6
886
- *
887
- * @uses wp_enqueue_style() Enqueues CSS
888
- * @uses wp_enqueue_script() Enqueues JS
889
- * @uses wp_add_dashboard_widget() Adds a new widget to the WordPress admin dashboard
890
- * @uses current_user_can() Checks the capabilities of the current user
891
- */
892
- function wpsc_dashboard_widget_setup() {
893
- $version_identifier = WPSC_VERSION . "." . WPSC_MINOR_VERSION;
894
- // Enqueue the styles and scripts necessary
895
- wp_enqueue_style( 'wp-e-commerce-admin', WPSC_URL . '/wpsc-admin/css/admin.css', false, $version_identifier, 'all' );
896
- wp_enqueue_script( 'datepicker-ui', WPSC_URL . "/wpsc-core/js/ui.datepicker.js", array( 'jquery', 'jquery-ui-core', 'jquery-ui-sortable' ), $version_identifier );
897
-
898
- $news_cap = apply_filters( 'wpsc_dashboard_news_cap' , 'manage_options' );
899
- $sales_cap = apply_filters( 'wpsc_dashboard_sales_summary_cap' , 'manage_options' );
900
- $quarterly_sales_cap = apply_filters( 'wpsc_dashboard_quarterly_sales_cap', 'manage_options' );
901
- $monthly_sales_cap = apply_filters( 'wpsc_dashboard_monthly_sales_cap' , 'manage_options' );
902
-
903
- // Add the dashboard widgets
904
- if ( current_user_can( $news_cap ) )
905
- wp_add_dashboard_widget( 'wpsc_dashboard_news', __( 'WP eCommerce News' , 'wp-e-commerce' ), 'wpsc_dashboard_news' );
906
- if ( current_user_can( $sales_cap ) )
907
- wp_add_dashboard_widget( 'wpsc_dashboard_widget', __( 'Sales Summary', 'wp-e-commerce' ), 'wpsc_dashboard_widget' );
908
- if ( current_user_can( $quarterly_sales_cap ) )
909
- wp_add_dashboard_widget( 'wpsc_quarterly_dashboard_widget', __( 'Sales by Quarter', 'wp-e-commerce' ), 'wpsc_quarterly_dashboard_widget' );
910
- if ( current_user_can( $monthly_sales_cap ) )
911
- wp_add_dashboard_widget( 'wpsc_dashboard_4months_widget', __( 'Sales by Month', 'wp-e-commerce' ), 'wpsc_dashboard_4months_widget' );
912
-
913
- // Sort the Dashboard widgets so ours it at the top
914
- global $wp_meta_boxes;
915
- $boxes = $wp_meta_boxes['dashboard'];
916
- $normal = isset( $wp_meta_boxes['dashboard']['normal'] ) ? $wp_meta_boxes['dashboard']['normal'] : array();
917
-
918
- $normal_dashboard = isset( $normal['core'] ) ? $normal['core'] : array();
919
-
920
- // Backup and delete our new dashbaord widget from the end of the array
921
- $wpsc_widget_backup = array();
922
- if ( isset( $normal_dashboard['wpsc_dashboard_news'] ) ) {
923
- $wpsc_widget_backup['wpsc_dashboard_news'] = $normal_dashboard['wpsc_dashboard_news'];
924
- unset( $normal_dashboard['wpsc_dashboard_news'] );
925
- }
926
- if ( isset( $normal_dashboard['wpsc_dashboard_widget'] ) ) {
927
- $wpsc_widget_backup['wpsc_dashboard_widget'] = $normal_dashboard['wpsc_dashboard_widget'];
928
- unset( $normal_dashboard['wpsc_dashboard_widget'] );
929
- }
930
- if ( isset( $normal_dashboard['wpsc_quarterly_dashboard_widget'] ) ) {
931
- $wpsc_widget_backup['wpsc_quarterly_dashboard_widget'] = $normal_dashboard['wpsc_quarterly_dashboard_widget'];
932
- unset( $normal_dashboard['wpsc_quarterly_dashboard_widget'] );
933
- }
934
- if ( isset( $normal_dashboard['wpsc_dashboard_4months_widget'] ) ) {
935
- $wpsc_widget_backup['wpsc_dashboard_4months_widget'] = $normal_dashboard['wpsc_dashboard_4months_widget'];
936
- unset( $normal_dashboard['wpsc_dashboard_4months_widget'] );
937
- }
938
-
939
- // Merge the two arrays together so our widget is at the beginning
940
- $sorted_dashboard = array_merge( $wpsc_widget_backup, $normal_dashboard );
941
-
942
- // Save the sorted array back into the original metaboxes
943
-
944
- $wp_meta_boxes['dashboard']['normal']['core'] = $sorted_dashboard;
945
- }
946
-
947
- /*
948
- * Registers the widgets on the WordPress Dashboard
949
- */
950
-
951
- add_action( 'wp_dashboard_setup', 'wpsc_dashboard_widget_setup' );
952
-
953
- /**
954
- * Shows the RSS feed for the WPEC dashboard widget
955
- *
956
- * @uses fetch_feed() Build SimplePie object based on RSS or Atom feed from URL.
957
- * @uses wp_widget_rss_output() Display the RSS entries in a list
958
- */
959
- function wpsc_dashboard_news() {
960
- $rss = fetch_feed( 'http://wpecommerce.org/feed/?category_name=news' );
961
- $args = array( 'show_author' => 1, 'show_date' => 1, 'show_summary' => 1, 'items' => 3 );
962
- wp_widget_rss_output( $rss, $args );
963
-
964
- }
965
-
966
- /**
967
- * Gets the quarterly summary of revenue
968
- *
969
- * @uses get_option() Retrieves an option from the WordPress database
970
- * @uses admin_display_total_price() Displays the total price
971
- *
972
- * @return array The array of prices
973
- */
974
- function wpsc_get_quarterly_summary() {
975
- $firstquarter = (int)get_option( 'wpsc_first_quart' );
976
- $secondquarter = (int)get_option( 'wpsc_second_quart' );
977
- $thirdquarter = (int)get_option( 'wpsc_third_quart' );
978
- $fourthquarter = (int)get_option( 'wpsc_fourth_quart' );
979
- $finalquarter = (int)get_option( 'wpsc_final_quart' );
980
-
981
- $results = array();
982
- $results[] = admin_display_total_price( $thirdquarter + 1, $fourthquarter );
983
- $results[] = admin_display_total_price( $secondquarter + 1, $thirdquarter );
984
- $results[] = admin_display_total_price( $firstquarter + 1, $secondquarter );
985
- $results[] = admin_display_total_price( $finalquarter, $firstquarter );
986
- return $results;
987
- }
988
-
989
- /**
990
- * Called by wp_add_dashboard_widget and ads the quarterly revenue reports to the WordPress admin dashboard
991
- *
992
- * @uses get_option() Gets the specified option from database
993
- * @uses esc_html_e() Displays translated text that has been escaped for safe use in HTML
994
- */
995
- function wpsc_quarterly_dashboard_widget() {
996
- if ( get_option( 'wpsc_business_year_start' ) == false ) {
997
- ?>
998
- <form action='' method='post'>
999
- <label for='date_start'><?php esc_html_e( 'Financial Year End' , 'wp-e-commerce' ); ?>: </label>
1000
- <input id='date_start' type='text' class='pickdate' size='11' value='<?php echo get_option( 'wpsc_last_date' ); ?>' name='add_start' />
1001
- <!--<select name='add_start[day]'>
1002
- <?php
1003
- for ( $i = 1; $i <= 31; ++$i ) {
1004
- $selected = '';
1005
- if ( $i == date( "d" ) ) {
1006
- $selected = "selected='selected'";
1007
- }
1008
- echo "<option $selected value='$i'>$i</option>";
1009
- }
1010
- ?>
1011
- </select>
1012
- <select name='add_start[month]'>
1013
- <?php
1014
- for ( $i = 1; $i <= 12; ++$i ) {
1015
- $selected = '';
1016
- if ( $i == (int)date( "m" ) ) {
1017
- $selected = "selected='selected'";
1018
- }
1019
- echo "<option $selected value='$i'>" . date( "M", mktime( 0, 0, 0, $i, 1, date( "Y" ) ) ) . "</option>";
1020
- }
1021
- ?>
1022
- </select>
1023
- <select name='add_start[year]'>
1024
- <?php
1025
- for ( $i = date( "Y" ); $i <= ( date( "Y" ) + 12 ); ++$i ) {
1026
- $selected = '';
1027
- if ( $i == date( "Y" ) ) {
1028
- $selected = "selected='true'";
1029
- }
1030
- echo "<option $selected value='$i'>" . $i . "</option>";
1031
- }
1032
- ?>
1033
- </select>-->
1034
- <input type='hidden' name='wpsc_admin_action' value='wpsc_quarterly' />
1035
- <input type='submit' class='button primary' value='Submit' name='wpsc_submit' />
1036
- </form>
1037
- <?php
1038
- if ( get_option( 'wpsc_first_quart' ) != '' ) {
1039
- $firstquarter = get_option( 'wpsc_first_quart' );
1040
- $secondquarter = get_option( 'wpsc_second_quart' );
1041
- $thirdquarter = get_option( 'wpsc_third_quart' );
1042
- $fourthquarter = get_option( 'wpsc_fourth_quart' );
1043
- $finalquarter = get_option( 'wpsc_final_quart' );
1044
- $revenue = wpsc_get_quarterly_summary();
1045
- $currsymbol = wpsc_get_currency_symbol();
1046
- foreach ( $revenue as $rev ) {
1047
- if ( $rev == '' ) {
1048
- $totals[] = '0.00';
1049
- } else {
1050
- $totals[] = $rev;
1051
- }
1052
- }
1053
- ?>
1054
- <div id='box'>
1055
- <p class='atglance'>
1056
- <span class='wpsc_quart_left'><?php esc_html_e( 'At a Glance' , 'wp-e-commerce' ); ?></span>
1057
- <span class='wpsc_quart_right'><?php esc_html_e( 'Revenue' , 'wp-e-commerce' ); ?></span>
1058
- </p>
1059
- <div style='clear:both'></div>
1060
- <p class='quarterly'>
1061
- <span class='wpsc_quart_left'><strong>01</strong>&nbsp; (<?php echo date( 'M Y', $thirdquarter ) . ' - ' . date( 'M Y', $fourthquarter ); ?>)</span>
1062
- <span class='wpsc_quart_right'><?php echo $currsymbol . ' ' . $totals[0]; ?></span></p>
1063
- <p class='quarterly'>
1064
- <span class='wpsc_quart_left'><strong>02</strong>&nbsp; (<?php echo date( 'M Y', $secondquarter ) . ' - ' . date( 'M Y', $thirdquarter ); ?>)</span>
1065
- <span class='wpsc_quart_right'><?php echo $currsymbol . ' ' . $totals[1]; ?></span></p>
1066
- <p class='quarterly'>
1067
- <span class='wpsc_quart_left'><strong>03</strong>&nbsp; (<?php echo date( 'M Y', $firstquarter ) . ' - ' . date( 'M Y', $secondquarter ); ?>)</span>
1068
- <span class='wpsc_quart_right'><?php echo $currsymbol . ' ' . $totals[2]; ?></span></p>
1069
- <p class='quarterly'>
1070
- <span class='wpsc_quart_left'><strong>04</strong>&nbsp; (<?php echo date( 'M Y', $finalquarter ) . ' - ' . date( 'M Y', $firstquarter ); ?>)</span>
1071
- <span class='wpsc_quart_right'><?php echo $currsymbol . ' ' . $totals[3]; ?></span>
1072
- </p>
1073
- <div style='clear:both'></div>
1074
- </div>
1075
- <?php
1076
- }
1077
- }
1078
- }
1079
-
1080
- /**
1081
- * Called by wp_add_dashboard_widget to add the WPSC dashboard widget
1082
- *
1083
- * @uses do_action() Calls 'wpsc_admin_pre_activity'
1084
- * @uses do_action() Calls 'wpsc_admin_post_activity'
1085
- */
1086
- function wpsc_dashboard_widget() {
1087
- do_action( 'wpsc_admin_pre_activity' );
1088
- do_action( 'wpsc_admin_post_activity' );
1089
- }
1090
-
1091
- /*
1092
- * END - Dashboard Widget for 2.7
1093
- */
1094
-
1095
-
1096
- /*
1097
- * Dashboard Widget Last Four Month Sales.
1098
- *
1099
- * @uses $wpdb WordPress database object for queries
1100
- * @uses get_results() Gets generic multiple row results from the WordPress database
1101
- * @uses get_var() Returns a single variable from the database
1102
- * @uses wpsc_currency_display() Returns the currency with the display options applied
1103
- */
1104
- function wpsc_dashboard_4months_widget() {
1105
- global $wpdb;
1106
-
1107
- $this_year = date( "Y" ); //get current year and month
1108
- $this_month = date( "n" );
1109
-
1110
- $months = array();
1111
- $months[] = mktime( 0, 0, 0, $this_month - 3, 1, $this_year ); //generate unix time stamps fo 4 last months
1112
- $months[] = mktime( 0, 0, 0, $this_month - 2, 1, $this_year );
1113
- $months[] = mktime( 0, 0, 0, $this_month - 1, 1, $this_year );
1114
- $months[] = mktime( 0, 0, 0, $this_month, 1, $this_year );
1115
-
1116
- $products = $wpdb->get_results( "SELECT `cart`.`prodid`,
1117
- `cart`.`name`
1118
- FROM `" . WPSC_TABLE_CART_CONTENTS . "` AS `cart`
1119
- INNER JOIN `" . WPSC_TABLE_PURCHASE_LOGS . "` AS `logs`
1120
- ON `cart`.`purchaseid` = `logs`.`id`
1121
- WHERE `logs`.`processed` >= 2
1122
- AND `logs`.`date` >= " . $months[0] . "
1123
- GROUP BY `cart`.`prodid`
1124
- ORDER BY SUM(`cart`.`price` * `cart`.`quantity`) DESC
1125
- LIMIT 4", ARRAY_A ); //get 4 products with top income in 4 last months.
1126
-
1127
- $timeranges = array();
1128
- $timeranges[0]["start"] = mktime( 0, 0, 0, $this_month - 3, 1, $this_year ); //make array of time ranges
1129
- $timeranges[0]["end"] = mktime( 0, 0, 0, $this_month - 2, 1, $this_year );
1130
- $timeranges[1]["start"] = mktime( 0, 0, 0, $this_month - 2, 1, $this_year );
1131
- $timeranges[1]["end"] = mktime( 0, 0, 0, $this_month - 1, 1, $this_year );
1132
- $timeranges[2]["start"] = mktime( 0, 0, 0, $this_month - 1, 1, $this_year );
1133
- $timeranges[2]["end"] = mktime( 0, 0, 0, $this_month, 1, $this_year );
1134
- $timeranges[3]["start"] = mktime( 0, 0, 0, $this_month, 1, $this_year );
1135
- $timeranges[3]["end"] = time(); // using mktime here can generate a php runtime warning
1136
-
1137
- $prod_data = array( );
1138
- foreach ( (array)$products as $product ) { //run through products and get each product income amounts and name
1139
- $sale_totals = array( );
1140
- foreach ( $timeranges as $timerange ) { //run through time ranges of product, and get its income over each time range
1141
- $prodsql = "SELECT
1142
- SUM(`cart`.`price` * `cart`.`quantity`) AS sum
1143
- FROM `" . WPSC_TABLE_CART_CONTENTS . "` AS `cart`
1144
- INNER JOIN `" . WPSC_TABLE_PURCHASE_LOGS . "` AS `logs`
1145
- ON `cart`.`purchaseid` = `logs`.`id`
1146
- WHERE `logs`.`processed` >= 2
1147
- AND `logs`.`date` >= " . $timerange["start"] . "
1148
- AND `logs`.`date` < " . $timerange["end"] . "
1149
- AND `cart`.`prodid` = " . $product['prodid'] . "
1150
- GROUP BY `cart`.`prodid`"; //get the amount of income that current product has generaterd over current time range
1151
- $sale_totals[] = $wpdb->get_var( $prodsql ); //push amount to array
1152
- }
1153
- $prod_data[] = array(
1154
- 'sale_totals' => $sale_totals,
1155
- 'product_name' => $product['name'] ); //result: array of 2: $prod_data[0] = array(income)
1156
- $sums = array( ); //reset array //$prod_data[1] = product name
1157
- }
1158
-
1159
- $tablerow = 1;
1160
- ob_start();
1161
- ?>
1162
- <div style="padding-bottom:15px; "><?php esc_html_e( 'Last four months of sales on a per product basis:', 'wp-e-commerce' ); ?></div>
1163
- <table style="width:100%" border="0" cellspacing="0">
1164
- <tr style="font-style:italic; color:#666;" height="20">
1165
- <td colspan="2" style=" font-family:\'Times New Roman\', Times, serif; font-size:15px; border-bottom:solid 1px #000;"><?php esc_html_e( 'At a Glance', 'wp-e-commerce' ); ?></td>
1166
- <?php foreach ( $months as $mnth ): ?>
1167
- <td align="center" style=" font-family:\'Times New Roman\'; font-size:15px; border-bottom:solid 1px #000;"><?php echo date( "M", $mnth ); ?></td>
1168
- <?php endforeach; ?>
1169
- </tr>
1170
- <?php foreach ( (array)$prod_data as $sales_data ): ?>
1171
- <tr height="20">
1172
- <td width="20" style="font-weight:bold; color:#008080; border-bottom:solid 1px #000;"><?php echo $tablerow; ?></td>
1173
- <td style="border-bottom:solid 1px #000;width:60px"><?php echo $sales_data['product_name']; ?></td>
1174
- <?php foreach ( $sales_data['sale_totals'] as $amount ): ?>
1175
- <td align="center" style="border-bottom:solid 1px #000;"><?php echo wpsc_currency_display($amount); ?></td>
1176
- <?php endforeach; ?>
1177
- </tr>
1178
- <?php
1179
- $tablerow++;
1180
- endforeach; ?>
1181
- </table>
1182
- <?php
1183
- ob_end_flush();
1184
- }
1185
-
1186
-
1187
- //Modification to allow for multiple column layout
1188
-
1189
- /**
1190
- * @todo docs
1191
- * @param $columns
1192
- * @param $screen
1193
- * @return mixed
1194
- */
1195
- function wpec_two_columns( $columns, $screen ) {
1196
- if ( $screen == 'toplevel_page_wpsc-edit-products' )
1197
- $columns['toplevel_page_wpsc-edit-products'] = 2;
1198
-
1199
- return $columns;
1200
- }
1201
- add_filter( 'screen_layout_columns', 'wpec_two_columns', 10, 2 );
1202
-
1203
- /**
1204
- * @todo docs
1205
- * @param $actions
1206
- * @return mixed
1207
- */
1208
- function wpsc_fav_action( $actions ) {
1209
- $actions['post-new.php?post_type=wpsc-product'] = array( 'New Product', 'manage_options' );
1210
- return $actions;
1211
- }
1212
- add_filter( 'favorite_actions', 'wpsc_fav_action' );
1213
-
1214
- /**
1215
- * Enqueue the admin scripts
1216
- *
1217
- * @uses wp_enqueue_script() Enqueues scripts
1218
- * @uses home_url() Returns the base url for the site
1219
- */
1220
- function wpsc_print_admin_scripts() {
1221
- $version_identifier = WPSC_VERSION . '.' . WPSC_MINOR_VERSION;
1222
- wp_enqueue_script( 'wp-e-commerce-admin', WPSC_CORE_JS_URL . '/wp-e-commerce.js', array( 'jquery' ), $version_identifier );
1223
- wp_localize_script( 'wp-e-commerce-admin', 'wpsc_ajax', wpsc_javascript_localizations() );
1224
- }
1225
-
1226
- /**
1227
- * wpsc_ajax_ie_save save changes made using inline edit
1228
- *
1229
- * @since 3.8.0
1230
- * @access public
1231
- *
1232
- * @uses get_post_type_object() Gets post object for given registered post type name
1233
- * @uses current_user_can() Checks the capabilities of the current user
1234
- * @uses absint() Converts to a nonnegative integer
1235
- * @uses get_post() Gets the post object given post id
1236
- * @uses wp_get_object_terms() Gets terms for given post object
1237
- * @uses wp_update_post() Updates the post in the database
1238
- * @uses get_product_meta() An alias for get_post_meta prefixes with the WPSC key
1239
- * @uses wpsc_convert_weight() Converts to weight format specified by user
1240
- * @uses json_encode() Encodes array for JS
1241
- * @uses esc_js() Escape single quotes, htmlspecialchar " < > &, and fix line endings.
1242
- *
1243
- * @returns nothing
1244
- */
1245
- function wpsc_ajax_ie_save() {
1246
-
1247
- $product_post_type = get_post_type_object( 'wpsc-product' );
1248
-
1249
- if ( !current_user_can( $product_post_type->cap->edit_posts ) ) {
1250
- echo '({"error":"' . __( 'Error: you don\'t have required permissions to edit this product', 'wp-e-commerce' ) . '", "id": "'. esc_js( $_POST['id'] ) .'"})';
1251
- die();
1252
- }
1253
-
1254
- $id = absint( $_POST['id'] );
1255
- $post = get_post( $_POST['id'] );
1256
- $parent = get_post( $post->post_parent );
1257
- $terms = wpsc_get_product_terms( $id, 'wpsc-variation', 'name' );
1258
-
1259
- $product = array(
1260
- 'ID' => $_POST['id'],
1261
- 'post_title' => $parent->post_title . ' (' . implode( ', ', $terms ) . ')',
1262
- );
1263
-
1264
- $id = wp_update_post( $product );
1265
- if ( $id > 0 ) {
1266
- //need parent meta to know which weight unit we are using
1267
- $parent_meta = get_product_meta($post->post_parent, 'product_metadata', true );
1268
- $product_meta = get_product_meta( $product['ID'], 'product_metadata', true );
1269
- if ( is_numeric( $_POST['weight'] ) || empty( $_POST['weight'] ) ){
1270
- $product_meta['weight'] = wpsc_convert_weight($_POST['weight'], $parent_meta['weight_unit'], 'pound', true);
1271
- $product_meta['weight_unit'] = $parent_meta['weight_unit'];
1272
- }
1273
-
1274
- update_product_meta( $product['ID'], 'product_metadata', $product_meta );
1275
- update_product_meta( $product['ID'], 'price', (float)$_POST['price'] );
1276
- update_product_meta( $product['ID'], 'special_price', (float)$_POST['special_price'] );
1277
- update_product_meta( $product['ID'], 'sku', sanitize_text_field( $_POST['sku'] ) );
1278
-
1279
- if ( !is_numeric($_POST['stock']) )
1280
- update_product_meta( $product['ID'], 'stock', '' );
1281
- else
1282
- update_product_meta( $product['ID'], 'stock', absint( $_POST['stock'] ) );
1283
-
1284
- $meta = get_product_meta( $id, 'product_metadata', true );
1285
- $price = get_product_meta( $id, 'price', true );
1286
- $special_price = get_product_meta( $id, 'special_price', true );
1287
- $sku = get_product_meta( $id, 'sku', true );
1288
- $sku = ( $sku )?$sku:__('N/A', 'wp-e-commerce');
1289
- $stock = get_product_meta( $id, 'stock', true );
1290
- $stock = ( $stock === '' )?__('N/A', 'wp-e-commerce'):$stock;
1291
- $results = array( 'id' => $id, 'title' => $post->post_title, 'weight' => wpsc_convert_weight($meta['weight'], 'pound', $parent_meta['weight_unit']), 'price' => wpsc_currency_display( $price ), 'special_price' => wpsc_currency_display( $special_price ), 'sku' => $sku, 'stock' => $stock );
1292
- echo '(' . json_encode( $results ) . ')';
1293
- die();
1294
- } else {
1295
- echo '({"error":"' . __( 'Error updating product', 'wp-e-commerce' ) . '", "id": "'. esc_js( $_POST['id'] ) .'"})';
1296
- }
1297
- die();
1298
- }
1299
-
1300
- /**
1301
- * @todo docs
1302
- *
1303
- * @uses add_meta_box Allows addition of metaboxes to the wpsc_add_meta_boxes admin
1304
- */
1305
- function wpsc_add_meta_boxes(){
1306
- add_meta_box( 'dashboard_right_now', __( 'Current Month', 'wp-e-commerce' ), 'wpsc_right_now', 'dashboard_page_wpsc-sales-logs', 'top' );
1307
- }
1308
-
1309
- /**
1310
- * Displays notice if user has Great Britain selected as their base country
1311
- * Since 3.8.9, we have deprecated Great Britain in favor of the UK
1312
- *
1313
- * @since 3.8.9
1314
- * @access private
1315
- * @link http://code.google.com/p/wp-e-commerce/issues/detail?id=1079
1316
- *
1317
- * @uses get_option() Retrieves option from the WordPress database
1318
- * @uses get_outdate_isocodes() Returns outdated isocodes
1319
- * @uses admin_url() Returns admin_url of the site
1320
- *
1321
- * @return string The admin notices for deprecated countries
1322
- */
1323
- function _wpsc_action_admin_notices_deprecated_countries_notice() {
1324
- $base_country = get_option( 'base_country' );
1325
-
1326
- if ( ! in_array( $base_country, WPSC_Country::get_outdated_isocodes() ) )
1327
- return;
1328
-
1329
- switch ( $base_country ) {
1330
- case 'YU':
1331
- $message = __( 'Yugoslavia is no longer a valid official country name according to <a href="%1$s">ISO 3166</a> while both Serbia and Montenegro have been added to the country list.<br /> As a result, we highly recommend changing your <em>Base Country</em> to reflect this change on the <a href="%2$s">General Settings</a> page.', 'wp-e-commerce' );
1332
- break;
1333
- case 'UK':
1334
- $message = __( 'Prior to WP eCommerce 3.8.9, in your database, United Kingdom\'s country code is UK and you have already selected that country code as the base country. However, now that you\'re using WP eCommerce version %3$s, it is recommended that you change your base country to the official "GB" country code, according to <a href="%1$s">ISO 3166</a>.<br /> Please go to <a href="%2$s">General Settings</a> page to make this change.<br />The legacy "UK" item will be marked as "U.K. (legacy)" on the country drop down list. Simply switch to the official "United Kingdom (ISO 3166)" to use the "GB" country code.' , 'wp-e-commerce' );
1335
- break;
1336
- case 'AN':
1337
- $message = __( 'Netherlands Antilles is no longer a valid official country name according to <a href="%1$s">ISO 3166</a>.<br />Please consider changing your <em>Base Country</em> to reflect this change on the <a href="%2$s">General Settings</a> page.', 'wp-e-commerce' );
1338
- case 'TP':
1339
- $message = __( 'Prior to WP eCommerce 3.8.9, in your database, East Timor\'s country code is TP and you have already selected that country code as the base country. However, now that you\'re using WP eCommerce version %3$s, it is recommended that you change your base country to the official "TL" country code, according to <a href="%1$s">ISO 3166</a>.<br /> Please go to <a href="%2$s">General Settings</a> page to make this change.<br />The legacy "TP" item will be marked as "East Timor (legacy)" on the country drop down list. Simply switch to the official "Timor-Leste (ISO 3166)" to use the "TL" country code.' , 'wp-e-commerce' );
1340
- break;
1341
- }
1342
-
1343
- $message = sprintf(
1344
- /* message */ $message,
1345
- /* %1$s */ 'http://en.wikipedia.org/wiki/ISO_3166-1',
1346
- /* %2$s */ admin_url( 'options-general.php?page=wpsc-settings&tab=general' ),
1347
- /* %3$s */ WPSC_VERSION
1348
- );
1349
- echo '<div id="wpsc-warning" class="error"><p>' . $message . '</p></div>';
1350
- }
1351
-
1352
- add_action( 'admin_notices' , '_wpsc_action_admin_notices_deprecated_countries_notice' );
1353
- add_action( 'wp_ajax_category_sort_order' , 'wpsc_ajax_set_category_order' );
1354
- add_action( 'wp_ajax_variation_sort_order', 'wpsc_ajax_set_variation_order' );
1355
- add_action( 'wp_ajax_wpsc_ie_save' , 'wpsc_ajax_ie_save' );
1356
- add_action( 'in_admin_header' , 'wpsc_add_meta_boxes' );
1357
-
1358
- /**
1359
- * Deletes file associated with a product.
1360
- *
1361
- * @access private
1362
- *
1363
- * @uses $wpdb WordPress database object for queries
1364
- * @uses prepare() Prepares a database query by escaping
1365
- * @uses wp_delete_post() Removes a post attachment or page*
1366
- *
1367
- * @param int $product_id req The id of the product
1368
- * @param string $file_name req The string
1369
- *
1370
- * @return mixed
1371
- *
1372
- */
1373
- function _wpsc_delete_file( $product_id, $file_name ) {
1374
- global $wpdb;
1375
-
1376
- $sql = $wpdb->prepare( "SELECT ID FROM $wpdb->posts WHERE post_title = %s AND post_parent = %d AND post_type ='wpsc-product-file'", $file_name, $product_id );
1377
- $product_id_to_delete = $wpdb->get_var( $sql );
1378
-
1379
- //Delete wpsc_download_status entry for this file
1380
- $wpdb->query( $wpdb->prepare( "DELETE FROM `".WPSC_TABLE_DOWNLOAD_STATUS."` WHERE `fileid`=%d AND `product_id` = %d", $product_id_to_delete, $product_id ) );
1381
-
1382
- return wp_delete_post( $product_id_to_delete, true );
1383
- }
1384
-
1385
- /**
1386
- * @todo docs
1387
- *
1388
- * @access private
1389
- *
1390
- * @uses add_query_arg() Adds argument to the WordPress query
1391
- * @uses update_option() Updates an option in the WordPress database given string and value
1392
- * @uses get_option() Gets option from the database given string
1393
- */
1394
- function _wpsc_admin_notices_3dot8dot9() {
1395
- $message = '<p>' . __( 'You are currently using WP eCommerce. There have been major changes in WP eCommerce 3.8.9, so backward-compatibility with existing plugins might not always be guaranteed. If you are unsure, please roll back to 3.8.8.5, and set up a test site with 3.8.9 to make sure WP eCommerce 3.8.9 is compatible with your existing themes and plugins.<br />If you find any incompatibility issues, please <a href="%1$s">report them to us</a> as well as the other plugins or themes\' developers.' , 'wp-e-commerce' ) . '</p>';
1396
- $message .= "\n<p>" . __( '<a href="%2$s">Hide this warning</a>', 'wp-e-commerce' ) . '</p>';
1397
- $message = sprintf(
1398
- $message,
1399
- 'https://wpecommerce.org/wp-e-commerce-3-8-9-compatibility-issues/',
1400
- esc_url( add_query_arg( 'dismiss_389_upgrade_notice', 1 ) )
1401
- );
1402
-
1403
- echo '<div id="wpsc-3.8.9-notice" class="error">' . $message . '</div>';
1404
- }
1405
-
1406
- /**
1407
- * Checks to ensure that shipping is enabled, and one or both of the shipping/billing states are not displayed.
1408
- * If those condtions are met, and the user has not previously dismissed the notice, then we notify them
1409
- * that the shipping calculator now depend on those fields.
1410
- *
1411
- * @access private
1412
- *
1413
- * @uses add_query_arg() Adds argument to the WordPress query
1414
- * @uses update_option() Updates an option in the WordPress database given string and value
1415
- * @uses get_option() Gets option from the database given string
1416
- */
1417
- function _wpsc_admin_notices_3_8_14_1() {
1418
-
1419
- if ( get_option( 'do_not_use_shipping' ) ) {
1420
- return;
1421
- }
1422
-
1423
- global $wpdb;
1424
-
1425
- $state_visibility = $wpdb->get_var( "SELECT COUNT(active) FROM " . WPSC_TABLE_CHECKOUT_FORMS . " WHERE unique_name IN ( 'billingstate', 'shippingstate' ) AND active = '1'" );
1426
-
1427
- if ( '2' === $state_visibility ) {
1428
- return;
1429
- }
1430
-
1431
- $message = '<p>' . __( 'WP eCommerce has been updated, please confirm the checkout field display
1432
- settings are correct for your store.<br><br><i>The visibility of the checkout billing and shipping
1433
- drop downs that show states and provinces is now controlled by the "billingstate" and "shippingstate"
1434
- options set in the <b>Store Settings</b> on the <b>Checkout</b> tab. Prior versions used
1435
- the "billingcountry" and "shippingcountry" settings to control the visibility of the drop downs.</i>' , 'wp-e-commerce' ) . '</p>';
1436
- $message .= "\n<p>" . __( '<a href="%s">Hide this warning</a>', 'wp-e-commerce' ) . '</p>';
1437
- $message = sprintf(
1438
- $message,
1439
- esc_url( add_query_arg( 'dismiss_3_8_14_1_upgrade_notice', 1 ) )
1440
- );
1441
-
1442
- echo '<div id="wpsc-3-8-14-1-notice" class="error">' . $message . '</div>';
1443
- }
1444
-
1445
- if ( ! get_option( 'wpsc_hide_3_8_14_1_notices' ) ) {
1446
- add_action( 'admin_notices', '_wpsc_admin_notices_3_8_14_1' );
1447
-
1448
- if ( isset( $_REQUEST['dismiss_3_8_14_1_upgrade_notice'] ) ) {
1449
- update_option( 'wpsc_hide_3_8_14_1_notices', true );
1450
- }
1451
- }
1452
-
1453
- /**
1454
- * @todo docs
1455
- * @access private
1456
- *
1457
- * @uses add_query_arg() Adds argument to the WordPress query
1458
- * @uses update_option() Updates an option in the WordPress database given string and value
1459
- * @uses get_option() Gets option from the database given string
1460
- */
1461
- function _wpsc_admin_notices_3dot8dot11() {
1462
- $message = '<p>' . __( 'You are currently using WPeC %1$s. We introduced a regression in WPeC 3.8.10 which affects your customer user account page. We have included a fix for a <a href="%2$s">bug on the User Account management page</a>. We are able to fix this automatically on most sites, but it appears that you have made changes to your wpsc-user-log.php page. For that reason, we have some <a href="%3$s">simple instructions for you to follow</a> to resolve the issue. We are sorry for the inconvenience.' , 'wp-e-commerce' ) . '</p>';
1463
- $message .= "\n<p>" . __( '<a href="%4$s">Hide this warning</a>', 'wp-e-commerce' ) . '</p>';
1464
- $message = sprintf(
1465
- $message,
1466
- WPSC_VERSION,
1467
- 'https://github.com/wp-e-commerce/WP-e-Commerce/issues/359',
1468
- 'http://docs.wpecommerce.org/documentation/3-8-11-user-logs',
1469
- esc_url( add_query_arg( 'dismiss_3811_upgrade_notice', 1 ) )
1470
- );
1471
-
1472
- echo '<div id="wpsc-3.8.11-notice" class="error">' . $message . '</div>';
1473
- }
1474
-
1475
- if ( isset( $_REQUEST['dismiss_3811_upgrade_notice'] ) )
1476
- update_option( '_wpsc_3811_user_log_notice', false );
1477
-
1478
- if ( get_option( '_wpsc_3811_user_log_notice' ) )
1479
- add_action( 'admin_notices', '_wpsc_admin_notices_3dot8dot11' );
1480
-
1481
- function _wpsc_notify_google_checkout_deprecation() {
1482
- $gateways = get_option( 'custom_gateway_options', array() );
1483
-
1484
- if ( false !== ( $key = array_search( 'google', $gateways ) ) ) {
1485
- unset( $gateways[ $key ] );
1486
- }
1487
-
1488
- if ( empty( $gateways ) ) {
1489
- $gateways[] = 'wpsc_merchant_testmode';
1490
- }
1491
-
1492
- update_option( 'custom_gateway_options', $gateways );
1493
-
1494
- $message = '<p>' . __( 'Effective November 20th, 2013, Google Checkout was shut down and is no longer processing payments. You are seeing this warning because it appears that Google Checkout was your payment gateway processor. If it was your sole processor, we have enabled the Test Gateway to ensure that orders are coming through on your site, but we highly recommend enabling a proper gateway. If you have no preference, we highly recommend Stripe.' , 'wp-e-commerce' ) . '</p>';
1495
-
1496
- echo '<div id="wpsc-3.8.11-notice" class="error">' . $message . '</div>';
1497
- }
1498
-
1499
- if ( in_array( 'google', get_option( 'custom_gateway_options', array() ) ) ) {
1500
- add_action( 'admin_notices', '_wpsc_notify_google_checkout_deprecation' );
1501
- }
1502
-
1503
- /**
1504
- * Adds links to premium support and documentation on WPeCommerce.org
1505
- *
1506
- * @since 3.9.0
1507
- *
1508
- * @param array $links Original links
1509
- * @return array $links Updated links
1510
- */
1511
- function wpsc_support_links( $links ) {
1512
- $links[] = sprintf( '<a href="%s">%s</a>', _x( 'https://wpecommerce.org/support/', 'Support URL', 'wp-e-commerce' ), __( 'Support', 'wp-e-commerce' ) );
1513
- $links[] = sprintf( '<a href="%s">%s</a>', _x( 'http://docs.wpecommerce.org/', 'Documentation URL', 'wp-e-commerce' ), __( 'Documentation', 'wp-e-commerce' ) );
1514
-
1515
- return $links;
1516
- }
1517
-
1518
- add_filter( 'plugin_action_links_' . WPSC_PLUGIN_BASENAME, 'wpsc_support_links' );
1519
-
1520
- /**
1521
- * Adds removable query args, for compatibility with dismissable notices.
1522
- *
1523
- * @param array $args Array of removable query args.
1524
- *
1525
- * @since 3.11.5
1526
- *
1527
- * @return array $args Array of removable query args.
1528
- */
1529
- function wpsc_removable_query_args( $args ) {
1530
- $args[] = 'shipping_disabled';
1531
- return $args;
1532
- }
1533
-
1534
- add_filter( 'removable_query_args', 'wpsc_removable_query_args' );
1535
-
1536
- /**
1537
- * Modify bulk post messages.
1538
- *
1539
- * @param array $bulk_messages Array of bulk messages.
1540
- * @param int $bulk_counts The amount of messages affected.
1541
- *
1542
- * @since 3.11.5
1543
- *
1544
- * @return array Array of bulk messages.
1545
- */
1546
- function wpsc_bulk_updated_messages( $bulk_messages, $bulk_counts ) {
1547
- $bulk_messages['wpsc-product'] = array(
1548
- 'updated' => _n( '%s product updated.', '%s products updated.', $bulk_counts['updated'], 'wp-e-commerce' ),
1549
- 'locked' => ( 1 == $bulk_counts['locked'] ) ? __( '1 product not updated, somebody is editing it.', 'wp-e-commerce' ) :
1550
- _n( '%s product not updated, somebody is editing it.', '%s products not updated, somebody is editing them.', $bulk_counts['locked'], 'wp-e-commerce' ),
1551
- 'deleted' => _n( '%s product permanently deleted.', '%s products permanently deleted.', $bulk_counts['deleted'], 'wp-e-commerce' ),
1552
- 'trashed' => _n( '%s product moved to the Trash.', '%s products moved to the Trash.', $bulk_counts['trashed'], 'wp-e-commerce' ),
1553
- 'untrashed' => _n( '%s product restored from the Trash.', '%s products restored from the Trash.', $bulk_counts['untrashed'], 'wp-e-commerce' ),
1554
- );
1555
-
1556
- return $bulk_messages;
1557
- }
1558
-
1559
- add_filter( 'bulk_post_updated_messages', 'wpsc_bulk_updated_messages', 10, 2 );
1560
-
1561
- /**
1562
- * Add rating links to the admin dashboard
1563
- *
1564
- * @since 3.12
1565
- * @global string $typenow
1566
- * @param string $footer_text The existing footer text
1567
- * @return string Changed $footer_text
1568
- */
1569
- function wpsc_admin_rate_us( $footer_text ) {
1570
- global $typenow;
1571
-
1572
- if ( $typenow == 'wpsc-product' ) {
1573
- $rate_text = sprintf( __( 'Thank you for using <a href="%1$s" target="_blank">WP eCommerce</a>! Please <a href="%2$s" target="_blank">rate us</a> on <a href="%2$s" target="_blank">WordPress.org</a>', 'wp-e-commerce' ),
1574
- 'https://wpecommerce.org',
1575
- 'https://wordpress.org/support/plugin/wp-e-commerce/reviews/?filter=5#new-post'
1576
- );
1577
- return str_replace( '</span>', '', $footer_text ) . ' | ' . $rate_text . '</span>';
1578
- } else {
1579
- return $footer_text;
1580
- }
1581
- }
1582
- add_filter( 'admin_footer_text', 'wpsc_admin_rate_us' );
1583
-
1584
- function wpsc_product_category_edit_form_tag() {
1585
- echo 'enctype="multipart/form-data" ';
1586
- }
1587
- add_action( 'wpsc_product_category_term_new_form_tag', 'wpsc_product_category_edit_form_tag' );
1588
- add_action( 'wpsc_product_category_term_edit_form_tag', 'wpsc_product_category_edit_form_tag' );
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
trunk/wpsc-admin/ajax-and-init.php DELETED
@@ -1,221 +0,0 @@
1
- <?php
2
-
3
- /**
4
- * WP eCommerce Admin AJAX functions
5
- *
6
- * These are the WPSC Admin AJAX functions
7
- *
8
- * @package wp-e-commerce
9
- * @since 3.7.0
10
- *
11
- * @uses update_option() Updates option in the database given key and value
12
- * @uses wp_delete_term() Removes term from the database
13
- * @uses fetch_rss() DEPRECATED
14
- * @uses wpsc_member_dedeactivate_subscriptions() @todo docs
15
- * @uses wpsc_member_deactivate_subscriptions() @todo docs
16
- * @uses wpsc_update_purchase_log_status() Updates the status of the logs for a purchase
17
- * @uses transaction_results() Main function for creating purchase reports
18
- * @uses wpsc_find_purchlog_status_name() Finds name of given status
19
- */
20
- function wpsc_admin_ajax() {
21
-
22
- if ( ! wpsc_is_store_admin() ) {
23
- return;
24
- }
25
-
26
- global $wpdb;
27
-
28
- if ( isset( $_POST['save_image_upload_state'] ) && $_POST['save_image_upload_state'] == 'true' && is_numeric( $_POST['image_upload_state'] ) ) {
29
- $upload_state = (int)(bool)$_POST['image_upload_state'];
30
- update_option( 'wpsc_use_flash_uploader', $upload_state );
31
- exit( "done" );
32
- }
33
-
34
- if ( isset( $_POST['remove_variation_value'] ) && $_POST['remove_variation_value'] == "true" && is_numeric( $_POST['variation_value_id'] ) ) {
35
- $value_id = absint( $_GET['variation_value_id'] );
36
- echo wp_delete_term( $value_id, 'wpsc-variation' );
37
- exit();
38
- }
39
-
40
- if ( isset( $_REQUEST['log_state'] ) && $_REQUEST['log_state'] == "true" && is_numeric( $_POST['id'] ) && is_numeric( $_POST['value'] ) ) {
41
- $newvalue = $_POST['value'];
42
- if ( $_REQUEST['suspend'] == 'true' ) {
43
- if ( $_REQUEST['value'] == 1 && function_exists('wpsc_member_dedeactivate_subscriptions'))
44
- wpsc_member_dedeactivate_subscriptions( $_POST['id'] );
45
- elseif( function_exists('wpsc_member_deactivate_subscriptions'))
46
- wpsc_member_deactivate_subscriptions( $_POST['id'] );
47
-
48
- exit();
49
- } else {
50
-
51
- $log_data = $wpdb->get_row( $wpdb->prepare( "SELECT * FROM `" . WPSC_TABLE_PURCHASE_LOGS . "` WHERE `id` = '%d' LIMIT 1", $_POST['id'] ), ARRAY_A );
52
- if ( ($newvalue == 2) && function_exists( 'wpsc_member_activate_subscriptions' ) ) {
53
- wpsc_member_activate_subscriptions( $_POST['id'] );
54
- }
55
-
56
- wpsc_update_purchase_log_status( $_POST['id'], $newvalue );
57
-
58
- if ( ($newvalue > $log_data['processed']) && ($log_data['processed'] < 2) ) {
59
- transaction_results( $log_data['sessionid'], false );
60
- }
61
-
62
- $status_name = wpsc_find_purchlog_status_name( $purchase['processed'] );
63
- echo "document.getElementById(\"form_group_" . absint( $_POST['id'] ) . "_text\").innerHTML = '" . $status_name . "';\n";
64
-
65
-
66
- $year = date( "Y" );
67
- $month = date( "m" );
68
- $start_timestamp = mktime( 0, 0, 0, $month, 1, $year );
69
- $end_timestamp = mktime( 0, 0, 0, ($month + 1 ), 0, $year );
70
-
71
- echo "document.getElementById(\"log_total_month\").innerHTML = '" . addslashes( wpsc_currency_display( admin_display_total_price( $start_timestamp, $end_timestamp ) ) ) . "';\n";
72
- echo "document.getElementById(\"log_total_absolute\").innerHTML = '" . addslashes( wpsc_currency_display( admin_display_total_price() ) ) . "';\n";
73
- exit();
74
- }
75
- }
76
- }
77
-
78
- if ( isset( $_REQUEST['ajax'] ) && isset( $_REQUEST['admin'] ) && ($_REQUEST['ajax'] == "true") && ($_REQUEST['admin'] == "true") )
79
- add_action( 'admin_init', 'wpsc_admin_ajax' );
80
-
81
- /**
82
- * The function that changes the main currency in the DB
83
- *
84
- * @uses $wpdb WordPress database object for queries
85
- */
86
- function wpsc_change_currency() {
87
-
88
- if ( ! wpsc_is_store_admin() ) {
89
- return;
90
- }
91
-
92
- global $wpdb;
93
-
94
- if ( is_numeric( $_POST['currencyid'] ) ) {
95
- $currency_data = $wpdb->get_results( $wpdb->prepare( "SELECT `symbol`,`symbol_html`,`code` FROM `" . WPSC_TABLE_CURRENCY_LIST . "` WHERE `id`=%d LIMIT 1", $_POST['currencyid'] ), ARRAY_A );
96
- $price_out = null;
97
- if ( $currency_data[0]['symbol'] != '' ) {
98
- $currency_sign = $currency_data[0]['symbol_html'];
99
- } else {
100
- $currency_sign = $currency_data[0]['code'];
101
- }
102
- echo $currency_sign;
103
- }
104
- }
105
- if ( isset( $_REQUEST['wpsc_admin_action'] ) && ($_REQUEST['wpsc_admin_action'] == 'change_currency') )
106
- add_action( 'admin_init', 'wpsc_change_currency' );
107
-
108
- /**
109
- * @todo docs
110
- * @uses $wpdb WordPress database object for queries
111
- */
112
- function wpsc_rearrange_images() {
113
-
114
- if ( ! wpsc_is_store_admin() ) {
115
- return;
116
- }
117
-
118
- global $wpdb;
119
- $images = explode( ",", $_POST['order'] );
120
- $product_id = absint( $_POST['product_id'] );
121
- $timestamp = time();
122
-
123
- $new_main_image = null;
124
- $have_set_first_item = false;
125
- $i = 0;
126
- foreach ( $images as $image ) {
127
- if ( $image > 0 ) {
128
- $wpdb->update(
129
- $wpdb->posts,
130
- array(
131
- 'menu_order' => $i
132
- ),
133
- array(
134
- 'ID' => $image
135
- ),
136
- '%d',
137
- '%d'
138
- );
139
- $i++;
140
- }
141
- }
142
- $output = wpsc_main_product_image_menu( $product_id );
143
- echo "image_menu = '';\n\r";
144
- echo "image_id = '" . $new_main_image . "';\n\r";
145
- exit();
146
- }
147
- if ( isset( $_REQUEST['wpsc_admin_action'] ) && ($_REQUEST['wpsc_admin_action'] == 'rearrange_images') )
148
- add_action( 'admin_init', 'wpsc_rearrange_images' );
149
-
150
- /**
151
- * @todo docs
152
- *
153
- * @uses $wpdb WordPress database object for queries
154
- * @uses $wp_rewrite Global variable instance of the WP_Rewrite Class
155
- * @uses wp_get_referer() Retrieve referer from '_wp_http_referer' or HTTP referer.
156
- * @uses add_query_arg() Retrieve a modified URL query string.
157
- * @uses wp_redirect() Redirects to string given as argument
158
- */
159
- function wpsc_clean_categories() {
160
-
161
- if ( ! wpsc_is_store_admin() ) {
162
- return;
163
- }
164
-
165
- global $wpdb, $wp_rewrite;
166
- $sql_query = "SELECT `id`, `name`, `active` FROM `" . WPSC_TABLE_PRODUCT_CATEGORIES . "`";
167
- $sql_data = $wpdb->get_results( $sql_query, ARRAY_A );
168
- foreach ( (array)$sql_data as $datarow ) {
169
- if ( $datarow['active'] == 1 ) {
170
- $tidied_name = strtolower( trim( $datarow['name'] ) );
171
- $url_name = sanitize_title( $tidied_name );
172
- $similar_names = $wpdb->get_row( $wpdb->prepare( "SELECT COUNT(*) AS `count`, MAX(REPLACE(`nice-name`, '%s', '')) AS `max_number` FROM `" . WPSC_TABLE_PRODUCT_CATEGORIES . "` WHERE `nice-name` REGEXP '^( " . esc_sql( $url_name ) . " ){1}(\d)*$' AND `id` NOT IN (%d) ", $url_name, $datarow['id'] ), ARRAY_A );
173
- $extension_number = '';
174
-
175
- if ( $similar_names['count'] > 0 )
176
- $extension_number = (int)$similar_names['max_number'] + 2;
177
-
178
- $url_name .= $extension_number;
179
-
180
- $wpdb->update(
181
- WPSC_TABLE_PRODUCT_CATEGORIES,
182
- array(
183
- 'nice-name' => $url_name
184
- ),
185
- array(
186
- 'id' => $datarow['id']
187
- ),
188
- '%s',
189
- '%d'
190
- );
191
-
192
- } else if ( $datarow['active'] == 0 ) {
193
- $wpdb->update(
194
- WPSC_TABLE_PRODUCT_CATEGORIES,
195
- array(
196
- 'nice-name' => ''
197
- ),
198
- array(
199
- 'id' => $datarow['id']
200
- ),
201
- '%s',
202
- '%d'
203
- );
204
- }
205
- }
206
- $wp_rewrite->flush_rules();
207
- $sendback = wp_get_referer();
208
-
209
- if ( isset( $updated ) ) {
210
- $sendback = add_query_arg( 'updated', $updated, $sendback );
211
- }
212
- if ( isset( $_SESSION['wpsc_settings_curr_page'] ) ) {
213
- $sendback = add_query_arg( 'tab', $_SESSION['wpsc_settings_curr_page'], $sendback );
214
- }
215
-
216
- wp_redirect( esc_url_raw( $sendback ) );
217
-
218
- exit();
219
- }
220
- if ( isset( $_REQUEST['wpsc_admin_action'] ) && ($_REQUEST['wpsc_admin_action'] == 'clean_categories') )
221
- add_action( 'admin_init', 'wpsc_clean_categories' );
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
trunk/wpsc-admin/ajax.php DELETED
@@ -1,1394 +0,0 @@
1
- <?php
2
- function _wpsc_ajax_purchase_log_refund_items() {
3
- if ( ! isset( $_POST['order_id'] ) ) {
4
- return new WP_Error( 'wpsc_ajax_invalid_purchase_log_refund_items', __( 'Refund failed.', 'wp-e-commerce' ) );
5
- }
6
-
7
- if ( ! current_user_can( 'manage_options' ) ) {
8
- return new WP_Error( 'wpsc_ajax_not_allowed_purchase_log_refund', __( 'Refund failed. (Incorrect Permissions)', 'wp-e-commerce' ) );
9
- }
10
-
11
- $order_id = absint( $_POST['order_id'] );
12
- $refund_reason = isset( $_POST['refund_reason'] ) ? sanitize_text_field( $_POST['refund_reason'] ) : '';
13
- $refund_amount = isset( $_POST['refund_amount'] ) ? sanitize_text_field( $_POST['refund_amount'] ) : false;
14
- $manual = $_POST['api_refund'] === 'true' ? false : true;
15
- $response_data = array();
16
-
17
- $log = wpsc_get_order( $order_id );
18
- $gateway_id = $log->get( 'gateway' );
19
- $gateway = wpsc_get_payment_gateway( $gateway_id );
20
-
21
- try {
22
- // Validate that the refund can occur
23
- $refund_amount = $refund_amount ? $refund_amount : $log->get( 'totalprice' );
24
-
25
- if ( wpsc_payment_gateway_supports( $gateway_id, 'refunds' ) ) {
26
- // Send api request to process refund. Returns Refund transaction ID
27
- $result = $gateway->process_refund( $log, $refund_amount, $refund_reason, $manual );
28
-
29
- do_action( 'wpsc_refund_processed', $log, $result, $refund_amount, $refund_reason );
30
-
31
- if ( is_wp_error( $result ) ) {
32
- return $result;
33
- }
34
-
35
- if ( ! $result ) {
36
- throw new Exception( __( 'Refund failed', 'wp-e-commerce' ) );
37
- }
38
- }
39
-
40
- if ( $log->get_remaining_refund() > 0 && $refund_amount != $log->get( 'totalprice' ) ) {
41
- /**
42
- * wpsc_order_partially_refunded.
43
- *
44
- * @since 3.11.5
45
- */
46
- do_action( 'wpsc_order_partially_refunded', $log );
47
- $response_data['status'] = 'partially_refunded';
48
-
49
- } else {
50
- /**
51
- * wpsc_order_fully_refunded.
52
- *
53
- * @since 3.11.5
54
- */
55
- do_action( 'wpsc_order_fully_refunded', $log );
56
- $response_data['status'] = 'fully_refunded';
57
- }
58
-
59
- return $response_data;
60
-
61
- } catch ( Exception $e ) {
62
- return new WP_Error( 'wpsc_ajax_purchase_log_refund_failed', $e->getMessage() );
63
- }
64
- }
65
-
66
- function _wpsc_ajax_purchase_log_capture_payment() {
67
- if ( ! isset( $_POST['order_id'] ) ) {
68
- return new WP_Error( 'wpsc_ajax_invalid_purchase_log_capture_payment', __( 'Capture failed.', 'wp-e-commerce' ) );
69
- }
70
-
71
- if ( ! wpsc_is_store_admin() ) {
72
- return new WP_Error( 'wpsc_ajax_not_allowed_purchase_log_capture_payment', __( 'Capture failed. (Incorrect Permissions)', 'wp-e-commerce' ) );
73
- }
74
-
75
- $order_id = absint( $_POST['order_id'] );
76
- $response_data = array();
77
-
78
- $log = wpsc_get_order( $order_id );
79
- $gateway_id = $log->get( 'gateway' );
80
- $gateway = wpsc_get_payment_gateway( $gateway_id );
81
-
82
- try {
83
-
84
- // Validate that the capture can occur
85
- if ( wpsc_payment_gateway_supports( $gateway_id, 'auth-capture' ) ) {
86
-
87
- if ( ! $log->is_order_received() ) {
88
- throw new Exception( __( 'Order must be in "Order Received" status to be captured.', 'wp-e-commerce' ) );
89
- }
90
-
91
- $transaction_id = $log->get( 'transactid' );
92
-
93
- if ( empty( $transaction_id ) ) {
94
- throw new Exception( __( 'Order must have a transaction ID to be captured.', 'wp-e-commerce' ) );
95
- }
96
-
97
- // Send api request to process capture. Returns capture transaction ID
98
- $result = $gateway->capture_payment( $log, $transaction_id );
99
-
100
- do_action( 'wpsc_payment_captured', $log, $result );
101
-
102
- if ( is_wp_error( $result ) ) {
103
- return $result;
104
- }
105
-
106
- if ( ! $result ) {
107
- throw new Exception( __( 'Capture failed', 'wp-e-commerce' ) );
108
- }
109
- }
110
-
111
- return $response_data;
112
-
113
- } catch ( Exception $e ) {
114
- return new WP_Error( 'wpsc_ajax_purchase_log_payment_capture_failed', $e->getMessage() );
115
- }
116
- }
117
-
118
- /**
119
- * Verify nonce of an AJAX request
120
- *
121
- * @since 3.8.9
122
- * @access private
123
- *
124
- * @uses WP_Error WordPress Error Class
125
- * @uses wp_verify_nonce() Verify that correct nonce was used with time limit.
126
- *
127
- * @param string $ajax_action Name of AJAX action
128
- * @return WP_Error|boolean True if nonce is valid. WP_Error if otherwise.
129
- */
130
- function _wpsc_ajax_verify_nonce( $ajax_action ) {
131
- // nonce can be passed with name wpsc_nonce or _wpnonce
132
- $nonce = '';
133
-
134
- if ( isset( $_REQUEST['nonce'] ) )
135
- $nonce = $_REQUEST['nonce'];
136
- elseif ( isset( $_REQUEST['_wpnonce'] ) )
137
- $nonce = $_REQUEST['_wpnonce'];
138
- else
139
- return _wpsc_error_invalid_nonce();
140
-
141
- // validate nonce
142
- if ( ! wp_verify_nonce( $nonce, 'wpsc_ajax_' . $ajax_action ) )
143
- return _wpsc_error_invalid_nonce();
144
-
145
- return true;
146
- }
147
-
148
- function _wpsc_error_invalid_nonce() {
149
- return new WP_Error( 'wpsc_ajax_invalid_nonce', __( 'Your session has expired. Please refresh the page and try again.', 'wp-e-commerce' ) );
150
- }
151
-
152
- /**
153
- * Verify AJAX callback and call it if it exists.
154
- *
155
- * @since 3.8.9
156
- * @access private
157
- *
158
- * @uses WP_Error WordPress Error object
159
- *
160
- * @param string $ajax_action Name of AJAX action
161
- * @return WP_Error|array Array of response args if callback is valid. WP_Error if otherwise.
162
- */
163
- function _wpsc_ajax_fire_callback( $ajax_action ) {
164
- // if callback exists, call it and output JSON response
165
- $callback = "_wpsc_ajax_{$ajax_action}";
166
-
167
- if ( is_callable( $callback ) )
168
- $result = call_user_func( $callback );
169
- else
170
- $result = new WP_Error( 'wpsc_invalid_ajax_callback', __( 'Invalid AJAX callback.', 'wp-e-commerce' ) );
171
-
172
- return $result;
173
- }
174
-
175
- /**
176
- * AJAX handler for all WPEC ajax requests.
177
- *
178
- * This function automates nonce checking and outputs JSON response.
179
- *
180
- * @since 3.8.9
181
- * @access private
182
- *
183
- * @uses _wpsc_ajax_fire_callback() Verify ajax callback if it exists
184
- * @uses _wpsc_ajax_verify_nonce() Verify nonce of an ajax request
185
- * @uses is_wp_error() Check whether variable is a WordPress Error.
186
- *
187
- * @return array $output json encoded response
188
- */
189
- function _wpsc_ajax_handler() {
190
- $ajax_action = str_replace( '-', '_', $_REQUEST['wpsc_action'] );
191
-
192
- if ( is_callable( '_wpsc_ajax_verify_' . $ajax_action ) ) {
193
- $result = call_user_func( '_wpsc_ajax_verify_' . $ajax_action );
194
- } else {
195
- $result = _wpsc_ajax_verify_nonce( $ajax_action );
196
- }
197
-
198
- if ( ! is_wp_error( $result ) ) {
199
- $result = _wpsc_ajax_fire_callback( $ajax_action );
200
- }
201
-
202
- $output = array(
203
- 'is_successful' => false,
204
- );
205
-
206
- if ( is_wp_error( $result ) ) {
207
- $output['error'] = array(
208
- 'code' => $result->get_error_code(),
209
- 'messages' => $result->get_error_messages(),
210
- 'data' => $result->get_error_data(),
211
- );
212
- } else {
213
- $output['is_successful'] = true;
214
- $output['obj'] = $result;
215
- }
216
-
217
- echo json_encode( $output );
218
- exit;
219
- }
220
- add_action( 'wp_ajax_wpsc_ajax', '_wpsc_ajax_handler' );
221
-
222
- /**
223
- * Checks if WPSC is doing ajax
224
- *
225
- * @param string $action req The action we're checking
226
- * @return bool True if doing ajax
227
- */
228
- function wpsc_is_doing_ajax( $action = '' ) {
229
- $ajax = defined( 'DOING_AJAX' ) && DOING_AJAX && ! empty( $_REQUEST['action'] ) && $_REQUEST['action'] == 'wpsc_ajax';
230
-
231
- if ( $action ) {
232
- $ajax = $ajax && ! empty( $_REQUEST['wpsc_action'] ) && $action == str_replace( '-', '_', $_REQUEST['wpsc_action'] );
233
- }
234
-
235
- return $ajax;
236
- }
237
-
238
- /**
239
- * Helper function that generates nonce for an AJAX action. Basically just a wrapper of
240
- * wp_create_nonce() but automatically add prefix.
241
- *
242
- * @since 3.8.9
243
- * @access private
244
- *
245
- * @uses wp_create_nonce() Creates a random one time use token
246
- *
247
- * @param string $action AJAX action without prefix
248
- * @return string The generated nonce.
249
- */
250
- function _wpsc_create_ajax_nonce( $ajax_action ) {
251
- return wp_create_nonce( "wpsc_ajax_{$ajax_action}" );
252
- }
253
-
254
- /**
255
- * Add new variation set via AJAX.
256
- *
257
- * If the variation set name is the same as an existing variation set,
258
- * the children variant terms will be added inside that existing set.
259
- *
260
- * @since 3.8.8
261
- * @access private
262
- *
263
- * @uses term_exists() Returns true if term exists
264
- * @uses get_term() Gets all term data by term_id
265
- * @uses wp_insert_term() Inserts a term to the WordPress database
266
- * @uses is_wp_error() Checks whether variable is a WordPress error
267
- * @uses WP_Error WordPress Error class
268
- * @uses clean_term_cache() Will remove all of the term ids from the cache.
269
- * @uses delete_option() Deletes option from the database
270
- * @uses wp_cache_set() Saves the data to the cache.
271
- * @uses _get_term_hierarchy() Retrieves children of taxonomy as Term IDs.
272
- * @uses wp_terms_checklist() Output an unordered list of checkbox <input> elements labelled
273
- * @uses WPSC_Walker_Variation_Checklist Walker variation checklist
274
- *
275
- * @return array Response args
276
- */
277
- function _wpsc_ajax_add_variation_set() {
278
- $new_variation_set = $_POST['variation_set'];
279
- $variants = preg_split( '/\s*,\s*/', $_POST['variants'] );
280
-
281
- $return = array();
282
-
283
- $parent_term_exists = term_exists( $new_variation_set, 'wpsc-variation' );
284
-
285
- // only use an existing parent ID if the term is not a child term
286
- if ( $parent_term_exists ) {
287
- $parent_term = get_term( $parent_term_exists['term_id'], 'wpsc-variation' );
288
- if ( $parent_term->parent == '0' )
289
- $variation_set_id = $parent_term_exists['term_id'];
290
- }
291
-
292
- if ( empty( $variation_set_id ) ) {
293
- $results = wp_insert_term( apply_filters( 'wpsc_new_variation_set', $new_variation_set ), 'wpsc-variation' );
294
- if ( is_wp_error( $results ) )
295
- return $results;
296
- $variation_set_id = $results['term_id'];
297
- }
298
-
299
- if ( empty( $variation_set_id ) )
300
- return new WP_Error( 'wpsc_invalid_variation_id', __( 'Cannot retrieve the variation set in order to proceed.', 'wp-e-commerce' ) );
301
-
302
- foreach ( $variants as $variant ) {
303
- $results = wp_insert_term( apply_filters( 'wpsc_new_variant', $variant, $variation_set_id ), 'wpsc-variation', array( 'parent' => $variation_set_id ) );
304
-
305
- if ( is_wp_error( $results ) )
306
- return $results;
307
-
308
- $inserted_variants[] = $results['term_id'];
309
- }
310
-
311
- require_once( 'includes/walker-variation-checklist.php' );
312
-
313
- if ( ! version_compare( $GLOBALS['wp_version'], '3.8.3', '>' ) ) {
314
-
315
- /* --- DIRTY HACK START --- */
316
- /*
317
- There's a bug with term cache in WordPress core. See http://core.trac.wordpress.org/ticket/14485. Fixed in 3.9.
318
- The next 3 lines will delete children term cache for wpsc-variation.
319
- Without this hack, the new child variations won't be displayed on "Variations" page and
320
- also won't be displayed in wp_terms_checklist() call below.
321
- */
322
- clean_term_cache( $variation_set_id, 'wpsc-variation' );
323
- delete_option('wpsc-variation_children');
324
- wp_cache_set( 'last_changed', 1, 'terms' );
325
- _get_term_hierarchy('wpsc-variation');
326
- /* --- DIRTY HACK END --- */
327
-
328
- }
329
-
330
- ob_start();
331
-
332
- wp_terms_checklist( (int) $_POST['post_id'], array(
333
- 'taxonomy' => 'wpsc-variation',
334
- 'descendants_and_self' => $variation_set_id,
335
- 'walker' => new WPSC_Walker_Variation_Checklist( $inserted_variants ),
336
- 'checked_ontop' => false,
337
- ) );
338
-
339
- $content = ob_get_clean();
340
-
341
- $return = array(
342
- 'variation_set_id' => $variation_set_id,
343
- 'inserted_variants' => $inserted_variants,
344
- 'content' => $content,
345
- );
346
-
347
- return $return;
348
- }
349
-
350
- /**
351
- * Display gateway settings form via AJAX
352
- *
353
- * @since 3.8.9
354
- * @access private
355
- *
356
- * @uses WPSC_Settings_Tab_Gateway
357
- * @uses WPSC_Settings_Tab_Gateway::display_payment_gateway_settings_form() Displays payment gateway form
358
- *
359
- * @return array Response args
360
- */
361
- function _wpsc_ajax_payment_gateway_settings_form() {
362
-
363
- require_once( 'settings-page.php' );
364
- require_once( 'includes/settings-tabs/gateway.php' );
365
-
366
- $return = array();
367
- ob_start();
368
- $tab = new WPSC_Settings_Tab_Gateway();
369
- $tab->display_payment_gateway_settings_form();
370
- $return['content'] = ob_get_clean();
371
-
372
- return $return;
373
- }
374
-
375
- /**
376
- * Display shipping module settings form via AJAX
377
- *
378
- * @since 3.8.9
379
- * @access private
380
- *
381
- * @uses WPSC_Settings_Table_Shipping
382
- * @uses WPSC_Settings_Table_Shipping::display_shipping_module_settings_form() Displays shipping module form
383
- *
384
- * @return array $return Response args
385
- */
386
- function _wpsc_ajax_shipping_module_settings_form() {
387
- require_once( 'settings-page.php' );
388
- require_once( 'includes/settings-tabs/shipping.php' );
389
-
390
- $return = array();
391
- ob_start();
392
- $tab = new WPSC_Settings_Tab_Shipping();
393
- $tab->display_shipping_module_settings_form();
394
- $return['content'] = ob_get_clean();
395
-
396
- return $return;
397
- }
398
-
399
- /**
400
- * Display settings tab via AJAX
401
- *
402
- * @since 3.8.9
403
- * @access private
404
- *
405
- * @uses WPSC_Settings_Page
406
- * @uses WPSC_Settings_Page::display_current_tab() Shows current tab of settings page
407
- *
408
- * @return array $return Response args
409
- */
410
- function _wpsc_ajax_navigate_settings_tab() {
411
- require_once( 'settings-page.php' );
412
-
413
- $return = array();
414
- ob_start();
415
- $settings_page = new WPSC_Settings_Page( $_POST['tab'] );
416
- $settings_page->display_current_tab();
417
- $return['content'] = ob_get_clean();
418
-
419
- return $return;
420
- }
421
-
422
- /**
423
- * Display base region list in Store Settings -> General
424
- *
425
- * @since 3.8.9
426
- * @access private
427
- *
428
- * @uses WPSC_Settings_Tab_General
429
- * @uses WPSC_Settings_Tab_General::display_region_drop_down() Shows region dropdown
430
- *
431
- * @return array $return Response args
432
- */
433
- function _wpsc_ajax_display_region_list() {
434
- require_once( 'settings-page.php' );
435
- require_once( 'includes/settings-tabs/general.php' );
436
-
437
- $return = array();
438
- ob_start();
439
- $tab = new WPSC_Settings_Tab_General();
440
- $tab->display_region_drop_down();
441
- $return['content'] = ob_get_clean();
442
-
443
- return $return;
444
- }
445
-
446
- /**
447
- * Save tracking ID of a sales log.
448
- *
449
- * @since 3.8.9
450
- * @access private
451
- *
452
- * @uses WP_Error WordPress Error class
453
- *
454
- * @return array|WP_Error $return Response args if successful, WP_Error if otherwise.
455
- */
456
- function _wpsc_ajax_purchase_log_save_tracking_id() {
457
- global $wpdb;
458
-
459
- $result = $wpdb->update(
460
- WPSC_TABLE_PURCHASE_LOGS,
461
- array(
462
- 'track_id' => $_POST['value']
463
- ),
464
- array(
465
- 'id' => $_POST['log_id']
466
- ),
467
- '%s',
468
- '%d'
469
- );
470
-
471
- if ( ! $result )
472
- return new WP_Error( 'wpsc_cannot_save_tracking_id', __( "Couldn't save tracking ID of the transaction. Please try again.", 'wp-e-commerce' ) );
473
-
474
- $return = array(
475
- 'rows_affected' => $result,
476
- 'id' => $_POST['log_id'],
477
- 'track_id' => $_POST['value'],
478
- );
479
-
480
- return $return;
481
- }
482
-
483
- /**
484
- * Send sales log tracking email via AJAX
485
- *
486
- * @since 3.8.9
487
- * @access private
488
- *
489
- * @uses $wpdb WordPress database object for queries
490
- * @uses get_option() Gets option from DB given key
491
- * @uses add_filter() Calls 'wp_mail_from' which can replace the from email address
492
- * @uses add_filter() Calls 'wp_mail_from_name' allows replacement of the from name on WordPress emails
493
- * @uses wp_mail() All the emailses in WordPress are sent through this function
494
- * @uses WP_Error WordPress Error class
495
- *
496
- * @return array|WP_Error $return Response args if successful, WP_Error if otherwise
497
- */
498
- function _wpsc_ajax_purchase_log_send_tracking_email() {
499
- global $wpdb;
500
-
501
- $id = absint( $_POST['log_id'] );
502
- $sql = $wpdb->prepare( "SELECT `track_id` FROM " . WPSC_TABLE_PURCHASE_LOGS . " WHERE `id`=%d LIMIT 1", $id );
503
- $trackingid = $wpdb->get_var( $sql );
504
-
505
- $message = get_option( 'wpsc_trackingid_message' );
506
- $message = str_replace( '%trackid%', $trackingid, $message );
507
- $message = str_replace( '%shop_name%', get_option( 'blogname' ), $message );
508
-
509
- $email = wpsc_get_buyers_email( $id );
510
-
511
- $subject = get_option( 'wpsc_trackingid_subject' );
512
- $subject = str_replace( '%shop_name%', get_option( 'blogname' ), $subject );
513
-
514
- add_filter( 'wp_mail_from', 'wpsc_replace_reply_address', 0 );
515
- add_filter( 'wp_mail_from_name', 'wpsc_replace_reply_name', 0 );
516
-
517
- $result = wp_mail( $email, $subject, $message);
518
-
519
- if ( ! $result ) {
520
- return new WP_Error( 'wpsc_cannot_send_tracking_email', __( "Couldn't send tracking email. Please try again.", 'wp-e-commerce' ) );
521
- }
522
-
523
- $return = array(
524
- 'id' => $id,
525
- 'tracking_id' => $trackingid,
526
- 'subject' => $subject,
527
- 'message' => $message,
528
- 'email' => $email
529
- );
530
-
531
- return $return;
532
- }
533
-
534
- /**
535
- * Do purchase log action link via AJAX
536
- *
537
- * @since 3.9.0
538
- * @access private
539
- *
540
- * @return array|WP_Error $return Response args if successful, WP_Error if otherwise
541
- */
542
- function _wpsc_ajax_purchase_log_action_link() {
543
-
544
- if ( isset( $_POST['log_id'] ) && isset( $_POST['purchase_log_action_link'] ) && isset( $_POST['purchase_log_action_nonce'] ) ) {
545
-
546
- $log_id = absint( $_POST['log_id'] );
547
- $purchase_log_action_link = sanitize_key( $_POST['purchase_log_action_link'] );
548
-
549
- // Verify action nonce
550
- if ( wp_verify_nonce( $_POST['purchase_log_action_nonce'], 'wpsc_purchase_log_action_ajax_' . $purchase_log_action_link ) ) {
551
-
552
- // Expected to receive success = true by default, or false on error.
553
- $return = apply_filters( 'wpsc_purchase_log_action_ajax-' . $purchase_log_action_link, array( 'success' => null ), $log_id );
554
-
555
- } else {
556
- $return = _wpsc_error_invalid_nonce();
557
- }
558
-
559
- if ( ! is_wp_error( $return ) ) {
560
- $return['log_id'] = $log_id;
561
- $return['purchase_log_action_link'] = $purchase_log_action_link;
562
- $return['success'] = isset( $return['success'] ) ? (bool) $return['success'] : null;
563
- }
564
-
565
- return $return;
566
-
567
- }
568
-
569
- return new WP_Error( 'wpsc_ajax_invalid_purchase_log_action', __( 'Purchase log action failed.', 'wp-e-commerce' ) );
570
-
571
- }
572
-
573
- /**
574
- * Remove purchase log item.
575
- *
576
- * @since 3.11.5
577
- * @access private
578
- *
579
- * @return array|WP_Error $return Response args if successful, WP_Error if otherwise
580
- */
581
- function _wpsc_ajax_remove_log_item() {
582
-
583
- if ( isset( $_POST['item_id'], $_POST['log_id'] ) ) {
584
-
585
- $item_id = absint( $_POST['item_id'] );
586
- $log_id = absint( $_POST['log_id'] );
587
- $log = wpsc_get_order( $log_id );
588
-
589
- if ( $log->remove_item( $item_id ) ) {
590
- return _wpsc_init_log_items( $log );
591
- }
592
- }
593
-
594
- return new WP_Error( 'wpsc_ajax_invalid_remove_log_item', __( 'Removing log item failed.', 'wp-e-commerce' ) );
595
- }
596
-
597
- /**
598
- * Update purchase log item quantity.
599
- *
600
- * @since 3.11.5
601
- * @access private
602
- *
603
- * @return array|WP_Error $return Response args if successful, WP_Error if otherwise
604
- */
605
- function _wpsc_ajax_update_log_item_qty() {
606
-
607
- if ( isset( $_POST['item_id'], $_POST['log_id'], $_POST['qty'] ) ) {
608
-
609
- if ( empty( $_POST['qty'] ) ) {
610
- return _wpsc_ajax_remove_log_item();
611
- }
612
-
613
- $item_id = absint( $_POST['item_id'] );
614
- $log_id = absint( $_POST['log_id'] );
615
- $log = wpsc_get_order( $log_id );
616
- $result = $log->update_item( $item_id, array( 'quantity' => absint( $_POST['qty'] ) ) );
617
-
618
- if ( 0 === $result ) {
619
- return true;
620
- } elseif ( false !== $result ) {
621
- return _wpsc_init_log_items( $log );
622
- }
623
- }
624
-
625
- return new WP_Error( 'wpsc_ajax_invalid_update_log_item_qty', __( 'Updating log item quantity failed.', 'wp-e-commerce' ) );
626
- }
627
-
628
- /**
629
- * Add purchase log item.
630
- *
631
- * @since 3.11.5
632
- * @access private
633
- *
634
- * @return array|WP_Error $return Response args if successful, WP_Error if otherwise
635
- */
636
- function _wpsc_ajax_add_log_item() {
637
- global $wpsc_cart;
638
-
639
- if (
640
- isset( $_POST['product_ids'], $_POST['log_id'] )
641
- && is_array( $_POST['product_ids'] )
642
- && ! empty( $_POST['product_ids'] )
643
- ) {
644
-
645
- $existing = isset( $_POST['existing'] ) && is_array( $_POST['existing'] )
646
- ? array_map( 'absint', $_POST['existing'] )
647
- : false;
648
-
649
- $item_ids = array();
650
- $log = null;
651
-
652
- foreach ( $_POST['product_ids'] as $product_id ) {
653
- $product_id = absint( $product_id );
654
- $log_id = absint( $_POST['log_id'] );
655
- $log = wpsc_get_order( $log_id );
656
-
657
- // Is product is already in item list?
658
- if ( $existing && in_array( $product_id, $existing, true ) ) {
659
- $item = $log->get_item_from_product_id( $product_id );
660
- if ( $item ) {
661
- // Update item quantity...
662
- $log->update_item( $item->id, array( 'quantity' => ++$item->quantity ) );
663
- // And move on.
664
- continue;
665
- }
666
- }
667
-
668
- $item = new wpsc_cart_item( $product_id, array(), $wpsc_cart );
669
- $item_id = $item->save_to_db( $log_id );
670
- $item_ids[] = absint( $item_id );
671
- }
672
-
673
- return _wpsc_init_log_items( $log, $item_ids );
674
- }
675
-
676
- return new WP_Error( 'wpsc_ajax_invalid_add_log_item', __( 'Adding log item failed.', 'wp-e-commerce' ) );
677
- }
678
-
679
- function _wpsc_init_log_items( WPSC_Purchase_Log $log, $item_ids = array() ) {
680
- $log->init_items();
681
-
682
- require_once( WPSC_FILE_PATH . '/wpsc-admin/display-sales-logs.php' );
683
-
684
- $html = '';
685
- $htmls = array();
686
- $htmls[] = array();
687
-
688
- while ( wpsc_have_purchaselog_details() ) {
689
- wpsc_the_purchaselog_item();
690
-
691
- ob_start();
692
- WPSC_Purchase_Log_Page::purchase_log_cart_item( $log->can_edit() );
693
- $cart_item = ob_get_clean();
694
-
695
- $htmls[ wpsc_purchaselog_details_id() ] = $cart_item;
696
- if ( ! empty( $item_ids ) && in_array( absint( wpsc_purchaselog_details_id() ), $item_ids, true ) ) {
697
- $html .= $cart_item;
698
- }
699
- }
700
-
701
- return array(
702
- 'quantities' => wp_list_pluck( $log->get_items(), 'quantity', 'id' ),
703
- 'html' => $html,
704
- 'htmls' => $htmls,
705
- 'discount_data' => wpsc_purchlog_has_discount_data() ? esc_html__( 'Coupon Code', 'wp-e-commerce' ) . ': ' . wpsc_display_purchlog_discount_data() : '',
706
- 'discount' => wpsc_display_purchlog_discount(),
707
- 'total_taxes' => wpsc_display_purchlog_taxes(),
708
- 'total_shipping' => wpsc_display_purchlog_shipping( false, true ),
709
- 'final_total' => wpsc_display_purchlog_totalprice(),
710
- );
711
- }
712
-
713
- /**
714
- * Edit log contact details.
715
- *
716
- * @since 3.11.5
717
- * @access private
718
- *
719
- * @return array|WP_Error $return Response args if successful, WP_Error if otherwise
720
- */
721
- function _wpsc_ajax_edit_contact_details() {
722
-
723
- if ( isset( $_POST['log_id'], $_POST['fields'] ) && ! empty( $_POST['fields'] ) ) {
724
-
725
- // Parse the URL query string of the fields array.
726
- parse_str( $_POST['fields'], $fields );
727
-
728
- $log_id = absint( $_POST['log_id'] );
729
- $log = wpsc_get_order( $log_id );
730
-
731
- if ( isset( $fields['wpsc_checkout_details'] ) && is_array( $fields['wpsc_checkout_details'] ) ) {
732
- $details = wp_unslash( $fields['wpsc_checkout_details'] );
733
-
734
- // Save the new/updated contact details.
735
- WPSC_Checkout_Form_Data::save_form(
736
- $log,
737
- WPSC_Checkout_Form::get()->get_fields(),
738
- array_map( 'sanitize_text_field', $details ),
739
- false
740
- );
741
-
742
- require_once( WPSC_FILE_PATH . '/wpsc-admin/display-sales-logs.php' );
743
-
744
- $log->init_items();
745
-
746
- // Fetch the shipping/billing formatted output.
747
-
748
- ob_start();
749
- WPSC_Purchase_Log_Page::shipping_address_output();
750
- $shipping = ob_get_clean();
751
-
752
- ob_start();
753
- WPSC_Purchase_Log_Page::billing_address_output();
754
- $billing = ob_get_clean();
755
-
756
- ob_start();
757
- WPSC_Purchase_Log_Page::payment_details_output();
758
- $payment = ob_get_clean();
759
-
760
- return compact( 'shipping', 'billing', 'payment' );
761
-
762
- }
763
-
764
- }
765
-
766
- return new WP_Error( 'wpsc_ajax_invalid_edit_contact_details', __( 'Failed to update contact details for log.', 'wp-e-commerce' ) );
767
- }
768
-
769
- /**
770
- * Add a note to a log.
771
- *
772
- * @since 3.11.5
773
- * @access private
774
- *
775
- * @return array|WP_Error $return Response args if successful, WP_Error if otherwise
776
- */
777
- function _wpsc_ajax_add_note() {
778
-
779
- if ( isset( $_POST['log_id'], $_POST['note'] ) && ! empty( $_POST['note'] ) ) {
780
-
781
- $result = wpsc_purchlogs_update_notes(
782
- absint( $_POST['log_id'] ),
783
- wp_kses_post( wp_unslash( $_POST['note'] ) )
784
- );
785
-
786
- if ( $result instanceof WPSC_Purchase_Log_Notes ) {
787
- require_once( WPSC_FILE_PATH . '/wpsc-admin/display-sales-logs.php' );
788
-
789
- $data = $result->get_data();
790
- $keys = array_keys( $data );
791
- $note_id = end( $keys );
792
- $note_args = end( $data );
793
-
794
- ob_start();
795
- WPSC_Purchase_Log_Page::note_output( $result, $note_id, $note_args );
796
- $row = ob_get_clean();
797
-
798
- return $row;
799
- }
800
- }
801
-
802
- return new WP_Error( 'wpsc_ajax_invalid_add_note', __( 'Failed adding log note.', 'wp-e-commerce' ) );
803
- }
804
-
805
- /**
806
- * Delete a note from a log.
807
- *
808
- * @since 3.11.5
809
- * @access private
810
- *
811
- * @return array|WP_Error $return Response args if successful, WP_Error if otherwise
812
- */
813
- function _wpsc_ajax_delete_note() {
814
-
815
- if ( isset( $_POST['log_id'], $_POST['note'] ) && is_numeric( $_POST['note'] ) ) {
816
-
817
- $notes = wpsc_get_order_notes( absint( $_POST['log_id'] ) );
818
- $notes->remove( absint( $_POST['note'] ) )->save();
819
-
820
- return true;
821
- }
822
-
823
- return new WP_Error( 'wpsc_ajax_invalid_delete_note', __( 'Failed to delete log note.', 'wp-e-commerce' ) );
824
- }
825
-
826
- /**
827
- * Search for products.
828
- *
829
- * @since 3.11.5
830
- * @access private
831
- *
832
- * @return array|WP_Error $return Response args if successful, WP_Error if otherwise
833
- */
834
- function _wpsc_ajax_search_products() {
835
- $pt_object = get_post_type_object( 'wpsc-product' );
836
-
837
- $s = wp_unslash( $_POST['search'] );
838
- $args = array(
839
- 'post_type' => 'wpsc-product',
840
- 'post_status' => array( 'publish', 'inherit' ),
841
- 'posts_per_page' => 50,
842
- );
843
- if ( '' !== $s ) {
844
- $args['s'] = $s;
845
- }
846
-
847
- $posts = get_posts( $args );
848
-
849
- if ( ! $posts ) {
850
- return new WP_Error( 'wpsc_ajax_invalid_search_products', __( 'No items found.', 'wp-e-commerce' ) );
851
- }
852
-
853
- $alt = '';
854
- foreach ( $posts as $post ) {
855
- $post->title = trim( $post->post_title ) ? $post->post_title : __( '(no title)' );
856
- $alt = ( 'alternate' === $alt ) ? '' : 'alternate';
857
-
858
- $post->status = $post->post_status;
859
-
860
- switch ( $post->post_status ) {
861
- case 'publish' :
862
- case 'private' :
863
- $post->status = __( 'Published' );
864
- break;
865
- case 'future' :
866
- $post->status = __( 'Scheduled' );
867
- break;
868
- case 'pending' :
869
- $post->status = __( 'Pending Review' );
870
- break;
871
- case 'draft' :
872
- $post->status = __( 'Draft' );
873
- break;
874
- default :
875
- $post->status = $post->post_status;
876
- break;
877
- }
878
-
879
- if ( '0000-00-00 00:00:00' === $post->post_date ) {
880
- $post->time = '';
881
- } else {
882
- /* translators: date format in table columns, see https://secure.php.net/date */
883
- $post->time = mysql2date( __( 'Y/m/d' ), $post->post_date );
884
- }
885
-
886
- $post->class = $alt;
887
- }
888
-
889
- return $posts;
890
- }
891
-
892
- /**
893
- * Handle AJAX clear downloads lock purchase log action
894
- *
895
- * The _wpsc_ajax_purchase_log_action_link() function which triggers this function is nonce
896
- * and capability checked in _wpsc_ajax_handler().
897
- *
898
- * @since 3.9.0
899
- * @access private
900
- *
901
- * @param array $response AJAX response.
902
- * @param int $log_id Purchase log ID.
903
- */
904
- function wpsc_purchase_log_action_ajax_downloads_lock( $response, $log_id ) {
905
-
906
- $response['success'] = wpsc_purchlog_clear_download_items( $log_id );
907
-
908
- return $response;
909
-
910
- }
911
- add_action( 'wpsc_purchase_log_action_ajax-downloads_lock', 'wpsc_purchase_log_action_ajax_downloads_lock', 10, 2 );
912
-
913
-
914
- /**
915
- * Handle AJAX email receipt purchase log action
916
- *
917
- * The _wpsc_ajax_purchase_log_action_link() function which triggers this function is nonce
918
- * and capability checked in _wpsc_ajax_handler().
919
- *
920
- * @since 3.9.0
921
- * @access private
922
- *
923
- * @param array $response AJAX response.
924
- * @param int $log_id Purchase log ID.
925
- */
926
- function wpsc_purchase_log_action_ajax_email_receipt( $response, $log_id ) {
927
-
928
- $response['success'] = wpsc_purchlog_resend_email( $log_id );
929
-
930
- return $response;
931
-
932
- }
933
- add_action( 'wpsc_purchase_log_action_ajax-email_receipt', 'wpsc_purchase_log_action_ajax_email_receipt', 10, 2 );
934
-
935
- /**
936
- * Delete an attached downloadable file via AJAX.
937
- *
938
- * @since 3.8.9
939
- * @access private
940
- *
941
- * @uses _wpsc_delete_file() Deletes files associated with a product
942
- * @uses WP_Error WordPress error class
943
- *
944
- * @return WP_Error|array $return Response args if successful, WP_Error if otherwise
945
- */
946
- function _wpsc_ajax_delete_file() {
947
- $product_id = absint( $_REQUEST['product_id'] );
948
- $file_name = basename( $_REQUEST['file_name'] );
949
-
950
- $result = _wpsc_delete_file( $product_id, $file_name );
951
-
952
- if ( ! $result )
953
- return new WP_Error( 'wpsc_cannot_delete_file', __( "Couldn't delete the file. Please try again.", 'wp-e-commerce' ) );
954
-
955
- $return = array(
956
- 'product_id' => $product_id,
957
- 'file_name' => $file_name,
958
- );
959
-
960
- return $return;
961
- }
962
-
963
- /**
964
- * Delete a product meta via AJAX
965
- *
966
- * @since 3.8.9
967
- * @access private
968
- *
969
- * @uses delete_meta() Deletes metadata by meta id
970
- * @uses WP_Error WordPress error class
971
- *
972
- * @return WP_Error|array $return Response args if successful, WP_Error if otherwise
973
- */
974
- function _wpsc_ajax_remove_product_meta() {
975
- $meta_id = (int) $_POST['meta_id'];
976
- if ( ! delete_meta( $meta_id ) )
977
- return new WP_Error( 'wpsc_cannot_delete_product_meta', __( "Couldn't delete product meta. Please try again.", 'wp-e-commerce' ) );
978
-
979
- return array( 'meta_id' => $meta_id );
980
- }
981
-
982
- /**
983
- * Modify a purchase log's status.
984
- *
985
- * @since 3.8.9
986
- * @access private
987
- *
988
- * @uses wpsc_purchlog_edit_status() Edits purchase log status
989
- * @uses WP_Error WordPress Error class
990
- * @uses WPSC_Purchase_Log_List_Table
991
- * @uses WPSC_Purchase_Log_List_Table::prepare_items()
992
- * @uses WPSC_Purchase_Log_List_Table::views()
993
- * @uses WPSC_Purchase_Log_List_Table::display_tablenav() @todo docs
994
- *
995
- * @return WP_Error|array $return Response args if successful, WP_Error if otherwise.
996
- */
997
- function _wpsc_ajax_change_purchase_log_status() {
998
- $result = wpsc_purchlog_edit_status( $_POST['id'], $_POST['new_status'] );
999
- if ( ! $result )
1000
- return new WP_Error( 'wpsc_cannot_edit_purchase_log_status', __( "Couldn't modify purchase log's status. Please try again.", 'wp-e-commerce' ) );
1001
-
1002
- $args = array();
1003
-
1004
- $args['screen'] = 'dashboard_page_wpsc-sales-logs';
1005
-
1006
- require_once( WPSC_FILE_PATH . '/wpsc-admin/includes/purchase-log-list-table-class.php' );
1007
- $purchaselog_table = new WPSC_Purchase_Log_List_Table( $args );
1008
- $purchaselog_table->prepare_items();
1009
-
1010
- ob_start();
1011
- $purchaselog_table->views();
1012
- $views = ob_get_clean();
1013
-
1014
- ob_start();
1015
- $purchaselog_table->display_tablenav( 'top' );
1016
- $tablenav_top = ob_get_clean();
1017
-
1018
- ob_start();
1019
- $purchaselog_table->display_tablenav( 'bottom' );
1020
- $tablenav_bottom = ob_get_clean();
1021
-
1022
- $return = array(
1023
- 'id' => $_POST['id'],
1024
- 'new_status' => $_POST['new_status'],
1025
- 'views' => $views,
1026
- 'tablenav_top' => $tablenav_top,
1027
- 'tablenav_bottom' => $tablenav_bottom,
1028
- );
1029
-
1030
- return $return;
1031
- }
1032
-
1033
- /**
1034
- * Save product ordering after drag-and-drop sorting
1035
- *
1036
- * @since 3.8.9
1037
- * @access private
1038
- *
1039
- * @uses $wpdb WordPress database object for use in queries
1040
- * @uses wp_update_post() Updates post based on passed $args. Needs a post_id
1041
- * @uses WP_Error WordPress Error class
1042
- *
1043
- * @return WP_Error|array Response args if successful, WP_Error if otherwise
1044
- */
1045
- function _wpsc_ajax_save_product_order() {
1046
-
1047
- $products = array( );
1048
- foreach ( $_POST['post'] as $product ) {
1049
- $products[] = (int) str_replace( 'post-', '', $product );
1050
- }
1051
-
1052
- $failed = array();
1053
- foreach ( $products as $order => $product_id ) {
1054
- $result = wp_update_post( array(
1055
- 'ID' => $product_id,
1056
- 'menu_order' => $order,
1057
- ) );
1058
-
1059
- if ( ! $result )
1060
- $failed[] = $product_id;
1061
- }
1062
-
1063
- // Validate data before exposing to action
1064
- $category = isset( $_POST['category_id'] ) ? get_term_by( 'slug', $_POST['category_id'], 'wpsc_product_category' ) : false;
1065
- do_action( 'wpsc_save_product_order', $products, $category );
1066
-
1067
- if ( ! empty( $failed ) ) {
1068
- $error_data = array(
1069
- 'failed_ids' => $failed,
1070
- );
1071
-
1072
- return new WP_Error( 'wpsc_cannot_save_product_sort_order', __( "Couldn't save the products' sort order. Please try again.", 'wp-e-commerce' ), $error_data );
1073
- }
1074
-
1075
- return array(
1076
- 'ids' => $products,
1077
- );
1078
- }
1079
-
1080
- /**
1081
- * Save Category Product Order
1082
- *
1083
- * Note that this uses the 'term_order' field in the 'term_relationships' table to store
1084
- * the order. Although this column presently seems to be unused by WordPress, the intention
1085
- * is it should be used to store the order of terms associates to a post, not the order
1086
- * of posts as we are doing. This shouldn't be an issue for WPEC unless WordPress adds a UI
1087
- * for this. More info at http://core.trac.wordpress.org/ticket/9547
1088
- *
1089
- * @since 3.9
1090
- * @access private
1091
- *
1092
- * @uses $wpdb WordPress database object used for queries
1093
- */
1094
- function _wpsc_save_category_product_order( $products, $category ) {
1095
- global $wpdb;
1096
-
1097
- // Only save category product order if in category
1098
- if ( ! $category )
1099
- return;
1100
-
1101
- // Save product order in term_relationships table
1102
- foreach ( $products as $order => $product_id ) {
1103
- $wpdb->update( $wpdb->term_relationships,
1104
- array( 'term_order' => $order ),
1105
- array( 'object_id' => $product_id, 'term_taxonomy_id' => $category->term_taxonomy_id ),
1106
- array( '%d' ),
1107
- array( '%d', '%d' )
1108
- );
1109
- }
1110
- }
1111
- add_action( 'wpsc_save_product_order', '_wpsc_save_category_product_order', 10, 2 );
1112
-
1113
- /**
1114
- * Update Checkout fields order
1115
- *
1116
- * @since 3.8.9
1117
- * @access private
1118
- *
1119
- * @uses $wpdb WordPress database object used for queries
1120
- * @uses WP_Error WordPress error class
1121
- *
1122
- * @return array|WP_Error Response args or WP_Error
1123
- */
1124
- function _wpsc_ajax_update_checkout_fields_order() {
1125
- global $wpdb;
1126
-
1127
- $checkout_fields = $_REQUEST['sort_order'];
1128
- $order = 1;
1129
- $failed = array();
1130
- $modified = array();
1131
- foreach ( $checkout_fields as &$checkout_field ) {
1132
- // ignore new fields
1133
- if ( strpos( $checkout_field, 'new-field' ) === 0 )
1134
- continue;
1135
- $checkout_field = absint( preg_replace('/[^0-9]+/', '', $checkout_field ) );
1136
- $result = $wpdb->update(
1137
- WPSC_TABLE_CHECKOUT_FORMS,
1138
- array(
1139
- 'checkout_order' => $order
1140
- ),
1141
- array(
1142
- 'id' => $checkout_field
1143
- ),
1144
- '%d',
1145
- '%d'
1146
- );
1147
- $order ++;
1148
- if ( $result === false )
1149
- $failed[] = $checkout_field;
1150
- elseif ( $result > 0 )
1151
- $modified[] = $checkout_field;
1152
- }
1153
-
1154
- if ( ! empty( $failed ) )
1155
- return new WP_Error( 'wpsc_cannot_save_checkout_field_sort_order', __( "Couldn't save checkout field sort order. Please try again.", 'wp-e-commerce' ), array( 'failed_ids' => $failed ) );
1156
-
1157
- return array(
1158
- 'modified' => $modified,
1159
- );
1160
- }
1161
-
1162
- /**
1163
- * Save a downloadable file to a product
1164
- *
1165
- * @since 3.8.9
1166
- * @access private
1167
- *
1168
- * @uses $wpdb WordPress database object for use in queries
1169
- * @uses _wpsc_create_ajax_nonce() Creates nonce for an ajax action
1170
- * @uses wpsc_get_mimetype() Returns mimetype of file
1171
- * @uses wp_insert_post() Inserts post to WordPress database
1172
- * @uses wp_nonce_url() Retrieve URL with nonce added to URL query.
1173
- * @uses wpsc_convert_bytes() Formats bytes
1174
- * @uses wpsc_get_extension() Gets extension of file
1175
- * @uses esc_attr() Escapes HTML attributes
1176
- * @uses _x() Retrieve translated string with gettext context
1177
- *
1178
- * @return array|WP_Error Response args if successful, WP_Error if otherwise.
1179
- */
1180
- function _wpsc_ajax_upload_product_file() {
1181
- global $wpdb;
1182
- $product_id = absint( $_POST["product_id"] );
1183
- $output = '';
1184
- $delete_nonce = _wpsc_create_ajax_nonce( 'delete_file' );
1185
-
1186
- foreach ( $_POST["select_product_file"] as $selected_file ) {
1187
- // if we already use this file, there is no point doing anything more.
1188
- $sql = $wpdb->prepare( "SELECT * FROM $wpdb->posts WHERE post_type = 'wpsc-product-file' AND post_title = %s", $selected_file ); // TODO it's safer to select by post ID, in that case we will use get_posts()
1189
- $file_post_data = $wpdb->get_row( $sql, ARRAY_A );
1190
- $selected_file_path = WPSC_FILE_DIR . basename( $selected_file );
1191
- $file_url = WPSC_FILE_URL . basename( $selected_file );
1192
- $file_size = filesize( $selected_file_path );
1193
- if ( empty( $file_post_data ) ) {
1194
- $type = wpsc_get_mimetype( $selected_file_path );
1195
- $attachment = array(
1196
- 'post_mime_type' => $type,
1197
- 'post_parent' => $product_id,
1198
- 'post_title' => $selected_file,
1199
- 'post_content' => '',
1200
- 'post_type' => "wpsc-product-file",
1201
- 'post_status' => 'inherit'
1202
- );
1203
- $id = wp_insert_post( $attachment );
1204
- } else {
1205
- // already attached
1206
- if ( $file_post_data['post_parent'] == $product_id )
1207
- continue;
1208
- $type = $file_post_data["post_mime_type"];
1209
- $url = $file_post_data["guid"];
1210
- $title = $file_post_data["post_title"];
1211
- $content = $file_post_data["post_content"];
1212
- // Construct the attachment
1213
- $attachment = array(
1214
- 'post_mime_type' => $type,
1215
- 'guid' => $url,
1216
- 'post_parent' => absint( $product_id ),
1217
- 'post_title' => $title,
1218
- 'post_content' => $content,
1219
- 'post_type' => "wpsc-product-file",
1220
- 'post_status' => 'inherit'
1221
- );
1222
- // Save the data
1223
- $id = wp_insert_post( $attachment );
1224
- }
1225
-
1226
- $deletion_url = wp_nonce_url( "admin.php?wpsc_admin_action=delete_file&amp;file_name={$attachment['post_title']}&amp;product_id={$product_id}", 'delete_file_' . $attachment['post_title'] );
1227
-
1228
- $output .= '<tr class="wpsc_product_download_row">';
1229
- $output .= '<td style="padding-right: 30px;">' . $attachment['post_title'] . '</td>';
1230
- $output .= '<td>' . wpsc_convert_byte( $file_size ) . '</td>';
1231
- $output .= '<td>.' . wpsc_get_extension( $attachment['post_title'] ) . '</td>';
1232
- $output .= "<td><a data-file-name='" . esc_attr( $attachment['post_title'] ) . "' data-product-id='" . esc_attr( $product_id ) . "' data-nonce='" . esc_attr( $delete_nonce ) . "' class='file_delete_button' href='{$deletion_url}' >" . _x( 'Delete', 'Digital Download UI row', 'wp-e-commerce' ) . "</a></td>";
1233
- $output .= '<td><a href=' .$file_url .'>' . _x( 'Download', 'Digital Download UI row', 'wp-e-commerce' ) . '</a></td>';
1234
- $output .= '</tr>';
1235
- }
1236
-
1237
- return array(
1238
- 'content' => $output,
1239
- );
1240
- }
1241
-
1242
- /**
1243
- * Generate variations
1244
- *
1245
- * @since 3.8.9
1246
- * @access private
1247
- *
1248
- * @uses wpsc_update_variations() Updates product variations given
1249
- * @uses wpsc_admin_product_listing() DEPRECATED
1250
- *
1251
- * @return array|WP_Error Response args if successful, WP_Error if otherwise
1252
- */
1253
- function _wpsc_ajax_update_variations() {
1254
- $product_id = absint( $_REQUEST["product_id"] );
1255
- wpsc_update_variations();
1256
-
1257
- ob_start();
1258
- wpsc_admin_product_listing( $product_id );
1259
- $content = ob_get_clean();
1260
-
1261
- return array( 'content' => $content );
1262
- }
1263
-
1264
- /**
1265
- * Display the shortcode generator.
1266
- *
1267
- * @since 3.8.9
1268
- * @access private
1269
- */
1270
- function _wpsc_action_tinymce_window() {
1271
- require_once( WPSC_CORE_JS_PATH . '/tinymce3/window.php' );
1272
- exit;
1273
- }
1274
- add_action( 'wp_ajax_wpsc_tinymce_window', '_wpsc_action_tinymce_window' );
1275
-
1276
- /**
1277
- * Add tax rate
1278
- * @since 3.8.9
1279
- * @access private
1280
- *
1281
- * @uses wpec_taxes_controller Contains all the logic to communicate with the taxes system
1282
- * @uses wpec_taxes_controller::wpec_taxes::wpec_taxes_get_regions() Gets tax regions based on input country code
1283
- * @uses wpec_taxes_controller::wpec_taxes_build_select_options() Returns HTML formatted options from input array
1284
- * @uses wpec_taxes_controller::wpec_taxes_build_form() Builds the tax rate form
1285
- * @uses wpec_taxes_controller::wpec_taxes::wpec_taxes_get_band_from_index() Retrieves tax band for given name
1286
- *
1287
- * @return array|WP_Error Response args if successful, WP_Error if otherwise
1288
- */
1289
- function _wpsc_ajax_add_tax_rate() {
1290
- //include taxes controller
1291
- $wpec_taxes_controller = new wpec_taxes_controller;
1292
-
1293
- switch ( $_REQUEST['wpec_taxes_action'] ) {
1294
- case 'wpec_taxes_get_regions':
1295
- $regions = $wpec_taxes_controller->wpec_taxes->wpec_taxes_get_regions( $_REQUEST['country_code'] );
1296
- $key = $_REQUEST['current_key'];
1297
- $type = $_REQUEST['taxes_type'];
1298
- $default_option = array( 'region_code' => 'all-markets', 'name' => 'All Markets' );
1299
- $select_settings = array(
1300
- 'id' => "{$type}-region-{$key}",
1301
- 'name' => "wpsc_options[wpec_taxes_{$type}][{$key}][region_code]",
1302
- 'class' => 'wpsc-taxes-region-drop-down'
1303
- );
1304
- $returnable = $wpec_taxes_controller->wpec_taxes_build_select_options( $regions, 'region_code', 'name', $default_option, $select_settings );
1305
- break;
1306
- }// switch
1307
-
1308
- return array(
1309
- 'content' => $returnable,
1310
- );
1311
- }
1312
-
1313
- /**
1314
- * Displays the WPSC product variations table
1315
- *
1316
- * @uses check_admin_referrer() Makes sure user was referred from another admin page
1317
- * @uses WPSC_Product_Variations_Page The WPSC Product variations class
1318
- * @uses WPSC_Product_Variations_Page::display() Displays the product variations page
1319
- */
1320
- function wpsc_product_variations_table() {
1321
- check_admin_referer( 'wpsc_product_variations_table' );
1322
- set_current_screen( 'wpsc-product' );
1323
- require_once( WPSC_FILE_PATH . '/wpsc-admin/includes/product-variations-page.class.php' );
1324
- $page = new WPSC_Product_Variations_Page();
1325
- $page->display();
1326
-
1327
- exit;
1328
- }
1329
- add_action( 'wp_ajax_wpsc_product_variations_table', 'wpsc_product_variations_table' );
1330
-
1331
- /**
1332
- * @access private
1333
- *
1334
- * @uses current_user_can() Checks user capabilities given string
1335
- * @uses delete_post_thumbnail() Deletes post thumbnail given thumbnail id
1336
- * @uses set_post_thumbnail() Sets post thumbnail given post_id and thumbnail_id
1337
- * @uses wpsc_the_product_thumbnail() Returns URL to the product thumbnail
1338
- *
1339
- * @return array $response Includes the thumbnail URL and success bool value
1340
- */
1341
- function _wpsc_ajax_set_variation_product_thumbnail() {
1342
- $response = array(
1343
- 'success' => false
1344
- );
1345
-
1346
- $post_ID = intval( $_POST['post_id'] );
1347
- if ( current_user_can( 'edit_post', $post_ID ) ) {
1348
- $thumbnail_id = intval( $_POST['thumbnail_id'] );
1349
-
1350
- if ( $thumbnail_id == '-1' )
1351
- delete_post_thumbnail( $post_ID );
1352
-
1353
- set_post_thumbnail( $post_ID, $thumbnail_id );
1354
-
1355
- $thumbnail = wpsc_the_product_thumbnail( 50, 50, $post_ID, '' );
1356
- if ( ! $thumbnail )
1357
- $thumbnail = WPSC_CORE_IMAGES_URL . '/no-image-uploaded.gif';
1358
- $response['src'] = $thumbnail;
1359
- $response['success'] = true;
1360
- }
1361
-
1362
- echo json_encode( $response );
1363
- exit;
1364
- }
1365
- add_action( 'wp_ajax_wpsc_set_variation_product_thumbnail', '_wpsc_ajax_set_variation_product_thumbnail' );
1366
-
1367
- /**
1368
- * Delete WPSC product image from gallery
1369
- *
1370
- * @uses check_ajax_referer() Verifies the AJAX request to prevent processing external requests
1371
- * @uses get_post_meta() Returns meta from the specified post
1372
- * @uses update_post_meta() Updates meta from the specified post
1373
- */
1374
- function product_gallery_image_delete_action() {
1375
-
1376
- $product_gallery = array();
1377
- $gallery_image_id = $gallery_post_id = '';
1378
-
1379
- $gallery_image_id = absint($_POST['product_gallery_image_id']);
1380
- $gallery_post_id = absint($_POST['product_gallery_post_id']);
1381
-
1382
- check_ajax_referer( 'wpsc_gallery_nonce', 'wpsc_gallery_nonce_check' );
1383
-
1384
- $product_gallery = get_post_meta( $gallery_post_id, '_wpsc_product_gallery', true );
1385
-
1386
- foreach ( $product_gallery as $index => $image_id ) {
1387
- if ( $image_id == $gallery_image_id ) {
1388
- unset( $product_gallery[$index] );
1389
- }
1390
- }
1391
-
1392
- update_post_meta( $gallery_post_id, '_wpsc_product_gallery', $product_gallery );
1393
- }
1394
- add_action( 'wp_ajax_product_gallery_image_delete', 'product_gallery_image_delete_action' );
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
trunk/wpsc-admin/css/admin.css DELETED
@@ -1,2676 +0,0 @@
1
- /**
2
- * WPSC Admin CSS file
3
- */
4
-
5
- table.wp-list-table .column-featured {
6
- width: 30px;
7
- }
8
-
9
- table.wp-list-table .column-price,
10
- table.wp-list-table .column-sale_price {
11
- width: 8%;
12
- }
13
-
14
- table.wp-list-table .column-SKU {
15
- width: 11%;
16
- }
17
-
18
- table.wp-list-table .column-stock {
19
- width: 8%;
20
- }
21
-
22
- table.wp-list-table .column-weight {
23
- width: 7%;
24
- }
25
-
26
- table.wp-list-table .column-cats {
27
- width: 15%;
28
- }
29
-
30
- ul.variation_checkboxes li {
31
- margin: 1px 0 3px;
32
- }
33
-
34
- /* This is the variation meta box stuff need to put it in the correct place - mychelle */
35
-
36
- div#wpsc_product_variation_forms table#wpsc_product_list tbody tr td span {
37
- display: none;
38
- }
39
-
40
- div#wpsc_product_variation_forms table#wpsc_product_list tbody tr td.weight {
41
- width: 81px;
42
- }
43
-
44
- div#wpsc_product_variation_forms table#wpsc_product_list tbody tr td.stock {
45
- width: 110px;
46
- }
47
-
48
- div#wpsc_product_variation_forms table#wpsc_product_list tbody tr td.price {
49
- width: 125px;
50
- }
51
-
52
- div#wpsc_product_variation_forms table#wpsc_product_list tbody tr td.post-title {
53
- width: 115px;
54
- }
55
-
56
- .wpsc_ie_stock[disabled] {
57
- background-color: #f6f6f6;
58
- }
59
-
60
- div#wpsc_add_variant_desc,
61
- div#wpsc_add_variation_desc {
62
- float: left;
63
- margin: 33px 0px 30px 20px;
64
- }
65
-
66
- div#wpsc_add_variation_desc {
67
- width: 300px;
68
- }
69
-
70
- div#wpsc_add_variant_desc {
71
- width: 200px;
72
- }
73
-
74
- div#wpsc_add_variant {
75
- float: left;
76
- max-width: 245px;
77
- }
78
-
79
- div #add_new_variation {
80
- float: left;
81
- width: 215px;
82
- }
83
-
84
- input.wpsc_ie_field {
85
- margin-bottom:10px;
86
- }
87
-
88
- .wpsc_ie_save {
89
- margin-bottom: 5px;
90
- }
91
-
92
- .wpsc_trackingid_row {
93
- margin-left: 20px;
94
- }
95
-
96
- ul.children {
97
- padding-left: 5px;
98
- }
99
-
100
- .category_indenter {
101
- float: left;
102
- width: auto;
103
- }
104
-
105
-
106
- /**
107
- * Dashboard Widget CSS
108
- */
109
-
110
- #leftDashboard {
111
- width: 45%;
112
- float: left;
113
- text-align: right;
114
- border-right: 1px #999999 solid;
115
-
116
- }
117
-
118
- #leftDashboard strong {
119
- float: left;
120
- padding-left: 40px;
121
- }
122
-
123
- #rightDashboard strong {
124
- float: left;
125
- padding-left: 40px;
126
- }
127
-
128
- #rightDashboard {
129
- width: 45%;
130
- float: right;
131
- text-align: right;
132
- }
133
-
134
- .dashboardWidgetSpecial {
135
- font-family: Georgia, "Times New Roman", "Bitstream Charter", Times, serif;
136
- color: #21759B;
137
- font-size: 15px !important;
138
- margin: 5px 0 5px 0;
139
- }
140
-
141
- .dashboardWidget {
142
- color: #777777;
143
- padding-left: 10px;
144
- padding-right: 30px;
145
- }
146
-
147
- span.wpsc_quart_left {
148
- width: 40%;
149
- float: left;
150
- }
151
-
152
- p.atglance {
153
- color: #777777;
154
- font-family: Georgia, "Times New Roman", "Bitstream Charter", Times, serif;
155
- font-size: 13px;
156
- font-style: italic;
157
- }
158
-
159
- span.wpsc_quart_right {
160
- width: 60%;
161
- float: right;
162
- text-align: right;
163
- }
164
-
165
- #box span {
166
- border-bottom: 1px solid #999999;
167
- }
168
-
169
- p.quarterly {
170
- color: #21759B;
171
- font-family: Georgia, "Times New Roman", "Bitstream Charter", Times, serif;
172
- font-size: 12px;
173
- line-height: 140%;
174
- margin: 5px 0;
175
- }
176
-
177
- /* End of dashboard widget css */
178
-
179
-
180
- /**
181
- * Display Purchase log Details CSS is HERE
182
- */
183
-
184
- .log-details-title-area {
185
- }
186
- .log-details-title-area .tablenav {
187
- float: right;
188
- clear: both;
189
- margin: 0;
190
- }
191
-
192
- .log-details-title-area .pagination-links a {
193
- padding: 0 0 0 8px;
194
- }
195
-
196
- .log-title-details {
197
- float: left;
198
- clear: none;
199
- margin-top: -10px;
200
- color: #23282d;
201
- font-size: 23px;
202
- }
203
-
204
- #purchlogs_customfields {
205
- clear: both;
206
- }
207
-
208
- th#date {
209
- width: 120px;
210
- }
211
-
212
- th#purchid {
213
- width: 60px;
214
- }
215
-
216
- th#details {
217
- width: 100px;
218
- }
219
-
220
- th#track {
221
- width: 75px;
222
- }
223
-
224
- th#delete {
225
- width: 60px;
226
- }
227
-
228
- th#status {
229
- width: 200px;
230
- }
231
-
232
- #wpsc-customer-settings-form h2 {
233
- padding: 0 !important;
234
- }
235
-
236
- #wpsc-customer-settings-form label {
237
- display: block;
238
- }
239
-
240
- #wpsc-customer-settings-form .button-secondary {
241
- margin-right: 10px;
242
- }
243
-
244
- #wpsc_items_ordered {
245
- clear: both;
246
- }
247
-
248
- #wpsc_items_ordered .widefat {
249
- border: 0;
250
- }
251
-
252
- .wpsc-remove-button {
253
- background: none;
254
- border: none;
255
- line-height: 1.60em;
256
- }
257
-
258
- .wpsc-remove-button .dashicons {
259
- color:#a00;
260
- }
261
-
262
- .wpsc-add-row {
263
- border: 1px solid #ddd;
264
- padding: 10px 0;
265
- border-left: 0;
266
- border-right: 0;
267
- }
268
-
269
- .wpsc-add-row button.button {
270
- margin-right: 6px;
271
- }
272
-
273
- .wpsc-add-row .spinner.is-active {
274
- float: none;
275
- }
276
-
277
- .wpsc_item_qty {
278
- width: 4em;
279
- }
280
-
281
- .wpsc_pushdown_img {
282
- float: left;
283
- }
284
-
285
- .wpsc-notes {
286
- margin: 5px 0 20px;
287
- }
288
-
289
- .wpsc-note {
290
- position: relative;
291
- padding: 1px 1em 1px;
292
- margin: 8px 0;
293
- }
294
-
295
- .wpsc-note > p {
296
- border-bottom: 1px solid #ddd;
297
- padding-bottom: 1em;
298
- height: 1.5em;
299
- }
300
-
301
- .wpsc-note .note-number {
302
- opacity: .5;
303
- padding-left: 5px;
304
- }
305
-
306
- .wpsc-note:nth-child( 2n ) {
307
- background: #f7f7f7;
308
- }
309
-
310
- .wpsc-note .wpsc-remove-button {
311
- float: right;
312
- margin-top: -3px;
313
- text-decoration: none;
314
- color: #444;
315
- }
316
-
317
- .wpsc-note .wpsc-remove-button .spinner {
318
- float: left;
319
- margin-top: 0;
320
- }
321
-
322
- .note-submit {
323
- display: inline-block;
324
- }
325
-
326
- #purchlogs_notes .inside {
327
- margin-top: 0;
328
- margin-bottom: 0;
329
- }
330
-
331
- #wpsc_purchlogitems_links {
332
- clear: both;
333
- }
334
-
335
- #wpsc_purchlog_order_status {
336
- float: right;
337
- width: 250px;
338
- }
339
-
340
- #wpsc_purchlog_order_status .selector {
341
- margin-top: -.2em;
342
- }
343
-
344
- /* Purchase Log Action Links */
345
-
346
- #wpsc_purchlogitems_links a {
347
- text-decoration: none;
348
- line-height: 14pt;
349
- }
350
-
351
- #wpsc_purchlogitems_links img {
352
- padding-top: 2px;
353
- float: left;
354
- }
355
-
356
- #wpsc_purchlogitems_links li .dashicons {
357
- margin-right: 10px;
358
- }
359
-
360
- #wpsc_purchlogitems_links li a {
361
- position: relative;
362
- }
363
-
364
- #wpsc_purchlogitems_links li a .spinner {
365
- display: none;
366
- float: none;
367
- margin: 0px;
368
- position: absolute;
369
- top: 0px;
370
- left: 0px;
371
- }
372
-
373
- #wpsc_purchlogitems_links li a .dashicons {
374
- color: #888;
375
- }
376
-
377
- #wpsc_purchlogitems_links li a .dashicons-yes {
378
- color: #7ad03a;
379
- }
380
-
381
- #wpsc_purchlogitems_links li a.wpsc-purchlog-action-link-delete .dashicons,
382
- #wpsc_purchlogitems_links li a.wpsc-purchlog-action-link-back .dashicons {
383
- color: #bbb;
384
- }
385
-
386
- #wpsc_purchlogitems_links li a.wpsc-purchlog-action-link-delete:hover .dashicons,
387
- #wpsc_purchlogitems_links li a .dashicons-no {
388
- color: #c00;
389
- }
390
-
391
- #wpsc_purchlogitems_links li a.wpsc-purchlog-action-link-back:hover .dashicons {
392
- color: #888;
393
- }
394
-
395
- #wpsc_purchlogitems_links li a.doing {
396
- padding-left: 30px;
397
- }
398
-
399
- #wpsc_purchlogitems_links li a.doing .spinner {
400
- display: block;
401
- }
402
-
403
- #wpsc_purchlogitems_links li a.doing .dashicons {
404
- display: none;
405
- }
406
-
407
- #wpsc_shipping_details_box {
408
- width: 45%;
409
- float: left;
410
- margin: .4em;
411
- padding: .6em;
412
- margin-right: 5em;
413
- }
414
-
415
- #wpsc_billing_details_box {
416
- width: 35%;
417
- float: left;
418
- margin: .4em;
419
- padding: .6em;
420
- }
421
-
422
- #wpsc_shipping_details_box em.field-blank,
423
- #wpsc_billing_details_box em.field-blank {
424
- color: #999;
425
- }
426
-
427
- #wpsc_purchlog_searchbox {
428
- width: 100%;
429
- text-align: right;
430
- }
431
-
432
- .edit-log-details {
433
- font-size: .8em;
434
- padding-left: 5px;
435
- }
436
-
437
- @media screen and ( min-width: 620px ) {
438
- #wpsc-customer-settings-form fieldset {
439
- float: left;
440
- min-width: 300px;
441
- margin-right: 10px;
442
- }
443
- #wpsc-customer-settings-form fieldset [type="text"] {
444
- min-width: 280px;
445
- }
446
- }
447
-
448
- .wpsc-form-actions {
449
- clear: both;
450
- }
451
-
452
- #edit-shipping-billing {
453
- padding: 18px 18px 0;
454
- background: #fff;
455
- border: 1px solid #e5e5e5;
456
- -webkit-box-shadow: 0 1px 1px rgba(0,0,0,0.04);
457
- box-shadow: 0 1px 1px rgba(0,0,0,0.04);
458
- clear: both;
459
- }
460
-
461
- #edit-shipping-billing .wpsc-form-actions {
462
- margin-bottom: 0;
463
- }
464
-
465
- /**
466
- * Display Products CSS starts here
467
- */
468
-
469
- .tablenav select[name="bulkAction"] {
470
- width: 100px;
471
- }
472
-
473
- textarea#additional_description {
474
- border: 1px solid #dfdfdf;
475
- }
476
-
477
- #poststuff h3.form_heading {
478
- font-size: 1.1em;
479
- margin: 40px 0px 10px 0px;
480
- padding-left: 0px;
481
- }
482
-
483
- #poststuff h3.form_heading span {
484
- font-size: 0.8em;
485
- }
486
-
487
- div.search-box input#page-search-input {
488
- width: 129px;
489
- }
490
-
491
- #wpsc_product_list,
492
- table.widefat {
493
- width: 100%;
494
- }
495
-
496
- table.widefat .column-hidden_alerts {
497
- display: none;
498
- }
499
-
500
- #wpsc_product_list .column-cb,
501
- table.widefat .column-cb {
502
- vertical-align: middle;
503
- }
504
-
505
- #wpsc_product_list .column-image,
506
- #wpsc_product_list .product-image,
507
- table.widefat .column-image,
508
- table.widefat .product-image {
509
- padding-right: 0px;
510
- width: 42px;
511
- }
512
-
513
- .post-type-wpsc-product table.widefat .column-image img {
514
- max-width: 100%;
515
- max-height: 100%;
516
- width: auto;
517
- height: auto;
518
- }
519
-
520
- #wpsc_product_list .column-categories,
521
- table.widefat .column-categories {
522
- padding-right:18px;
523
- }
524
-
525
- #wpsc_product_list tbody tr td.column-title,
526
- table.widefat tbody tr td.column-title {
527
- border-right: none;
528
- }
529
-
530
- #wpsc_product_list tbody tr td.product-image img,
531
- table.widefat tbody tr td.product-image img {
532
- margin-top: 4px;
533
- cursor: move;
534
- }
535
-
536
-
537
- /**
538
- * Product Currency and Quantity Discount Layers
539
- */
540
-
541
- .wpsc-currency-layers {
542
- clear: both;
543
- margin: 0 0 15px 0;
544
- padding: 15px 0 0 0;
545
- }
546
-
547
- .wpsc-quantity-discounts {
548
- clear: both;
549
- margin: 0 0 20px 0;
550
- }
551
-
552
- .wpsc-currency-layers table,
553
- .wpsc-quantity-discounts table {
554
- border-collapse: collapse;
555
- margin: 10px 0;
556
- width: 100%;
557
- }
558
-
559
- .wpsc-quantity-discounts table {
560
- margin-top: 20px;
561
- }
562
-
563
- .wpsc-currency-layers th,
564
- .wpsc-quantity-discounts th {
565
- font-weight: normal;
566
- text-align: left;
567
- vertical-align: bottom;
568
- }
569
-
570
- .wpsc-currency-layers th.price,
571
- .wpsc-quantity-discounts th.price {
572
- width: 30%;
573
- }
574
-
575
- .wpsc-quantity-discounts th.qty {
576
- width: 40%;
577
- }
578
-
579
- .wpsc-quantity-discounts td {
580
- line-height: 28px;
581
- }
582
-
583
- .wpsc-quantity-discounts td.curr {
584
- text-align: right;
585
- }
586
-
587
- .wpsc-currency-layers th.remove,
588
- .wpsc-quantity-discounts th.remove {
589
- width: 20px;
590
- }
591
-
592
- .wpsc-currency-layers td,
593
- .wpsc-quantity-discounts td {
594
- padding: 3px 2px 3px 0px;
595
- }
596
-
597
- .wpsc-currency-layers .newCurrency {
598
- margin: 0px;
599
- width: 95%;
600
- }
601
-
602
- .wpsc-quantity-discounts .qty input {
603
- width: 4em;
604
- }
605
-
606
- .wpsc-currency-layers .newCurrPrice,
607
- .wpsc-quantity-discounts .newCurrPrice {
608
- width: 100%;
609
- }
610
-
611
- .wpsc_delete_currency_layer,
612
- .wpsc-quantity-discounts .remove_line {
613
- color: #bbb;
614
- display: inline-block;
615
- font-size: 16px;
616
- line-height: 20px;
617
- margin: 4px 0 0 0;
618
- text-align: center;
619
- width: 20px;
620
- height: 20px;
621
- }
622
-
623
- .wpsc_delete_currency_layer:hover,
624
- .wpsc-quantity-discounts .remove_line:hover {
625
- color: #c00;
626
- }
627
-
628
- div.wpsc_floatleft {
629
- width: 161px;
630
- float: left;
631
- }
632
-
633
- div.wpsc_floatleft label {
634
- line-height: 18px;
635
- white-space: nowrap;
636
- display: block
637
- }
638
-
639
-
640
- /**
641
- * Sortable product styling
642
- */
643
-
644
- table.product_editform {
645
- width: 100%;
646
- }
647
-
648
- #wpsc_product_list .ui-sortable-helper,
649
- table.widefat .ui-sortable-helper {
650
- width: 410px;
651
- margin-left: -1px;
652
- background-color: #FEFEFE;
653
- }
654
-
655
- #wpsc_product_list .ui-sortable-helper td,
656
- #wpsc_product_list .ui-sortable-helper th,
657
- table.widefat .ui-sortable-helper td,
658
- table.widefat .ui-sortable-helper th {
659
- border-top: 1px solid #DFDFDF;
660
- opacity: .4;
661
- }
662
-
663
- .wpsc-sortable-table-placeholder td,
664
- .product-placeholder {
665
- border-width: 1px;
666
- border-style: dashed;
667
- z-index: 900;
668
- border-color: #bbb;
669
- background-color: #eaeaea !important;
670
- height: 38px;
671
- }
672
-
673
- div#poststuff table tr td {
674
- vertical-align: top;
675
- }
676
-
677
- div#poststuff textarea {
678
- width: 100%;
679
- }
680
-
681
- div.admin_product_name label {
682
- display: block;
683
- float: left;
684
- }
685
-
686
- div.admin_product_name {
687
- position: relative;
688
- height: 30px;
689
- background: #ffffff;
690
- border: 1px solid #dfdfdf;
691
- -webkit-border-radius: 6px;
692
- -khtml-border-radius: 6px;
693
- -moz-border-radius: 6px;
694
- border-radius: 6px;
695
- }
696
-
697
- div.admin_product_name input.wpsc_product_name {
698
- border: none;
699
- }
700
-
701
- div.admin_product_name a.shorttag_toggle {
702
- position: absolute;
703
- top: 0px;
704
- right: 0px;
705
- background: url(../../wpsc-core/images/info_icon.jpg) no-repeat scroll 5px 8px;
706
- border-left: 1px solid #DFDFDF;
707
- display: block;
708
- height: 100%;
709
- padding: 0px 3px 0px 3px;
710
- width: 18px;
711
- }
712
-
713
- div#icon_card {
714
- float: left;
715
- height: 36px;
716
- margin: 7px 8px 0 0;
717
- width: 36px;
718
- background: url(../../wpsc-core/images/icon32.png) no-repeat center center;
719
- }
720
-
721
- /* Can .admin_product_shorttags be deprecated */
722
-
723
- div.admin_product_shorttags {
724
- width: 93%;
725
- min-width: 396px;
726
- max-width: 558px;
727
- clear: both;
728
- padding: 6px;
729
- font-size: 8pt;
730
- margin: 0 0 0 6px !important;
731
- border-left: 1px solid #DFDFDF;
732
- border-right: 1px solid #DFDFDF;
733
- border-bottom: 1px solid #DFDFDF;
734
- display: none;
735
- background-color: #ffffff;
736
- }
737
-
738
- #description {
739
- margin: 0;
740
- }
741
-
742
- h4.product_action_link {
743
- margin: 4px 0px 0px 0px;
744
- display: block;
745
- font-weight: bold;
746
- }
747
-
748
-
749
- /**
750
- * Image form styling
751
- */
752
-
753
- div.flash-image-uploader {
754
- display: none;
755
- }
756
-
757
- #wpbody-content div.flash-image-uploader #media-items {
758
- position: relative;
759
- border: none;
760
- }
761
-
762
- #wpbody-content div.flash-image-uploader #media-items .progress {
763
- position: static;
764
- margin: 0 0 6px;
765
- height: 16px;
766
- }
767
-
768
- .ui-selected {
769
- border: 2px dashed #969696;
770
- }
771
-
772
- img.deleteButton {
773
- display: none;
774
- position: absolute;
775
- top: -5px;
776
- right: -1px;
777
- width: 16px;
778
- height: 16px;
779
- cursor: pointer;
780
- }
781
-
782
- a.editButton {
783
- background: #FFFFFF none repeat scroll 0%;
784
- height: 20px;
785
- display: none;
786
- position: absolute;
787
- right: 0px;
788
- top: 0px;
789
- padding-bottom: 3px;
790
- padding-left: 3px;
791
- cursor: pointer;
792
- }
793
-
794
- div.image_settings_box {
795
- position: absolute;
796
- width: 150px;
797
- display: none;
798
- margin: -66px 0px 0px 36px;
799
- padding-top: 2px;
800
- width: 252px;
801
- z-index: 69;
802
- }
803
-
804
- a.thickbox img {
805
- border: medium none;
806
- }
807
-
808
- img.previewimage {
809
- cursor: move;
810
- height: 60px;
811
- margin-right: 4px;
812
- width: 60px;
813
- }
814
-
815
- div.lower_settings_box {
816
- width: 234px;
817
- background-color: white;
818
- border: 1px solid black;
819
- border-top: 1px solid #CCCCCC;
820
- float: right;
821
- margin: -1px -6px 0px 0px;
822
- padding: 2px 0 0 4px;
823
- background-color: #EAF3FA;
824
- }
825
-
826
- div.upper_settings_box {
827
- width: 250px;
828
- background-color: white;
829
- border: 1px solid black;
830
- padding: 3px 1px 2px 5px;
831
- }
832
-
833
- div.upper_image {
834
- float: left;
835
- padding-left :5px;
836
- margin-left: -5px;
837
- margin-right: -7px;
838
- padding-bottom: 4px;
839
- }
840
-
841
- div.upper_txt {
842
- padding-left: 22px;
843
- color: #666666;
844
- }
845
-
846
- div.previewimage {
847
- position: relative;
848
- }
849
-
850
- tr.edit_product_image * {
851
- z-index: 80;
852
- }
853
-
854
- div.browser-image-uploader h4 {
855
- margin-bottom: 8px;
856
- }
857
-
858
- div.image_resize_extra_forms {
859
- display: none;
860
- }
861
-
862
- #wpsc_product_category_and_tag_forms table {
863
- width: 100%;
864
- }
865
-
866
- #wpsc_product_category_and_tag_forms table td.itemfirstcol {
867
- padding-left: 3pt;
868
- width: 50%;
869
- }
870
-
871
-
872
- /**
873
- * Variations CSS starts
874
- */
875
-
876
- table.product_variation_listing {
877
- margin-bottom: 12px;
878
- }
879
-
880
- table.product_variation_listing th.variation_name {
881
- color: #71A4C8;
882
- font-style: italic;
883
- text-align: left;
884
- padding-bottom: 1px;
885
- }
886
-
887
- table.product_variation_grid {
888
- margin-top: 12px;
889
- }
890
-
891
- table.product_variation_grid th.variation_name {
892
- color: #71A4C8;
893
- font-style: italic;
894
- text-align: left;
895
- padding-bottom: 1px;
896
- }
897
-
898
- div#edit_variations_container {
899
- margin-top: 12px;
900
- }
901
-
902
- table.product_variation_grid {
903
- border-collapse: collapse;
904
- margin-top: 0px;
905
- }
906
-
907
- table.product_variation_grid tr td,
908
- table.product_variation_grid tr th {
909
- border: 1px solid #cccccc;
910
- border-collapse: collapse;
911
- text-align: left;
912
- }
913
-
914
- table.product_variation_grid tr th {
915
- border-bottom: 1px solid #969696;
916
- }
917
-
918
- table.product_variation_grid tr th.stock {
919
- border-bottom: 1px solid #969696;
920
- width: 50px;
921
- }
922
-
923
- table.product_variation_grid tr th.price {
924
- width: 78px;
925
- }
926
-
927
- table.product_variation_grid tr td.variations,
928
- table.product_variation_grid tr th {
929
- padding: 4px 0px 4px 10px;
930
- }
931
-
932
- table.product_variation_grid tr td.variations,
933
- table.product_variation_grid tr th.variations {
934
- width: 300px;
935
- }
936
-
937
- table.product_variation_grid tr td input {
938
- padding: 0px 3px 0px 3px;
939
- }
940
-
941
- table.product_variation_grid tr.group_boundary td {
942
- border-bottom: 1px solid #969696;
943
- }
944
-
945
- a.about_this_page_sub {
946
- text-decoration: underline;
947
- }
948
-
949
- table.product_variation_grid tr td,
950
- table.product_variation_grid tr th {
951
- border: 1px solid #cccccc;
952
- border-collapse: collapse;
953
- text-align: left;
954
- }
955
-
956
- table.product_variation_grid tr.variation_row td {
957
- border-bottom: none;
958
- }
959
-
960
- table.product_variation_grid tr.settings_row td {
961
- border-top: none;
962
- padding: 0px !important;
963
- }
964
-
965
- table.product_variation_grid tr.settings_row td div.variation_settings {
966
- display: none;
967
- border-top: 1px dotted #cccccc;
968
- width: 100%;
969
- min-height: 30px;
970
- padding: 4px 10px;
971
- }
972
-
973
- table.product_variation_grid tr th {
974
- border-bottom: 1px solid #969696;
975
- }
976
-
977
- table.product_variation_grid tr th.stock {
978
- border-bottom: 1px solid #969696;
979
- width: 50px;
980
- }
981
-
982
- table.product_variation_grid tr th.price {
983
- width: 78px;
984
- }
985
-
986
- table.product_variation_grid tr td.variations,
987
- table.product_variation_grid tr th {
988
- padding: 4px 0px 4px 10px;
989
- }
990
-
991
- table.product_variation_grid tr td.variations,
992
- table.product_variation_grid tr th.variations {
993
- width: 300px;
994
- }
995
-
996
- table.product_variation_grid tr td input {
997
- padding: 0px 3px 0px 3px;
998
- }
999
-
1000
- table.product_variation_grid tr td input.checkbox {
1001
- display: block;
1002
- margin: 6px auto;
1003
- }
1004
-
1005
- table.product_variation_grid tr.group_boundary td {
1006
- border-bottom: 1px solid #969696;
1007
- }
1008
-
1009
- div#add_product_variation_details {
1010
- margin: 1ex 0px 0px 0px;
1011
- }
1012
-
1013
- div#add_product_variation_details table.product_variation_grid {
1014
- margin: 4px 0px 0px 0px;
1015
- }
1016
-
1017
- div.variation_checkboxes {
1018
- margin-bottom: 4px;
1019
- }
1020
-
1021
- a.variation_edit_button {
1022
- display: block;
1023
- height: 16px;
1024
- width: 16px;
1025
- margin: 4px auto 0px auto;
1026
- }
1027
-
1028
- div.variation_settings div.variation_settings_contents {
1029
- padding-left: 10px;
1030
- }
1031
-
1032
- div.select_variation_file {
1033
- padding-left: 6px;
1034
- }
1035
-
1036
- div.select_variation_file p {
1037
- margin: 0 0 3px;
1038
- }
1039
-
1040
- div.select_variation_file p {
1041
- margin: 0 0 3px;
1042
- }
1043
-
1044
- div.select_variation_file p input {
1045
- position: relative;
1046
- top: 2px;
1047
- }
1048
-
1049
- .variation_checkboxes li {
1050
- margin: 0;
1051
- }
1052
-
1053
- .variation_checkboxes ul {
1054
- margin-left: 30px;
1055
- }
1056
-
1057
- .js .variation_checkboxes .children {
1058
- display: none;
1059
- }
1060
-
1061
- .js .variation_checkboxes .expanded .children {
1062
- display: block;
1063
- }
1064
-
1065
- .variation_checkboxes a.expand {
1066
- background: url(arrows.png) no-repeat left -108px;
1067
- display: inline-block;
1068
- height: 15px;
1069
- width: 15px;
1070
- text-indent: -999em;
1071
- vertical-align: middle;
1072
- }
1073
-
1074
- .variation_checkboxes .expanded a.expand {
1075
- background-position: left top;
1076
- }
1077
-
1078
- #add-new-variation-set {
1079
- margin-bottom: 20px;
1080
- display: none;
1081
- }
1082
-
1083
- #add-new-variation-set p {
1084
- position: relative;
1085
- }
1086
-
1087
- #add-new-variation-set p.howto {
1088
- margin-bottom: 16px;
1089
- }
1090
-
1091
- #add-new-variation-set p label.focus {
1092
- color: #666;
1093
- }
1094
-
1095
- #add-new-variation-set p.error label {
1096
- color: red;
1097
- }
1098
-
1099
- #add-new-variation-set p label {
1100
- color: #000;
1101
- cursor: text;
1102
- left: 6px;
1103
- position: absolute;
1104
- top: 4px;
1105
- }
1106
-
1107
- #add-new-variation-set .text-field {
1108
- width: 195px;
1109
- }
1110
-
1111
- .variation-set-prototype {
1112
- display: none;
1113
- }
1114
-
1115
- /* Variations CSS ends */
1116
-
1117
- div#side-sortables input[type="file"] {
1118
- width: 250px;
1119
- }
1120
-
1121
- .wpsc_product_downloads_header {
1122
- margin: 0 0 5px;
1123
- }
1124
-
1125
- .select_product_file,
1126
- .edit_select_product_file {
1127
- margin-bottom: 0;
1128
- margin-top: 3px;
1129
- overflow-x: hidden;
1130
- overflow-y: auto;
1131
- position: relative;
1132
- width: 100%;
1133
- }
1134
-
1135
- span.select_product_note {
1136
- margin: 0 0 5px;
1137
- }
1138
-
1139
- img.wpsc_add_download {
1140
- display: inline;
1141
- position: relative;
1142
- top: 2px;
1143
- }
1144
-
1145
- a.file_delete_button {
1146
- cursor: pointer;
1147
- color: red;
1148
- display: block;
1149
- }
1150
-
1151
- a.delete_button {
1152
- border-color: -moz-use-text-color;
1153
- border-style: none none solid;
1154
- border-width: medium medium 1px;
1155
- color: #FF0000;
1156
- font-size: 11px;
1157
- padding: 1px 2px;
1158
- text-decoration: none;
1159
- }
1160
-
1161
- .greytext {
1162
- color: #666666;
1163
- }
1164
-
1165
- span.small_italic {
1166
- font-style: italic;
1167
- }
1168
-
1169
- /* Product details form styling ends */
1170
-
1171
- /* Display Products CSS ends here */
1172
-
1173
-
1174
- /**
1175
- * Product Groups styles start here
1176
- */
1177
-
1178
- td.firstcol div.postbox div.inside {
1179
- margin: 0px;
1180
- padding: 0px;
1181
- }
1182
-
1183
- table#productpage {
1184
- width: 100%;
1185
- clear: both;
1186
- border-collapse: collapse;
1187
- }
1188
-
1189
- table#productpage tr td {
1190
- vertical-align: top;
1191
- }
1192
-
1193
- table#productpage tr td.secondcol {
1194
- padding: 0px 2px 0px 16px;
1195
- }
1196
-
1197
- table.category-edit {
1198
- border-collapse: collapse;
1199
- width: 100%;
1200
- }
1201
-
1202
- table.category-edit tr td {
1203
- border: none;
1204
- }
1205
- table.category-edit tr td.column-title {
1206
- width: 450px;
1207
- }
1208
-
1209
- div.category-image-container {
1210
- width: 55px;
1211
- height: 30px;
1212
- }
1213
-
1214
- div.category-image-container img {
1215
- float: left;
1216
- }
1217
-
1218
- div.category-image-container img.category_indenter {
1219
- margin-right: 3px;
1220
- width: auto;
1221
- float: left;
1222
- }
1223
-
1224
- div#productform {
1225
- display: none;
1226
- width: 99.5%;
1227
- }
1228
-
1229
- div#edititem27 {
1230
- display: none;
1231
- width: 586px;
1232
- }
1233
-
1234
- div#productform table tr td {
1235
- height: 11px !important;
1236
- }
1237
-
1238
- div#blank_item {
1239
- display: block;
1240
- }
1241
-
1242
- #poststuff div#blank_item h3 {
1243
- margin-top: 0px;
1244
- }
1245
-
1246
- div#additem {
1247
- display: none;
1248
- }
1249
-
1250
- div#productform td.itemfirstcol {
1251
- padding-left: 4px;
1252
- vertical-align: top;
1253
- }
1254
-
1255
- div#productform input.text,
1256
- div#additem input.text {
1257
- width: 386px;
1258
- border: 1px solid #bbb;
1259
- }
1260
-
1261
- table.category_forms {
1262
- width: 100%;
1263
- }
1264
-
1265
- table.category_forms tr td {
1266
- padding: 0px;
1267
- padding-right: 8px;
1268
- }
1269
-
1270
- table.category_forms tr td textarea {
1271
- width: 386px;
1272
- }
1273
-
1274
- div#edit_variation_values input.text {
1275
- width: 286px !important;
1276
- border: 1px solid #bbb;
1277
- }
1278
-
1279
- input.image_resize {
1280
- position: relative;
1281
- top: 4px;
1282
- }
1283
-
1284
- div#additem table.additem input.wpsc_tag {
1285
- width: 180px;
1286
- }
1287
-
1288
- div#additem label {
1289
- font-style: normal;
1290
- font-size: 0.95em;
1291
- }
1292
-
1293
- .groupItem {
1294
- border-top: 1px solid #bbb;
1295
- width: 385px;
1296
- height: 35px;
1297
- clear: both;
1298
- padding: 0px 0px 4px 0px;
1299
- }
1300
-
1301
- .groupItem .itemHeader {
1302
- width: 65px;
1303
- line-height: 15px;
1304
- color: #000;
1305
- padding: 4px;
1306
- cursor: move;
1307
- height: 35px;
1308
- position: relative;
1309
- clear: both;
1310
- }
1311
-
1312
- .groupItem .itemHeader a {
1313
- margin: 4px 0px 4px 0px;
1314
- font-weight: normal;
1315
- font-size: 11px;
1316
- text-decoration: none;
1317
- }
1318
-
1319
- .sortHelper {
1320
- border: 3px dashed #666;
1321
- width: auto;
1322
- }
1323
-
1324
- .groupWrapper p {
1325
- height: 1px;
1326
- overflow: hidden;
1327
- margin: 0;
1328
- padding: 0;
1329
- }
1330
-
1331
- table#productpage tr td.secondcol.product_groups_page {
1332
- padding-left: 16px;
1333
- }
1334
-
1335
- table#productpage tr td.secondcol.product_groups_page h4 {
1336
- font-family: inherit;
1337
- margin-top: 20px;
1338
- }
1339
-
1340
- td.product_groups_page #additem .inside,
1341
- td.product_groups_page #productform .inside {
1342
- margin: 0px 0px 15px 0px;
1343
- }
1344
-
1345
- div.editing_this_group {
1346
- margin-top: 8px;
1347
- margin-bottom: 8px;
1348
- width: 100%;
1349
- }
1350
-
1351
- td.product_groups_page h4 {
1352
- margin-bottom: 1ex;
1353
- }
1354
-
1355
- #editorcontainer {
1356
- clear: both;
1357
- }
1358
-
1359
- td.product_groups_page td.category_presentation_settings {
1360
- padding-bottom: 1ex;
1361
- }
1362
-
1363
- div.editing_this_group {
1364
- font-size: 8pt;
1365
- }
1366
-
1367
- div.editing_this_group p {
1368
- padding: 4px 4px 4px 8px;
1369
- }
1370
-
1371
- div.editing_this_group dl {
1372
- padding: 4px 4px 4px 8px;
1373
- }
1374
-
1375
- #blank_item a.add_category_link {
1376
- display: block;
1377
- margin: 8px 8px 8px 0px;
1378
- text-decoration: underline;
1379
- }
1380
-
1381
- div.product_group {
1382
- margin: 12px 0px 10px 0px;
1383
- }
1384
-
1385
- table#wpsc_category_list td div.subcategory img.category_indenter {
1386
- float: left;
1387
- margin: 8px 0px 0px 0px;
1388
- }
1389
-
1390
- table#wpsc_category_list td div.subcategory table.itemlist {
1391
- float: left;
1392
- }
1393
-
1394
- label.select_categorisation_group,
1395
- select#select_categorisation_group,
1396
- a.add_categorisation_group,
1397
- a.edit_categorisation_group,
1398
- #submit_categorisation_form span {
1399
- display: block;
1400
- float: left;
1401
- }
1402
-
1403
- #submit_categorisation_form span {
1404
- display: block;
1405
- float: left;
1406
- margin-left: 10px;
1407
- }
1408
-
1409
- #submit_categorisation_form a span {
1410
- margin-left: 0px;
1411
- }
1412
-
1413
- label.select_categorisation_group {
1414
- padding-top: 4px;
1415
- font-size: 11px;
1416
- }
1417
-
1418
- a.add_categorisation_group {
1419
- margin-left: 10px;
1420
- }
1421
-
1422
- a.edit_categorisation_group {
1423
- margin-left: 30px;
1424
- }
1425
-
1426
- div#add_categorisation,
1427
- div#edit_categorisation {
1428
- display: none;
1429
- border: 1px solid #BBBBBB;
1430
- padding: 4px;
1431
- margin-top: 6px;
1432
- }
1433
-
1434
- div#add_categorisation br,
1435
- div#edit_categorisation br {
1436
- clear: both;
1437
- }
1438
-
1439
- div#add_categorisation fieldset,
1440
- div#edit_categorisation fieldset {
1441
- width: 230px;
1442
- float: left;
1443
- border: none;
1444
- }
1445
-
1446
- div#add_categorisation fieldset label,
1447
- div#edit_categorisation fieldset label {
1448
- display: block;
1449
- }
1450
-
1451
- ul.categorisation_links {
1452
- list-style-type: none;
1453
- clear: both;
1454
- padding: 0px;
1455
- }
1456
-
1457
- ul.categorisation_links li {
1458
- display: block;
1459
- float: left;
1460
- list-style-type: none;
1461
- margin: 0px;
1462
- font-size: 14px;
1463
- padding: 4px;
1464
- }
1465
-
1466
- ul.categorisation_links li.selected a {
1467
- color: #D54E21;
1468
- }
1469
-
1470
- .multiple-select-container {
1471
- margin-left: 0.5em;
1472
- }
1473
-
1474
- .multiple-select {
1475
- background: white none repeat scroll 0px 0px;
1476
- border: 1px solid #DFDFDF;
1477
- display: inline-block;
1478
- height: 120px;
1479
- overflow-x: hidden;
1480
- overflow-y: auto;
1481
- padding: 0 0 0 5px;
1482
- position: relative;
1483
- }
1484
-
1485
- .multiple-select input {
1486
- width: inherit;
1487
- }
1488
-
1489
- .multiple-select label {
1490
- display: inherit;
1491
- }
1492
-
1493
- table.category_forms a.delete_button {
1494
- display: block;
1495
- margin: 3px 0px 0px 8px;
1496
- float: left;
1497
- }
1498
-
1499
- table.category_forms td.last_row {
1500
- padding: 16px 0px 0px 0px;
1501
- }
1502
-
1503
- .wpsc_gold_float {
1504
- min-width: 45%;
1505
- float: left;
1506
- max-width: 450px;
1507
- }
1508
-
1509
- .wpsc_gold_text {
1510
- width: 70%;
1511
- float: left;
1512
- clear: both;
1513
- }
1514
-
1515
- .wpsc_gold_info {
1516
- width: 30%;
1517
- float: right;
1518
- text-align: center;
1519
- font-size: 20px;
1520
- }
1521
-
1522
- .wpsc_gold_module {
1523
- width: 100%;
1524
- float: left;
1525
- border-bottom: 1px solid #DFDFDF;
1526
- }
1527
-
1528
- .wpsc_gold_module strong {
1529
- width: auto;
1530
- float: left;
1531
- }
1532
-
1533
- #visitInstinct {
1534
- float: right;
1535
- margin: 5px 20px 0 0;
1536
- }
1537
-
1538
- #product_license_box .postbox p img {
1539
- padding-bottom: 10px;
1540
- }
1541
-
1542
- #product_license_box_outside {
1543
- width: 400px;
1544
- }
1545
-
1546
- #product_license_box .postbox p {
1547
- padding-left: 4px;
1548
- }
1549
-
1550
- #product_license_box .postbox {
1551
- width: 100%;
1552
- max-width: 500px;
1553
- }
1554
-
1555
- #product_license_box .postbox p {
1556
- padding-left: 10px;
1557
- }
1558
-
1559
- #product_license_box .postbox p label {
1560
- width: 80px;
1561
- float: left;
1562
- }
1563
-
1564
- a.admin_download {
1565
- height: 26px;
1566
- border-bottom: none;
1567
- text-decoration: none;
1568
- }
1569
-
1570
- a.admin_download img {
1571
- margin-right: 3px;
1572
- }
1573
-
1574
- a.admin_download span {
1575
- text-decoration: underline;
1576
- }
1577
-
1578
-
1579
- /**
1580
- * Product Groups styles end here
1581
- */
1582
-
1583
- .wpsc_td_note {
1584
- padding-bottom: 0 !important;
1585
- }
1586
-
1587
- .wpsc_purchaselogs_options {
1588
- margin: 0px 0px 8px 0px;
1589
- }
1590
-
1591
- p.add_new_form_set_forms {
1592
- display: none;
1593
- }
1594
-
1595
- td.product-image a img.attachment-thumbnail {
1596
- height: 38px;
1597
- width: 38px;
1598
- }
1599
-
1600
- #wpsc_product_category_and_tag_forms .tagchecklist {
1601
- font-size: 11px;
1602
- }
1603
-
1604
- #categorydiv div {
1605
- margin-top: 4px;
1606
- }
1607
-
1608
- a.variation_handle {
1609
- color: #CCCCCC;
1610
- text-decoration: none;
1611
- font-size: 15px;
1612
- }
1613
-
1614
- .toplevel_page_wpsc-edit-products .wrap h2 {
1615
- padding-bottom: 0px;
1616
- border-bottom: 1px solid #CCC;
1617
- }
1618
-
1619
- #post-body #advanced-sortables {
1620
- margin-right: 300px
1621
- }
1622
-
1623
- #media-buttons #add_audio,
1624
- #media-buttons #add_video,
1625
- #media-buttons #add_media {
1626
- display: none;
1627
- }
1628
-
1629
- /**
1630
- * Marketing / coupon page styling
1631
- */
1632
-
1633
- div.modify_coupon {
1634
- border: 1px solid #eeeeee;
1635
- display: none;
1636
- width: 100%;
1637
- }
1638
-
1639
- table.coupon_data {
1640
- width: 100%;
1641
- }
1642
-
1643
- table.add-coupon {
1644
- width: 100%;
1645
- }
1646
-
1647
- table.add-coupon tr th {
1648
- text-align: left;
1649
- padding: 2px 5px 0px 5px;
1650
- border: none;
1651
- }
1652
-
1653
- table.add-coupon tr td {
1654
- text-align: left;
1655
- padding: 2px 5px 2px 5px;
1656
- border: none;
1657
- }
1658
-
1659
- table.add-coupon tr td p {
1660
- padding: 0;
1661
- margin: 5px;
1662
- }
1663
- #table_header {
1664
- font-size: 16px;
1665
- margin-top: 20px;
1666
- font-weight: bold;
1667
- }
1668
-
1669
- table.coupon-list {
1670
- width: 100%;
1671
- }
1672
-
1673
- table.coupon-list th {
1674
- text-align: left;
1675
- }
1676
-
1677
- table.coupon-list tr.toprow td {
1678
- text-align: left;
1679
- font-weight: bold;
1680
- }
1681
-
1682
- table.coupon-list tr td {
1683
- padding: 5px 5px 10px 10px;
1684
- vertical-align: middle;
1685
- }
1686
-
1687
- table.coupon-list tr.alt {
1688
- background-color: #eeeeee;
1689
- }
1690
-
1691
- table.coupon-list tr.alt td {
1692
- background-color: #eeeeee;
1693
- }
1694
-
1695
- table.coupon-list tr.coupon_edit td {
1696
- padding: 0;
1697
- }
1698
-
1699
- td#order_summary_container {
1700
- width: 80px;
1701
- }
1702
-
1703
- table.category_forms a.delete_button,
1704
- span.delete_button {
1705
- color: #FF0000;
1706
- display: block;
1707
- float: left;
1708
- font-size: 11px;
1709
- margin: 3px 0 0 8px;
1710
- text-decoration: underline;
1711
- }
1712
-
1713
- p span.input_label {
1714
- font-size: 1.2em;
1715
- width: 180px;
1716
- float: left;
1717
- }
1718
-
1719
- a.wpsc_featured_product_toggle {
1720
- display: block;
1721
- height: 18px;
1722
- width: 18px;
1723
- margin: 4px 0px 0px 0px;
1724
- }
1725
-
1726
- .column-featured a {
1727
- background: url(../../wpsc-core/images/core-sprite.png) no-repeat 0 -32px transparent;
1728
- }
1729
-
1730
- .column-featured a.gold-star {
1731
- background-position: 0 -16px;
1732
- }
1733
-
1734
- .column-featured a:active,
1735
- .column-featured a.gold-star:active {
1736
- background-position: 0 0;
1737
- }
1738
-
1739
- div.wpsc_clear {
1740
- clear: both;
1741
- }
1742
-
1743
- .wpsc_featured div.product_grid_display div.product_grid_item {
1744
- width: 100%;
1745
- height: auto !important;
1746
- margin: 4px 90px 8px 0;
1747
- position: relative;
1748
- }
1749
-
1750
- .wpsc_featured .item_text {
1751
- float: left;
1752
- height: 240px;
1753
- width: auto;
1754
- }
1755
-
1756
- .wpsc_featured .item_image {
1757
- float: left;
1758
- height: 240px;
1759
- width: 340px;
1760
- margin-left: 20px;
1761
- }
1762
-
1763
- .wpsc_featured .item_image a {
1764
- display: block;
1765
- height: 240px;
1766
- width: 340px;
1767
- border: 1px solid #FEFAF1;
1768
- -webkit-border-radius: 18px;
1769
- -moz-border-radius: 18px;
1770
- border-radius: 18px;
1771
- background-repeat: no-repeat;
1772
- }
1773
-
1774
- .wpsc_featured .item_text h3 {
1775
- font-size: 1.4em;
1776
- margin: 0px 0px 8px 0px;
1777
- }
1778
-
1779
- .wpsc_featured .item_text div.pricedisplay {
1780
- color: #9B9A96;
1781
- line-height: normal;
1782
- display: block;
1783
- margin: 0px 0px 4px 0px;
1784
- }
1785
-
1786
- .wpsc_featured .item_text .wpsc_description {
1787
- font-size: 1em;
1788
- line-height: 24px;
1789
- display: block;
1790
- float: left;
1791
- width: auto;
1792
- color: #9B9A96;
1793
- font-family: Georgia, "Bitstream Charter", serif;
1794
- }
1795
-
1796
- .wpsc_featured .item_text .wpsc_description p {
1797
- margin-bottom: 0px;
1798
- }
1799
-
1800
- .wpsc_featured .item_text .wpsc_description a {
1801
- color: #9B9A96;
1802
- }
1803
-
1804
- ul.wpsc_categories {
1805
- clear: both;
1806
- }
1807
-
1808
- a.update_variations_action {
1809
- vertical-align: middle;
1810
- }
1811
-
1812
- #poststuff .inside p.update-variations {
1813
- display: none;
1814
- margin-top: 1em;
1815
- }
1816
-
1817
- #search-products {
1818
- width: auto;
1819
- float: right;
1820
- }
1821
-
1822
- .productnav {
1823
- height: 30px;
1824
- margin: 6px 0px 4px;
1825
- vertical-align: middle;
1826
- }
1827
-
1828
- #wpsc_stock_control_forms .edit_stock {
1829
- margin-top: 15px;
1830
- line-height: 16px;
1831
- }
1832
-
1833
- #wpsc_stock_control_forms .unpublish_when_none_left,
1834
- #wpsc_stock_control_forms .notify_when_none_left {
1835
- margin: 0.5em 0;
1836
- }
1837
-
1838
- #media-upload form p.help {
1839
- text-align: left;
1840
- clear: both;
1841
- }
1842
-
1843
- ul#category_list_li li:hover span.handle {
1844
- cursor: move;
1845
- }
1846
-
1847
- ul#category_list_li li span.handle {
1848
- float: left;
1849
- padding: 5px;
1850
- }
1851
-
1852
- .category_admin_list_img a.row-title {
1853
- text-decoration: none;
1854
- }
1855
-
1856
- .category_admin_list_img:hover div.row-actions {
1857
- visibility: visible;
1858
- }
1859
-
1860
- ul#category_list_li ul {
1861
- margin-left: 15px;
1862
- }
1863
-
1864
- .row-title img {
1865
- width: 30px;
1866
- float: left;
1867
- padding-right: 10px;
1868
- }
1869
-
1870
- .row-title {
1871
- margin-right: 5px;
1872
- }
1873
-
1874
- body.edit-php form#posts-filter {
1875
- min-width: 830px;
1876
- }
1877
-
1878
- input.wpsc_cat_image_size {
1879
- width: 40px
1880
- }
1881
-
1882
- input.wpsc_cat_box {
1883
- width: auto;
1884
- margin: 6px;
1885
- vertical-align: middle;
1886
- }
1887
-
1888
- .wpsc_ie_field {
1889
- width: 100%;
1890
- }
1891
-
1892
- .wpsc_inline_actions .loading_indicator {
1893
- position: relative;
1894
- top: 3px;
1895
- left: 2px;
1896
- visibility: hidden;
1897
- }
1898
-
1899
- table.tags th#image {
1900
- width: 60px;
1901
- }
1902
-
1903
-
1904
- /**
1905
- * Quick and bulk edit product
1906
- */
1907
-
1908
- #wpbody-content .bulk-edit-row-post fieldset.wpsc-cols {
1909
- width: 49%;
1910
- margin-top: 0;
1911
- }
1912
-
1913
- #wpbody-content .quick-edit-row-post .inline-edit-col-left {
1914
- width: 35%;
1915
- }
1916
-
1917
- .bulk-edit-row-post fieldset.inline-edit-col-right label span.title {
1918
- padding-right: 0.5em;
1919
- width: auto;
1920
- }
1921
-
1922
- .wpsc-quick-edit {
1923
- width: 30%;
1924
- float: left;
1925
- }
1926
-
1927
- textarea.tax_input_product_tag {
1928
- width: 50% !important;
1929
- height: 95px !important;
1930
- }
1931
-
1932
- ul.wpsc_product_category-checklist {
1933
- height: 280px;
1934
- }
1935
-
1936
- span.wpsc-quick-edit {
1937
- width: 77px;
1938
- display: block;
1939
- float: left;
1940
- }
1941
-
1942
- .wpsc_var_description {
1943
- margin: 20px 0 0 20px !important;
1944
- color: red;
1945
- }
1946
-
1947
- .ajax-loading {
1948
- visibility: hidden;
1949
- }
1950
-
1951
- #cart_options .delete {
1952
- color: #c00;
1953
- float: right;
1954
- }
1955
-
1956
- #cart_options .delete:hover {
1957
- color: #D54E21;
1958
- }
1959
-
1960
- .dashboard_page_wpsc-update .wpsc-progress-bar {
1961
- position: relative;
1962
- height: 20px;
1963
- width: 300px;
1964
- border: 1px solid #3a58cf;
1965
- margin: -0.75em 0 27px;
1966
- }
1967
-
1968
- .dashboard_page_wpsc-update .wpsc-progress-bar * {
1969
- position: absolute;
1970
- left: 0;
1971
- top: 0;
1972
- background: #f9f9f9;
1973
- font-size: 12px;
1974
- }
1975
-
1976
- .dashboard_page_wpsc-update .wpsc-progress-bar .block {
1977
- background-color: #527dff;
1978
- z-index: -1;
1979
- height: 20px;
1980
- }
1981
-
1982
- .dashboard_page_wpsc-update .wpsc-progress-bar span {
1983
- display: block;
1984
- left: 310px;
1985
- line-height: 20px;
1986
- width: 200px;
1987
- }
1988
-
1989
- .dashboard_page_wpsc-update .wpsc-progress-bar .eta {
1990
- top: 22px;
1991
- line-height: 15px;
1992
- width: 100%;
1993
- }
1994
-
1995
- .downloadables_float {
1996
- float: right;
1997
- width: 80px;
1998
- vertical-align: middle;
1999
- }
2000
-
2001
- .downloadables_headding1 {
2002
- display: inline;
2003
- float: left;
2004
- text-align: left;
2005
- vertical-align: middle;
2006
- width: auto;
2007
- }
2008
-
2009
- img.ajax-feedback-active {
2010
- vertical-align: middle;
2011
- visibility: visible;
2012
- }
2013
-
2014
- .dashboard_page_wpsc-purchase-logs .column-id {
2015
- width: 75px;
2016
- }
2017
-
2018
- .dashboard_page_wpsc-purchase-logs .column-amount {
2019
- width: 100px;
2020
- }
2021
-
2022
- .js table.purchase-logs td.column-status span,
2023
- table.purchase-logs .column-status select {
2024
- display: none;
2025
- }
2026
-
2027
- .js table.purchase-logs .column-status select {
2028
- display: inline-block;
2029
- margin-right: 5px;
2030
- }
2031
-
2032
- table.purchase-logs .column-tracking .empty {
2033
- position: relative;
2034
- }
2035
-
2036
- table.purchase-logs .column-tracking .empty .send-email {
2037
- display: none;
2038
- }
2039
-
2040
- table.purchase-logs .column-tracking .add {
2041
- position: absolute;
2042
- left: 6px;
2043
- top: 4px;
2044
- }
2045
-
2046
- table.purchase-logs .column-tracking {
2047
- width: 200px;
2048
- }
2049
-
2050
- table.purchase-logs .column-tracking input[type="text"] {
2051
- width: 180px;
2052
- }
2053
-
2054
- table.purchase-logs .column-tracking a.save {
2055
- display: none;
2056
- float: right;
2057
- }
2058
-
2059
- table.purchase-logs .column-tracking a.add {
2060
- display: none;
2061
- color: #ccc;
2062
- cursor: text;
2063
- }
2064
-
2065
- table.purchase-logs .column-tracking .empty a.add {
2066
- display: inline;
2067
- }
2068
-
2069
- table.purchase-logs .column-tracking .ajax-feedback {
2070
- display: none;
2071
- float: right;
2072
- margin-top: 5px;
2073
- }
2074
-
2075
- table.purchase-logs .column-tracking .ajax-feedback-active {
2076
- display: inline-block;
2077
- }
2078
-
2079
- table.purchase-logs .column-tracking em.sent {
2080
- color: green;
2081
- }
2082
-
2083
- table.purchase-logs .column-id .delete {
2084
- color: red;
2085
- visibility: hidden;
2086
- }
2087
-
2088
- table.purchase-logs tr:hover .column-id .delete {
2089
- visibility: visible;
2090
- }
2091
-
2092
-
2093
- /**
2094
- * Product Variations
2095
- */
2096
-
2097
- .no-js #wpsc_product_variation_forms iframe {
2098
- height: 300px;
2099
- }
2100
-
2101
- .js #wpsc_product_variation_forms iframe {
2102
- border: 0;
2103
- margin: 0;
2104
- overflow: hidden;
2105
- padding: 0;
2106
- }
2107
-
2108
- #wpsc_product_variation_forms .inside {
2109
- margin: 0;
2110
- padding: 0 12px 0 12px;
2111
- }
2112
-
2113
- #wpsc_product_variation_forms iframe {
2114
- background: transparent;
2115
- width: 100%;
2116
- }
2117
-
2118
- .wpsc-product-variation-iframe {
2119
- min-width: 400px;
2120
- padding: 6px 0 12px 0;
2121
- overflow:hidden;
2122
- }
2123
-
2124
- #wpsc-product-variations-wrapper .tablenav.top {
2125
- margin-top: 0;
2126
- }
2127
-
2128
- .wpsc-save-variations-top {
2129
- float: right;
2130
- margin: 8px 0 5px;
2131
- }
2132
-
2133
- #wpsc-product-variations-wrapper .column-stock input[type="text"],
2134
- #wpsc-product-variations-wrapper .column-tax input[type="text"],
2135
- #wpsc-product-variations-wrapper .column-price input[type="text"],
2136
- #wpsc-product-variations-wrapper .column-sale_price input[type="text"],
2137
- #wpsc-product-variations-wrapper .column-sku input[type="text"] {
2138
- width: 100%;
2139
- -webkit-box-sizing: border-box;
2140
- -moz-box-sizing: border-box;
2141
- -o-box-sizing: border-box;
2142
- box-sizing: border-box;
2143
- }
2144
-
2145
- #wpsc-product-variations-wrapper .inline-edit-row.column-stock input[type="text"],
2146
- #wpsc-product-variations-wrapper .inline-edit-row.column-tax input[type="text"],
2147
- #wpsc-product-variations-wrapper .inline-edit-row.column-price input[type="text"],
2148
- #wpsc-product-variations-wrapper .inline-edit-row.column-sale_price input[type="text"],
2149
- #wpsc-product-variations-wrapper .inline-edit-row.column-sku input[type="text"] {
2150
- width: 60%;
2151
- }
2152
-
2153
- #wpsc-product-variations-wrapper .column-stock,
2154
- #wpsc-product-variations-wrapper .column-tax,
2155
- #wpsc-product-variations-wrapper .column-price,
2156
- #wpsc-product-variations-wrapper .column-sale_price,
2157
- #wpsc-product-variations-wrapper .column-sku {
2158
- text-align: center;
2159
- width: 11%;
2160
- }
2161
-
2162
- #wpsc-product-variations-wrapper .column-stock input,
2163
- #wpsc-product-variations-wrapper .column-tax input,
2164
- #wpsc-product-variations-wrapper .column-price input,
2165
- #wpsc-product-variations-wrapper .column-sale_price input,
2166
- #wpsc-product-variations-wrapper .column-sku input {
2167
- text-align: right;
2168
- }
2169
-
2170
- .js #wpsc-product-variations-wrapper tbody .active td,
2171
- .js #wpsc-product-variations-wrapper tbody .active th {
2172
- border-bottom-style: dashed;
2173
- }
2174
-
2175
- #wpsc-product-variations-wrapper div.updated,
2176
- #wpsc-product-variations-wrapper div.error {
2177
- margin: 15px 0 2px;
2178
- }
2179
-
2180
- .js #wpsc-product-variations-wrapper .wpsc-stock-editor-row {
2181
- display: none;
2182
- }
2183
-
2184
- #wpsc-product-variations-wrapper .wpsc-stock-editor-row td {
2185
- border-bottom-style: solid;
2186
- }
2187
-
2188
- #wpsc-product-variations-wrapper {
2189
- padding-bottom: 5px;
2190
- }
2191
-
2192
- #wpsc-product-variations-wrapper .submit {
2193
- margin: 0;
2194
- padding: 0;
2195
- }
2196
-
2197
- .wpsc-stock-editor .inside {
2198
- overflow: hidden;
2199
- }
2200
-
2201
- .wpsc-stock-editor .wpsc-product-shipping-section {
2202
- vertical-align: top;
2203
- }
2204
-
2205
- .wpsc-stock-editor .wpsc-form-field {
2206
- clear: both;
2207
- }
2208
-
2209
- .wpsc-stock-editor .wpsc-form-field label {
2210
- width: 150px;
2211
- }
2212
-
2213
- .wpsc-stock-editor .wpsc-form-field input[type="number"] {
2214
- width: 70px;
2215
- }
2216
-
2217
- .wpsc-stock-editor .wpsc-product-shipping-section input[type="text"] {
2218
- text-align: right;
2219
- width: 50px;
2220
- }
2221
-
2222
- .wpsc-product-shipping-weight-dimensions label {
2223
- display: inline-block;
2224
- min-width: 60px;
2225
- }
2226
-
2227
- .wpsc-product-shipping-flat-rate label {
2228
- display: inline-block;
2229
- min-width: 160px;
2230
- }
2231
-
2232
- .wpsc-stock-editor {
2233
- overflow: hidden;
2234
- }
2235
-
2236
- .wpsc-stock-editor select {
2237
- min-width: 100px;
2238
- }
2239
-
2240
- .wpsc-product-variations-tabs {
2241
- margin: 0 0 1px 0;
2242
- width: 100%;
2243
- }
2244
-
2245
- .wpsc-product-variations-tabs:before,
2246
- .wpsc-product-variations-tabs:after {
2247
- display: table;
2248
- content: "";
2249
- }
2250
-
2251
- .wpsc-product-variations-tabs:after {
2252
- clear: both;
2253
- }
2254
-
2255
- .wpsc-product-variations-tabs li {
2256
- float: left;
2257
- margin: 5px 4px 0 0px;
2258
- }
2259
-
2260
- .wpsc-product-variations-tabs a {
2261
- display: block;
2262
- background-color: #f1f1f1;
2263
- border-color: #dfdfdf #dfdfdf #fff;
2264
- border-style: solid;
2265
- border-width: 1px 1px 0;
2266
- line-height: 1em;
2267
- color: #aaa;
2268
- padding: 5px 7px 3px;
2269
- text-decoration: none;
2270
- vertical-align: middle;
2271
- -webkit-border-top-right-radius: 3px;
2272
- -moz-border-top-right-radius: 3px;
2273
- border-top-right-radius: 3px;
2274
- -webkit-border-top-left-radius: 3px;
2275
- -moz-border-top-left-radius: 3px;
2276
- border-top-left-radius: 3px;
2277
- }
2278
-
2279
- .wpsc-product-variations-tabs a:hover {
2280
- color: #D54E21;
2281
- }
2282
-
2283
- .wpsc-product-variations-tabs .active a {
2284
- background: #fff;
2285
- border-bottom-width: 1px;
2286
- color: #333;
2287
- margin-bottom: -1px;
2288
- }
2289
-
2290
- .wpsc-product-variations-tab-content {
2291
- clear: both;
2292
- padding: 0 10px;
2293
- }
2294
-
2295
- .wpsc-save-product-variations.top {
2296
- margin: 8px 0 5px;
2297
- }
2298
-
2299
- .wpsc-save-product-variations.bottom {
2300
- float: none;
2301
- overflow: hidden;
2302
- padding-bottom: 5px;
2303
- }
2304
- .wpsc-save-product-variations.bottom input {
2305
- float: right;
2306
- }
2307
-
2308
- .wpsc-product-variation-thumbnail {
2309
- float: left;
2310
- height: 50px;
2311
- width: 50px;
2312
- }
2313
-
2314
- .wpsc-product-variation-thumbnail img {
2315
- max-height: 50px;
2316
- max-width: 50px;
2317
- }
2318
-
2319
- .wpsc-product-variation-title {
2320
- margin-left: 60px;
2321
- }
2322
-
2323
- .compat-field-wpsc_image_size input[type="radio"] {
2324
- width: auto;
2325
- margin-right:5px;
2326
- }
2327
-
2328
- .wpsc-button-round {
2329
- padding: 0 0 1px !important;
2330
- height: 28px !important;
2331
- text-align: center;
2332
- width: 28px !important;
2333
- -webkit-border-radius: 14px !important;
2334
- border-radius: 14px !important;
2335
- outline: 0 !important;
2336
- }
2337
-
2338
- /* Make the minus sign look balanced with the plus sign */
2339
-
2340
- .wpsc-button-minus {
2341
- font-weight: bold;
2342
- font-size: 10px !important;
2343
- }
2344
-
2345
- span.wpsc-button-round {
2346
- cursor: default !important;
2347
- opacity: 0.3;
2348
- }
2349
-
2350
- .wpsc-coupon-status-active {
2351
- color: #1be032;
2352
- }
2353
-
2354
- .wpsc-coupon-status-inactive {
2355
- color: #e01b1b;
2356
- }
2357
-
2358
- th.right-col {
2359
- text-align: right;
2360
- padding: 0;
2361
- }
2362
-
2363
- div.new_layer {
2364
- display: block;
2365
- margin-bottom: 10px;
2366
- }
2367
-
2368
- div.new_layer > * {
2369
- display: inline-block;
2370
- vertical-align: middle;
2371
- }
2372
-
2373
- div.new_layer select {
2374
- height: auto !important;
2375
- white-space: nowrap;
2376
- }
2377
-
2378
- body.edit-tags-php img.wpsc_category_image {
2379
- max-width: 256px;
2380
- max-height: 256px;
2381
- min-width: 128px;
2382
- }
2383
-
2384
- .wpsc-width-height-fields label {
2385
- display: inline;
2386
- }
2387
-
2388
-
2389
- /**
2390
- * Live Title Meta Box
2391
- */
2392
-
2393
- .wpsc_metabox_live_title {
2394
- position: absolute;
2395
- right: 30px;
2396
- }
2397
-
2398
- .wpsc_metabox_live_title > * {
2399
- float: right;
2400
- margin: 0px;
2401
- padding: 0px;
2402
- font-style: normal;
2403
- font-size: 13px;
2404
- color: #858585;
2405
- text-shadow: 1px 1px #fff;
2406
- }
2407
-
2408
- #wpsc_product_delivery_metabox_live_title,
2409
- #wpsc_product_details_metabox_live_title {
2410
- left: 170px;
2411
- }
2412
-
2413
- /**
2414
- * Product Price Meta Box
2415
- */
2416
-
2417
- .wpsc-categorydiv .tabs-panel {
2418
- max-height: none !important;
2419
- overflow: visible !important;
2420
- padding-top: 5px !important;
2421
- padding-bottom: 5px !important;
2422
- }
2423
-
2424
-
2425
- /**
2426
- * Product Delivery
2427
- */
2428
-
2429
- #wpsc_product_delivery-external_link th {
2430
- width: 50px;
2431
- }
2432
-
2433
- #wpsc_product_gallery li {
2434
- float: left;
2435
- margin-right: 10px;
2436
- cursor: move;
2437
- }
2438
-
2439
- /**
2440
- * Digital download table style
2441
- */
2442
-
2443
- #wpsc_digital_download_table {
2444
- margin-top: 10px;
2445
- margin-bottom: 15px;
2446
- }
2447
-
2448
- #wpsc_digital_download_table tfoot {
2449
- display: none;
2450
- }
2451
-
2452
- #wpsc_digital_download_table a,
2453
- #wpsc_digital_download_table img {
2454
- display: inline-block;
2455
- margin-right: 10px;
2456
- }
2457
-
2458
- #wpsc_digital_download_table span {
2459
- display: inline-block;
2460
- vertical-align: middle;
2461
- }
2462
-
2463
- #wpsc_digital_download_table img {
2464
- max-height: 20px;
2465
- vertical-align: middle;
2466
- }
2467
-
2468
- #wpsc_digital_download_action_th {
2469
- width: 120px;
2470
- }
2471
-
2472
-
2473
- /**
2474
- * Custom meta style
2475
- */
2476
-
2477
- #wpsc_product_meta_table {
2478
- margin-bottom: 10px;
2479
- margin-top: 10px;
2480
- }
2481
-
2482
- #wpsc_product_meta_table tfoot {
2483
- display: none;
2484
- }
2485
-
2486
- #wpsc_product_meta_table input {
2487
- width: 100%;
2488
- }
2489
-
2490
- a.wpsc_remove_meta {
2491
- color: red;
2492
- }
2493
-
2494
- #wpsc_custom_meta_name_th {
2495
- width: 250px;
2496
- }
2497
-
2498
- #wpsc_custom_meta_action_th {
2499
- width: 70px;
2500
- }
2501
-
2502
- .wpsc_fileUpload {
2503
- display: inline-block;
2504
- position: relative;
2505
- margin: 10px;
2506
- cursor: pointer;
2507
- }
2508
-
2509
- .wpsc_fileUpload input {
2510
- position: absolute;
2511
- top: 0;
2512
- bottom: 0;
2513
- right: 0;
2514
- left: 0;
2515
- margin: 0;
2516
- padding: 0;
2517
- font-size: 20px;
2518
- cursor: pointer;
2519
- opacity: 0;
2520
- filter: alpha(opacity=0);
2521
- }
2522
-
2523
- #wpsc_sku {
2524
- width: 100%;
2525
- }
2526
-
2527
-
2528
- /**
2529
- * WordPress 3.8 Responsiveness
2530
- */
2531
-
2532
- @media screen and ( max-width: 782px ) {
2533
-
2534
- /**
2535
- * Override responsiveness in variations iframe
2536
- */
2537
-
2538
- /* Buttons */
2539
- .wpsc-product-variation-iframe.wp-core-ui .button,
2540
- .wpsc-product-variation-iframe.wp-core-ui .button.button-large,
2541
- .wpsc-product-variation-iframe.wp-core-ui .button.button-small {
2542
- padding: 0px 10px 1px;
2543
- line-height: 2;
2544
- font-size: 13px;
2545
- vertical-align: top;
2546
- height: 28px;
2547
- margin-bottom: 0px;
2548
- }
2549
-
2550
- .wpsc-product-variation-iframe.wp-core-ui .button:active,
2551
- .wpsc-product-variation-iframe.wp-core-ui .button-large:active,
2552
- .wpsc-product-variation-iframe.wp-core-ui .button-small:active {
2553
- padding-top: 1px;
2554
- padding-bottom: 0;
2555
- }
2556
-
2557
- /* Categories Metabox */
2558
- .wpsc-product-variation-iframe ul.category-tabs {
2559
- margin: 12px 0 5px;
2560
- }
2561
-
2562
- .wpsc-product-variation-iframe ul.category-tabs li.tabs {
2563
- padding: 3px 5px 5px;
2564
- }
2565
-
2566
- /* Subsubsub Nav */
2567
- .wpsc-product-variation-iframe .subsubsub {
2568
- font-size: 13px;
2569
- margin: 8px 0px 0px;
2570
- }
2571
-
2572
- /* Form Tables */
2573
- .wpsc-product-variation-iframe input[type="checkbox"],
2574
- .wpsc-product-variation-iframe .widefat th input[type="checkbox"] {
2575
- padding: 0px;
2576
- }
2577
-
2578
- .wpsc-product-variation-iframe input[type="radio"],
2579
- .wpsc-product-variation-iframe input[type="checkbox"] {
2580
- width: 16px;
2581
- height: 16px;
2582
- }
2583
-
2584
- .wpsc-product-variation-iframe textarea,
2585
- .wpsc-product-variation-iframe input,
2586
- .wpsc-product-variation-iframe select {
2587
- font-size: 14px;
2588
- }
2589
-
2590
- .wpsc-product-variation-iframe input[type=checkbox]:checked:before,
2591
- .wpsc-product-variation-iframe .widefat th input[type=checkbox]:before {
2592
- font-size: 21px;
2593
- margin: -3px 0 0 -4px;
2594
- }
2595
-
2596
- .wpsc-product-variation-iframe input[type="text"],
2597
- .wpsc-product-variation-iframe input[type="search"],
2598
- .wpsc-product-variation-iframe input[type="password"],
2599
- .wpsc-product-variation-iframe input[type="number"] {
2600
- padding: 3px 5px;
2601
- }
2602
-
2603
- .wpsc-product-variation-iframe .tablenav.bottom .displaying-num {
2604
- font-size: 12px;
2605
- }
2606
-
2607
- }
2608
-
2609
-
2610
- /**
2611
- * Pre WordPress 3.8 Compatibility
2612
- */
2613
-
2614
-
2615
- .branch-3-7.wpsc-product-variation-iframe #post-body,
2616
- .branch-3-6.wpsc-product-variation-iframe #post-body {
2617
- background: #f5f5f5;
2618
- background-image: -webkit-gradient(linear,left bottom,left top,from(#f5f5f5),to(#f9f9f9));
2619
- background-image: -webkit-linear-gradient(bottom, #f5f5f5, #f9f9f9);
2620
- background-image: -moz-linear-gradient(bottom, #f5f5f5, #f9f9f9);
2621
- background-image: -o-linear-gradient(bottom, #f5f5f5, #f9f9f9);
2622
- background-image: linear-gradient(to top, #f5f5f5, #f9f9f9);
2623
- }
2624
-
2625
- .branch-3-7.wpsc-product-variation-iframe .widefat td.column-title,
2626
- .branch-3-6.wpsc-product-variation-iframe .widefat td.column-title {
2627
- padding-bottom: 5px;
2628
- }
2629
-
2630
- .branch-3-7 .wpsc-currency-layers td.remove a,
2631
- .branch-3-7 .wpsc-quantity-discounts td.remove a,
2632
- .branch-3-6 .wpsc-currency-layers td.remove a,
2633
- .branch-3-6 .wpsc-quantity-discounts td.remove a {
2634
- background: url(xit.gif) no-repeat 0 0;
2635
- display: inline-block;
2636
- margin-top: 7px;
2637
- overflow: hidden;
2638
- text-indent: -999px;
2639
- width: 10px;
2640
- height: 10px;
2641
- }
2642
-
2643
- .branch-3-7 .wpsc-currency-layers td.remove a:hover,
2644
- .branch-3-7 .wpsc-quantity-discounts td.remove a:hover,
2645
- .branch-3-6 .wpsc-currency-layers td.remove a:hover,
2646
- .branch-3-6 .wpsc-quantity-discounts td.remove a:hover {
2647
- background-position: -10px 0;
2648
- }
2649
-
2650
- .product_gallery_image_delete_button {
2651
- display: none;
2652
- }
2653
-
2654
- .list_gallery_image {
2655
- position: relative;
2656
- }
2657
-
2658
- .product_gallery_image_delete_button {
2659
- position: absolute;
2660
- right: 0;
2661
- top: 0;
2662
- font-size: 16px;
2663
- }
2664
-
2665
- .product_gallery_image_delete_button:hover,
2666
- .wpsc-remove-row button {
2667
- cursor: pointer
2668
- }
2669
-
2670
- .wpsc-refund-ui {
2671
- display: none;
2672
- }
2673
-
2674
- .wp-core-ui .wpsc-refund-ui .button {
2675
- margin-right: 5px;
2676
- }
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
trunk/wpsc-admin/css/arrows.png DELETED
Binary file
trunk/wpsc-admin/css/jquery.ui.datepicker-classic.css DELETED
@@ -1,579 +0,0 @@
1
- /*
2
- * jQuery UI CSS Framework 1.8.16
3
- *
4
- * Copyright 2011, AUTHORS.txt (http://jqueryui.com/about)
5
- * Dual licensed under the MIT or GPL Version 2 licenses.
6
- * http://jquery.org/license
7
- *
8
- * http://docs.jquery.com/UI/Theming/API
9
- *
10
- * Credit goes to Helen Hou-Sandi:
11
- * https://github.com/helenhousandi/wp-admin-jquery-ui
12
- *
13
- */
14
-
15
- /* Layout helpers
16
- ----------------------------------*/
17
- .ui-helper-hidden { display: none; }
18
- .ui-helper-hidden-accessible { position: absolute !important; clip: rect(1px 1px 1px 1px); clip: rect(1px,1px,1px,1px); }
19
- .ui-helper-reset { margin: 0; padding: 0; border: 0; outline: 0; line-height: 1.3; text-decoration: none; font-size: 100%; list-style: none; }
20
- .ui-helper-clearfix:after { content: "."; display: block; height: 0; clear: both; visibility: hidden; }
21
- .ui-helper-clearfix { display: inline-block; }
22
- /* required comment for clearfix to work in Opera \*/
23
- * html .ui-helper-clearfix { height:1%; }
24
- .ui-helper-clearfix { display:block; }
25
- /* end clearfix */
26
- .ui-helper-zfix { width: 100%; height: 100%; top: 0; left: 0; position: absolute; opacity: 0; filter:Alpha(Opacity=0); }
27
-
28
-
29
- /* Interaction Cues
30
- ----------------------------------*/
31
- .ui-state-disabled { cursor: default !important; }
32
-
33
-
34
- /* Icons
35
- ----------------------------------*/
36
-
37
- /* states and images */
38
- .ui-icon { display: block; text-indent: -99999px; overflow: hidden; background-repeat: no-repeat; }
39
-
40
-
41
- /* Misc visuals
42
- ----------------------------------*/
43
-
44
- /* Overlays */
45
- .ui-widget-overlay { position: absolute; top: 0; left: 0; width: 100%; height: 100%; }
46
-
47
-
48
- /*
49
- * jQuery UI CSS Framework 1.8.16
50
- *
51
- * Copyright 2011, AUTHORS.txt (http://jqueryui.com/about)
52
- * Dual licensed under the MIT or GPL Version 2 licenses.
53
- * http://jquery.org/license
54
- *
55
- * http://docs.jquery.com/UI/Theming/API
56
- *
57
- * To view and modify this theme, visit http://jqueryui.com/themeroller/?ffDefault=sans-serif&fwDefault=normal&fsDefault=12px&cornerRadius=3px&bgColorHeader=eff8ff&bgTextureHeader=04_highlight_hard.png&bgImgOpacityHeader=75&borderColorHeader=d1e5ee&fcHeader=333333&iconColorHeader=21759b&bgColorContent=ffffff&bgTextureContent=01_flat.png&bgImgOpacityContent=75&borderColorContent=d1e5ee&fcContent=333333&iconColorContent=333333&bgColorDefault=eff8ff&bgTextureDefault=04_highlight_hard.png&bgImgOpacityDefault=75&borderColorDefault=d1e5ee&fcDefault=333333&iconColorDefault=333333&bgColorHover=f7fcfe&bgTextureHover=06_inset_hard.png&bgImgOpacityHover=75&borderColorHover=b8d7e5&fcHover=000000&iconColorHover=333333&bgColorActive=ffffff&bgTextureActive=01_flat.png&bgImgOpacityActive=65&borderColorActive=d1e5ee&fcActive=333333&iconColorActive=333333&bgColorHighlight=ffffe0&bgTextureHighlight=01_flat.png&bgImgOpacityHighlight=55&borderColorHighlight=e6db55&fcHighlight=333333&iconColorHighlight=21759b&bgColorError=ffebe8&bgTextureError=01_flat.png&bgImgOpacityError=95&borderColorError=cc0000&fcError=cc0000&iconColorError=cc0000&bgColorOverlay=aaaaaa&bgTextureOverlay=01_flat.png&bgImgOpacityOverlay=0&opacityOverlay=30&bgColorShadow=aaaaaa&bgTextureShadow=01_flat.png&bgImgOpacityShadow=0&opacityShadow=30&thicknessShadow=8px&offsetTopShadow=-8px&offsetLeftShadow=-8px&cornerRadiusShadow=3px
58
- */
59
-
60
-
61
- /* Component containers
62
- ----------------------------------*/
63
- .ui-widget { font-family: sans-serif; font-size: 12px; }
64
- .ui-widget .ui-widget { font-size: 1em; }
65
- .ui-widget input, .ui-widget select, .ui-widget textarea, .ui-widget button { font-family: sans-serif; font-size: 1em; }
66
- .ui-widget-content { border: 1px solid #d1e5ee; background: #ffffff; color: #333333; }
67
- .ui-widget-header { border: 1px solid #d1e5ee; background-color: #f5fafd; background-image: -ms-linear-gradient(top, #f7fcfe, #eff8ff); background-image: -moz-linear-gradient(top, #f7fcfe, #eff8ff); background-image: -o-linear-gradient(top, #f7fcfe, #eff8ff); background-image: -webkit-gradient(linear, left top, left bottom, from(#f7fcfe), to(#eff8ff)); background-image: -webkit-linear-gradient(top, #f7fcfe, #eff8ff); background-image: linear-gradient(top, #f7fcfe, #eff8ff); color: #333333; font-weight: bold; }
68
- .ui-widget-header a { color: #333333; }
69
-
70
- /* Interaction states
71
- ----------------------------------*/
72
- .ui-state-default, .ui-widget-content .ui-state-default, .ui-widget-header .ui-state-default { border: 1px solid #d1e5ee; background-color: #f5fafd; background-image: -ms-linear-gradient(top, #f7fcfe, #eff8ff); background-image: -moz-linear-gradient(top, #f7fcfe, #eff8ff); background-image: -o-linear-gradient(top, #f7fcfe, #eff8ff); background-image: -webkit-gradient(linear, left top, left bottom, from(#f7fcfe), to(#eff8ff)); background-image: -webkit-linear-gradient(top, #f7fcfe, #eff8ff); background-image: linear-gradient(top, #f7fcfe, #eff8ff); font-weight: normal; color: #333333; }
73
- .ui-state-default a, .ui-state-default a:link, .ui-state-default a:visited { color: #333333; text-decoration: none; }
74
- .ui-state-hover, .ui-widget-content .ui-state-hover, .ui-widget-header .ui-state-hover, .ui-state-focus, .ui-widget-content .ui-state-focus, .ui-widget-header .ui-state-focus { border: 1px solid #b8d7e5; background-color: #f7fcfe; background-image: -ms-linear-gradient(top, #eff8ff, #f7fcfe); background-image: -moz-linear-gradient(top, #eff8ff, #f7fcfe); background-image: -o-linear-gradient(top, #eff8ff, #f7fcfe); background-image: -webkit-gradient(linear, left top, left bottom, from(#eff8ff), to(#f7fcfe)); background-image: -webkit-linear-gradient(top, #eff8ff, #f7fcfe); background-image: linear-gradient(top, #eff8ff, #f7fcfe);; font-weight: normal; color: #000000; }
75
- .ui-state-hover a, .ui-state-hover a:hover { color: #000000; text-decoration: none; }
76
- .ui-state-active, .ui-widget-content .ui-state-active, .ui-widget-header .ui-state-active { border: 1px solid #d1e5ee; background: #ffffff; font-weight: normal; color: #333333; }
77
- .ui-state-active a, .ui-state-active a:link, .ui-state-active a:visited { color: #333333; text-decoration: none; }
78
- .ui-widget :active { outline: none; }
79
-
80
- /* Interaction Cues
81
- ----------------------------------*/
82
- .ui-state-highlight, .ui-widget-content .ui-state-highlight, .ui-widget-header .ui-state-highlight {border: 1px solid #e6db55; background: #ffffe0; color: #333333; }
83
- .ui-state-highlight a, .ui-widget-content .ui-state-highlight a,.ui-widget-header .ui-state-highlight a { color: #333333; }
84
- .ui-state-error, .ui-widget-content .ui-state-error, .ui-widget-header .ui-state-error {border: 1px solid #cc0000; background: #ffebe8; color: #cc0000; }
85
- .ui-state-error a, .ui-widget-content .ui-state-error a, .ui-widget-header .ui-state-error a { color: #cc0000; }
86
- .ui-state-error-text, .ui-widget-content .ui-state-error-text, .ui-widget-header .ui-state-error-text { color: #cc0000; }
87
- .ui-priority-primary, .ui-widget-content .ui-priority-primary, .ui-widget-header .ui-priority-primary { font-weight: bold; }
88
- .ui-priority-secondary, .ui-widget-content .ui-priority-secondary, .ui-widget-header .ui-priority-secondary { opacity: .7; filter:Alpha(Opacity=70); font-weight: normal; }
89
- .ui-state-disabled, .ui-widget-content .ui-state-disabled, .ui-widget-header .ui-state-disabled { opacity: .35; filter:Alpha(Opacity=35); background-image: none; }
90
-
91
- /* Icons
92
- ----------------------------------*/
93
-
94
- /* states and images */
95
- .ui-icon { width: 16px; height: 16px; background-image: url(ui-images/ui-icons_333333_256x240.png); }
96
- .ui-widget-content .ui-icon {background-image: url(ui-images/ui-icons_333333_256x240.png); }
97
- .ui-widget-header .ui-icon {background-image: url(ui-images/ui-icons_999999_256x240.png); }
98
- .ui-state-default .ui-icon { background-image: url(ui-images/ui-icons_333333_256x240.png); }
99
- .ui-state-hover .ui-icon, .ui-state-focus .ui-icon {background-image: url(ui-images/ui-icons_333333_256x240.png); }
100
- .ui-state-active .ui-icon {background-image: url(ui-images/ui-icons_333333_256x240.png); }
101
- .ui-state-highlight .ui-icon {background-image: url(ui-images/ui-icons_21759b_256x240.png); }
102
- .ui-state-error .ui-icon, .ui-state-error-text .ui-icon {background-image: url(ui-images/ui-icons_cc0000_256x240.png); }
103
-
104
- /* positioning */
105
- .ui-icon-carat-1-n { background-position: 0 0; }
106
- .ui-icon-carat-1-ne { background-position: -16px 0; }
107
- .ui-icon-carat-1-e { background-position: -32px 0; }
108
- .ui-icon-carat-1-se { background-position: -48px 0; }
109
- .ui-icon-carat-1-s { background-position: -64px 0; }
110
- .ui-icon-carat-1-sw { background-position: -80px 0; }
111
- .ui-icon-carat-1-w { background-position: -96px 0; }
112
- .ui-icon-carat-1-nw { background-position: -112px 0; }
113
- .ui-icon-carat-2-n-s { background-position: -128px 0; }
114
- .ui-icon-carat-2-e-w { background-position: -144px 0; }
115
- .ui-icon-triangle-1-n { background-position: 0 -16px; }
116
- .ui-icon-triangle-1-ne { background-position: -16px -16px; }
117
- .ui-icon-triangle-1-e { background-position: -32px -16px; }
118
- .ui-icon-triangle-1-se { background-position: -48px -16px; }
119
- .ui-icon-triangle-1-s { background-position: -64px -16px; }
120
- .ui-icon-triangle-1-sw { background-position: -80px -16px; }
121
- .ui-icon-triangle-1-w { background-position: -96px -16px; }
122
- .ui-icon-triangle-1-nw { background-position: -112px -16px; }
123
- .ui-icon-triangle-2-n-s { background-position: -128px -16px; }
124
- .ui-icon-triangle-2-e-w { background-position: -144px -16px; }
125
- .ui-icon-arrow-1-n { background-position: 0 -32px; }
126
- .ui-icon-arrow-1-ne { background-position: -16px -32px; }
127
- .ui-icon-arrow-1-e { background-position: -32px -32px; }
128
- .ui-icon-arrow-1-se { background-position: -48px -32px; }
129
- .ui-icon-arrow-1-s { background-position: -64px -32px; }
130
- .ui-icon-arrow-1-sw { background-position: -80px -32px; }
131
- .ui-icon-arrow-1-w { background-position: -96px -32px; }
132
- .ui-icon-arrow-1-nw { background-position: -112px -32px; }
133
- .ui-icon-arrow-2-n-s { background-position: -128px -32px; }
134
- .ui-icon-arrow-2-ne-sw { background-position: -144px -32px; }
135
- .ui-icon-arrow-2-e-w { background-position: -160px -32px; }
136
- .ui-icon-arrow-2-se-nw { background-position: -176px -32px; }
137
- .ui-icon-arrowstop-1-n { background-position: -192px -32px; }
138
- .ui-icon-arrowstop-1-e { background-position: -208px -32px; }
139
- .ui-icon-arrowstop-1-s { background-position: -224px -32px; }
140
- .ui-icon-arrowstop-1-w { background-position: -240px -32px; }
141
- .ui-icon-arrowthick-1-n { background-position: 0 -48px; }
142
- .ui-icon-arrowthick-1-ne { background-position: -16px -48px; }
143
- .ui-icon-arrowthick-1-e { background-position: -32px -48px; }
144
- .ui-icon-arrowthick-1-se { background-position: -48px -48px; }
145
- .ui-icon-arrowthick-1-s { background-position: -64px -48px; }
146
- .ui-icon-arrowthick-1-sw { background-position: -80px -48px; }
147
- .ui-icon-arrowthick-1-w { background-position: -96px -48px; }
148
- .ui-icon-arrowthick-1-nw { background-position: -112px -48px; }
149
- .ui-icon-arrowthick-2-n-s { background-position: -128px -48px; }
150
- .ui-icon-arrowthick-2-ne-sw { background-position: -144px -48px; }
151
- .ui-icon-arrowthick-2-e-w { background-position: -160px -48px; }
152
- .ui-icon-arrowthick-2-se-nw { background-position: -176px -48px; }
153
- .ui-icon-arrowthickstop-1-n { background-position: -192px -48px; }
154
- .ui-icon-arrowthickstop-1-e { background-position: -208px -48px; }
155
- .ui-icon-arrowthickstop-1-s { background-position: -224px -48px; }
156
- .ui-icon-arrowthickstop-1-w { background-position: -240px -48px; }
157
- .ui-icon-arrowreturnthick-1-w { background-position: 0 -64px; }
158
- .ui-icon-arrowreturnthick-1-n { background-position: -16px -64px; }
159
- .ui-icon-arrowreturnthick-1-e { background-position: -32px -64px; }
160
- .ui-icon-arrowreturnthick-1-s { background-position: -48px -64px; }
161
- .ui-icon-arrowreturn-1-w { background-position: -64px -64px; }
162
- .ui-icon-arrowreturn-1-n { background-position: -80px -64px; }
163
- .ui-icon-arrowreturn-1-e { background-position: -96px -64px; }
164
- .ui-icon-arrowreturn-1-s { background-position: -112px -64px; }
165
- .ui-icon-arrowrefresh-1-w { background-position: -128px -64px; }
166
- .ui-icon-arrowrefresh-1-n { background-position: -144px -64px; }
167
- .ui-icon-arrowrefresh-1-e { background-position: -160px -64px; }
168
- .ui-icon-arrowrefresh-1-s { background-position: -176px -64px; }
169
- .ui-icon-arrow-4 { background-position: 0 -80px; }
170
- .ui-icon-arrow-4-diag { background-position: -16px -80px; }
171
- .ui-icon-extlink { background-position: -32px -80px; }
172
- .ui-icon-newwin { background-position: -48px -80px; }
173
- .ui-icon-refresh { background-position: -64px -80px; }
174
- .ui-icon-shuffle { background-position: -80px -80px; }
175
- .ui-icon-transfer-e-w { background-position: -96px -80px; }
176
- .ui-icon-transferthick-e-w { background-position: -112px -80px; }
177
- .ui-icon-folder-collapsed { background-position: 0 -96px; }
178
- .ui-icon-folder-open { background-position: -16px -96px; }
179
- .ui-icon-document { background-position: -32px -96px; }
180
- .ui-icon-document-b { background-position: -48px -96px; }
181
- .ui-icon-note { background-position: -64px -96px; }
182
- .ui-icon-mail-closed { background-position: -80px -96px; }
183
- .ui-icon-mail-open { background-position: -96px -96px; }
184
- .ui-icon-suitcase { background-position: -112px -96px; }
185
- .ui-icon-comment { background-position: -128px -96px; }
186
- .ui-icon-person { background-position: -144px -96px; }
187
- .ui-icon-print { background-position: -160px -96px; }
188
- .ui-icon-trash { background-position: -176px -96px; }
189
- .ui-icon-locked { background-position: -192px -96px; }
190
- .ui-icon-unlocked { background-position: -208px -96px; }
191
- .ui-icon-bookmark { background-position: -224px -96px; }
192
- .ui-icon-tag { background-position: -240px -96px; }
193
- .ui-icon-home { background-position: 0 -112px; }
194
- .ui-icon-flag { background-position: -16px -112px; }
195
- .ui-icon-calendar { background-position: -32px -112px; }
196
- .ui-icon-cart { background-position: -48px -112px; }
197
- .ui-icon-pencil { background-position: -64px -112px; }
198
- .ui-icon-clock { background-position: -80px -112px; }
199
- .ui-icon-disk { background-position: -96px -112px; }
200
- .ui-icon-calculator { background-position: -112px -112px; }
201
- .ui-icon-zoomin { background-position: -128px -112px; }
202
- .ui-icon-zoomout { background-position: -144px -112px; }
203
- .ui-icon-search { background-position: -160px -112px; }
204
- .ui-icon-wrench { background-position: -176px -112px; }
205
- .ui-icon-gear { background-position: -192px -112px; }
206
- .ui-icon-heart { background-position: -208px -112px; }
207
- .ui-icon-star { background-position: -224px -112px; }
208
- .ui-icon-link { background-position: -240px -112px; }
209
- .ui-icon-cancel { background-position: 0 -128px; }
210
- .ui-icon-plus { background-position: -16px -128px; }
211
- .ui-icon-plusthick { background-position: -32px -128px; }
212
- .ui-icon-minus { background-position: -48px -128px; }
213
- .ui-icon-minusthick { background-position: -64px -128px; }
214
- .ui-icon-close { background-position: -80px -128px; }
215
- .ui-icon-closethick { background-position: -96px -128px; }
216
- .ui-icon-key { background-position: -112px -128px; }
217
- .ui-icon-lightbulb { background-position: -128px -128px; }
218
- .ui-icon-scissors { background-position: -144px -128px; }
219
- .ui-icon-clipboard { background-position: -160px -128px; }
220
- .ui-icon-copy { background-position: -176px -128px; }
221
- .ui-icon-contact { background-position: -192px -128px; }
222
- .ui-icon-image { background-position: -208px -128px; }
223
- .ui-icon-video { background-position: -224px -128px; }
224
- .ui-icon-script { background-position: -240px -128px; }
225
- .ui-icon-alert { background-position: 0 -144px; }
226
- .ui-icon-info { background-position: -16px -144px; }
227
- .ui-icon-notice { background-position: -32px -144px; }
228
- .ui-icon-help { background-position: -48px -144px; }
229
- .ui-icon-check { background-position: -64px -144px; }
230
- .ui-icon-bullet { background-position: -80px -144px; }
231
- .ui-icon-radio-off { background-position: -96px -144px; }
232
- .ui-icon-radio-on { background-position: -112px -144px; }
233
- .ui-icon-pin-w { background-position: -128px -144px; }
234
- .ui-icon-pin-s { background-position: -144px -144px; }
235
- .ui-icon-play { background-position: 0 -160px; }
236
- .ui-icon-pause { background-position: -16px -160px; }
237
- .ui-icon-seek-next { background-position: -32px -160px; }
238
- .ui-icon-seek-prev { background-position: -48px -160px; }
239
- .ui-icon-seek-end { background-position: -64px -160px; }
240
- .ui-icon-seek-start { background-position: -80px -160px; }
241
- /* ui-icon-seek-first is deprecated, use ui-icon-seek-start instead */
242
- .ui-icon-seek-first { background-position: -80px -160px; }
243
- .ui-icon-stop { background-position: -96px -160px; }
244
- .ui-icon-eject { background-position: -112px -160px; }
245
- .ui-icon-volume-off { background-position: -128px -160px; }
246
- .ui-icon-volume-on { background-position: -144px -160px; }
247
- .ui-icon-power { background-position: 0 -176px; }
248
- .ui-icon-signal-diag { background-position: -16px -176px; }
249
- .ui-icon-signal { background-position: -32px -176px; }
250
- .ui-icon-battery-0 { background-position: -48px -176px; }
251
- .ui-icon-battery-1 { background-position: -64px -176px; }
252
- .ui-icon-battery-2 { background-position: -80px -176px; }
253
- .ui-icon-battery-3 { background-position: -96px -176px; }
254
- .ui-icon-circle-plus { background-position: 0 -192px; }
255
- .ui-icon-circle-minus { background-position: -16px -192px; }
256
- .ui-icon-circle-close { background-position: -32px -192px; }
257
- .ui-icon-circle-triangle-e { background-position: -48px -192px; }
258
- .ui-icon-circle-triangle-s { background-position: -64px -192px; }
259
- .ui-icon-circle-triangle-w { background-position: -80px -192px; }
260
- .ui-icon-circle-triangle-n { background-position: -96px -192px; }
261
- .ui-icon-circle-arrow-e { background-position: -112px -192px; }
262
- .ui-icon-circle-arrow-s { background-position: -128px -192px; }
263
- .ui-icon-circle-arrow-w { background-position: -144px -192px; }
264
- .ui-icon-circle-arrow-n { background-position: -160px -192px; }
265
- .ui-icon-circle-zoomin { background-position: -176px -192px; }
266
- .ui-icon-circle-zoomout { background-position: -192px -192px; }
267
- .ui-icon-circle-check { background-position: -208px -192px; }
268
- .ui-icon-circlesmall-plus { background-position: 0 -208px; }
269
- .ui-icon-circlesmall-minus { background-position: -16px -208px; }
270
- .ui-icon-circlesmall-close { background-position: -32px -208px; }
271
- .ui-icon-squaresmall-plus { background-position: -48px -208px; }
272
- .ui-icon-squaresmall-minus { background-position: -64px -208px; }
273
- .ui-icon-squaresmall-close { background-position: -80px -208px; }
274
- .ui-icon-grip-dotted-vertical { background-position: 0 -224px; }
275
- .ui-icon-grip-dotted-horizontal { background-position: -16px -224px; }
276
- .ui-icon-grip-solid-vertical { background-position: -32px -224px; }
277
- .ui-icon-grip-solid-horizontal { background-position: -48px -224px; }
278
- .ui-icon-gripsmall-diagonal-se { background-position: -64px -224px; }
279
- .ui-icon-grip-diagonal-se { background-position: -80px -224px; }
280
-
281
-
282
- /* Misc visuals
283
- ----------------------------------*/
284
-
285
- /* Corner radius */
286
- .ui-corner-all, .ui-corner-top, .ui-corner-left, .ui-corner-tl { -moz-border-radius-topleft: 3px; -webkit-border-top-left-radius: 3px; -khtml-border-top-left-radius: 3px; border-top-left-radius: 3px; }
287
- .ui-corner-all, .ui-corner-top, .ui-corner-right, .ui-corner-tr { -moz-border-radius-topright: 3px; -webkit-border-top-right-radius: 3px; -khtml-border-top-right-radius: 3px; border-top-right-radius: 3px; }
288
- .ui-corner-all, .ui-corner-bottom, .ui-corner-left, .ui-corner-bl { -moz-border-radius-bottomleft: 3px; -webkit-border-bottom-left-radius: 3px; -khtml-border-bottom-left-radius: 3px; border-bottom-left-radius: 3px; }
289
- .ui-corner-all, .ui-corner-bottom, .ui-corner-right, .ui-corner-br { -moz-border-radius-bottomright: 3px; -webkit-border-bottom-right-radius: 3px; -khtml-border-bottom-right-radius: 3px; border-bottom-right-radius: 3px; }
290
-
291
- /* Overlays */
292
- .ui-widget-overlay { background: #000000; opacity: .6;filter:Alpha(Opacity=60); }
293
- .ui-widget-shadow { box-shadow: 0 0 16px rgba(0, 0, 0, 0.3); }/*
294
- * jQuery UI Resizable 1.8.16
295
- *
296
- * Copyright 2011, AUTHORS.txt (http://jqueryui.com/about)
297
- * Dual licensed under the MIT or GPL Version 2 licenses.
298
- * http://jquery.org/license
299
- *
300
- * http://docs.jquery.com/UI/Resizable#theming
301
- */
302
- .ui-resizable { position: relative;}
303
- .ui-resizable-handle { position: absolute;font-size: 0.1px;z-index: 99999; display: block; }
304
- .ui-resizable-disabled .ui-resizable-handle, .ui-resizable-autohide .ui-resizable-handle { display: none; }
305
- .ui-resizable-n { cursor: n-resize; height: 7px; width: 100%; top: -5px; left: 0; }
306
- .ui-resizable-s { cursor: s-resize; height: 7px; width: 100%; bottom: -5px; left: 0; }
307
- .ui-resizable-e { cursor: e-resize; width: 7px; right: -5px; top: 0; height: 100%; }
308
- .ui-resizable-w { cursor: w-resize; width: 7px; left: -5px; top: 0; height: 100%; }
309
- .ui-resizable-se { cursor: se-resize; width: 12px; height: 12px; right: 1px; bottom: 1px; }
310
- .ui-resizable-sw { cursor: sw-resize; width: 9px; height: 9px; left: -5px; bottom: -5px; }
311
- .ui-resizable-nw { cursor: nw-resize; width: 9px; height: 9px; left: -5px; top: -5px; }
312
- .ui-resizable-ne { cursor: ne-resize; width: 9px; height: 9px; right: -5px; top: -5px;}/*
313
- * jQuery UI Selectable 1.8.16
314
- *
315
- * Copyright 2011, AUTHORS.txt (http://jqueryui.com/about)
316
- * Dual licensed under the MIT or GPL Version 2 licenses.
317
- * http://jquery.org/license
318
- *
319
- * http://docs.jquery.com/UI/Selectable#theming
320
- */
321
- .ui-selectable-helper { position: absolute; z-index: 100; border:1px dotted black; }
322
- /*
323
- * jQuery UI Accordion 1.8.16
324
- *
325
- * Copyright 2011, AUTHORS.txt (http://jqueryui.com/about)
326
- * Dual licensed under the MIT or GPL Version 2 licenses.
327
- * http://jquery.org/license
328
- *
329
- * http://docs.jquery.com/UI/Accordion#theming
330
- */
331
- /* IE/Win - Fix animation bug - #4615 */
332
- .ui-accordion { width: 100%; }
333
- .ui-accordion .ui-accordion-header { cursor: pointer; position: relative; margin-top: 1px; zoom: 1; }
334
- .ui-accordion .ui-accordion-li-fix { display: inline; }
335
- .ui-accordion .ui-accordion-header-active { border-bottom: 0 !important; }
336
- .ui-accordion .ui-accordion-header a { display: block; font-size: 1em; padding: .5em .5em .5em .7em; }
337
- .ui-accordion-icons .ui-accordion-header a { padding-left: 2.2em; }
338
- .ui-accordion .ui-accordion-header .ui-icon { position: absolute; left: .5em; top: 50%; margin-top: -8px; }
339
- .ui-accordion .ui-accordion-content { padding: 1em 2.2em; border-top: 0; margin-top: -2px; position: relative; top: 1px; margin-bottom: 2px; overflow: auto; display: none; zoom: 1; }
340
- .ui-accordion .ui-accordion-content-active { display: block; }
341
- /*
342
- * jQuery UI Autocomplete 1.8.16
343
- *
344
- * Copyright 2011, AUTHORS.txt (http://jqueryui.com/about)
345
- * Dual licensed under the MIT or GPL Version 2 licenses.
346
- * http://jquery.org/license
347
- *
348
- * http://docs.jquery.com/UI/Autocomplete#theming
349
- */
350
- .ui-autocomplete { position: absolute; cursor: default; }
351
-
352
- /* workarounds */
353
- * html .ui-autocomplete { width:1px; } /* without this, the menu expands to 100% in IE6 */
354
-
355
- /*
356
- * jQuery UI Menu 1.8.16
357
- *
358
- * Copyright 2010, AUTHORS.txt (http://jqueryui.com/about)
359
- * Dual licensed under the MIT or GPL Version 2 licenses.
360
- * http://jquery.org/license
361
- *
362
- * http://docs.jquery.com/UI/Menu#theming
363
- */
364
- .ui-menu {
365
- list-style:none;
366
- padding: 2px;
367
- margin: 0;
368
- display:block;
369
- float: left;
370
- }
371
- .ui-menu .ui-menu {
372
- margin-top: -3px;
373
- }
374
- .ui-menu .ui-menu-item {
375
- margin:0;
376
- padding: 0;
377
- zoom: 1;
378
- float: left;
379
- clear: left;
380
- width: 100%;
381
- }
382
- .ui-menu .ui-menu-item a {
383
- text-decoration:none;
384
- display:block;
385
- padding:.2em .4em;
386
- line-height:1.5;
387
- zoom:1;
388
- }
389
- .ui-menu .ui-menu-item a.ui-state-hover,
390
- .ui-menu .ui-menu-item a.ui-state-active {
391
- font-weight: normal;
392
- margin: -1px;
393
- }
394
- /*
395
- * jQuery UI Button 1.8.16
396
- *
397
- * Copyright 2011, AUTHORS.txt (http://jqueryui.com/about)
398
- * Dual licensed under the MIT or GPL Version 2 licenses.
399
- * http://jquery.org/license
400
- *
401
- * http://docs.jquery.com/UI/Button#theming
402
- */
403
- .ui-button { display: inline-block; position: relative; padding: 0; margin-right: .1em; text-decoration: none !important; cursor: pointer; text-align: center; zoom: 1; overflow: visible; } /* the overflow property removes extra width in IE */
404
- .ui-button-icon-only { width: 2.2em; } /* to make room for the icon, a width needs to be set here */
405
- button.ui-button-icon-only { width: 2.4em; } /* button elements seem to need a little more width */
406
- .ui-button-icons-only { width: 3.4em; }
407
- button.ui-button-icons-only { width: 3.7em; }
408
-
409
- /*button text element */
410
- .ui-button .ui-button-text { display: block; line-height: 1.4; }
411
- .ui-button-text-only .ui-button-text { padding: .4em 1em; }
412
- .ui-button-icon-only .ui-button-text, .ui-button-icons-only .ui-button-text { padding: .4em; text-indent: -9999999px; }
413
- .ui-button-text-icon-primary .ui-button-text, .ui-button-text-icons .ui-button-text { padding: .4em 1em .4em 2.1em; }
414
- .ui-button-text-icon-secondary .ui-button-text, .ui-button-text-icons .ui-button-text { padding: .4em 2.1em .4em 1em; }
415
- .ui-button-text-icons .ui-button-text { padding-left: 2.1em; padding-right: 2.1em; }
416
- /* no icon support for input elements, provide padding by default */
417
- input.ui-button { padding: .4em 1em; }
418
-
419
- /*button icon element(s) */
420
- .ui-button-icon-only .ui-icon, .ui-button-text-icon-primary .ui-icon, .ui-button-text-icon-secondary .ui-icon, .ui-button-text-icons .ui-icon, .ui-button-icons-only .ui-icon { position: absolute; top: 50%; margin-top: -8px; }
421
- .ui-button-icon-only .ui-icon { left: 50%; margin-left: -8px; }
422
- .ui-button-text-icon-primary .ui-button-icon-primary, .ui-button-text-icons .ui-button-icon-primary, .ui-button-icons-only .ui-button-icon-primary { left: .5em; }
423
- .ui-button-text-icon-secondary .ui-button-icon-secondary, .ui-button-text-icons .ui-button-icon-secondary, .ui-button-icons-only .ui-button-icon-secondary { right: .5em; }
424
- .ui-button-text-icons .ui-button-icon-secondary, .ui-button-icons-only .ui-button-icon-secondary { right: .5em; }
425
-
426
- /*button sets*/
427
- .ui-buttonset { margin-right: 7px; }
428
- .ui-buttonset .ui-button { margin-left: 0; margin-right: -.3em; }
429
-
430
- /* workarounds */
431
- button.ui-button::-moz-focus-inner { border: 0; padding: 0; } /* reset extra padding in Firefox */
432
- /*
433
- * jQuery UI Dialog 1.8.16
434
- *
435
- * Copyright 2011, AUTHORS.txt (http://jqueryui.com/about)
436
- * Dual licensed under the MIT or GPL Version 2 licenses.
437
- * http://jquery.org/license
438
- *
439
- * http://docs.jquery.com/UI/Dialog#theming
440
- */
441
- .ui-dialog { position: absolute; padding: .2em; width: 300px; overflow: hidden; }
442
- .ui-dialog .ui-dialog-titlebar { padding: .4em 1em; position: relative; }
443
- .ui-dialog .ui-dialog-title { float: left; margin: .1em 16px .1em 0; }
444
- .ui-dialog .ui-dialog-titlebar-close { position: absolute; right: .3em; top: 50%; width: 19px; margin: -10px 0 0 0; padding: 1px; height: 18px; }
445
- .ui-dialog .ui-dialog-titlebar-close span { display: block; margin: 1px; }
446
- .ui-dialog .ui-dialog-titlebar-close:hover, .ui-dialog .ui-dialog-titlebar-close:focus { padding: 0; }
447
- .ui-dialog .ui-dialog-content { position: relative; border: 0; padding: .5em 1em; background: none; overflow: auto; zoom: 1; }
448
- .ui-dialog .ui-dialog-buttonpane { text-align: left; border-width: 1px 0 0 0; background-image: none; margin: .5em 0 0 0; padding: .3em 1em .5em .4em; }
449
- .ui-dialog .ui-dialog-buttonpane .ui-dialog-buttonset { float: right; }
450
- .ui-dialog .ui-dialog-buttonpane button { margin: .5em .4em .5em 0; cursor: pointer; }
451
- .ui-dialog .ui-resizable-se { width: 14px; height: 14px; right: 3px; bottom: 3px; }
452
- .ui-draggable .ui-dialog-titlebar { cursor: move; }
453
- /*
454
- * jQuery UI Slider 1.8.16
455
- *
456
- * Copyright 2011, AUTHORS.txt (http://jqueryui.com/about)
457
- * Dual licensed under the MIT or GPL Version 2 licenses.
458
- * http://jquery.org/license
459
- *
460
- * http://docs.jquery.com/UI/Slider#theming
461
- */
462
- .ui-slider { position: relative; text-align: left; }
463
- .ui-slider .ui-slider-handle { position: absolute; z-index: 2; width: 1.2em; height: 1.2em; cursor: default; }
464
- .ui-slider .ui-slider-range { position: absolute; z-index: 1; font-size: .7em; display: block; border: 0; background-position: 0 0; }
465
-
466
- .ui-slider-horizontal { height: .8em; }
467
- .ui-slider-horizontal .ui-slider-handle { top: -.3em; margin-left: -.6em; }
468
- .ui-slider-horizontal .ui-slider-range { top: 0; height: 100%; }
469
- .ui-slider-horizontal .ui-slider-range-min { left: 0; }
470
- .ui-slider-horizontal .ui-slider-range-max { right: 0; }
471
-
472
- .ui-slider-vertical { width: .8em; height: 100px; }
473
- .ui-slider-vertical .ui-slider-handle { left: -.3em; margin-left: 0; margin-bottom: -.6em; }
474
- .ui-slider-vertical .ui-slider-range { left: 0; width: 100%; }
475
- .ui-slider-vertical .ui-slider-range-min { bottom: 0; }
476
- .ui-slider-vertical .ui-slider-range-max { top: 0; }/*
477
- * jQuery UI Tabs 1.8.16
478
- *
479
- * Copyright 2011, AUTHORS.txt (http://jqueryui.com/about)
480
- * Dual licensed under the MIT or GPL Version 2 licenses.
481
- * http://jquery.org/license
482
- *
483
- * http://docs.jquery.com/UI/Tabs#theming
484
- */
485
- .ui-tabs { position: relative; padding: .2em; zoom: 1; } /* position: relative prevents IE scroll bug (element with position: relative inside container with overflow: auto appear as "fixed") */
486
- .ui-tabs .ui-tabs-nav { margin: 0; padding: .2em .2em 0; }
487
- .ui-tabs .ui-tabs-nav li { list-style: none; float: left; position: relative; top: 1px; margin: 0 .2em 1px 0; border-bottom: 0 !important; padding: 0; white-space: nowrap; }
488
- .ui-tabs .ui-tabs-nav li a { float: left; padding: .5em 1em; text-decoration: none; }
489
- .ui-tabs .ui-tabs-nav li.ui-tabs-selected { margin-bottom: 0; padding-bottom: 1px; }
490
- .ui-tabs .ui-tabs-nav li.ui-tabs-selected a, .ui-tabs .ui-tabs-nav li.ui-state-disabled a, .ui-tabs .ui-tabs-nav li.ui-state-processing a { cursor: text; }
491
- .ui-tabs .ui-tabs-nav li a, .ui-tabs.ui-tabs-collapsible .ui-tabs-nav li.ui-tabs-selected a { cursor: pointer; } /* first selector in group seems obsolete, but required to overcome bug in Opera applying cursor: text overall if defined elsewhere... */
492
- .ui-tabs .ui-tabs-panel { display: block; border-width: 0; padding: 1em 1.4em; background: none; }
493
- .ui-tabs .ui-tabs-hide { display: none !important; }
494
- /*
495
- * jQuery UI Datepicker 1.8.16
496
- *
497
- * Copyright 2011, AUTHORS.txt (http://jqueryui.com/about)
498
- * Dual licensed under the MIT or GPL Version 2 licenses.
499
- * http://jquery.org/license
500
- *
501
- * http://docs.jquery.com/UI/Datepicker#theming
502
- */
503
- .ui-datepicker { width: 17em; padding: .2em .2em 0; display: none; }
504
- .ui-datepicker .ui-datepicker-header { position:relative; padding:.2em 0; }
505
- .ui-datepicker .ui-datepicker-prev, .ui-datepicker .ui-datepicker-next { position:absolute; top: 2px; width: 1.8em; height: 1.8em; }
506
- .ui-datepicker .ui-datepicker-prev-hover, .ui-datepicker .ui-datepicker-next-hover { top: 1px; }
507
- .ui-datepicker .ui-datepicker-prev { left:2px; }
508
- .ui-datepicker .ui-datepicker-next { right:2px; }
509
- .ui-datepicker .ui-datepicker-prev-hover { left:1px; }
510
- .ui-datepicker .ui-datepicker-next-hover { right:1px; }
511
- .ui-datepicker .ui-datepicker-prev span, .ui-datepicker .ui-datepicker-next span { display: block; position: absolute; left: 50%; margin-left: -8px; top: 50%; margin-top: -8px; }
512
- .ui-datepicker .ui-datepicker-title { margin: 0 2.3em; line-height: 1.8em; text-align: center; }
513
- .ui-datepicker .ui-datepicker-title select { font-size:1em; margin:1px 0; }
514
- .ui-datepicker select.ui-datepicker-month-year {width: 100%;}
515
- .ui-datepicker select.ui-datepicker-month,
516
- .ui-datepicker select.ui-datepicker-year { width: 49%;}
517
- .ui-datepicker table {width: 100%; font-size: .9em; border-collapse: collapse; margin:0 0 .4em; }
518
- .ui-datepicker th { padding: .7em .3em; text-align: center; font-weight: bold; border: 0; }
519
- .ui-datepicker td { border: 0; padding: 1px; }
520
- .ui-datepicker td span, .ui-datepicker td a { display: block; padding: .2em; text-align: right; text-decoration: none; }
521
- .ui-datepicker .ui-datepicker-buttonpane { background-image: none; margin: .7em 0 0 0; padding:0 .2em; border-left: 0; border-right: 0; border-bottom: 0; }
522
- .ui-datepicker .ui-datepicker-buttonpane button { float: right; margin: .5em .2em .4em; cursor: pointer; padding: .2em .6em .3em .6em; width:auto; overflow:visible; }
523
- .ui-datepicker .ui-datepicker-buttonpane button.ui-datepicker-current { float:left; }
524
-
525
- /* with multiple calendars */
526
- .ui-datepicker.ui-datepicker-multi { width:auto; }
527
- .ui-datepicker-multi .ui-datepicker-group { float:left; }
528
- .ui-datepicker-multi .ui-datepicker-group table { width:95%; margin:0 auto .4em; }
529
- .ui-datepicker-multi-2 .ui-datepicker-group { width:50%; }
530
- .ui-datepicker-multi-3 .ui-datepicker-group { width:33.3%; }
531
- .ui-datepicker-multi-4 .ui-datepicker-group { width:25%; }
532
- .ui-datepicker-multi .ui-datepicker-group-last .ui-datepicker-header { border-left-width:0; }
533
- .ui-datepicker-multi .ui-datepicker-group-middle .ui-datepicker-header { border-left-width:0; }
534
- .ui-datepicker-multi .ui-datepicker-buttonpane { clear:left; }
535
- .ui-datepicker-row-break { clear:both; width:100%; font-size:0em; }
536
-
537
- /* RTL support */
538
- .ui-datepicker-rtl { direction: rtl; }
539
- .ui-datepicker-rtl .ui-datepicker-prev { right: 2px; left: auto; }
540
- .ui-datepicker-rtl .ui-datepicker-next { left: 2px; right: auto; }
541
- .ui-datepicker-rtl .ui-datepicker-prev:hover { right: 1px; left: auto; }
542
- .ui-datepicker-rtl .ui-datepicker-next:hover { left: 1px; right: auto; }
543
- .ui-datepicker-rtl .ui-datepicker-buttonpane { clear:right; }
544
- .ui-datepicker-rtl .ui-datepicker-buttonpane button { float: left; }
545
- .ui-datepicker-rtl .ui-datepicker-buttonpane button.ui-datepicker-current { float:right; }
546
- .ui-datepicker-rtl .ui-datepicker-group { float:right; }
547
- .ui-datepicker-rtl .ui-datepicker-group-last .ui-datepicker-header { border-right-width:0; border-left-width:1px; }
548
- .ui-datepicker-rtl .ui-datepicker-group-middle .ui-datepicker-header { border-right-width:0; border-left-width:1px; }
549
-
550
- /* IE6 IFRAME FIX (taken from datepicker 1.5.3 */
551
- .ui-datepicker-cover {
552
- display: none; /*sorry for IE5*/
553
- display/**/: block; /*sorry for IE5*/
554
- position: absolute; /*must have*/
555
- z-index: -1; /*must have*/
556
- filter: mask(); /*must have*/
557
- top: -4px; /*must have*/
558
- left: -4px; /*must have*/
559
- width: 200px; /*must have*/
560
- height: 200px; /*must have*/
561
- }/*
562
- * jQuery UI Progressbar 1.8.16
563
- *
564
- * Copyright 2011, AUTHORS.txt (http://jqueryui.com/about)
565
- * Dual licensed under the MIT or GPL Version 2 licenses.
566
- * http://jquery.org/license
567
- *
568
- * http://docs.jquery.com/UI/Progressbar#theming
569
- */
570
- .ui-progressbar { height:2em; text-align: left; }
571
- .ui-progressbar .ui-progressbar-value {margin: -1px; height:100%; }
572
- .ui-progressbar .ui-widget-header {
573
- background-color: #83B4D8;
574
- background-image: linear-gradient(bottom, rgb(114,167,207) 0%, rgb(144,197,238) 100%);
575
- background-image: -o-linear-gradient(bottom, rgb(114,167,207) 0%, rgb(144,197,238) 100%);
576
- background-image: -moz-linear-gradient(bottom, rgb(114,167,207) 0%, rgb(144,197,238) 100%);
577
- background-image: -webkit-linear-gradient(bottom, rgb(114,167,207) 0%, rgb(144,197,238) 100%);
578
- background-image: -ms-linear-gradient(bottom, rgb(114,167,207) 0%, rgb(144,197,238) 100%);
579
- }
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
trunk/wpsc-admin/css/jquery.ui.datepicker-fresh.css DELETED
@@ -1,579 +0,0 @@
1
- /*
2
- * jQuery UI CSS Framework 1.8.16
3
- *
4
- * Copyright 2011, AUTHORS.txt (http://jqueryui.com/about)
5
- * Dual licensed under the MIT or GPL Version 2 licenses.
6
- * http://jquery.org/license
7
- *
8
- * http://docs.jquery.com/UI/Theming/API
9
- *
10
- * Credit goes to Helen Hou-Sandi:
11
- * https://github.com/helenhousandi/wp-admin-jquery-ui
12
- *
13
- */
14
-
15
- /* Layout helpers
16
- ----------------------------------*/
17
- .ui-helper-hidden { display: none; }
18
- .ui-helper-hidden-accessible { position: absolute !important; clip: rect(1px 1px 1px 1px); clip: rect(1px,1px,1px,1px); }
19
- .ui-helper-reset { margin: 0; padding: 0; border: 0; outline: 0; line-height: 1.3; text-decoration: none; font-size: 100%; list-style: none; }
20
- .ui-helper-clearfix:after { content: "."; display: block; height: 0; clear: both; visibility: hidden; }
21
- .ui-helper-clearfix { display: inline-block; }
22
- /* required comment for clearfix to work in Opera \*/
23
- * html .ui-helper-clearfix { height:1%; }
24
- .ui-helper-clearfix { display:block; }
25
- /* end clearfix */
26
- .ui-helper-zfix { width: 100%; height: 100%; top: 0; left: 0; position: absolute; opacity: 0; filter:Alpha(Opacity=0); }
27
-
28
-
29
- /* Interaction Cues
30
- ----------------------------------*/
31
- .ui-state-disabled { cursor: default !important; }
32
-
33
-
34
- /* Icons
35
- ----------------------------------*/
36
-
37
- /* states and images */
38
- .ui-icon { display: block; text-indent: -99999px; overflow: hidden; background-repeat: no-repeat; }
39
-
40
-
41
- /* Misc visuals
42
- ----------------------------------*/
43
-
44
- /* Overlays */
45
- .ui-widget-overlay { position: absolute; top: 0; left: 0; width: 100%; height: 100%; }
46
-
47
-
48
- /*
49
- * jQuery UI CSS Framework 1.8.16
50
- *
51
- * Copyright 2011, AUTHORS.txt (http://jqueryui.com/about)
52
- * Dual licensed under the MIT or GPL Version 2 licenses.
53
- * http://jquery.org/license
54
- *
55
- * http://docs.jquery.com/UI/Theming/API
56
- *
57
- * To view and modify this theme, visit http://jqueryui.com/themeroller/?ffDefault=sans-serif&fwDefault=normal&fsDefault=12px&cornerRadius=4px&bgColorHeader=ececec&bgTextureHeader=04_highlight_hard.png&bgImgOpacityHeader=75&borderColorHeader=dfdfdf&fcHeader=333333&iconColorHeader=999999&bgColorContent=ffffff&bgTextureContent=01_flat.png&bgImgOpacityContent=75&borderColorContent=dfdfdf&fcContent=333333&iconColorContent=333333&bgColorDefault=ececec&bgTextureDefault=04_highlight_hard.png&bgImgOpacityDefault=75&borderColorDefault=dfdfdf&fcDefault=333333&iconColorDefault=333333&bgColorHover=ececec&bgTextureHover=06_inset_hard.png&bgImgOpacityHover=75&borderColorHover=ccc&fcHover=000000&iconColorHover=333333&bgColorActive=ffffff&bgTextureActive=01_flat.png&bgImgOpacityActive=65&borderColorActive=dfdfdf&fcActive=333333&iconColorActive=333333&bgColorHighlight=ffffe0&bgTextureHighlight=01_flat.png&bgImgOpacityHighlight=55&borderColorHighlight=e6db55&fcHighlight=333333&iconColorHighlight=21759b&bgColorError=ffebe8&bgTextureError=01_flat.png&bgImgOpacityError=95&borderColorError=cc0000&fcError=cc0000&iconColorError=cc0000&bgColorOverlay=aaaaaa&bgTextureOverlay=01_flat.png&bgImgOpacityOverlay=0&opacityOverlay=30&bgColorShadow=aaaaaa&bgTextureShadow=01_flat.png&bgImgOpacityShadow=0&opacityShadow=30&thicknessShadow=8px&offsetTopShadow=-8px&offsetLeftShadow=-8px&cornerRadiusShadow=3px
58
- */
59
-
60
-
61
- /* Component containers
62
- ----------------------------------*/
63
- .ui-widget { font-family: sans-serif; font-size: 12px; }
64
- .ui-widget .ui-widget { font-size: 1em; }
65
- .ui-widget input, .ui-widget select, .ui-widget textarea, .ui-widget button { font-family: sans-serif; font-size: 1em; }
66
- .ui-widget-content { border: 1px solid #dfdfdf; background: #ffffff; color: #333333; }
67
- .ui-widget-header { border: 1px solid #dfdfdf; color: #333333; font-weight: bold; background-color: #f1f1f1; background-image: -ms-linear-gradient(top, #f9f9f9, #ececec); background-image: -moz-linear-gradient(top, #f9f9f9, #ececec); background-image: -o-linear-gradient(top, #f9f9f9, #ececec); background-image: -webkit-gradient(linear, left top, left bottom, from(#f9f9f9), to(#ececec)); background-image: -webkit-linear-gradient(top, #f9f9f9, #ececec); background-image: linear-gradient(top, #f9f9f9, #ececec); }
68
- .ui-widget-header a { color: #333333; }
69
-
70
- /* Interaction states
71
- ----------------------------------*/
72
- .ui-state-default, .ui-widget-content .ui-state-default, .ui-widget-header .ui-state-default { border: 1px solid #dfdfdf; background-color: #f1f1f1; background-image: -ms-linear-gradient(top, #f9f9f9, #ececec); background-image: -moz-linear-gradient(top, #f9f9f9, #ececec); background-image: -o-linear-gradient(top, #f9f9f9, #ececec); background-image: -webkit-gradient(linear, left top, left bottom, from(#f9f9f9), to(#ececec)); background-image: -webkit-linear-gradient(top, #f9f9f9, #ececec); background-image: linear-gradient(top, #f9f9f9, #ececec); font-weight: normal; color: #333333; }
73
- .ui-state-default a, .ui-state-default a:link, .ui-state-default a:visited { color: #333333; text-decoration: none; }
74
- .ui-state-hover, .ui-widget-content .ui-state-hover, .ui-widget-header .ui-state-hover, .ui-state-focus, .ui-widget-content .ui-state-focus, .ui-widget-header .ui-state-focus { border: 1px solid #ccc; background-color: #ececec; background-image: -ms-linear-gradient(top, #ececec, #f9f9f9); background-image: -moz-linear-gradient(top, #ececec, #f9f9f9); background-image: -o-linear-gradient(top, #ececec, #f9f9f9); background-image: -webkit-gradient(linear, left top, left bottom, from(#ececec), to(#f9f9f9)); background-image: -webkit-linear-gradient(top, #ececec, #f9f9f9); background-image: linear-gradient(top, #ececec, #f9f9f9); font-weight: normal; color: #000000; }
75
- .ui-state-hover a, .ui-state-hover a:hover { color: #000000; text-decoration: none; }
76
- .ui-state-active, .ui-widget-content .ui-state-active, .ui-widget-header .ui-state-active { border: 1px solid #dfdfdf; background: #ffffff; font-weight: normal; color: #333333; }
77
- .ui-state-active a, .ui-state-active a:link, .ui-state-active a:visited { color: #333333; text-decoration: none; }
78
- .ui-widget :active { outline: none; }
79
-
80
- /* Interaction Cues
81
- ----------------------------------*/
82
- .ui-state-highlight, .ui-widget-content .ui-state-highlight, .ui-widget-header .ui-state-highlight {border: 1px solid #e6db55; background: #ffffe0; color: #333333; }
83
- .ui-state-highlight a, .ui-widget-content .ui-state-highlight a,.ui-widget-header .ui-state-highlight a { color: #333333; }
84
- .ui-state-error, .ui-widget-content .ui-state-error, .ui-widget-header .ui-state-error {border: 1px solid #cc0000; background: #ffebe8; color: #cc0000; }
85
- .ui-state-error a, .ui-widget-content .ui-state-error a, .ui-widget-header .ui-state-error a { color: #cc0000; }
86
- .ui-state-error-text, .ui-widget-content .ui-state-error-text, .ui-widget-header .ui-state-error-text { color: #cc0000; }
87
- .ui-priority-primary, .ui-widget-content .ui-priority-primary, .ui-widget-header .ui-priority-primary { font-weight: bold; }
88
- .ui-priority-secondary, .ui-widget-content .ui-priority-secondary, .ui-widget-header .ui-priority-secondary { opacity: .7; filter:Alpha(Opacity=70); font-weight: normal; }
89
- .ui-state-disabled, .ui-widget-content .ui-state-disabled, .ui-widget-header .ui-state-disabled { opacity: .35; filter:Alpha(Opacity=35); background-image: none; }
90
-
91
- /* Icons
92
- ----------------------------------*/
93
-
94
- /* states and images */
95
- .ui-icon { width: 16px; height: 16px; background-image: url(ui-images/ui-icons_333333_256x240.png); }
96
- .ui-widget-content .ui-icon {background-image: url(ui-images/ui-icons_333333_256x240.png); }
97
- .ui-widget-header .ui-icon {background-image: url(ui-images/ui-icons_999999_256x240.png); }
98
- .ui-state-default .ui-icon { background-image: url(ui-images/ui-icons_333333_256x240.png); }
99
- .ui-state-hover .ui-icon, .ui-state-focus .ui-icon {background-image: url(ui-images/ui-icons_333333_256x240.png); }
100
- .ui-state-active .ui-icon {background-image: url(ui-images/ui-icons_333333_256x240.png); }
101
- .ui-state-highlight .ui-icon {background-image: url(ui-images/ui-icons_21759b_256x240.png); }
102
- .ui-state-error .ui-icon, .ui-state-error-text .ui-icon {background-image: url(ui-images/ui-icons_cc0000_256x240.png); }
103
-
104
- /* positioning */
105
- .ui-icon-carat-1-n { background-position: 0 0; }
106
- .ui-icon-carat-1-ne { background-position: -16px 0; }
107
- .ui-icon-carat-1-e { background-position: -32px 0; }
108
- .ui-icon-carat-1-se { background-position: -48px 0; }
109
- .ui-icon-carat-1-s { background-position: -64px 0; }
110
- .ui-icon-carat-1-sw { background-position: -80px 0; }
111
- .ui-icon-carat-1-w { background-position: -96px 0; }
112
- .ui-icon-carat-1-nw { background-position: -112px 0; }
113
- .ui-icon-carat-2-n-s { background-position: -128px 0; }
114
- .ui-icon-carat-2-e-w { background-position: -144px 0; }
115
- .ui-icon-triangle-1-n { background-position: 0 -16px; }
116
- .ui-icon-triangle-1-ne { background-position: -16px -16px; }
117
- .ui-icon-triangle-1-e { background-position: -32px -16px; }
118
- .ui-icon-triangle-1-se { background-position: -48px -16px; }
119
- .ui-icon-triangle-1-s { background-position: -64px -16px; }
120
- .ui-icon-triangle-1-sw { background-position: -80px -16px; }
121
- .ui-icon-triangle-1-w { background-position: -96px -16px; }
122
- .ui-icon-triangle-1-nw { background-position: -112px -16px; }
123
- .ui-icon-triangle-2-n-s { background-position: -128px -16px; }
124
- .ui-icon-triangle-2-e-w { background-position: -144px -16px; }
125
- .ui-icon-arrow-1-n { background-position: 0 -32px; }
126
- .ui-icon-arrow-1-ne { background-position: -16px -32px; }
127
- .ui-icon-arrow-1-e { background-position: -32px -32px; }
128
- .ui-icon-arrow-1-se { background-position: -48px -32px; }
129
- .ui-icon-arrow-1-s { background-position: -64px -32px; }
130
- .ui-icon-arrow-1-sw { background-position: -80px -32px; }
131
- .ui-icon-arrow-1-w { background-position: -96px -32px; }
132
- .ui-icon-arrow-1-nw { background-position: -112px -32px; }
133
- .ui-icon-arrow-2-n-s { background-position: -128px -32px; }
134
- .ui-icon-arrow-2-ne-sw { background-position: -144px -32px; }
135
- .ui-icon-arrow-2-e-w { background-position: -160px -32px; }
136
- .ui-icon-arrow-2-se-nw { background-position: -176px -32px; }
137
- .ui-icon-arrowstop-1-n { background-position: -192px -32px; }
138
- .ui-icon-arrowstop-1-e { background-position: -208px -32px; }
139
- .ui-icon-arrowstop-1-s { background-position: -224px -32px; }
140
- .ui-icon-arrowstop-1-w { background-position: -240px -32px; }
141
- .ui-icon-arrowthick-1-n { background-position: 0 -48px; }
142
- .ui-icon-arrowthick-1-ne { background-position: -16px -48px; }
143
- .ui-icon-arrowthick-1-e { background-position: -32px -48px; }
144
- .ui-icon-arrowthick-1-se { background-position: -48px -48px; }
145
- .ui-icon-arrowthick-1-s { background-position: -64px -48px; }
146
- .ui-icon-arrowthick-1-sw { background-position: -80px -48px; }
147
- .ui-icon-arrowthick-1-w { background-position: -96px -48px; }
148
- .ui-icon-arrowthick-1-nw { background-position: -112px -48px; }
149
- .ui-icon-arrowthick-2-n-s { background-position: -128px -48px; }
150
- .ui-icon-arrowthick-2-ne-sw { background-position: -144px -48px; }
151
- .ui-icon-arrowthick-2-e-w { background-position: -160px -48px; }
152
- .ui-icon-arrowthick-2-se-nw { background-position: -176px -48px; }
153
- .ui-icon-arrowthickstop-1-n { background-position: -192px -48px; }
154
- .ui-icon-arrowthickstop-1-e { background-position: -208px -48px; }
155
- .ui-icon-arrowthickstop-1-s { background-position: -224px -48px; }
156
- .ui-icon-arrowthickstop-1-w { background-position: -240px -48px; }
157
- .ui-icon-arrowreturnthick-1-w { background-position: 0 -64px; }
158
- .ui-icon-arrowreturnthick-1-n { background-position: -16px -64px; }
159
- .ui-icon-arrowreturnthick-1-e { background-position: -32px -64px; }
160
- .ui-icon-arrowreturnthick-1-s { background-position: -48px -64px; }
161
- .ui-icon-arrowreturn-1-w { background-position: -64px -64px; }
162
- .ui-icon-arrowreturn-1-n { background-position: -80px -64px; }
163
- .ui-icon-arrowreturn-1-e { background-position: -96px -64px; }
164
- .ui-icon-arrowreturn-1-s { background-position: -112px -64px; }
165
- .ui-icon-arrowrefresh-1-w { background-position: -128px -64px; }
166
- .ui-icon-arrowrefresh-1-n { background-position: -144px -64px; }
167
- .ui-icon-arrowrefresh-1-e { background-position: -160px -64px; }
168
- .ui-icon-arrowrefresh-1-s { background-position: -176px -64px; }
169
- .ui-icon-arrow-4 { background-position: 0 -80px; }
170
- .ui-icon-arrow-4-diag { background-position: -16px -80px; }
171
- .ui-icon-extlink { background-position: -32px -80px; }
172
- .ui-icon-newwin { background-position: -48px -80px; }
173
- .ui-icon-refresh { background-position: -64px -80px; }
174
- .ui-icon-shuffle { background-position: -80px -80px; }
175
- .ui-icon-transfer-e-w { background-position: -96px -80px; }
176
- .ui-icon-transferthick-e-w { background-position: -112px -80px; }
177
- .ui-icon-folder-collapsed { background-position: 0 -96px; }
178
- .ui-icon-folder-open { background-position: -16px -96px; }
179
- .ui-icon-document { background-position: -32px -96px; }
180
- .ui-icon-document-b { background-position: -48px -96px; }
181
- .ui-icon-note { background-position: -64px -96px; }
182
- .ui-icon-mail-closed { background-position: -80px -96px; }
183
- .ui-icon-mail-open { background-position: -96px -96px; }
184
- .ui-icon-suitcase { background-position: -112px -96px; }
185
- .ui-icon-comment { background-position: -128px -96px; }
186
- .ui-icon-person { background-position: -144px -96px; }
187
- .ui-icon-print { background-position: -160px -96px; }
188
- .ui-icon-trash { background-position: -176px -96px; }
189
- .ui-icon-locked { background-position: -192px -96px; }
190
- .ui-icon-unlocked { background-position: -208px -96px; }
191
- .ui-icon-bookmark { background-position: -224px -96px; }
192
- .ui-icon-tag { background-position: -240px -96px; }
193
- .ui-icon-home { background-position: 0 -112px; }
194
- .ui-icon-flag { background-position: -16px -112px; }
195
- .ui-icon-calendar { background-position: -32px -112px; }
196
- .ui-icon-cart { background-position: -48px -112px; }
197
- .ui-icon-pencil { background-position: -64px -112px; }
198
- .ui-icon-clock { background-position: -80px -112px; }
199
- .ui-icon-disk { background-position: -96px -112px; }
200
- .ui-icon-calculator { background-position: -112px -112px; }
201
- .ui-icon-zoomin { background-position: -128px -112px; }
202
- .ui-icon-zoomout { background-position: -144px -112px; }
203
- .ui-icon-search { background-position: -160px -112px; }
204
- .ui-icon-wrench { background-position: -176px -112px; }
205
- .ui-icon-gear { background-position: -192px -112px; }
206
- .ui-icon-heart { background-position: -208px -112px; }
207
- .ui-icon-star { background-position: -224px -112px; }
208
- .ui-icon-link { background-position: -240px -112px; }
209
- .ui-icon-cancel { background-position: 0 -128px; }
210
- .ui-icon-plus { background-position: -16px -128px; }
211
- .ui-icon-plusthick { background-position: -32px -128px; }
212
- .ui-icon-minus { background-position: -48px -128px; }
213
- .ui-icon-minusthick { background-position: -64px -128px; }
214
- .ui-icon-close { background-position: -80px -128px; }
215
- .ui-icon-closethick { background-position: -96px -128px; }
216
- .ui-icon-key { background-position: -112px -128px; }
217
- .ui-icon-lightbulb { background-position: -128px -128px; }
218
- .ui-icon-scissors { background-position: -144px -128px; }
219
- .ui-icon-clipboard { background-position: -160px -128px; }
220
- .ui-icon-copy { background-position: -176px -128px; }
221
- .ui-icon-contact { background-position: -192px -128px; }
222
- .ui-icon-image { background-position: -208px -128px; }
223
- .ui-icon-video { background-position: -224px -128px; }
224
- .ui-icon-script { background-position: -240px -128px; }
225
- .ui-icon-alert { background-position: 0 -144px; }
226
- .ui-icon-info { background-position: -16px -144px; }
227
- .ui-icon-notice { background-position: -32px -144px; }
228
- .ui-icon-help { background-position: -48px -144px; }
229
- .ui-icon-check { background-position: -64px -144px; }
230
- .ui-icon-bullet { background-position: -80px -144px; }
231
- .ui-icon-radio-off { background-position: -96px -144px; }
232
- .ui-icon-radio-on { background-position: -112px -144px; }
233
- .ui-icon-pin-w { background-position: -128px -144px; }
234
- .ui-icon-pin-s { background-position: -144px -144px; }
235
- .ui-icon-play { background-position: 0 -160px; }
236
- .ui-icon-pause { background-position: -16px -160px; }
237
- .ui-icon-seek-next { background-position: -32px -160px; }
238
- .ui-icon-seek-prev { background-position: -48px -160px; }
239
- .ui-icon-seek-end { background-position: -64px -160px; }
240
- .ui-icon-seek-start { background-position: -80px -160px; }
241
- /* ui-icon-seek-first is deprecated, use ui-icon-seek-start instead */
242
- .ui-icon-seek-first { background-position: -80px -160px; }
243
- .ui-icon-stop { background-position: -96px -160px; }
244
- .ui-icon-eject { background-position: -112px -160px; }
245
- .ui-icon-volume-off { background-position: -128px -160px; }
246
- .ui-icon-volume-on { background-position: -144px -160px; }
247
- .ui-icon-power { background-position: 0 -176px; }
248
- .ui-icon-signal-diag { background-position: -16px -176px; }
249
- .ui-icon-signal { background-position: -32px -176px; }
250
- .ui-icon-battery-0 { background-position: -48px -176px; }
251
- .ui-icon-battery-1 { background-position: -64px -176px; }
252
- .ui-icon-battery-2 { background-position: -80px -176px; }
253
- .ui-icon-battery-3 { background-position: -96px -176px; }
254
- .ui-icon-circle-plus { background-position: 0 -192px; }
255
- .ui-icon-circle-minus { background-position: -16px -192px; }
256
- .ui-icon-circle-close { background-position: -32px -192px; }
257
- .ui-icon-circle-triangle-e { background-position: -48px -192px; }
258
- .ui-icon-circle-triangle-s { background-position: -64px -192px; }
259
- .ui-icon-circle-triangle-w { background-position: -80px -192px; }
260
- .ui-icon-circle-triangle-n { background-position: -96px -192px; }
261
- .ui-icon-circle-arrow-e { background-position: -112px -192px; }
262
- .ui-icon-circle-arrow-s { background-position: -128px -192px; }
263
- .ui-icon-circle-arrow-w { background-position: -144px -192px; }
264
- .ui-icon-circle-arrow-n { background-position: -160px -192px; }
265
- .ui-icon-circle-zoomin { background-position: -176px -192px; }
266
- .ui-icon-circle-zoomout { background-position: -192px -192px; }
267
- .ui-icon-circle-check { background-position: -208px -192px; }
268
- .ui-icon-circlesmall-plus { background-position: 0 -208px; }
269
- .ui-icon-circlesmall-minus { background-position: -16px -208px; }
270
- .ui-icon-circlesmall-close { background-position: -32px -208px; }
271
- .ui-icon-squaresmall-plus { background-position: -48px -208px; }
272
- .ui-icon-squaresmall-minus { background-position: -64px -208px; }
273
- .ui-icon-squaresmall-close { background-position: -80px -208px; }
274
- .ui-icon-grip-dotted-vertical { background-position: 0 -224px; }
275
- .ui-icon-grip-dotted-horizontal { background-position: -16px -224px; }
276
- .ui-icon-grip-solid-vertical { background-position: -32px -224px; }
277
- .ui-icon-grip-solid-horizontal { background-position: -48px -224px; }
278
- .ui-icon-gripsmall-diagonal-se { background-position: -64px -224px; }
279
- .ui-icon-grip-diagonal-se { background-position: -80px -224px; }
280
-
281
-
282
- /* Misc visuals
283
- ----------------------------------*/
284
-
285
- /* Corner radius */
286
- .ui-corner-all, .ui-corner-top, .ui-corner-left, .ui-corner-tl { -moz-border-radius-topleft: 3px; -webkit-border-top-left-radius: 3px; border-top-left-radius: 3px; }
287
- .ui-corner-all, .ui-corner-top, .ui-corner-right, .ui-corner-tr { -moz-border-radius-topright: 3px; -webkit-border-top-right-radius: 3px; border-top-right-radius: 3px; }
288
- .ui-corner-all, .ui-corner-bottom, .ui-corner-left, .ui-corner-bl { -moz-border-radius-bottomleft: 3px; -webkit-border-bottom-left-radius: 3px; border-bottom-left-radius: 3px; }
289
- .ui-corner-all, .ui-corner-bottom, .ui-corner-right, .ui-corner-br { -moz-border-radius-bottomright: 3px; -webkit-border-bottom-right-radius: 3px; border-bottom-right-radius: 3px; }
290
-
291
- /* Overlays */
292
- .ui-widget-overlay { background: #000000; opacity: .6;filter:Alpha(Opacity=60); }
293
- .ui-widget-shadow { box-shadow: 0 0 16px rgba(0, 0, 0, 0.3); }/*
294
- * jQuery UI Resizable 1.8.16
295
- *
296
- * Copyright 2011, AUTHORS.txt (http://jqueryui.com/about)
297
- * Dual licensed under the MIT or GPL Version 2 licenses.
298
- * http://jquery.org/license
299
- *
300
- * http://docs.jquery.com/UI/Resizable#theming
301
- */
302
- .ui-resizable { position: relative;}
303
- .ui-resizable-handle { position: absolute;font-size: 0.1px;z-index: 99999; display: block; }
304
- .ui-resizable-disabled .ui-resizable-handle, .ui-resizable-autohide .ui-resizable-handle { display: none; }
305
- .ui-resizable-n { cursor: n-resize; height: 7px; width: 100%; top: -5px; left: 0; }
306
- .ui-resizable-s { cursor: s-resize; height: 7px; width: 100%; bottom: -5px; left: 0; }
307
- .ui-resizable-e { cursor: e-resize; width: 7px; right: -5px; top: 0; height: 100%; }
308
- .ui-resizable-w { cursor: w-resize; width: 7px; left: -5px; top: 0; height: 100%; }
309
- .ui-resizable-se { cursor: se-resize; width: 12px; height: 12px; right: 1px; bottom: 1px; }
310
- .ui-resizable-sw { cursor: sw-resize; width: 9px; height: 9px; left: -5px; bottom: -5px; }
311
- .ui-resizable-nw { cursor: nw-resize; width: 9px; height: 9px; left: -5px; top: -5px; }
312
- .ui-resizable-ne { cursor: ne-resize; width: 9px; height: 9px; right: -5px; top: -5px;}/*
313
- * jQuery UI Selectable 1.8.16
314
- *
315
- * Copyright 2011, AUTHORS.txt (http://jqueryui.com/about)
316
- * Dual licensed under the MIT or GPL Version 2 licenses.
317
- * http://jquery.org/license
318
- *
319
- * http://docs.jquery.com/UI/Selectable#theming
320
- */
321
- .ui-selectable-helper { position: absolute; z-index: 100; border:1px dotted black; }
322
- /*
323
- * jQuery UI Accordion 1.8.16
324
- *
325
- * Copyright 2011, AUTHORS.txt (http://jqueryui.com/about)
326
- * Dual licensed under the MIT or GPL Version 2 licenses.
327
- * http://jquery.org/license
328
- *
329
- * http://docs.jquery.com/UI/Accordion#theming
330
- */
331
- /* IE/Win - Fix animation bug - #4615 */
332
- .ui-accordion { width: 100%; }
333
- .ui-accordion .ui-accordion-header { cursor: pointer; position: relative; margin-top: 1px; zoom: 1; }
334
- .ui-accordion .ui-accordion-li-fix { display: inline; }
335
- .ui-accordion .ui-accordion-header-active { border-bottom: 0 !important; }
336
- .ui-accordion .ui-accordion-header a { display: block; font-size: 1em; padding: .5em .5em .5em .7em; }
337
- .ui-accordion-icons .ui-accordion-header a { padding-left: 2.2em; }
338
- .ui-accordion .ui-accordion-header .ui-icon { position: absolute; left: .5em; top: 50%; margin-top: -8px; }
339
- .ui-accordion .ui-accordion-content { padding: 1em 2.2em; border-top: 0; margin-top: -2px; position: relative; top: 1px; margin-bottom: 2px; overflow: auto; display: none; zoom: 1; }
340
- .ui-accordion .ui-accordion-content-active { display: block; }
341
- /*
342
- * jQuery UI Autocomplete 1.8.16
343
- *
344
- * Copyright 2011, AUTHORS.txt (http://jqueryui.com/about)
345
- * Dual licensed under the MIT or GPL Version 2 licenses.
346
- * http://jquery.org/license
347
- *
348
- * http://docs.jquery.com/UI/Autocomplete#theming
349
- */
350
- .ui-autocomplete { position: absolute; cursor: default; }
351
-
352
- /* workarounds */
353
- * html .ui-autocomplete { width:1px; } /* without this, the menu expands to 100% in IE6 */
354
-
355
- /*
356
- * jQuery UI Menu 1.8.16
357
- *
358
- * Copyright 2010, AUTHORS.txt (http://jqueryui.com/about)
359
- * Dual licensed under the MIT or GPL Version 2 licenses.
360
- * http://jquery.org/license
361
- *
362
- * http://docs.jquery.com/UI/Menu#theming
363
- */
364
- .ui-menu {
365
- list-style:none;
366
- padding: 2px;
367
- margin: 0;
368
- display:block;
369
- float: left;
370
- }
371
- .ui-menu .ui-menu {
372
- margin-top: -3px;
373
- }
374
- .ui-menu .ui-menu-item {
375
- margin:0;
376
- padding: 0;
377
- zoom: 1;
378
- float: left;
379
- clear: left;
380
- width: 100%;
381
- }
382
- .ui-menu .ui-menu-item a {
383
- text-decoration:none;
384
- display:block;
385
- padding:.2em .4em;
386
- line-height:1.5;
387
- zoom:1;
388
- }
389
- .ui-menu .ui-menu-item a.ui-state-hover,
390
- .ui-menu .ui-menu-item a.ui-state-active {
391
- font-weight: normal;
392
- margin: -1px;
393
- }
394
- /*
395
- * jQuery UI Button 1.8.16
396
- *
397
- * Copyright 2011, AUTHORS.txt (http://jqueryui.com/about)
398
- * Dual licensed under the MIT or GPL Version 2 licenses.
399
- * http://jquery.org/license
400
- *
401
- * http://docs.jquery.com/UI/Button#theming
402
- */
403
- .ui-button { display: inline-block; position: relative; padding: 0; margin-right: .1em; text-decoration: none !important; cursor: pointer; text-align: center; zoom: 1; overflow: visible; } /* the overflow property removes extra width in IE */
404
- .ui-button-icon-only { width: 2.2em; } /* to make room for the icon, a width needs to be set here */
405
- button.ui-button-icon-only { width: 2.4em; } /* button elements seem to need a little more width */
406
- .ui-button-icons-only { width: 3.4em; }
407
- button.ui-button-icons-only { width: 3.7em; }
408
-
409
- /*button text element */
410
- .ui-button .ui-button-text { display: block; line-height: 1.4; }
411
- .ui-button-text-only .ui-button-text { padding: .4em 1em; }
412
- .ui-button-icon-only .ui-button-text, .ui-button-icons-only .ui-button-text { padding: .4em; text-indent: -9999999px; }
413
- .ui-button-text-icon-primary .ui-button-text, .ui-button-text-icons .ui-button-text { padding: .4em 1em .4em 2.1em; }
414
- .ui-button-text-icon-secondary .ui-button-text, .ui-button-text-icons .ui-button-text { padding: .4em 2.1em .4em 1em; }
415
- .ui-button-text-icons .ui-button-text { padding-left: 2.1em; padding-right: 2.1em; }
416
- /* no icon support for input elements, provide padding by default */
417
- input.ui-button { padding: .4em 1em; }
418
-
419
- /*button icon element(s) */
420
- .ui-button-icon-only .ui-icon, .ui-button-text-icon-primary .ui-icon, .ui-button-text-icon-secondary .ui-icon, .ui-button-text-icons .ui-icon, .ui-button-icons-only .ui-icon { position: absolute; top: 50%; margin-top: -8px; }
421
- .ui-button-icon-only .ui-icon { left: 50%; margin-left: -8px; }
422
- .ui-button-text-icon-primary .ui-button-icon-primary, .ui-button-text-icons .ui-button-icon-primary, .ui-button-icons-only .ui-button-icon-primary { left: .5em; }
423
- .ui-button-text-icon-secondary .ui-button-icon-secondary, .ui-button-text-icons .ui-button-icon-secondary, .ui-button-icons-only .ui-button-icon-secondary { right: .5em; }
424
- .ui-button-text-icons .ui-button-icon-secondary, .ui-button-icons-only .ui-button-icon-secondary { right: .5em; }
425
-
426
- /*button sets*/
427
- .ui-buttonset { margin-right: 7px; }
428
- .ui-buttonset .ui-button { margin-left: 0; margin-right: -.3em; }
429
-
430
- /* workarounds */
431
- button.ui-button::-moz-focus-inner { border: 0; padding: 0; } /* reset extra padding in Firefox */
432
- /*
433
- * jQuery UI Dialog 1.8.16
434
- *
435
- * Copyright 2011, AUTHORS.txt (http://jqueryui.com/about)
436
- * Dual licensed under the MIT or GPL Version 2 licenses.
437
- * http://jquery.org/license
438
- *
439
- * http://docs.jquery.com/UI/Dialog#theming
440
- */
441
- .ui-dialog { position: fixed; padding: .2em; width: 300px; overflow: hidden; }
442
- .ui-dialog .ui-dialog-titlebar { padding: .4em 1em; position: relative; }
443
- .ui-dialog .ui-dialog-title { float: left; margin: .1em 16px .1em 0; }
444
- .ui-dialog .ui-dialog-titlebar-close { position: absolute; right: .3em; top: 50%; width: 19px; margin: -10px 0 0 0; padding: 1px; height: 18px; }
445
- .ui-dialog .ui-dialog-titlebar-close span { display: block; margin: 1px; }
446
- .ui-dialog .ui-dialog-titlebar-close:hover, .ui-dialog .ui-dialog-titlebar-close:focus { padding: 0; }
447
- .ui-dialog .ui-dialog-content { position: relative; border: 0; padding: .5em 1em; background: none; overflow: auto; zoom: 1; }
448
- .ui-dialog .ui-dialog-buttonpane { text-align: left; border-width: 1px 0 0 0; background-image: none; margin: .5em 0 0 0; padding: .3em 1em .5em .4em; }
449
- .ui-dialog .ui-dialog-buttonpane .ui-dialog-buttonset { float: right; }
450
- .ui-dialog .ui-dialog-buttonpane button { margin: .5em .4em .5em 0; cursor: pointer; }
451
- .ui-dialog .ui-resizable-se { width: 14px; height: 14px; right: 3px; bottom: 3px; }
452
- .ui-draggable .ui-dialog-titlebar { cursor: move; }
453
- /*
454
- * jQuery UI Slider 1.8.16
455
- *
456
- * Copyright 2011, AUTHORS.txt (http://jqueryui.com/about)
457
- * Dual licensed under the MIT or GPL Version 2 licenses.
458
- * http://jquery.org/license
459
- *
460
- * http://docs.jquery.com/UI/Slider#theming
461
- */
462
- .ui-slider { position: relative; text-align: left; }
463
- .ui-slider .ui-slider-handle { position: absolute; z-index: 2; width: 1.2em; height: 1.2em; cursor: default; }
464
- .ui-slider .ui-slider-range { position: absolute; z-index: 1; font-size: .7em; display: block; border: 0; background-position: 0 0; }
465
-
466
- .ui-slider-horizontal { height: .8em; }
467
- .ui-slider-horizontal .ui-slider-handle { top: -.3em; margin-left: -.6em; }
468
- .ui-slider-horizontal .ui-slider-range { top: 0; height: 100%; }
469
- .ui-slider-horizontal .ui-slider-range-min { left: 0; }
470
- .ui-slider-horizontal .ui-slider-range-max { right: 0; }
471
-
472
- .ui-slider-vertical { width: .8em; height: 100px; }
473
- .ui-slider-vertical .ui-slider-handle { left: -.3em; margin-left: 0; margin-bottom: -.6em; }
474
- .ui-slider-vertical .ui-slider-range { left: 0; width: 100%; }
475
- .ui-slider-vertical .ui-slider-range-min { bottom: 0; }
476
- .ui-slider-vertical .ui-slider-range-max { top: 0; }/*
477
- * jQuery UI Tabs 1.8.16
478
- *
479
- * Copyright 2011, AUTHORS.txt (http://jqueryui.com/about)
480
- * Dual licensed under the MIT or GPL Version 2 licenses.
481
- * http://jquery.org/license
482
- *
483
- * http://docs.jquery.com/UI/Tabs#theming
484
- */
485
- .ui-tabs { position: relative; padding: .2em; zoom: 1; } /* position: relative prevents IE scroll bug (element with position: relative inside container with overflow: auto appear as "fixed") */
486
- .ui-tabs .ui-tabs-nav { margin: 0; padding: .2em .2em 0; }
487
- .ui-tabs .ui-tabs-nav li { list-style: none; float: left; position: relative; top: 1px; margin: 0 .2em 1px 0; border-bottom: 0 !important; padding: 0; white-space: nowrap; }
488
- .ui-tabs .ui-tabs-nav li a { float: left; padding: .5em 1em; text-decoration: none; }
489
- .ui-tabs .ui-tabs-nav li.ui-tabs-selected { margin-bottom: 0; padding-bottom: 1px; }
490
- .ui-tabs .ui-tabs-nav li.ui-tabs-selected a, .ui-tabs .ui-tabs-nav li.ui-state-disabled a, .ui-tabs .ui-tabs-nav li.ui-state-processing a { cursor: text; }
491
- .ui-tabs .ui-tabs-nav li a, .ui-tabs.ui-tabs-collapsible .ui-tabs-nav li.ui-tabs-selected a { cursor: pointer; } /* first selector in group seems obsolete, but required to overcome bug in Opera applying cursor: text overall if defined elsewhere... */
492
- .ui-tabs .ui-tabs-panel { display: block; border-width: 0; padding: 1em 1.4em; background: none; }
493
- .ui-tabs .ui-tabs-hide { display: none !important; }
494
- /*
495
- * jQuery UI Datepicker 1.8.16
496
- *
497
- * Copyright 2011, AUTHORS.txt (http://jqueryui.com/about)
498
- * Dual licensed under the MIT or GPL Version 2 licenses.
499
- * http://jquery.org/license
500
- *
501
- * http://docs.jquery.com/UI/Datepicker#theming
502
- */
503
- .ui-datepicker { width: 17em; padding: .2em .2em 0; display: none; }
504
- .ui-datepicker .ui-datepicker-header { position:relative; padding:.2em 0; }
505
- .ui-datepicker .ui-datepicker-prev, .ui-datepicker .ui-datepicker-next { position:absolute; top: 2px; width: 1.8em; height: 1.8em; }
506
- .ui-datepicker .ui-datepicker-prev-hover, .ui-datepicker .ui-datepicker-next-hover { top: 1px; }
507
- .ui-datepicker .ui-datepicker-prev { left:2px; }
508
- .ui-datepicker .ui-datepicker-next { right:2px; }
509
- .ui-datepicker .ui-datepicker-prev-hover { left:1px; }
510
- .ui-datepicker .ui-datepicker-next-hover { right:1px; }
511
- .ui-datepicker .ui-datepicker-prev span, .ui-datepicker .ui-datepicker-next span { display: block; position: absolute; left: 50%; margin-left: -8px; top: 50%; margin-top: -8px; }
512
- .ui-datepicker .ui-datepicker-title { margin: 0 2.3em; line-height: 1.8em; text-align: center; }
513
- .ui-datepicker .ui-datepicker-title select { font-size:1em; margin:1px 0; }
514
- .ui-datepicker select.ui-datepicker-month-year {width: 100%;}
515
- .ui-datepicker select.ui-datepicker-month,
516
- .ui-datepicker select.ui-datepicker-year { width: 49%;}
517
- .ui-datepicker table {width: 100%; font-size: .9em; border-collapse: collapse; margin:0 0 .4em; }
518
- .ui-datepicker th { padding: .7em .3em; text-align: center; font-weight: bold; border: 0; }
519
- .ui-datepicker td { border: 0; padding: 1px; }
520
- .ui-datepicker td span, .ui-datepicker td a { display: block; padding: .2em; text-align: right; text-decoration: none; }
521
- .ui-datepicker .ui-datepicker-buttonpane { background-image: none; margin: .7em 0 0 0; padding:0 .2em; border-left: 0; border-right: 0; border-bottom: 0; }
522
- .ui-datepicker .ui-datepicker-buttonpane button { float: right; margin: .5em .2em .4em; cursor: pointer; padding: .2em .6em .3em .6em; width:auto; overflow:visible; }
523
- .ui-datepicker .ui-datepicker-buttonpane button.ui-datepicker-current { float:left; }
524
-
525
- /* with multiple calendars */
526
- .ui-datepicker.ui-datepicker-multi { width:auto; }
527
- .ui-datepicker-multi .ui-datepicker-group { float:left; }
528
- .ui-datepicker-multi .ui-datepicker-group table { width:95%; margin:0 auto .4em; }
529
- .ui-datepicker-multi-2 .ui-datepicker-group { width:50%; }
530
- .ui-datepicker-multi-3 .ui-datepicker-group { width:33.3%; }
531
- .ui-datepicker-multi-4 .ui-datepicker-group { width:25%; }
532
- .ui-datepicker-multi .ui-datepicker-group-last .ui-datepicker-header { border-left-width:0; }
533
- .ui-datepicker-multi .ui-datepicker-group-middle .ui-datepicker-header { border-left-width:0; }
534
- .ui-datepicker-multi .ui-datepicker-buttonpane { clear:left; }
535
- .ui-datepicker-row-break { clear:both; width:100%; font-size:0em; }
536
-
537
- /* RTL support */
538
- .ui-datepicker-rtl { direction: rtl; }
539
- .ui-datepicker-rtl .ui-datepicker-prev { right: 2px; left: auto; }
540
- .ui-datepicker-rtl .ui-datepicker-next { left: 2px; right: auto; }
541
- .ui-datepicker-rtl .ui-datepicker-prev:hover { right: 1px; left: auto; }
542
- .ui-datepicker-rtl .ui-datepicker-next:hover { left: 1px; right: auto; }
543
- .ui-datepicker-rtl .ui-datepicker-buttonpane { clear:right; }
544
- .ui-datepicker-rtl .ui-datepicker-buttonpane button { float: left; }
545
- .ui-datepicker-rtl .ui-datepicker-buttonpane button.ui-datepicker-current { float:right; }
546
- .ui-datepicker-rtl .ui-datepicker-group { float:right; }
547
- .ui-datepicker-rtl .ui-datepicker-group-last .ui-datepicker-header { border-right-width:0; border-left-width:1px; }
548
- .ui-datepicker-rtl .ui-datepicker-group-middle .ui-datepicker-header { border-right-width:0; border-left-width:1px; }
549
-
550
- /* IE6 IFRAME FIX (taken from datepicker 1.5.3 */
551
- .ui-datepicker-cover {
552
- display: none; /*sorry for IE5*/
553
- display/**/: block; /*sorry for IE5*/
554
- position: absolute; /*must have*/
555
- z-index: -1; /*must have*/
556
- filter: mask(); /*must have*/
557
- top: -4px; /*must have*/
558
- left: -4px; /*must have*/
559
- width: 200px; /*must have*/
560
- height: 200px; /*must have*/
561
- }/*
562
- * jQuery UI Progressbar 1.8.16
563
- *
564
- * Copyright 2011, AUTHORS.txt (http://jqueryui.com/about)
565
- * Dual licensed under the MIT or GPL Version 2 licenses.
566
- * http://jquery.org/license
567
- *
568
- * http://docs.jquery.com/UI/Progressbar#theming
569
- */
570
- .ui-progressbar { height:2em; text-align: left; }
571
- .ui-progressbar .ui-progressbar-value {margin: -1px; height:100%; }
572
- .ui-progressbar .ui-widget-header {
573
- background-color: #83B4D8;
574
- background-image: linear-gradient(bottom, rgb(114,167,207) 0%, rgb(144,197,238) 100%);
575
- background-image: -o-linear-gradient(bottom, rgb(114,167,207) 0%, rgb(144,197,238) 100%);
576
- background-image: -moz-linear-gradient(bottom, rgb(114,167,207) 0%, rgb(144,197,238) 100%);
577
- background-image: -webkit-linear-gradient(bottom, rgb(114,167,207) 0%, rgb(144,197,238) 100%);
578
- background-image: -ms-linear-gradient(bottom, rgb(114,167,207) 0%, rgb(144,197,238) 100%);
579
- }
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
trunk/wpsc-admin/css/jquery.ui.tabs.css DELETED
@@ -1,152 +0,0 @@
1
- /* Caution! Ensure accessibility in print and other media types... */
2
- @media projection, screen { /* Use class for showing/hiding tab content, so that visibility can be better controlled in different media types... */
3
- .ui-tabs-hide {
4
- display: none;
5
- }
6
- }
7
-
8
- /* Hide useless elements in print layouts... */
9
- @media print {
10
- .ui-tabs-nav {
11
- display: none;
12
- }
13
- }
14
-
15
- /* Skin */
16
- #slider {
17
- border-color:#EBEBEB rgb(204, 204, 204) rgb(204, 204, 204) rgb(235, 235, 235);
18
- border-style:solid;
19
- border-width:1px;
20
- margin:0pt 15% 0pt 15px;
21
- padding:2px;
22
- }
23
- #tabs{
24
- display: block;
25
- background:#EAF3FA none repeat scroll 0%;
26
- font-size:14px;
27
- margin:0pt 0pt 10px;
28
- overflow:hidden;
29
- }
30
-
31
- .ui-tabs-nav {
32
- list-style: none;
33
- margin: 0;
34
- padding: 0 0 0 4px;
35
- }
36
- .ui-tabs-nav:after { /* clearing without presentational markup, IE gets extra treatment */
37
- display: block;
38
- clear: both;
39
- content: " ";
40
- }
41
- .ui-tabs-nav li {
42
- float: left;
43
- padding:8px 5px;
44
- min-width: 84px; /* be nice to Opera */
45
- margin: 2px 2px 0px 1px !important;
46
- text-decoration: none;
47
- list-style: none;
48
- }
49
- .ui-tabs-nav a, .ui-tabs-nav a span {
50
- display: block;
51
- padding: 0 10px;
52
- }
53
-
54
- .ui-tabs-nav a {
55
- margin: 1px 0 0; /* position: relative makes opacity fail for disabled tab in IE */
56
- padding-left: 0;
57
- color: #27537a;
58
- line-height: 1.2;
59
- text-align: center;
60
- text-decoration: none;
61
- white-space: nowrap; /* required in IE 6 */
62
- outline: 0; /* prevent dotted border in Firefox */
63
- }
64
- .ui-tabs-nav .ui-tabs-selected{
65
- background:#CEE1EF none repeat scroll 0% 50%;
66
- font-weight:bold;
67
- -moz-border-radius-topright: 4px;
68
- -khtml-border-top-right-radius: 4px;
69
- -webkit-border-top-right-radius: 4px;
70
- border-top-right-radius: 4px;
71
- -moz-border-radius-topleft: 4px;
72
- -khtml-border-top-left-radius: 4px;
73
- -webkit-border-top-left-radius: 4px;
74
- border-top-left-radius: 4px;
75
- }
76
- .ui-tabs-nav .ui-tabs-selected a {
77
- position: relative;
78
- top: 1px;
79
- z-index: 2;
80
- margin-top: 0;
81
- color:#333333;
82
- }
83
- .ui-tabs-nav li a:hover {
84
- color:#D54E21;
85
- }
86
- .ui-tabs-nav a span {
87
- width: 64px; /* IE 6 treats width as min-width */
88
- min-width: 64px;
89
- height: 18px; /* IE 6 treats height as min-height */
90
- min-height: 18px;
91
- padding-top: 6px;
92
- padding-right: 0;
93
- }
94
- *>.ui-tabs-nav a span { /* hide from IE 6 */
95
- width: auto;
96
- height: auto;
97
- }
98
- .ui-tabs-nav .ui-tabs-selected a span {
99
- padding-bottom: 1px;
100
- }
101
- .ui-tabs-nav .ui-tabs-selected a, .ui-tabs-nav a:hover, .ui-tabs-nav a:focus, .ui-tabs-nav a:active {
102
- background-position: 100% -150px;
103
- }
104
- .ui-tabs-nav a, .ui-tabs-nav .ui-tabs-disabled a:hover, .ui-tabs-nav .ui-tabs-disabled a:focus, .ui-tabs-nav .ui-tabs-disabled a:active {
105
- background-position: 100% -100px;
106
- }
107
- .ui-tabs-nav .ui-tabs-selected a span, .ui-tabs-nav a:hover span, .ui-tabs-nav a:focus span, .ui-tabs-nav a:active span {
108
- background-position: 0 -50px;
109
- }
110
- .ui-tabs-nav a span, .ui-tabs-nav .ui-tabs-disabled a:hover span, .ui-tabs-nav .ui-tabs-disabled a:focus span, .ui-tabs-nav .ui-tabs-disabled a:active span {
111
- background-position: 0 0;
112
- }
113
- .ui-tabs-nav .ui-tabs-selected a:link, .ui-tabs-nav .ui-tabs-selected a:visited, .ui-tabs-nav .ui-tabs-disabled a:link, .ui-tabs-nav .ui-tabs-disabled a:visited { /* @ Opera, use pseudo classes otherwise it confuses cursor... */
114
- cursor: text;
115
- }
116
- .ui-tabs-nav a:hover, .ui-tabs-nav a:focus, .ui-tabs-nav a:active,
117
- .ui-tabs-nav .ui-tabs-unselect a:hover, .ui-tabs-nav .ui-tabs-unselect a:focus, .ui-tabs-nav .ui-tabs-unselect a:active { /* @ Opera, we need to be explicit again here now... */
118
- cursor: pointer;
119
- }
120
- .ui-tabs-disabled {
121
- opacity: .4;
122
- filter: alpha(opacity=40);
123
- }
124
- .ui-tabs-panel {
125
- border-top: 1px solid #97a5b0 !important;
126
- padding: 1em 8px;
127
- background: #fff; /* declare background color for container to avoid distorted fonts in IE while fading */
128
-
129
- /* overwrite wp-admin */
130
- border:none !important;
131
- height:100% !important;
132
- margin:0pt 0pt 0pt 0px !important;
133
- overflow:visible !important;
134
- }
135
-
136
- .ui-tabs-panel a {
137
- display:inline;
138
- }
139
-
140
- .ui-tabs-loading em {
141
- padding: 0 0 0 20px;
142
- background: url(loading.gif) no-repeat 0 50%;
143
- }
144
-
145
- /* Additional IE specific bug fixes... */
146
- * html .ui-tabs-nav { /* auto clear, @ IE 6 & IE 7 Quirks Mode */
147
- display: inline-block;
148
- }
149
- *:first-child+html .ui-tabs-nav { /* @ IE 7 Standards Mode - do not group selectors, otherwise IE 6 will ignore complete rule (because of the unknown + combinator)... */
150
- display: inline-block;
151
- }
152
-
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
trunk/wpsc-admin/css/loading-small.gif DELETED
Binary file
trunk/wpsc-admin/css/media.css DELETED
@@ -1,26 +0,0 @@
1
- .wpsc-featured-label {
2
- position: absolute;
3
- bottom: 0;
4
- left: 0;
5
- right: 0;
6
- background: #f1f1f1;
7
- background-image: -webkit-gradient(linear, left top, left bottom, from(#f1f1f1), to(#e1e1e1));
8
- background-image: -webkit-linear-gradient(top, #f1f1f1, #e1e1e1);
9
- background-image: -moz-linear-gradient(top, #f1f1f1, #e1e1e1);
10
- background-image: -o-linear-gradient(top, #f1f1f1, #e1e1e1);
11
- background-image: linear-gradient(to bottom, #f1f1f1, #e1e1e1);
12
- box-shadow: 0 0 0 1px rgba( 0, 0, 0, 0.15 );
13
- font-weight: bold;
14
- text-align: center;
15
- color: rgb(70, 70, 70);
16
- max-height: 100%;
17
- padding: 5px 10px;
18
- outline: 0 none;
19
- opacity: 0.95;
20
- line-height: 1em;
21
- }
22
-
23
- .selection-view .wpsc-featured-label {
24
- font-size:7px;
25
- padding: 2px 0;
26
- }
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
trunk/wpsc-admin/css/settingspage.css DELETED
@@ -1,485 +0,0 @@
1
- table#wpsc_checkout_list{
2
- width:100%;
3
- }
4
-
5
- table#wpsc_checkout_list tbody {
6
- position:relative;
7
- }
8
-
9
- th#actions{
10
- width:65px;
11
- }
12
- th#drag{
13
- width:50px;
14
- }
15
- tr.wpsc_grey{
16
- background-color: #ededed;
17
- }
18
- td.drag a:hover{
19
- cursor: move;
20
- }
21
-
22
- th.column-type {
23
- width: 9em;
24
- }
25
- #wpsc_checkout_list th.column-type {
26
- width: 9em;
27
- }
28
-
29
- th.column-unique_name {
30
- width: 9em;
31
- }
32
-
33
- th.column-mandatory, th.column-display {
34
- width: 6em;
35
- }
36
-
37
- .widefat th.column-mandatory, td.mandatorycol, .widefat th.column-display, td.displaycol, .widefat th.column-trash, td.trashcol {
38
- text-align:center;
39
- vertical-align: top
40
- }
41
-
42
- #wpsc_checkout_list td.typecol select {
43
- width: 100%;
44
- }
45
-
46
- #wpsc_imported_columns ol {
47
- margin-top: 0;
48
- }
49
- #wpsc_imported_columns .empty {
50
- color: #999;
51
- }
52
-
53
- #checkout_message{
54
- display: none;
55
- }
56
-
57
- #wpsc_checkout_list td {
58
- vertical-align:middle;
59
- }
60
-
61
- #wpsc_checkout_list .uniquenamecol small {
62
- color:#999;
63
- }
64
-
65
- td.drag a img {
66
- vertical-align:middle;
67
- }
68
-
69
- #wpsc_checkout_list_body .ajax-feedback {
70
- display:none;
71
- }
72
-
73
- #wpsc_checkout_list_body .ajax-feedback-active {
74
- display:inline-block;
75
- margin-left:4px;
76
- }
77
-
78
- #wpsc_checkout_list .ui-sortable-helper {
79
- margin-left:0;
80
- }
81
-
82
- #wpsc_checkout_list .namecol input {
83
- width: 98%;
84
- }
85
-
86
- #wpsc_checkout_list .actionscol .cell-wrapper {
87
- float:right !important;
88
- }
89
-
90
- tr.checkout-placeholder td {
91
- border-width: 1px;
92
- border-style: dashed;
93
- z-index: 900;
94
- border-color: #bbb;
95
- background-color: #f5f5f5;
96
- margin: -2px 0 0 -2px;
97
- }
98
-
99
- /* Removed to prevent overlapping the Contextual Help tab
100
- #wpsc_options {
101
- position: relative;
102
- }
103
- */
104
-
105
- #wpsc_options a.about_this_page {
106
- position: absolute;
107
- top: 10px;
108
- right: 12px;
109
- }
110
-
111
- #wpsc_options_page {
112
- padding: 0;
113
- }
114
-
115
- #options_presentation{
116
- margin-right: 370px;
117
- }
118
-
119
- table.wpsc-edit-module-options tr td {
120
- padding: 0;
121
- vertical-align: top;
122
- }
123
- .wpsc-module-settings {
124
- padding: 0 0 8px 8px;
125
- width:394px;
126
- }
127
- .gateway_settings_form,
128
- .shipping-module-settings-form {
129
- padding: .5em;
130
- }
131
- .widefat .gateway_settings_form td,
132
- .widefat .shipping-module-settings-form td {
133
- border: none;
134
- overflow: initial;
135
- }
136
- .widefat .shipping-module-settings-form td input {
137
- margin-top: -5px;
138
- }
139
- .widefat .shipping-module-settings-form th {
140
- font-family: inherit;
141
- font-size: 12px;
142
- }
143
- .widefat p.description {
144
- color: #666;
145
- }
146
- .widefat .inactive p.description {
147
- margin-left: 0;
148
- }
149
- .gateway_settings_form p.submit,
150
- .shipping-module-settings-form p.submit {
151
- margin-top: 2em;
152
- }
153
-
154
- .gateway_settings .gateway_settings_form,
155
- .gateway_settings .gateway_settings_form tr {
156
- background: #f8f8f8;
157
- }
158
-
159
- .gateway_settings.active .gateway_settings_form,
160
- .gateway_settings.active .gateway_settings_form tr td {
161
- background: #ecf5f9;
162
- }
163
-
164
- .gateway_settings .gateway_settings_form tr:last-child td {
165
- box-shadow: none;
166
- }
167
- .gateway_settings input[type=text]{
168
- width: 200px;
169
- }
170
- .edit-payment-module-update,
171
- .edit-shipping-module-update {
172
- float: right;
173
- }
174
-
175
- tr.rate_row td input[type=text]{
176
- width:50px;
177
- }
178
- div.wpsc_newlayer input[type=text]{
179
- width:50px;
180
- }
181
- .gateway_settings textarea{
182
- width:100%;
183
- }
184
- .gateway_settings h4{
185
- margin-bottom:5px;
186
- }
187
-
188
- div#wpsc_shipwire_setting, div#shipping_discount_value {
189
- display: none;
190
- }
191
-
192
- table.wpsc-edit-module-options {
193
- margin:0;
194
- width:100%;
195
- }
196
- /* admin checkout page css */
197
- div#form_field_form_container{ padding: 0px; margin: 0px; }
198
-
199
- div#form_field_form_container div, div#form_field_form_container div table{ padding: 0px; margin: 0px; width: 100%; border-collapse: collapse; }
200
- table#form_field_table tr td.namecol{ }
201
-
202
- table#form_field_table tr *.namecol{ width: 170px; padding-right: 8px; }
203
- table#form_field_table tr *.namecol input{ width: 160px; }
204
-
205
- tr td.namecol{ padding-left: 2em; }
206
- tr.field_type_heading td.namecol { padding-left: 0; }
207
-
208
- table#form_field_table tr *.typecol{ width: 120px; }
209
- table#form_field_table tr *.typecol select{ width: 115px; }
210
-
211
- table#form_field_table tr *.mandatorycol{ width: 90px; text-align: center; }
212
- table#form_field_table tr *.mandatorycol input{ }
213
-
214
- table#form_field_table tr *.logdisplaycol{ width: 70px; text-align: center; }
215
- table#form_field_table tr *.logdisplaycol input{ }
216
-
217
- table#form_field_table tr *.ordercol{ width: 70px; text-align: center; }
218
- table#form_field_table tr *.ordercol input{ }
219
-
220
- table#form_field_table tr th{ padding-left: 0px; padding-right: 0px; }
221
-
222
- .flag_email{
223
- width:16px;
224
- float:right;
225
- }
226
-
227
- #wpsc_settingpage_nav_spacer{
228
- width:35%;
229
- float:right;
230
- height:30px;
231
- border-bottom:1px solid #dfdfdf;
232
- }
233
-
234
- #wpsc_settings_nav_bar {
235
- width:100%;
236
- }
237
-
238
- #wpsc_settings_nav_bar ul {
239
- width: 98%;
240
- border-bottom: 1px solid #DFDFDF;
241
- float: left;
242
- margin: 10px auto 0;
243
- padding-left: 15px;
244
- }
245
- #wpsc_settings_nav_bar ul li a{
246
- margin-bottom:-1px;
247
- }
248
-
249
- #wpsc_settings_nav_bar ul li a.current {
250
- background-color: #f9f9f9 !important;
251
- border-bottom-color: transparent !important;
252
- }
253
-
254
- h3.form_group {
255
- clear: left;
256
- }
257
- h3.form_group a{
258
- color: #000;
259
- }
260
- div.product_and_button_settings {
261
- position: relative;
262
- }
263
-
264
- div#themes_and_appearance {
265
- border: 1px solid #DFDFDF;
266
- width: 360px;
267
- position: absolute;
268
- left: 45em;
269
- }
270
-
271
- div#themes_and_appearance p {
272
- font-size: 11px;
273
- }
274
-
275
- span.display-path {
276
- color:#666666;
277
- }
278
-
279
- div#themes_and_appearance ol {
280
- font-size: 11px;
281
- list-style-type:decimal;
282
- list-style-position:inside;
283
- }
284
-
285
- div#themes_and_appearance ol li {
286
- font-size: 11px;
287
- }
288
-
289
- a.nav-tab-loading {
290
- color:#D54E21;
291
- }
292
-
293
- #wpsc_options h2 .nav-tab {
294
- font-size:16px;
295
- line-height:20px;
296
- padding:3px 6px 3px;
297
- margin-right:0;
298
- }
299
-
300
- #wpsc_options h2.nav-tab-wrapper {
301
- padding-left:7px;
302
- }
303
-
304
- #wpsc_options .postbox .inside p.submit {
305
- margin-top:5px;
306
- padding:0;
307
- }
308
-
309
- #wpsc-shipping-module-settings td small {
310
- color:#666;
311
- font-style:italic;
312
- }
313
-
314
- .wpsc-shipping-module-settings-tablerate .postbox .inside, .wpsc-shipping-module-settings-weightrate .postbox .inside {
315
- padding: 0;
316
- }
317
-
318
- .wpsc-shipping-module-settings-tablerate .form-table th, .wpsc-shipping-module-settings-weightrate .form-table th {
319
- border-bottom:1px solid #dfdfdf;
320
- font-size:12px;
321
- font-weight:bold;
322
- padding:7px 10px 7px 20px;
323
- }
324
-
325
- .wpsc-shipping-module-settings-tablerate .form-table, .wpsc-shipping-module-settings-weightrate .form-table {
326
- margin-top:0;
327
- }
328
-
329
- .wpsc-shipping-module-settings-tablerate .total {
330
- width:120px;
331
- }
332
-
333
- .wpsc-shipping-module-settings-weightrate .form-table th.total-weight {
334
- padding-left:10px;
335
- width:140px;
336
- }
337
-
338
- .wpsc-shipping-module-settings-tablerate .form-table td, .wpsc-shipping-module-settings-weightrate .form-table td {
339
- border-bottom:1px solid #dfdfdf;
340
- padding:0 10px;
341
- }
342
-
343
- .wpsc-shipping-module-settings-tablerate .form-table td .cell-wrapper, .wpsc-shipping-module-settings-weightrate .form-table td .cell-wrapper {
344
- padding:7px 0;
345
- width:100%;
346
- }
347
-
348
- #wpsc_options .wpsc-shipping-module-settings-tablerate .postbox .inside .submit, #wpsc_options .wpsc-shipping-module-settings-weightrate .postbox .inside .submit {
349
- padding:0 10px 0 20px;
350
- }
351
-
352
- .wpsc-shipping-module-settings-tablerate td .actions, .wpsc-shipping-module-settings-weightrate td .actions {
353
- float:right;
354
- margin-right:10px;
355
- }
356
-
357
- #wpsc_options .action {
358
- display:none;
359
- }
360
-
361
- .js #wpsc_options .js-warning {
362
- display:none;
363
- }
364
-
365
- .js #wpsc_options .wpsc-shipping-module-settings-tablerate td .action,
366
- .js #wpsc_options .wpsc-shipping-module-settings-weightrate td .action,
367
- .js #wpsc_checkout_list .action {
368
- background-image:url(plus-minus.png);
369
- background-repeat:no-repeat;
370
- display:inline-block;
371
- height:20px;
372
- margin-left:3px;
373
- text-indent:-9999em;
374
- width:20px;
375
- }
376
-
377
- .js #wpsc_options .wpsc-shipping-module-settings-tablerate td span.action,
378
- .js #wpsc_options .wpsc-shipping-module-settings-weightrate td span.action,
379
- .js #wpsc_checkout_list span.action {
380
- opacity:0.3;
381
- }
382
-
383
- #wpsc_checkout_list .wpsc-field-options-table {
384
- border-collapse:collapse;
385
- margin-bottom:1em;
386
- width:100%;
387
- }
388
-
389
- #wpsc_checkout_list .wpsc-field-options-table th {
390
- background:none;
391
- border-top:none;
392
- color:#000;
393
- font-family:sans-serif;
394
- font-size:12px;
395
- font-weight:bold;
396
- padding:0 5px;
397
- }
398
-
399
- #wpsc_checkout_list .wpsc-field-options-table input {
400
- width:100%;
401
- }
402
-
403
- #wpsc_checkout_list .wpsc-field-options-table td {
404
- border:none;
405
- padding:0 5px;
406
- }
407
-
408
- .js #wpsc_checkout_list .edit-options {
409
- display: none;
410
- }
411
-
412
- .js .form-field-options {
413
- display:none;
414
- }
415
-
416
- #wpsc_checkout_list .form-field-options td {
417
- border-top:none;
418
- }
419
-
420
- #wpsc_checkout_list tr.editing-options td {
421
- border-bottom:none;
422
- }
423
-
424
- #wpsc_checkout_list .wpsc-field-options-table td .field-option-cell-wrapper {
425
- padding: 2px 0;
426
- }
427
-
428
- #wpsc_checkout_list .wpsc-field-options-table .column-actions {
429
- width:65px;
430
- }
431
-
432
- #wpsc_checkout_list .wpsc-field-options-table .column-actions .field-option-cell-wrapper {
433
- float:right;
434
- }
435
-
436
- .js #wpsc_checkout_list .new-field {
437
- display:none;
438
- }
439
-
440
- /* shipping options start here */
441
- div.wpsc_shipping_options, div.wpsc-select-gateway {
442
- border-top: 1px solid #e9e9e9;
443
- width:100%;
444
- padding:3px 0;
445
- }
446
- .wpsc-shipping-actions, .wpsc-gateway-actions {
447
- visibility:hidden;
448
- line-height: 16px;
449
- margin:0px 9em 0 0;
450
- float:right;
451
- }
452
- div.wpsc_shipping_options:hover .wpsc-shipping-actions,
453
- div.wpsc-select-gateway:hover .wpsc-gateway-actions {
454
- visibility:visible;
455
- }
456
- div.wpsc-select-gateway p, div.wpsc_shipping_options p {
457
- margin: 0px 15px 4px 5px;
458
- }
459
- #wpsc-payment-gateway-settings-panel input[type=text], #wpsc-payment-gateway-settings-panel textarea {
460
- width:265px;
461
- }
462
- table.form-table td .updated.shipwire-update {
463
- display : none;
464
- font-size : 12px;
465
- line-height : 1.6em;
466
- }
467
-
468
- /* tax */
469
- .wpsc-tax-bands-row, .wpsc-tax-rates-row {
470
- line-height: 3.2;
471
- }
472
-
473
- .wpsc-tax-bands-row.prototype,
474
- .wpsc-tax-rates-row.prototype {
475
- display: none;
476
- }
477
-
478
- #wpsc-amazon-payments-secret-key {
479
- width: 400px;
480
- }
481
-
482
- #wpsc-amazon-payments-client_id,
483
- #wpsc-amazon-payments-ipn {
484
- width: 500px;
485
- }
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
trunk/wpsc-admin/css/ui-images/ui-icons_21759b_256x240.png DELETED
Binary file
trunk/wpsc-admin/css/ui-images/ui-icons_333333_256x240.png DELETED
Binary file
trunk/wpsc-admin/css/ui-images/ui-icons_999999_256x240.png DELETED
Binary file
trunk/wpsc-admin/css/ui-images/ui-icons_cc0000_256x240.png DELETED
Binary file
trunk/wpsc-admin/css/xit.gif DELETED
Binary file
trunk/wpsc-admin/db-upgrades/routines/1.php DELETED
@@ -1,142 +0,0 @@
1
- <?php
2
-
3
- function _wpsc_db_upgrade_1() {
4
- _wpsc_fix_checkout_field_limitation();
5
- _wpsc_fix_mexico_currency_sign();
6
- _wpsc_fix_canadian_province_codes();
7
- _wpsc_fix_colombia_currency();
8
- _wpsc_fix_ukraine_currency();
9
- _wpsc_fix_russia_currency();
10
- _wpsc_fix_belarus_currency();
11
- _wpsc_fix_estonia_currency();
12
- _wpsc_fix_slovenia_currency();
13
- _wpsc_fix_sudan_currency();
14
- _wpsc_create_south_sudan();
15
- wpsc_update_permalink_slugs();
16
- }
17
-
18
- function _wpsc_fix_checkout_field_limitation() {
19
- global $wpdb;
20
- $wpdb->query( "ALTER TABLE " . WPSC_TABLE_CHECKOUT_FORMS . " MODIFY options longtext" );
21
- }
22
-
23
- function _wpsc_fix_mexico_currency_sign() {
24
- $country = new WPSC_Country( array(
25
- 'isocode' => 'MX',
26
- 'currency' => __( 'Mexican Peso', 'wp-e-commerce' ),
27
- 'symbol' => __( '$', 'wp-e-commerce' ),
28
- 'symbol_html' => __( '&#036;', 'wp-e-commerce' ),
29
- 'has_regions' => '1'
30
- ) );
31
- }
32
-
33
- function _wpsc_fix_canadian_province_codes() {
34
- global $wpdb;
35
-
36
- $correct_provinces = array(
37
- 'AB' => 'Alberta',
38
- 'BC' => 'British Columbia',
39
- 'MB' => 'Manitoba',
40
- 'NB' => 'New Brunswick',
41
- 'NT' => 'Northwest Territories',
42
- 'NS' => 'Nova Scotia',
43
- 'NU' => 'Nunavut',
44
- 'ON' => 'Ontario',
45
- 'PE' => 'Prince Edward Island',
46
- 'QC' => 'Quebec',
47
- 'SK' => 'Saskatchewan',
48
- 'YT' => 'Yukon',
49
- );
50
-
51
- foreach( $correct_provinces as $code => $name ) {
52
- $wpdb->update( WPSC_TABLE_REGION_TAX,
53
- array(
54
- 'code' => $code
55
- ),
56
- array(
57
- 'name' => $name
58
- )
59
- );
60
- }
61
-
62
- $wpdb->update( WPSC_TABLE_REGION_TAX,
63
- array(
64
- 'code' => 'NL',
65
- 'name' => 'Newfoundland and Labrador',
66
- ),
67
- array(
68
- 'name' => 'Newfoundland',
69
- )
70
- );
71
- }
72
-
73
- function _wpsc_fix_colombia_currency() {
74
- $country = new WPSC_Country( array(
75
- 'isocode' => 'CO',
76
- 'symbol' => __( '$', 'wp-e-commerce' ),
77
- 'symbol_html' => __( '&#036;', 'wp-e-commerce' ),
78
- ) );
79
- }
80
-
81
- function _wpsc_fix_ukraine_currency() {
82
- $country = new WPSC_Country( array(
83
- 'isocode' => 'UA',
84
- 'code' => __( 'UAH', 'wp-e-commerce' ),
85
- 'symbol' => __( '₴', 'wp-e-commerce' ),
86
- 'symbol_html' => __( '&#8372;', 'wp-e-commerce' ),
87
- ) );
88
- }
89
-
90
- function _wpsc_fix_russia_currency() {
91
- $country = new WPSC_Country( array(
92
- 'isocode' => 'RU',
93
- 'code' => __( 'RUB', 'wp-e-commerce' )
94
- ) );
95
- }
96
-
97
- function _wpsc_fix_belarus_currency() {
98
- $country = new WPSC_Country( array(
99
- 'isocode' => 'BY',
100
- 'code' => __( 'BYR', 'wp-e-commerce' )
101
- ) );
102
- }
103
-
104
- function _wpsc_fix_estonia_currency() {
105
- $country = new WPSC_Country( array(
106
- 'isocode' => 'EE',
107
- 'currency' => __( 'Euro', 'wp-e-commerce' ),
108
- 'symbol' => __( '€', 'wp-e-commerce' ),
109
- 'symbol_html' => __( '&#8364;', 'wp-e-commerce' ),
110
- 'code' => __( 'EUR', 'wp-e-commerce' )
111
- ) );
112
- }
113
-
114
- function _wpsc_fix_slovenia_currency() {
115
- $country = new WPSC_Country( array(
116
- 'isocode' => 'SI',
117
- 'currency' => __( 'Euro', 'wp-e-commerce' ),
118
- 'symbol' => __( '€', 'wp-e-commerce' ),
119
- 'symbol_html' => __( '&#8364;', 'wp-e-commerce' ),
120
- 'code' => __( 'EUR', 'wp-e-commerce' )
121
- ) );
122
- }
123
-
124
- function _wpsc_fix_sudan_currency() {
125
- $country = new WPSC_Country( array(
126
- 'isocode' => 'SD',
127
- 'currency' => __( 'Sudanese Pound', 'wp-e-commerce' ),
128
- 'code' => __( 'SDG', 'wp-e-commerce' )
129
- ) );
130
- }
131
-
132
- function _wpsc_create_south_sudan() {
133
- $country = new WPSC_Country( array(
134
- 'id' => '242',
135
- 'country' => __( 'South Sudan', 'wp-e-commerce' ),
136
- 'isocode' => __( 'SS', 'wp-e-commerce' ),
137
- 'currency' => __( 'South Sudanese Pound', 'wp-e-commerce' ),
138
- 'code' => __( 'SSP', 'wp-e-commerce' ),
139
- 'continent' => 'africa',
140
- 'visible' => 0,
141
- ) );
142
- }
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
trunk/wpsc-admin/db-upgrades/routines/10.php DELETED
@@ -1,134 +0,0 @@
1
- <?php
2
-
3
- /**
4
- * Control database upgrade to version 10
5
- *
6
- * @access private
7
- * @since 3.8.14
8
- *
9
- */
10
- function _wpsc_db_upgrade_10() {
11
- _wpsc_add_region_name_meta();
12
- _wpsc_maybe_create_visitor_tables();
13
- _wpsc_cleanup_visitor_meta_checkout_details();
14
- }
15
-
16
- /**
17
- * 3.8.14 supports country meta and a feature that let's a countries regions be called by the
18
- * proper name. Here we initialize the values.
19
- *
20
- * @access private
21
- * @since 3.8.14
22
- *
23
- */
24
- function _wpsc_add_region_name_meta() {
25
- $wpsc_country = new WPSC_Country( 'US' );
26
- $wpsc_country->set( 'region_label', __( 'State', 'wp-e-commerce' ) );
27
-
28
- $wpsc_country = new WPSC_Country( 'CA' );
29
- $wpsc_country->set( 'region_label', __( 'Province', 'wp-e-commerce' ) );
30
- }
31
-
32
- /**
33
- * 3.8.14 maintains visitor information in a visitors table, create it
34
- *
35
- * @access private
36
- * @since 3.8.14
37
- *
38
- */
39
- function _wpsc_maybe_create_visitor_tables() {
40
- _wpsc_create_visitor_table();
41
- _wpsc_create_visitor_meta_table();
42
- _wpsc_meta_migrate_anonymous_users();
43
- }
44
-
45
- /**
46
- * starting in 3.8.14 visitors information belongs in the vistor table, not the users table, start
47
- * the migration. This migration could take a very long time so it's done as a cron
48
- *
49
- * @access private
50
- * @since 3.8.14
51
- *
52
- */
53
- function _wpsc_meta_migrate_anonymous_users() {
54
- global $wpdb;
55
-
56
- // get the users table auto increment value, and set the visitor meta auto increment to match.
57
- // we do this so that new customer cookies don't collide with existing customer cookies after
58
- // the migration. Note we can't use max of user id because users may have been deleted.
59
- $sql = 'SHOW TABLE STATUS WHERE NAME = "' . $wpdb->users . '"';
60
- $status = $wpdb->get_results( $sql );
61
-
62
- $wpdb->query( 'ALTER TABLE ' . $wpdb->wpsc_visitors . ' AUTO_INCREMENT = ' . $status[0]->Auto_increment );
63
-
64
- wp_suspend_cache_addition( true );
65
-
66
- $role = get_role( 'wpsc_anonymous' );
67
-
68
- if ( $role ) {
69
- remove_role( 'wpsc_anonymous', __( 'Anonymous', 'wp-e-commerce' ) );
70
- }
71
-
72
- wp_schedule_single_event( time() + 5 , 'wpsc_migrate_anonymous_user_cron' );
73
-
74
- }
75
-
76
-
77
- /**
78
- * Create the table for visitors
79
- *
80
- * @since 3.8.14
81
- * @access private
82
- *
83
- */
84
- function _wpsc_create_visitor_table() {
85
- require_once( ABSPATH . 'wp-admin/includes/upgrade.php' );
86
- global $wpdb;
87
- global $charset_collate;
88
-
89
- $sql = 'CREATE TABLE IF NOT EXISTS '. $wpdb->wpsc_visitors .' ('
90
- .'id bigint(20) unsigned NOT NULL AUTO_INCREMENT, '
91
- .'user_id bigint(20) unsigned DEFAULT NULL , '
92
- .'last_active timestamp NULL DEFAULT NULL, '
93
- .'expires timestamp NULL DEFAULT NULL, '
94
- .'created timestamp NULL DEFAULT NULL, '
95
- .'PRIMARY KEY ( `id` ), '
96
- .'KEY user_id ( `user_id` ), '
97
- .'KEY expires ( `expires` ), '
98
- .'KEY last_active ( `last_active` ), '
99
- .'KEY created ( `created` ) '
100
- .') '. $charset_collate;
101
-
102
- dbDelta( $sql );
103
-
104
- _wpsc_create_well_known_visitors();
105
- }
106
-
107
- /**
108
- * Create the meta table for visitor meta
109
- *
110
- * @since 3.8.14
111
- * @access private
112
- *
113
- */
114
- function _wpsc_create_visitor_meta_table() {
115
- require_once( ABSPATH . 'wp-admin/includes/upgrade.php' );
116
- global $wpdb;
117
- global $charset_collate;
118
-
119
- $sql = 'CREATE TABLE IF NOT EXISTS '. $wpdb->wpsc_visitormeta .' ('
120
- .'meta_id bigint(20) unsigned NOT NULL AUTO_INCREMENT, '
121
- .'wpsc_visitor_id bigint(20) unsigned NOT NULL DEFAULT 0 , '
122
- .'meta_key varchar(255) DEFAULT NULL, '
123
- .'meta_value longtext, '
124
- .'meta_timestamp timestamp NOT NULL DEFAULT CURRENT_TIMESTAMP ON UPDATE CURRENT_TIMESTAMP, '
125
- .'PRIMARY KEY (meta_id), '
126
- .'KEY wpsc_visitor_id (wpsc_visitor_id), '
127
- .'KEY meta_key (meta_key(191)), '
128
- .'KEY meta_value (meta_value(20)), '
129
- .'KEY meta_key_and_value (meta_key(191),meta_value(32)), '
130
- .'KEY meta_timestamp_index ( `meta_timestamp` ) '
131
- .') '. $charset_collate;
132
-
133
- dbDelta( $sql );
134
- }
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
trunk/wpsc-admin/db-upgrades/routines/11.php DELETED
@@ -1,83 +0,0 @@
1
- <?php
2
- /**
3
- * Control database upgrade to version 11
4
- *
5
- * @access private
6
- * @since 3.8.14
7
- *
8
- */
9
- function _wpsc_db_upgrade_11() {
10
- _wpsc_fix_united_kingdom();
11
- _wpsc_set_legacy_country_meta();
12
- }
13
-
14
- /**
15
- * Reset United Kingdom country data to default, hide ISO code 'UK'
16
- *
17
- * @access private
18
- * @since 3.8.14
19
- */
20
- function _wpsc_fix_united_kingdom() {
21
-
22
- $legacy_ok_country_was_visible = true;
23
-
24
- if ( $wpsc_country = WPSC_Countries::get_country( 'UK' ) ) {
25
-
26
- $legacy_ok_country_was_visible = $wpsc_country->is_visible();
27
-
28
- $wpsc_country = new WPSC_Country(
29
- array(
30
- 'visible' => '0',
31
- 'isocode' => 'UK',
32
- )
33
- );
34
-
35
- $wpsc_country->set( '_is_country_legacy', true );
36
- }
37
-
38
- $wpsc_country = new WPSC_Country(
39
- array(
40
- 'country' => __( 'United Kingdom', 'wp-e-commerce' ),
41
- 'isocode' => 'GB',
42
- 'currency' => __( 'Pound Sterling', 'wp-e-commerce' ),
43
- 'symbol' => __( '£', 'wp-e-commerce' ),
44
- 'symbol_html' => __( '&#163;', 'wp-e-commerce' ),
45
- 'code' => __( 'GBP', 'wp-e-commerce' ),
46
- 'continent' => 'europe',
47
- 'visible' => $legacy_ok_country_was_visible ? '0' : '1',
48
- 'has_regions' => '0',
49
- 'tax' => '0',
50
- )
51
- );
52
-
53
- //make sure base country is ok after the UK/GB fix
54
- $base_country = get_option( 'base_country', '' );
55
- if ( ! empty( $base_country ) && is_numeric( $base_country ) ) {
56
- $wpsc_country = new WPSC_Country( $base_country );
57
- if ( 'UK' == $wpsc_country->get_isocode() ) {
58
- $wpsc_country = new WPSC_Country( 'GB' );
59
- update_option( 'base_country' , $wpsc_country->get_id() );
60
- }
61
- }
62
-
63
- }
64
-
65
- /**
66
- * Sets meta for countries that no longer exist in their former notation to be considered legacy.
67
- *
68
- * @access private
69
- * @since 3.8.14
70
- */
71
- function _wpsc_set_legacy_country_meta() {
72
- if ( $wpsc_country = WPSC_Countries::get_country( 'YU' ) ) {
73
- $wpsc_country->set( '_is_country_legacy', true );
74
- }
75
-
76
- if ( $wpsc_country = WPSC_Countries::get_country( 'AN' ) ) {
77
- $wpsc_country->set( '_is_country_legacy', true );
78
- }
79
-
80
- if ( $wpsc_country = WPSC_Countries::get_country( 'TP' ) ) {
81
- $wpsc_country->set( '_is_country_legacy', true );
82
- }
83
- }
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
trunk/wpsc-admin/db-upgrades/routines/12.php DELETED
@@ -1,55 +0,0 @@
1
- <?php
2
- /**
3
- * Control database upgrade to version 12
4
- *
5
- * @access private
6
- * @since 3.8.14
7
- *
8
- */
9
- function _wpsc_db_upgrade_12() {
10
- _wpsc_fix_billing_country_meta();
11
- _wpsc_fix_shipping_country_meta();
12
- }
13
-
14
- /**
15
- * make sure the billing country meta is stored as individual values not as an array
16
- *
17
- * @access private
18
- * @since 3.8.14
19
- */
20
- function _wpsc_fix_billing_country_meta() {
21
- global $wpdb;
22
-
23
- $sql = 'SELECT * from ' . $wpdb->wpsc_visitormeta . ' WHERE meta_key = "billingcountry"';
24
- $metas = $wpdb->get_results( $sql, OBJECT );
25
-
26
- foreach ( $metas as $meta ) {
27
- $meta_value = maybe_unserialize( $meta->meta_value );
28
- if ( is_array( $meta_value ) ) {
29
- wpsc_update_visitor_meta( $meta->wpsc_visitor_id, 'billingregion', $meta_value[1] );
30
- wpsc_update_visitor_meta( $meta->wpsc_visitor_id, 'billingcountry', $meta_value[0] );
31
- }
32
- }
33
- }
34
-
35
- /**
36
- * make sure the shipping country meta is stored as individual values not as an array
37
- *
38
- * @access private
39
- * @since 3.8.14
40
- */
41
- function _wpsc_fix_shipping_country_meta() {
42
- global $wpdb;
43
-
44
- $sql = 'SELECT * from ' . $wpdb->wpsc_visitormeta . ' WHERE meta_key = "shippingcountry"';
45
- $metas = $wpdb->get_results( $sql, OBJECT );
46
-
47
- foreach ( $metas as $meta ) {
48
- $meta_value = maybe_unserialize( $meta->meta_value );
49
- if ( is_array( $meta_value ) ) {
50
- wpsc_update_visitor_meta( $meta->wpsc_visitor_id, 'shippingregion', $meta_value[1] );
51
- wpsc_update_visitor_meta( $meta->wpsc_visitor_id, 'shippingcountry', $meta_value[0] );
52
- }
53
- }
54
- }
55
-
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
trunk/wpsc-admin/db-upgrades/routines/13.php DELETED
@@ -1,54 +0,0 @@
1
- <?php
2
- /**
3
- * Control database upgrade to version 13
4
- *
5
- * @access private
6
- * @since 3.8.14
7
- *
8
- */
9
- function _wpsc_db_upgrade_13() {
10
- _wpsc_add_region_label_to_uk();
11
- _wpsc_fix_bad_checkout_form_rows();
12
- }
13
-
14
- /**
15
- * Add the county region label to the uk
16
- *
17
- * @access private
18
- * @since 3.8.14.1
19
- */
20
- function _wpsc_add_region_label_to_uk() {
21
- $wpsc_country = new WPSC_Country( 'GB' );
22
- $wpsc_country->set( 'region_label', __( 'County', 'wp-e-commerce' ) );
23
- }
24
-
25
- function _wpsc_fix_bad_checkout_form_rows() {
26
- global $wpdb;
27
-
28
- $rows = $wpdb->get_results( 'SELECT * from '. WPSC_TABLE_CHECKOUT_FORMS . ' WHERE `unique_name` = ""' );
29
-
30
- foreach ( $rows as $index => $row ) {
31
- // look for the unique name to be sure it doesn't already-exist, if it does, make it unique
32
- $new_unique_name = sanitize_title( $row->name );
33
-
34
- $count = $wpdb->get_var( 'SELECT count(*) FROM ' . WPSC_TABLE_CHECKOUT_FORMS . ' WHERE `unique_name` = "' . $new_unique_name .'"' );
35
- $count = intval( $count );
36
- if ( $count ) {
37
- $new_unique_name = sanitize_title( $row->name ) . '-' . ( $count + 1 );
38
- }
39
-
40
- $result = $wpdb->query(
41
- 'UPDATE ' . WPSC_TABLE_CHECKOUT_FORMS
42
- . ' SET `unique_name` = "' . $new_unique_name
43
- . '" WHERE id=' . $row->id
44
- );
45
- }
46
-
47
-
48
- $index = $wpdb->get_results( 'SHOW INDEX FROM `' . WPSC_TABLE_CHECKOUT_FORMS . '` WHERE KEY_NAME = "unique_name"' );
49
-
50
- if ( ! count( $index ) ) {
51
- // Add the new index
52
- $wpdb->query( 'ALTER TABLE `' . WPSC_TABLE_CHECKOUT_FORMS . '` ADD INDEX ( `unique_name` )' );
53
- }
54
- }
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
trunk/wpsc-admin/db-upgrades/routines/14.php DELETED
@@ -1,28 +0,0 @@
1
- <?php
2
- /**
3
- * Control database upgrade to version 14
4
- *
5
- * @access private
6
- * @since 3.9.0
7
- *
8
- */
9
- function _wpsc_db_upgrade_14() {
10
- _wpsc_fix_latvia_currency();
11
- }
12
-
13
- /**
14
- * Change Latvian currency to Euro.
15
- *
16
- * @access private
17
- * @since 3.9.0
18
- */
19
- function _wpsc_fix_latvia_currency() {
20
- $country = new WPSC_Country( array(
21
- 'isocode' => 'LV',
22
- 'currency' => __( 'Euro', 'wp-e-commerce' ),
23
- 'symbol' => __( '€', 'wp-e-commerce' ),
24
- 'symbol_html' => __( '&#8364;', 'wp-e-commerce' ),
25
- 'code' => __( 'EUR', 'wp-e-commerce' )
26
- ) );
27
-
28
- }
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
trunk/wpsc-admin/db-upgrades/routines/2.php DELETED
@@ -1,430 +0,0 @@
1
- <?php
2
-
3
- function _wpsc_db_upgrade_2() {
4
- _wpsc_fix_UK_country_code();
5
- _wpsc_fix_guernsey_country_code();
6
- _wpsc_new_country_serbia();
7
- _wpsc_new_country_montenegro();
8
- _wpsc_fix_timor_leste_name();
9
- _wpsc_new_country_aland_islands();
10
- _wpsc_new_country_saint_barthelemy();
11
- _wpsc_new_country_bonaire_et_al();
12
- _wpsc_new_country_curacao();
13
- _wpsc_new_country_saint_martin_french();
14
- _wpsc_new_country_palestinian_territories();
15
- _wpsc_update_israeli_new_shekel_symbol();
16
- _wpsc_new_country_sint_maarten_dutch();
17
- _wpsc_new_country_french_guiana();
18
- _wpsc_fix_netherlands_antille();
19
- _wpsc_fix_angola_kwanza();
20
- _wpsc_fix_aruban_florin();
21
- _wpsc_fix_azerbaijani_manat();
22
- _wpsc_fix_cyprus_currency();
23
- _wpsc_fix_republic_of_the_congo();
24
- _wpsc_fix_currency_el_salvador();
25
- _wpsc_fix_ghanaian_currency_code();
26
- _wpsc_fix_guatemala_currency();
27
- _wpsc_fix_guinea_bissau_currency();
28
- _wpsc_fix_madagascar_currency();
29
- _wpsc_fix_malta_currency();
30
- _wpsc_fix_mozambique_currency();
31
- _wpsc_fix_nicaragua_currency();
32
- _wpsc_fix_romania_currency();
33
- _wpsc_fix_san_marino_currency();
34
- _wpsc_fix_somalia_currency();
35
- _wpsc_fix_suriname_currency();
36
- _wpsc_fix_taiwan_currency();
37
- _wpsc_fix_tajikistan_currency();
38
- _wpsc_fix_tunisia_currency();
39
- _wpsc_fix_uganda_currency();
40
- _wpsc_fix_turkey_currency();
41
- _wpsc_fix_uruguay_currency();
42
- _wpsc_fix_venezuela_currency();
43
- _wpsc_fix_zimbabwe_currency();
44
- }
45
-
46
- function _wpsc_fix_UK_country_code() {
47
- $country = new WPSC_Country( array(
48
- 'isocode' => 'GB',
49
- 'country', __( 'United Kingdom', 'wp-e-commerce' )
50
- ) );
51
- }
52
-
53
- function _wpsc_fix_guernsey_country_code() {
54
- $existing_wpsc_country = new WPSC_Country( 'GF' );
55
- // replace the ISO country code in the existing country
56
- $updated_wpsc_country = new WPSC_Country( array( 'id' => $existing_wpsc_country->get_id(), 'isocode' => 'GG', ) );
57
- }
58
-
59
- function _wpsc_new_country_serbia() {
60
- $country = new WPSC_Country( array(
61
- 'id' => 243,
62
- 'country' => __( 'Serbia', 'wp-e-commerce' ),
63
- 'isocode' => 'RS',
64
- 'currency' => __('Serbian Dinar', 'wp-e-commerce'),
65
- 'code' => __('RSD', 'wp-e-commerce'),
66
- 'continent' => 'europe',
67
- 'visible' => '0',
68
- ) );
69
- }
70
-
71
- function _wpsc_new_country_montenegro() {
72
- $country = new WPSC_Country( array(
73
- 'id' => 244,
74
- 'country' => __( 'Montenegro', 'wp-e-commerce' ),
75
- 'isocode' => 'ME',
76
- 'currency' => __( 'Euro', 'wp-e-commerce' ),
77
- 'symbol' => __( '€', 'wp-e-commerce' ),
78
- 'symbol_html' => __( '&#8364;', 'wp-e-commerce' ),
79
- 'code' => __( 'EUR', 'wp-e-commerce' ),
80
- 'continent' => 'europe',
81
- 'visible' => '0',
82
- ) );
83
- }
84
-
85
- function _wpsc_fix_timor_leste_name() {
86
- $country = new WPSC_Country( array(
87
- 'id' => 245,
88
- 'country' => __( 'Timor-Leste', 'wp-e-commerce' ),
89
- 'isocode' => 'TL',
90
- 'currency' => __( 'US Dollar', 'wp-e-commerce' ),
91
- 'symbol' => __( '$', 'wp-e-commerce' ),
92
- 'symbol_html' => __( '&#036;', 'wp-e-commerce' ),
93
- 'code' => 'USD',
94
- 'continent' => 'asiapacific',
95
- 'visible' => '0',
96
- ) );
97
- }
98
-
99
- function _wpsc_new_country_aland_islands() {
100
- $country = new WPSC_Country( array(
101
- 'id' => 246,
102
- 'country' => __( 'Aland Islands', 'wp-e-commerce' ),
103
- 'isocode' => 'AX',
104
- 'currency' => __( 'Euro', 'wp-e-commerce' ),
105
- 'symbol' => __( '€', 'wp-e-commerce' ),
106
- 'symbol_html' => __( '&#8364;', 'wp-e-commerce' ),
107
- 'code' => __( 'EUR', 'wp-e-commerce' ),
108
- 'continent' => 'europe',
109
- 'visible' => '0',
110
- ) );
111
- }
112
-
113
- function _wpsc_new_country_saint_barthelemy() {
114
- $country = new WPSC_Country( array(
115
- 'id' => 247,
116
- 'country' => __( 'Saint Barthelemy', 'wp-e-commerce' ),
117
- 'isocode' => 'BL',
118
- 'currency' => __( 'Euro', 'wp-e-commerce' ),
119
- 'symbol' => __( '€', 'wp-e-commerce' ),
120
- 'symbol_html' => __( '&#8364;', 'wp-e-commerce' ),
121
- 'code' => __( 'EUR', 'wp-e-commerce' ),
122
- 'continent' => 'europe',
123
- 'visible' => '0',
124
- ) );
125
- }
126
-
127
- function _wpsc_new_country_bonaire_et_al() {
128
- $country = new WPSC_Country( array(
129
- 'id' => 248,
130
- 'country' => __( 'Bonaire, Sint Eustatius and Saba', 'wp-e-commerce' ),
131
- 'isocode' => 'BQ',
132
- 'currency' => __( 'US Dollar', 'wp-e-commerce' ),
133
- 'symbol' => __( '$', 'wp-e-commerce' ),
134
- 'symbol_html' => __( '&#036;', 'wp-e-commerce' ),
135
- 'code' => __( 'USD', 'wp-e-commerce' ),
136
- 'continent' => 'southamerica',
137
- 'visible' => '0',
138
- ) );
139
- }
140
-
141
- function _wpsc_new_country_curacao() {
142
- $country = new WPSC_Country( array(
143
- 'id' => 249,
144
- 'country' => __( 'Curacao', 'wp-e-commerce' ),
145
- 'isocode' => 'CW',
146
- 'currency' => __( 'Netherlands Antillean Guilder', 'wp-e-commerce' ),
147
- 'symbol' => __( 'ƒ', 'wp-e-commerce' ),
148
- 'symbol_html' => __( '&#402;', 'wp-e-commerce' ),
149
- 'code' => __( 'ANG', 'wp-e-commerce' ),
150
- 'continent' => 'southamerica',
151
- 'visible' => '0',
152
- ) );
153
- }
154
-
155
- function _wpsc_new_country_saint_martin_french() {
156
- $country = new WPSC_Country( array(
157
- 'id' => 250,
158
- 'country' => __( 'Saint Martin (French Part)', 'wp-e-commerce' ),
159
- 'isocode' => 'MF',
160
- 'currency' => __( 'Euro', 'wp-e-commerce' ),
161
- 'symbol' => __( '€', 'wp-e-commerce' ),
162
- 'symbol_html' => __( '&#8364;', 'wp-e-commerce' ),
163
- 'code' => __( 'EUR', 'wp-e-commerce' ),
164
- 'continent' => 'southamerica',
165
- 'visible' => '0',
166
- ) );
167
- }
168
-
169
- function _wpsc_new_country_palestinian_territories() {
170
- $country = new WPSC_Country( array(
171
- 'id' => 251,
172
- 'country' => __( 'Palestinian Territories', 'wp-e-commerce' ),
173
- 'isocode' => 'PS',
174
- 'currency' => __( 'Israeli New Shekel', 'wp-e-commerce' ),
175
- 'symbol' => __( '₪', 'wp-e-commerce' ),
176
- 'symbol_html' => __( '&#8362;', 'wp-e-commerce' ),
177
- 'code' => __( 'ILS', 'wp-e-commerce' ),
178
- 'continent' => 'asiapacific',
179
- 'visible' => '0',
180
- ) );
181
- }
182
-
183
- function _wpsc_update_israeli_new_shekel_symbol() {
184
- $country = new WPSC_Country( array(
185
- 'isocode' => 'IL',
186
- 'symbol' => __( '₪', 'wp-e-commerce' ),
187
- 'symbol_html' => __( '&#8362;', 'wp-e-commerce' ),
188
- ) );
189
- }
190
-
191
- function _wpsc_new_country_sint_maarten_dutch() {
192
- $country = new WPSC_Country( array(
193
- 'id' => 252,
194
- 'country' => __( 'Sint Maarten (Dutch Part)', 'wp-e-commerce' ),
195
- 'isocode' => 'SX',
196
- 'currency' => __( 'Netherlands Antillean Guilder', 'wp-e-commerce' ),
197
- 'symbol' => __( 'ƒ', 'wp-e-commerce' ),
198
- 'symbol_html' => __( '&#402;', 'wp-e-commerce' ),
199
- 'code' => __( 'ANG', 'wp-e-commerce' ),
200
- 'continent' => 'southamerica',
201
- 'visible' => '0',
202
- ) );
203
- }
204
-
205
- function _wpsc_new_country_french_guiana() {
206
- $country = new WPSC_Country( array(
207
- 'id' => 253,
208
- 'country' => __( 'French Guiana', 'wp-e-commerce' ),
209
- 'isocode' => 'GF',
210
- 'currency' => __( 'Euro', 'wp-e-commerce' ),
211
- 'symbol' => __( '€', 'wp-e-commerce' ),
212
- 'symbol_html' => __( '&#8364;', 'wp-e-commerce' ),
213
- 'code' => __( 'EUR', 'wp-e-commerce' ),
214
- 'continent' => 'southamerica',
215
- 'visible' => '0',
216
- ) );
217
- }
218
-
219
- function _wpsc_fix_netherlands_antille() {
220
- $country = new WPSC_Country( array(
221
- 'isocode' => 'AN',
222
- 'symbol' => __( 'ƒ', 'wp-e-commerce' ),
223
- 'symbol_html' => __( '&#402;', 'wp-e-commerce' ),
224
- 'continent' => 'southamerica',
225
- ) );
226
- }
227
-
228
- function _wpsc_fix_angola_kwanza() {
229
- $country = new WPSC_Country( array(
230
- 'isocode' => 'AO',
231
- 'code' => 'AOA',
232
- 'currency' => __( 'Angolan Kwanza', 'wp-e-commerce' ),
233
- 'symbol' => __( 'Kz', 'wp-e-commerce' ),
234
- 'symbol_html' => __( 'Kz', 'wp-e-commerce' ),
235
- ) );
236
- }
237
-
238
- function _wpsc_fix_aruban_florin() {
239
- $country = new WPSC_Country( array(
240
- 'isocode' => 'AW',
241
- 'currency' => __( 'Aruban Florin', 'wp-e-commerce' ),
242
- 'symbol' => __( 'Afl.', 'wp-e-commerce' ),
243
- 'symbol_html' => __( 'Afl.', 'wp-e-commerce' ),
244
- ) );
245
- }
246
-
247
- function _wpsc_fix_azerbaijani_manat() {
248
- $country = new WPSC_Country( array(
249
- 'isocode' => 'AZ',
250
- 'currency' => __('Azerbaijani Manat', 'wp-e-commerce'),
251
- 'code' => 'AZN',
252
- 'symbol' => _x( 'm', 'azerbaijani manat symbol', 'wp-e-commerce' ),
253
- 'symbol_html' => _x( 'm', 'azerbaijani manat symbol html', 'wp-e-commerce' ),
254
- ) );
255
- }
256
-
257
- function _wpsc_fix_cyprus_currency() {
258
- $country = new WPSC_Country( array(
259
- 'isocode' => 'CY',
260
- 'currency' => __( 'Euro', 'wp-e-commerce' ),
261
- 'symbol' => __( '€', 'wp-e-commerce' ),
262
- 'symbol_html' => __( '&#8364;', 'wp-e-commerce' ),
263
- 'code' => __( 'EUR', 'wp-e-commerce' ),
264
- ) );
265
- }
266
-
267
- function _wpsc_fix_republic_of_the_congo() {
268
- $country = new WPSC_Country( array(
269
- 'isocode' => 'CG',
270
- 'country' => __( 'Republic of the Congo', 'wp-e-commerce' ),
271
- ) );
272
- }
273
-
274
- function _wpsc_fix_currency_el_salvador() {
275
- $country = new WPSC_Country( array(
276
- 'isocode' => 'SV',
277
- 'currency' => __( 'US Dollar', 'wp-e-commerce' ),
278
- 'symbol' => __( '$', 'wp-e-commerce' ),
279
- 'symbol_html' => __( '&#036;', 'wp-e-commerce' ),
280
- 'code' => 'USD',
281
- ) );
282
- }
283
-
284
- function _wpsc_fix_ghanaian_currency_code() {
285
- $country = new WPSC_Country( array(
286
- 'isocode' => 'GH',
287
- 'code' => 'GHS',
288
- ) );
289
- }
290
-
291
- function _wpsc_fix_guatemala_currency() {
292
- $country = new WPSC_Country( array(
293
- 'isocode' => 'GT',
294
- 'code' => 'GTQ',
295
- ) );
296
- }
297
-
298
- function _wpsc_fix_guinea_bissau_currency() {
299
- $country = new WPSC_Country( array(
300
- 'isocode' => 'GW',
301
- 'currency' => __( 'CFA Franc BEAC', 'wp-e-commerce' ),
302
- 'code' => __('XAF', 'wp-e-commerce'),
303
- ) );
304
- }
305
-
306
- function _wpsc_fix_madagascar_currency() {
307
- $country = new WPSC_Country( array(
308
- 'isocode' => 'MG',
309
- 'currency' => __( 'Malagasy Ariary', 'wp-e-commerce' ),
310
- 'code' => __( 'MGA', 'wp-e-commerce' ),
311
- ) );
312
- }
313
-
314
- function _wpsc_fix_malta_currency() {
315
- $country = new WPSC_Country( array(
316
- 'isocode' => 'MT',
317
- 'currency' => __( 'Euro', 'wp-e-commerce' ),
318
- 'symbol' => __( '€', 'wp-e-commerce' ),
319
- 'symbol_html' => __( '&#8364;', 'wp-e-commerce' ),
320
- 'code' => __( 'EUR', 'wp-e-commerce' ),
321
- ) );
322
- }
323
-
324
- function _wpsc_fix_mozambique_currency() {
325
- $country = new WPSC_Country( array(
326
- 'isocode' => 'MZ',
327
- 'code' => __( 'MZN', 'wp-e-commerce' )
328
- ) );
329
- }
330
-
331
- function _wpsc_fix_nicaragua_currency() {
332
- $country = new WPSC_Country( array(
333
- 'isocode' => 'NI',
334
- 'code' => __( 'NIO', 'wp-e-commerce' )
335
- ) );
336
- }
337
-
338
- function _wpsc_fix_romania_currency() {
339
- $country = new WPSC_Country( array(
340
- 'isocode' => 'RO',
341
- 'currency' => __( 'Romanian New Leu', 'wp-e-commerce' )
342
- ) );
343
- }
344
-
345
- function _wpsc_fix_san_marino_currency() {
346
- $country = new WPSC_Country( array(
347
- 'isocode' => 'SM',
348
- 'currency' => __( 'Euro', 'wp-e-commerce' ),
349
- 'symbol' => __( '€', 'wp-e-commerce' ),
350
- 'symbol_html' => __( '&#8364;', 'wp-e-commerce' ),
351
- 'code' => __( 'EUR', 'wp-e-commerce' ),
352
- ) );
353
- }
354
-
355
- function _wpsc_fix_somalia_currency() {
356
- $country = new WPSC_Country( array(
357
- 'isocode' => 'SO',
358
- 'code' => __( 'SOS', 'wp-e-commerce' )
359
- ) );
360
- }
361
-
362
- function _wpsc_fix_suriname_currency() {
363
- $country = new WPSC_Country( array(
364
- 'isocode' => 'SR',
365
- 'currency' => __( 'Surinamese Dollar', 'wp-e-commerce' ),
366
- 'code' => __( 'SRD', 'wp-e-commerce' ),
367
- ) );
368
- }
369
-
370
- function _wpsc_fix_taiwan_currency() {
371
- $country = new WPSC_Country( array(
372
- 'isocode' => 'TW',
373
- 'currency' => __( 'New Taiwanese Dollar', 'wp-e-commerce' )
374
- ) );
375
- }
376
-
377
- function _wpsc_fix_tajikistan_currency() {
378
- $country = new WPSC_Country( array(
379
- 'isocode' => 'TJ',
380
- 'currency' => __( 'Tajikistan Somoni', 'wp-e-commerce' ),
381
- 'code' => __( 'TJS', 'wp-e-commerce' ),
382
- ) );
383
- }
384
-
385
- function _wpsc_fix_tunisia_currency() {
386
- $country = new WPSC_Country( array(
387
- 'isocode' => 'TN',
388
- 'currency' => __( 'Tunisian Dollar', 'wp-e-commerce' )
389
- ) );
390
- }
391
-
392
- function _wpsc_fix_turkey_currency() {
393
- $country = new WPSC_Country( array(
394
- 'isocode' => 'TR',
395
- 'code' => __( 'TRY', 'wp-e-commerce' )
396
- ) );
397
- }
398
-
399
- function _wpsc_fix_uganda_currency() {
400
- $country = new WPSC_Country( array(
401
- 'isocode' => 'UG',
402
- 'code' => __( 'UGX', 'wp-e-commerce' )
403
- ) );
404
- }
405
-
406
- function _wpsc_fix_uruguay_currency() {
407
- $country = new WPSC_Country( array(
408
- 'isocode' => 'UY',
409
- 'code' => __( 'UYU', 'wp-e-commerce' )
410
- ) );
411
- }
412
-
413
- function _wpsc_fix_venezuela_currency() {
414
- $country = new WPSC_Country( array(
415
- 'isocode' => 'VE',
416
- 'currency' => __( 'Venezuelan Bolivar Fuerte', 'wp-e-commerce' ),
417
- 'code' => __( 'VEF', 'wp-e-commerce' ),
418
- ) );
419
- }
420
-
421
- function _wpsc_fix_zimbabwe_currency() {
422
- $country = new WPSC_Country( array(
423
- 'isocode' => 'ZW',
424
- 'currency' => __( 'US Dollar', 'wp-e-commerce' ),
425
- 'symbol' => __( '$', 'wp-e-commerce' ),
426
- 'symbol_html' => __( '&#036;', 'wp-e-commerce' ),
427
- 'code' => 'USD',
428
- 'continent' => 'asiapacific',
429
- ) );
430
- }
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
trunk/wpsc-admin/db-upgrades/routines/3.php DELETED
@@ -1,18 +0,0 @@
1
- <?php
2
-
3
- function _wpsc_db_upgrade_3() {
4
- _wpsc_maybe_create_UK();
5
- }
6
-
7
- function _wpsc_maybe_create_UK() {
8
- $country = new WPSC_Country( array(
9
- 'isocode' => 'GB',
10
- 'id' => 138,
11
- 'country' => __( 'United Kingdom', 'wp-e-commerce' ),
12
- 'currency' => __( 'Pound Sterling', 'wp-e-commerce' ),
13
- 'symbol' => __( '£', 'wp-e-commerce' ),
14
- 'symbol_html' => __( '&#163;', 'wp-e-commerce' ),
15
- 'code' => __( 'GBP', 'wp-e-commerce' ),
16
- 'continent' => 'europe',
17
- ) );
18
- }
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
trunk/wpsc-admin/db-upgrades/routines/4.php DELETED
@@ -1,53 +0,0 @@
1
- <?php
2
-
3
- function _wpsc_db_upgrade_4() {
4
- _wpsc_maybe_update_submitted_form_data_value();
5
- _wpsc_maybe_update_user_log_file();
6
- }
7
-
8
- function _wpsc_maybe_update_submitted_form_data_value() {
9
- global $wpdb;
10
- $wpdb->query( 'ALTER TABLE ' . WPSC_TABLE_SUBMITTED_FORM_DATA . ' MODIFY value LONGTEXT;' );
11
- }
12
-
13
- function _wpsc_maybe_update_user_log_file() {
14
- $hashes = array(
15
- '3.8' => '1526bcf18869f9ea2f4061f528a1a21a',
16
- '3.8.4' => '1d17c7fb086e2afcf942ca497629b4c9',
17
- '3.8.8' => 'f9549ba1b1956c78f96b1551ab965c13',
18
- '3.8.9' => '4d0bcba88d211147399e79661cf3b41d',
19
- '3.8.10' => '09e2cb9c753587c9228a4e9e8008a82f',
20
- );
21
-
22
- if ( function_exists( 'wpsc_flush_theme_transients' ) ) {
23
- wpsc_flush_theme_transients( true );
24
- }
25
-
26
- // Using TEv2
27
- if ( ! function_exists( 'wpsc_get_template_file_path' ) ) {
28
- return;
29
- }
30
-
31
- //Make sure the theme has actually been moved.
32
- $file = wpsc_get_template_file_path( 'wpsc-user-log.php' );
33
-
34
- if ( false !== strpos( WPSC_CORE_THEME_PATH, $file ) ) {
35
- return;
36
- }
37
-
38
- //If it has been moved, but it's the 3.8.10 version, we should be good to go.
39
- $hash = md5_file( $file );
40
-
41
- if ( $hashes['3.8.10'] === $hash ) {
42
- return;
43
- }
44
-
45
- //At this point, we know the file has been moved to the active file folder. Checking now if it has been modified.
46
- if ( in_array( $hash, $hashes ) ) {
47
- //We now know that they've moved the file, but haven't actually changed anything. We can safely overwrite the file with the new core file.
48
- @ copy( $file, path_join( get_stylesheet_directory(), 'wpsc-user-log.php' ) );
49
- } else {
50
- //This means they have indeed changed the file. We need to add a notice letting them know about the issue and how to fix it.
51
- update_option( '_wpsc_3811_user_log_notice', '1' );
52
- }
53
- }
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
trunk/wpsc-admin/db-upgrades/routines/5.php DELETED
@@ -1,49 +0,0 @@
1
- <?php
2
-
3
- function _wpsc_db_upgrade_5() {
4
- _wpsc_maybe_update_product_meta_array_keys();
5
- }
6
-
7
- /**
8
- * Rename old _wpsc_* product metadata array keys so they no longer include the '_wpsc_' prefix
9
- * See https://github.com/wp-e-commerce/WP-e-Commerce/issues/492 for details
10
- */
11
- function _wpsc_maybe_update_product_meta_array_keys() {
12
- global $wpdb;
13
-
14
- $product_ids = $wpdb->get_col( "SELECT post_id FROM $wpdb->postmeta WHERE meta_key='_wpsc_product_metadata' AND meta_value LIKE '%_wpsc_%'" );
15
-
16
- foreach ( $product_ids as $product_id ) {
17
- $metadata_needs_saving = false;
18
- $product_metadata = get_post_meta( $product_id, '_wpsc_product_metadata', true );
19
- if ( is_array( $product_metadata ) ) {
20
- foreach ( $product_metadata as $meta_key => $meta_value ) {
21
- if ( '_wpsc_' === substr( $meta_key, 0, 6 ) ) {
22
- /*
23
- Typical meta keys that need renaming are:
24
- wpsc_url_name
25
- _wpsc_sku
26
- _wpsc_dimensions
27
- _wpsc_engraved
28
- _wpsc_can_have_uploaded_image
29
- _wpsc_unpublish_oos
30
- */
31
- $new_meta_key = substr( $meta_key, 6 );
32
-
33
- // remove the old (_wpsc_ prefixed) metadata from the array
34
- unset ( $product_metadata[ $meta_key ] );
35
- $metadata_needs_saving = true;
36
-
37
- // If metadata doesn't already exist with the new non-prefixed key, add it to the array
38
- // This check ensures that we don't overwrite newer product metadata
39
- if ( ! isset( $product_metadata[ $new_meta_key ] ) ) {
40
- $product_metadata[ $new_meta_key ] = $meta_value;
41
- }
42
- }
43
- }
44
- }
45
- if ( $metadata_needs_saving ) {
46
- update_post_meta( $product_id, '_wpsc_product_metadata', $product_metadata );
47
- }
48
- }
49
- }
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
trunk/wpsc-admin/db-upgrades/routines/6.php DELETED
@@ -1,12 +0,0 @@
1
- <?php
2
- require_once( WPSC_FILE_PATH . '/wpsc-includes/wpsc-meta-init.php' );
3
-
4
- function _wpsc_db_upgrade_6() {
5
- _wpsc_maybe_create_meta_tables();
6
- }
7
-
8
- function _wpsc_maybe_create_meta_tables() {
9
-
10
- _wpsc_create_cart_item_meta_table();
11
- _wpsc_meta_migrate_wpsc_cart_item();
12
- }
 
 
 
 
 
 
 
 
 
 
 
 
trunk/wpsc-admin/db-upgrades/routines/7.php DELETED
@@ -1,36 +0,0 @@
1
- <?php
2
-
3
- function _wpsc_db_upgrade_7() {
4
- _wpsc_migrate_user_meta();
5
- }
6
-
7
- function _wpsc_migrate_user_meta() {
8
- global $wpdb;
9
-
10
- $sql = "
11
- SELECT *
12
- FROM {$wpdb->usermeta}
13
- WHERE
14
- meta_key LIKE '_wpsc_%customer_profile';
15
- ";
16
-
17
- $results = $wpdb->get_results( $sql );
18
-
19
- foreach ( $results as $row ) {
20
- preg_match( '/_wpsc_(.*)customer_profile/', $row->meta_key, $matches );
21
- $blog_prefix = $matches[1];
22
-
23
- $profile = maybe_unserialize( $row->meta_value );
24
-
25
- foreach ( $profile as $key => $value ) {
26
- $internal_key = "{$blog_prefix}_wpsc_{$key}";
27
- $current_value = get_user_meta( $row->user_id, $internal_key, true );
28
-
29
- if ( $current_value === '' && $value ) {
30
- update_user_meta( $row->user_id, $internal_key, $value );
31
- }
32
- }
33
-
34
- delete_user_meta( $row->user_id, $row->meta_key );
35
- }
36
- }
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
trunk/wpsc-admin/db-upgrades/routines/8.php DELETED
@@ -1,12 +0,0 @@
1
- <?php
2
-
3
- function _wpsc_db_upgrade_8() {
4
- _wpsc_fix_bulgaria_currency();
5
- }
6
-
7
- function _wpsc_fix_bulgaria_currency() {
8
- $country = new WPSC_Country( array(
9
- 'isocode' => 'BG',
10
- 'code' => __( 'BGN', 'wp-e-commerce' ),
11
- ) );
12
- }
 
 
 
 
 
 
 
 
 
 
 
 
trunk/wpsc-admin/db-upgrades/routines/9.php DELETED
@@ -1,13 +0,0 @@
1
- <?php
2
-
3
- require_once( WPSC_FILE_PATH . '/wpsc-includes/wpsc-meta-init.php' );
4
-
5
- function _wpsc_db_upgrade_9() {
6
- _wpsc_maybe_create_purchase_meta_tables();
7
- }
8
-
9
- function _wpsc_maybe_create_purchase_meta_tables() {
10
-
11
- _wpsc_create_purchase_meta_table();
12
- _wpsc_meta_migrate_wpsc_purchase();
13
- }
 
 
 
 
 
 
 
 
 
 
 
 
 
trunk/wpsc-admin/db-upgrades/upgrade.php DELETED
@@ -1,155 +0,0 @@
1
- <?php
2
- /**
3
- * Upgrade routines
4
- *
5
- * @since 3.8.9
6
- * @access private
7
- * @package wp-e-commerce
8
- */
9
-
10
- /**
11
- * Execute upgrade routines if necessary
12
- *
13
- * @access private
14
- * @since 3.8.9
15
- */
16
- function _wpsc_maybe_upgrade() {
17
- $current_db_ver = (int) get_option( 'wpsc_db_version', 0 );
18
-
19
- if ( ! _wpsc_needs_upgrade() )
20
- return;
21
-
22
- for ( $i = $current_db_ver + 1; $i <= WPSC_DB_VERSION; $i++ ) {
23
- $file_path = WPSC_FILE_PATH . '/wpsc-admin/db-upgrades/routines/' . $i . '.php';
24
-
25
- if ( file_exists( $file_path ) ) {
26
- require_once( $file_path );
27
- }
28
-
29
- if ( ! function_exists( '_wpsc_db_upgrade_' . $i ) ) {
30
- continue;
31
- }
32
-
33
- wpsc_core_flush_temporary_data();
34
-
35
- call_user_func( '_wpsc_db_upgrade_' . $i );
36
- update_option( 'wpsc_db_version', $i );
37
- }
38
-
39
- wpsc_core_flush_temporary_data();
40
- }
41
-
42
- function _wpsc_upgrade_display_backup_warning() {
43
- $message = __( '<strong>Important:</strong> Before proceeding with the database upgrade, <a href="%1$s">please backup your database and files</a>.<br>We recommend using <a href="%2$s">VaultPress</a> or <a href="%3$s">BackupBuddy</a> to regularly backup your WordPress installation.', 'wp-e-commerce' );
44
- $message = sprintf(
45
- $message,
46
- 'http://codex.wordpress.org/WordPress_Backups',
47
- 'http://vaultpress.com/',
48
- 'http://ithemes.com/member/go.php?r=45982&i=l44'
49
- );
50
- ?>
51
- <div id="wpsc-upgrade-warning" class="updated">
52
- <p><?php echo $message; ?></p>
53
- </div>
54
- <?php
55
- }
56
-
57
- function _wpsc_upgrade_display_prompt() {
58
- $message = __( '<strong>WP eCommerce %1$s is almost ready.</strong> Some database routines need to be run before the upgrade is complete. <a href="%2$s">Click here to start!</a>', 'wp-e-commerce' );
59
- $message = sprintf( $message, WPSC_VERSION, admin_url( '?page=wpsc-db-upgrade' ) );
60
- ?>
61
- <div id="wpsc-upgrade-warning" class="error">
62
- <p><?php echo $message; ?></p>
63
- </div>
64
- <?php
65
- }
66
-
67
- function _wpsc_upgrade_display_successful() {
68
- $message = __( 'WP eCommerce has been successfully updated to %s. Enjoy!', 'wp-e-commerce' );
69
- $message = sprintf( $message, WPSC_VERSION );
70
- ?>
71
- <div id="wpsc-upgrade-warning" class="updated">
72
- <p><?php echo $message; ?></p>
73
- </div>
74
- <?php
75
- }
76
-
77
- function _wpsc_action_admin_notices_db_upgrade() {
78
- if ( ! empty( $_GET['wpsc_db_upgrade_successful'] ) ) {
79
- _wpsc_upgrade_display_successful();
80
- } elseif ( _wpsc_is_db_upgrade_page() ) {
81
- _wpsc_upgrade_display_backup_warning();
82
- } elseif ( _wpsc_needs_upgrade() ) {
83
- _wpsc_upgrade_display_prompt();
84
- }
85
- }
86
- add_action( 'admin_notices', '_wpsc_action_admin_notices_db_upgrade' );
87
-
88
- function _wpsc_needs_3dot7_db_upgrade() {
89
- global $wpdb;
90
-
91
- static $return = null;
92
-
93
- if ( is_null( $return ) ) {
94
- // in case this installation was first installed using 3.8.x, then return false
95
- if ( ! get_option( 'wpsc_needs_update', false ) ) {
96
- $return = false;
97
- } else {
98
- // in case this installation was first installed using 3.7.x, we need to check whether
99
- // the legacy database table exists, and if there are any products remain in that table
100
- $table_exists = $wpdb->get_var( "SHOW TABLES LIKE '" . WPSC_TABLE_PRODUCT_LIST . "'" );
101
- $product_count = empty( $table_exists ) ? 0 : $wpdb->get_var( "SELECT COUNT(*) FROM " . WPSC_TABLE_PRODUCT_LIST );
102
-
103
- $return = $product_count > 0;
104
- }
105
- }
106
-
107
- return $return;
108
- }
109
-
110
- function _wpsc_needs_upgrade() {
111
- if ( ! current_user_can( 'update_plugins' ) )
112
- return false;
113
-
114
- $current_db_ver = get_option( 'wpsc_db_version', 0 );
115
-
116
- if ( WPSC_DB_VERSION <= $current_db_ver )
117
- return false;
118
-
119
- // if upgrading from 3.7.x, avoid displaying this notification until 3.7.x db has been successfully
120
- // migrated
121
- if ( _wpsc_needs_3dot7_db_upgrade() )
122
- return false;
123
-
124
- return true;
125
- }
126
-
127
- function _wpsc_is_db_upgrade_page() {
128
- $current_screen = get_current_screen();
129
- return ! empty( $current_screen->id ) && 'dashboard_page_wpsc-db-upgrade' == $current_screen->id;
130
- }
131
-
132
- function _wpsc_action_admin_menu_db_upgrade() {
133
- if ( _wpsc_needs_upgrade() ) {
134
- $page_hook = add_submenu_page( 'index.php', __( 'Database Upgrade', 'wp-e-commerce' ), __( 'Database Upgrade', 'wp-e-commerce' ), 'update_plugins', 'wpsc-db-upgrade', '_wpsc_callback_display_db_upgrade_page' );
135
- add_action( 'load-' . $page_hook, '_wpsc_action_load_db_upgrade' );
136
- }
137
- }
138
- add_action( 'admin_menu', '_wpsc_action_admin_menu_db_upgrade' );
139
-
140
- function _wpsc_action_load_db_upgrade() {
141
- if ( empty( $_REQUEST['action'] ) )
142
- return;
143
-
144
- check_admin_referer( 'wpsc_db_upgrade' );
145
-
146
- _wpsc_maybe_upgrade();
147
-
148
- wp_redirect( esc_url_raw( add_query_arg( 'wpsc_db_upgrade_successful', 1, admin_url() ) ) );
149
- exit;
150
- }
151
-
152
- function _wpsc_callback_display_db_upgrade_page() {
153
- $update_title = sprintf( __( 'Your database needs to be upgraded before you can use WP eCommerce %s', 'wp-e-commerce' ), WPSC_VERSION );
154
- include( 'views/main.php' );
155
- }
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
trunk/wpsc-admin/db-upgrades/views/main.php DELETED
@@ -1,11 +0,0 @@
1
- <div class="wrap">
2
- <div id="icon-tools" class="icon32"><br></div>
3
- <h2><?php esc_html_e( 'WP eCommerce Database Upgrade', 'wp-e-commerce' ); ?></h2>
4
- <form class="wpsc-db-upgrade" action="" method="post">
5
- <h3><?php echo esc_html( $update_title ); ?></h3>
6
- <p><?php esc_html_e( 'Click "Start Database Upgrade" when you are ready.', 'wp-e-commerce' ); ?></p>
7
- <?php wp_nonce_field( 'wpsc_db_upgrade' ); ?>
8
- <input type="hidden" name="action" value="start_upgrade" />
9
- <?php submit_button( __( 'Start Database Upgrade', 'wp-e-commerce' ), 'primary', 'submit', false ); ?>
10
- </form>
11
- </div>
 
 
 
 
 
 
 
 
 
 
 
trunk/wpsc-admin/display-coupon-add.php DELETED
@@ -1,133 +0,0 @@
1
- <div class="wrap" id="coupon_data">
2
- <div id="add_coupon_box">
3
- <h2><?php _e( 'Add Coupon', 'wp-e-commerce' ); ?></h2>
4
- <form name='add_coupon' method="post" action="<?php echo admin_url( 'edit.php?post_type=wpsc-product&page=wpsc-edit-coupons' ); ?>">
5
- <table class="form-table">
6
- <tbody>
7
-
8
- <?php do_action( 'wpsc_coupon_add_top' ); ?>
9
-
10
- <tr class="form-field">
11
- <th scope="row" valign="top">
12
- <label for="add_coupon_code"><?php _e( 'Coupon Code', 'wp-e-commerce' ); ?></label>
13
- </th>
14
- <td>
15
- <input name="add_coupon_code" id="add_coupon_code" type="text" style="width: 300px;"/>
16
- <p class="description"><?php _e( 'The code entered to receive the discount', 'wp-e-commerce' ); ?></p>
17
- </td>
18
- </tr>
19
-
20
- <tr class="form-field" id="discount_amount">
21
- <th scope="row" valign="top">
22
- <label for="add-coupon-code"><?php _e( 'Discount', 'wp-e-commerce' ); ?></label>
23
- </th>
24
- <td>
25
- <input name="add_discount" step=".01" id="add-coupon-code" type="number" class="small-text" min="0" style="width: 300px" />
26
- <p class="description"><?php _e( 'The discount amount', 'wp-e-commerce' ); ?></p>
27
- </td>
28
- </tr>
29
-
30
- <tr class="form-field">
31
- <th scope="row" valign="top">
32
- <label for="add_discount_type"><?php _e( 'Discount Type', 'wp-e-commerce' ); ?></label>
33
- </th>
34
- <td>
35
- <select name='add_discount_type' id='add_discount_type'>
36
- <option value='0'><?php _e( 'Fixed Amount', 'wp-e-commerce' ); ?></option>
37
- <option value='1'><?php _e( 'Percentage', 'wp-e-commerce' ); ?></option>
38
- <option value='2'><?php _e( 'Free shipping', 'wp-e-commerce' ); ?></option>
39
- </select>
40
- <p class="description"><?php _e( 'The discount type', 'wp-e-commerce' ); ?></p>
41
- </td>
42
- </tr>
43
-
44
- <tr class="form-field">
45
- <th scope="row" valign="top">
46
- <label for="add_start"><?php _e( 'Start and End', 'wp-e-commerce' ); ?></label>
47
- </th>
48
- <td>
49
- <span class="description"><?php _e( 'Start: ', 'wp-e-commerce' ); ?></span>
50
- <input name="add_start" id="add_start" type="text" class="regular-text pickdate" style="width: 100px"/>
51
- <span class="description"><?php _e( 'End: ', 'wp-e-commerce' ); ?></span>
52
- <input name="add_end" id="add_end" type="text" class="regular-text pickdate" style="width: 100px"/>
53
- <p class="description"><?php _e( 'If date fields are left empty, there will be no expiration on this coupon.', 'wp-e-commerce' ); ?></p>
54
- </td>
55
- </tr>
56
-
57
- <tr>
58
- <th scope="row" valign="top">
59
- <?php _e( 'Active', 'wp-e-commerce' ); ?>
60
- </th>
61
- <td>
62
- <input type='hidden' value='0' name='add_active' />
63
- <input type="checkbox" value='1' checked='checked' name='add_active' id="add_active" />
64
- <label for="add_active"><?php _e( 'Activate coupon on creation.', 'wp-e-commerce' ) ?></label>
65
- </td>
66
- </tr>
67
-
68
- <tr>
69
- <th scope="row" valign="top">
70
- <?php _e( 'Use Once', 'wp-e-commerce' ); ?>
71
- </th>
72
- <td>
73
- <input type='hidden' value='0' name='add_use-once' />
74
- <input type='checkbox' value='1' name='add_use-once' id="add_use-once" />
75
- <label for="add_use-once"><?php _e( 'Deactivate coupon after it has been used.', 'wp-e-commerce' ) ?></label>
76
- </td>
77
- </tr>
78
-
79
- <tr>
80
- <th scope="row" valign="top">
81
- <?php _e( 'Apply On All Products', 'wp-e-commerce' ); ?>
82
- </th>
83
- <td>
84
- </span><input type='hidden' value='0' name='add_every_product' />
85
- <input type="checkbox" value="1" name='add_every_product' id="add_every-product"/>
86
- <label for="add_every-product"><?php _e( 'This coupon affects each product at checkout.', 'wp-e-commerce' ) ?></label>
87
- </td>
88
- </tr>
89
-
90
- <tr class="form-field coupon-conditions">
91
- <th scope="row" valign="top">
92
- <label><strong><?php _e( 'Conditions', 'wp-e-commerce' ); ?></strong></label>
93
- </th>
94
- <td>
95
- <input type="hidden" name="rules[operator][]" value="" />
96
- <div class='coupon-condition'>
97
- <select class="ruleprops" name="rules[property][]">
98
- <option value="item_name" rel="order"><?php _e( 'Item name', 'wp-e-commerce' ); ?></option>
99
- <option value="item_quantity" rel="order"><?php _e( 'Item quantity', 'wp-e-commerce' ); ?></option>
100
- <option value="total_quantity" rel="order"><?php _e( 'Total quantity', 'wp-e-commerce' ); ?></option>
101
- <option value="subtotal_amount" rel="order"><?php _e( 'Subtotal amount', 'wp-e-commerce' ); ?></option>
102
- <?php echo apply_filters( 'wpsc_coupon_rule_property_options', '' ); ?>
103
- </select>
104
-
105
- <select name="rules[logic][]">
106
- <option value="equal"><?php _e( 'Is equal to', 'wp-e-commerce' ); ?></option>
107
- <option value="greater"><?php _e( 'Is greater than', 'wp-e-commerce' ); ?></option>
108
- <option value="less"><?php _e( 'Is less than', 'wp-e-commerce' ); ?></option>
109
- <option value="contains"><?php _e( 'Contains', 'wp-e-commerce' ); ?></option>
110
- <option value="not_contain"><?php _e( 'Does not contain', 'wp-e-commerce' ); ?></option>
111
- <option value="begins"><?php _e( 'Begins with', 'wp-e-commerce' ); ?></option>
112
- <option value="ends"><?php _e( 'Ends with', 'wp-e-commerce' ); ?></option>
113
- <option value="category"><?php _e( 'In Category', 'wp-e-commerce' ); ?></option>
114
- <?php echo apply_filters( 'wpsc_coupon_rule_logic_options', '' ); ?>
115
- </select>
116
-
117
- <input type="text" name="rules[value][]" style="width: 150px;"/>
118
- <a title="<?php esc_attr_e( 'Delete condition', 'wp-e-commerce' ); ?>" class="button-secondary wpsc-button-round wpsc-button-minus" href="#"><?php echo _x( '&ndash;', 'delete item', 'wp-e-commerce' ); ?></a>
119
- <a title="<?php esc_attr_e( 'Add condition', 'wp-e-commerce' ); ?>" class="button-secondary wpsc-button-round wpsc-button-plus" href="#"><?php echo _x( '+', 'add item', 'wp-e-commerce' ); ?></a>
120
- </div>
121
- </td>
122
- </tr>
123
-
124
- <?php do_action( 'wpsc_coupon_add_bottom' ); ?>
125
-
126
- </tbody>
127
- </table>
128
- <?php wp_nonce_field( 'wpsc_coupon', 'wpsc-coupon-add' ); ?>
129
- <?php submit_button( __( 'Add Coupon', 'wp-e-commerce' ), 'primary', 'add_coupon' ); ?>
130
-
131
- </form>
132
- </div>
133
- </div><!--end .wrap-->
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
trunk/wpsc-admin/display-coupon-edit.php DELETED
@@ -1,183 +0,0 @@
1
- <?php
2
-
3
- // Die if accessed directly
4
- if ( ! defined( 'ABSPATH' ) ) {
5
- die();
6
- }
7
-
8
- $coupon = new WPSC_Coupon( $_GET['coupon'] );
9
-
10
- ?>
11
- <div class="wrap" id="coupon_data">
12
- <div id="edit_coupon_box">
13
- <h2><?php _e( 'Edit Coupon', 'wp-e-commerce' ); ?></h2>
14
-
15
- <script type='text/javascript'>
16
- jQuery(".pickdate").datepicker();
17
- /* jQuery datepicker selector */
18
- if (typeof jQuery('.pickdate').datepicker != "undefined") {
19
- jQuery('.pickdate').datepicker({ dateFormat: 'yy-mm-dd' });
20
- }
21
- </script>
22
- <form name='edit_coupon' method="post" action="<?php echo admin_url( 'edit.php?post_type=wpsc-product&page=wpsc-edit-coupons' ); ?>">
23
- <table class="form-table">
24
- <tbody>
25
-
26
- <?php do_action( 'wpsc_coupon_edit_top', $coupon->get( 'id' ), $coupon->get_data() ); ?>
27
-
28
- <tr class="form-field">
29
- <th scope="row" valign="top">
30
- <label for="edit_coupon_code"><?php _e( 'Coupon Code', 'wp-e-commerce' ); ?></label>
31
- </th>
32
- <td>
33
- <input name="edit_coupon_code" id="edit_coupon_code" type="text" value="<?php echo esc_attr( $coupon->get( 'coupon_code' ) ); ?>" style="width: 300px;"/>
34
- <p class="description"><?php _e( 'The code entered to receive the discount', 'wp-e-commerce' ); ?></p>
35
- </td>
36
- </tr>
37
-
38
- <tr class="form-field" id="discount_amount">
39
- <th scope="row" valign="top">
40
- <label for="edit_coupon_amount"><?php _e( 'Discount', 'wp-e-commerce' ); ?></label>
41
- </th>
42
- <td>
43
- <input name="edit_coupon_amount" id="edit_coupon_amount" type="number" step=".01" value="<?php echo esc_attr( $coupon->get( 'value' ) ); ?>" class="small-text" min="0" style="width: 300px" />
44
- <p class="description"><?php _e( 'The discount amount', 'wp-e-commerce' ); ?></p>
45
- </td>
46
- </tr>
47
-
48
- <tr class="form-field">
49
- <th scope="row" valign="top">
50
- <label for="edit_discount_type"><?php _e( 'Discount Type', 'wp-e-commerce' ); ?></label>
51
- </th>
52
- <td>
53
- <?php $type = absint( $coupon->get( 'is-percentage' ) ); ?>
54
- <select name='edit_discount_type' id='edit_discount_type'>
55
- <option value='0'<?php selected( 0, $type ); ?>><?php _e( 'Fixed Amount', 'wp-e-commerce' ); ?></option>
56
- <option value='1'<?php selected( 1, $type ); ?>><?php _e( 'Percentage', 'wp-e-commerce' ); ?></option>
57
- <option value='2'<?php selected( 2, $type ); ?>><?php _e( 'Free shipping', 'wp-e-commerce' ); ?></option>
58
- </select>
59
- <p class="description"><?php _e( 'The discount type', 'wp-e-commerce' ); ?></p>
60
-
61
- <?php $display = $type == 2 ? '' : 'style="display:none;"'; ?>
62
- </td>
63
- </tr>
64
-
65
- <tr class="form-field">
66
- <th scope="row" valign="top">
67
- <label for="edit_coupon_start"><?php _e( 'Start and End', 'wp-e-commerce' ); ?></label>
68
- </th>
69
- <td>
70
- <?php
71
- $start = $coupon->get( 'start' ) == '0000-00-00 00:00:00' ? '' : get_date_from_gmt( $coupon->get( 'start' ), 'Y-m-d' );
72
- $end = $coupon->get( 'expiry' ) == '0000-00-00 00:00:00' ? '' : get_date_from_gmt( $coupon->get( 'expiry' ), 'Y-m-d' );
73
- ?>
74
- <span class="description"><?php _e( 'Start: ', 'wp-e-commerce' ); ?></span>
75
- <input name="edit_coupon_start" id="edit_coupon_start" type="text" value="<?php echo esc_attr( $start ); ?>" class="regular-text pickdate" style="width: 100px"/>
76
- <span class="description"><?php _e( 'End: ', 'wp-e-commerce' ); ?></span>
77
- <input name="edit_coupon_end" id="edit_coupon_end" type="text" value="<?php echo esc_attr( $end ); ?>" class="regular-text pickdate" style="width: 100px"/>
78
- <p class="description"><?php _e( 'If date fields are left empty, there will be no expiration on this coupon.', 'wp-e-commerce' ); ?></p>
79
- </td>
80
- </tr>
81
-
82
- <tr>
83
- <th scope="row" valign="top">
84
- <?php _e( 'Active', 'wp-e-commerce' ); ?>
85
- </th>
86
- <td>
87
- <input type='hidden' value='0' name='edit_coupon_active' />
88
- <input type="checkbox" value='1'<?php checked( 1, $coupon->get( 'active' ) ); ?> name='edit_coupon_active' id="edit_coupon_active" />
89
- <label for="edit_coupon_active"><?php _e( 'Is this coupon active?', 'wp-e-commerce' ) ?></label>
90
- </td>
91
- </tr>
92
-
93
- <tr>
94
- <th scope="row" valign="top">
95
- <?php _e( 'Use Once', 'wp-e-commerce' ); ?>
96
- </th>
97
- <td>
98
- <input type='hidden' value='0' name='edit_coupon_use_once' />
99
- <input type='checkbox' value='1'<?php checked( 1, $coupon->get( 'use-once' ) ); ?> name='edit_coupon_use_once' id="edit_coupon_use_once" />
100
- <label for="edit_coupon_use_once"><?php _e( 'Deactivate coupon after it has been used.', 'wp-e-commerce' ) ?></label>
101
- </td>
102
- </tr>
103
-
104
- <tr>
105
- <th scope="row" valign="top">
106
- <?php _e( 'Apply On All Products', 'wp-e-commerce' ); ?>
107
- </th>
108
- <td>
109
- </span><input type='hidden' value='0' name='edit_coupon_every_product' />
110
- <input type="checkbox" value="1"<?php checked( 1, $coupon->get( 'every_product' ) ); ?> name='edit_coupon_every_product' id="edit-coupon-every-product"/>
111
- <label for="edit-coupon-every-product"><?php _e( 'This coupon affects each product at checkout.', 'wp-e-commerce' ) ?></label>
112
- </td>
113
- </tr>
114
-
115
- <tr class="form-field coupon-conditions">
116
- <th scope="row" valign="top">
117
- <label><strong><?php _e( 'Conditions', 'wp-e-commerce' ); ?></strong></label>
118
- </th>
119
- <td>
120
- <input type="hidden" name="rules[operator][]" value="" />
121
- <?php
122
- $conditions = maybe_unserialize( $coupon->get( 'condition' ) );
123
-
124
- if ( empty( $conditions ) )
125
- $conditions = array(
126
- array(
127
- 'property' => '',
128
- 'logic' => '',
129
- 'value' => '',
130
- )
131
- );
132
- foreach ( $conditions as $key => $condition ) :
133
- ?>
134
- <div class='coupon-condition'>
135
- <?php
136
- if ( isset( $condition["operator"] ) && ! empty( $condition["operator"] ) ) :
137
- ?>
138
- <select name="rules[operator][]">
139
- <option value="and"<?php selected( 'and', $condition["operator"] ); ?>><?php _ex( 'AND', 'Coupon comparison logic', 'wp-e-commerce' );?></option>
140
- <option value="or"<?php selected( 'or' , $condition["operator"] ); ?>><?php _ex( 'OR' , 'Coupon comparison logic', 'wp-e-commerce' );?></option>
141
- </select>
142
- <?php endif; ?>
143
- <select class="ruleprops" name="rules[property][]">
144
- <option value="item_name"<?php selected( 'item_name', $condition['property'] ); ?> rel="order"><?php _e( 'Item name', 'wp-e-commerce' ); ?></option>
145
- <option value="item_quantity"<?php selected( 'item_quantity', $condition['property'] ); ?> rel="order"><?php _e( 'Item quantity', 'wp-e-commerce' ); ?></option>
146
- <option value="total_quantity"<?php selected( 'total_quantity', $condition['property'] ); ?> rel="order"><?php _e( 'Total quantity', 'wp-e-commerce' ); ?></option>
147
- <option value="subtotal_amount"<?php selected( 'subtotal_amount', $condition['property'] ); ?> rel="order"><?php _e( 'Subtotal amount', 'wp-e-commerce' ); ?></option>
148
- <?php do_action( 'wpsc_coupon_rule_property_options', $condition['property'] ); ?>
149
- </select>
150
-
151
- <select name="rules[logic][]">
152
- <option value="equal"<?php selected( 'equal', $condition['logic'] ); ?>><?php _e( 'Is equal to', 'wp-e-commerce' ); ?></option>
153
- <option value="greater"<?php selected( 'greater', $condition['logic'] ); ?>><?php _e( 'Is greater than', 'wp-e-commerce' ); ?></option>
154
- <option value="less"<?php selected( 'less', $condition['logic'] ); ?>><?php _e( 'Is less than', 'wp-e-commerce' ); ?></option>
155
- <option value="contains"<?php selected( 'contains', $condition['logic'] ); ?>><?php _e( 'Contains', 'wp-e-commerce' ); ?></option>
156
- <option value="not_contain"<?php selected( 'not_contain', $condition['logic'] ); ?>><?php _e( 'Does not contain', 'wp-e-commerce' ); ?></option>
157
- <option value="begins"<?php selected( 'begins', $condition['logic'] ); ?>><?php _e( 'Begins with', 'wp-e-commerce' ); ?></option>
158
- <option value="ends"<?php selected( 'ends', $condition['logic'] ); ?>><?php _e( 'Ends with', 'wp-e-commerce' ); ?></option>
159
- <option value="category"<?php selected( 'category', $condition['logic'] ); ?>><?php _e( 'In Category', 'wp-e-commerce' ); ?></option>
160
- </select>
161
-
162
- <input type="text" name="rules[value][]" value="<?php echo esc_attr( $condition['value'] ); ?>" style="width: 150px;"/>
163
- <a title="<?php esc_attr_e( 'Delete condition', 'wp-e-commerce' ); ?>" class="button-secondary wpsc-button-round wpsc-button-minus" href="#"><?php echo _x( '&ndash;', 'delete item', 'wp-e-commerce' ); ?></a>
164
- <a title="<?php esc_attr_e( 'Add condition', 'wp-e-commerce' ); ?>" class="button-secondary wpsc-button-round wpsc-button-plus" href="#"><?php echo _x( '+', 'add item', 'wp-e-commerce' ); ?></a>
165
- </div>
166
- <?php endforeach; ?>
167
- </td>
168
- </tr>
169
-
170
- <?php do_action( 'wpsc_coupon_edit_bottom', $coupon->get( 'id' ), $coupon->get_data() ); ?>
171
-
172
- </tbody>
173
- </table>
174
- <input type="hidden" name="coupon_id" value="<?php echo esc_attr( $coupon->get( 'id' ) ); ?>"/>
175
- <input type="hidden" name="edit_coupon_is_used" value="<?php echo esc_attr( $coupon->get( 'is-used' ) ); ?>"/>
176
- <input type="hidden" name="is_edit_coupon" value="true" />
177
-
178
- <?php wp_nonce_field( 'wpsc_coupon', 'wpsc-coupon-edit' ); ?>
179
- <?php submit_button( __( 'Update Coupon', 'wp-e-commerce' ), 'primary' ); ?>
180
-
181
- </form>
182
- </div>
183
- </div><!--end .wrap-->
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
trunk/wpsc-admin/display-coupons.php DELETED
@@ -1,140 +0,0 @@
1
- <?php
2
-
3
- function wpsc_display_coupons_page() {
4
- global $wpdb;
5
-
6
-
7
- /**
8
- * Update / create code that will be abstracted to its own class at some point
9
- */
10
-
11
- if ( isset( $_POST ) && is_array( $_POST ) && ! empty( $_POST ) ) {
12
-
13
- if ( isset( $_POST['add_coupon'] ) && (!isset( $_POST['is_edit_coupon'] ) || !($_POST['is_edit_coupon'] == 'true')) ) {
14
-
15
- check_admin_referer( 'wpsc_coupon', 'wpsc-coupon-add' );
16
-
17
- if ( ! function_exists( 'wpsc_is_store_admin' ) || ! wpsc_is_store_admin() ) {
18
- wp_die( __( 'Permission denied', 'wpsc' ) );
19
- }
20
-
21
- $coupon_code = $_POST['add_coupon_code'];
22
- $discount = (double)$_POST['add_discount'];
23
- $discount_type = (int)$_POST['add_discount_type'];
24
- $use_once = (int)(bool)$_POST['add_use-once'];
25
- $every_product = (int)(bool)$_POST['add_every_product'];
26
- $is_active = (int)(bool)$_POST['add_active'];
27
- $start_date = ! empty( $_POST['add_start'] ) ? date( 'Y-m-d', strtotime( $_POST['add_start'] ) ) . " 00:00:00" : "0000-00-00 00:00:00";
28
- $end_date = ! empty( $_POST['add_end'] ) ? date( 'Y-m-d', strtotime( $_POST['add_end'] ) ) . " 23:59:59" : "0000-00-00 00:00:00";
29
- $rules = $_POST['rules'];
30
- $new_rules = array();
31
-
32
- foreach ( $rules as $key => $rule ) {
33
- foreach ( $rule as $k => $r ) {
34
- $new_rules[$k][$key] = $r;
35
- }
36
- }
37
-
38
- foreach ( $new_rules as $key => $rule ) {
39
- if ( '' == $rule['value'] )
40
- unset( $new_rules[$key] );
41
- }
42
-
43
- $new_coupon = new WPSC_Coupon( array(
44
- 'coupon_code' => $coupon_code,
45
- 'value' => $discount,
46
- 'is-percentage' => $discount_type,
47
- 'use-once' => $use_once,
48
- 'is-used' => 0,
49
- 'active' => $is_active,
50
- 'every_product' => $every_product,
51
- 'start' => $start_date,
52
- 'expiry' => $end_date,
53
- 'condition' => $new_rules
54
- ) );
55
- $insert = $new_coupon->save();
56
-
57
- if ( $insert ) {
58
- echo '<div class="updated"><p>' . __( 'The coupon has been added.', 'wp-e-commerce' ) . '</p></div>';
59
- }
60
-
61
- }
62
-
63
- // update an existing coupon
64
- if ( isset( $_POST['is_edit_coupon'] ) && ($_POST['is_edit_coupon'] == 'true') && !(isset( $_POST['delete_condition'] )) && !(isset( $_POST['submit_condition'] )) ) {
65
-
66
- check_admin_referer( 'wpsc_coupon', 'wpsc-coupon-edit' );
67
-
68
- if ( ! function_exists( 'wpsc_is_store_admin' ) || ! wpsc_is_store_admin() ) {
69
- wp_die( __( 'Permission denied', 'wpsc' ) );
70
- }
71
-
72
- $rules = isset( $_POST['rules'] ) ? $_POST['rules'] : array();
73
- $new_rules = array();
74
-
75
- foreach ( $rules as $key => $rule ) {
76
- foreach ( $rule as $k => $r ) {
77
- $new_rules[$k][$key] = $r;
78
- }
79
- }
80
-
81
- foreach ( $new_rules as $key => $rule ) {
82
- if ( '' == $rule['value'] )
83
- unset( $new_rules[$key] );
84
- }
85
-
86
- $update_coupon = new WPSC_Coupon( $_POST['coupon_id'] );
87
- $update_coupon->set( array(
88
- 'coupon_code' => $_POST['edit_coupon_code'],
89
- 'value' => $_POST['edit_coupon_amount'],
90
- 'is-percentage' => $_POST['edit_discount_type'],
91
- 'use-once' => $_POST['edit_coupon_use_once'],
92
- 'is-used' => $_POST['edit_coupon_is_used'],
93
- 'active' => $_POST['edit_coupon_active'],
94
- 'every_product' => $_POST['edit_coupon_every_product'],
95
- 'start' => ! empty( $_POST['edit_coupon_start'] ) ? get_gmt_from_date( $_POST['edit_coupon_start'] . ' 00:00:00' ) : "0000-00-00 00:00:00",
96
- 'expiry' => ! empty( $_POST['edit_coupon_end'] ) ? get_gmt_from_date( $_POST['edit_coupon_end'] . ' 23:59:59' ) : "0000-00-00 00:00:00",
97
- 'condition' => $new_rules
98
- ) );
99
-
100
- $update = $update_coupon->save();
101
-
102
- if ( $update ) {
103
- echo '<div class="updated"><p>' . __( 'The coupon has been updated.', 'wp-e-commerce' ) . '</p></div>';
104
- }
105
-
106
- }
107
- }
108
-
109
- /**
110
- * Load the selected view
111
- */
112
-
113
- if( isset( $_GET['wpsc-action'] ) && $_GET['wpsc-action'] == 'add_coupon' ) {
114
- // load the coupon add screen
115
- include( dirname( __FILE__ ) . '/display-coupon-add.php' );
116
-
117
- } elseif( isset( $_GET['wpsc-action'] ) && $_GET['wpsc-action'] == 'edit_coupon' ) {
118
- // load the coupon add screen
119
- include( dirname( __FILE__ ) . '/display-coupon-edit.php' );
120
-
121
- } else {
122
- require_once WPSC_FILE_PATH . '/wpsc-admin/includes/coupon-list-table-class.php';
123
- $coupons_table = new WPSC_Coupons_List_Table();
124
- $coupons_table->prepare_items(); ?>
125
- <div class="wrap">
126
- <h2><?php _e( 'Coupons', 'wp-e-commerce' ); ?><a href="<?php echo esc_url( add_query_arg( 'wpsc-action', 'add_coupon' ) ); ?>" class="add-new-h2"><?php _e( 'Add Coupon', 'wp-e-commerce' ); ?></a></h2>
127
- <?php do_action( 'wpsc_coupons_page_top' ); ?>
128
- <form id="wpsc-coupons-filter" method="get" action="<?php echo admin_url( 'edit.php?post_type=wpsc-product&page=wpsc-edit-coupons' ); ?>">
129
-
130
- <input type="hidden" name="post_type" value="wpsc-product" />
131
- <input type="hidden" name="page" value="wpsc-edit-coupons" />
132
-
133
- <?php $coupons_table->views() ?>
134
- <?php $coupons_table->display() ?>
135
- </form>
136
- <?php do_action( 'wpsc_coupons_page_bottom' ); ?>
137
- </div>
138
- <?php
139
- } // end view check
140
- }
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
trunk/wpsc-admin/display-items.page.php DELETED
@@ -1,584 +0,0 @@
1
- <?php
2
- /**
3
- * WP eCommerce edit and add product page functions
4
- *
5
- * These are the main WPSC Admin functions
6
- *
7
- * @package wp-e-commerce
8
- * @since 3.7
9
- */
10
-
11
- /**
12
- * wpsc_additional_column_names function.
13
- *
14
- * @access public
15
- * @param (array) $columns
16
- * @return (array) $columns
17
- *
18
- */
19
- function wpsc_additional_column_names( $columns ){
20
- $columns = array();
21
-
22
- $columns['cb'] = '<input type="checkbox" />';
23
- $columns['image'] = '';
24
- $columns['title'] = __('Name', 'wp-e-commerce');
25
- $columns['stock'] = __('Stock', 'wp-e-commerce');
26
- $columns['price'] = __('Price', 'wp-e-commerce');
27
- $columns['sale_price'] = __('Sale', 'wp-e-commerce');
28
- $columns['SKU'] = __('SKU', 'wp-e-commerce');
29
- $columns['weight'] = __('Weight', 'wp-e-commerce');
30
- $columns['cats'] = __('Categories', 'wp-e-commerce');
31
- $columns['featured'] = '<img src="' . WPSC_CORE_IMAGES_URL . '/black-star.png" alt="' . __( 'Featured', 'wp-e-commerce' ) . '" title="' . __( 'Featured', 'wp-e-commerce' ) . '">';
32
- $columns['hidden_alerts'] = '';
33
- $columns['date'] = __('Date', 'wp-e-commerce');
34
-
35
- return $columns;
36
- }
37
-
38
- /**
39
- * @param array $columns The array of sortable columns
40
- * @return array
41
- */
42
- function wpsc_additional_sortable_column_names( $columns ){
43
-
44
- $columns['stock'] = 'stock';
45
- $columns['price'] = 'price';
46
- $columns['sale_price'] = 'sale_price';
47
- $columns['SKU'] = 'SKU';
48
-
49
- return $columns;
50
- }
51
-
52
- /**
53
- * Image column in Manage Products page
54
- *
55
- * @since 3.8.9
56
- * @access private
57
- *
58
- * @param object $post Post object
59
- * @param int $post_id Post ID
60
- *
61
- * @uses wpsc_the_product_thumbnail() Prints URL to the product thumbnail
62
- * @uses esc_url() Makes sure we have a safe URL
63
- */
64
- function _wpsc_manage_products_column_image( $post, $post_id ) {
65
- $src = wpsc_the_product_thumbnail( false, false, $post_id, 'manage-products' );
66
-
67
- if ( $src )
68
- echo '<img src="' . esc_url( $src ). '" alt="" />';
69
- else
70
- echo '<img src="' . esc_url( WPSC_CORE_IMAGES_URL . '/no-image-uploaded.gif' ) . '" width="38" height="38" />';
71
- }
72
- add_action( 'wpsc_manage_products_column_image', '_wpsc_manage_products_column_image', 10, 2 );
73
-
74
- /**
75
- * Weight column in Manage Products page
76
- *
77
- * @since 3.8.9
78
- * @access private
79
- *
80
- * @param object $post Post object
81
- * @param int $post_id Post ID
82
- * @param boolean $has_variations Whether the product has variations
83
- *
84
- * @uses esc_html_e() Safe HTML with translation
85
- * @uses get_post_meta() Gets post meta given key and post_id
86
- * @uses maybe_unserialize() Unserialize value only if it was serialized.
87
- * @uses wpsc_convert_weight() Does weight conversions
88
- * @uses esc_html() Makes sure things are safe
89
- * @uses wpsc_weight_unit_display() Gets weight unit for display
90
- */
91
- function _wpsc_manage_products_column_weight( $post, $post_id, $has_variations ) {
92
- if( $has_variations ) {
93
- esc_html_e( 'N/A', 'wp-e-commerce' );
94
- return;
95
- }
96
- $product_data = array();
97
- $product_data['meta'] = array();
98
- $product_data['meta'] = get_post_meta( $post->ID, '' );
99
- foreach( $product_data['meta'] as $meta_name => $meta_value ) {
100
- $product_data['meta'][$meta_name] = maybe_unserialize( array_pop( $meta_value ) );
101
- }
102
-
103
- $product_data['transformed'] = array();
104
- if( !isset( $product_data['meta']['_wpsc_product_metadata']['weight'] ) )
105
- $product_data['meta']['_wpsc_product_metadata']['weight'] = "";
106
- if( !isset( $product_data['meta']['_wpsc_product_metadata']['weight_unit'] ) )
107
- $product_data['meta']['_wpsc_product_metadata']['weight_unit'] = "";
108
-
109
- $product_data['transformed']['weight'] = wpsc_convert_weight( $product_data['meta']['_wpsc_product_metadata']['weight'], "pound", $product_data['meta']['_wpsc_product_metadata']['weight_unit'] );
110
-
111
- $weight = $product_data['transformed']['weight'];
112
- if( $weight == '' )
113
- $weight = '0';
114
-
115
- $unit = $product_data['meta']['_wpsc_product_metadata']['weight_unit'];
116
-
117
- echo $weight . wpsc_weight_unit_display( $unit );
118
- echo '<div id="inline_' . $post->ID . '_weight" class="hidden">' . esc_html( $weight ) . '</div>';
119
- }
120
- add_action( 'wpsc_manage_products_column_weight', '_wpsc_manage_products_column_weight', 10, 3 );
121
-
122
- /**
123
- * Stock column in Manage Products page.
124
- *
125
- * @since 3.8.9
126
- * @access private
127
- *
128
- * @param object $post Post Object
129
- * @param int $post_id Post ID
130
- * @param boolean $has_variations Whether the product has variations
131
- *
132
- * @uses get_post_meta() Gets post meta given key and post_id
133
- * @uses wpsc_variations_stock_remaining() Gets remaining stock level for given post_id
134
- * @uses esc_html() Because we need safe HTML right???
135
- */
136
- function _wpsc_manage_products_column_stock( $post, $post_id, $has_variations ) {
137
- $stock = get_post_meta( $post->ID, '_wpsc_stock', true );
138
-
139
- if( $stock == '' )
140
- $stock = __('N/A', 'wp-e-commerce');
141
-
142
- if ( $has_variations ) {
143
- echo '~ ' . wpsc_variations_stock_remaining( $post->ID );
144
- return;
145
- }
146
-
147
- echo $stock;
148
- echo '<div id="inline_' . $post->ID . '_stock" class="hidden">' . esc_html( $stock ) . '</div>';
149
-
150
- }
151
- add_action( 'wpsc_manage_products_column_stock', '_wpsc_manage_products_column_stock', 10, 3 );
152
-
153
- /**
154
- * Price column in Manage Products page
155
- *
156
- * @since 3.8.9
157
- * @access private
158
- *
159
- * @param object $post Post object
160
- * @param int $post_id Post ID
161
- * @param boolean $has_variations Whether the product has variations
162
- *
163
- * @uses get_post_meta() Gets post meta given key and post_id
164
- * @uses wpsc_currency_display() Returns the currency after dealing with how the user wants it to be displayed
165
- * @uses wpsc_product_variation_price_from() Gets the lowest variation price for the given post_id
166
- */
167
- function _wpsc_manage_products_column_price( $post, $post_id, $has_variations ) {
168
- $price = get_post_meta( $post->ID, '_wpsc_price', true );
169
- $has_var = '1';
170
- if( ! $has_variations ) {
171
- echo wpsc_currency_display( $price );
172
- echo '<div id="inline_' . $post->ID . '_price" class="hidden">' . trim( $price ) . '</div>';
173
- $has_var = '0';
174
- }
175
- else
176
- echo wpsc_product_variation_price_from( $post->ID, array(
177
- 'only_normal_price' => true,
178
- 'from_text' => '%s+'
179
- ) );
180
- echo '<input type="hidden" value="' . $has_var . '" id="inline_' . $post->ID . '_has_var" />';
181
- }
182
- add_action( 'wpsc_manage_products_column_price', '_wpsc_manage_products_column_price', 10, 3 );
183
-
184
- /**
185
- * Sale price column in Manage Products page.
186
- *
187
- * @since 3.8.9
188
- * @access private
189
- *
190
- * @param object $post Post object
191
- * @param int $post_id Post ID
192
- * @param boolean $has_variations Whether the product has variations
193
- *
194
- * @uses get_post_meta() Gets post meta given key and post_id
195
- * @uses wpsc_currency_display() Returns currency after taking user display options in to account
196
- * @uses wpsc_product_variation_price_from() Gets the lowest variation price for the given post_id
197
- */
198
- function _wpsc_manage_products_column_sale_price( $post, $post_id, $has_variations ) {
199
- $price = get_post_meta( $post->ID, '_wpsc_special_price', true );
200
- if( ! $has_variations ) {
201
- echo wpsc_currency_display( $price );
202
- echo '<div id="inline_' . $post->ID . '_sale_price" class="hidden">' . $price . '</div>';
203
- } else
204
- echo wpsc_product_variation_price_from( $post->ID, array( 'from_text' => '%s+' ) );
205
- }
206
- add_action( 'wpsc_manage_products_column_sale_price', '_wpsc_manage_products_column_sale_price', 10, 3 );
207
-
208
- /**
209
- * SKU column in Manage Products page
210
- *
211
- * @since 3.8.9
212
- * @access private
213
- *
214
- * @param object $post Post object
215
- * @param int $post_id Post ID
216
- *
217
- * @uses get_post_meta() Gets post meta given key and post_id
218
- * @uses esc_html() Escapes the stuff inside
219
- */
220
- function _wpsc_manage_products_column_sku( $post, $post_id ) {
221
- $sku = get_post_meta( $post->ID, '_wpsc_sku', true );
222
- if( $sku == '' )
223
- $sku = __('N/A', 'wp-e-commerce');
224
-
225
- echo $sku;
226
- echo '<div id="inline_' . $post->ID . '_sku" class="hidden">' . esc_html( $sku ) . '</div>';
227
- }
228
- add_action( 'wpsc_manage_products_column_sku', '_wpsc_manage_products_column_sku', 10, 2 );
229
-
230
- /**
231
- * Categories column in Manage Products page
232
- *
233
- * @since 3.8.9
234
- * @access private
235
- *
236
- * @param object $post Post object
237
- * @param int $post_id Post ID
238
- *
239
- * @uses get_the_product_category() Gets the category for the given post_id
240
- * @uses esc_html() Makes sure we have safe HTML
241
- * @uses sanitize_term_field() Cleanse the field value in the term based on the context.
242
- */
243
- function _wpsc_manage_products_column_cats( $post, $post_id ) {
244
- $categories = get_the_product_category( $post->ID );
245
- if ( !empty( $categories ) ) {
246
- $out = array();
247
- foreach ( $categories as $c )
248
- $out[] = "<a href='?post_type=wpsc-product&amp;wpsc_product_category={$c->slug}'> " . esc_html( sanitize_term_field( 'name', $c->name, $c->term_id, 'category', 'display' ) ) . "</a>";
249
- echo join( ', ', $out );
250
- } else {
251
- _e('Uncategorized', 'wp-e-commerce');
252
- }
253
- }
254
- add_action( 'wpsc_manage_products_column_cats', '_wpsc_manage_products_column_cats', 10, 2 );
255
-
256
- /**
257
- * Featured column in Manage Products page.
258
- *
259
- * @since 3.8.9
260
- * @access private
261
- *
262
- * @param object $post Post object
263
- * @param int $post_id Post ID
264
- *
265
- * @uses get_option() Gets option from the WordPress database
266
- * @uses _e() Displays the returned translated text from translate()
267
- */
268
- function _wpsc_manage_products_column_featured( $post, $post_id ) {
269
- $featured_product_url = wp_nonce_url( "index.php?wpsc_admin_action=update_featured_product&amp;product_id=$post->ID", 'feature_product_' . $post->ID);
270
- if ( in_array( $post->ID, (array) get_option( 'sticky_products' ) ) ) {
271
- $class = 'gold-star';
272
- $title = __( 'Unmark as Featured', 'wp-e-commerce' );
273
- } else {
274
- $class = 'grey-star';
275
- $title = __( 'Mark as Featured', 'wp-e-commerce' );
276
- }
277
- ?>
278
- <a class="wpsc_featured_product_toggle featured_toggle_<?php echo $post->ID; ?> <?php echo esc_attr( $class ); ?>" href='<?php echo $featured_product_url; ?>' title="<?php echo esc_attr( $title ); ?>" ></a>
279
- <?php
280
- }
281
- add_action( 'wpsc_manage_products_column_featured', '_wpsc_manage_products_column_featured', 10, 2 );
282
-
283
- /**
284
- * Product alert column in Manage Products page
285
- *
286
- * @since 3.8.9
287
- * @access private
288
- *
289
- * @param object $post Post object
290
- * @param int $post_id Post ID
291
- *
292
- * @uses apply_filters() Calls 'wpsc_product_alert'
293
- */
294
- function _wpsc_manage_products_column_hidden_alerts( $post, $post_id ) {
295
- $product_alert = apply_filters( 'wpsc_product_alert', array( false, '' ), $post );
296
- if( !empty( $product_alert['messages'] ) )
297
- $product_alert['messages'] = implode( "\n",( array )$product_alert['messages'] );
298
-
299
- if( $product_alert['state'] === true ) {
300
- ?>
301
- <img alt='<?php echo $product_alert['messages'];?>' title='<?php echo $product_alert['messages'];?>' class='product-alert-image' src='<?php echo WPSC_CORE_IMAGES_URL;?>/product-alert.jpg' alt='' />
302
- <?php
303
- }
304
-
305
- // If a product alert has stuff to display, show it.
306
- // Can be used to add extra icons etc
307
- if ( !empty( $product_alert['display'] ) )
308
- echo $product_alert['display'];
309
- }
310
- add_action( 'wpsc_manage_products_column_hidden_alerts', '_wpsc_manage_products_column_hidden_alerts', 10, 2 );
311
-
312
-
313
- /**
314
- * Adds extra data to post columns
315
- *
316
- * @access public
317
- *
318
- * @param (array) $column
319
- * @return void
320
- *
321
- * @todo Need to check titles / alt tags ( I don't think thumbnails have any in this code )
322
- * @desc Switch function to generate columns the right way...no more UI hacking!
323
- *
324
- * @uses get_post() Gets post object from provided post_id
325
- * @uses wpsc_product_has_children() Checks if a product has variations or not
326
- * @uses do_action() Calls 'wpsc_manage_products_column_$column'
327
- */
328
- function wpsc_additional_column_data( $column, $post_id ) {
329
- $post = get_post( $post_id );
330
-
331
- $is_parent = wpsc_product_has_children($post_id);
332
- $column = strtolower( $column );
333
- do_action( "wpsc_manage_products_column_{$column}", $post, $post_id, $is_parent );
334
- }
335
-
336
- /**
337
- * @param array $vars Array of query vars
338
- * @return array $vars Our modified vars
339
- */
340
- function wpsc_column_sql_orderby( $vars ) {
341
- if ( ! isset( $vars['post_type'] ) || 'wpsc-product' != $vars['post_type'] || ! isset( $vars['orderby'] ) )
342
- return $vars;
343
-
344
- switch ( $vars['orderby'] ) :
345
- case 'stock' :
346
- $vars = array_merge(
347
- $vars,
348
- array(
349
- 'meta_key' => '_wpsc_stock',
350
- 'orderby' => 'meta_value_num'
351
- )
352
- );
353
- break;
354
- case 'price' :
355
- $vars = array_merge(
356
- $vars,
357
- array(
358
- 'meta_key' => '_wpsc_price',
359
- 'orderby' => 'meta_value_num'
360
- )
361
- );
362
- break;
363
- case 'sale_price' :
364
- $vars = array_merge(
365
- $vars,
366
- array(
367
- 'meta_key' => '_wpsc_special_price',
368
- 'orderby' => 'meta_value_num'
369
- )
370
- );
371
-
372
- break;
373
- case 'SKU' :
374
- $vars = array_merge(
375
- $vars,
376
- array(
377
- 'meta_key' => '_wpsc_sku',
378
- 'orderby' => 'meta_value'
379
- )
380
- );
381
- break;
382
- endswitch;
383
-
384
- return $vars;
385
- }
386
-
387
- /**
388
- *
389
- * @uses get_taxonomy() Retrieves the taxonomy object of $taxonomy.
390
- * @uses wpsc_cats_restrict_manage_posts_print_terms() @todo docs
391
- */
392
- function wpsc_cats_restrict_manage_posts() {
393
- global $typenow;
394
-
395
- if ( $typenow == 'wpsc-product' ) {
396
-
397
- $filters = array( 'wpsc_product_category' );
398
-
399
- foreach ( $filters as $tax_slug ) {
400
- // retrieve the taxonomy object
401
- $tax_obj = get_taxonomy( $tax_slug );
402
- $tax_name = $tax_obj->labels->name;
403
- // retrieve array of term objects per taxonomy
404
- // output html for taxonomy dropdown filter
405
- echo "<select name='$tax_slug' id='$tax_slug' class='postform'>";
406
- echo "<option value=''>" . esc_html( sprintf( _x( 'Show All %s', 'Show all [category name]', 'wp-e-commerce' ), $tax_name ) ) . "</option>";
407
- wpsc_cats_restrict_manage_posts_print_terms($tax_slug);
408
- echo "</select>";
409
- }
410
- }
411
- }
412
-
413
- /**
414
- * @todo docs
415
- * @param $taxonomy
416
- * @param int $parent
417
- * @param int $level
418
- *
419
- * @uses get_terms() Retrieve the terms in a given taxonomy or list of taxonomies.
420
- */
421
- function wpsc_cats_restrict_manage_posts_print_terms( $taxonomy, $parent = 0, $level = 0 ) {
422
- $prefix = str_repeat( '&nbsp;&nbsp;&nbsp;' , $level );
423
- $terms = get_terms( $taxonomy, array( 'parent' => $parent, 'hide_empty' => false ) );
424
- if( !($terms instanceof WP_Error) && !empty($terms) )
425
- foreach ( $terms as $term ){
426
- echo '<option value="'. $term->slug . '"', ( isset($_GET[$term->taxonomy]) && $_GET[$term->taxonomy] == $term->slug) ? ' selected="selected"' : '','>' . $prefix . $term->name .' (' . $term->count .')</option>';
427
- wpsc_cats_restrict_manage_posts_print_terms($taxonomy, $term->term_id, $level+1);
428
- }
429
- }
430
-
431
- /**
432
- * Restrict the products page to showing only parent products and not variations.
433
- *
434
- * @since 3.8
435
- */
436
- function wpsc_no_minors_allowed( $vars ) {
437
- $current_screen = get_current_screen();
438
-
439
- if( $current_screen->post_type != 'wpsc-product' )
440
- return $vars;
441
-
442
- $vars['post_parent'] = 0;
443
-
444
- return $vars;
445
- }
446
-
447
- /**
448
- * wpsc_sortable_column_load
449
- *
450
- * Only sorts columns on edit.php page.
451
- * @since 3.8.8
452
- *
453
- * @uses add_filter()
454
- */
455
- function wpsc_sortable_column_load() {
456
- add_filter( 'request', 'wpsc_no_minors_allowed' );
457
- add_filter( 'request', 'wpsc_column_sql_orderby', 8 );
458
- }
459
-
460
- /**
461
- * Product List Exclude Child Categories
462
- *
463
- * When filtering the product list by category in the admin this ensures that
464
- * only products in the selected category are shown, not any of it's sub-categories.
465
- *
466
- * @param object $query WP_Query
467
- *
468
- * @uses get_current_screen()
469
- */
470
- function wpsc_product_list_exclude_child_categories( $query ) {
471
-
472
- if ( ! is_admin() || ( defined( 'DOING_AJAX' ) && DOING_AJAX ) || ! $query->is_main_query() )
473
- return;
474
-
475
- if ( 'edit-wpsc-product' == get_current_screen()->id ) {
476
- $wpsc_product_category = $query->get( 'wpsc_product_category' );
477
- if ( ! empty( $wpsc_product_category ) ) {
478
- $category_query = array(
479
- 'taxonomy' => 'wpsc_product_category',
480
- 'field' => 'slug',
481
- 'terms' => array( $wpsc_product_category ),
482
- 'include_children' => false,
483
- 'operator' => 'IN'
484
- );
485
- $query->set( 'tax_query', array( $category_query ) );
486
- $query->tax_query->queries = $query->get( 'tax_query' );
487
- }
488
- }
489
- }
490
-
491
- add_action( 'pre_get_posts', 'wpsc_product_list_exclude_child_categories', 15 );
492
-
493
- add_action( 'load-edit.php' , 'wpsc_sortable_column_load' );
494
- add_action( 'restrict_manage_posts' , 'wpsc_cats_restrict_manage_posts' );
495
- add_action( 'manage_wpsc-product_posts_custom_column' , 'wpsc_additional_column_data', 10, 2 );
496
- add_filter( 'manage_edit-wpsc-product_sortable_columns', 'wpsc_additional_sortable_column_names' );
497
- add_filter( 'manage_edit-wpsc-product_columns' , 'wpsc_additional_column_names' );
498
- add_filter( 'manage_wpsc-product_posts_columns' , 'wpsc_additional_column_names' );
499
-
500
-
501
-
502
- /**
503
- * Update featured prodcuts using AJAX.
504
- *
505
- * @access public
506
- * @return void
507
- *
508
- * @uses check_admin_referer() Makes sure that a user was referred from another admin page.
509
- * @uses get_option() Gets option from the WordPress database
510
- * @uses update_option() Updates an option in the WordPress database
511
- * @uses wp_redirect() Redirects to another page.
512
- * @uses wp_get_referer() Retrieve referer from '_wp_http_referer' or HTTP referer.
513
- */
514
- function wpsc_update_featured_products() {
515
- if ( ! ( defined( 'DOING_AJAX' ) && DOING_AJAX ) &&
516
- ! ( isset( $_REQUEST['wpsc_admin_action'] ) &&
517
- ( $_REQUEST['wpsc_admin_action'] == 'update_featured_product' ) ) )
518
- return;
519
-
520
- if ( defined( 'DOING_AJAX' ) && DOING_AJAX && 'update_featured_product' !== $_REQUEST['action'] )
521
- return;
522
-
523
- $product_id = absint( $_REQUEST['product_id'] );
524
-
525
- if ( ! DOING_AJAX )
526
- check_admin_referer( 'feature_product_' . $product_id );
527
-
528
- $status = get_option( 'sticky_products' );
529
-
530
- $new_status = ! in_array( $product_id, $status );
531
-
532
- if ( $new_status ) {
533
- $status[] = $product_id;
534
- } else {
535
- $status = array_diff( $status, array( $product_id ) );
536
- $status = array_values( $status );
537
- }
538
-
539
- $update = update_option( 'sticky_products', $status );
540
-
541
- do_action( 'wpsc_after_featured_product_update', $update, $status );
542
-
543
- if ( defined( 'DOING_AJAX' ) && DOING_AJAX ) {
544
- $json_response = array(
545
- 'text' => $new_status ? esc_attr__( 'Unmark as Featured', 'wp-e-commerce' ) : esc_attr__( 'Mark as Featured', 'wp-e-commerce' ),
546
- 'product_id' => $product_id,
547
- 'color' => $new_status ? 'gold-star' : 'grey-star',
548
- 'image' => $new_status ? WPSC_CORE_IMAGES_URL . '/gold-star.png' : WPSC_CORE_IMAGES_URL . '/grey-star.png'
549
- );
550
-
551
- echo json_encode( $json_response );
552
-
553
- exit();
554
- }
555
- wp_redirect( wp_get_referer() );
556
- exit;
557
- }
558
-
559
- add_filter( 'page_row_actions','wpsc_action_row', 10, 2 );
560
-
561
- /**
562
- * @param $actions
563
- * @param $post
564
- * @return mixed
565
- *
566
- * @uses admin_url() Gets the WordPress admin url
567
- * @uses add_query_arg() Adds a query arg to url
568
- * @uses esc_url() Makes sure the URL is safe, we like safe
569
- * @uses esc_html_x() Displays translated string with gettext context
570
- */
571
- function wpsc_action_row( $actions, $post ) {
572
-
573
- if ( $post->post_type != "wpsc-product" )
574
- return $actions;
575
-
576
- $url = admin_url( 'edit.php' );
577
- $url = add_query_arg( array( 'wpsc_admin_action' => 'duplicate_product', 'product' => $post->ID ), $url );
578
-
579
- $actions['duplicate'] = '<a href="'.esc_url( $url ).'">' . esc_html_x( 'Duplicate', 'row-actions', 'wp-e-commerce' ) . '</a>';
580
- return $actions;
581
- }
582
-
583
- add_action( 'wp_ajax_update_featured_product', 'wpsc_update_featured_products' );
584
- add_action( 'admin_init' , 'wpsc_update_featured_products' );
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
trunk/wpsc-admin/display-options-settings.page.php DELETED
@@ -1,72 +0,0 @@
1
- <?php
2
- /**
3
- * Display Settings page
4
- *
5
- * @package wp-e-commerce
6
- * @since 3.8
7
- */
8
-
9
- /**
10
- * Get the WPSC_Settings_Page class to display the page
11
- *
12
- * @since 3.8.9
13
- */
14
- function wpsc_display_settings_page() {
15
- WPSC_Settings_Page::get_instance()->display();
16
- }
17
-
18
- /*
19
- * Create settings page tabs
20
- */
21
-
22
- function wpsc_settings_tabs() {
23
- return WPSC_Settings_Page::get_instance()->get_tabs();
24
- }
25
-
26
- /*
27
- * Display settings tabs
28
- */
29
-
30
- function wpsc_the_settings_tabs() {
31
- WPSC_Settings_Page::get_instance()->output_tabs();
32
- }
33
-
34
- function wpsc_settings_page_update_notification() {
35
-
36
- if ( isset( $_GET['skipped'] ) || isset( $_GET['updated'] ) || isset( $_GET['regenerate'] ) || isset( $_GET['deleted'] ) || isset( $_GET['shipadd'] ) ) { ?>
37
-
38
- <div id="message" class="updated fade"><p>
39
- <?php
40
-
41
- if ( isset( $_GET['updated'] ) && (int)$_GET['updated'] ) {
42
- printf( _n( '%s Setting options updated.', ' %s Settings options updated.', $_GET['updated'], 'wp-e-commerce' ), absint( $_GET['updated'] ) );
43
- unset( $_GET['updated'] );
44
- $message = true;
45
- }
46
- if ( isset( $_GET['deleted'] ) && (int)$_GET['deleted'] ) {
47
- printf( _n( '%s Setting option deleted.', '%s Setting option deleted.', $_GET['deleted'], 'wp-e-commerce' ), absint( $_GET['deleted'] ) );
48
- unset( $_GET['deleted'] );
49
- $message = true;
50
- }
51
- if ( isset( $_GET['shipadd'] ) && (int)$_GET['shipadd'] ) {
52
- printf( _n( '%s Shipping option updated.', '%s Shipping option updated.', $_GET['shipadd'], 'wp-e-commerce' ), absint( $_GET['shipadd'] ) );
53
- unset( $_GET['shipadd'] );
54
- $message = true;
55
- }
56
- if ( isset( $_GET['added'] ) && (int)$_GET['added'] ) {
57
- printf( _n( '%s Checkout field added.', '%s Checkout fields added.', $_GET['added'], 'wp-e-commerce' ), absint( $_GET['added'] ) );
58
- unset( $_GET['added'] );
59
- $message = true;
60
- }
61
-
62
- if ( ! isset( $message ) )
63
- _e( 'Settings successfully updated.', 'wp-e-commerce' );
64
-
65
- $_SERVER['REQUEST_URI'] = esc_url( remove_query_arg( array( 'locked', 'regenerate', 'skipped', 'updated', 'deleted', 'wpsc_downloadcsv', 'rss_key', 'start_timestamp', 'end_timestamp', 'email_buyer_id' ), $_SERVER['REQUEST_URI'] ) ); ?>
66
- </p></div>
67
-
68
- <?php
69
- }
70
- }
71
-
72
- ?>
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
trunk/wpsc-admin/display-sales-logs.php DELETED
@@ -1,824 +0,0 @@
1
- <?php
2
- /**
3
- * WP eCommerce edit and view sales page functions
4
- *
5
- * These are the main WPSC sales page functions
6
- *
7
- * @package wp-e-commerce
8
- * @since 3.8.8
9
- */
10
-
11
- class WPSC_Purchase_Log_Page {
12
-
13
- private $list_table;
14
- private $output;
15
- private $cols = 0;
16
- public $log_id = 0;
17
-
18
- /**
19
- * WPSC_Purchase_Log
20
- *
21
- * @var WPSC_Purchase_Log object.
22
- */
23
- public $log = null;
24
-
25
- /**
26
- * Whether the purchase log can be modified.
27
- *
28
- * @var boolean
29
- */
30
- protected $can_edit = false;
31
-
32
- public function __construct() {
33
- $controller = 'default';
34
- $controller_method = 'controller_default';
35
-
36
- // If individual purchase log, setup ID and action links.
37
- if ( isset( $_REQUEST['id'] ) && is_numeric( $_REQUEST['id'] ) ) {
38
- $this->log_id = (int) $_REQUEST['id'];
39
- $this->log = wpsc_get_order( $this->log_id );
40
- $this->notes = wpsc_get_order_notes( $this->log );
41
- $this->can_edit = $this->log->can_edit();
42
- }
43
-
44
- if ( isset( $_REQUEST['c'] ) && method_exists( $this, 'controller_' . $_REQUEST['c'] ) ) {
45
- $controller = $_REQUEST['c'];
46
- $controller_method = 'controller_' . $controller;
47
- } elseif ( isset( $_REQUEST['id'] ) && is_numeric( $_REQUEST['id'] ) ) {
48
- $controller = 'item_details';
49
- $controller_method = 'controller_item_details';
50
- }
51
-
52
- // Can only edit in the item details view.
53
- if ( 'controller_item_details' !== $controller_method ) {
54
- $this->can_edit = false;
55
- }
56
-
57
- $this->$controller_method();
58
- }
59
-
60
- private function needs_update() {
61
- global $wpdb;
62
-
63
- if ( get_option( '_wpsc_purchlogs_3.8_updated' ) ) {
64
- return false;
65
- }
66
-
67
- $c = $wpdb->get_var( "SELECT COUNT(*) FROM " . WPSC_TABLE_PURCHASE_LOGS . " WHERE plugin_version IN ('3.6', '3.7')" );
68
-
69
- if ( $c > 0 ) {
70
- return true;
71
- }
72
-
73
- update_option( '_wpsc_purchlogs_3.8_updated', true );
74
- return false;
75
- }
76
-
77
- public function controller_upgrade_purchase_logs_3_7() {
78
- add_action( 'wpsc_display_purchase_logs_page', array( $this, 'display_upgrade_purchase_logs_3_7' ) );
79
- }
80
-
81
- private function purchase_logs_fix_options( $id ) {
82
- ?>
83
- <select name='<?php echo $id; ?>'>
84
- <option value='-1'><?php echo esc_html_x( 'Select an Option', 'Dropdown default when called in uniquename dropdown', 'wp-e-commerce' ); ?></option>
85
- <option value='billingfirstname'><?php esc_html_e( 'Billing First Name', 'wp-e-commerce' ); ?></option>
86
- <option value='billinglastname'><?php esc_html_e( 'Billing Last Name', 'wp-e-commerce' ); ?></option>
87
- <option value='billingaddress'><?php esc_html_e( 'Billing Address', 'wp-e-commerce' ); ?></option>
88
- <option value='billingcity'><?php esc_html_e( 'Billing City', 'wp-e-commerce' ); ?></option>
89
- <option value='billingstate'><?php esc_html_e( 'Billing State', 'wp-e-commerce' ); ?></option>
90
- <option value='billingcountry'><?php esc_html_e( 'Billing Country', 'wp-e-commerce' ); ?></option>
91
- <option value='billingemail'><?php esc_html_e( 'Billing Email', 'wp-e-commerce' ); ?></option>
92
- <option value='billingphone'><?php esc_html_e( 'Billing Phone', 'wp-e-commerce' ); ?></option>
93
- <option value='billingpostcode'><?php esc_html_e( 'Billing Post Code', 'wp-e-commerce' ); ?></option>
94
- <option value='shippingfirstname'><?php esc_html_e( 'Shipping First Name', 'wp-e-commerce' ); ?></option>
95
- <option value='shippinglastname'><?php esc_html_e( 'Shipping Last Name', 'wp-e-commerce' ); ?></option>
96
- <option value='shippingaddress'><?php esc_html_e( 'Shipping Address', 'wp-e-commerce' ); ?></option>
97
- <option value='shippingcity'><?php esc_html_e( 'Shipping City', 'wp-e-commerce' ); ?></option>
98
- <option value='shippingstate'><?php esc_html_e( 'Shipping State', 'wp-e-commerce' ); ?></option>
99
- <option value='shippingcountry'><?php esc_html_e( 'Shipping Country', 'wp-e-commerce' ); ?></option>
100
- <option value='shippingpostcode'><?php esc_html_e( 'Shipping Post Code', 'wp-e-commerce' ); ?></option>
101
- </select>
102
- <?php
103
- }
104
-
105
- public function display_upgrade_purchase_logs_3_7() {
106
- global $wpdb;
107
- $numChanged = 0;
108
- $numQueries = 0;
109
- $purchlog = "SELECT DISTINCT id FROM `".WPSC_TABLE_PURCHASE_LOGS."` LIMIT 1";
110
- $id = $wpdb->get_var($purchlog);
111
- $usersql = "SELECT DISTINCT `".WPSC_TABLE_SUBMITTED_FORM_DATA."`.value, `".WPSC_TABLE_CHECKOUT_FORMS."`.* FROM `".WPSC_TABLE_CHECKOUT_FORMS."` LEFT JOIN `".WPSC_TABLE_SUBMITTED_FORM_DATA."` ON `".WPSC_TABLE_CHECKOUT_FORMS."`.id = `".WPSC_TABLE_SUBMITTED_FORM_DATA."`.`form_id` WHERE `".WPSC_TABLE_SUBMITTED_FORM_DATA."`.log_id=".$id." ORDER BY `".WPSC_TABLE_CHECKOUT_FORMS."`.`checkout_order`" ;
112
- $formfields = $wpdb->get_results($usersql);
113
-
114
- if(count($formfields) < 1){
115
- $usersql = "SELECT DISTINCT `".WPSC_TABLE_CHECKOUT_FORMS."`.* FROM `".WPSC_TABLE_CHECKOUT_FORMS."` WHERE `type` != 'heading'";
116
- $formfields = $wpdb->get_results($usersql);
117
- }
118
-
119
- if(isset($_POST)){
120
- foreach($_POST as $key=>$value){
121
- if($value != '-1'){
122
- $complete = $wpdb->update(
123
- WPSC_TABLE_CHECKOUT_FORMS,
124
- array(
125
- 'unique_name' => $value
126
- ),
127
- array(
128
- 'id' => $key
129
- ),
130
- '%s',
131
- '%d'
132
- );
133
- }
134
- $numChanged++;
135
- $numQueries++;
136
- }
137
-
138
- $sql = "UPDATE `".WPSC_TABLE_CHECKOUT_FORMS."` SET `unique_name`='delivertoafriend' WHERE `name` = '2. Shipping details'";
139
- $wpdb->query($sql);
140
-
141
- add_option('wpsc_purchaselogs_fixed',true);
142
- }
143
-
144
- include( 'includes/purchase-logs-page/upgrade.php' );
145
- }
146
-
147
- public function display_upgrade_purchase_logs_3_8() {
148
- ?>
149
- <div class="wrap">
150
- <h2><?php echo esc_html( __('Sales', 'wp-e-commerce') ); ?> </h2>
151
- <div class="updated">
152
- <p><?php printf( __( 'Your purchase logs have been updated! <a href="%s">Click here</a> to return.' , 'wp-e-commerce' ), esc_url( remove_query_arg( 'c' ) ) ); ?></p>
153
- </div>
154
- </div>
155
- <?php
156
- }
157
-
158
- public function controller_upgrade_purchase_logs_3_8() {
159
- if ( $this->needs_update() ) {
160
- wpsc_update_purchase_logs();
161
- }
162
-
163
- add_action( 'wpsc_display_purchase_logs_page', array( $this, 'display_upgrade_purchase_logs_3_8' ) );
164
- }
165
-
166
- function purchase_logs_pagination() {
167
-
168
- $prev_id = $this->log->get_previous_log_id();
169
- $next_id = $this->log->get_next_log_id();
170
- ?>
171
- <span class='tablenav'><span class='tablenav-logs'><span class='pagination-links'>
172
- <?php if ( $prev_id ) : ?>
173
- <a href='<?php echo esc_url( $this->get_purchase_log_url( $prev_id ) ); ?>' class='prev-page'>&lsaquo; <?php _e( 'Previous', 'wp-e-commerce' ); ?></a>
174
- <?php endif; ?>
175
-
176
- <?php if ( $next_id ) : ?>
177
- <a href='<?php echo esc_url( $this->get_purchase_log_url( $next_id ) ); ?>' class='next-page'><?php _e( 'Next', 'wp-e-commerce' ); ?> &rsaquo;</a>
178
- <?php endif; ?>
179
- </span></span></span>
180
- <?php
181
- }
182
-
183
- public function purchase_logs_checkout_fields() {
184
- global $purchlogitem;
185
-
186
- foreach( (array) $purchlogitem->additional_fields as $value ) {
187
- $value['value'] = maybe_unserialize( $value['value'] );
188
- if ( is_array( $value['value'] ) ) {
189
- ?>
190
- <p><strong><?php echo $value['name']; ?> :</strong> <?php echo implode( stripslashes( $value['value'] ), ',' ); ?></p>
191
- <?php
192
- } else {
193
- $thevalue = esc_html( stripslashes( $value['value'] ));
194
- if ( empty( $thevalue ) ) {
195
- $thevalue = __( '<em>blank</em>', 'wp-e-commerce' );
196
- }
197
- ?>
198
- <p><strong><?php echo $value['name']; ?> :</strong> <?php echo $thevalue; ?></p>
199
- <?php
200
- }
201
- }
202
- }
203
-
204
- public function purchase_log_custom_fields() {
205
- $messages = wpsc_purchlogs_custommessages();
206
- $files = wpsc_purchlogs_customfiles();
207
-
208
- if ( count( $files ) > 0 ) { ?>
209
- <h4><?php esc_html_e( 'Cart Items with Custom Files' , 'wp-e-commerce' ); ?>:</h4>
210
- <?php
211
- foreach( $files as $file ) {
212
- echo $file;
213
- }
214
- }
215
- if ( count( $messages ) > 0 ) { ?>
216
- <h4><?php esc_html_e( 'Cart Items with Custom Messages' , 'wp-e-commerce' ); ?>:</h4>
217
- <?php
218
- foreach( $messages as $message ) {
219
- echo esc_html( $message['title'] ) . ':<br />' . nl2br( esc_html( $message['message'] ) );
220
- }
221
- }
222
- }
223
-
224
- public function items_ordered_box() {
225
- ?>
226
- <?php do_action( 'wpsc_purchlogitem_metabox_start', $this->log_id ); ?>
227
-
228
- <form name="wpsc_items_ordered_form" method="post">
229
- <table class="widefat" cellspacing="0">
230
- <thead>
231
- <tr>
232
- <?php print_column_headers( 'wpsc_purchase_log_item_details' ); ?>
233
- </tr>
234
- </thead>
235
-
236
- <tbody>
237
- <?php $this->purchase_log_cart_items(); ?>
238
-
239
- <?php if ( $this->can_edit ) : ?>
240
- <tr class="wpsc_purchaselog_add_product">
241
- <td colspan="<?php echo $this->cols + 2; ?>">
242
- <p class="wpsc-add-row">
243
- <button type="button" class="wpsc-add-item-button button"><?php esc_html_e( 'Add Item', 'wp-e-commerce' ); ?></button>
244
- </p>
245
- </td>
246
- </tr>
247
- <?php endif; ?>
248
-
249
- <tr class="wpsc_purchaselog_start_totals" id="wpsc_discount_data">
250
- <td colspan="<?php echo $this->cols; ?>">
251
- <?php if ( wpsc_purchlog_has_discount_data() ): ?>
252
- <?php esc_html_e( 'Coupon Code', 'wp-e-commerce' ); ?>: <?php echo wpsc_display_purchlog_discount_data(); ?>
253
- <?php endif; ?>
254
- </td>
255
- <th class='right-col'><?php esc_html_e( 'Discount', 'wp-e-commerce' ); ?> </th>
256
- <td><?php echo wpsc_display_purchlog_discount(); ?></td>
257
- </tr>
258
-
259
- <?php if ( ! wpec_display_product_tax() ): ?>
260
- <tr id="wpsc_total_taxes">
261
- <td colspan='<?php echo $this->cols; ?>'></td>
262
- <th class='right-col'><?php esc_html_e( 'Taxes', 'wp-e-commerce' ); ?> </th>
263
- <td><?php echo wpsc_display_purchlog_taxes(); ?></td>
264
- </tr>
265
- <?php endif; ?>
266
-
267
- <tr id="wpsc_total_shipping">
268
- <td colspan='<?php echo $this->cols; ?>'></td>
269
- <th class='right-col'><?php esc_html_e( 'Shipping', 'wp-e-commerce' ); ?> </th>
270
- <td><?php echo wpsc_display_purchlog_shipping( false, true ); ?></td>
271
- </tr>
272
- <tr id="wpsc_final_total">
273
- <td colspan='<?php echo $this->cols; ?>'></td>
274
- <th class='right-col'><?php esc_html_e( 'Total', 'wp-e-commerce' ); ?> </th>
275
- <td><span><?php echo wpsc_display_purchlog_totalprice(); ?></span> <div class="spinner"></div></td>
276
- </tr>
277
- <tr class="wpsc-row-actions">
278
- <td class="wpsc-add-row" colspan="<?php echo $this->cols + 2; ?>">
279
- <?php do_action( 'wpsc_order_row_actions', $this->log ); ?>
280
- </td>
281
- </tr>
282
- <tr class="wpsc-row-action-views">
283
- <td colspan="<?php echo $this->cols + 2; ?>">
284
- <?php do_action( 'wpsc_order_row_actions_views', $this->log ); ?>
285
- </td>
286
- </tr>
287
- </tbody>
288
- </table>
289
- </form>
290
-
291
- <?php do_action( 'wpsc_purchlogitem_metabox_end', $this->log_id ); ?>
292
-
293
- <?php
294
- }
295
-
296
- public function add_refund_button( $log ) {
297
- if ( wpsc_payment_gateway_supports( $log->get( 'gateway' ), 'refunds' ) && $log->get_remaining_refund() != 0 ) :
298
- ?>
299
- <button type="button" class="button refund-items"><?php _e( 'Refund', 'wp-e-commerce' ); ?></button>
300
- <?php
301
- endif;
302
- }
303
-
304
- public function add_refund_button_ui( $log ) {
305
- if ( wpsc_payment_gateway_supports( $log->get( 'gateway' ), 'refunds' ) ) :
306
- ?>
307
- <table class='wpsc-refund-ui'>
308
- <tbody>
309
- <tr>
310
- <td class="label"><?php _e( 'Amount already refunded', 'wp-e-commerce' ); ?>:</td>
311
- <td class="total"><?php echo wpsc_currency_display( $log->get_total_refunded() );?></td>
312
- </tr>
313
- <?php if ( wpsc_payment_gateway_supports( $log->get( 'gateway' ), 'partial-refunds' ) ) : ?>
314
- <tr>
315
- <td class="label"><label for="refund_amount"><?php _e( 'Refund amount', 'wp-e-commerce' ); ?>:</label></td>
316
- <td class="total">
317
- <input type="number" max="<?php echo floatval( $log->get_remaining_refund() ); ?>" class="text" id="refund_amount" name="refund_amount" class="wpec_input_price" />
318
- <div class="clear"></div>
319
- </td>
320
- </tr>
321
- <?php endif; // gateway supports PARTIAL refunds ?>
322
- <tr>
323
- <td class="label"><label for="refund_reason"><?php _e( 'Reason for refund (optional)', 'wp-e-commerce' ); ?>:</label></td>
324
- <td class="total">
325
- <input type="text" class="text" id="refund_reason" name="refund_reason" />
326
- <div class="clear"></div>
327
- </td>
328
- </tr>
329
- <tr>
330
- <td>
331
- <p>
332
- <button type="button" class="button tips button-primary do-api-refund"><?php printf( __( 'Refund via %s', 'wp-e-commerce' ), wpsc_get_payment_gateway( $log->get( 'gateway' ) )->get_title() ); ?></button>
333
- <button type="button" class="button button-secondary do-manual-refund tips"><?php _e( 'Manual Refund', 'wp-e-commerce' ); ?></button>
334
- </p>
335
- </td>
336
- <td>
337
- <span class="spinner"></span>
338
- </td>
339
- </tr>
340
- </tbody>
341
- </table>
342
- <?php
343
- endif;
344
- }
345
-
346
- public function add_capture_button( $log ) {
347
- if ( wpsc_payment_gateway_supports( $log->get( 'gateway' ), 'auth-capture' ) && $log->is_order_received() ) :
348
- ?>
349
- <button type="button" class="button-primary button capture-payment"><?php _e( 'Capture Payment', 'wp-e-commerce' ); ?></button>
350
- <div class="spinner"></div>
351
- <?php
352
- endif;
353
- }
354
-
355
- public function purch_notes_box() {
356
- ?>
357
- <div class="wpsc-notes">
358
- <?php $this->notes_output(); ?>
359
- </div>
360
- <form method="post" action="" id="note-submit-form">
361
- <?php wp_nonce_field( 'wpsc_log_add_notes_nonce', 'wpsc_log_add_notes_nonce' ); ?>
362
- <input type='hidden' name='purchlog_id' value='<?php echo $this->log_id; ?>' />
363
- <p>
364
- <?php wp_editor( '', 'purchlog_notes', array(
365
- 'textarea_name' => 'purchlog_notes',
366
- 'textarea_rows' => 3,
367
- 'teeny' => true,
368
- 'tinymce' => false,
369
- 'media_buttons' => false,
370
- ) ); ?>
371
- </p>
372
- <div class="note-submit">
373
- <input class="button" type="submit" value="<?php _e( 'Add Note', 'wp-e-commerce' ); ?>" />
374
- <div class="spinner"></div>
375
- </div>
376
- </form>
377
- <?php
378
- }
379
-
380
- private function edit_contact_details_form() {
381
- $args = wpsc_get_customer_settings_form_args( $this->log->form_data() );
382
- $args['form_actions'][0]['class'] = 'button';
383
- $args['form_actions'][0]['title'] = __( 'Update', 'wp-e-commerce' );
384
- echo wpsc_get_form_output( $args );
385
- }
386
-
387
- private function purchase_log_cart_items() {
388
- while( wpsc_have_purchaselog_details() ) : wpsc_the_purchaselog_item();
389
- self::purchase_log_cart_item( $this->can_edit );
390
- endwhile;
391
- }
392
-
393
- public static function purchase_log_cart_item( $can_edit = false ) {
394
- ?>
395
- <tr class="purchase-log-line-item" id="purchase-log-item-<?php echo wpsc_purchaselog_details_id(); ?>" data-id="<?php echo wpsc_purchaselog_details_id(); ?>" data-productid="<?php echo wpsc_purchaselog_product_id(); ?>">
396
- <td><?php echo wpsc_purchaselog_details_name(); ?></td> <!-- NAME! -->
397
- <td><?php echo wpsc_purchaselog_details_SKU(); ?></td> <!-- SKU! -->
398
- <td>
399
- <?php if ( $can_edit ) : ?>
400
- <input type="number" step="1" min="0" autocomplete="off" name="wpsc_item_qty" class="wpsc_item_qty" placeholder="0" value="<?php echo wpsc_purchaselog_details_quantity(); ?>" size="4" class="quantity">
401
- <?php else: ?>
402
- <?php echo wpsc_purchaselog_details_quantity(); ?>
403
- <?php endif; ?>
404
- </td> <!-- QUANTITY! -->
405
- <td>
406
- <?php
407
- echo wpsc_currency_display( wpsc_purchaselog_details_price() );
408
- do_action( 'wpsc_additional_sales_amount_info', wpsc_purchaselog_details_id() );
409
- ?>
410
- </td> <!-- PRICE! -->
411
- <td><?php echo wpsc_currency_display( wpsc_purchaselog_details_shipping() ); ?></td> <!-- SHIPPING! -->
412
- <?php if( wpec_display_product_tax() ): ?>
413
- <td><?php echo wpsc_currency_display( wpsc_purchaselog_details_tax() ); ?></td> <!-- TAX! -->
414
- <?php endif; ?>
415
- <!-- <td><?php echo wpsc_currency_display( wpsc_purchaselog_details_discount() ); ?></td> --> <!-- DISCOUNT! -->
416
- <td class="amount"><?php echo wpsc_currency_display( wpsc_purchaselog_details_total() ); ?></td> <!-- TOTAL! -->
417
- <?php if ( $can_edit ) : ?>
418
- <td class="remove">
419
- <div class="wpsc-remove-row">
420
- <button type="button" class="wpsc-remove-button wpsc-remove-item-button"><span class="dashicons dashicons-dismiss"></span> <?php esc_html_e( 'Remove Item', 'wp-e-commerce' ); ?></button>
421
- </div>
422
- </td> <!-- REMOVE! -->
423
- <?php endif; ?>
424
- </tr>
425
- <?php
426
- do_action( 'wpsc_additional_sales_item_info', wpsc_purchaselog_details_id() );
427
- }
428
-
429
- public function notes_output() {
430
-
431
- foreach ( $this->notes as $note_id => $note_args ) : ?>
432
- <?php self::note_output( $this->notes, $note_id, $note_args ); ?>
433
- <?php endforeach;
434
- }
435
-
436
- public static function note_output( WPSC_Purchase_Log_Notes $notes, $note_id, array $note_args ) {
437
- ?>
438
- <div class="wpsc-note" id="wpsc-note-<?php echo absint( $note_id ); ?>" data-id="<?php echo absint( $note_id ); ?>">
439
- <p>
440
- <strong class="note-date"><?php echo $notes->get_formatted_date( $note_args ); ?></strong>
441
- <a href="#wpsc-note-<?php echo absint( $note_id ); ?>" class="note-number">#<?php echo ( $note_id ); ?></a>
442
- <a href="<?php echo wp_nonce_url( add_query_arg( 'note', absint( $note_id ) ), 'delete-note', 'delete-note' ); ?>" class="wpsc-remove-button wpsc-remove-note-button"><span class="dashicons dashicons-dismiss"></span> <?php esc_html_e( 'Delete Note', 'wp-e-commerce' ); ?></a>
443
- </p>
444
- <div class="wpsc-note-content">
445
- <?php echo wpautop( $note_args['content'] ); ?>
446
- </div>
447
- </div>
448
- <?php
449
- }
450
-
451
- public static function shipping_address_output() {
452
- ?>
453
- <strong>
454
- <?php echo ( wpsc_display_purchlog_shipping_name() != "" ) ? wpsc_display_purchlog_shipping_name() . "<br />" : '<span class="field-blank">' . __( 'Anonymous', 'wp-e-commerce' ) . '</span>' ; ?>
455
- </strong>
456
- <?php echo ( wpsc_display_purchlog_shipping_address() != "" ) ? wpsc_display_purchlog_shipping_address() . "<br />" : '' ; ?>
457
- <?php echo ( wpsc_display_purchlog_shipping_city() != "" ) ? wpsc_display_purchlog_shipping_city() . ", " : '' ; ?>
458
- <?php echo ( wpsc_display_purchlog_shipping_state_and_postcode() != "" ) ? wpsc_display_purchlog_shipping_state_and_postcode() . "<br />" : '' ; ?>
459
- <?php echo ( wpsc_display_purchlog_shipping_country() != "" ) ? wpsc_display_purchlog_shipping_country() . "<br />" : '<span class="field-blank">' . __( 'Country not specified', 'wp-e-commerce' ) . '</span>' ; ?>
460
- <?php
461
- }
462
-
463
- public static function billing_address_output() {
464
- ?>
465
- <strong>
466
- <?php echo ( wpsc_display_purchlog_buyers_name() != "" ) ? wpsc_display_purchlog_buyers_name() . "<br />" : '<span class="field-blank">' . __( 'Anonymous', 'wp-e-commerce' ) . '</span>' ; ?>
467
- </strong>
468
- <?php echo ( wpsc_display_purchlog_buyers_address() != "" ) ? wpsc_display_purchlog_buyers_address() . "<br />" : '' ; ?>
469
- <?php echo ( wpsc_display_purchlog_buyers_city() != "" ) ? wpsc_display_purchlog_buyers_city() . ", " : '' ; ?>
470
- <?php echo ( wpsc_display_purchlog_buyers_state_and_postcode() != "" ) ? wpsc_display_purchlog_buyers_state_and_postcode() . "<br />" : '' ; ?>
471
- <?php echo ( wpsc_display_purchlog_buyers_country() != "" ) ? wpsc_display_purchlog_buyers_country() . "<br />" : '<span class="field-blank">' . __( 'Country not specified', 'wp-e-commerce' ) . '</span>' ; ?>
472
- <?php
473
- }
474
-
475
- public static function payment_details_output() {
476
- ?>
477
- <strong><?php esc_html_e( 'Phone:', 'wp-e-commerce' ); ?> </strong><?php echo ( wpsc_display_purchlog_buyers_phone() != "" ) ? wpsc_display_purchlog_buyers_phone() : __( '<em class="field-blank">not provided</em>', 'wp-e-commerce' ); ?><br />
478
- <strong><?php esc_html_e( 'Email:', 'wp-e-commerce' ); ?> </strong>
479
- <a href="mailto:<?php echo wpsc_display_purchlog_buyers_email(); ?>?subject=<?php echo rawurlencode( sprintf( __( 'Message from %s', 'wp-e-commerce' ), site_url() ) ); ?>">
480
- <?php echo ( wpsc_display_purchlog_buyers_email() != "" ) ? wpsc_display_purchlog_buyers_email() : __( '<em class="field-blank">not provided</em>', 'wp-e-commerce' ); ?>
481
- </a>
482
- <br />
483
- <strong><?php esc_html_e( 'Payment Method:', 'wp-e-commerce' ); ?> </strong><?php echo wpsc_display_purchlog_paymentmethod(); ?><br />
484
- <?php if ( wpsc_display_purchlog_display_howtheyfoundus() ) : ?>
485
- <strong><?php esc_html_e( 'How User Found Us:', 'wp-e-commerce' ); ?> </strong><?php echo wpsc_display_purchlog_howtheyfoundus(); ?><br />
486
- <?php endif; ?>
487
- <?php
488
- }
489
-
490
- public function controller_item_details() {
491
- if (
492
- ! isset( $_REQUEST['id'] )
493
- || ( isset( $_REQUEST['id'] ) && ! is_numeric( $_REQUEST['id'] ) )
494
- || ! $this->log->exists()
495
- ) {
496
- wp_die( __( 'Invalid sales log ID', 'wp-e-commerce' ) );
497
- }
498
-
499
- if ( isset( $_POST['wpsc_checkout_details'], $_POST['_wp_nonce'] ) ) {
500
- self::maybe_update_contact_details_for_log( $this->log, wp_unslash( $_POST['wpsc_checkout_details'] ) );
501
- }
502
-
503
- if ( isset( $_POST['wpsc_log_add_notes_nonce'], $_POST['purchlog_notes'] ) ) {
504
- self::maybe_add_note_to_log( $this->log, wp_unslash( $_POST['purchlog_notes'] ) );
505
- }
506
-
507
- if ( isset( $_REQUEST['delete-note'], $_REQUEST['note'] ) ) {
508
- self::maybe_delete_note_from_log( $this->log, absint( $_REQUEST['note'] ) );
509
- }
510
-
511
- $this->log->init_items();
512
-
513
- $columns = array(
514
- 'title' => __( 'Name', 'wp-e-commerce' ),
515
- 'sku' => __( 'SKU', 'wp-e-commerce' ),
516
- 'quantity' => __( 'Quantity','wp-e-commerce' ),
517
- 'price' => __( 'Price', 'wp-e-commerce' ),
518
- 'shipping' => __( 'Item Shipping', 'wp-e-commerce'),
519
- );
520
-
521
- if ( wpec_display_product_tax() ) {
522
- $columns['tax'] = __( 'Item Tax', 'wp-e-commerce' );
523
- }
524
-
525
- $columns['total'] = __( 'Item Total','wp-e-commerce' );
526
-
527
- if ( $this->can_edit ) {
528
- $columns['remove'] = '';
529
-
530
- $this->include_te_v2_resources();
531
- $this->enqueue_te_v2_resources();
532
- }
533
-
534
- add_filter( 'admin_title', array( $this, 'doc_title' ), 10, 2 );
535
-
536
- register_column_headers( 'wpsc_purchase_log_item_details', $columns );
537
-
538
- add_action( 'wpsc_display_purchase_logs_page', array( $this, 'display_purchase_log' ) );
539
- add_action( 'wpsc_purchlog_before_metaboxes' , array( $this, 'register_metaboxes' ) );
540
-
541
- add_action( 'wpsc_order_row_actions' , array( $this, 'add_refund_button' ) );
542
- add_action( 'wpsc_order_row_actions_views' , array( $this, 'add_refund_button_ui' ) );
543
-
544
- add_action( 'wpsc_order_row_actions' , array( $this, 'add_capture_button' ) );
545
- }
546
-
547
- public function register_metaboxes() {
548
- global $purchlogitem;
549
-
550
- add_meta_box( 'wpsc_items_ordered', esc_html__( 'Items Ordered' , 'wp-e-commerce' ), array( $this, 'items_ordered_box' ), get_current_screen()->id, 'normal' );
551
-
552
- add_meta_box( 'purchlogs_notes', esc_html__( 'Order Notes' , 'wp-e-commerce' ), array( $this, 'purch_notes_box' ), get_current_screen()->id, 'low' );
553
-
554
- if ( wpsc_purchlogs_has_customfields() ) {
555
- add_meta_box( 'purchlogs_customfields', esc_html__( 'Users Custom Fields' , 'wp-e-commerce' ), array( $this, 'purchase_log_custom_fields' ), get_current_screen()->id, 'normal' );
556
- }
557
-
558
- if ( ! empty( $purchlogitem->additional_fields ) ) {
559
- add_meta_box( 'custom_checkout_fields', esc_html__( 'Additional Checkout Fields' , 'wp-e-commerce' ), array( $this, 'purchase_logs_checkout_fields' ), get_current_screen()->id, 'normal' );
560
- }
561
-
562
- do_action( 'wpsc_purchase_logs_register_metaboxes', get_current_screen(), $this );
563
- }
564
-
565
- public static function maybe_update_contact_details_for_log( WPSC_Purchase_Log $log, $details ) {
566
- if ( is_array( $details ) ) {
567
-
568
- check_admin_referer( 'wpsc-customer-settings-form', '_wp_nonce' );
569
-
570
- return WPSC_Checkout_Form_Data::save_form(
571
- $log,
572
- WPSC_Checkout_Form::get()->get_fields(),
573
- array_map( 'sanitize_text_field', $details ),
574
- false
575
- );
576
- }
577
- }
578
-
579
- /**
580
- * Update Purchase Log Notes
581
- *
582
- * @param WPSC_Purchase_Log $log log object.
583
- */
584
- public static function maybe_add_note_to_log( WPSC_Purchase_Log $log, $note ) {
585
- if ( $note ) {
586
- check_admin_referer( 'wpsc_log_add_notes_nonce', 'wpsc_log_add_notes_nonce' );
587
-
588
- $log->add_note( wp_kses_post( $note ) );
589
-
590
- wp_safe_redirect( esc_url_raw( remove_query_arg( 'wpsc_log_add_notes_nonce' ) ) );
591
- exit;
592
- }
593
- }
594
-
595
- public static function maybe_delete_note_from_log( WPSC_Purchase_Log $log, $note_id ) {
596
- if ( is_numeric( $note_id ) ) {
597
- check_admin_referer( 'delete-note', 'delete-note' );
598
-
599
- $notes = wpsc_get_order_notes( $log );
600
-
601
- $notes->remove( $note_id )->save();
602
-
603
- wp_safe_redirect( esc_url_raw( remove_query_arg( 'delete-note', remove_query_arg( 'note' ) ) ) . '#purchlogs_notes' );
604
- exit;
605
- }
606
- }
607
-
608
- /**
609
- * Include files/resources from TEV2.
610
- *
611
- * @since 4.0.0
612
- *
613
- * @return void
614
- */
615
- public function include_te_v2_resources() {
616
- if ( ! defined( 'WPSC_TE_V2_CLASSES_PATH' ) ) {
617
- require_once WPSC_FILE_PATH . '/wpsc-components/theme-engine-v2/core.php';
618
- _wpsc_te_v2_includes();
619
- }
620
-
621
- require_once( WPSC_TE_V2_CLASSES_PATH . '/message-collection.php' );
622
- require_once( WPSC_TE_V2_HELPERS_PATH . '/message-collection.php' );
623
- require_once( WPSC_TE_V2_HELPERS_PATH . '/template-tags/form.php' );
624
- }
625
-
626
- /**
627
- * Enqueue resources from tev2.
628
- *
629
- * @since 4.0.0
630
- *
631
- * @return void
632
- */
633
- public function enqueue_te_v2_resources() {
634
- _wpsc_te2_register_styles();
635
- wp_enqueue_style( 'wpsc-common' );
636
- wpsc_enqueue_script( 'wpsc-select-autocomplete' );
637
- wpsc_enqueue_script( 'wpsc-country-region' );
638
- wpsc_enqueue_script( 'wpsc-copy-billing-info' );
639
- }
640
-
641
- public function doc_title( $admin_title, $title ) {
642
- /* translators: #%d represents the sales log id. */
643
- $this_title = sprintf( esc_html__( 'Sales Log #%d', 'wp-e-commerce' ), $this->log_id );
644
- $admin_title = str_replace( $title, $this_title, $admin_title );
645
-
646
- return $admin_title;
647
- }
648
-
649
- public function controller_packing_slip() {
650
- if ( ! isset( $_REQUEST['id'] ) || ( isset( $_REQUEST['id'] ) && ! is_numeric( $_REQUEST['id'] ) ) ) {
651
- wp_die( __( 'Invalid sales log ID', 'wp-e-commerce' ) );
652
- }
653
-
654
- $this->log->init_items();
655
-
656
- $columns = array(
657
- 'title' => __( 'Item Name', 'wp-e-commerce' ),
658
- 'sku' => __( 'SKU', 'wp-e-commerce' ),
659
- 'quantity' => __( 'Quantity', 'wp-e-commerce' ),
660
- 'price' => __( 'Price', 'wp-e-commerce' ),
661
- 'shipping' => __( 'Item Shipping','wp-e-commerce' ),
662
- );
663
-
664
- if ( wpec_display_product_tax() ) {
665
- $columns['tax'] = __( 'Item Tax', 'wp-e-commerce' );
666
- }
667
-
668
- $columns['total'] = __( 'Item Total','wp-e-commerce' );
669
-
670
- $this->cols = count( $columns ) - 2;
671
-
672
- register_column_headers( 'wpsc_purchase_log_item_details', $columns );
673
-
674
- if ( file_exists( get_stylesheet_directory() . '/wpsc-packing-slip.php' ) ) {
675
- $packing_slip_file = get_stylesheet_directory() . '/wpsc-packing-slip.php';
676
- } else {
677
- $packing_slip_file = 'includes/purchase-logs-page/packing-slip.php';
678
- }
679
-
680
- $packing_slip_file = apply_filters( 'wpsc_packing_packing_slip_path', $packing_slip_file );
681
-
682
- include( $packing_slip_file );
683
-
684
- exit;
685
- }
686
-
687
- public function controller_default() {
688
- // Create an instance of our package class...
689
- $this->list_table = new WPSC_Purchase_Log_List_Table();
690
- $this->process_bulk_action();
691
- $this->list_table->prepare_items();
692
- add_action( 'wpsc_display_purchase_logs_page', array( $this, 'display_list_table' ) );
693
- }
694
-
695
- public function display_purchase_log() {
696
- $this->cols = 4;
697
- if ( wpec_display_product_tax() ) {
698
- $this->cols++;
699
- }
700
-
701
- if ( $this->can_edit ) {
702
- $this->cols++;
703
- }
704
-
705
- $receipt_sent = ! empty( $_GET['sent'] );
706
- $receipt_not_sent = isset( $_GET['sent'] ) && ! $_GET['sent'];
707
- include( 'includes/purchase-logs-page/item-details.php' );
708
-
709
- global $wp_scripts;
710
-
711
- wp_enqueue_script( 'wp-backbone' );
712
-
713
- if ( isset( $wp_scripts->registered['wp-e-commerce-purchase-logs'] ) ) {
714
- // JS needed for modal
715
- $wp_scripts->registered['wp-e-commerce-purchase-logs']->deps[] = 'wp-backbone';
716
- }
717
-
718
- add_action( 'admin_footer', 'find_posts_div' );
719
- }
720
-
721
- public function download_csv() {
722
- _wpsc_download_purchase_log_csv();
723
- }
724
-
725
- public function process_bulk_action() {
726
- global $wpdb;
727
- $current_action = $this->list_table->current_action();
728
-
729
- do_action( 'wpsc_sales_log_process_bulk_action', $current_action );
730
-
731
- if ( ! $current_action || ( 'download_csv' != $current_action && empty( $_REQUEST['post'] ) ) ) {
732
- if ( ! empty( $_REQUEST['_wp_http_referer'] ) ) {
733
- wp_redirect( esc_url_raw( remove_query_arg( array( '_wp_http_referer', '_wpnonce', 'action', 'action2' ), stripslashes( $_SERVER['REQUEST_URI'] ) ) ) );
734
- exit;
735
- }
736
-
737
- unset( $_REQUEST['post'] );
738
- return;
739
- }
740
-
741
- if ( 'download_csv' == $current_action ) {
742
- $this->download_csv();
743
- }
744
-
745
- $sendback = remove_query_arg( array(
746
- '_wpnonce',
747
- '_wp_http_referer',
748
- 'action',
749
- 'action2',
750
- 'confirm',
751
- 'post',
752
- 'last_paged'
753
- ) );
754
-
755
- if ( 'delete' == $current_action ) {
756
-
757
- // delete action
758
- if ( empty( $_REQUEST['confirm'] ) ) {
759
- $this->list_table->disable_search_box();
760
- $this->list_table->disable_bulk_actions();
761
- $this->list_table->disable_sortable();
762
- $this->list_table->disable_month_filter();
763
- $this->list_table->disable_views();
764
- $this->list_table->set_per_page(0);
765
- add_action( 'wpsc_purchase_logs_list_table_before', array( $this, 'action_list_table_before' ) );
766
- return;
767
- } else {
768
- if ( empty( $_REQUEST['post'] ) )
769
- return;
770
-
771
- $ids = array_map( 'intval', $_REQUEST['post'] );
772
-
773
- foreach ( $ids as $id ) {
774
- $log = wpsc_get_order( $id );
775
- $log->delete();
776
- }
777
-
778
- $sendback = add_query_arg( array(
779
- 'paged' => $_REQUEST['last_paged'],
780
- 'deleted' => count( $_REQUEST['post'] ),
781
- ), $sendback );
782
-
783
- }
784
- }
785
-
786
- // change status actions
787
- if ( is_numeric( $current_action ) && ! empty( $_REQUEST['post'] ) ) {
788
-
789
- foreach ( $_REQUEST['post'] as $id )
790
- wpsc_purchlog_edit_status( $id, $current_action );
791
-
792
- $sendback = add_query_arg( array(
793
- 'updated' => count( $_REQUEST['post'] ),
794
- ), $sendback );
795
- }
796
-
797
- wp_redirect( esc_url_raw( $sendback ) );
798
- exit;
799
- }
800
-
801
- public function action_list_table_before() {
802
- include( 'includes/purchase-logs-page/bulk-delete-confirm.php' );
803
- }
804
-
805
- public function display_list_table() {
806
- if ( ! empty( $this->output ) ) {
807
- echo $this->output;
808
- return;
809
- }
810
-
811
- include( 'includes/purchase-logs-page/list-table.php' );
812
- }
813
-
814
- private function get_purchase_log_url( $id ) {
815
- $location = add_query_arg( array(
816
- 'page' => 'wpsc-purchase-logs',
817
- 'c' => 'item_details',
818
- 'id' => $id,
819
- ), admin_url( 'index.php' ) );
820
-
821
- return esc_url( $location );
822
- }
823
-
824
- }
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
trunk/wpsc-admin/display-update.page.php DELETED
@@ -1,122 +0,0 @@
1
- <?php
2
- /**
3
- * WP eCommerce database updating page functions
4
- *
5
- * These are the main WPSC Admin functions
6
- *
7
- * @package wp-e-commerce
8
- * @since 3.8
9
- */
10
-
11
- global $wpdb,$wp_version;
12
- $show_update_page = 1;
13
-
14
- // if there's nothing in the children variation cache, refresh it, just to make sure.
15
- if ( 0 == count( get_option( 'wpsc-variation_children' ) ) ) {
16
- delete_option( 'wpsc-variation_children' );
17
- _get_term_hierarchy( 'wpsc-variation' );
18
- }
19
-
20
- // if there's nothing in the children variation cache, refresh it, just to make sure.
21
- if ( 0 == count( get_option( 'wpsc_product_category_children' ) ) ) {
22
- delete_option( 'wpsc_product_category_children' );
23
- _get_term_hierarchy( 'wpsc_product_category_children' );
24
- }
25
-
26
- $wpsc_version = get_option( 'wpsc_version', '0' );
27
-
28
- // If database is already updated, then no need to update
29
- if ( ! get_option( 'wpsc_needs_update', false ) ) {
30
- $show_update_page = 0;
31
- } else {
32
-
33
- $table_exists = $wpdb->get_var( "SHOW TABLES LIKE '" . WPSC_TABLE_PRODUCT_LIST . "'" );
34
- $product_count = empty( $table_exists ) ? 0 : $wpdb->get_var( "SELECT COUNT(*) FROM " . WPSC_TABLE_PRODUCT_LIST );
35
-
36
- if ( $product_count > 0 ) {
37
-
38
- function wpsc_display_update_notice() {
39
- echo "<div id='wpsc-warning' class='error fade'><p><strong>" . __( 'WP eCommerce is almost ready.', 'wp-e-commerce' ) . "</strong> " . sprintf( __( 'You must <a href="%1$s">update your database</a> to import all of your products.', 'wp-e-commerce' ), "admin.php?page=wpsc-update") . "</p></div>";
40
- }
41
-
42
- if ( ! isset( $_GET['page'] ) || $_GET['page'] != 'wpsc-update' )
43
- add_action( 'admin_notices', 'wpsc_display_update_notice' );
44
-
45
- // There weren't any products, so mark the update as complete
46
- } else {
47
- update_option( 'wpsc_version', WPSC_VERSION );
48
- }
49
- }
50
-
51
- /**
52
- * Throw a warning if the PHP version is not compatible with WP e-Commerce
53
- *
54
- * @since 3.8
55
- */
56
- function wpsc_display_php_version_notice() {
57
- ?>
58
- <div id='wpsc-warning' class='error fade'><p><?php printf( __( 'You are using PHP %s. WP eCommerce %s requires PHP 5.0 or above. Please contact your hosting provider for further assistance.', 'wp-e-commerce' ), PHP_VERSION, WPSC_VERSION ); ?></p></div>
59
- <?php
60
- }
61
-
62
- /**
63
- * Display the "Update WP e-Commerce page"
64
- */
65
- function wpsc_display_update_page() {
66
- global $wpdb;
67
- ?>
68
-
69
- <div class="wrap">
70
- <h2><?php esc_html_e( 'Update WP eCommerce', 'wp-e-commerce' ); ?> </h2>
71
- <br />
72
- <?php
73
- if ( isset( $_REQUEST['run_updates'] ) ) :
74
- ob_implicit_flush( true );
75
- $wpsc_update = WPSC_Update::get_instance();
76
- $update_stages = array(
77
- 'convert_category_groups' => __( 'Updating Categories...' , 'wp-e-commerce' ),
78
- 'convert_variation_sets' => __( 'Updating Variations...' , 'wp-e-commerce' ),
79
- 'convert_products_to_posts' => __( 'Updating Products ...' , 'wp-e-commerce' ),
80
- 'convert_variation_combinations' => __( 'Updating Child Products...', 'wp-e-commerce' ),
81
- 'update_files' => __( 'Updating Product Files...' , 'wp-e-commerce' ),
82
- 'update_purchase_logs' => __( 'Updating Purchase Logs... ', 'wp-e-commerce' ),
83
- 'create_or_update_tables' => __( 'Updating Database...' , 'wp-e-commerce' ),
84
- 'update_database' => '',
85
- );
86
-
87
- foreach ( $update_stages as $function => $message ) {
88
- $wpsc_update->run( $function, $message );
89
- }
90
-
91
- echo '<br /><br /><strong>' . esc_html__( 'WP eCommerce updated successfully!', 'wp-e-commerce' ) . '</strong><br />';
92
- if( '' != get_option('permalink_structure')){ ?>
93
- <em><?php echo esc_html( sprintf( __( 'Note: It looks like you have custom permalinks, you will need to refresh your permalinks <a href="%s">here</a>', 'wp-e-commerce' ) , admin_url( 'options-permalink.php' ) ) ); ?></em>
94
- <?php
95
- }
96
- update_option('wpsc_version', 3.8);
97
- update_option('wpsc_hide_update', true);
98
- update_option( 'wpsc_needs_update', false );
99
- $wpsc_update->clean_up();
100
- ob_implicit_flush( false );
101
- else:
102
-
103
-
104
- esc_html_e( 'Your WP eCommerce database needs to be updated for WP eCommerce 3.8. To perform this update, press the button below. It is highly recommended that you back up your database before performing this update.', 'wp-e-commerce' );
105
- ?> <br />
106
- <br />
107
- <em><?php esc_html_e( 'Note: If the server times out or runs out of memory, just reload this page, the server will pick up where it left off.', 'wp-e-commerce' ); ?></em>
108
- <br />
109
-
110
- <form action="" method="post" id="setup">
111
- <input type="hidden" name="run_updates" value="true" id="run_updates">
112
- <p class="step"><input type="submit" class="button" value="<?php esc_attr_e( 'Update WP eCommerce', 'wp-e-commerce' ); ?>" name="Submit"></p>
113
- </form>
114
- <?php
115
- endif;
116
- ?>
117
- </div>
118
-
119
- <?php
120
- }
121
-
122
- ?>
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
trunk/wpsc-admin/display-upgrades.page.php DELETED
@@ -1,180 +0,0 @@
1
- <?php
2
- function wpsc_display_upgrades_page() {
3
-
4
- do_action( 'wpsc_upgrades_license_activation' ); ?>
5
-
6
- <div class='wrap'>
7
- <div class='metabox-holder wpsc_gold_side'>
8
- <div class='metabox-holder'>
9
- <form method='post' id='product_license_box' action=''>
10
- <div class="postbox">
11
- <h3 class="hndle"><?php _e( 'Product License Registration', 'wp-e-commerce' );?></h3>
12
- <p>
13
- <label for="activation_key"><?php _e( 'License Key ', 'wp-e-commerce' ); ?></label>
14
- <input type="text" id="activation_key" name="product_license" size="48" value="" class="text" />
15
- </p>
16
- <p>
17
- <input type="hidden" value="true" name="product_license_key" />
18
- <?php submit_button( __( 'Register License', 'wp-e-commerce' ), 'primary', 'submit_values', false ); ?>
19
- <?php submit_button( __( 'Reset License', 'wp-e-commerce' ), 'secondary', 'reset_values', false ); ?>
20
- </p>
21
- <?php
22
- echo '<p>' . sprintf(
23
- __( 'Enter your extension license keys here to receive updates for purchased extensions. If your license key has expired, please <a href="%s" target="_blank">renew your license</a>.', 'wp-e-commerce' ),
24
- 'http://docs.wpecommerce.org/license-renewals/'
25
- ) . '</p>';
26
- ?>
27
- <p>
28
- <?php _e( 'API keys purchased prior to November 6, 2015 will not work.', 'wp-e-commerce' ); ?>
29
- </p>
30
-
31
- </div>
32
- </form>
33
- </div>
34
- </div>
35
- </div>
36
- <?php
37
- wpse_license_page_display_licenses();
38
- }
39
-
40
- function wpse_license_page_display_licenses () {
41
- $licenses = get_option( 'wpec_licenses_active_products', array() );
42
- ?>
43
- <table class="wp-list-table widefat striped">
44
- <thead>
45
- <tr>
46
- <th scope="col" id="product_name" class="manage-column column-product_name column-primary"><?php _e('Product Name', 'wp-e-commerce'); ?></th>
47
- <th scope="col" id="product_license" class="manage-column column-product_license"><?php _e('License Key', 'wp-e-commerce'); ?></th>
48
- <th scope="col" id="product_expiry" class="manage-column column-product_expiry"><?php _e('License Expiration', 'wp-e-commerce'); ?></th>
49
- </tr>
50
- </thead>
51
- <tbody id="the-list">
52
- <?php
53
- if ( ! empty( $licenses ) ) {
54
- foreach ( (array) $licenses as $license ) { $license_info = get_option( 'wpec_product_' . $license . '_license_active', array() ); ?>
55
- <?php do_action( 'wpec_license_individual_license', $license_info ); ?>
56
- <tr><td class="product_name column-product_name"><p><strong><?php echo esc_html( $license_info->item_name ); ?></strong></p></td>
57
- <td class="product_license column-product_license"><p><strong><?php echo esc_html( $license_info->license_key ); ?></strong></p></td>
58
- <td class="product_expiry column-product_expiry"><p><strong><?php if ( $license_info->expiration == 'lifetime' ) { _e('Lifetime', 'wp-e-commerce'); } else { echo esc_html( $license_info->expiration ); } ?></strong></p></td></tr>
59
- <?php }
60
- } else {
61
- ?>
62
- <tr class="no-items"><td class="colspanchange" colspan="4"><p><?php _e('No licenses found.', 'wp-e-commerce'); ?></p></td></tr>
63
- <?php
64
- }
65
- ?>
66
- </tbody>
67
- <tfoot>
68
- <tr>
69
- <th scope="col" class="manage-column column-product_name column-primary"><?php _e( 'Product Name', 'wp-e-commerce' ); ?></th>
70
- <th scope="col" class="manage-column column-product_license"><?php _e( 'License Key', 'wp-e-commerce' ); ?></th>
71
- <th scope="col" class="manage-column column-product_expiry"><?php _e( 'License Expiration', 'wp-e-commerce' ); ?></th>
72
- </tr>
73
- </tfoot>
74
- </table>
75
- <?php
76
- }
77
-
78
- /**
79
- * Activate Gold Cart plugin
80
- */
81
- function wpec_licenses_action_stuff() {
82
- //Activate a new Product License
83
-
84
- if( ! current_user_can( 'manage_options' ) ) {
85
- return;
86
- }
87
-
88
- if ( isset( $_POST['product_license_key'] ) && $_POST['product_license_key'] == 'true' ) {
89
- if ( isset( $_POST['product_license'] ) && $_POST['product_license'] != '' ) {
90
-
91
- //Do stuff
92
- $params = array (
93
- 'license' => sanitize_text_field( $_POST['product_license'] ),
94
- 'url' => home_url()
95
- );
96
-
97
- $activation = false;
98
- if ( isset( $_POST['submit_values'] ) && $_POST['submit_values'] == __( 'Register License', 'wp-e-commerce' ) ) {
99
- $activation = true;
100
- $params['wpec_lic_action'] = 'activate_license';
101
- } elseif ( isset( $_POST['reset_values'] ) && $_POST['reset_values'] == __( 'Reset License', 'wp-e-commerce' ) ) {
102
- $params['wpec_lic_action'] = 'deactivate_license';
103
- }
104
-
105
- $response = wp_safe_remote_post(
106
- 'https://wpecommerce.org/',
107
- array(
108
- 'timeout' => 15,
109
- 'sslverify' => false,
110
- 'body' => $params
111
- )
112
- );
113
-
114
- // Make sure there are no errors
115
- if ( is_wp_error( $response ) ) {
116
- return;
117
- }
118
-
119
- // Decode license data
120
- $license_data = json_decode( wp_remote_retrieve_body( $response ) );
121
- $active_licenses = get_option( 'wpec_licenses_active_products', array() );
122
-
123
- if ( $license_data->success === true ) {
124
- if ( $activation ) {
125
- // Tell WordPress to look for updates
126
- set_site_transient( 'update_plugins', null );
127
- $active_licenses[] = $license_data->item_id;
128
- update_option( 'wpec_licenses_active_products', $active_licenses );
129
- update_option( 'wpec_product_' . $license_data->item_id . '_license_active', $license_data );
130
- } else {
131
- $key = array_search( $license_data->item_id, $active_licenses );
132
- unset( $active_licenses[ $key ] );
133
- update_option( 'wpec_licenses_active_products', $active_licenses );
134
- delete_option( 'wpec_product_' . $license_data->item_id . '_license_active' );
135
- }
136
-
137
-
138
- echo '<div class="updated"><p>' . esc_html( $license_data->message ).'</p></div>';
139
- } else {
140
- echo '<div class="error"><p>' . esc_html( $license_data->message ).'</p></div>';
141
- }
142
- }
143
- }
144
- }
145
-
146
- add_action( 'wpsc_upgrades_license_activation', 'wpec_licenses_action_stuff' );
147
-
148
- function wpec_license_notices() {
149
- static $showed_invalid_message;
150
-
151
- if ( ! current_user_can( 'manage_options' ) ) {
152
- return;
153
- }
154
-
155
- $active_licenses = get_option( 'wpec_licenses_active_products', array() );
156
- if( empty( $active_licenses ) ) {
157
- return;
158
- }
159
-
160
- $messages = array();
161
-
162
- foreach ( (array) $active_licenses as $license ) {
163
- $license = get_option( 'wpec_product_' . $license . '_license_active' );
164
-
165
- if( is_object( $license ) && 'valid' !== $license->license && empty( $showed_invalid_message ) ) {
166
- $messages[] = sprintf(
167
- __( 'You have invalid or expired license keys for WP eCommerce. Please go to the <a href="%s" title="WPeC Licensing">WPeC Licensing</a> page to correct this issue.', 'wp-e-commerce' ),
168
- admin_url( 'index.php?page=wpsc-upgrades' )
169
- );
170
- $showed_invalid_message = true;
171
- }
172
- }
173
-
174
- if( ! empty( $messages ) ) {
175
- foreach( $messages as $message ) {
176
- echo '<div class="error"><p>' . $message . '</p></div>';
177
- }
178
- }
179
- }
180
- add_action( 'admin_notices', 'wpec_license_notices' );
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
trunk/wpsc-admin/includes/coupon-list-table-class.php DELETED
@@ -1,484 +0,0 @@
1
- <?php
2
- /**
3
- * Coupon WP List Table Class
4
- *
5
- * @package WP e-Commerce
6
- * @subpackage Coupon List Table Class
7
- * @license http://opensource.org/licenses/gpl-2.0.php GNU Public License
8
- * @since 3.8.10
9
- */
10
-
11
-
12
- // Exit if accessed directly
13
- if ( ! defined( 'ABSPATH' ) ) exit;
14
-
15
-
16
- // Load WP_List_Table if not loaded
17
- if ( ! class_exists( 'WP_List_Table' ) ) {
18
- require_once ABSPATH . 'wp-admin/includes/class-wp-list-table.php';
19
- }
20
-
21
- /**
22
- * WPSC Coupon Codes Table Class
23
- *
24
- * Renders the Coupons table on the Coupons page
25
- *
26
- * @access private
27
- * @since 3.8.10
28
- */
29
-
30
- class WPSC_Coupons_List_Table extends WP_List_Table {
31
-
32
-
33
- /**
34
- * Number of results to show per page
35
- *
36
- * @since 3.8.10
37
- */
38
- private $per_page = 30;
39
-
40
- private $total_count;
41
- private $active_count;
42
- private $inactive_count;
43
- private $statuses;
44
-
45
-
46
- /**
47
- * Get things started
48
- *
49
- * @access private
50
- * @since 3.8.10
51
- * @return void
52
- */
53
-
54
- public function __construct(){
55
- global $status, $page;
56
-
57
- parent::__construct( array(
58
- 'singular' => 'coupon',
59
- 'plural' => 'coupons',
60
- 'ajax' => false
61
- ) );
62
-
63
- $this->statuses = array(
64
- 'active' => _x( 'Active', 'coupon status', 'wp-e-commerce' ),
65
- 'inactive' => _x( 'Inactive', 'coupon status', 'wp-e-commerce' ),
66
- 'unknown' => _x( 'Unknown', 'coupon status', 'wp-e-commerce' ),
67
- );
68
-
69
- $this->process_single_actions();
70
- $this->count_coupons();
71
- }
72
-
73
-
74
- /**
75
- * Retrieve the view types
76
- *
77
- * @access private
78
- * @since 3.8.10
79
- * @return array
80
- */
81
-
82
- public function get_views() {
83
- $base = admin_url('edit.php?post_type=wpsc-product&page=wpsc-edit-coupons');
84
-
85
- $current = isset( $_GET['status'] ) ? $_GET['status'] : 'all';
86
- $total_count = '&nbsp;<span class="count">(' . $this->total_count . ')</span>';
87
- $active_count = '&nbsp;<span class="count">(' . $this->active_count . ')</span>';
88
- $inactive_count = '&nbsp;<span class="count">(' . $this->inactive_count . ')</span>';
89
-
90
- $views = array(
91
- 'all' => sprintf( '<a href="%s"%s>%s</a>', esc_url( remove_query_arg( 'status', $base ) ), $current === 'all' || $current == '' ? ' class="current"' : '', __('All', 'wp-e-commerce') . $total_count ),
92
- 'active' => sprintf( '<a href="%s"%s>%s</a>', esc_url( add_query_arg( 'status', '1', $base ) ), $current === '1' ? ' class="current"' : '', __('Active', 'wp-e-commerce') . $active_count ),
93
- 'inactive' => sprintf( '<a href="%s"%s>%s</a>', esc_url( add_query_arg( 'status', '0', $base ) ), $current === '0' ? ' class="current"' : '', __('Inactive', 'wp-e-commerce') . $inactive_count ),
94
- );
95
-
96
- return $views;
97
- }
98
-
99
-
100
- /**
101
- * Retrieve the table columnds
102
- *
103
- * @access private
104
- * @since 3.8.10
105
- * @return array
106
- */
107
-
108
- public function get_columns() {
109
- $columns = array(
110
- 'cb' => '<input type="checkbox" />',
111
- 'coupon' => __( 'Code', 'wp-e-commerce' ),
112
- 'discount' => __( 'Discount', 'wp-e-commerce' ),
113
- 'start' => __( 'Start Date', 'wp-e-commerce' ),
114
- 'expiry' => __( 'Expiration', 'wp-e-commerce' ),
115
- 'status' => __( 'Status', 'wp-e-commerce' ),
116
- );
117
-
118
- return $columns;
119
- }
120
-
121
-
122
- /**
123
- * Render most columns
124
- *
125
- * @access private
126
- * @param array $item Contains all the data of the discount code
127
- * @param string $column_name The name of the column
128
- * @since 3.8.10
129
- * @return string
130
- */
131
-
132
- protected function column_default( $item, $column_name ) {
133
- switch( $column_name ){
134
- case 'start' :
135
-
136
- if( ! empty( $item[ 'start'] ) && '0000-00-00 00:00:00' != $item['start'] ) {
137
- $start_date = strtotime( get_date_from_gmt( $item[ $column_name ] ) );
138
- $value = date_i18n( get_option( 'date_format' ), $start_date );
139
- } else {
140
- $value = __( 'None', 'wp-e-commerce' );
141
- }
142
-
143
- return $value;
144
-
145
- case 'expiry' :
146
-
147
- if( ! empty( $item[ 'expiry'] ) && '0000-00-00 00:00:00' != $item['expiry'] ) {
148
- $expiry_date = strtotime( get_date_from_gmt( $item[ $column_name ] ) );
149
- $value = date_i18n( get_option( 'date_format' ), $expiry_date );
150
- } else {
151
- $value = __( 'None', 'wp-e-commerce' );
152
- }
153
-
154
- return $value;
155
-
156
- default:
157
- return $item[ $column_name ];
158
- }
159
- }
160
-
161
- /**
162
- * Render the Name Column
163
- *
164
- * @access private
165
- * @param array $item Contains all the data of the discount code
166
- * @since 3.8.10
167
- * @return string
168
- */
169
- protected function column_coupon( $item ) {
170
-
171
- $base = admin_url( 'edit.php?post_type=wpsc-product&page=wpsc-edit-coupons&wpsc-action=edit_coupon&coupon=' . $item['ID'] );
172
-
173
- $coupon = '<strong><a href="' . esc_url( add_query_arg( array( 'wpsc-action' => 'edit_coupon', 'coupon' => $item['ID'] ) ) ) . '">' . esc_html( $item['coupon'] ) . '</a></strong>';
174
-
175
- $row_actions = array();
176
-
177
- $row_actions['edit'] = '<a href="' . esc_url( add_query_arg( array( 'wpsc-action' => 'edit_coupon', 'coupon' => $item['ID'] ) ) ) . '">' . __( 'Edit', 'wp-e-commerce' ) . '</a>';
178
-
179
- if( strtolower( $item['status'] ) == 'active' )
180
- $row_actions['deactivate'] = '<a href="' . esc_url( add_query_arg( array( 'wpsc-action' => 'deactivate_coupon', 'coupon' => $item['ID'] ) ) ) . '">' . __( 'Deactivate', 'wp-e-commerce' ) . '</a>';
181
- else
182
- $row_actions['activate'] = '<a href="' . esc_url( add_query_arg( array( 'wpsc-action' => 'activate_coupon', 'coupon' => $item['ID'] ) ) ) . '">' . __( 'Activate', 'wp-e-commerce' ) . '</a>';
183
-
184
- $row_actions['delete'] = '<a href="' . esc_url( add_query_arg( array( 'wpsc-action' => 'delete_coupon', 'coupon' => $item['ID'] ) ) ) . '">' . __( 'Delete', 'wp-e-commerce' ) . '</a>';
185
-
186
- $row_actions = apply_filters( 'wpsc_coupon_row_actions', $row_actions, $item['ID'] );
187
-
188
- return $coupon . $this->row_actions( $row_actions );
189
- }
190
-
191
-
192
- /**
193
- * Render the checkbox column
194
- *
195
- * @access private
196
- * @since 3.8.10
197
- * @return string
198
- */
199
-
200
- protected function column_cb( $item ) {
201
- return sprintf(
202
- '<input type="checkbox" name="%1$s[]" value="%2$s" />',
203
- /*$1%s*/ $this->_args['singular'],
204
- /*$2%s*/ $item['ID']
205
- );
206
- }
207
-
208
-
209
- /**
210
- * Render the Status Column
211
- *
212
- * @access private
213
- * @param array $item Contains all the data of the discount code
214
- * @since 3.8.10
215
- * @return string
216
- */
217
-
218
- protected function column_status( $item ) {
219
- if ( ! array_key_exists( $item['status'], $this->statuses ) )
220
- $item['status'] = 'unknown';
221
-
222
- $column = '<span class="wpsc-coupon-status wpsc-coupon-status-%1$s">%2$s</a>';
223
- $column = sprintf( $column, $item['status'], $this->statuses[$item['status']] );
224
-
225
- return $column;
226
- }
227
-
228
-
229
- /**
230
- * Render the Discount Column
231
- *
232
- * @access private
233
- * @param array $item Contains all the data of the discount code
234
- * @since 3.8.10
235
- * @return string
236
- */
237
-
238
- protected function column_discount( $item ) {
239
- switch( $item['type'] ) {
240
- case 0:
241
- return wpsc_currency_display( $item['discount'] );
242
- break;
243
- case 1:
244
- return $item['discount'] . '%';
245
- break;
246
- case 2:
247
- return __( 'Free shipping', 'wp-e-commerce' );
248
- break;
249
- }
250
- }
251
-
252
-
253
- /**
254
- * Retrieve the bulk actions
255
- *
256
- * @access private
257
- * @since 3.8.10
258
- * @return array
259
- */
260
-
261
- public function get_bulk_actions() {
262
- $actions = array(
263
- 'activate' => __( 'Activate', 'wp-e-commerce' ),
264
- 'deactivate' => __( 'Deactivate', 'wp-e-commerce' ),
265
- 'delete' => __( 'Delete', 'wp-e-commerce' )
266
- );
267
-
268
- return $actions;
269
- }
270
-
271
-
272
- /**
273
- * Process the bulk actions
274
- *
275
- * @access private
276
- * @since 3.8.10
277
- * @return void
278
- */
279
-
280
- public function process_bulk_action() {
281
-
282
- global $wpdb;
283
-
284
- $ids = isset( $_GET['coupon'] ) ? $_GET['coupon'] : false;
285
-
286
- if ( ! is_array( $ids ) ) {
287
- $ids = array( $ids );
288
- }
289
-
290
- foreach ( $ids as $id ) {
291
-
292
- $coupon = new WPSC_Coupon( $id );
293
-
294
- if ( 'delete' === $this->current_action() ) {
295
-
296
- // Delete a discount
297
- $coupon->delete();
298
-
299
- } elseif( 'activate' === $this->current_action() ) {
300
-
301
- // Activate a discount
302
- $coupon->activate();
303
-
304
- } elseif( 'deactivate' === $this->current_action() ) {
305
-
306
- // Deactivate a discount
307
- $coupon->deactivate();
308
-
309
- }
310
-
311
- }
312
-
313
- }
314
-
315
- /**
316
- * Process single actions
317
- *
318
- * @access private
319
- * @since 3.8.10
320
- * @return void
321
- */
322
- public function process_single_actions() {
323
-
324
- global $wpdb;
325
-
326
- if ( ! isset( $_GET['wpsc-action'] ) || ! isset( $_GET['coupon'] ) ) {
327
- return;
328
- }
329
-
330
- $coupon = new WPSC_Coupon( $_GET['coupon'] );
331
-
332
- switch ( $_GET['wpsc-action'] ) {
333
-
334
- case 'activate_coupon':
335
-
336
- $updated = $coupon->activate();
337
-
338
- if ( $updated ) {
339
- printf( '<div class="updated"><p>%s</p></div>', __( 'The coupon has been activated.', 'wp-e-commerce' ) );
340
- }
341
-
342
- break;
343
-
344
- case 'deactivate_coupon':
345
-
346
- $updated = $coupon->deactivate();
347
-
348
- if ( $updated ) {
349
- printf( '<div class="updated"><p>%s</p></div>', __( 'The coupon has been deactivated.', 'wp-e-commerce' ) );
350
- }
351
-
352
- break;
353
-
354
- case 'delete_coupon':
355
-
356
- $deleted = $coupon->delete();
357
-
358
- if ( $deleted ) {
359
- printf( '<div class="updated"><p>%s</p></div>', __( 'The coupon has been deleted.', 'wp-e-commerce' ) );
360
- }
361
-
362
- break;
363
-
364
- }
365
-
366
- }
367
-
368
-
369
- /**
370
- * Retrieve the discount code counts
371
- *
372
- * @access private
373
- * @since 3.8.10
374
- * @return array
375
- */
376
- public function count_coupons() {
377
-
378
- global $wpdb;
379
-
380
- // retrieve all discounts here
381
- $this->active_count = $wpdb->get_var( "SELECT COUNT(id) AS count FROM " . WPSC_TABLE_COUPON_CODES . " WHERE active=1;" );
382
- $this->inactive_count = $wpdb->get_var( "SELECT COUNT(id) AS count FROM " . WPSC_TABLE_COUPON_CODES . " WHERE active=0;" );
383
- $this->total_count = $this->active_count + $this->inactive_count;
384
- }
385
-
386
-
387
- /**
388
- * Retrieve all the data for all the discount codes
389
- *
390
- * @access private
391
- * @since 3.8.10
392
- * @return array
393
- */
394
- public function coupons_data() {
395
-
396
- global $wpdb;
397
-
398
- $coupons_data = array();
399
-
400
- if ( isset( $_GET['paged'] ) ) $page = $_GET['paged']; else $page = 1;
401
-
402
- $per_page = $this->per_page;
403
- $offset = ( $page - 1 ) * $this->per_page;
404
-
405
- $status = isset( $_GET['status'] ) ? absint( $_GET['status'] ) : false;
406
- $where = $status !== false ? "WHERE active = $status" : '';
407
-
408
- $order = isset( $_GET['order'] ) && strtoupper( $_GET['order'] ) === 'ASC' ? 'ASC' : 'DESC';
409
- $limit = " LIMIT $offset,$per_page;";
410
- $coupons = $wpdb->get_results( "SELECT * FROM `" . WPSC_TABLE_COUPON_CODES . "` {$where} ORDER BY id {$order} {$limit} ", ARRAY_A );
411
-
412
- if ( $coupons ) {
413
- foreach ( $coupons as $data ) {
414
-
415
- $coupon = new WPSC_Coupon( array(
416
- 'id' => $data['id'],
417
- 'coupon_code' => $data['coupon_code'],
418
- 'value' => $data['value'],
419
- 'is-percentage' => $data['is-percentage'],
420
- 'start' => $data['start'],
421
- 'expiry' => $data['expiry'],
422
- 'active' => $data['active']
423
- ) );
424
-
425
- // Re-map data to array for legacy handling of this method's return data.
426
- // (would be nicer to return an object?)
427
- $coupons_data[] = array(
428
- 'ID' => $coupon->get( 'id' ),
429
- 'coupon' => $coupon->get( 'coupon_code' ),
430
- 'discount' => $coupon->get( 'value' ),
431
- 'type' => $coupon->get( 'is-percentage' ),
432
- 'start' => $coupon->get( 'start' ),
433
- 'expiry' => $coupon->get( 'expiry' ),
434
- 'status' => $coupon->get( 'active' ) == 1 ? 'active' : 'inactive'
435
- );
436
-
437
- }
438
- }
439
- return $coupons_data;
440
- }
441
-
442
-
443
- /**
444
- * Setup the final data for the table
445
- *
446
- * @access private
447
- * @since 3.8.10
448
- * @return array
449
- */
450
- public function prepare_items() {
451
-
452
- $hidden = array();
453
- $total_items = 0;
454
- $per_page = $this->per_page;
455
- $columns = $this->get_columns();
456
- $sortable = $this->get_sortable_columns();
457
- $this->_column_headers = array( $columns, $hidden, $sortable );
458
-
459
- $this->process_bulk_action();
460
-
461
- $data = $this->coupons_data();
462
- $this->items = $data;
463
-
464
- $status = isset( $_GET['status'] ) ? $_GET['status'] : 'any';
465
- switch ( $status ) {
466
- case '1':
467
- $total_items = $this->active_count;
468
- break;
469
- case '0':
470
- $total_items = $this->inactive_count;
471
- break;
472
- case 'any':
473
- $total_items = $this->total_count;
474
- break;
475
- }
476
-
477
- $this->set_pagination_args( array(
478
- 'total_items' => $total_items,
479
- 'per_page' => $per_page,
480
- 'total_pages' => ceil( $total_items / $per_page )
481
- )
482
- );
483
- }
484
- }
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
trunk/wpsc-admin/includes/display-items-functions.php DELETED
@@ -1,1687 +0,0 @@
1
- <?php
2
- /**
3
- * WPSC Product form generation functions
4
- *
5
- * @package wp-e-commerce
6
- * @since 3.7
7
- */
8
-
9
- global $wpsc_product_defaults;
10
-
11
- $wpsc_product_defaults = array(
12
- 'id' => '0',
13
- 'name' => '',
14
- 'description' => '',
15
- 'additional_description' => '',
16
- 'price' => '0.00',
17
- 'weight' => '0',
18
- 'weight_unit' => 'pound',
19
- 'pnp' => '0.00',
20
- 'international_pnp' => '0.00',
21
- 'file' => '0',
22
- 'image' => '',
23
- 'category' => '0',
24
- 'brand' => '0',
25
- 'quantity_limited' => '0',
26
- 'quantity' => '0',
27
- 'special' => '0',
28
- 'special_price' => 0.00,
29
- 'display_frontpage' => '0',
30
- 'notax' => '0',
31
- 'publish' => '1',
32
- 'active' => '1',
33
- 'donation' => '0',
34
- 'no_shipping' => '0',
35
- 'thumbnail_image' => '',
36
- 'thumbnail_state' => '1',
37
- 'meta' => array(
38
- 'external_link' => NULL,
39
- 'external_link_text' => NULL,
40
- 'merchant_notes' => NULL,
41
- 'sku' => NULL,
42
- 'engraved' => '0',
43
- 'can_have_uploaded_image' => '0',
44
- 'table_rate_price' => array(
45
- 'quantity' => array(
46
- 0 => '',
47
- ),
48
- 'table_price' => array(
49
- 0 => '',
50
- ),
51
- ),
52
- ),
53
- );
54
-
55
- function wpsc_redirect_variation_update( $location, $post_id ) {
56
- global $post;
57
-
58
- if ( $post->post_parent > 0 && 'wpsc-product' == $post->post_type )
59
- wp_redirect( admin_url( 'post.php?post='.$post->post_parent.'&action=edit' ) );
60
- else
61
- return $location;
62
-
63
- }
64
-
65
- add_filter( 'redirect_post_location', 'wpsc_redirect_variation_update', 10, 2 );
66
-
67
- function wpsc_price_control_forms() {
68
- global $post, $wpdb, $variations_processor, $wpsc_product_defaults;
69
-
70
- $product_data = get_post_custom( $post->ID );
71
- $product_data['meta'] = maybe_unserialize( $product_data );
72
-
73
- foreach ( $product_data['meta'] as $meta_key => $meta_value ) {
74
- $product_data['meta'][$meta_key] = $meta_value[0];
75
- }
76
-
77
- $product_meta = array();
78
-
79
- if ( ! empty( $product_data['_wpsc_product_metadata'] ) ) {
80
- $product_meta = maybe_unserialize( $product_data['_wpsc_product_metadata'][0] );
81
- }
82
-
83
- if ( isset( $product_data['meta']['_wpsc_currency'] ) ) {
84
- $product_alt_currency = maybe_unserialize( $product_data['meta']['_wpsc_currency'] );
85
- }
86
-
87
- if ( ! isset( $product_data['meta']['_wpsc_table_rate_price'] ) ) {
88
- $product_data['meta']['_wpsc_table_rate_price'] = $wpsc_product_defaults['meta']['table_rate_price'];
89
- }
90
-
91
- if ( isset( $product_meta['_wpsc_table_rate_price'] ) ) {
92
- $product_meta['table_rate_price']['state'] = 1;
93
- $product_meta['table_rate_price'] += $product_meta['_wpsc_table_rate_price'];
94
- $product_data['meta']['_wpsc_table_rate_price'] = $product_meta['_wpsc_table_rate_price'];
95
- }
96
-
97
-
98
- if ( ! isset( $product_data['meta']['_wpsc_is_donation'] ) ) {
99
- $product_data['meta']['_wpsc_is_donation'] = $wpsc_product_defaults['donation'];
100
- }
101
-
102
- if ( ! isset( $product_meta['table_rate_price']['state'] ) ) {
103
- $product_meta['table_rate_price']['state'] = null;
104
- }
105
-
106
- if ( ! isset( $product_meta['table_rate_price']['quantity'] ) ) {
107
- $product_meta['table_rate_price']['quantity'] = $wpsc_product_defaults['meta']['table_rate_price']['quantity'][0];
108
- }
109
-
110
- if ( ! isset( $product_data['meta']['_wpsc_price'] ) ) {
111
- $product_data['meta']['_wpsc_price'] = $wpsc_product_defaults['price'];
112
- }
113
-
114
- if ( ! isset( $product_data['special'] ) ) {
115
- $product_data['special'] = $wpsc_product_defaults['special'];
116
- }
117
-
118
- if ( ! isset( $product_data['meta']['_wpsc_special_price'] ) ) {
119
- $product_data['meta']['_wpsc_special_price'] = $wpsc_product_defaults['special_price'];
120
- }
121
-
122
- $product_data['meta']['_wpsc_special_price'] = wpsc_format_number( $product_data['meta']['_wpsc_special_price'] );
123
-
124
- if ( ! isset( $product_data['meta']['_wpsc_price'] ) ) {
125
- $product_data['meta']['_wpsc_price'] = 0;
126
- }
127
-
128
- $product_data['meta']['_wpsc_price'] = wpsc_format_number( $product_data['meta']['_wpsc_price'] );
129
-
130
- $currency_data = $wpdb->get_results( "SELECT * FROM `" . WPSC_TABLE_CURRENCY_LIST . "` ORDER BY `country` ASC", ARRAY_A );
131
-
132
- /* Get country name and symbol */
133
- $currency_type = get_option( 'currency_type' );
134
- $country = new WPSC_Country( $currency_type );
135
-
136
- $ct_code = $country->get_currency_code(); // Country currency code
137
- $ct_symb = $country->get_currency_symbol(); // Country symbol
138
-
139
- $price = $product_data['meta']['_wpsc_price'];
140
- $sale_price = $product_data['meta']['_wpsc_special_price'];
141
-
142
- $wp_38 = version_compare( $GLOBALS['wp_version'], '3.8', '>=' );
143
-
144
- $currency_delete_class = $wp_38 ? ' dashicons dashicons-dismiss' : '';
145
- $currency_delete_text = $wp_38 ? '' : 'x';
146
- ?>
147
- <em id="wpsc_product_price_metabox_live_title" class="wpsc_metabox_live_title">
148
- <p>&nbsp;<?php echo esc_html( $ct_symb ); ?><span><?php echo esc_html( $sale_price ); ?></span></p>
149
- <del><?php echo esc_html( $ct_symb ); ?><span><?php echo esc_html( $price ) ?></span></del>
150
- </em>
151
- <input type="hidden" id="parent_post" name="parent_post" value="<?php echo $post->post_parent; ?>" />
152
- <?php /* Lots of tedious work is avoided with this little line. */ ?>
153
- <input type="hidden" id="product_id" name="product_id" value="<?php echo $post->ID; ?>" />
154
-
155
- <?php /* Check product if a product has variations */ ?>
156
- <?php if ( wpsc_product_has_children( $post->ID ) ) : ?>
157
- <?php $price = wpsc_product_variation_price_from( $post->ID ); ?>
158
- <p style="margin-top: 6px;"><?php echo sprintf( __( 'This product has variations. To edit the price, please use the <a href="%s">Variation Controls</a>.' , 'wp-e-commerce' ), '#wpsc_product_variation_forms' ); ?></p>
159
- <p><?php printf( __( 'Price: %s and above.' , 'wp-e-commerce' ), $price ); ?></p>
160
- <?php else: ?>
161
-
162
- <div class='wpsc_floatleft' style="width:100px;">
163
- <label for="wpsc_price"><?php _e( 'Price', 'wp-e-commerce' ); ?></label>
164
- <?php echo esc_html( $ct_symb ); ?> <input id="wpsc_price"
165
- type="text"
166
- style="width: 70px;"
167
- name="meta[_wpsc_price]"
168
- value="<?php echo esc_attr( $price ); ?>" />
169
- </div>
170
-
171
- <div class='wpsc_floatleft' style='width:95px; margin-left:30px;'>
172
- <label for='wpsc_sale_price'><?php _e( 'Sale Price', 'wp-e-commerce' ); ?></label>
173
- <?php echo esc_html( $ct_symb ); ?> <input id = "wpsc_sale_price"
174
- type="text"
175
- style="width: 70px;"
176
- value="<?php echo esc_attr( $sale_price ); ?>"
177
- name='meta[_wpsc_special_price]' />
178
- </div>
179
-
180
- <div class="wpsc-currency-layers">
181
- <table>
182
- <thead>
183
- <tr>
184
- <th class="type" colspan="2"><?php esc_html_e( 'Alternative Currencies:', 'wp-e-commerce' ); ?></th>
185
- <th class="price"><?php esc_html_e( 'Price:', 'wp-e-commerce' ); ?></th>
186
- <tr>
187
- </thead>
188
- <tbody>
189
- <?php
190
- if ( isset( $product_alt_currency ) && is_array( $product_alt_currency ) ) :
191
- $i = 0;
192
- foreach ( $product_alt_currency as $iso => $alt_price ) :
193
- $i++;
194
- ?>
195
- <tr class="wpsc_additional_currency">
196
- <td class="remove"><a href="#" class="wpsc_delete_currency_layer<?php echo $currency_delete_class; ?>" rel="<?php echo $iso; ?>"><?php echo $currency_delete_text; ?></a></td>
197
- <td>
198
- <select name="newCurrency[]" class="newCurrency">
199
- <?php foreach ( $currency_data as $currency ) : ?>
200
- <option value="<?php echo absint( $currency['id'] ); ?>" <?php selected( $iso, $currency['isocode'] ); ?>>
201
- <?php echo esc_html( $currency['country'] ); ?> (<?php echo esc_html( $currency['currency'] ); ?>)
202
- </option>
203
- <?php endforeach; ?>
204
- </select>
205
- </td>
206
- <td><input class="newCurrPrice text" size="8" name="newCurrPrice[]" value="<?php echo esc_attr( $alt_price ); ?>" /></td>
207
- </tr>
208
- <?php
209
- endforeach;
210
- endif;
211
- ?>
212
- <tr id="wpsc_currency_row_template" class="template hidden">
213
- <td class="remove"><a href="#" class="wpsc_delete_currency_layer<?php echo $currency_delete_class; ?>"><?php echo $currency_delete_text; ?></a></td>
214
- <td>
215
- <select name="newCurrency[]" class="newCurrency">
216
- <?php foreach ( (array) $currency_data as $currency ) { ?>
217
- <option value="<?php echo absint( $currency['id'] ); ?>">
218
- <?php echo esc_html( $currency['country'] ); ?>
219
- </option>
220
- <?php } ?>
221
- </select>
222
- </td>
223
- <td><input class="newCurrPrice text" size="8" name="newCurrPrice[]" value="0.00" /></td>
224
- </tr>
225
- </tbody>
226
- </table>
227
- <a href="#wpsc_currency_row_template" class="button button-small wpsc_add_new_currency"><?php esc_html_e( 'Add a Currency Option', 'wp-e-commerce' ); ?></a>
228
- <?php wp_nonce_field( 'update-options', 'wpsc-update-currency-layers', false ); ?>
229
- </div>
230
-
231
- <div class="wpsc-quantity-discounts">
232
- <table>
233
- <thead>
234
- <tr>
235
- <th class="qty" colspan="2"><?php esc_html_e( 'Quantity:', 'wp-e-commerce' ); ?></th>
236
- <th class="curr"><span class="hidden"><?php esc_html_e( 'Currency:', 'wp-e-commerce' ); ?><span></th>
237
- <th class="price"><?php esc_html_e( 'Price:', 'wp-e-commerce' ); ?></th>
238
- </tr>
239
- </thead>
240
- <tbody>
241
- <?php
242
- if ( count( $product_meta['table_rate_price']['quantity'] ) > 0 ) {
243
- foreach ( (array) $product_meta['table_rate_price']['quantity'] as $key => $quantity ) {
244
- if ( $quantity != '' ) {
245
- $table_price = number_format( $product_meta['table_rate_price']['table_price'][ $key ], 2, '.', '' );
246
- ?>
247
- <tr>
248
- <td class="remove"><a href="#" class="remove_line<?php echo $currency_delete_class; ?>"><?php echo $currency_delete_text; ?></a></td>
249
- <td class="qty">
250
- <input type="text" size="5" value="<?php echo absint( $quantity ); ?>" name="table_rate_price[quantity][]" />
251
- <?php esc_html_e( '+', 'wp-e-commerce' ); ?>
252
- </td>
253
- <td class="curr"><?php echo $ct_code . ' ' . $ct_symb; ?></td>
254
- <td><input class="newCurrPrice text" value="<?php echo $table_price; ?>" name="table_rate_price[table_price][]" /></td>
255
- </tr>
256
- <?php
257
- }
258
- }
259
- }
260
- ?>
261
- <tr id="wpsc_quantity_discount_row_template" class="template hidden">
262
- <td class="remove"><a href="#" class="remove_line<?php echo $currency_delete_class; ?>"><?php echo $currency_delete_text; ?></a></td>
263
- <td class="qty">
264
- <input size="5" value="0" name="table_rate_price[quantity][]" />
265
- <?php esc_html_e( '+', 'wp-e-commerce' ); ?>
266
- </td>
267
- <td class="curr"><?php echo $ct_code . ' ' . $ct_symb; ?></td>
268
- <td><input size="10"class="newCurrPrice text" value="0" name="table_rate_price[table_price][]" /></td>
269
- </tr>
270
- </tbody>
271
- </table>
272
- <a href="#wpsc_quantity_discount_row_template" class="add_level button button-small"><?php esc_html_e( 'Add a Quantity Discount', 'wp-e-commerce' ); ?></a>
273
- <?php wp_nonce_field( 'update-options', 'wpsc-update-quantity-discounts', false ); ?>
274
- </div>
275
-
276
- <input id="add_form_donation" type="checkbox" name="meta[_wpsc_is_donation]" value="yes" <?php checked( $product_data['meta']['_wpsc_is_donation'], 1 ); ?> />
277
- <label for="add_form_donation"><?php _e( 'Purchase is a donation.', 'wp-e-commerce' ) ?></label>
278
- <?php wp_nonce_field( 'update', 'wpsc_product_pricing_nonce' ); ?>
279
-
280
- <?php endif;
281
-
282
- }
283
- function wpsc_stock_control_forms() {
284
- global $post, $wpdb, $variations_processor, $wpsc_product_defaults;
285
-
286
- $product_data = get_post_custom( $post->ID );
287
- $product_data['meta'] = maybe_unserialize( $product_data );
288
-
289
- foreach ( $product_data['meta'] as $meta_key => $meta_value ) {
290
- $product_data['meta'][$meta_key] = $meta_value[0];
291
- }
292
-
293
- $product_meta = array();
294
-
295
- if ( ! empty( $product_data['_wpsc_product_metadata'] ) ) {
296
- $product_meta = maybe_unserialize( $product_data["_wpsc_product_metadata"][0] );
297
- }
298
-
299
- if ( ! isset( $product_meta['unpublish_when_none_left'] ) ) {
300
- $product_meta['unpublish_when_none_left'] = '';
301
- }
302
-
303
- if ( ! isset( $product_meta['stock_limit_notify'] ) ) {
304
- $product_meta['stock_limit_notify'] = '';
305
- }
306
-
307
- // Display live title if stock is set
308
- if ( isset( $product_data['meta']['_wpsc_stock'] ) && is_numeric( $product_data['meta']['_wpsc_stock'] ) ) {
309
- $live_title = '<em id="wpsc_product_stock_metabox_live_title" class="wpsc_metabox_live_title">';
310
- $live_title .= sprintf( '<p><span>%s</span> %s</p>', wpsc_format_number( $product_data['meta']['_wpsc_stock'], 0 ), _x( 'left in stock', 'live preview of stock remaining in admin', 'wp-e-commerce' ) );
311
- $live_title .= '</em>';
312
-
313
- echo $live_title;
314
- }
315
-
316
- if ( ! empty( $product_meta['unpublish_when_none_left'] ) )
317
- ?>
318
- <label for="wpsc_sku"><abbr title="<?php esc_attr_e( 'Stock Keeping Unit', 'wp-e-commerce' ); ?>"><?php esc_html_e( 'SKU:', 'wp-e-commerce' ); ?></abbr></label>
319
- <?php
320
- if ( !isset( $product_data['meta']['_wpsc_sku'] ) )
321
- $product_data['meta']['_wpsc_sku'] = $wpsc_product_defaults['meta']['sku']; ?><br />
322
- <input size='32' type='text' class='text' id="wpsc_sku" name='meta[_wpsc_sku]' value='<?php echo esc_html( $product_data['meta']['_wpsc_sku'] ); ?>' />
323
- <br style="clear:both" />
324
- <?php
325
- if ( !isset( $product_data['meta']['_wpsc_stock'] ) )
326
- $product_data['meta']['_wpsc_stock'] = ''; ?>
327
- <br /><input class='limited_stock_checkbox' id='add_form_quantity_limited' type='checkbox' value='yes' <?php if ( is_numeric( $product_data['meta']['_wpsc_stock'] ) ) echo 'checked="checked"'; else echo ''; ?> name='meta[_wpsc_limited_stock]' />
328
- <label for='add_form_quantity_limited' class='small'><?php esc_html_e( 'Product has limited stock', 'wp-e-commerce' ); ?></label>
329
- <?php
330
- if ( $post->ID > 0 ) {
331
- if ( is_numeric( $product_data['meta']['_wpsc_stock'] ) ) {?>
332
- <div class='edit_stock' style='display: block;'> <?php
333
- } else { ?>
334
- <div class='edit_stock' style='display: none;'><?php
335
- } ?>
336
- <?php if ( wpsc_product_has_children( $post->ID ) ) : ?>
337
- <?php $stock = wpsc_variations_stock_remaining( $post->ID ); ?>
338
- <p><?php echo sprintf( __( 'This product has variations. To edit the quantity, please use the <a href="%s">Variation Controls</a> below.' , 'wp-e-commerce' ), '#wpsc_product_variation_forms' ); ?></p>
339
- <p><?php printf( _n( "%s variant item in stock.", "%s variant items in stock.", $stock, 'wp-e-commerce' ), $stock ); ?></p>
340
- <?php else: ?>
341
- <div style="margin-bottom:20px;">
342
- <label for="stock_limit_quantity"><?php esc_html_e( 'Quantity in stock', 'wp-e-commerce' ); ?></label>
343
- <input type='number' min="0" step="1" style="width:80px; margin-left:50px;"
344
- id="stock_limit_quantity" name='meta[_wpsc_stock]'
345
- size='3' value='<?php echo absint( $product_data['meta']['_wpsc_stock'] ); ?>'
346
- class='stock_limit_quantity' />
347
- </div>
348
-
349
- <?php
350
- $remaining_quantity = wpsc_get_remaining_quantity( $post->ID );
351
- $reserved_quantity = $product_data['meta']['_wpsc_stock'] - $remaining_quantity;
352
- if ( $reserved_quantity ) {
353
- echo '<p><em>';
354
- printf( _n('%s of them is reserved for pending or recently completed orders.',
355
- '%s of them are reserved for pending or recently completed orders.',
356
- $reserved_quantity, 'wp-e-commerce'), $reserved_quantity );
357
-
358
- echo '</em></p>';
359
- }
360
- ?>
361
- <?php endif; ?>
362
- <hr>
363
- <p><?php esc_html_e( 'Notify site owner via email when stock reduces to :', 'wp-e-commerce' ); ?>
364
- <input type='number' min="0" step="1" style="width:70px; margin-left:10px;"
365
- id="stock_limit_notify" name='meta[_wpsc_product_metadata][stock_limit_notify]'
366
- size='3' value='<?php echo absint( $product_meta['stock_limit_notify'] ); ?>'
367
- class='stock_limit_notify' />
368
- </p>
369
- <hr>
370
- <p><?php esc_html_e( 'When stock reduces to zero:', 'wp-e-commerce' ); ?>
371
- <div class='unpublish_when_none_left'>
372
- <input type='checkbox' id="unpublish_when_oos"
373
- name='meta[_wpsc_product_metadata][unpublish_when_none_left]'
374
- class='unpublish_when_oos'<?php checked( $product_meta['unpublish_when_none_left'] ); ?> />
375
- <label for="unpublish_when_oos"><?php esc_html_e( 'Unpublish product from website', 'wp-e-commerce' ); ?></label>
376
-
377
- </div>
378
- </div> <?php
379
- } else { ?>
380
- <div style='display: none;' class='edit_stock'>
381
- <?php esc_html_e( 'Stock Qty', 'wp-e-commerce' ); ?><input type='text' name='meta[_wpsc_stock]' value='0' size='10' />
382
- <div style='font-size:9px; padding:5px;'>
383
- <input type='checkbox' class='unpublish_when_oos' name='meta[_wpsc_product_metadata][unpublish_when_none_left]' /> <?php esc_html_e( 'Set status to Unpublished if this Product runs out of stock', 'wp-e-commerce' ); ?>
384
- </div>
385
- </div>
386
- <?php
387
- }
388
-
389
- wp_nonce_field( 'update', 'wpsc_product_stock_nonce' );
390
-
391
- }
392
-
393
- function wpsc_product_taxes_forms() {
394
- global $post, $wpdb, $wpsc_product_defaults;
395
- $product_data = get_post_custom( $post->ID );
396
-
397
- $product_data['meta'] = $product_meta = array();
398
- if ( !empty( $product_data['_wpsc_product_metadata'] ) )
399
- $product_data['meta'] = $product_meta = maybe_unserialize( $product_data['_wpsc_product_metadata'][0] );
400
-
401
- if ( !isset( $product_data['meta']['_wpsc_custom_tax'] ) )
402
- $product_data['meta']['_wpsc_custom_tax'] = '';
403
- $custom_tax = $product_data['meta']['_wpsc_custom_tax'];
404
-
405
-
406
- if ( !isset( $product_meta['custom_tax'] ) ) {
407
- $product_meta['custom_tax'] = 0.00;
408
- }
409
-
410
- //Add New WPEC-Taxes Bands Here
411
- $wpec_taxes_controller = new wpec_taxes_controller();
412
-
413
- //display tax bands
414
- $band_select_settings = array(
415
- 'id' => 'wpec_taxes_band',
416
- 'name' => 'meta[_wpsc_product_metadata][wpec_taxes_band]',
417
- 'label' => __( 'Custom Tax Band', 'wp-e-commerce' )
418
- );
419
- $wpec_taxes_band = '';
420
- if ( isset( $product_meta['wpec_taxes_band'] ) ) {
421
- $band = $wpec_taxes_controller->wpec_taxes->wpec_taxes_get_band_from_index( $product_meta['wpec_taxes_band'] );
422
- $wpec_taxes_band = array( 'index'=>$band['index'], 'name'=>$band['name'] );
423
- }
424
-
425
- $taxable_checkbox_settings = array(
426
- 'type' => 'checkbox',
427
- 'id' => 'wpec_taxes_taxable',
428
- 'name' => 'meta[_wpsc_product_metadata][wpec_taxes_taxable]',
429
- 'label' => __( 'Product is exempt from taxation.', 'wp-e-commerce' )
430
- );
431
-
432
- if ( isset( $product_meta['wpec_taxes_taxable'] ) && 'on' == $product_meta['wpec_taxes_taxable'] ) {
433
- $taxable_checkbox_settings['checked'] = 'checked';
434
- }
435
-
436
- //add taxable amount only for exclusive tax
437
- if ( !$wpec_taxes_controller->wpec_taxes_isincluded() ) {
438
- $taxable_amount_input_settings = array(
439
- 'id' => 'wpec_taxes_taxable_amount',
440
- 'name' => 'meta[_wpsc_product_metadata][wpec_taxes_taxable_amount]',
441
- 'label' => __( 'Taxable Amount', 'wp-e-commerce' ),
442
- 'description' => __( 'Taxable amount in your currency, not percentage of price.', 'wp-e-commerce' ),
443
- );
444
-
445
- if ( isset( $product_meta['wpec_taxes_taxable_amount'] ) ) {
446
- $taxable_amount_input_settings['value'] = $product_meta['wpec_taxes_taxable_amount'];
447
-
448
- if ( ! empty( $product_meta['wpec_taxes_taxable_amount'] ) )
449
- $taxable_amount_input_settings['value'] = wpsc_format_number(
450
- $taxable_amount_input_settings['value']
451
- );
452
- }
453
- }// if
454
-
455
- $output = '<a name="wpsc_tax"></a>';
456
- $output .= '<p>'.$wpec_taxes_controller->wpec_taxes_build_input( $taxable_checkbox_settings ).'</p>';
457
- $output .= '<p>'.$wpec_taxes_controller->wpec_taxes_display_tax_bands( $band_select_settings, $wpec_taxes_band ).'</p>';
458
- $output .= '<p>';
459
- $output .= ( !$wpec_taxes_controller->wpec_taxes_isincluded() ) ? $wpec_taxes_controller->wpec_taxes_build_input( $taxable_amount_input_settings ) : '';
460
- $output .= '</p>';
461
-
462
- if ( ! $wpec_taxes_controller->wpec_taxes->wpec_taxes_get_enabled() ) {
463
- $output = '<p>' . sprintf( __( 'Taxes are not enabled. See <a href="%s">Settings &gt; Taxes</a>', 'wp-e-commerce' ), admin_url( 'options-general.php?page=wpsc-settings&tab=taxes' ) ) . '</p>';
464
- }
465
-
466
- echo $output;
467
-
468
- wp_nonce_field( 'update', 'wpsc_product_tax_nonce' );
469
-
470
- }
471
-
472
- function wpsc_product_variation_forms() {
473
- ?>
474
- <iframe src="<?php echo _wpsc_get_product_variation_form_url(); ?>"></iframe>
475
- <?php
476
- }
477
-
478
- function _wpsc_get_product_variation_form_url( $id = false ) {
479
- if ( ! $id ) {
480
- $id = get_the_ID();
481
- }
482
-
483
- return admin_url( 'admin-ajax.php?action=wpsc_product_variations_table&product_id=' . $id . '&_wpnonce=' . wp_create_nonce( 'wpsc_product_variations_table' ) );
484
- }
485
-
486
- function wpsc_product_shipping_forms_metabox() {
487
- wpsc_product_shipping_forms();
488
- }
489
-
490
- /**
491
- * Dimension Units
492
- *
493
- * @since 3.8.13
494
- *
495
- * @return array List of valid dimension units.
496
- */
497
- function wpsc_dimension_units() {
498
- return array(
499
- 'in' => __( 'inches', 'wp-e-commerce' ),
500
- 'cm' => __( 'cm', 'wp-e-commerce' ),
501
- 'meter' => __( 'meters', 'wp-e-commerce' )
502
- );
503
- }
504
-
505
- /**
506
- * Weight Units
507
- *
508
- * @since 3.8.13
509
- *
510
- * @return array List of valid weight units.
511
- */
512
- function wpsc_weight_units() {
513
- return array(
514
- 'pound' => __( 'pounds', 'wp-e-commerce' ),
515
- 'ounce' => __( 'ounces', 'wp-e-commerce' ),
516
- 'gram' => __( 'grams', 'wp-e-commerce' ),
517
- 'kilogram' => __( 'kilograms', 'wp-e-commerce' )
518
- );
519
- }
520
-
521
- /**
522
- * Weight Unit Display
523
- *
524
- * Returns a weight unit abbreviation for display.
525
- *
526
- * @since 3.8.13
527
- *
528
- * @param string $unit Weight unit.
529
- * @return string Weight unit string.
530
- */
531
- function wpsc_weight_unit_display( $unit ) {
532
- switch ( $unit ) {
533
- case 'pound' :
534
- return __( ' lbs.', 'wp-e-commerce' );
535
- case 'ounce' :
536
- return __( ' oz.', 'wp-e-commerce' );
537
- case 'gram' :
538
- return __( ' g', 'wp-e-commerce' );
539
- case 'kilograms' :
540
- case 'kilogram' :
541
- return __( ' kgs.', 'wp-e-commerce' );
542
- }
543
- return '';
544
- }
545
-
546
- /**
547
- * Validate Dimension Unit
548
- *
549
- * Returns a valid dimensions unit.
550
- * If the unit is not set or invalid it will be filtered using 'wpsc_default_dimension_unit'
551
- * so that an alternative default unit can be set.
552
- *
553
- * @since 3.8.13
554
- *
555
- * @param string $unit Dimension unit.
556
- * @return string Dimension unit string.
557
- *
558
- * @uses wpsc_default_dimension_unit
559
- */
560
- function wpsc_validate_dimension_unit( $unit = '' ) {
561
-
562
- $default_unit = apply_filters( 'wpsc_default_dimension_unit', $unit );
563
-
564
- if ( empty( $unit ) && array_key_exists( $default_unit, wpsc_dimension_units() ) ) {
565
- $unit = $default_unit;
566
- }
567
-
568
- return $unit;
569
- }
570
-
571
- /**
572
- * Validate Weight Unit
573
- *
574
- * Returns a valid weight unit.
575
- * If the unit is not set or invalid it will be filtered using 'wpsc_default_weight_unit'
576
- * so that an alternative default unit can be set.
577
- *
578
- * @since 3.8.13
579
- *
580
- * @param string $unit Weight unit.
581
- * @return string Weight unit string.
582
- *
583
- * @uses wpsc_default_weight_unit
584
- */
585
- function wpsc_validate_weight_unit( $unit = '' ) {
586
-
587
- $default_unit = apply_filters( 'wpsc_default_weight_unit', $unit );
588
-
589
- if ( empty( $unit ) && array_key_exists( $default_unit, wpsc_weight_units() ) ) {
590
- $unit = $default_unit;
591
- }
592
-
593
- return $unit;
594
- }
595
-
596
- /**
597
- * Product Shipping Forms
598
- *
599
- * @uses wpsc_validate_weight_unit()
600
- * @uses wpsc_validate_dimension_unit()
601
- */
602
- function wpsc_product_shipping_forms( $product = false, $field_name_prefix = 'meta[_wpsc_product_metadata]', $bulk = false ) {
603
- if ( ! $product )
604
- $product_id = get_the_ID();
605
- else
606
- $product_id = $product->ID;
607
-
608
- $meta = get_post_meta( $product_id, '_wpsc_product_metadata', true );
609
- if ( ! is_array( $meta ) )
610
- $meta = array();
611
-
612
- $defaults = array(
613
- 'weight' => '',
614
- 'weight_unit' => wpsc_validate_weight_unit(),
615
- 'demension_unit' => wpsc_validate_dimension_unit(),
616
- 'dimensions' => array(),
617
- 'shipping' => array(),
618
- 'no_shipping' => '',
619
- 'display_weight_as' => '',
620
- );
621
- $dimensions_defaults = array(
622
- 'height' => 0,
623
- 'width' => 0,
624
- 'length' => 0,
625
- );
626
- $shipping_defaults = array(
627
- 'local' => '',
628
- 'international' => '',
629
- );
630
- $meta = array_merge( $defaults, $meta );
631
- $meta['dimensions'] = array_merge( $dimensions_defaults, $meta['dimensions'] );
632
- $meta['shipping'] = array_merge( $shipping_defaults, $meta['shipping'] );
633
-
634
- extract( $meta, EXTR_SKIP );
635
-
636
- foreach ( $shipping as $key => &$val ) {
637
- $val = wpsc_format_number( $val );
638
- }
639
-
640
- $weight = wpsc_convert_weight( $weight, 'pound', $weight_unit );
641
-
642
- $dimension_units = wpsc_dimension_units();
643
- $weight_units = wpsc_weight_units();
644
-
645
- // Why we need this????
646
- $measurements = $dimensions;
647
- $measurements['weight'] = $weight;
648
- $measurements['weight_unit'] = $weight_unit;
649
- // End why
650
-
651
- ?>
652
- <div class="wpsc-stock-editor<?php if ( $bulk ) echo ' wpsc-bulk-edit' ?>">
653
- <p class="wpsc-form-field">
654
- <input type="checkbox" id="wpsc-product-no-shipping" name="<?php echo esc_attr( $field_name_prefix ); ?>[no_shipping]" value="1" <?php checked( $no_shipping && ! $bulk ); ?>>
655
- <label for="wpsc-product-no-shipping"><?php _e( 'Product will <em>not</em> be shipped to customer', 'wp-e-commerce' ); ?></label>
656
- </p>
657
-
658
- <div class="wpsc-product-shipping-section wpsc-product-shipping-weight-dimensions">
659
- <p><strong><?php esc_html_e( 'Calculate Shipping Costs based on measurements', 'wp-e-commerce' ); ?></strong></p>
660
-
661
- <!-- WEIGHT INPUT -->
662
- <p class="wpsc-form-field">
663
- <?php if ( $bulk ) : ?>
664
- <input class="wpsc-bulk-edit-fields" type="checkbox" name="wpsc_bulk_edit[fields][measurements][weight]" value="1" />
665
- <?php endif; ?>
666
- <label for="wpsc-product-shipping-weight"><?php echo esc_html_e( 'Weight', 'wp-e-commerce' ); ?></label>
667
- <span class="wpsc-product-shipping-input">
668
- <input type="text" id="wpsc-product-shipping-weight" name="<?php echo esc_attr( $field_name_prefix ); ?>[weight]" value="<?php if ( ! $bulk ) echo esc_attr( wpsc_format_number( $weight ) ); ?>" />
669
- <select id="wpsc-product-shipping-weight-unit" name="<?php echo $field_name_prefix; ?>[weight_unit]">
670
- <?php foreach ( $weight_units as $unit => $unit_label ): ?>
671
- <option value="<?php echo esc_attr( $unit ); ?>" <?php if ( ! $bulk ) selected( $unit, $measurements['weight_unit'] ); ?>><?php echo esc_html( $unit_label ); ?></option>
672
- <?php endforeach; ?>
673
- </select>
674
- </span>
675
- </p>
676
- <!-- END WEIGHT INPUT -->
677
-
678
- <!-- DIMENSIONS INPUT -->
679
- <p class="wpsc-form-field">
680
- <?php if ( $bulk ) : ?>
681
- <input class="wpsc-bulk-edit-fields" type="checkbox" name="wpsc_bulk_edit[fields][measurements][dimensions]" value="1" />
682
- <?php endif; ?>
683
- <label for="wpsc-product-shipping-weight"><?php echo esc_html_e( 'Dimensions', 'wp-e-commerce' ); ?></label>
684
- <span class="wpsc-product-shipping-input">
685
- <input placeholder="L" type="text" id="wpsc-product-shipping-length" name="<?php echo esc_attr( $field_name_prefix ); ?>[dimensions][length]" value="<?php if ( !$bulk && $dimensions['length']>0 ) echo esc_attr( wpsc_format_number( $dimensions['length'] ) ); ?>" />&nbsp;&times;&nbsp;
686
- <input placeholder="W" type="text" id="wpsc-product-shipping-width" name="<?php echo esc_attr( $field_name_prefix ); ?>[dimensions][width]" value="<?php if ( !$bulk && $dimensions['width']>0 ) echo esc_attr( wpsc_format_number( $dimensions['width'] ) ); ?>" />&nbsp;&times;&nbsp;
687
- <input placeholder="H" type="text" id="wpsc-product-shipping-height" name="<?php echo esc_attr( $field_name_prefix ); ?>[dimensions][height]" value="<?php if ( !$bulk && $dimensions['height']>0 ) echo esc_attr( wpsc_format_number( $dimensions['height'] ) ); ?>" />
688
- <select id="wpsc-product-shipping-dimensions-unit" name="<?php echo $field_name_prefix; ?>[dimension_unit]">
689
- <?php foreach ( $dimension_units as $unit => $unit_label ): ?>
690
- <option value="<?php echo esc_attr( $unit ); ?>" <?php if ( ! $bulk && isset( $meta['dimension_unit'] ) ) selected( $unit, $meta['dimension_unit'] ); // Dirty code ?>><?php echo esc_html( $unit_label ); ?></option>
691
- <?php endforeach; ?>
692
- </select>
693
- </span>
694
- </p>
695
- <!-- END DEMENSION INPUT -->
696
-
697
- </div>
698
-
699
- <?php
700
- $currency_type = get_option( 'currency_type' );
701
- $country = new WPSC_Country( $currency_type );
702
-
703
- $ct_symb = $country->get_currency_symbol_html();
704
- ?>
705
-
706
- <div class="wpsc-product-shipping-section wpsc-product-shipping-flat-rate">
707
- <p><strong><?php esc_html_e( 'Flat Rate Settings', 'wp-e-commerce' ); ?></strong></p>
708
- <p class="wpsc-form-field">
709
- <?php if ( $bulk ): ?>
710
- <input class="wpsc-bulk-edit-fields" type="checkbox" name="wpsc_bulk_edit[fields][shipping][local]" value="1" />
711
- <?php endif; ?>
712
- <label for="wpsc-product-shipping-flatrate-local"><?php esc_html_e( 'Local Shipping Fee', 'wp-e-commerce' ); ?></label>
713
- <span>
714
- <?php echo esc_html( $ct_symb ); ?>
715
- <input type="text" id="wpsc-product-shipping-flatrate-local" name="<?php echo esc_html( $field_name_prefix ); ?>[shipping][local]" value="<?php if ( ! $bulk ) echo $shipping['local']; ?>" />
716
- </span>
717
- </p>
718
- <p class="wpsc-form-field">
719
- <?php if ( $bulk ): ?>
720
- <input class="wpsc-bulk-edit-fields" type="checkbox" name="wpsc_bulk_edit[fields][shipping][international]" value="1" />
721
- <?php endif; ?>
722
- <label for="wpsc-product-shipping-flatrate-international"><?php esc_html_e( 'International Shipping Fee', 'wp-e-commerce' ); ?></label>
723
- <span>
724
- <?php echo esc_html( $ct_symb ); ?>
725
- <input type="text" id="wpsc-product-shipping-flatrate-international" name="<?php echo esc_html( $field_name_prefix ); ?>[shipping][international]" value="<?php if ( ! $bulk ) echo $shipping['international']; ?>" />
726
- </span>
727
- </p>
728
- </div>
729
- </div>
730
- <?php
731
-
732
- wp_nonce_field( 'update', 'wpsc_product_shipping_nonce' );
733
-
734
- }
735
-
736
- /**
737
- * Product Custom Metadata Form
738
- *
739
- * @global $post Instance of WP_Post.
740
- * @global $wpdb Instance of wpdb.
741
- */
742
- function wpsc_product_advanced_forms() {
743
-
744
- global $post, $wpdb;
745
-
746
- $delete_nonce = _wpsc_create_ajax_nonce( 'remove_product_meta' );
747
-
748
- $custom_fields = $wpdb->get_results( "
749
- SELECT
750
- `meta_id`, `meta_key`, `meta_value`
751
- FROM
752
- `{$wpdb->postmeta}`
753
- WHERE
754
- `post_id` = {$post->ID}
755
- AND
756
- `meta_key` NOT LIKE '\_%'
757
- ORDER BY
758
- LOWER(meta_key)", ARRAY_A
759
- );
760
-
761
- $output = '<table id="wpsc_product_meta_table" class="wp-list-table widefat posts">';
762
- $output .= '<thead>';
763
- $output .= '<tr>';
764
- $output .= '<th id="wpsc_custom_meta_name_th">' . _x( 'Name', 'Product meta UI', 'wp-e-commerce' ) . '</th>';
765
- $output .= '<th id="wpsc_custom_meta_value_th">' . _x( 'Value', 'Product meta UI', 'wp-e-commerce' ) . '</th>';
766
- $output .= '<th id="wpsc_custom_meta_action_th">' . _x( 'Action', 'Product meta UI', 'wp-e-commerce' ) . '</th>';
767
- $output .= '</tr>';
768
- $output .= '</thead>';
769
- $output .= '<tfoot>';
770
- $output .= '<tr>';
771
- $output .= '<th>' . _x( 'Name', 'Product meta UI', 'wp-e-commerce' ) . '</th>';
772
- $output .= '<th>' . _x( 'Value', 'Product meta UI', 'wp-e-commerce' ) . '</th>';
773
- $output .= '<th>' . _x( 'Action', 'Product meta UI', 'wp-e-commerce' ) . '</th>';
774
- $output .= '</tr>';
775
- $output .= '</tfood>';
776
-
777
- $output .= '<tbody>';
778
-
779
- if ( empty( $custom_fields ) ) {
780
- $output .= '<tr class="no-meta"><td colspan="3"><p>' . sprintf( __( 'You have no custom metadata. You can set any arbitrary meta you like and access it programatically via the <a href="">Post Meta API</a>.', 'wp-e-commerce' ), esc_url( 'https://codex.wordpress.org/Function_Reference/get_post_meta' ) ) . '</p></td></tr>';
781
- } else {
782
- // Display all available metadata
783
- $alternate = false;
784
- foreach ( (array) $custom_fields as $custom_field ) {
785
- $i = $custom_field['meta_id'];
786
- $alternate = ! $alternate;
787
-
788
- $output .= '<tr'. ($alternate ? ' class="alternate"' : '') .'>';
789
- $output .= '<td><input type="text" value="'.esc_attr( $custom_field['meta_key'] ).'" name="custom_meta['.$i.'][name]" id="custom_meta_name_'.$i.'"></input></td>';
790
- $output .= '<td><input type="text" value="'.esc_attr( $custom_field['meta_value'] ).'" name="custom_meta['.$i.'][value]" id="custom_meta_value_'.$i.'"></input></td>';
791
- $output .= '<td><a href="#" data-nonce="'.esc_attr( $delete_nonce ).'" class="wpsc_remove_meta" onclick="wpsc_remove_custom_meta(this,'.$i.')">'.esc_html( 'Delete', 'wp-e-commerce' ).'</a></td>';
792
- $output .= '</tr>';
793
- }
794
- }
795
-
796
- // Template for new metadata input
797
- $output .= '<tr id="wpsc_new_meta_template">';
798
- $output .= '<td><input type="text" name="new_custom_meta[name][]" value=""></input></td>';
799
- $output .= '<td><input type="text" name="new_custom_meta[value][]" value=""></input></td>';
800
- $output .= '<td><a href="#" class="wpsc_remove_meta" onclick="wpsc_remove_empty_meta(this)">'.esc_html( 'Delete', 'wp-e-commerce' ).'</a></td>';
801
- $output .= '</tr>';
802
-
803
- $output .= '</tbody>';
804
- $output .= '</table>';
805
-
806
- $output .= '<a href="#" class="add_more_meta button button-small" id="wpsc_add_custom_meta">'.esc_html( '+ Add Custom Meta', 'wp-e-commerce' ).'</a>';
807
-
808
- echo $output;
809
-
810
- }
811
-
812
- /**
813
- * Display Product External Link Meta Box Form Fields.
814
- *
815
- * @global $post Instance of WP_Post.
816
- */
817
- function wpsc_product_external_link_forms() {
818
-
819
- global $post;
820
-
821
- // Get External Link Values
822
- $product_meta = get_post_meta( $post->ID, '_wpsc_product_metadata', true );
823
- $product_meta = wp_parse_args( $product_meta, array(
824
- 'external_link' => '',
825
- 'external_link_text' => '',
826
- ) );
827
-
828
- ?>
829
- <table class="form-table" style="width: 100%;" cellspacing="2" cellpadding="5">
830
- <tbody>
831
- <tr class="form-field">
832
- <th valign="top" scope="row"><label for="external_link"><?php esc_html_e( 'URL', 'wp-e-commerce' ); ?></label></th>
833
- <td><input type="text" name="meta[_wpsc_product_metadata][external_link]" id="external_link" value="<?php echo esc_url( $product_meta['external_link'] ); ?>" size="50" style="width: 95%" placeholder="http://" /></td>
834
- </tr>
835
- <tr class="form-field">
836
- <th valign="top" scope="row"><label for="external_link_text"><?php esc_html_e( 'Label', 'wp-e-commerce' ); ?></label></th>
837
- <td><input type="text" name="meta[_wpsc_product_metadata][external_link_text]" id="external_link_text" value="<?php echo esc_attr( $product_meta['external_link_text'] ); ?>" size="50" style="width: 95%" placeholder="<?php _e( 'Buy Now', 'wp-e-commerce' ); ?>" /></td>
838
- </tr>
839
- </tbody>
840
- </table>
841
- <em><?php esc_html_e( 'This option overrides the "Buy Now" and "Add to Cart" buttons, replacing them with the link you describe here.', 'wp-e-commerce' ); ?></em>
842
- <?php
843
-
844
- wp_nonce_field( 'update', 'wpsc_product_external_link_nonce' );
845
-
846
- }
847
-
848
- function wpsc_additional_desc() {
849
- ?>
850
- <textarea name='additional_description' id='additional_description' cols='40' rows='5' ><?php echo esc_textarea( get_post_field( 'post_excerpt', get_the_ID() ) ); ?></textarea>
851
- <em><?php _e( 'Short Descriptions are optional hand-crafted summaries of your content that can be used in your theme.', 'wp-e-commerce' ); ?></em>
852
- <?php
853
-
854
- }
855
-
856
- /**
857
- * We really need to either bake this functionality in for 3.9.0 or rip it out into Gold Cart or something else.
858
- * So not awesome to have this exposed and unusable.
859
- *
860
- * @param WP_Post $post Product
861
- * @return void
862
- */
863
- function wpsc_product_gallery( $post ) {
864
- // pull the old iframe source for non JS users
865
- $upload_iframe_src = esc_url( get_upload_iframe_src( 'image', $post->ID ) );
866
- // get our gallery image IDs if present
867
- $images = wpsc_get_admin_product_gallery( $post->ID );
868
- // begin HTML output
869
- $output = '<div id="wpsc_product_gallery">';
870
- $output .= '<ul>';
871
- // check for images before beginngin loop
872
- if ( $images ) {
873
- // now loop images
874
- foreach ( $images as $image_id ) {
875
- // get the thumbnail URL
876
- $thumb_url = wp_get_attachment_thumb_url( absint( $image_id ) );
877
- // output each item
878
- $output .= '<li><div class="list_gallery_image">';
879
- $output .= '<img src="' . esc_url( $thumb_url ) . '">';
880
- $output .= '<input type="hidden" name="wpsc-product-gallery-imgs[]" value="' . absint( $image_id ) . '">';
881
-
882
- $output .= '<span class="product_gallery_image_delete_button dashicons dashicons-no-alt"></span></div>';
883
- $output .= '<input type="hidden" class="product_gallery_image_id" value="'.$image_id.'">';
884
- $output .= '<input type="hidden" class="product_gallery_post_id" value="'.$post->ID.'">';
885
- $output .= '</li>';
886
- }
887
- }
888
- $output .= '</ul>';
889
- $output .= '<div class="clear"></div>';
890
- $output .= '</div>';
891
- $nonce_var = wp_create_nonce( 'wpsc_gallery_nonce' );
892
- ?>
893
- <input type="hidden" class="nonce_class" value="<?php echo $nonce_var; ?>">
894
- <?php
895
- // button for old iframe for non JS people
896
- $output .= '<p class="hide-if-no-js">';
897
- $output .= '<a class="button button-small thickbox" title="' . esc_attr__( 'Manage Product Image Gallery...', 'wp-e-commerce' ).'" href="' . $upload_iframe_src . '" id="wpsc-manage-product-gallery">';
898
- $output .= esc_html__( 'Manage Product Image Gallery...', 'wp-e-commerce' );
899
- $output .= '</a>';
900
- $output .= '</p>';
901
-
902
- // include a nonce for verification
903
- $output .= wp_nonce_field( 'wpsc_product_gallery_nonce', 'wpsc_product_gallery_nonce', false, false );
904
-
905
- // echo the gallery output
906
- echo $output;
907
- }
908
-
909
-
910
- function wpsc_product_download_forms() {
911
- global $post, $wpdb, $wpsc_product_defaults;
912
- $product_data = get_post_custom( $post->ID );
913
- $output = '';
914
- $product_data['meta'] = array();
915
-
916
- if ( !empty( $product_data['_wpsc_product_metadata'] ) )
917
- $product_data['meta'] = maybe_unserialize( $product_data['_wpsc_product_metadata'][0] );
918
-
919
- $upload_max = wpsc_get_max_upload_size();
920
- ?>
921
- <?php echo wpsc_select_product_file( $post->ID ); ?>
922
-
923
- <a href="admin.php?wpsc_admin_action=product_files_existing&amp;product_id=<?php echo absint( $post->ID ); ?>" class="thickbox button button-small" title="<?php echo esc_attr( sprintf( __( 'Select all downloadable files for %s', 'wp-e-commerce' ), $post->post_title ) ); ?>"><?php esc_html_e( 'Add existing files...', 'wp-e-commerce' ); ?></a>
924
-
925
- <div class="wpsc_fileUpload button button-small">
926
- <span><?php esc_html_e('Upload new file...','wp-e-commerce'); ?></span>
927
- <input type='file' name='file' class="button button-small" value='' onchange="wpsc_push_v2t(this, '#wpsc_fileupload_path')" />
928
- </div>
929
- <em id="wpsc_fileupload_path"></em>
930
-
931
- <?php
932
- if ( function_exists( "make_mp3_preview" ) || function_exists( "wpsc_media_player" ) ) {
933
- ?>
934
- <br />
935
- <h4><?php esc_html_e( 'Select an MP3 file to upload as a preview', 'wp-e-commerce' ) ?></h4>
936
- <input type='file' name='preview_file' value='' /><br />
937
-
938
- <h4><?php esc_html_e( 'Your preview for this product', 'wp-e-commerce' ) ?>:</h4>
939
-
940
- <?php
941
- $args = array(
942
- 'post_type' => 'wpsc-preview-file',
943
- 'post_parent' => $post->ID,
944
- 'numberposts' => -1,
945
- 'post_status' => 'all'
946
- );
947
-
948
- $preview_files = (array) get_posts( $args );
949
-
950
- foreach ( $preview_files as $preview ) {
951
- echo $preview->post_title . '<br />';
952
- }
953
-
954
- ?>
955
- <br />
956
- <?php
957
- }
958
-
959
- $output = apply_filters( 'wpsc_downloads_metabox', $output );
960
- }
961
-
962
- /**
963
- * Product Personalization Form
964
- *
965
- * @global $post Instance of WP_Post.
966
- */
967
- function wpsc_product_personalization_forms() {
968
-
969
- global $post;
970
-
971
- $product_meta = get_post_meta( $post->ID, '_wpsc_product_metadata', true );
972
- $product_meta = wp_parse_args( $product_meta, array(
973
- 'engraved' => 0,
974
- 'can_have_uploaded_image' => 0
975
- ) );
976
-
977
- ?>
978
- <ul id="wpsc_product_personalization_option">
979
- <li>
980
- <input type="checkbox" name="meta[_wpsc_product_metadata][engraved]" <?php checked( $product_meta['engraved'], '1' ); ?> id="add_engrave_text" />
981
- <label for="add_engrave_text"><?php esc_html_e( 'Users can personalize this product by leaving a message on single product page', 'wp-e-commerce' ); ?></label>
982
- </li>
983
- <li>
984
- <input type="checkbox" name="meta[_wpsc_product_metadata][can_have_uploaded_image]" <?php checked( $product_meta['can_have_uploaded_image'], '1' ); ?> id="can_have_uploaded_image" />
985
- <label for="can_have_uploaded_image"> <?php esc_html_e( 'Users can upload images on single product page to purchase logs.', 'wp-e-commerce' ); ?></label>
986
- </li>
987
- <?php do_action( 'wpsc_add_advanced_options', $post->ID ); ?>
988
- </ul>
989
- <em><?php _e( "Form fields for the customer to personalize this product will be shown on it's single product page.", 'wp-e-commerce' ); ?></em>
990
- <?php
991
-
992
- wp_nonce_field( 'update', 'wpsc_product_personalization_nonce' );
993
-
994
- }
995
-
996
- function wpsc_product_delivery_forms(){
997
- $has_variations = wpsc_product_has_variations( get_post()->ID );
998
-
999
- $show_if_variation = $has_variations ? 'display: block;' : 'display:none;';
1000
- ?>
1001
- <em id="wpsc_product_delivery_metabox_live_title" class="wpsc_metabox_live_title">
1002
- <p></p>
1003
- </em>
1004
-
1005
- <div id="wpsc_product_delivery_forms" class="categorydiv wpsc-categorydiv">
1006
- <ul id="wpsc_product_delivery_tabs" class="category-tabs">
1007
- <li class="tabs"><a href="#wpsc_product_delivery-shipping"><?php _e( 'Shipping', 'wp-e-commerce' ); ?></a></li>
1008
- <li><a href="#wpsc_product_delivery-download"><?php _e( 'Download', 'wp-e-commerce' ); ?></a></li>
1009
- <li><a href="#wpsc_product_delivery-external_link"><?php _e( 'External Link', 'wp-e-commerce' ); ?></a></li>
1010
- </ul>
1011
-
1012
- <div id="wpsc_product_delivery-shipping" class="tabs-panel" style="display:block;">
1013
- <?php
1014
- if ( ! $has_variations ) {
1015
- wpsc_product_shipping_forms();
1016
- } else {
1017
- echo '<p>' . sprintf( __( 'This product has variations. To edit the shipping, please use the <a href="%s">Variation Controls</a>.', 'wp-e-commerce' ), '#wpsc_product_variation_forms' ) . '</p>';
1018
- }
1019
- ?>
1020
- </div>
1021
-
1022
- <div id="wpsc_product_delivery-download" class="tabs-panel" style="display:none;">
1023
- <?php wpsc_product_download_forms(); ?>
1024
- </div>
1025
-
1026
- <div id="wpsc_product_delivery-external_link" class="tabs-panel" style="display: none;">
1027
- <?php wpsc_product_external_link_forms(); ?>
1028
- </div>
1029
- </div>
1030
- <?php
1031
- }
1032
-
1033
- function wpsc_product_details_forms(){
1034
- ?>
1035
- <em id="wpsc_product_details_metabox_live_title" class="wpsc_metabox_live_title">
1036
- <p></p>
1037
- </em>
1038
-
1039
- <div id="wpsc_product_details_forms" class="categorydiv wpsc-categorydiv">
1040
- <ul id="wpsc_product_details_tabs" class="category-tabs">
1041
- <li class="tabs"><a href="#wpsc_product_details-image"><?php _e( 'Image Gallery', 'wp-e-commerce' ); ?></a></li>
1042
- <li><a href="#wpsc_product_details-desc"><?php _e( 'Short Description', 'wp-e-commerce' ); ?></a></li>
1043
- <li><a href="#wpsc_product_details-personalization"><?php _e( 'Personalization', 'wp-e-commerce' ); ?></a></li>
1044
- <li><a href="#wpsc_product_details-meta"><?php _e( 'Metadata', 'wp-e-commerce' ); ?></a></li>
1045
- </ul>
1046
-
1047
- <div id="wpsc_product_details-image" class="tabs-panel" style="display: block;">
1048
- <?php wpsc_product_gallery( get_post() ); ?>
1049
- </div>
1050
-
1051
- <div id="wpsc_product_details-desc" class="tabs-panel" style="display: none;">
1052
- <?php wpsc_additional_desc(); ?>
1053
- </div>
1054
-
1055
- <div id="wpsc_product_details-personalization" class="tabs-panel" style="display: none;">
1056
- <?php wpsc_product_personalization_forms(); ?>
1057
- </div>
1058
-
1059
- <div id="wpsc_product_details-meta" class="tabs-panel" style="display: none;">
1060
- <?php wpsc_product_advanced_forms(); ?>
1061
- </div>
1062
- </div>
1063
- <?php
1064
- }
1065
-
1066
- function wpsc_form_multipart_encoding() {
1067
- echo ' enctype="multipart/form-data"';
1068
- }
1069
-
1070
- add_action( 'post_edit_form_tag', 'wpsc_form_multipart_encoding' );
1071
-
1072
- /*
1073
- * Modifications to Media Gallery
1074
- */
1075
-
1076
- add_filter( 'attachment_fields_to_edit', 'wpsc_attachment_fields', 11, 2 );
1077
- add_filter( 'attachment_fields_to_save', 'wpsc_save_attachment_fields', 9, 2 );
1078
- add_filter( 'gettext_with_context', 'wpsc_filter_gettex_with_context', 12, 4);
1079
-
1080
- /*
1081
- * This filter overrides string with context translations
1082
- *
1083
- * @param $translation The current translation
1084
- * @param $text The text being translated
1085
- * @param $context The domain for the translation
1086
- * @param $domain The domain for the translation
1087
- * @return string The translated / filtered text.
1088
- */
1089
- function wpsc_filter_gettex_with_context( $translation, $text, $context, $domain ) {
1090
-
1091
- if ( 'Taxonomy Parent' == $context && 'Parent' == $text && isset($_GET['taxonomy']) && 'wpsc-variation' == $_GET['taxonomy'] ) {
1092
- $translations = get_translations_for_domain( $domain );
1093
- return $translations->translate( 'Variation Set', 'wp-e-commerce' );
1094
- //this will never happen, this is here only for gettext to pick up the translation
1095
- return __( 'Variation Set', 'wp-e-commerce' );
1096
- }
1097
- return $translation;
1098
- }
1099
-
1100
- function wpsc_attachment_fields( $form_fields, $post ) {
1101
- $out = '';
1102
-
1103
- if( isset( $_REQUEST["post_id"] ) )
1104
- $parent_post = get_post( absint( $_REQUEST["post_id"] ) );
1105
- else
1106
- $parent_post = get_post( $post->post_parent );
1107
-
1108
- // check if post is set before accessing
1109
- if ( isset( $parent_post ) && $parent_post->post_type == "wpsc-product" ) {
1110
-
1111
- //Unfortunate hack, as I'm not sure why the From Computer tab doesn't process filters the same way the Gallery does
1112
- ob_start();
1113
- echo '
1114
- <script type="text/javascript">
1115
-
1116
- jQuery(function(){
1117
-
1118
- jQuery("a.wp-post-thumbnail").each(function(){
1119
- var product_image = jQuery(this).text();
1120
- if (product_image == "' . esc_js( __( 'Use as featured image', 'wp-e-commerce' ) ) . '") {
1121
- jQuery(this).text("' . esc_js( __('Use as Product Thumbnail', 'wp-e-commerce' ) ) . '");
1122
- }
1123
- });
1124
-
1125
- var trash = jQuery("#media-upload a.del-link").text();
1126
-
1127
- if (trash == "' . esc_js( __( 'Delete', 'wp-e-commerce' ) ) . '") {
1128
- jQuery("#media-upload a.del-link").text("' . esc_js( __( 'Trash', 'wp-e-commerce' ) ) . '");
1129
- }
1130
-
1131
-
1132
- });
1133
-
1134
- </script>';
1135
- $out .= ob_get_clean();
1136
-
1137
- $size_names = array( 'small-product-thumbnail' => __( 'Default Product Thumbnail Size', 'wp-e-commerce' ), 'medium-single-product' => __( 'Single Product Image Size', 'wp-e-commerce' ), 'full' => __( 'Full Size', 'wp-e-commerce' ) );
1138
-
1139
- $check = get_post_meta( $post->ID, '_wpsc_selected_image_size', true );
1140
- if ( !$check )
1141
- $check = 'medium-single-product';
1142
-
1143
- $current_size = image_get_intermediate_size( $post->ID, $check );
1144
- $settings_width = get_option( 'single_view_image_width' );
1145
- $settings_height = get_option( 'single_view_image_height' );
1146
-
1147
- // regenerate size metadata in case it's missing
1148
- if ( ! $check || ( $current_size['width'] != $settings_width && $current_size['height'] != $settings_height ) ) {
1149
- _wpsc_regenerate_thumbnail_size( $post->ID, $check );
1150
- }
1151
-
1152
- //This loop attaches the custom thumbnail/single image sizes to this page
1153
- foreach ( $size_names as $size => $name ) {
1154
- $downsize = image_downsize( $post->ID, $size );
1155
- // is this size selectable?
1156
- $enabled = ( $downsize[3] || 'full' == $size );
1157
- $css_id = "image-size-{$size}-{$post->ID}";
1158
- // if this size is the default but that's not available, don't select it
1159
-
1160
- $html = "<div class='image-size-item'><input type='radio' " . disabled( $enabled, false, false ) . "name='attachments[$post->ID][wpsc_image_size]' id='{$css_id}' value='{$size}' " . checked( $size, $check, false ) . " />";
1161
-
1162
- $html .= "<label for='{$css_id}'>$name</label>";
1163
- // only show the dimensions if that choice is available
1164
- if ( $enabled )
1165
- $html .= " <label for='{$css_id}' class='help'>" . sprintf( __( "(%d&nbsp;&times;&nbsp;%d)", 'wp-e-commerce' ), $downsize[1], $downsize[2] ). "</label>";
1166
-
1167
- $html .= '</div>';
1168
-
1169
- $out .= $html;
1170
- }
1171
-
1172
- unset( $form_fields['post_excerpt'], $form_fields['image_url'], $form_fields['post_content'], $form_fields['post_title'], $form_fields['url'], $form_fields['align'], $form_fields['image_alt']['helps'], $form_fields["image-size"] );
1173
- $form_fields['image_alt']['helps'] = __( 'Alt text for the product image, e.g. &#8220;Rockstar T-Shirt&#8221;', 'wp-e-commerce' );
1174
-
1175
- $form_fields["wpsc_image_size"] = array(
1176
- 'label' => __( 'Single Product Page Thumbnail:', 'wp-e-commerce' ),
1177
- 'input' => 'html',
1178
- 'html' => $out,
1179
- 'helps' => "<span style='text-align:left; clear:both; display:block; padding-top:3px;'>" . __( 'This is the Thumbnail size that will be displayed on the Single Product page. You can change the default sizes under your store settings', 'wp-e-commerce' ) . "</span>"
1180
- );
1181
-
1182
- //This is for the custom thumbnail size.
1183
-
1184
- $custom_thumb_size_w = get_post_meta( $post->ID, "_wpsc_custom_thumb_w", true );
1185
- $custom_thumb_size_h = get_post_meta( $post->ID, "_wpsc_custom_thumb_h", true );
1186
- $custom_thumb_html = "
1187
-
1188
- <input style='width:50px; text-align:center' type='text' name='attachments[{$post->ID}][wpsc_custom_thumb_w]' value='{$custom_thumb_size_w}' /> X <input style='width:50px; text-align:center' type='text' name='attachments[{$post->ID}][wpsc_custom_thumb_h]' value='{$custom_thumb_size_h}' />
1189
-
1190
- ";
1191
- $form_fields["wpsc_custom_thumb"] = array(
1192
- "label" => __( 'Products Page Thumbnail Size:', 'wp-e-commerce' ),
1193
- "input" => "html", // this is default if "input" is omitted
1194
- "helps" => "<span style='text-align:left; clear:both; display:block; padding-top:3px;'>" . __( 'Custom thumbnail size for this image on the main Product Page', 'wp-e-commerce') . "</span>",
1195
- "html" => $custom_thumb_html
1196
- );
1197
- }
1198
- return $form_fields;
1199
-
1200
- }
1201
- function wpsc_save_attachment_fields( $post, $attachment ) {
1202
-
1203
- if ( isset( $attachment['wpsc_custom_thumb_w'] ) ) {
1204
- update_post_meta( $post['ID'], '_wpsc_custom_thumb_w', $attachment['wpsc_custom_thumb_w'] );
1205
- }
1206
-
1207
- if ( isset( $attachment['wpsc_custom_thumb_h'] ) ) {
1208
- update_post_meta( $post['ID'], '_wpsc_custom_thumb_h', $attachment['wpsc_custom_thumb_h'] );
1209
- }
1210
-
1211
- if ( isset( $attachment['wpsc_image_size'] ) ) {
1212
- update_post_meta( $post['ID'], '_wpsc_selected_image_size', $attachment['wpsc_image_size'] );
1213
- }
1214
-
1215
- return $post;
1216
- }
1217
-
1218
- /**
1219
- * Save Product Quick Edit Box
1220
- *
1221
- * Saves input for the various meta in the quick edit boxes.
1222
- *
1223
- * @todo UI.
1224
- * @todo Data validation / sanitization / security.
1225
- * @todo AJAX should probably return weight unit.
1226
- *
1227
- * @return int $post_id Post ID.
1228
- */
1229
- function wpsc_save_quickedit_box( $post_id ) {
1230
-
1231
- global $doaction;
1232
-
1233
- // Only save product if saving (not autosaving) via AJAX.
1234
- if ( ( defined( 'DOING_AUTOSAVE' ) && DOING_AUTOSAVE ) || ! defined( 'DOING_AJAX' ) || ! DOING_AJAX || get_post_type( $post_id ) != 'wpsc-product' ) {
1235
- return;
1236
- }
1237
-
1238
- $bulk = isset( $doaction ) && $doaction == 'edit';
1239
-
1240
- // Map post field to meta key.
1241
- $custom_fields = array(
1242
- 'weight' => 'product_metadata',
1243
- 'stock' => 'stock',
1244
- 'price' => 'price',
1245
- 'sale_price' => 'special_price',
1246
- 'sku' => 'sku'
1247
- );
1248
-
1249
- // Get product variations (if any).
1250
- $children = get_children( array(
1251
- 'post_parent' => $post_id,
1252
- 'post_type' => 'wpsc-product',
1253
- 'post_status' => 'inherit'
1254
- ) );
1255
- $is_parent = (bool) $children;
1256
-
1257
- foreach ( $custom_fields as $post_key => $meta_key ) {
1258
-
1259
- // Don't update if field is not set or we're bulk updating and the field is left blank.
1260
- if ( ! isset( $_REQUEST[ $post_key ] ) || ( $bulk && empty( $_REQUEST[ $post_key ] ) ) ) {
1261
- continue;
1262
- }
1263
-
1264
- // Don't update if the product has variations and the field is one of the defined custom fields (unless overridden).
1265
- $override_variant = isset( $_REQUEST[ $post_key . '_variant' ] ) && $_REQUEST[ $post_key . '_variant' ] == 'on';
1266
- if ( $is_parent && ! $override_variant && in_array( $post_key, array_keys( $custom_fields ) ) ) {
1267
- continue;
1268
- }
1269
-
1270
- // Select single product or variation IDs.
1271
- if ( $is_parent && count( $children ) > 0 ) {
1272
- $products = wp_list_pluck( $children, 'ID' );
1273
- } else {
1274
- $products = array( $post_id );
1275
- }
1276
-
1277
- foreach ( $products as $post_id ) {
1278
- $value = $_REQUEST[ $post_key ];
1279
-
1280
- // Validate custom field values
1281
- switch ( $post_key ) {
1282
-
1283
- case 'weight':
1284
- $product_meta = get_post_meta( $post_id, '_wpsc_product_metadata', true );
1285
- if ( ! is_array( $product_meta ) ) {
1286
- $product_meta = array();
1287
- }
1288
-
1289
- // Draft products don't have product metadata set yet
1290
- $weight_unit = isset( $product_meta['weight_unit'] ) ? $product_meta['weight_unit'] : 'pound';
1291
- $weight = wpsc_convert_weight( $value, $weight_unit, 'pound', true );
1292
-
1293
- if ( isset( $product_meta['weight'] ) ) {
1294
- unset( $product_meta['weight'] );
1295
- }
1296
-
1297
- $product_meta['weight'] = $weight;
1298
-
1299
- $value = $product_meta;
1300
- break;
1301
-
1302
- case 'stock':
1303
- if ( ! is_numeric( $value ) ) {
1304
- $value = '';
1305
- }
1306
- break;
1307
-
1308
- case 'sku':
1309
- if ( $value == __( 'N/A', 'wp-e-commerce' ) ) {
1310
- $value = '';
1311
- } else {
1312
- $value = sanitize_text_field( $value );
1313
- }
1314
- break;
1315
- default :
1316
- $value = sanitize_text_field( $value );
1317
-
1318
- }
1319
-
1320
- update_post_meta( $post_id, "_wpsc_{$meta_key}", $value );
1321
- }
1322
- }
1323
-
1324
- return $post_id;
1325
-
1326
- }
1327
-
1328
- /**
1329
- * wpsc_quick_edit_boxes function
1330
- * Creates inputs for the various meta in the quick edit boxes.
1331
- *
1332
- * @todo UI
1333
- * @internal The post_id cannot be accessed here because this gets output at the very end
1334
- * of the editor form, and injected within relevant rows using javascript.
1335
- */
1336
-
1337
- function wpsc_quick_edit_boxes( $col_name, $_screen_post_type = null ) {
1338
- // Avoid outputting this on term edit screens.
1339
- // See http://core.trac.wordpress.org/ticket/16392#comment:9
1340
- if ( current_filter() == 'quick_edit_custom_box' && $_screen_post_type == 'edit-tags' )
1341
- return;
1342
- ?>
1343
-
1344
- <fieldset class="inline-edit-col-left wpsc-cols">
1345
- <div class="inline-edit-col">
1346
- <div class="inline-edit-group">
1347
- <?php
1348
- switch ( $col_name ) :
1349
- case 'SKU' :
1350
- ?>
1351
- <label style="max-width: 85%" class="alignleft">
1352
- <span class="checkbox-title wpsc-quick-edit"><?php esc_html_e( 'SKU:', 'wp-e-commerce' ); ?> </span>
1353
- <input type="text" name="sku" class="wpsc_ie_sku" />
1354
- <input type="checkbox" name="sku_variant"> <span><?php esc_html_e( 'Update Variants', 'wp-e-commerce');?></span>
1355
-
1356
- </label>
1357
- <?php
1358
- break;
1359
- case 'weight' :
1360
- ?>
1361
- <label style="max-width: 85%" class="alignleft">
1362
- <span class="checkbox-title wpsc-quick-edit"><?php esc_html_e( 'Weight:', 'wp-e-commerce' ); ?> </span>
1363
- <input type="text" name="weight" class="wpsc_ie_weight" />
1364
- <input type="checkbox" name="weight_variant"> <span><?php esc_html_e( 'Update Variants', 'wp-e-commerce');?></span>
1365
- </label>
1366
- <?php
1367
- break;
1368
- case 'stock' :
1369
- ?>
1370
- <label style="max-width: 85%" class="alignleft">
1371
- <span class="checkbox-title wpsc-quick-edit"><?php esc_html_e( 'Stock:', 'wp-e-commerce' ); ?> </span>
1372
- <input type="text" name="stock" class="wpsc_ie_stock" />
1373
- <input type="checkbox" name="stock_variant"> <span><?php esc_html_e( 'Update Variants', 'wp-e-commerce');?></span>
1374
- </label>
1375
- <?php
1376
- break;
1377
- case 'price' :
1378
- ?>
1379
- <label style="max-width: 85%" class="alignleft">
1380
- <span class="checkbox-title wpsc-quick-edit"><?php esc_html_e( 'Price:', 'wp-e-commerce' ); ?> </span>
1381
- <input type="text" name="price" class="wpsc_ie_price" />
1382
- <input type="checkbox" name="price_variant"> <span><?php esc_html_e( 'Update Variants', 'wp-e-commerce');?></span>
1383
- </label>
1384
- <?php
1385
- break;
1386
- case 'sale_price' :
1387
- ?>
1388
- <label style="max-width: 85%" class="alignleft">
1389
- <span class="checkbox-title wpsc-quick-edit"><?php esc_html_e( 'Sale Price:', 'wp-e-commerce' ); ?> </span>
1390
- <input type="text" name="sale_price" class="wpsc_ie_sale_price" />
1391
- <input type="checkbox" name="sale_price_variant"> <span><?php esc_html_e( 'Update Variants', 'wp-e-commerce');?></span>
1392
- </label>
1393
- <?php
1394
- break;
1395
- endswitch;
1396
- ?>
1397
- </div>
1398
- </div>
1399
- </fieldset>
1400
- <?php
1401
- }
1402
-
1403
- add_action( 'quick_edit_custom_box', 'wpsc_quick_edit_boxes', 10, 2 );
1404
- add_action( 'bulk_edit_custom_box', 'wpsc_quick_edit_boxes', 10, 2 );
1405
- add_action( 'save_post', 'wpsc_save_quickedit_box' );
1406
-
1407
- /**
1408
- * If it doesn't exist, let's create a multi-dimensional associative array
1409
- * that will contain all of the term/price associations
1410
- *
1411
- * @param <type> $variation
1412
- */
1413
- function variation_price_field( $variation ) {
1414
- $term_prices = get_option( 'term_prices' );
1415
-
1416
- if ( is_object( $variation ) )
1417
- $term_id = $variation->term_id;
1418
-
1419
- if ( empty( $term_prices ) || !is_array( $term_prices ) ) {
1420
-
1421
- $term_prices = array( );
1422
- if ( isset( $term_id ) ) {
1423
- $term_prices[$term_id] = array( );
1424
- $term_prices[$term_id]["price"] = '';
1425
- $term_prices[$term_id]["checked"] = '';
1426
- }
1427
- add_option( 'term_prices', $term_prices );
1428
- }
1429
-
1430
- if ( isset( $term_id ) && is_array( $term_prices ) && array_key_exists( $term_id, $term_prices ) )
1431
- $price = esc_attr( $term_prices[$term_id]["price"] );
1432
- else
1433
- $price = '';
1434
-
1435
- if( !isset( $_GET['action'] ) ) {
1436
- ?>
1437
- <div class="form-field">
1438
- <label for="variation_price"><?php esc_html_e( 'Variation Price', 'wp-e-commerce' ); ?></label>
1439
- <input type="text" name="variation_price" id="variation_price" style="width:50px;" value="<?php echo $price; ?>"><br />
1440
- <span class="description"><?php esc_html_e( 'You can list a default price here for this variation. You can list a regular price (18.99), differential price (+1.99 / -2) or even a percentage-based price (+50% / -25%).', 'wp-e-commerce' ); ?></span>
1441
- </div>
1442
- <script type="text/javascript">
1443
- jQuery('#parent option:contains("   ")').remove();
1444
- jQuery('#parent').mousedown(function(){
1445
- jQuery('#parent option:contains("   ")').remove();
1446
- });
1447
- </script>
1448
- <?php
1449
- } else{
1450
- ?>
1451
- <tr class="form-field">
1452
- <th scope="row" valign="top">
1453
- <label for="variation_price"><?php esc_html_e( 'Variation Price', 'wp-e-commerce' ); ?></label>
1454
- </th>
1455
- <td>
1456
- <input type="text" name="variation_price" id="variation_price" style="width:50px;" value="<?php echo $price; ?>"><br />
1457
- <span class="description"><?php esc_html_e( 'You can list a default price here for this variation. You can list a regular price (18.99), differential price (+1.99 / -2) or even a percentage-based price (+50% / -25%).', 'wp-e-commerce' ); ?></span>
1458
- </td>
1459
- </tr>
1460
- <?php
1461
- }
1462
- }
1463
- add_action( 'wpsc-variation_edit_form_fields', 'variation_price_field' );
1464
- add_action( 'wpsc-variation_add_form_fields', 'variation_price_field' );
1465
-
1466
- /*
1467
- WordPress doesnt let you change the custom post type taxonomy form very easily
1468
- Use Jquery to move the set variation (parent) field to the top and add a description
1469
- */
1470
- function variation_set_field(){
1471
- ?>
1472
- <script>
1473
- /* change the text on the variation set from (none) to new variation set*/
1474
- jQuery("#parent option[value='-1']").text("New Variation Set");
1475
- /* Move to the top of the form and add a description */
1476
- jQuery("#tag-name").parent().before( jQuery("#parent").parent().append('<p>Choose the Variation Set you want to add variants to. If your\'e creating a new variation set then select "New Variation Set"</p>') );
1477
- /*
1478
- create a small description about variations below the add variation / set title
1479
- we can then get rid of the big red danger warning
1480
- */
1481
- ( jQuery("div#ajax-response").after('<p>Variations allow you to create options for your products, for example if you\'re selling T-Shirts they will have a size option you can create this as a variation. Size will be the Variation Set name, and it will be a "New Variant Set". You will then create variants (small, medium, large) which will have the "Variation Set" of Size. Once you have made your set you can use the table on the right to manage them (edit, delete). You will be able to order your variants by draging and droping them within their Variation Set.</p>') );
1482
- </script>
1483
- <?php
1484
- }
1485
- add_action( 'wpsc-variation_edit_form_fields', 'variation_set_field' );
1486
- add_action( 'wpsc-variation_add_form_fields', 'variation_set_field' );
1487
-
1488
-
1489
- function category_edit_form(){
1490
- ?>
1491
- <script type="text/javascript">
1492
-
1493
- </script>
1494
- <?php
1495
- }
1496
-
1497
- function variation_price_field_check( $variation ) {
1498
-
1499
- $term_prices = get_option( 'term_prices' );
1500
-
1501
- if ( is_array( $term_prices ) && array_key_exists( $variation->term_id, $term_prices ) )
1502
- $checked = ($term_prices[$variation->term_id]["checked"] == 'checked') ? 'checked' : '';
1503
- else
1504
- $checked = ''; ?>
1505
-
1506
- <tr class="form-field">
1507
- <th scope="row" valign="top"><label for="apply_to_current"><?php esc_html_e( 'Apply to current variations?', 'wp-e-commerce' ) ?></label></th>
1508
- <td>
1509
- <span class="description"><input type="checkbox" name="apply_to_current" id="apply_to_current" <?php echo $checked; ?> /><?php _e( 'By checking this box, the price rule you implement above will be applied to all variations that currently exist. If you leave it unchecked, it will only apply to products that use this variation created or edited from now on. Take note, this will apply this rule to <strong>every</strong> product using this variation. If you need to override it for any reason on a specific product, simply go to that product and change the price.', 'wp-e-commerce' ); ?></span>
1510
- </td>
1511
- </tr>
1512
- <?php
1513
- }
1514
- add_action( 'wpsc-variation_edit_form_fields', 'variation_price_field_check' );
1515
-
1516
-
1517
-
1518
- /**
1519
- * @todo - Should probably refactor this at some point - very procedural,
1520
- * WAY too many foreach loops for my liking :) But it does the trick
1521
- *
1522
- * @param <type> $term_id
1523
- */
1524
- function save_term_prices( $term_id ) {
1525
- // First - Saves options from input
1526
- if ( isset( $_POST['variation_price'] ) || isset( $_POST["apply_to_current"] ) ) {
1527
-
1528
- $term_prices = get_option( 'term_prices' );
1529
-
1530
- $term_prices[$term_id]["price"] = sanitize_text_field( $_POST["variation_price"] );
1531
- $term_prices[$term_id]["checked"] = (isset( $_POST["apply_to_current"] )) ? "checked" : "unchecked";
1532
-
1533
- update_option( 'term_prices', $term_prices );
1534
- }
1535
-
1536
- // Second - If box was checked, let's then check whether or not it was flat, differential, or percentile, then let's apply the pricing to every product appropriately
1537
- if ( isset( $_POST["apply_to_current"] ) ) {
1538
-
1539
- //Now, find all products with this term_id, update their pricing structure (terms returned include only parents at this point, we'll grab relevent children soon)
1540
- $products_to_mod = get_objects_in_term( $term_id, "wpsc-variation" );
1541
- $product_parents = array( );
1542
-
1543
- foreach ( (array)$products_to_mod as $get_parent ) {
1544
-
1545
- $post = get_post( $get_parent );
1546
-
1547
- if ( !$post->post_parent )
1548
- $product_parents[] = $post->ID;
1549
- }
1550
-
1551
- //Now that we have all parent IDs with this term, we can get the children (only the ones that are also in $products_to_mod, we don't want to apply pricing to ALL kids)
1552
-
1553
- foreach ( $product_parents as $parent ) {
1554
- $args = array(
1555
- 'post_parent' => $parent,
1556
- 'post_type' => 'wpsc-product'
1557
- );
1558
- $children = get_children( $args, ARRAY_A );
1559
-
1560
- foreach ( $children as $childrens ) {
1561
- $parent = $childrens["post_parent"];
1562
- $children_ids[$parent][] = $childrens["ID"];
1563
- $children_ids[$parent] = array_intersect( $children_ids[$parent], $products_to_mod );
1564
- }
1565
- }
1566
-
1567
- //Got the right kids, let's grab their parent pricing and modify their pricing based on var_price_type
1568
-
1569
- foreach ( (array)$children_ids as $parents => $kids ) {
1570
-
1571
- $kids = array_values( $kids );
1572
-
1573
- foreach ( $kids as $kiddos ) {
1574
- $price = wpsc_determine_variation_price( $kiddos );
1575
- update_product_meta( $kiddos, 'price', $price );
1576
- }
1577
- }
1578
- }
1579
- }
1580
- add_action( 'edited_wpsc-variation', 'save_term_prices' );
1581
- add_action( 'created_wpsc-variation', 'save_term_prices' );
1582
-
1583
- function wpsc_delete_variations( $postid ) {
1584
- $post = get_post( $postid );
1585
- if ( $post->post_type != 'wpsc-product' || $post->post_parent != 0 )
1586
- return;
1587
- $variations = get_posts( array(
1588
- 'post_type' => 'wpsc-product',
1589
- 'post_parent' => $postid,
1590
- 'post_status' => 'any',
1591
- 'numberposts' => -1,
1592
- ) );
1593
-
1594
- if ( ! empty( $variations ) )
1595
- foreach ( $variations as $variation ) {
1596
- wp_delete_post( $variation->ID, true );
1597
- }
1598
- }
1599
- add_action( 'before_delete_post', 'wpsc_delete_variations' );
1600
-
1601
-
1602
- /**
1603
- * fetch the items for display inside the admin product gallery
1604
- * differs from the original `wpsc_get_product_gallery` in that
1605
- * it only checks the postmeta for an actual gallery generated by
1606
- * the user instead of pulling all attachments
1607
- *
1608
- * @since 3.8.14.2
1609
- *
1610
- * @param integer $product_id the product ID of the product
1611
- * @return array $gallery the attachment IDs of the gallery if present
1612
- */
1613
- function wpsc_get_admin_product_gallery( $product_id = 0 ) {
1614
-
1615
- // grab our meta from the DB
1616
- $gallery = get_post_meta( $product_id, '_wpsc_product_gallery', true );
1617
-
1618
- // no custom gallery was created, so return nothing
1619
- if ( ! $gallery ) {
1620
- return;
1621
- }
1622
-
1623
- // now make sure the IDs present are actual attachments
1624
- // by looping and unsetting them
1625
- //
1626
- // may want to add a MIME type check here, but not sure
1627
- // if that would cause issues if people use non-images
1628
- // in their galleries
1629
- foreach( $gallery as $key => $image_id ) {
1630
- if ( get_post_type( $image_id ) !== 'attachment' ) {
1631
- unset( $gallery[ $key ] );
1632
- }
1633
- }
1634
-
1635
- // somehow everything in the gallery
1636
- // was not an attachment, so bail
1637
- if ( empty( $gallery ) ) {
1638
- return;
1639
- }
1640
-
1641
- // send it back
1642
- return $gallery;
1643
-
1644
- }
1645
-
1646
- /**
1647
- * save our gallery IDs on post save
1648
- *
1649
- * @since 3.8.14.2
1650
- * @param integer $product_id the post ID being passed
1651
- * @return void
1652
- */
1653
- function wpsc_new_gallery_save( $product_id = 0 ) {
1654
-
1655
- // do our nonce check. ALWAYS A NONCE CHECK
1656
- if ( ! isset( $_POST['wpsc_product_gallery_nonce'] ) || ! wp_verify_nonce( $_POST['wpsc_product_gallery_nonce'], 'wpsc_product_gallery_nonce' ) ) {
1657
- return $product_id;
1658
- }
1659
-
1660
- // set an empty array for the image IDs
1661
- $image_ids = array();
1662
-
1663
- // ok. we have image IDs to work with. do some filtering
1664
- if ( ! empty( $_POST['wpsc-product-gallery-imgs'] ) ) {
1665
- // make sure our IDs are set to an array
1666
- $image_ids = (array) $_POST['wpsc-product-gallery-imgs'];
1667
- // ensure nothing non-numeric got added in
1668
- $image_ids = wp_parse_id_list( $image_ids );
1669
- // filter out any empty items
1670
- $image_ids = array_filter( $image_ids );
1671
- }
1672
-
1673
- // now if we have image IDs left after filtering, save them
1674
- // if not, delete the meta key
1675
- if ( ! empty( $image_ids ) ) {
1676
- update_post_meta( $product_id, '_wpsc_product_gallery', $image_ids );
1677
- } else {
1678
- delete_post_meta( $product_id, '_wpsc_product_gallery' );
1679
- }
1680
-
1681
- // add an action for after the gallery being saved
1682
- // passing the post ID and the image IDs
1683
- do_action( 'wpsc_after_gallery_save', $product_id, $image_ids );
1684
-
1685
- }
1686
-
1687
- add_action( 'wpsc_edit_product', 'wpsc_new_gallery_save' );
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
trunk/wpsc-admin/includes/duplicate-product-class.php DELETED
@@ -1,446 +0,0 @@
1
- <?php
2
-
3
- /**
4
- * Duplicate Product Class
5
- *
6
- * @package WP eCommerce
7
- * @subpackage Duplicate Product Class
8
- * @since 3.11.0
9
- */
10
-
11
- /**
12
- * WPSC Duplicate Product Class
13
- *
14
- * Used to duplicate products.
15
- *
16
- * @since 3.11.0
17
- */
18
- class WPSC_Duplicate_Product {
19
-
20
- private $post_id = null;
21
- private $new_post_id = null;
22
- private $new_parent_id = false;
23
-
24
- /**
25
- * Create new duplicate product
26
- *
27
- * @since 3.11.0
28
- *
29
- * @param int $post_id Post ID.
30
- * @param int|false $new_parent_id Optional. New post parent ID.
31
- * @param int|null $new_post_id Optional. New post ID if copying to exisiting post.
32
- */
33
- public function __construct( $post_id, $new_parent_id = false, $new_post_id = null ) {
34
-
35
- $this->post_id = absint( $post_id );
36
- $this->new_parent_id = is_numeric( $new_parent_id ) ? absint( $new_parent_id ) : false;
37
- $this->new_post_id = is_numeric( $new_post_id ) ? absint( $new_post_id ) : null;
38
- }
39
-
40
- /**
41
- * Duplicates a product
42
- *
43
- * @since 3.11.0
44
- *
45
- * @uses wp_insert_post() Inserts a new post to the database.
46
- *
47
- * @return int|WP_Error New post ID or error.
48
- */
49
- public function duplicate_product_process() {
50
-
51
- $post = get_post( $this->get_post_id() );
52
-
53
- // If no new post ID yet, duplicate the product post
54
- if ( ! $this->get_new_post_id() ) {
55
-
56
- $new_parent_id = $this->get_new_parent_id( $post->post_parent );
57
-
58
- $new_post_date = $post->post_date;
59
- $new_post_date_gmt = get_gmt_from_date( $new_post_date );
60
-
61
- $new_post_type = $post->post_type;
62
- $post_content = $post->post_content;
63
- $post_content_filtered = $post->post_content_filtered;
64
- $post_excerpt = $post->post_excerpt;
65
- $post_title = sprintf( __( '%s (Duplicate)', 'wp-e-commerce' ), $post->post_title );
66
- $post_name = $post->post_name;
67
- $comment_status = $post->comment_status;
68
- $ping_status = $post->ping_status;
69
-
70
- $defaults = array(
71
- 'post_status' => $post->post_status,
72
- 'post_type' => $new_post_type,
73
- 'ping_status' => $ping_status,
74
- 'post_parent' => $new_parent_id,
75
- 'menu_order' => $post->menu_order,
76
- 'to_ping' => $post->to_ping,
77
- 'pinged' => $post->pinged,
78
- 'post_excerpt' => $post_excerpt,
79
- 'post_title' => $post_title,
80
- 'post_content' => $post_content,
81
- 'post_content_filtered' => $post_content_filtered,
82
- 'post_mime_type' => $post->post_mime_type,
83
- 'import_id' => 0
84
- );
85
-
86
- if ( 'attachment' == $post->post_type ) {
87
- $defaults['guid'] = $post->guid;
88
- }
89
-
90
- $defaults = stripslashes_deep( $defaults );
91
-
92
- // Insert the new template in the post table
93
- $this->new_post_id = wp_insert_post( $defaults );
94
-
95
- }
96
-
97
- // Copy the taxonomies
98
- $this->duplicate_taxonomies();
99
-
100
- // Copy the meta information
101
- $this->duplicate_product_meta();
102
-
103
- do_action( 'wpsc_duplicate_product', $post, $this->get_new_post_id() );
104
-
105
- // Finds children (which includes product files AND product images), their meta values, and duplicates them.
106
- $duplicated_children = $this->duplicate_children();
107
-
108
- // Update product gallery meta (resetting duplicated meta value IDs)
109
- $this->update_duplicate_product_gallery_meta( $duplicated_children );
110
-
111
- // Copy product thumbnail (resetting duplicated meta value)
112
- $this->duplicate_product_thumbnail();
113
-
114
- return $this->get_new_post_id();
115
- }
116
-
117
- /**
118
- * Copy the taxonomies of a post to another post
119
- *
120
- * @since 3.11.0
121
- *
122
- * @uses get_object_taxonomies() Gets taxonomies for the given object.
123
- * @uses wpsc_get_product_terms() Gets terms for the product taxonomies.
124
- * @uses wp_set_object_terms() Sets the terms for a post object.
125
- */
126
- public function duplicate_taxonomies() {
127
-
128
- $new_post_id = $this->get_new_post_id();
129
-
130
- if ( $new_post_id ) {
131
-
132
- $id = $this->get_post_id();
133
- $post_type = get_post_type( $id );
134
- $taxonomies = get_object_taxonomies( $post_type );
135
-
136
- foreach ( $taxonomies as $taxonomy ) {
137
- $post_terms = wpsc_get_product_terms( $id, $taxonomy );
138
- foreach ( $post_terms as $post_term ) {
139
- wp_set_object_terms( $new_post_id, $post_term->slug, $taxonomy, true );
140
- }
141
- }
142
- }
143
- }
144
-
145
- /**
146
- * Copy the meta information of a post to another post
147
- *
148
- * @since 3.11.0
149
- *
150
- * @uses $wpdb WordPress database object for queries.
151
- * @uses get_results() Gets generic multirow results from the database.
152
- * @uses prepare() Prepares a database query making it safe.
153
- * @uses query() Runs an SQL query.
154
- */
155
- public function duplicate_product_meta() {
156
-
157
- global $wpdb;
158
-
159
- $new_post_id = $this->get_new_post_id();
160
-
161
- if ( $new_post_id ) {
162
-
163
- $post_meta_infos = $wpdb->get_results( $wpdb->prepare( "SELECT meta_key, meta_value FROM $wpdb->postmeta WHERE post_id = %d", $this->get_post_id() ) );
164
-
165
- if ( count( $post_meta_infos ) ) {
166
-
167
- $sql_query = "INSERT INTO $wpdb->postmeta (post_id, meta_key, meta_value) VALUES ";
168
- $values = array();
169
- $sql_query_sel = array();
170
-
171
- foreach ( $post_meta_infos as $meta_info ) {
172
- $meta_key = $meta_info->meta_key;
173
- $meta_value = addslashes( $meta_info->meta_value );
174
-
175
- $sql_query_sel[] = "( $new_post_id, '$meta_key', '$meta_value' )";
176
- $values[] = $new_post_id;
177
- $values[] = $meta_key;
178
- $values[] = $meta_value;
179
- $values += array( $new_post_id, $meta_key, $meta_value );
180
- }
181
-
182
- $sql_query .= implode( ",", $sql_query_sel );
183
- $wpdb->query( $sql_query );
184
- clean_post_cache( $new_post_id );
185
- }
186
- }
187
- }
188
-
189
- /**
190
- * Update Duplicate Product Gallery Meta
191
- *
192
- * When a product is duplicated its meta values are copied, too
193
- * including the gallery meta array of IDs.
194
- *
195
- * After the product's children (including attachments) have been
196
- * duplicated this function is used to update the gallery meta to
197
- * refer to the IDs of any duplicated media.
198
- *
199
- * @since 3.11.0
200
- *
201
- * @param array $duplicated_children Associative array mapping original child IDs to duplicated child IDs.
202
- */
203
- private function update_duplicate_product_gallery_meta( $duplicated_children ) {
204
-
205
- $new_post_id = $this->get_new_post_id();
206
-
207
- if ( $new_post_id ) {
208
-
209
- $gallery = get_post_meta( $new_post_id, '_wpsc_product_gallery', true );
210
- $new_gallery = array();
211
-
212
- // Loop through duplicated gallery IDs.
213
- if ( is_array( $gallery ) ) {
214
- foreach ( $gallery as $gallery_id ) {
215
-
216
- // If product image should be duplicated
217
- if ( apply_filters( 'wpsc_duplicate_product_attachment', true, $gallery_id, $new_post_id ) ) {
218
-
219
- // Update attached image IDs and copy non-attached image IDs
220
- if ( array_key_exists( $gallery_id, $duplicated_children ) ) {
221
- $new_gallery[] = $duplicated_children[ $gallery_id ];
222
- } else {
223
- $new_gallery[] = $gallery_id;
224
- }
225
- }
226
- }
227
-
228
- update_post_meta( $new_post_id, '_wpsc_product_gallery', $new_gallery );
229
- }
230
- }
231
- }
232
-
233
- /**
234
- * Duplicate Featured Image
235
- *
236
- * When a product is duplicated, the featured image ID is copied when the post
237
- * meta is duplicated.
238
- *
239
- * When the featured image is attached to the duplicated product, if the image
240
- * is duplicated the featured image ID is updated to the duplicated image ID
241
- * otherwise the featured image ID is removed.
242
- *
243
- * If the featured image is not attached to the product the featured image ID
244
- * remains the same as the original product.
245
- *
246
- * This function will remove the featured image if the image is not attached to
247
- * the duplicated product and offers the opportunity to change the featured image
248
- * of the duplicated product via the 'wpsc_duplicate_product_thumbnail' filter.
249
- *
250
- * @since 3.11.0
251
- */
252
- private function duplicate_product_thumbnail() {
253
-
254
- $new_post_id = $this->get_new_post_id();
255
-
256
- if ( $new_post_id ) {
257
-
258
- $thumbnail_id = $original_thumbnail_id = has_post_thumbnail( $new_post_id ) ? get_post_thumbnail_id( $new_post_id ) : 0;
259
-
260
- // If not duplicating product attachments, ensure featured image ID is zero
261
- if ( ! apply_filters( 'wpsc_duplicate_product_attachment', true, $thumbnail_id, $new_post_id ) ) {
262
- $thumbnail_id = 0;
263
- }
264
-
265
- // Filter featured product image ID
266
- $thumbnail_id = absint( apply_filters( 'wpsc_duplicate_product_thumbnail', $thumbnail_id, $original_thumbnail_id, $this->get_post_id(), $new_post_id ) );
267
-
268
- if ( $thumbnail_id > 0 ) {
269
- set_post_thumbnail( $new_post_id, $thumbnail_id );
270
- } else {
271
- delete_post_thumbnail( $new_post_id );
272
- }
273
- }
274
- }
275
-
276
- /**
277
- * Duplicates product children and meta
278
- *
279
- * @since 3.11.0
280
- *
281
- * @uses get_posts() Gets an array of posts given array of arguments.
282
- *
283
- * @return array Array mapping old child IDs to duplicated child IDs.
284
- */
285
- private function duplicate_children() {
286
-
287
- $new_parent_id = $this->get_new_post_id();
288
-
289
- // Map duplicate child IDs
290
- $converted_child_ids = array();
291
-
292
- if ( $new_parent_id ) {
293
-
294
- // Get children products and duplicate them
295
- $child_posts = get_posts( array(
296
- 'post_parent' => $this->get_post_id(),
297
- 'post_type' => 'any',
298
- 'post_status' => 'any',
299
- 'numberposts' => -1,
300
- 'order' => 'ASC'
301
- ) );
302
-
303
- // Duplicate product images and child posts
304
- foreach ( $child_posts as $child_post ) {
305
-
306
- $duplicate_child = new WPSC_Duplicate_Product( $child_post->ID, $new_parent_id );
307
-
308
- // Duplicate image or post
309
- if ( 'attachment' == get_post_type( $child_post ) ) {
310
- $new_child_id = $duplicate_child->duplicate_product_image_process();
311
- } else {
312
- $new_child_id = $duplicate_child->duplicate_product_process();
313
- }
314
-
315
- // Map child ID to new child ID
316
- if ( $new_child_id && ! is_wp_error( $new_child_id ) ) {
317
- $converted_child_ids[ $child_post->ID ] = $new_child_id;
318
- }
319
-
320
- do_action( 'wpsc_duplicate_product_child', $child_post, $new_parent_id, $new_child_id );
321
- }
322
- }
323
-
324
- return $converted_child_ids;
325
- }
326
-
327
- /**
328
- * Duplicates a product image.
329
- *
330
- * Uses a portion of code from media_sideload_image() in `wp-admin/includes/media.php`
331
- * to check file before downloading from URL.
332
- *
333
- * @since 3.11.0
334
- *
335
- * @uses get_post_type() Gets post type.
336
- * @uses wp_get_attachment_url() Gets attachment URL.
337
- * @uses download_url() Download file from URl to temp location.
338
- * @uses is_wp_error() Is WP error?
339
- * @uses media_handle_sideload() Handle creation of new attachment and attach to post.
340
- *
341
- * @return int|bool Attachment ID or false.
342
- */
343
- public function duplicate_product_image_process() {
344
-
345
- $child_post = get_post( $this->get_post_id() );
346
- $new_parent_id = $this->get_new_parent_id( $child_post->post_parent );
347
-
348
- if ( 'attachment' == get_post_type( $child_post ) && apply_filters( 'wpsc_duplicate_product_attachment', true, $child_post->ID, $new_parent_id ) ) {
349
-
350
- $file = wp_get_attachment_url( $child_post->ID );
351
-
352
- if ( ! empty( $file ) ) {
353
-
354
- // Set variables for storage, fix file filename for query strings.
355
- preg_match( '/[^\?]+\.(jpe?g|jpe|gif|png)\b/i', $file, $matches );
356
- $file_array = array();
357
- $file_array['name'] = basename( $matches[0] );
358
-
359
- // Download file to temp location.
360
- $file_array['tmp_name'] = download_url( $file );
361
-
362
- // If error storing temporarily, return the error.
363
- if ( is_wp_error( $file_array['tmp_name'] ) ) {
364
- return $file_array['tmp_name'];
365
- }
366
-
367
- // Do the validation and storage stuff.
368
- $new_post_id = media_handle_sideload( $file_array, $new_parent_id );
369
-
370
- // If error storing permanently, unlink.
371
- if ( is_wp_error( $new_post_id ) ) {
372
- @ unlink( $file_array['tmp_name'] );
373
- }
374
-
375
- // Re-attribute featured image
376
- if ( has_post_thumbnail( $new_parent_id ) && $child_post->ID == get_post_thumbnail_id( $new_parent_id ) ) {
377
- set_post_thumbnail( $new_parent_id, $new_post_id );
378
- }
379
-
380
- // Copy attachment data
381
- $post_data = array(
382
- 'ID' => $new_post_id,
383
- 'post_content' => $child_post->post_content,
384
- 'post_title' => $child_post->post_title,
385
- 'post_excerpt' => $child_post->post_excerpt,
386
- 'post_status' => $child_post->post_status,
387
- 'comment_status' => $child_post->comment_status,
388
- 'ping_status' => $child_post->ping_status,
389
- 'post_password' => $child_post->post_password,
390
- 'post_content_filtered' => $child_post->post_content_filtered,
391
- 'menu_order' => $child_post->menu_order
392
- );
393
-
394
- wp_update_post( $post_data );
395
-
396
- // Copy alt text
397
- update_post_meta( $new_post_id, '_wp_attachment_image_alt', get_post_meta( $child_post->ID, '_wp_attachment_image_alt', true ) );
398
-
399
- return $new_post_id;
400
- }
401
-
402
- } elseif ( has_post_thumbnail( $new_parent_id ) && $child_post->ID == get_post_thumbnail_id( $new_parent_id ) ) {
403
-
404
- delete_post_meta( $new_parent_id, '_thumbnail_id' );
405
- }
406
-
407
- return false;
408
- }
409
-
410
- /**
411
- * Get Post ID
412
- *
413
- * @since 3.11.0
414
- *
415
- * @return int Post ID.
416
- */
417
- public function get_post_id() {
418
-
419
- return $this->post_id;
420
- }
421
-
422
- /**
423
- * Get New Post ID
424
- *
425
- * @since 3.11.0
426
- *
427
- * @return int Post ID.
428
- */
429
- public function get_new_post_id() {
430
-
431
- return $this->new_post_id;
432
- }
433
-
434
- /**
435
- * Get New Parent ID
436
- *
437
- * @since 3.11.0
438
- *
439
- * @param int $default Default parent ID.
440
- * @return int Post ID.
441
- */
442
- public function get_new_parent_id( $default = 0 ) {
443
-
444
- return false === $this->new_parent_id ? $default : $this->new_parent_id;
445
- }
446
- }
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
trunk/wpsc-admin/includes/product-functions.php DELETED
@@ -1,1231 +0,0 @@
1
- <?php
2
- /**
3
- * WPSC Product modifying functions
4
- *
5
- * @package wp-e-commerce
6
- * @since 3.7
7
- */
8
-
9
- function wpsc_get_max_upload_size(){
10
- return size_format( wp_max_upload_size() );
11
- }
12
-
13
- /**
14
- * wpsc_admin_submit_product function
15
- * @internal Was going to completely refactor sanitise forms and wpsc_insert_product, but they are also used by the import system
16
- * which I'm not really familiar with...so I'm not touching them :) Erring on the side of redundancy and caution I'll just
17
- * refactor this to do the job.
18
- * @return nothing
19
- */
20
- function wpsc_admin_submit_product( $post_ID, $post ) {
21
-
22
- if ( ( defined( 'DOING_AUTOSAVE' ) && DOING_AUTOSAVE ) || $post->post_type != 'wpsc-product' ) {
23
- return;
24
- }
25
-
26
- //Type-casting ( not so much sanitization, which would be good to do )
27
- $post_data = stripslashes_deep( $_POST );
28
- $product_id = $post_ID;
29
-
30
- $post_data['additional_description'] = isset( $post_data['additional_description'] ) ? $post_data['additional_description'] : '';
31
-
32
- if ( ! isset( $post_data['meta'] ) && isset( $_POST['meta'] ) ) {
33
- $post_data['meta'] = (array) $_POST['meta'];
34
- }
35
-
36
- if ( isset( $post_data['meta']['_wpsc_price'] ) )
37
- $post_data['meta']['_wpsc_price'] = wpsc_string_to_float( $post_data['meta']['_wpsc_price'] );
38
-
39
- if ( isset( $post_data['meta']['_wpsc_special_price'] ) )
40
- $post_data['meta']['_wpsc_special_price'] = wpsc_string_to_float( $post_data['meta']['_wpsc_special_price'] );
41
-
42
- if ( isset( $post_data['meta']['_wpsc_sku'] ) && $post_data['meta']['_wpsc_sku'] == __('N/A', 'wp-e-commerce') ) {
43
- $post_data['meta']['_wpsc_sku'] = '';
44
- }
45
-
46
- // Update donation setting
47
- if ( isset( $post_data['wpsc_product_pricing_nonce'] ) && wp_verify_nonce( $post_data['wpsc_product_pricing_nonce'], 'update' ) ) {
48
- $post_data['meta']['_wpsc_is_donation'] = isset( $post_data['meta']['_wpsc_is_donation'] ) ? 1 : 0;
49
- }
50
-
51
- if ( ! isset( $post_data['meta']['_wpsc_limited_stock'] ) ){
52
- $post_data['meta']['_wpsc_stock'] = false;
53
- } else {
54
- $post_data['meta']['_wpsc_stock'] = isset( $post_data['meta']['_wpsc_stock'] ) ? (int) $post_data['meta']['_wpsc_stock'] : 0;
55
- }
56
-
57
- // Update low stock notifications
58
- if ( isset( $post_data['meta']['_wpsc_stock'] ) && isset( $post_data['meta']['_wpsc_product_metadata'] ) && ( $post_data['meta']['_wpsc_stock'] > $post_data['meta']['_wpsc_product_metadata']['stock_limit_notify'] ) ) {
59
- // Check if notification has been sent
60
- $notify_sent = get_product_meta( $product_id, 'stock_limit_notify_sent', true );
61
- if( ! empty( $notify_sent ) ) {
62
- delete_product_meta( $product_id, 'stock_limit_notify_sent' );
63
- }
64
- }
65
-
66
- unset($post_data['meta']['_wpsc_limited_stock']);
67
- if(!isset($post_data['quantity_limited'])) $post_data['quantity_limited'] = '';
68
- if(!isset($post_data['special'])) $post_data['special'] = '';
69
-
70
- $post_data['meta']['_wpsc_product_metadata']['quantity_limited'] = (int)(bool)$post_data['quantity_limited'];
71
- $post_data['meta']['_wpsc_product_metadata']['special'] = (int)(bool)$post_data['special'];
72
-
73
- // Update Stock Options
74
- if ( isset( $_POST['wpsc_product_stock_nonce'] ) && wp_verify_nonce( $_POST['wpsc_product_stock_nonce'], 'update' ) ) {
75
-
76
- $post_data['meta']['_wpsc_product_metadata'] = wp_parse_args( $post_data['meta']['_wpsc_product_metadata'], array(
77
- 'unpublish_when_none_left' => 0
78
- ) );
79
- $post_data['meta']['_wpsc_product_metadata']['unpublish_when_none_left'] = absint( (bool) $post_data['meta']['_wpsc_product_metadata']['unpublish_when_none_left'] );
80
-
81
- }
82
-
83
- // Update shipping setting
84
- if ( isset( $_POST['wpsc_product_shipping_nonce'] ) && wp_verify_nonce( $_POST['wpsc_product_shipping_nonce'], 'update' ) ) {
85
-
86
- $post_data['meta']['_wpsc_product_metadata'] = wp_parse_args( $post_data['meta']['_wpsc_product_metadata'], array(
87
- 'no_shipping' => 0
88
- ) );
89
- $post_data['meta']['_wpsc_product_metadata']['no_shipping'] = absint( (bool) $post_data['meta']['_wpsc_product_metadata']['no_shipping'] );
90
-
91
- }
92
-
93
- // Product Weight
94
- if(!isset($post_data['meta']['_wpsc_product_metadata']['display_weight_as'])) $post_data['meta']['_wpsc_product_metadata']['display_weight_as'] = '';
95
-
96
- if ( isset( $post_data['meta']['_wpsc_product_metadata']['weight'] ) ) {
97
- $weight = wpsc_string_to_float( $post_data['meta']['_wpsc_product_metadata']['weight'] );
98
- $weight = wpsc_convert_weight( $weight, $post_data['meta']['_wpsc_product_metadata']['weight_unit'], "pound", true);
99
- $post_data['meta']['_wpsc_product_metadata']['weight'] = $weight;
100
- $post_data['meta']['_wpsc_product_metadata']['display_weight_as'] = $post_data['meta']['_wpsc_product_metadata']['weight_unit'];
101
- }
102
-
103
- if ( isset( $post_data['meta']['_wpsc_product_metadata']['dimensions'] ) ) {
104
- $dimensions =& $post_data['meta']['_wpsc_product_metadata']['dimensions'];
105
- foreach ( $dimensions as $key => $value ) {
106
- if ( ! in_array( $key, array( 'height', 'width', 'length' ) ) )
107
- continue;
108
-
109
- $dimensions[$key] = wpsc_string_to_float( $value );
110
- }
111
- }
112
-
113
- // Update the table rate prices (quantity discounts)
114
- if ( isset( $post_data['wpsc-update-quantity-discounts'] ) && wp_verify_nonce( $post_data['wpsc-update-quantity-discounts'], 'update-options' ) ) {
115
- $post_data['meta']['_wpsc_product_metadata']['table_rate_price'] = isset( $post_data['table_rate_price'] ) ? $post_data['table_rate_price'] : array();
116
-
117
- // If table_rate_price is empty, set empty table rate price arrays
118
- if ( empty( $post_data['meta']['_wpsc_product_metadata']['table_rate_price'] ) ) {
119
- $post_data['meta']['_wpsc_product_metadata']['table_rate_price']['table_price'] = array();
120
- $post_data['meta']['_wpsc_product_metadata']['table_rate_price']['quantity'] = array();
121
- }
122
-
123
- // Remove any rates with no quantity or price
124
- if ( ! empty( $post_data['meta']['_wpsc_product_metadata']['table_rate_price']['table_price'] ) ) {
125
- foreach ( (array) $post_data['meta']['_wpsc_product_metadata']['table_rate_price']['quantity'] as $key => $value ) {
126
- if ( empty( $value ) ) {
127
- unset( $post_data['meta']['_wpsc_product_metadata']['table_rate_price']['table_price'][ $key ] );
128
- unset( $post_data['meta']['_wpsc_product_metadata']['table_rate_price']['quantity'][ $key ] );
129
- }
130
- }
131
- foreach ( (array) $post_data['meta']['_wpsc_product_metadata']['table_rate_price']['table_price'] as $key => $value ) {
132
- if ( empty( $value ) ) {
133
- unset( $post_data['meta']['_wpsc_product_metadata']['table_rate_price']['table_price'][ $key ] );
134
- unset( $post_data['meta']['_wpsc_product_metadata']['table_rate_price']['quantity'][ $key ] );
135
- }
136
- }
137
- }
138
- }
139
-
140
- if ( isset( $post_data['meta']['_wpsc_product_metadata']['shipping'] ) ) {
141
- $post_data['meta']['_wpsc_product_metadata']['shipping']['local'] = wpsc_string_to_float( $post_data['meta']['_wpsc_product_metadata']['shipping']['local'] );
142
- $post_data['meta']['_wpsc_product_metadata']['shipping']['international'] = wpsc_string_to_float( $post_data['meta']['_wpsc_product_metadata']['shipping']['international'] );
143
- }
144
-
145
- // Update product taxes
146
- if ( isset( $_POST['wpsc_product_tax_nonce'] ) && wp_verify_nonce( $_POST['wpsc_product_tax_nonce'], 'update' ) ) {
147
-
148
- $post_data['meta']['_wpsc_product_metadata'] = wp_parse_args( $post_data['meta']['_wpsc_product_metadata'], array(
149
- 'wpec_taxes_taxable_amount' => '',
150
- 'wpec_taxes_taxable' => ''
151
- ) );
152
- if ( ! empty( $post_data['meta']['_wpsc_product_metadata']['wpec_taxes_taxable_amount'] ) ) {
153
- $post_data['meta']['_wpsc_product_metadata']['wpec_taxes_taxable_amount'] = wpsc_string_to_float($post_data['meta']['_wpsc_product_metadata']['wpec_taxes_taxable_amount'] );
154
- }
155
- $post_data['meta']['_wpsc_product_metadata']['wpec_taxes_taxable'] = $post_data['meta']['_wpsc_product_metadata']['wpec_taxes_taxable'];
156
-
157
- }
158
-
159
- // External Link Options
160
- if ( isset( $_POST['wpsc_product_external_link_nonce'] ) && wp_verify_nonce( $_POST['wpsc_product_external_link_nonce'], 'update' ) ) {
161
-
162
- // Parse post meta to ensure default values
163
- $post_data['meta']['_wpsc_product_metadata'] = wp_parse_args( $post_data['meta']['_wpsc_product_metadata'], array(
164
- 'external_link' => '',
165
- 'external_link_text' => '',
166
- ) );
167
-
168
- }
169
-
170
- // Advanced Options
171
- if ( isset( $_POST['wpsc_product_personalization_nonce'] ) && wp_verify_nonce( $_POST['wpsc_product_personalization_nonce'], 'update' ) ) {
172
-
173
- // Parse post meta to ensure default values (especially checkboxes)
174
- $post_data['meta']['_wpsc_product_metadata'] = wp_parse_args( $post_data['meta']['_wpsc_product_metadata'], array(
175
- 'engraved' => 0,
176
- 'can_have_uploaded_image' => 0
177
- ) );
178
-
179
- $post_data['meta']['_wpsc_product_metadata']['engraved'] = absint( (bool) $post_data['meta']['_wpsc_product_metadata']['engraved'] );
180
- $post_data['meta']['_wpsc_product_metadata']['can_have_uploaded_image'] = absint( (bool) $post_data['meta']['_wpsc_product_metadata']['can_have_uploaded_image'] );
181
-
182
- }
183
-
184
- if ( ! isset($post_data['meta']['_wpsc_product_metadata']['google_prohibited'])) $post_data['meta']['_wpsc_product_metadata']['google_prohibited'] = '';
185
- $post_data['meta']['_wpsc_product_metadata']['google_prohibited'] = (int)(bool)$post_data['meta']['_wpsc_product_metadata']['google_prohibited'];
186
-
187
- // Fill in any missing meta values with existing values.
188
- $post_data['meta'] = wp_parse_args( $post_data['meta'], array(
189
- '_wpsc_is_donation' => get_product_meta( $product_id, 'is_donation', true )
190
- ) );
191
-
192
- // Fill in any missing product meta values with existing values.
193
- $default_meta_values = wp_parse_args( get_product_meta( $product_id, 'product_metadata', true ), array(
194
- 'unpublish_when_none_left' => 0,
195
- 'no_shipping' => 0,
196
- 'external_link' => '',
197
- 'external_link_text' => '',
198
- 'engraved' => 0,
199
- 'can_have_uploaded_image' => 0
200
- ) );
201
-
202
- $post_data['meta']['_wpsc_product_metadata'] = wp_parse_args( $post_data['meta']['_wpsc_product_metadata'], $default_meta_values );
203
-
204
- $post_data['files'] = $_FILES;
205
-
206
- if(isset($post_data['post_title']) && $post_data['post_title'] != '') {
207
-
208
- $product_columns = array(
209
- 'name' => '',
210
- 'description' => '',
211
- 'additional_description' => '',
212
- 'price' => null,
213
- 'weight' => null,
214
- 'weight_unit' => '',
215
- 'pnp' => null,
216
- 'international_pnp' => null,
217
- 'file' => null,
218
- 'image' => '0',
219
- 'quantity_limited' => '',
220
- 'quantity' => null,
221
- 'special' => null,
222
- 'special_price' => null,
223
- 'display_frontpage' => null,
224
- 'notax' => null,
225
- 'publish' => null,
226
- 'active' => null,
227
- 'donation' => null,
228
- 'no_shipping' => null,
229
- 'thumbnail_image' => null,
230
- 'thumbnail_state' => null
231
- );
232
-
233
- foreach ( $product_columns as $column => $default ) {
234
- if ( ! isset( $post_data[ $column ] ) ) {
235
- $post_data[ $column ] = '';
236
- }
237
- }
238
-
239
- // if we succeed, we can do further editing (todo - if_wp_error)
240
-
241
- // if we have no categories selected, assign one.
242
- if ( isset( $post_data['tax_input']['wpsc_product_category'] ) && count( $post_data['tax_input']['wpsc_product_category'] ) == 1 && $post_data['tax_input']['wpsc_product_category'][0] == 0){
243
- $post_data['tax_input']['wpsc_product_category'][1] = wpsc_add_product_category_default($product_id);
244
- }
245
-
246
- // and the meta
247
- wpsc_update_product_meta($product_id, $post_data['meta']);
248
-
249
- // and the custom meta
250
- wpsc_update_custom_meta($product_id, $post_data);
251
-
252
- // Update the alternative currencies
253
- if ( isset( $post_data['wpsc-update-currency-layers'] ) && wp_verify_nonce( $post_data['wpsc-update-currency-layers'], 'update-options' ) ) {
254
-
255
- // Clear currencies before re-saving to make sure deleted currencies are removed
256
- update_product_meta( $product_id, 'currency', array() );
257
-
258
- if ( ! empty( $post_data['newCurrency'] ) ) {
259
- foreach( (array) $post_data['newCurrency'] as $key =>$value ) {
260
- wpsc_update_alt_product_currency( $product_id, $value, $post_data['newCurrPrice'][ $key ] );
261
- }
262
- }
263
- }
264
-
265
- if ( isset( $post_data['files']['file'] ) && $post_data['files']['file']['tmp_name'] != '' ) {
266
- wpsc_item_process_file($product_id, $post_data['files']['file']);
267
- } else {
268
- if (!isset($post_data['select_product_file'])) $post_data['select_product_file'] = null;
269
- wpsc_item_reassign_file($product_id, $post_data['select_product_file']);
270
- }
271
-
272
- if(isset($post_data['files']['preview_file']['tmp_name']) && ($post_data['files']['preview_file']['tmp_name'] != '')) {
273
- wpsc_item_add_preview_file($product_id, $post_data['files']['preview_file']);
274
- }
275
- do_action('wpsc_edit_product', $product_id);
276
- }
277
- return $product_id;
278
- }
279
-
280
-
281
- function wpsc_pre_update( $data, $postarr ) {
282
- if ( (defined('DOING_AUTOSAVE') && DOING_AUTOSAVE) || $postarr["post_type"] != 'wpsc-product' )
283
- return $data;
284
- if( isset( $postarr["additional_description"] ) )
285
- $data["post_excerpt"] = $postarr["additional_description"];
286
-
287
- if( isset( $postarr["parent_post"] ) && !empty( $postarr["parent_post"] ) )
288
- $data["post_parent"] = $postarr["parent_post"];
289
-
290
- // Sanitize status for variations (see #324)
291
- if ( $data['post_parent'] && ( ! isset( $data['ID'] ) || $data['post_parent'] != $data['ID'] ) && $data['post_status'] == 'publish' ) {
292
- $data['post_status'] = 'inherit';
293
- }
294
-
295
- if ( ! empty( $postarr['meta'] ) && ( ! isset( $postarr['meta']['_wpsc_product_metadata']['enable_comments'] ) || $postarr['meta']['_wpsc_product_metadata']['enable_comments'] == 0 || empty( $postarr['meta']['_wpsc_product_metadata']['enable_comments'] ) ) ) {
296
- $data["comment_status"] = "closed";
297
- } else {
298
- $data["comment_status"] = "open";
299
- }
300
-
301
- return $data;
302
- }
303
- add_filter( 'wp_insert_post_data','wpsc_pre_update', 99, 2 );
304
- add_action( 'save_post', 'wpsc_admin_submit_product', 5, 2 );
305
- add_action( 'admin_notices', 'wpsc_admin_submit_notices' );
306
-
307
- /**
308
- * Remove category meta box from variation editor. This would disassociate variations
309
- * with the default category. See #431 (http://code.google.com/p/wp-e-commerce/issues/detail?id=431)
310
- *
311
- */
312
- function wpsc_variation_remove_metaboxes() {
313
- global $post;
314
- if ( ! $post->post_parent )
315
- return;
316
-
317
- remove_meta_box( 'wpsc_product_categorydiv', 'wpsc-product', 'side' );
318
- }
319
- add_action( 'add_meta_boxes_wpsc-product', 'wpsc_variation_remove_metaboxes', 99 );
320
-
321
- function wpsc_admin_submit_notices() {
322
- global $current_screen, $post;
323
-
324
- if( $current_screen->id != 'wpsc-product' || !isset( $_SESSION['product_error_messages'] ) )
325
- return;
326
- foreach ( $_SESSION['product_error_messages'] as $error )
327
- echo "<div id=\"message\" class=\"updated below-h2\"><p>".$error."</p></div>";
328
- unset( $_SESSION['product_error_messages'] );
329
- }
330
-
331
- /**
332
- * wpsc_add_product_category_default, if there is no category assigned assign first product category as default
333
- *
334
- * @since 3.8
335
- * @param $product_id (int) the Post ID
336
- * @return null
337
- */
338
- function wpsc_add_product_category_default( $product_id ){
339
- $terms = get_terms( 'wpsc_product_category', array( 'orderby' => 'id', 'hide_empty' => 0 ) );
340
- if ( ! empty( $terms ) ) {
341
- $default = array_shift( $terms );
342
- wp_set_object_terms( $product_id , array( $default->slug ) , 'wpsc_product_category' );
343
- }
344
- }
345
- /**
346
- * wpsc_sanitise_product_forms function
347
- *
348
- * @return array - Sanitised product details
349
- */
350
- function wpsc_sanitise_product_forms($post_data = null) {
351
- if ( empty($post_data) ) {
352
- $post_data = &$_POST;
353
- }
354
-
355
- $post_data = stripslashes_deep( $post_data );
356
-
357
- $post_data['name'] = isset($post_data['post_title']) ? $post_data['post_title'] : '';
358
- $post_data['title'] = $post_data['name'];
359
- $post_data['description'] = isset($post_data['content']) ? $post_data['content'] : '';
360
- $post_data['additional_description'] = isset($post_data['additional_description']) ? $post_data['additional_description'] : '';
361
- $post_data['post_status'] = 'draft';
362
-
363
- if(isset($post_data['publish'])) {
364
- $post_data['post_status'] = 'publish';
365
- } else if(isset($post_data['unpublish'])) {
366
- $post_data['post_status'] = 'draft';
367
- }
368
-
369
- $post_data['meta']['_wpsc_price'] = wpsc_string_to_float( $post_data['meta']['_wpsc_price'] );
370
- $post_data['meta']['_wpsc_special_price'] = wpsc_string_to_float( $post_data['meta']['_wpsc_special_price'] );
371
- if (!isset($post_data['meta']['_wpsc_is_donation'])) $post_data['meta']['_wpsc_is_donation'] = '';
372
- $post_data['meta']['_wpsc_is_donation'] = (int)(bool)$post_data['meta']['_wpsc_is_donation'];
373
- $post_data['meta']['_wpsc_stock'] = (int)$post_data['meta']['_wpsc_stock'];
374
-
375
- if (!isset($post_data['meta']['_wpsc_limited_stock'])) $post_data['meta']['_wpsc_limited_stock'] = '';
376
- if((bool)$post_data['meta']['_wpsc_limited_stock'] !== true) {
377
- $post_data['meta']['_wpsc_stock'] = false;
378
- }
379
- unset($post_data['meta']['_wpsc_limited_stock']);
380
- if(!isset($post_data['meta']['_wpsc_product_metadata']['unpublish_when_none_left'])) $post_data['meta']['_wpsc_product_metadata']['unpublish_when_none_left'] = '';
381
- if(!isset($post_data['quantity_limited'])) $post_data['quantity_limited'] = '';
382
- if(!isset($post_data['special'])) $post_data['special'] = '';
383
- if(!isset($post_data['meta']['_wpsc_product_metadata']['no_shipping'])) $post_data['meta']['_wpsc_product_metadata']['no_shipping'] = '';
384
-
385
- $post_data['meta']['_wpsc_product_metadata']['unpublish_when_none_left'] = (int)(bool)$post_data['meta']['_wpsc_product_metadata']['unpublish_when_none_left'];
386
- $post_data['meta']['_wpsc_product_metadata']['quantity_limited'] = (int)(bool)$post_data['quantity_limited'];
387
- $post_data['meta']['_wpsc_product_metadata']['special'] = (int)(bool)$post_data['special'];
388
- $post_data['meta']['_wpsc_product_metadata']['no_shipping'] = (int)(bool)$post_data['meta']['_wpsc_product_metadata']['no_shipping'];
389
-
390
- // Product Weight
391
- if(!isset($post_data['meta']['_wpsc_product_metadata']['display_weight_as'])) $post_data['meta']['_wpsc_product_metadata']['display_weight_as'] = '';
392
- if(!isset($post_data['meta']['_wpsc_product_metadata']['display_weight_as'])) $post_data['meta']['_wpsc_product_metadata']['display_weight_as'] = '';
393
-
394
- $weight = wpsc_string_to_float( $post_data['meta']['_wpsc_product_metadata']['weight'] );
395
- $weight = wpsc_convert_weight( $weight, $post_data['meta']['_wpsc_product_metadata']['weight_unit'], "pound", true);
396
- $post_data['meta']['_wpsc_product_metadata']['weight'] = $weight;
397
- $post_data['meta']['_wpsc_product_metadata']['display_weight_as'] = $post_data['meta']['_wpsc_product_metadata']['weight_unit'];
398
-
399
- $post_data['files'] = $_FILES;
400
- return $post_data;
401
- }
402
-
403
- /**
404
- * wpsc_insert_product function
405
- *
406
- * @param unknown
407
- * @return unknown
408
- */
409
- function wpsc_insert_product($post_data, $wpsc_error = false) {
410
- global $wpdb, $user_ID;
411
- $adding = false;
412
- $update = false;
413
-
414
- $product_columns = array(
415
- 'name' => '',
416
- 'description' => '',
417
- 'additional_description' => '',
418
- 'price' => null,
419
- 'weight' => null,
420
- 'weight_unit' => '',
421
- 'pnp' => null,
422
- 'international_pnp' => null,
423
- 'file' => null,
424
- 'image' => '0',
425
- 'quantity_limited' => '',
426
- 'quantity' => null,
427
- 'special' => null,
428
- 'special_price' => null,
429
- 'display_frontpage' => null,
430
- 'notax' => null,
431
- 'publish' => null,
432
- 'active' => null,
433
- 'donation' => null,
434
- 'no_shipping' => null,
435
- 'thumbnail_image' => null,
436
- 'thumbnail_state' => null
437
- );
438
-
439
- foreach ( $product_columns as $column => $default ) {
440
- if ( ! isset( $post_data[ $column ] ) ) {
441
- $post_data[ $column ] = '';
442
- }
443
- }
444
-
445
- $product_post_values = array(
446
- 'post_author' => $user_ID,
447
- 'post_content' => $post_data['description'],
448
- 'post_excerpt' => $post_data['additional_description'],
449
- 'post_title' => $post_data['name'],
450
- 'post_status' => $post_data['post_status'],
451
- 'post_type' => "wpsc-product",
452
- 'post_name' => sanitize_title($post_data['name'])
453
- );
454
- $product_post_values["comment_status"] = "open";
455
-
456
- $product_id = wp_insert_post($product_post_values);
457
- if ( isset ( $post_data["sticky"] ) ) {
458
- stick_post($product_id);
459
- }else {
460
- unstick_post($product_id);
461
- }
462
-
463
- $adding = true;
464
-
465
- // if we succeed, we can do further editing
466
-
467
- // and the meta
468
- wpsc_update_product_meta($product_id, $post_data['meta']);
469
- do_action('wpsc_edit_product', $product_id);
470
- return $product_id;
471
- }
472
-
473
- /**
474
- * term_id_price function
475
- * Retreives associated price, if any, with term_id
476
- * @param integer term ID
477
- * @param integer parent product price
478
- * @return integer modified price for child product, based on term ID price and parent price
479
- */
480
-
481
- function term_id_price($term_id, $parent_price) {
482
-
483
- $term_price_arr = get_option( 'term_prices' );
484
-
485
- if ( isset($term_price_arr[$term_id]) ) {
486
- $price = $term_price_arr[$term_id]["price"];
487
- } else {
488
- $price = 0;
489
- }
490
-
491
- //Check for flat, percentile or differential
492
- $var_price_type = '';
493
-
494
- if (flat_price($price)) {
495
- $var_price_type = 'flat';
496
- $price = floatval($price);
497
- } elseif ( differential_price($price) ) {
498
- $var_price_type = 'differential';
499
- } elseif (percentile_price($price)) {
500
- $var_price_type = 'percentile';
501
- }
502
-
503
- if (strchr($price, '-') ) {
504
- $positive = false;
505
- } else {
506
- $positive = true;
507
- }
508
-
509
- if ($positive) {
510
-
511
- if ( $var_price_type == 'differential' ) {
512
- $differential = (floatval($price));
513
- $price = $parent_price + $differential;
514
- } elseif ( $var_price_type == 'percentile' ) {
515
- $percentage = (floatval($price) / 100);
516
- $price = $parent_price + ($parent_price * $percentage);
517
- }
518
- } else {
519
-
520
- if ( $var_price_type == 'differential' ) {
521
- $differential = (floatval($price));
522
- $price = $parent_price - $differential;
523
- } elseif ( $var_price_type == 'percentile' ) {
524
- $percentage = (floatval($price) / 100);
525
- $price = $parent_price - ($parent_price * $percentage);
526
- }
527
- }
528
- return $price;
529
- }
530
-
531
- /**
532
- * Determine the price of a variation product based on the variation it's assigned
533
- * to. Because each variation term can have its own price (eg. 10, +10, -5%), this
534
- * function also takes those into account.
535
- *
536
- * @since 3.8.6
537
- * @param int $variation_id ID of the variation product
538
- * @param string $terms Optional. Defaults to false. Variation terms assigned to
539
- * the variation product. Pass this argument to save one SQL query.
540
- * @return float Calculated price of the variation
541
- */
542
- function wpsc_determine_variation_price( $variation_id, $term_ids = false ) {
543
- $flat = array();
544
- $diff = 0;
545
-
546
- $variation = get_post( $variation_id );
547
- $price = (float) get_product_meta( $variation->post_parent, 'price', true );
548
-
549
- if ( ! $term_ids )
550
- $term_ids = wpsc_get_product_terms( $variation_id, 'wpsc-variation', 'term_id' );
551
-
552
- $term_price_arr = get_option( 'term_prices' );
553
- foreach ( $term_ids as $term_id ) {
554
- if ( isset( $term_price_arr[$term_id] ) )
555
- $term_price = trim( $term_price_arr[$term_id]['price'] );
556
- else
557
- continue;
558
- if ( flat_price( $term_price ) ) {
559
- $flat[] = $term_price;
560
- } elseif ( differential_price( $term_price ) ) {
561
- $diff += (float) $term_price;
562
- } elseif ( percentile_price( $term_price ) ) {
563
- $diff += (float) $term_price / 100 * $price;
564
- }
565
- }
566
- // Variation price should at least be the maximum of all flat prices
567
- if ( ! empty( $flat ) )
568
- $price = max( $flat );
569
- $price += $diff;
570
- return $price;
571
- }
572
-
573
- /**
574
- * wpsc_edit_product_variations function.
575
- * this is the function to make child products using variations
576
- *
577
- * @access public
578
- * @param mixed $product_id
579
- * @param mixed $post_data
580
- * @return void
581
- */
582
- function wpsc_edit_product_variations($product_id, $post_data) {
583
- global $user_ID;
584
-
585
- $parent = get_post_field( 'post_parent', $product_id );
586
-
587
- if( ! empty( $parent ) )
588
- return;
589
-
590
- $variations = array();
591
- $product_children = array();
592
- if (!isset($post_data['edit_var_val']))
593
- $post_data['edit_var_val'] = '';
594
-
595
- $variations = (array) $post_data['edit_var_val'];
596
-
597
- // Generate the arrays for variation sets, values and combinations
598
- $wpsc_combinator = new wpsc_variation_combinator($variations);
599
-
600
- // Retrieve the array containing the variation set IDs
601
- $variation_sets = $wpsc_combinator->return_variation_sets();
602
-
603
- // Retrieve the array containing the combinations of each variation set to be associated with this product.
604
- $variation_values = $wpsc_combinator->return_variation_values();
605
-
606
- // Retrieve the array containing the combinations of each variation set to be associated with this product.
607
- $combinations = $wpsc_combinator->return_combinations();
608
-
609
- $product_terms = wpsc_get_product_terms( $product_id, 'wpsc-variation' );
610
-
611
- $variation_sets_and_values = array_merge($variation_sets, $variation_values);
612
- $variation_sets_and_values = apply_filters('wpsc_edit_product_variation_sets_and_values', $variation_sets_and_values, $product_id);
613
-
614
- wp_set_object_terms($product_id, $variation_sets_and_values, 'wpsc-variation');
615
-
616
- $parent_id = absint( $_REQUEST['product_id'] );
617
-
618
- $child_product_template = array(
619
- 'post_author' => $user_ID,
620
- 'post_content' => get_post_field( 'post_content', $parent_id, 'raw' ),
621
- 'post_excerpt' => get_post_field( 'post_excerpt', $parent_id, 'raw' ),
622
- 'post_title' => get_post_field( 'post_title', $parent_id, 'raw' ),
623
- 'post_status' => 'inherit',
624
- 'post_type' => "wpsc-product",
625
- 'post_parent' => $product_id
626
- );
627
-
628
- $child_product_meta = get_post_custom($product_id);
629
-
630
- // here we loop through the combinations, get the term data and generate custom product names
631
- foreach($combinations as $combination) {
632
- $term_names = array();
633
- $term_ids = array();
634
- $term_slugs = array();
635
- $product_values = $child_product_template;
636
-
637
- $combination_terms = get_terms('wpsc-variation', array(
638
- 'hide_empty' => 0,
639
- 'include' => implode(",", $combination),
640
- 'orderby' => 'parent',
641
- ));
642
-
643
- foreach($combination_terms as $term) {
644
- $term_ids[] = $term->term_id;
645
- $term_slugs[] = $term->slug;
646
- $term_names[] = $term->name;
647
- }
648
-
649
- $product_values['post_title'] .= " (".implode(", ", $term_names).")";
650
- $product_values['post_name'] = sanitize_title($product_values['post_title']);
651
-
652
- $selected_post = get_posts(array(
653
- 'name' => $product_values['post_name'],
654
- 'post_parent' => $product_id,
655
- 'post_type' => "wpsc-product",
656
- 'post_status' => 'all',
657
- 'suppress_filters' => true
658
- ));
659
- $selected_post = array_shift($selected_post);
660
- $child_product_id = wpsc_get_child_object_in_terms($product_id, $term_ids, 'wpsc-variation');
661
- $already_a_variation = true;
662
- if($child_product_id == false) {
663
- $already_a_variation = false;
664
- if($selected_post != null) {
665
- $child_product_id = $selected_post->ID;
666
- } else {
667
- $child_product_id = wp_insert_post($product_values);
668
- }
669
- } else {
670
- // sometimes there have been problems saving the variations, this gets the correct product ID
671
- if(($selected_post != null) && ($selected_post->ID != $child_product_id)) {
672
- $child_product_id = $selected_post->ID;
673
- }
674
- }
675
- $product_children[] = $child_product_id;
676
- if($child_product_id > 0) {
677
- wp_set_object_terms($child_product_id, $term_slugs, 'wpsc-variation');
678
- }
679
- //JS - 7.9 - Adding loop to include meta data in child product.
680
- if(!$already_a_variation){
681
- $this_child_product_meta = apply_filters( 'insert_child_product_meta', $child_product_meta, $product_id, $combination_terms );
682
- foreach ($this_child_product_meta as $meta_key => $meta_value ) :
683
- if ($meta_key == "_wpsc_product_metadata") {
684
- update_post_meta($child_product_id, $meta_key, unserialize($meta_value[0]));
685
- } else {
686
- update_post_meta($child_product_id, $meta_key, $meta_value[0]);
687
- }
688
-
689
- endforeach;
690
-
691
- if ( is_array( $term_ids ) && $price = wpsc_determine_variation_price( $child_product_id, $term_ids ) )
692
- update_product_meta( $child_product_id, 'price', $price );
693
- }
694
- }
695
-
696
- //For reasons unknown, this code did not previously deal with variation deletions.
697
- //Basically, we'll just check if any existing term associations are missing from the posted variables, delete if they are.
698
- //Get posted terms (multi-dimensional array, first level = parent var, second level = child var)
699
- $posted_term = $variations;
700
- //Get currently associated terms
701
- $currently_associated_var = $product_terms;
702
-
703
- $currently_associated_vars = array();
704
- foreach ($currently_associated_var as $current) {
705
- $currently_associated_vars[] = $current->term_id;
706
- }
707
-
708
- $posted_terms = array();
709
-
710
- foreach ($posted_term as $term=>$val) {
711
- $posted_terms[] = $term;
712
- if(is_array($val)) {
713
- foreach($val as $term2=>$val2) {
714
- $posted_terms[] = $term2;
715
- }
716
- }
717
- }
718
-
719
- if(!empty($currently_associated_vars)){
720
- $term_ids_to_delete = array();
721
- $term_ids_to_delete = array_diff($currently_associated_vars, $posted_terms);
722
- }
723
-
724
- if(isset($_REQUEST["post_ID"])) {
725
- $post_id = $_REQUEST["post_ID"];
726
- } elseif(isset($_REQUEST["product_id"])) {
727
- $post_id = $_REQUEST["product_id"];
728
- } else {
729
- return;
730
- }
731
-
732
- if(!empty($term_ids_to_delete) && (isset($_REQUEST["product_id"]) || isset($post_id))) {
733
- $post_ids_to_delete = array();
734
-
735
- // Whatever remains, find child products of current product with that term, in the variation taxonomy, and delete
736
- $post_ids_to_delete = wpsc_get_child_object_in_terms_var($_REQUEST["product_id"], $term_ids_to_delete, 'wpsc-variation');
737
-
738
- if(is_array($post_ids_to_delete) && !empty($post_ids_to_delete)) {
739
- foreach($post_ids_to_delete as $object_ids) {
740
- foreach($object_ids as $object_id) {
741
- wp_delete_post($object_id);
742
- }
743
- }
744
- }
745
- }
746
- $current_children = get_posts(array(
747
- 'post_parent' => $post_id,
748
- 'post_type' => 'wpsc-product',
749
- 'post_status' => 'all',
750
- 'numberposts' => -1
751
- ));
752
-
753
- $children = array();
754
- foreach((array)$current_children as $child_prod){
755
- $children[] = $child_prod->ID;
756
- }
757
- if(!empty($children)){
758
- $old_ids_to_delete = array_diff($children, $product_children);
759
- $old_ids_to_delete = apply_filters('wpsc_edit_product_variations_deletion', $old_ids_to_delete);
760
- if(is_array($old_ids_to_delete) && !empty($old_ids_to_delete)) {
761
- foreach($old_ids_to_delete as $object_ids) {
762
- wp_delete_post($object_ids);
763
- }
764
- }
765
- }
766
- _wpsc_refresh_parent_product_terms( $parent_id );
767
-
768
- }
769
-
770
- function wpsc_update_alt_product_currency($product_id, $newCurrency, $newPrice){
771
- global $wpdb;
772
-
773
- $old_curr = get_product_meta($product_id, 'currency',true);
774
- $sql = $wpdb->prepare( "SELECT `isocode` FROM `".WPSC_TABLE_CURRENCY_LIST."` WHERE `id`= %d", $newCurrency );
775
- $isocode = $wpdb->get_var($sql);
776
-
777
- $newCurrency = 'currency';
778
- $old_curr[$isocode] = $newPrice;
779
- if(($newPrice != '') && ($newPrice > 0.00)){
780
- update_product_meta($product_id, $newCurrency, $old_curr);
781
- } else {
782
- if((empty($old_curr[$isocode]) || 0.00 == $old_curr[$isocode]) && is_array($old_curr))
783
- unset($old_curr[$isocode]);
784
- update_product_meta($product_id, $newCurrency, $old_curr);
785
-
786
- }
787
-
788
- }
789
-
790
- /**
791
- * wpsc_update_product_meta function
792
- *
793
- * @param integer product ID
794
- * @param string comma separated tags
795
- */
796
- function wpsc_update_product_meta($product_id, $product_meta) {
797
- if($product_meta != null) {
798
- foreach((array)$product_meta as $key => $value) {
799
- update_post_meta($product_id, $key, $value);
800
- }
801
- }
802
- }
803
-
804
- /**
805
- * Called from javascript within product page to toggle publish status - AJAX
806
- * @return bool publish status
807
- */
808
- function wpsc_ajax_toggle_publish() {
809
- /**
810
- * @todo - Check Admin Referer
811
- * @todo - Check Permissions
812
- */
813
- $status = (wpsc_toggle_publish_status($_REQUEST['productid'])) ? ('true') : ('false');
814
- exit( $status );
815
- }
816
- /*
817
- /* END - Publish /No Publish functions
818
- */
819
-
820
- function wpsc_update_custom_meta($product_id, $post_data) {
821
-
822
- if ( isset( $post_data['new_custom_meta'] ) && $post_data['new_custom_meta'] != null ) {
823
- foreach((array)$post_data['new_custom_meta']['name'] as $key => $name) {
824
- $value = $post_data['new_custom_meta']['value'][(int)$key];
825
- if(($name != '') && ($value != '')) {
826
- add_post_meta($product_id, $name, $value);
827
- }
828
- }
829
- }
830
-
831
- if (!isset($post_data['custom_meta'])) $post_data['custom_meta'] = '';
832
- if($post_data['custom_meta'] != null) {
833
- foreach((array)$post_data['custom_meta'] as $key => $values) {
834
- if(($values['name'] != '') && ($values['value'] != '')) {
835
- update_post_meta($product_id, $values['name'], $values['value']);
836
- }
837
- }
838
- }
839
- }
840
-
841
- /**
842
- * wpsc_item_process_file function
843
- *
844
- * @param integer product ID
845
- * @param array the file array from $_FILES
846
- * @param array the preview file array from $_FILES
847
- */
848
- function wpsc_item_process_file( $product_id, $submitted_file, $preview_file = null ) {
849
-
850
- add_filter( 'upload_dir', 'wpsc_modify_upload_directory' );
851
-
852
- $time = current_time( 'mysql' );
853
-
854
- if ( $post = get_post( $product_id ) ) {
855
- if ( substr( $post->post_date, 0, 4 ) > 0 )
856
- $time = $post->post_date;
857
- }
858
-
859
- $file = wp_handle_upload( $submitted_file, array( 'test_form' => false ), $time );
860
-
861
- if ( isset( $file['error'] ) ) {
862
- return new WP_Error( 'upload_error', $file['error'] );
863
- }
864
-
865
- $name_parts = pathinfo( $file['file'] );
866
-
867
- // Construct the attachment array
868
- $attachment = array(
869
- 'post_mime_type' => $file['type'],
870
- 'guid' => $file['url'],
871
- 'post_parent' => $product_id,
872
- 'post_title' => $name_parts['basename'],
873
- 'post_content' => '',
874
- 'post_type' => 'wpsc-product-file',
875
- 'post_status' => 'inherit'
876
- );
877
-
878
- // Save the data
879
- wp_insert_post( $attachment );
880
-
881
- remove_filter( 'upload_dir', 'wpsc_modify_upload_directory' );
882
- }
883
-
884
- function wpsc_modify_upload_directory($input) {
885
- $previous_subdir = $input['subdir'];
886
- $download_subdir = str_replace($input['basedir'], '', WPSC_FILE_DIR);
887
- $input['path'] = substr_replace(str_replace($previous_subdir, $download_subdir, $input['path']),'',-1);
888
- $input['url'] = substr_replace(str_replace($previous_subdir, $download_subdir, $input['url']),'',-1);
889
- $input['subdir'] = substr_replace(str_replace($previous_subdir, $download_subdir, $input['subdir']),'',-1);
890
- return $input;
891
- }
892
-
893
- function wpsc_modify_preview_directory($input) {
894
- $previous_subdir = $input['subdir'];
895
- $download_subdir = str_replace($input['basedir'], '', WPSC_PREVIEW_DIR);
896
-
897
- $input['path'] = substr_replace(str_replace($previous_subdir, $download_subdir, $input['path']),'',-1);
898
- $input['url'] = substr_replace(str_replace($previous_subdir, $download_subdir, $input['url']),'',-1);
899
- $input['subdir'] = substr_replace(str_replace($previous_subdir, $download_subdir, $input['subdir']),'',-1);
900
-
901
- return $input;
902
- }
903
-
904
- /**
905
- * wpsc_item_reassign_file function
906
- *
907
- * @param integer product ID
908
- * @param string the selected file name;
909
- */
910
- function wpsc_item_reassign_file($product_id, $selected_files) {
911
- global $wpdb;
912
- $product_file_list = array();
913
- // initialise $idhash to null to prevent issues with undefined variables and error logs
914
- $idhash = null;
915
-
916
- $args = array(
917
- 'post_type' => 'wpsc-product-file',
918
- 'post_parent' => $product_id,
919
- 'numberposts' => -1,
920
- 'post_status' => 'any'
921
- );
922
-
923
- $attached_files = (array) get_posts( $args );
924
- $attached_files_by_file = array();
925
-
926
- foreach($attached_files as $key => $attached_file) {
927
- $attached_files_by_file[$attached_file->post_title] = $attached_files[$key];
928
- }
929
-
930
- /* if we are editing, grab the current file and ID hash */
931
- if(!$selected_files) {
932
- // unlikely that anyone will ever upload a file called .none., so its the value used to signify clearing the product association
933
- return null;
934
- }
935
-
936
- foreach($selected_files as $selected_file) {
937
- // if we already use this file, there is no point doing anything more.
938
- $file_is_attached = false;
939
- $selected_file_path = WPSC_FILE_DIR.basename($selected_file);
940
-
941
- if(isset($attached_files_by_file[$selected_file])) {
942
- $file_is_attached = true;
943
- }
944
-
945
- if($file_is_attached == false ) {
946
- $type = wpsc_get_mimetype($selected_file_path);
947
- $attachment = array(
948
- 'post_mime_type' => $type,
949
- 'post_parent' => $product_id,
950
- 'post_title' => $selected_file,
951
- 'post_content' => '',
952
- 'post_type' => "wpsc-product-file",
953
- 'post_status' => 'inherit'
954
- );
955
- wp_insert_post($attachment);
956
- } else {
957
- $product_post_values = array(
958
- 'ID' => $attached_files_by_file[$selected_file]->ID,
959
- 'post_status' => 'inherit'
960
- );
961
- wp_update_post($product_post_values);
962
- }
963
- }
964
-
965
-
966
- foreach($attached_files as $attached_file) {
967
- if(!in_array($attached_file->post_title, $selected_files)) {
968
- $product_post_values = array(
969
- 'ID' => $attached_file->ID,
970
- 'post_status' => 'draft'
971
- );
972
- wp_update_post($product_post_values);
973
- }
974
- }
975
-
976
- return true;
977
- }
978
-
979
- /**
980
- * wpsc_delete_preview_file
981
- *
982
- * @param integer product ID
983
- */
984
-
985
- function wpsc_delete_preview_file($product_id) {
986
-
987
- $args = array(
988
- 'post_type' => 'wpsc-preview-file',
989
- 'post_parent' => $product_id,
990
- 'numberposts' => -1,
991
- 'post_status' => 'all'
992
- );
993
-
994
- $preview_files = (array)get_posts( $args );
995
-
996
- foreach( $preview_files as $preview ) {
997
- $preview_id = $preview->ID;
998
- wp_delete_post($preview_id);
999
- }
1000
- return true;
1001
- }
1002
-
1003
- /**
1004
- * wpsc_item_add_preview_file function
1005
- *
1006
- * @param integer product ID
1007
- * @param array the preview file array from $_FILES
1008
- */
1009
- function wpsc_item_add_preview_file($product_id, $preview_file) {
1010
- global $wpdb;
1011
-
1012
- wpsc_delete_preview_file($product_id);
1013
-
1014
- add_filter('upload_dir', 'wpsc_modify_preview_directory');
1015
- $overrides = array('test_form'=>false);
1016
-
1017
- $time = current_time('mysql');
1018
- if ( $post = get_post($product_id) ) {
1019
- if ( substr( $post->post_date, 0, 4 ) > 0 )
1020
- $time = $post->post_date;
1021
- }
1022
-
1023
- $file = wp_handle_upload($preview_file, $overrides, $time);
1024
-
1025
- if ( isset($file['error']) )
1026
- return new WP_Error( 'upload_error', $file['error'] );
1027
-
1028
- $name_parts = pathinfo($file['file']);
1029
- $name = $name_parts['basename'];
1030
-
1031
- $url = $file['url'];
1032
- $type = $file['type'];
1033
- $file = $file['file'];
1034
- $title = $name;
1035
- $content = '';
1036
-
1037
- // Construct the attachment array
1038
- $attachment = array(
1039
- 'post_mime_type' => $type,
1040
- 'guid' => $url,
1041
- 'post_parent' => $product_id,
1042
- 'post_title' => $title,
1043
- 'post_content' => $content,
1044
- 'post_type' => "wpsc-preview-file",
1045
- 'post_status' => 'inherit'
1046
- );
1047
-
1048
- // Save the data
1049
- $id = wp_insert_post($attachment, $file, $product_id);
1050
- remove_filter('upload_dir', 'wpsc_modify_preview_directory');
1051
- return $id;
1052
-
1053
-
1054
- }
1055
-
1056
- /**
1057
- * wpsc_variation_combinator class.
1058
- * Produces all combinations of variations selected for this product
1059
- * this class is based off the example code from here:
1060
- * http://www.php.net/manual/en/ref.array.php#94910
1061
- * Thanks, phektus, you are awesome, whoever you are.
1062
- */
1063
- class wpsc_variation_combinator {
1064
- var $variation_sets = array();
1065
- var $variation_values = array();
1066
- var $reprocessed_array = array();
1067
- var $combinations= array();
1068
-
1069
- public function __construct($variation_sets) {
1070
- if( $variation_sets ) {
1071
- foreach($variation_sets as $variation_set_id => $variation_set) {
1072
- $this->variation_sets[] = absint($variation_set_id);
1073
- $new_variation_set = array();
1074
- if( $variation_set ) {
1075
- foreach($variation_set as $variation => $active) {
1076
- if($active == 1) {
1077
- $new_variation_set[] = array(absint($variation));
1078
- $this->variation_values[] = $variation;
1079
- }
1080
- }
1081
- }
1082
- $this->reprocessed_array[] = $new_variation_set;
1083
- }
1084
- $this->get_combinations(array(), $this->reprocessed_array, 0);
1085
- }
1086
- }
1087
-
1088
-
1089
- function get_combinations($batch, $elements, $i) {
1090
- if ($i >= count($elements)) {
1091
- $this->combinations[] = $batch;
1092
- } else {
1093
- foreach ($elements[$i] as $element) {
1094
- $this->get_combinations(array_merge($batch, $element), $elements, $i + 1);
1095
- }
1096
- }
1097
- }
1098
-
1099
- function return_variation_sets() {
1100
- return $this->variation_sets;
1101
- }
1102
-
1103
- function return_variation_values() {
1104
- return $this->variation_values;
1105
- }
1106
-
1107
- function return_combinations() {
1108
- return $this->combinations;
1109
-
1110
- }
1111
- }
1112
-
1113
- function wpsc_variations_stock_remaining($product_id){
1114
- global $wpdb;
1115
- return $wpdb->get_var( $wpdb->prepare( '
1116
- SELECT
1117
- sum(`pm`.`meta_value`)
1118
- FROM
1119
- `' . $wpdb->postmeta . '` `pm`
1120
- JOIN
1121
- `' . $wpdb->posts . '` `p`
1122
- ON
1123
- `pm`.`post_id` = `p`.`id`
1124
- WHERE
1125
- `p`.`post_type`= "wpsc-product"
1126
- AND
1127
- `p`.`post_parent` = %d
1128
- AND
1129
- `pm`.`meta_key` = "_wpsc_stock"
1130
- ', $product_id ) );
1131
- }
1132
-
1133
- function flat_price( $price ) {
1134
- if ( ! empty( $price ) && strchr( $price, '-' ) === false && strchr( $price, '+' ) === false && strchr( $price, '%' ) === false )
1135
- return true;
1136
- }
1137
-
1138
- function percentile_price( $price ) {
1139
- if ( ! empty( $price ) && ( strchr( $price, '-' ) || strchr( $price, '+' ) ) && strchr( $price, '%' ) )
1140
- return true;
1141
- }
1142
-
1143
- function differential_price( $price ) {
1144
- if ( ! empty( $price ) && ( strchr( $price, '-' ) || strchr( $price, '+' ) ) && strchr( $price, '%' ) === false )
1145
- return true;
1146
- }
1147
-
1148
- /**
1149
- * Refresh variation terms assigned to parent product based on the variations it has.
1150
- *
1151
- * @since 3.8.9
1152
- * @access private
1153
- * @param int $parent_id Parent product ID
1154
- */
1155
- function _wpsc_refresh_parent_product_terms( $parent_id ) {
1156
- $children = get_children( array(
1157
- 'post_parent' => $parent_id,
1158
- 'post_status' => array( 'publish', 'inherit' ),
1159
- ) );
1160
-
1161
- $children_ids = wp_list_pluck( $children, 'ID' );
1162
-
1163
- $children_terms = wp_get_object_terms( $children_ids, 'wpsc-variation' );
1164
- $new_terms = array();
1165
- foreach ( $children_terms as $term ) {
1166
- if ( $term->parent )
1167
- $new_terms[] = $term->parent;
1168
- }
1169
-
1170
- $children_term_ids = wp_list_pluck( $children_terms, 'term_id' );
1171
- $new_terms = array_merge( $new_terms, $children_term_ids );
1172
- $new_terms = array_unique( $new_terms );
1173
- $new_terms = array_map( 'absint', $new_terms );
1174
- wp_set_object_terms( $parent_id, $new_terms, 'wpsc-variation' );
1175
- }
1176
-
1177
- /**
1178
- * Make sure parent product's assigned terms are refreshed when its variations are deleted or trashed
1179
- *
1180
- * @since 3.8.9
1181
- * @access private
1182
- * @param int $post_id Parent product ID
1183
- */
1184
- function _wpsc_action_refresh_variation_parent_terms( $post_id ) {
1185
- $post = get_post( $post_id );
1186
- if ( $post->post_type != 'wpsc-product' || ! $post->post_parent || in_array( $post->post_status, array( 'publish', 'inherit' ) ) )
1187
- return;
1188
-
1189
- _wpsc_refresh_parent_product_terms( $post->post_parent );
1190
- }
1191
-
1192
- /**
1193
- * Make sure parent product's assigned terms are refresh when its variations' statuses are changed
1194
- *
1195
- * @since 3.8.9
1196
- * @access private
1197
- * @param string $new_status New status
1198
- * @param string $old_status Old status
1199
- * @param object $post Variation object
1200
- */
1201
- function _wpsc_action_transition_post_status( $new_status, $old_status, $post ) {
1202
- if ( $post->post_type != 'wpsc-product' || ! $post->post_parent )
1203
- return;
1204
-
1205
- _wpsc_refresh_parent_product_terms( $post->post_parent );
1206
- }
1207
-
1208
- /**
1209
- * Prevent parent terms from being refreshed when its variations are updated. This is useful when
1210
- * the variations are being mass updated.
1211
- *
1212
- * @since 3.8.9
1213
- * @access private
1214
- */
1215
- function _wpsc_remove_refresh_variation_parent_term_hooks() {
1216
- remove_action( 'transition_post_status', '_wpsc_action_transition_post_status', 10, 3 );
1217
- remove_action( 'deleted_post', '_wpsc_action_refresh_variation_parent_terms', 10, 1 );
1218
- }
1219
-
1220
- /**
1221
- * Add hooks so that parent product's assigned terms are refreshed when its variations are updated.
1222
- *
1223
- * @since 3.8.9
1224
- * @access private
1225
- */
1226
- function _wpsc_add_refresh_variation_parent_term_hooks() {
1227
- add_action( 'transition_post_status', '_wpsc_action_transition_post_status', 10, 3 );
1228
- add_action( 'deleted_post', '_wpsc_action_refresh_variation_parent_terms', 10, 1 );
1229
- }
1230
-
1231
- _wpsc_add_refresh_variation_parent_term_hooks();
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
trunk/wpsc-admin/includes/product-variation-list-table.class.php DELETED
@@ -1,678 +0,0 @@
1
- <?php
2
-
3
- require_once( ABSPATH . 'wp-admin/includes/class-wp-list-table.php' );
4
- require_once( ABSPATH . 'wp-admin/includes/class-wp-posts-list-table.php' );
5
-
6
- /**
7
- * Product Variation List Table class
8
- *
9
- * @package wp-e-commerce
10
- */
11
- class WPSC_Product_Variation_List_Table extends WP_List_Table {
12
- private $product_id;
13
- private $object_terms_cache = array();
14
- private $args = array();
15
- private $is_trash = false;
16
- private $is_draft = false;
17
- private $is_publish = false;
18
- private $is_all = true;
19
- private $is_bulk_edit = false;
20
- private $bulk_edited_items = array();
21
- private $bulk_edited_item_ids = array();
22
-
23
- public function __construct( $product_id ) {
24
- WP_List_Table::__construct( array(
25
- 'plural' => 'variations',
26
- ) );
27
-
28
- $this->product_id = $product_id;
29
- if ( isset( $_REQUEST['post_status'] ) ) {
30
- $this->is_trash = $_REQUEST['post_status'] == 'trash';
31
- $this->is_draft = $_REQUEST['post_status'] == 'draft';
32
- $this->is_publish = $_REQUEST['post_status'] == 'publish';
33
- $this->is_all = $_REQUEST['post_status'] == 'all';
34
- } else {
35
- $this->is_all = true;
36
- }
37
- }
38
-
39
- public function prepare_items() {
40
- if ( ! empty( $this->items ) )
41
- return;
42
-
43
- $per_page = $this->get_items_per_page( 'edit_wpsc-product-variations_per_page' );
44
- $per_page = apply_filters( 'edit_wpsc_product_variations_per_page', $per_page );
45
- $this->args = array(
46
- 'post_type' => 'wpsc-product',
47
- 'orderby' => 'menu_order title',
48
- 'post_parent' => $this->product_id,
49
- 'post_status' => 'publish, inherit',
50
- 'numberposts' => -1,
51
- 'order' => "ASC",
52
- 'posts_per_page' => $per_page,
53
- );
54
-
55
- if ( isset( $_REQUEST['post_status'] ) )
56
- $this->args['post_status'] = $_REQUEST['post_status'];
57
-
58
- if ( isset( $_REQUEST['s'] ) )
59
- $this->args['s'] = $_REQUEST['s'];
60
-
61
- if ( isset( $_REQUEST['paged'] ) )
62
- $this->args['paged'] = $_REQUEST['paged'];
63
-
64
- $query = new WP_Query( $this->args );
65
-
66
- $this->items = $query->posts;
67
- $total_items = $query->found_posts;
68
- $total_pages = $query->max_num_pages;
69
-
70
- $this->set_pagination_args( array(
71
- 'total_items' => $total_items,
72
- 'total_pages' => $total_pages,
73
- 'per_page' => $per_page
74
- ) );
75
-
76
- if ( empty( $this->items ) )
77
- return;
78
-
79
- $ids = wp_list_pluck( $this->items, 'ID' );
80
- $object_terms = wp_get_object_terms( $ids, 'wpsc-variation', array( 'fields' => 'all_with_object_id' ) );
81
-
82
- foreach ( $object_terms as $term ) {
83
- if ( ! array_key_exists( $term->object_id, $this->object_terms_cache ) )
84
- $this->object_terms_cache[$term->object_id] = array();
85
-
86
- $this->object_terms_cache[$term->object_id][$term->parent] = $term->name;
87
- }
88
- }
89
-
90
- public function get_hidden_columns() {
91
- return array();
92
- }
93
-
94
- /**
95
- * Get a list of all, hidden and sortable columns, with filter applied
96
- *
97
- * @since 3.1.0
98
- * @access protected
99
- *
100
- * @return array
101
- */
102
- public function get_column_info() {
103
- if ( isset( $this->_column_headers ) )
104
- return $this->_column_headers;
105
-
106
- $screen = get_current_screen();
107
-
108
- $columns = $this->get_columns();
109
- $hidden = $this->get_hidden_columns();
110
- $_sortable = $this->get_sortable_columns();
111
-
112
- $sortable = array();
113
- foreach ( $_sortable as $id => $data ) {
114
- if ( empty( $data ) )
115
- continue;
116
-
117
- $data = (array) $data;
118
- if ( !isset( $data[1] ) )
119
- $data[1] = false;
120
-
121
- $sortable[$id] = $data;
122
- }
123
-
124
- $this->_column_headers = array( $columns, $hidden, $sortable );
125
-
126
- return $this->_column_headers;
127
- }
128
-
129
- public function get_columns() {
130
- $columns = array(
131
- 'cb' => '<input type="checkbox" />',
132
- 'title' => __( 'Title' , 'wp-e-commerce' ),
133
- 'sku' => __( 'SKU' , 'wp-e-commerce' ),
134
- 'price' => __( 'Price' , 'wp-e-commerce' ),
135
- 'sale_price' => __( 'Sale Price', 'wp-e-commerce' ),
136
- 'stock' => __( 'Stock' , 'wp-e-commerce' ),
137
- );
138
-
139
- if ( get_option( 'wpec_taxes_enabled' ) ) {
140
- $columns['tax'] = __( 'Taxable Amount', 'wp-e-commerce' );
141
- }
142
-
143
- return apply_filters( 'wpsc_variation_column_headers', $columns );
144
- }
145
-
146
- public function get_sortable_columns() {
147
- return array();
148
- }
149
-
150
- public function column_cb( $item ) {
151
- $checked = isset( $_REQUEST['variations'] ) ? checked( in_array( $item->ID, $_REQUEST['variations'] ), true, false ) : '';
152
- return sprintf(
153
- '<input type="checkbox" %1$s name="%2$s[]" value="%3$s" />',
154
- /*$1%s*/ $checked,
155
- /*$2%s*/ 'post',
156
- /*$3%s*/ $item->ID
157
- );
158
- }
159
-
160
- private function get_row_actions( $item ) {
161
- $post_type_object = get_post_type_object( 'wpsc-product' );
162
- $can_edit_post = current_user_can( $post_type_object->cap->edit_post, $item->ID );
163
-
164
- $actions = array();
165
-
166
- if ( apply_filters( 'wpsc_show_product_variations_edit_action', true, $item ) && $can_edit_post && 'trash' != $item->post_status ) {
167
- $actions['edit'] = '<a target="_blank" href="' . get_edit_post_link( $item->ID, true ) . '" title="' . esc_attr__( 'Edit this item', 'wp-e-commerce' ) . '">' . __( 'Edit', 'wp-e-commerce' ) . '</a>';
168
- }
169
-
170
- $actions['stock hide-if-no-js'] = '<a class="wpsc-variation-stock-editor-link" href="#" title="' . __( 'Show shipping editor', 'wp-e-commerce' ) . '">' . __( 'Edit Shipping', 'wp-e-commerce' ) . '</a>';
171
-
172
- if ( $item->post_status == 'draft' ) {
173
- $show_url = add_query_arg( array(
174
- 'bulk_action' => 'show',
175
- 'post' => $item->ID,
176
- 'bulk_action_nonce' => wp_create_nonce( 'wpsc_product_variations_bulk_action' ),
177
- ) );
178
- $actions['show'] = '<a class="wpsc-variation-show-link" href="' . esc_url( $show_url ) . '" title="' . __( 'Show this variation on the front-end', 'wp-e-commerce' ) . '">' . __( 'Publish', 'wp-e-commerce' ) . '</a>';
179
- } elseif ( in_array( $item->post_status, array( 'publish', 'inherit' ) ) ) {
180
- $hide_url = add_query_arg( array(
181
- 'bulk_action' => 'hide',
182
- 'post' => $item->ID,
183
- 'bulk_action_nonce' => wp_create_nonce( 'wpsc_product_variations_bulk_action' ),
184
- ) );
185
- $actions['hide'] = '<a class="wpsc-variation-hide-link" href="' . esc_url( $hide_url ) . '" title="' . __( 'Mark this variation as draft to hide it from the front-end.', 'wp-e-commerce' ) . '">' . __( 'Mark as Draft', 'wp-e-commerce' ) . '</a>';
186
- }
187
-
188
- if ( current_user_can( $post_type_object->cap->delete_post, $item->ID ) ) {
189
- $force_delete = 'trash' == $item->post_status || ! EMPTY_TRASH_DAYS;
190
- $redirect_url = urlencode( _wpsc_get_product_variation_form_url( $this->product_id ) );
191
- $delete_link = add_query_arg( '_wp_http_referer', $redirect_url, get_delete_post_link( $item->ID, '', $force_delete ) );
192
-
193
- if ( 'trash' == $item->post_status ) {
194
- $restore_url = admin_url( sprintf( $post_type_object->_edit_link, $item->ID ) );
195
- $restore_url = add_query_arg(
196
- array(
197
- 'action' => 'untrash',
198
- '_wp_http_referer' => $redirect_url,
199
- ),
200
- $restore_url
201
- );
202
- $restore_url = wp_nonce_url( $restore_url, 'untrash-post_' . $item->ID );
203
- $actions['untrash'] = "<a title='" . esc_attr__( 'Restore this item from the Trash', 'wp-e-commerce' ) . "' href='" . esc_url( $restore_url ) . "'>" . __( 'Restore', 'wp-e-commerce' ) . "</a>";
204
- } elseif ( EMPTY_TRASH_DAYS ) {
205
- $actions['trash'] = "<a class='submitdelete' title='" . esc_attr__( 'Move this item to the Trash', 'wp-e-commerce' ) . "' href='" . esc_url( $delete_link ) . "'>" . __( 'Trash', 'wp-e-commerce' ) . "</a>";
206
- }
207
-
208
- if ( $force_delete )
209
- $actions['delete'] = "<a class='submitdelete' title='" . esc_attr__( 'Delete this item permanently', 'wp-e-commerce' ) . "' href='" . esc_url( $delete_link ) . "'>" . __( 'Delete Permanently', 'wp-e-commerce' ) . "</a>";
210
- }
211
-
212
- return $actions;
213
- }
214
-
215
- public function column_title( $item ) {
216
- $title = implode( ', ', $this->object_terms_cache[$item->ID] );
217
- $thumbnail = wpsc_the_product_thumbnail( false, false, $item->ID, 'manage-products' );
218
- $show_edit_link = apply_filters( 'wpsc_show_product_variations_edit_action', true, $item );
219
-
220
- $nonce = wp_create_nonce( "wpsc_ajax_get_variation_gallery_{$item->ID}" );
221
- $save_gallery_nonce = wp_create_nonce( "wpsc_ajax_update_gallery_{$item->ID}" );
222
- $get_gallery_nonce = wp_create_nonce( "wpsc_ajax_get_gallery_{$item->ID}" );
223
-
224
- if ( ! $thumbnail )
225
- $thumbnail = WPSC_CORE_IMAGES_URL . '/no-image-uploaded.gif';
226
- ?>
227
- <div class="wpsc-product-variation-thumbnail">
228
- <a
229
- target="_blank"
230
- data-featured-nonce="<?php echo esc_attr( wp_create_nonce( "update-post_{$item->ID}" ) ); ?>"
231
- data-nonce="<?php echo esc_attr( $nonce ); ?>"
232
- data-save-gallery-nonce="<?php echo esc_attr( $save_gallery_nonce ); ?>"
233
- data-get-gallery-nonce="<?php echo esc_attr( $get_gallery_nonce ); ?>"
234
- data-image-id="<?php echo get_post_thumbnail_id( $item->ID ); ?>"
235
- data-id="<?php echo $item->ID; ?>"
236
- data-title="<?php echo esc_attr( $title ); ?>"
237
- href="<?php echo esc_url( admin_url( 'media-upload.php?post_id=' . $item->ID . '&width=640&height=566&product_variation=1' ) ) ?>"
238
- >
239
- <img id="wpsc-variation-thumbnail-<?php echo $item->ID; ?>" src="<?php echo esc_url( $thumbnail ); ?>" alt="" />
240
- </a>
241
- </div>
242
- <div class="wpsc-product-variation-title">
243
- <strong class="row-title">
244
- <?php if ( $show_edit_link ): ?>
245
- <a target="_blank" href="<?php echo esc_url( get_edit_post_link( $item->ID, true ) ); ?>" title="<?php esc_attr_e( 'Edit this item', 'wp-e-commerce' ); ?>">
246
- <?php endif; ?>
247
- <?php echo esc_html( apply_filters( 'wpsc_variation_name', $title, $item ) ); ?>
248
- <?php if ( $show_edit_link ): ?>
249
- </a>
250
- <?php endif; ?>
251
- </strong>
252
- <?php echo $this->row_actions( $this->get_row_actions( $item ) ); ?>
253
- </div>
254
- <?php
255
- }
256
-
257
- /**
258
- * Stock Column
259
- *
260
- * @uses get_product_meta Get product meta data.
261
- *
262
- * @param object $item Product
263
- */
264
- public function column_stock( $item ) {
265
- $stock = get_product_meta( $item->ID, 'stock', true );
266
- if ( is_numeric( $stock ) )
267
- $stock = absint( $stock );
268
- ?>
269
- <input type="text" name="wpsc_variations[<?php echo $item->ID; ?>][stock]" value="<?php echo esc_attr( $stock ); ?>" />
270
- <?php
271
- }
272
-
273
- public function column_price( $item ) {
274
- $price = get_product_meta( $item->ID, 'price', true );
275
- $price = wpsc_format_number( $price );
276
- ?>
277
- <input type="text" name="wpsc_variations[<?php echo $item->ID; ?>][price]" value="<?php echo esc_attr( $price ); ?>" />
278
- <?php
279
- }
280
-
281
- public function column_sale_price( $item ) {
282
- $sale_price = get_product_meta( $item->ID, 'special_price', true );
283
- if ( is_numeric( $sale_price ) )
284
- $sale_price = wpsc_format_number( $sale_price );
285
- ?>
286
- <input type="text" name="wpsc_variations[<?php echo $item->ID; ?>][sale_price]" value="<?php echo esc_attr( $sale_price ); ?>">
287
- <?php
288
- }
289
-
290
- public function column_sku( $item ) {
291
- $sku = get_product_meta( $item->ID, 'sku', true );
292
- ?>
293
- <input type="text" name="wpsc_variations[<?php echo $item->ID; ?>][sku]" value="<?php echo esc_attr( $sku ); ?>" />
294
- <?php
295
- }
296
-
297
- public function column_tax( $item ) {
298
- $meta = get_post_meta( $item->ID, '_wpsc_product_metadata', true );
299
- if ( ! $meta || ! isset( $meta['wpec_taxes_taxable_amount'] ) )
300
- $tax = '';
301
- else
302
- $tax = wpsc_format_number( $meta['wpec_taxes_taxable_amount'] );
303
- ?>
304
- <input type="text" name="wpsc_variations[<?php echo $item->ID; ?>][product_metadata][wpec_taxes_taxable_amount]" value="<?php echo esc_attr( $tax ); ?>" />
305
- <?php
306
- }
307
-
308
- public function column_default( $item, $column_name ) {
309
- $output = apply_filters( 'wpsc_manage_product_variations_custom_column', '', $column_name, $item );
310
- return $output;
311
- }
312
-
313
- private function shipping_editor( $item = false ) {
314
- static $alternate = '';
315
-
316
- if ( ! $item )
317
- $alternate = '';
318
- else
319
- $alternate = ( $alternate == '' ) ? ' alternate' : '';
320
-
321
- $row_class = $alternate;
322
-
323
- $style = '';
324
- $bulk = false;
325
- if ( ! $item ) {
326
- $item = get_post( $this->product_id );
327
- $field_name = "wpsc_bulk_edit[product_metadata]";
328
- $row_class .= " wpsc_bulk_edit_shipping";
329
- if ( $this->is_bulk_edit )
330
- $style = ' style="display:table-row;"';
331
- else
332
- $style = ' style="display:none;"';
333
- $bulk = true;
334
- } else {
335
- $field_name = "wpsc_variations[{$item->ID}][product_metadata]";
336
- }
337
- $colspan = count( $this->get_columns() ) - 1;
338
- ?>
339
- <tr class="wpsc-stock-editor-row inline-edit-row<?php echo $row_class; ?>"<?php echo $style; ?> id="wpsc-stock-editor-row-<?php echo $item->ID; ?>">
340
- <td></td>
341
- <td colspan="<?php echo $colspan; ?>" class="colspanchange">
342
- <h4><?php esc_html_e( 'Variation Shipping Editor', 'wp-e-commerce' ); ?></h4>
343
- <?php wpsc_product_shipping_forms( $item, $field_name, $bulk ); ?>
344
- </td>
345
- </tr>
346
- <?php
347
- }
348
-
349
- public function single_row( $item ) {
350
- static $count = 0;
351
- $count ++;
352
- $item->index = $count;
353
- parent::single_row( $item );
354
- $this->shipping_editor( $item );
355
- }
356
-
357
- /**
358
- * Generate the table navigation above or below the table
359
- *
360
- * @since 3.1.0
361
- * @access protected
362
- */
363
- public function display_tablenav( $which ) {
364
- ?>
365
- <div class="tablenav <?php echo esc_attr( $which ); ?>">
366
- <div class="alignleft actions">
367
- <?php $this->bulk_actions( $which ); ?>
368
- </div>
369
- <?php
370
- $this->extra_tablenav( $which );
371
- $this->pagination( $which );
372
- ?>
373
- <br class="clear" />
374
- </div>
375
- <?php
376
- }
377
-
378
- public function display_rows() {
379
- $this->display_bulk_edit_row();
380
- if ( ! $this->is_bulk_edit )
381
- parent::display_rows();
382
- }
383
-
384
- public function display_messages() {
385
- if ( isset($_REQUEST['locked']) || isset($_REQUEST['skipped']) || isset($_REQUEST['updated']) || isset($_REQUEST['deleted']) || isset($_REQUEST['trashed']) || isset($_REQUEST['untrashed']) )
386
- $messages = array();
387
- else
388
- return;
389
-
390
- if ( isset($_REQUEST['updated']) && (int) $_REQUEST['updated'] ) {
391
- $messages[] = sprintf( _n( '%s post updated.', '%s posts updated.', $_REQUEST['updated'], 'wp-e-commerce' ), number_format_i18n( $_REQUEST['updated'] ) );
392
- unset($_REQUEST['updated']);
393
- }
394
-
395
- if ( isset($_REQUEST['skipped']) && (int) $_REQUEST['skipped'] )
396
- unset($_REQUEST['skipped']);
397
-
398
- if ( isset($_REQUEST['locked']) && (int) $_REQUEST['locked'] ) {
399
- $messages[] = sprintf( _n( '%s item not updated, somebody is editing it.', '%s items not updated, somebody is editing them.', $_REQUEST['locked'], 'wp-e-commerce' ), number_format_i18n( $_REQUEST['locked'] ) );
400
- unset($_REQUEST['locked']);
401
- }
402
-
403
- if ( isset($_REQUEST['deleted']) && (int) $_REQUEST['deleted'] ) {
404
- $messages[] = sprintf( _n( 'Item permanently deleted.', '%s items permanently deleted.', $_REQUEST['deleted'], 'wp-e-commerce' ), number_format_i18n( $_REQUEST['deleted'] ) );
405
- unset($_REQUEST['deleted']);
406
- }
407
-
408
- if ( isset($_REQUEST['trashed']) && (int) $_REQUEST['trashed'] ) {
409
- $messages[] = sprintf( _n( 'Item moved to the Trash.', '%s items moved to the Trash.', $_REQUEST['trashed'], 'wp-e-commerce' ), number_format_i18n( $_REQUEST['trashed'] ) );
410
- $ids = isset($_REQUEST['ids']) ? $_REQUEST['ids'] : 0;
411
- $undo_url = wp_nonce_url( add_query_arg( array( 'doaction' => 'undo', 'action' => 'untrash', 'ids' => $ids ) ), 'bulk-posts' );
412
- $messages[] = '<a href="' . esc_url( $undo_url ) . '">' . __( 'Undo', 'wp-e-commerce' ) . '</a>';
413
- unset($_REQUEST['trashed']);
414
- }
415
-
416
- if ( isset($_REQUEST['untrashed']) && (int) $_REQUEST['untrashed'] ) {
417
- $messages[] = sprintf( _n( 'Item restored from the Trash.', '%s items restored from the Trash.', $_REQUEST['untrashed'], 'wp-e-commerce' ), number_format_i18n( $_REQUEST['untrashed'] ) );
418
- unset($_REQUEST['undeleted']);
419
- }
420
- ?>
421
- <div id="message" class="updated"><p>
422
- <?php
423
- echo join( ' ', $messages ); unset( $messages );
424
- $_SERVER['REQUEST_URI'] = esc_url( remove_query_arg( array('locked', 'skipped', 'updated', 'deleted', 'trashed', 'untrashed'), $_SERVER['REQUEST_URI'] ) );
425
- echo '</p></div>';
426
- }
427
-
428
- public function get_bulk_actions() {
429
- $actions = array();
430
-
431
- if ( $this->is_trash )
432
- $actions['untrash'] = __( 'Restore', 'wp-e-commerce' );
433
-
434
- if ( $this->is_draft )
435
- $actions['show'] = __( 'Publish', 'wp-e-commerce' );
436
- elseif ( $this->is_all || $this->is_publish )
437
- $actions['hide'] = __( 'Mark as Draft', 'wp-e-commerce' );
438
-
439
- $actions['edit'] = __( 'Edit', 'wp-e-commerce' );
440
-
441
- if ( $this->is_trash || !EMPTY_TRASH_DAYS )
442
- $actions['delete'] = __( 'Delete Permanently', 'wp-e-commerce' );
443
- else
444
- $actions['trash'] = __( 'Move to Trash', 'wp-e-commerce' );
445
-
446
- return $actions;
447
- }
448
-
449
- public function bulk_actions( $which = '' ) {
450
- $screen = get_current_screen();
451
-
452
- if ( is_null( $this->_actions ) ) {
453
- $no_new_actions = $this->_actions = $this->get_bulk_actions();
454
- // This filter can currently only be used to remove actions.
455
- $this->_actions = apply_filters( 'bulk_actions-' . $screen->id, $this->_actions );
456
- $this->_actions = array_intersect_assoc( $this->_actions, $no_new_actions );
457
- $two = '';
458
- } else {
459
- $two = '2';
460
- }
461
-
462
- if ( empty( $this->_actions ) )
463
- return;
464
-
465
- echo '<input type="hidden" name="bulk_action_nonce" value="' . wp_create_nonce( 'wpsc_product_variations_bulk_action' ) .'" />';
466
- echo "<select name='bulk_action$two'>\n";
467
- echo "<option value='-1' selected='selected'>" . __( 'Bulk Actions', 'wp-e-commerce' ) . "</option>\n";
468
-
469
- foreach ( $this->_actions as $name => $title ) {
470
- $class = 'edit' == $name ? ' class="hide-if-no-js"' : '';
471
-
472
- echo "\t<option value='$name'$class>$title</option>\n";
473
- }
474
-
475
- echo "</select>\n";
476
-
477
- submit_button( __( 'Apply', 'wp-e-commerce' ), 'action', false, false, array( 'id' => "doaction$two" ) );
478
- echo "\n";
479
- }
480
-
481
- public function current_action() {
482
- if ( isset( $_REQUEST['bulk_action'] ) && -1 != $_REQUEST['bulk_action'] )
483
- return $_REQUEST['bulk_action'];
484
-
485
- if ( isset( $_REQUEST['bulk_action2'] ) && -1 != $_REQUEST['bulk_action2'] )
486
- return $_REQUEST['bulk_action2'];
487
-
488
- return false;
489
- }
490
-
491
- private function count_variations() {
492
- global $wpdb;
493
- $query = $wpdb->prepare( "SELECT post_status, COUNT( * ) AS num_posts FROM {$wpdb->posts} WHERE post_type = 'wpsc-product' AND post_parent = %d GROUP BY post_status", $this->product_id );
494
- $results = $wpdb->get_results( $query );
495
-
496
- $return = array();
497
- foreach ( get_post_stati() as $state )
498
- $stats[$state] = 0;
499
-
500
- foreach ( $results as $row ) {
501
- $return[$row->post_status] = $row->num_posts;
502
- }
503
-
504
- return (object) $return;
505
- }
506
-
507
- public function get_views() {
508
- global $locked_post_status;
509
- $parent = get_post( $this->product_id );
510
- $avail_post_stati = get_available_post_statuses( 'wpsc-product' );
511
- $post_type_object = get_post_type_object( 'wpsc-product' );
512
- $post_type = $post_type_object->name;
513
- $url_base = add_query_arg( array(
514
- 'action' => 'wpsc_product_variations_table',
515
- 'product_id' => $_REQUEST['product_id'],
516
- '_wpnonce' => wp_create_nonce( 'wpsc_product_variations_table' ),
517
- ), admin_url( 'admin-ajax.php' ) );
518
-
519
- if ( !empty($locked_post_status) )
520
- return array();
521
-
522
- $status_links = array();
523
- $num_posts = $this->count_variations();
524
- $class = '';
525
-
526
- $current_user_id = get_current_user_id();
527
-
528
- if ( isset( $num_posts->inherit ) ) {
529
- $key = $parent->post_status;
530
- if ( ! isset( $num_posts->$key ) )
531
- $num_posts->$key = 0;
532
-
533
- $num_posts->$key += $num_posts->inherit;
534
- unset( $num_posts->inherit );
535
- }
536
-
537
- $total_posts = array_sum( (array) $num_posts );
538
-
539
- // Subtract post types that are not included in the admin all list.
540
- foreach ( get_post_stati( array('show_in_admin_all_list' => false) ) as $state ) {
541
- if ( isset( $num_posts->$state ) )
542
- $total_posts -= $num_posts->$state;
543
- }
544
-
545
- $class = empty( $class ) && empty( $_REQUEST['post_status'] ) && empty( $_REQUEST['show_sticky'] ) ? ' class="current"' : '';
546
- $status_links['all'] = "<a href='{$url_base}'$class>" . sprintf( _nx( 'All <span class="count">(%s)</span>', 'All <span class="count">(%s)</span>', $total_posts, 'posts', 'wp-e-commerce' ), number_format_i18n( $total_posts ) ) . '</a>';
547
-
548
- foreach ( get_post_stati(array('show_in_admin_status_list' => true), 'objects') as $status ) {
549
- $class = '';
550
-
551
- $status_name = $status->name;
552
-
553
- if ( $status_name == 'publish' )
554
- continue;
555
-
556
- if ( !in_array( $status_name, $avail_post_stati ) )
557
- continue;
558
-
559
- if ( empty( $num_posts->$status_name ) ) {
560
- if ( isset( $_REQUEST['post_status'] ) && $status_name == $_REQUEST['post_status'] )
561
- $num_posts->$_REQUEST['post_status'] = 0;
562
- else
563
- continue;
564
- }
565
-
566
- if ( isset($_REQUEST['post_status']) && $status_name == $_REQUEST['post_status'] )
567
- $class = ' class="current"';
568
-
569
- $status_links[$status_name] = "<a href='" . esc_url( add_query_arg( 'post_status', $status_name, $url_base ) ) ."'$class>" . sprintf( translate_nooped_plural( $status->label_count, $num_posts->$status_name ), number_format_i18n( $num_posts->$status_name ) ) . '</a>';
570
- }
571
-
572
- return $status_links;
573
- }
574
-
575
- public function set_bulk_edited_items( $item_ids ) {
576
- $this->prepare_items();
577
- $this->is_bulk_edit = true;
578
- foreach ( $this->items as $key => $item ) {
579
- if ( in_array( $item->ID, $item_ids ) ) {
580
- $this->bulk_edited_items[] = $item;
581
- unset( $this->items[$key] );
582
- }
583
- }
584
- $this->bulk_edited_item_ids = $item_ids;
585
- }
586
-
587
- private function display_bulk_edit_row() {
588
- $style = $this->is_bulk_edit ? '' : ' style="display:none";';
589
- $classes = 'wpsc-bulk-edit';
590
- if ( $this->is_bulk_edit )
591
- $classes .= ' active';
592
- echo "<tr{$style} class='{$classes}'>";
593
- list( $columns, $hidden ) = $this->get_column_info();
594
- foreach ( $columns as $column_name => $column_display_name ) {
595
- $class = "class='$column_name column-$column_name inline-edit-row'";
596
- $style = '';
597
-
598
- if ( in_array( $column_name, $hidden ) )
599
- $style = ' style="display:none;"';
600
-
601
- $attributes = "$class$style";
602
-
603
- if ( $column_name == 'cb' )
604
- echo '<td></td>';
605
- elseif ( method_exists( $this, 'bulk_edit_column_' . $column_name ) ) {
606
- echo "<td $attributes>";
607
- echo call_user_func( array( &$this, 'bulk_edit_column_' . $column_name ) );
608
- echo "</td>";
609
- }
610
- }
611
- echo '</tr>';
612
- $this->shipping_editor();
613
- }
614
-
615
- public function bulk_edit_column_title() {
616
- ?>
617
- <div class="wpsc-bulk-edit-items">
618
- <?php foreach ( $this->bulk_edited_items as $item ):
619
- $title = implode( ', ', $this->object_terms_cache[$item->ID] );
620
- ?>
621
- <div class="wpsc-bulk-edit-item">
622
- <span>
623
- <input type="checkbox" name="wpsc_bulk_edit[post][]" checked="checked" value="<?php echo $item->ID; ?>" />
624
- </span>
625
- <strong>
626
- <a class="row-title" href="<?php echo get_edit_post_link( $item->ID ); ?>" title="<?php esc_attr_e( 'Edit this variation', 'wp-e-commerce' ) ?>"><?php echo esc_html( $title ); ?></a>
627
- </strong>
628
- </div>
629
- <?php endforeach; ?>
630
- </div>
631
- <?php
632
- }
633
-
634
- public function bulk_edit_column_stock() {
635
- ?>
636
- <input class="wpsc-bulk-edit-fields" type="checkbox" name="wpsc_bulk_edit[fields][stock]" value="1" />
637
- <input tabindex="101" type="text" name="wpsc_bulk_edit[stock]" value="" />
638
- <?php
639
- }
640
-
641
- public function bulk_edit_column_price() {
642
- ?>
643
- <input class="wpsc-bulk-edit-fields" type="checkbox" name="wpsc_bulk_edit[fields][price]" value="1" />
644
- <input tabindex="103" type="text" name="wpsc_bulk_edit[price]" value="" />
645
- <?php
646
- }
647
-
648
- public function bulk_edit_column_tax() {
649
- ?>
650
- <input class="wpsc-bulk-edit-fields" type="checkbox" name="wpsc_bulk_edit[fields][wpec_taxes_taxable_amount]" value="1" />
651
- <input tabindex="102" type="text" name="wpsc_bulk_edit[product_metadata][wpec_taxes_taxable_amount]" value="" />
652
- <?php
653
- }
654
-
655
- public function bulk_edit_column_sku() {
656
- ?>
657
- <input class="wpsc-bulk-edit-fields" type="checkbox" name="wpsc_bulk_edit[fields][sku]" value="1" />
658
- <input tabindex="105" type="text" name="wpsc_bulk_edit[sku]" value="" />
659
- <?php
660
- }
661
-
662
- public function bulk_edit_column_sale_price() {
663
- $sale_price = get_product_meta( $this->product_id, 'special_price', true );
664
- ?>
665
- <input class="wpsc-bulk-edit-fields" type="checkbox" name="wpsc_bulk_edit[fields][sale_price]" value="1" />
666
- <input tabindex="104" type="text" name="wpsc_bulk_edit[sale_price]" value="">
667
- <?php
668
- }
669
-
670
- public function extra_tablenav( $which ) {
671
- $post_type_object = get_post_type_object( 'wpsc-product' );
672
- ?><div class="alignleft actions"><?php
673
- if ( $this->is_trash && current_user_can( $post_type_object->cap->edit_others_posts ) ) {
674
- submit_button( __( 'Empty Trash', 'wp-e-commerce' ), 'button-secondary apply', 'delete_all', false );
675
- }
676
- ?></div><?php
677
- }
678
- }
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
trunk/wpsc-admin/includes/product-variations-manage.page.php DELETED
@@ -1,13 +0,0 @@
1
- <?php $this->list_table->display_messages(); ?>
2
- <form action="" method="post">
3
- <?php $this->list_table->views(); ?>
4
- <div class="alignright actions wpsc-save-product-variations top">
5
- <?php submit_button( __( 'Save Variations', 'wp-e-commerce' ) ); ?>
6
- </div>
7
- <input type="hidden" name="post_status" class="post_status_page" value="<?php echo !empty($_REQUEST['post_status']) ? esc_attr($_REQUEST['post_status']) : 'all'; ?>" />
8
- <?php wp_nonce_field( 'wpsc_save_variations_meta', '_wpsc_save_meta_nonce' ); ?>
9
- <?php $this->list_table->display(); ?>
10
- <div class="alignright actions wpsc-save-product-variations bottom">
11
- <?php submit_button( __( 'Save Variations', 'wp-e-commerce' ) ); ?>
12
- </div>
13
- </form>
 
 
 
 
 
 
 
 
 
 
 
 
 
trunk/wpsc-admin/includes/product-variations-page.class.php DELETED
@@ -1,437 +0,0 @@
1
- <?php
2
-
3
- /**
4
- * The Product Variations page class in the WordPress admin
5
- *
6
- * @package wp-e-commerce
7
- */
8
-
9
- class WPSC_Product_Variations_Page {
10
- private $list_table;
11
- private $parent_id;
12
- private $current_tab;
13
- private $post;
14
-
15
- public function __construct() {
16
- require_once( WPSC_FILE_PATH . '/wpsc-admin/includes/product-variation-list-table.class.php' );
17
- $GLOBALS['hook_suffix'] = 'wpsc-product-variations-iframe';
18
- $this->parent_id = absint( $_REQUEST['product_id'] );
19
- set_current_screen();
20
-
21
- if ( ! empty( $_REQUEST['tab'] ) ) {
22
- $this->current_tab = $_REQUEST['tab'];
23
- } else {
24
- $args = array(
25
- 'post_parent' => $this->parent_id,
26
- 'post_type' => 'wpsc-product',
27
- 'post_status' => 'any');
28
-
29
- $number_of_variations = count(get_children($args));
30
-
31
- $this->current_tab = ($number_of_variations > 0) ? 'manage' : 'setup';
32
- }
33
- }
34
-
35
- private function merge_meta_deep( $original, $updated ) {
36
- $keys = array_merge( array_keys( $original ), array_keys( $updated ) );
37
-
38
- foreach ( $keys as $key ) {
39
- if ( ! isset( $updated[$key] ) )
40
- continue;
41
-
42
- if ( isset( $original[$key] ) && is_array( $original[$key] ) ) {
43
- $original[$key] = $this->merge_meta_deep( $original[$key] , $updated[$key] );
44
- } else {
45
- $original[$key] = $updated[$key];
46
- if ( in_array( $key, array( 'weight', 'wpec_taxes_taxable_amount', 'height', 'width', 'length' ) ) )
47
- $original[$key] = (float) $original[$key];
48
- }
49
-
50
- }
51
-
52
- return $original;
53
- }
54
-
55
- /* */
56
- private function save_variation_meta( $id, $data ) {
57
-
58
- $product_meta = get_product_meta( $id, 'product_metadata', true );
59
-
60
- if ( ! is_array( $product_meta ) ) {
61
- $product_meta = array();
62
- }
63
-
64
- $product_meta = $this->merge_meta_deep( $product_meta, $data['product_metadata'] );
65
-
66
- // convert to pound to maintain backward compat with shipping modules
67
- if ( isset( $data['product_metadata']['weight'] ) || isset( $data['product_metadata']['weight_unit'] ) ) {
68
- $product_meta['weight'] = wpsc_convert_weight( $product_meta['weight'], $product_meta['weight_unit'], 'pound', true );
69
- }
70
-
71
- update_product_meta( $id, 'product_metadata', $product_meta );
72
-
73
- if ( isset( $data['price'] ) ) {
74
- update_product_meta( $id, 'price', wpsc_string_to_float( $data['price'] ) );
75
- }
76
-
77
- if ( isset( $data['sale_price'] ) ) {
78
-
79
- $sale_price = wpsc_string_to_float( $data['sale_price'] );
80
-
81
- if ( is_numeric( $sale_price ) ) {
82
- update_product_meta( $id, 'special_price', wpsc_string_to_float( $data['sale_price'] ) );
83
- } else {
84
- update_product_meta( $id, 'special_price', '' );
85
- }
86
- }
87
-
88
- if ( isset( $data['sku'] ) ) {
89
- update_product_meta( $id, 'sku', sanitize_text_field( $data['sku'] ) );
90
- }
91
-
92
- if ( isset( $data['stock'] ) ) {
93
- if ( is_numeric( $data['stock'] ) ) {
94
- update_product_meta( $id, 'stock', (int) $data['stock'] );
95
- $parent_id = wpsc_product_is_variation( $id );
96
-
97
- if( $parent_id ) {
98
- // If product is a variatio get the notification threshold from parent product
99
- $parent_meta = get_product_meta( $parent_id, 'product_metadata', true );
100
- $notify_limit = $parent_meta['stock_limit_notify'];
101
- if ( (int) $data['stock'] > $notify_limit ) {
102
- // Check if notification has been sent
103
- $notify_sent = get_product_meta( $id, 'stock_limit_notify_sent', true );
104
- if( ! empty( $notify_sent ) ) {
105
- delete_product_meta( $id, 'stock_limit_notify_sent' );
106
- }
107
- }
108
- }
109
- } else {
110
- update_product_meta( $id, 'stock', '' );
111
- }
112
- }
113
- }
114
-
115
- private function save_variations_meta(){
116
- if ( empty( $_REQUEST['wpsc_variations'] ) )
117
- return;
118
-
119
- check_admin_referer( 'wpsc_save_variations_meta', '_wpsc_save_meta_nonce' );
120
- $post_type_object = get_post_type_object( 'wpsc-product' );
121
- if ( ! current_user_can( $post_type_object->cap->edit_posts ) )
122
- wp_die( __( 'Cheatin&#8217; uh?', 'wp-e-commerce' ) );
123
-
124
- /* Long-term, we should have a better saving routine here. Can't unset these currently. *
125
- /* That said, the only thing that fails hard if we can't unset it is the checkbox. */
126
- foreach ( $_REQUEST['wpsc_variations'] as $id => $data ) {
127
- if ( ! isset( $data['product_metadata']['no_shipping'] ) ) {
128
- $data['product_metadata']['no_shipping'] = '';
129
- }
130
- $this->save_variation_meta( $id, $data );
131
- }
132
- }
133
-
134
- public function display() {
135
- global $title, $hook_suffix, $wp_locale, $pagenow, $wp_version, $is_iphone,
136
- $current_site, $update_title, $total_update_count, $parent_file;
137
-
138
- $current_screen = get_current_screen();
139
- $admin_body_class = $hook_suffix;
140
- $post_type_object = get_post_type_object( 'wpsc-product' );
141
-
142
- wp_enqueue_style( 'global' );
143
- wp_enqueue_style( 'wp-admin' );
144
- wp_enqueue_style( 'buttons' );
145
- wp_enqueue_style( 'colors' );
146
- wp_enqueue_style( 'ie' );
147
- wp_enqueue_script( 'common' );
148
- wp_enqueue_script( 'jquery-color' );
149
- wp_enqueue_script( 'utils' );
150
- wp_enqueue_script( 'jquery-query' );
151
- wp_enqueue_media( array( 'post' => absint( $_REQUEST['product_id'] ) ) );
152
-
153
-
154
- $callback = "callback_tab_{$this->current_tab}";
155
- if ( ! is_callable( array( $this, "callback_tab_{$this->current_tab}" ) ) )
156
- $callback = "callback_tab_manage";
157
-
158
- $this->$callback();
159
-
160
- @header('Content-Type: ' . get_option('html_type') . '; charset=' . get_option('blog_charset'));
161
- require_once( WPSC_FILE_PATH . "/wpsc-admin/includes/product-variations.page.php" );
162
- }
163
-
164
- private function display_tabs() {
165
- $tabs = array(
166
- 'manage' => _x( 'Manage', 'manage product variations', 'wp-e-commerce' ),
167
- 'setup' => __( 'Setup', 'wp-e-commerce' ),
168
- );
169
-
170
- echo '<ul id="wpsc-product-variations-tabs" class="category-tabs">';
171
- foreach ( $tabs as $tab => $title ) {
172
- $class = ( $tab == $this->current_tab ) ? ' class="tabs"' : '';
173
- $item = '<li' . $class . '>';
174
- $item .= '<a href="' . esc_url( add_query_arg( 'tab', $tab ) ) . '">' . esc_html( $title ) . '</a></li> ';
175
- echo $item;
176
- }
177
- echo '</ul>';
178
- }
179
-
180
- private function callback_tab_manage() {
181
- $this->list_table = new WPSC_Product_Variation_List_Table( $this->parent_id );
182
- $this->save_variations_meta();
183
- $this->process_bulk_action();
184
- $this->list_table->prepare_items();
185
- }
186
-
187
- private function callback_tab_setup() {
188
- global $post;
189
- require_once( 'walker-variation-checklist.php' );
190
-
191
- $this->generate_variations();
192
- }
193
-
194
- private function generate_variations() {
195
- if ( ! isset( $_REQUEST['action2'] ) || $_REQUEST['action2'] != 'generate' )
196
- return;
197
-
198
- check_admin_referer( 'wpsc_generate_product_variations', '_wpsc_generate_product_variations_nonce' );
199
-
200
- wpsc_update_variations();
201
-
202
- $sendback = remove_query_arg( array(
203
- '_wp_http_referer',
204
- 'updated',
205
- ) );
206
- wp_redirect( esc_url_raw( add_query_arg( 'tab', 'manage', $sendback ) ) );
207
- exit;
208
- }
209
-
210
- public function display_current_tab() {
211
- require_once( WPSC_FILE_PATH . "/wpsc-admin/includes/product-variations-{$this->current_tab}.page.php" );
212
- }
213
-
214
- public function process_bulk_action_delete_all( $post_ids ) {
215
- $post_status = preg_replace( '/[^a-z0-9_-]+/i', '', $_REQUEST['post_status'] );
216
- if ( get_post_status_object( $post_status ) ) // Check the post status exists first
217
- $post_ids = $wpdb->get_col( $wpdb->prepare( "SELECT ID FROM $wpdb->posts WHERE post_type='wpsc-product' AND post_status = %s", $post_type, $post_status ) );
218
-
219
- return $this->process_bulk_action_delete( $post_ids );
220
- }
221
-
222
- public function process_bulk_action_trash( $post_ids ) {
223
- $post_type_object = get_post_type_object( 'wpsc-product' );
224
- $trashed = 0;
225
- foreach( (array) $post_ids as $post_id ) {
226
- if ( !current_user_can( $post_type_object->cap->delete_post, $post_id ) )
227
- wp_die( __( 'You are not allowed to move this item to the Trash.', 'wp-e-commerce' ) );
228
-
229
- if ( !wp_trash_post( $post_id ) )
230
- wp_die( __( 'Error in moving to Trash.', 'wp-e-commerce' ) );
231
-
232
- $trashed++;
233
- }
234
- return esc_url( add_query_arg( array( 'trashed' => $trashed, 'ids' => join( ',', $post_ids ) ) ) );
235
- }
236
-
237
- public function process_bulk_action_untrash( $post_ids ) {
238
- $post_type_object = get_post_type_object( 'wpsc-product' );
239
- $untrashed = 0;
240
- foreach( (array) $post_ids as $post_id ) {
241
- if ( ! current_user_can( $post_type_object->cap->delete_post, $post_id ) )
242
- wp_die( __( 'You are not allowed to restore this item from the Trash.', 'wp-e-commerce' ) );
243
-
244
- if ( !wp_untrash_post( $post_id ) )
245
- wp_die( __( 'Error in restoring from Trash.', 'wp-e-commerce' ) );
246
-
247
- $untrashed++;
248
- }
249
- return esc_url( add_query_arg( 'untrashed', $untrashed ) );
250
- }
251
-
252
- public function process_bulk_action_delete( $post_ids ) {
253
- $deleted = 0;
254
- $post_type_object = get_post_type_object( 'wpsc-product' );
255
- foreach( (array) $post_ids as $post_id ) {
256
- $post_del = & get_post( $post_id );
257
-
258
- if ( ! current_user_can( $post_type_object->cap->delete_post, $post_id ) )
259
- wp_die( __( 'You are not allowed to delete this item.', 'wp-e-commerce' ) );
260
-
261
- if ( $post_del->post_type == 'attachment' ) {
262
- if ( ! wp_delete_attachment( $post_id ) )
263
- wp_die( __( 'Error in deleting...', 'wp-e-commerce' ) );
264
- } else {
265
- if ( ! wp_delete_post( $post_id ) )
266
- wp_die( __( 'Error in deleting...', 'wp-e-commerce' ) );
267
- }
268
- $deleted++;
269
- }
270
- return esc_url( add_query_arg( 'deleted', $deleted ) );
271
- }
272
-
273
- public function process_bulk_action_hide( $post_ids ) {
274
- $updated = 0;
275
- foreach( $post_ids as $id ) {
276
- wp_update_post( array(
277
- 'ID' => $id,
278
- 'post_status' => 'draft',
279
- ) );
280
- $updated ++;
281
- }
282
- return esc_url( add_query_arg( 'updated', $updated ) );
283
- }
284
-
285
- public function process_bulk_action_show( $post_ids ) {
286
- $updated = 0;
287
- foreach ( $post_ids as $id ) {
288
- wp_update_post( array(
289
- 'ID' => $id,
290
- 'post_status' => 'publish',
291
- ) );
292
- $updated ++;
293
- }
294
- return esc_url( add_query_arg( 'updated', $updated ) );
295
- }
296
-
297
- private function save_bulk_edited_items() {
298
- $ids = array_map( 'absint', $_REQUEST['wpsc_bulk_edit']['post'] );
299
- $data = $_REQUEST['wpsc_bulk_edit'];
300
-
301
- if ( empty( $_REQUEST['wpsc_bulk_edit']['fields'] ) )
302
- return;
303
-
304
- $fields = $_REQUEST['wpsc_bulk_edit']['fields'];
305
-
306
- foreach ( array( 'stock', 'price', 'sale_price', 'sku' ) as $field ) {
307
- if ( empty( $fields[$field] ) )
308
- unset( $data[$field] );
309
- }
310
-
311
- if ( empty( $fields['shipping'] ) )
312
- unset( $data['product_metadata']['shipping'] );
313
- else {
314
- foreach ( array( 'local', 'international' ) as $field ) {
315
- if ( empty( $fields['shipping'][$field] ) )
316
- unset( $data['product_metadata'][$field] );
317
- }
318
- }
319
-
320
- if ( empty( $fields['measurements'] ) ) {
321
- unset( $data['product_metadata']['dimensions'] );
322
- unset( $data['product_metadata']['weight'] );
323
- unset( $data['product_metadata']['weight_unit'] );
324
- } else {
325
- if ( empty( $fields['measurements']['weight'] ) ) {
326
- unset( $data['product_metadata']['weight'] );
327
- unset( $data['product_metadata']['weight_unit'] );
328
- }
329
-
330
- if ( empty( $fields['measurements']['dimensions'] ) ) {
331
- foreach ( array( 'height', 'width', 'length' ) as $field ) {
332
- unset( $data['product_metadata']['dimensions'][$field] );
333
- unset( $data['product_metadata']['dimensions'][$field . '_unit'] );
334
- }
335
- } else {
336
- foreach ( array( 'height', 'width', 'length' ) as $field ) {
337
- $data['product_metadata']['dimensions'][$field . '_unit'] = "cm";
338
- }
339
- }
340
-
341
- unset( $data['product_metadata']['dimensions_unit'] );
342
- }
343
-
344
- unset( $data['post'] );
345
- unset( $data['fields'] );
346
-
347
- foreach ( $ids as $id ) {
348
- $this->save_variation_meta( $id, $data );
349
- }
350
-
351
- $sendback = $_SERVER['REQUEST_URI'];
352
- $sendback = remove_query_arg( array(
353
- '_wp_http_referer',
354
- 'bulk_action',
355
- 'bulk_action2',
356
- 'bulk_action_nonce',
357
- 'confirm',
358
- 'post',
359
- 'last_paged'
360
- ), $sendback );
361
- $sendback = add_query_arg( 'updated', count( $ids ), $sendback );
362
- wp_redirect( esc_url_raw( $sendback ) );
363
- exit;
364
- }
365
-
366
- public function process_bulk_action_edit( $post_ids ) {
367
- $this->list_table->set_bulk_edited_items( $post_ids );
368
- }
369
-
370
- public function process_bulk_action() {
371
- if ( ! empty( $_REQUEST['wpsc_bulk_edit']['post'] ) ) {
372
- $this->save_bulk_edited_items();
373
- return;
374
- }
375
-
376
- $current_action = $this->list_table->current_action();
377
- if ( empty( $current_action ) )
378
- return;
379
-
380
- _wpsc_remove_refresh_variation_parent_term_hooks();
381
-
382
- check_admin_referer( 'wpsc_product_variations_bulk_action', 'bulk_action_nonce' );
383
- $sendback = $_SERVER['REQUEST_URI'];
384
- $callback = 'process_bulk_action_' . $current_action;
385
-
386
- $post_ids = isset( $_REQUEST['post'] ) ? $_REQUEST['post'] : array();
387
- if ( ! is_array( $post_ids ) )
388
- $post_ids = explode( ',', $post_ids );
389
- $post_ids = array_map('intval', $post_ids);
390
- if ( ! empty( $post_ids ) && is_callable( array( $this, $callback ) ) )
391
- $sendback = $this->$callback( $post_ids );
392
-
393
- $sendback = remove_query_arg( array(
394
- '_wp_http_referer',
395
- 'bulk_action',
396
- 'bulk_action2',
397
- 'bulk_action_nonce',
398
- 'confirm',
399
- 'post',
400
- 'last_paged'
401
- ), $sendback );
402
-
403
- _wpsc_refresh_parent_product_terms( $this->parent_id );
404
- _wpsc_add_refresh_variation_parent_term_hooks();
405
- if ( $current_action != 'edit' ) {
406
- wp_redirect( esc_url_raw( $sendback ) );
407
- exit;
408
- }
409
- }
410
- }
411
-
412
- /**
413
- * Wrapper for _wp_admin_html_begin(), which might not be available on older
414
- * WordPress versions.
415
- *
416
- * @access private
417
- * @since 3.8.9.4
418
- */
419
- function _wpsc_admin_html_begin() {
420
- if ( function_exists( '_wp_admin_html_begin' ) ) {
421
- _wp_admin_html_begin();
422
- return;
423
- }
424
-
425
- $admin_html_class = ( is_admin_bar_showing() ) ? 'wp-toolbar' : '';
426
- ?>
427
- <!DOCTYPE html>
428
- <!--[if IE 8]>
429
- <html xmlns="http://www.w3.org/1999/xhtml" class="ie8 <?php echo $admin_html_class; ?>" <?php do_action('admin_xml_ns'); ?> <?php language_attributes(); ?>>
430
- <![endif]-->
431
- <!--[if !(IE 8) ]><!-->
432
- <html xmlns="http://www.w3.org/1999/xhtml" class="<?php echo $admin_html_class; ?>" <?php do_action('admin_xml_ns'); ?> <?php language_attributes(); ?>>
433
- <!--<![endif]-->
434
- <head>
435
- <meta http-equiv="Content-Type" content="<?php bloginfo('html_type'); ?>; charset=<?php echo get_option('blog_charset'); ?>" />
436
- <?php
437
- }
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
trunk/wpsc-admin/includes/product-variations-setup.page.php DELETED
@@ -1,40 +0,0 @@
1
- <div id="product_variations">
2
- <h4><a href="#wpsc_variation_metabox" class="add_variation_set_action"><?php esc_html_e( '+ Add New Variants', 'wp-e-commerce' ) ?></a></h4>
3
-
4
- <div id="add-new-variation-set">
5
- <p>
6
- <label for="new-variation-set-name"><?php esc_html_e( "Enter variation set's name", 'wp-e-commerce' ); ?></label>
7
- <input type="text" class="text-field" id="new-variation-set-name" /><br />
8
- </p>
9
- <p class="howto"><?php esc_html_e( "Example: Color. If you want to add variants to an existing set, you can enter the name of that set here.", 'wp-e-commerce' ); ?></p>
10
- <p>
11
- <label for="new-variants"><?php esc_html_e( "Enter new variants", 'wp-e-commerce' ); ?></label>
12
- <input type="text" class="text-field" id="new-variants" /><br />
13
- </p>
14
- <p class="howto"><?php esc_html_e( "Example: Red, Green, Blue. Separate variants with commas.", 'wp-e-commerce' ); ?></p>
15
- <p>
16
- <a class="button" href="#"><?php esc_html_e( 'Add New Variants', 'wp-e-commerce' ); ?></a>
17
- <img src="<?php echo esc_url( wpsc_get_ajax_spinner() ); ?>" class="ajax-feedback" title="" alt="" /><br class="clear" />
18
- </p>
19
- </div>
20
-
21
- <p><a name='variation_control'>&nbsp;</a><?php _e( 'Select the Variation sets and then the corresponding Variants you want to add to this product.', 'wp-e-commerce' ) ?></p>
22
-
23
- <form action="" method="post">
24
- <ul class="variation_checkboxes">
25
- <?php
26
- wp_terms_checklist( $this->parent_id, array(
27
- 'taxonomy' => 'wpsc-variation',
28
- 'walker' => new WPSC_Walker_Variation_Checklist(),
29
- 'checked_ontop' => false,
30
- ) );
31
- ?>
32
- </ul>
33
- <input type="hidden" name="action2" value="generate" />
34
- <input type="hidden" name="product_id" value="<?php echo $this->parent_id; ?>" />
35
- <?php wp_nonce_field( 'wpsc_generate_product_variations', '_wpsc_generate_product_variations_nonce' ); ?>
36
- <?php submit_button( __( 'Generate Variations', 'wp-e-commerce' ) ); ?>
37
- </form>
38
-
39
- <div class="clear"></div>
40
- </div>
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
trunk/wpsc-admin/includes/product-variations.page.php DELETED
@@ -1,59 +0,0 @@
1
- <?php _wpsc_admin_html_begin(); ?>
2
- <title><?php esc_html_e( 'Manage Product Variations', 'wp-e-commerce' ); ?></title>
3
- <script type="text/javascript">
4
- addLoadEvent = function(func){if(typeof jQuery!="undefined")jQuery(document).ready(func);else if(typeof wpOnload!='function'){wpOnload=func;}else{var oldonload=wpOnload;wpOnload=function(){oldonload();func();}}};
5
- var userSettings = {
6
- 'url': '<?php echo SITECOOKIEPATH; ?>',
7
- 'uid': '<?php if ( ! isset($current_user) ) $current_user = wp_get_current_user(); echo $current_user->ID; ?>',
8
- 'time':'<?php echo time() ?>'
9
- },
10
- ajaxurl = '<?php echo admin_url( 'admin-ajax.php', 'relative' ); ?>',
11
- pagenow = '<?php echo $current_screen->id; ?>',
12
- typenow = '<?php echo $current_screen->post_type; ?>',
13
- adminpage = '<?php echo $admin_body_class; ?>',
14
- thousandsSeparator = '<?php echo addslashes( $wp_locale->number_format['thousands_sep'] ); ?>',
15
- decimalPoint = '<?php echo addslashes( $wp_locale->number_format['decimal_point'] ); ?>',
16
- isRtl = <?php echo (int) is_rtl(); ?>;
17
- </script>
18
- <?php
19
- do_action('admin_enqueue_scripts', $hook_suffix);
20
- do_action("admin_print_styles-$hook_suffix");
21
- do_action('admin_print_styles');
22
- do_action("admin_print_scripts-$hook_suffix");
23
- do_action('admin_print_scripts');
24
- do_action("admin_head-$hook_suffix");
25
- do_action('admin_head');
26
- ?>
27
- <style type="text/css">
28
- html {
29
- background-color:transparent;
30
- }
31
- </style>
32
- </head>
33
- <?php
34
-
35
- $admin_body_class = ' branch-' . str_replace( array( '.', ',' ), '-', floatval( $wp_version ) );
36
- $admin_body_class .= ' version-' . str_replace( '.', '-', preg_replace( '/^([.0-9]+).*/', '$1', $wp_version ) );
37
- $admin_body_class .= ' admin-color-' . sanitize_html_class( get_user_option( 'admin_color' ), 'fresh' );
38
- $admin_body_class .= ' locale-' . sanitize_html_class( strtolower( str_replace( '_', '-', get_locale() ) ) );
39
-
40
- ?>
41
- <body class="no-js wp-admin wp-core-ui wpsc-product-variation-iframe<?php echo $admin_body_class; ?>">
42
- <script type="text/javascript">document.body.className = document.body.className.replace('no-js','js');</script>
43
-
44
- <div id="post-body">
45
- <div id="wpsc-product-variations-wrapper" class="categorydiv wpsc-categorydiv">
46
- <?php $this->display_tabs(); ?>
47
- <div class="wpsc-product-variations-tab-content tabs-panel">
48
- <?php $this->display_current_tab(); ?>
49
- </div>
50
- </div>
51
- </div>
52
-
53
- <?php
54
- do_action('admin_print_footer_scripts');
55
- do_action("admin_footer-" . $GLOBALS['hook_suffix']);
56
- ?>
57
- <script type="text/javascript">if(typeof wpOnload=='function')wpOnload();</script>
58
- </body>
59
- </html>
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
trunk/wpsc-admin/includes/products.php DELETED
@@ -1 +0,0 @@
1
- <?php //Deprecated file ?>
 
trunk/wpsc-admin/includes/purchase-log-action-links.php DELETED
@@ -1,482 +0,0 @@
1
- <?php
2
-
3
- /**
4
- * Purchase Log Action Links Class
5
- *
6
- * Manages and displays a links of action links when editing a puchase log.
7
- *
8
- * @package wp-e-commerce
9
- * @since 3.9.0
10
- *
11
- * @link https://github.com/wp-e-commerce/WP-e-Commerce/pull/1562
12
- */
13
- class WPSC_Purchase_Log_Action_Links {
14
-
15
- /**
16
- * Purchase Log ID.
17
- *
18
- * @since 3.9.0
19
- * @access private
20
- * @var int
21
- */
22
- protected $log_id;
23
-
24
- /**
25
- * An array of WPSC_Purchase_Log_Action_Link objects.
26
- *
27
- * @since 3.9.0
28
- * @access private
29
- * @var array
30
- */
31
- protected $links;
32
-
33
- /**
34
- * Setup all action links.
35
- *
36
- * @since 3.9.0
37
- *
38
- * @param int $log_id Purchase log ID.
39
- */
40
- public function __construct( $log_id ) {
41
-
42
- $this->log_id = absint( $log_id );
43
-
44
- // Create and validate links.
45
- $this->_create_links();
46
- $this->_validate_links();
47
-
48
- }
49
-
50
- /**
51
- * Create Action Links
52
- *
53
- * Packing slip and email receipt links are available by default.
54
- * Action links are filterable via the 'wpsc_purchlogitem_links' filter which passes the purchase log ID.
55
- * Delete and back links are always required and added after the filter.
56
- *
57
- * @since 3.9.0
58
- * @access private
59
- */
60
- private function _create_links() {
61
-
62
- // Add default links.
63
- if ( wpsc_purchlogs_have_downloads_locked() !== false ) {
64
- $this->links[] = $this->get_downloads_lock_link();
65
- }
66
- $this->links[] = $this->get_packing_slip_link();
67
- $this->links[] = $this->get_email_receipt_link();
68
-
69
- // Filter action links.
70
- $this->links = apply_filters( 'wpsc_purchlogitem_links', $this->links, $this->log_id );
71
-
72
- // Add delete and back links.
73
- $this->links[] = $this->_get_delete_link();
74
- $this->links[] = $this->_get_back_link();
75
-
76
- }
77
-
78
- /**
79
- * Validate Links
80
- *
81
- * Validates all links are WPSC_Purchase_Log_Action_Link objects.
82
- *
83
- * @since 3.9.0
84
- * @access private
85
- */
86
- private function _validate_links() {
87
-
88
- $this->links = array_map( array( $this, '_validate_link' ), $this->links );
89
- $this->links = array_filter( $this->links );
90
-
91
- }
92
-
93
- /**
94
- * Validate Link
95
- *
96
- * Validates a WPSC_Purchase_Log_Action_Link object.
97
- *
98
- * @since 3.9.0
99
- * @access private
100
- *
101
- * @todo Check that the WPSC_Purchase_Log_Action_Link ID is unique and reject if not - maybe not here.
102
- *
103
- * @param WPSC_Purchase_Log_Action_Link $action_link Action link object.
104
- * @return WPSC_Purchase_Log_Action_Link|boolean If valid, the action link object, otherwise false.
105
- */
106
- private function _validate_link( $action_link ) {
107
-
108
- if ( is_a( $action_link, 'WPSC_Purchase_Log_Action_Link' ) ) {
109
- return $action_link;
110
- }
111
-
112
- return false;
113
-
114
- }
115
-
116
- /**
117
- * Downloads Lock Action Link
118
- *
119
- * @since 3.9.0
120
- * @access private
121
- *
122
- * @return WPSC_Purchase_Log_Action_Link Instance of an action link object.
123
- */
124
- private function get_downloads_lock_link() {
125
-
126
- return new WPSC_Purchase_Log_Action_Link( 'downloads_lock', wpsc_purchlogs_have_downloads_locked(), $this->log_id, array(
127
- 'ajax' => true,
128
- 'dashicon' => 'dashicons-lock'
129
- ) );
130
-
131
- }
132
-
133
- /**
134
- * View Packing Slip Action Link
135
- *
136
- * @since 3.9.0
137
- * @access private
138
- *
139
- * @return WPSC_Purchase_Log_Action_Link Instance of an action link object.
140
- */
141
- private function get_packing_slip_link() {
142
-
143
- return new WPSC_Purchase_Log_Action_Link( 'packing_slip', __( 'View Packing Slip', 'wp-e-commerce' ), $this->log_id, array(
144
- 'url' => esc_url( add_query_arg( array(
145
- 'c' => 'packing_slip',
146
- 'id' => $this->log_id
147
- ) ) ),
148
- 'dashicon' => 'dashicons-format-aside',
149
- 'attributes' => array(
150
- 'target' => 'wpsc_packing_slip'
151
- )
152
- ) );
153
-
154
- }
155
-
156
- /**
157
- * Resend Email Receipt Action Link
158
- *
159
- * @since 3.9.0
160
- * @access private
161
- *
162
- * @return WPSC_Purchase_Log_Action_Link Instance of an action link object.
163
- */
164
- private function get_email_receipt_link() {
165
-
166
- return new WPSC_Purchase_Log_Action_Link( 'email_receipt', __( 'Resend Receipt to Buyer', 'wp-e-commerce' ), $this->log_id, array(
167
- 'ajax' => true,
168
- 'dashicon' => 'dashicons-migrate dashicons-email-alt'
169
- ) );
170
-
171
- }
172
-
173
- /**
174
- * Delete Action Link
175
- *
176
- * @since 3.9.0
177
- * @access private
178
- *
179
- * @return WPSC_Purchase_Log_Action_Link Instance of an action link object.
180
- */
181
- private function _get_delete_link() {
182
-
183
- return new WPSC_Purchase_Log_Action_Link( 'delete', _x( 'Remove this record', 'purchase log action link', 'wp-e-commerce' ), $this->log_id, array(
184
- 'dashicon' => 'dashicons-dismiss',
185
- 'attributes' => array(
186
- 'onclick' => "if ( confirm('" . esc_js( sprintf( __( "You are about to delete this log '%s'\n 'Cancel' to stop, 'OK' to delete.", 'wp-e-commerce' ), wpsc_purchaselog_details_date() ) ) . "') ) { return true; } return false;"
187
- )
188
- ) );
189
-
190
- }
191
-
192
- /**
193
- * Back Action Link
194
- *
195
- * @since 3.9.0
196
- * @access private
197
- *
198
- * @return WPSC_Purchase_Log_Action_Link Instance of an action link object.
199
- */
200
- private function _get_back_link() {
201
-
202
- return new WPSC_Purchase_Log_Action_Link( 'back', _x( 'Go Back', 'purchase log action link', 'wp-e-commerce' ), $this->log_id, array(
203
- 'url' => wp_get_referer(),
204
- 'dashicon' => 'dashicons-arrow-left-alt'
205
- ) );
206
-
207
- }
208
-
209
- /**
210
- * Display Link List Items
211
- *
212
- * @since 3.9.0
213
- *
214
- * Outputs action links as a series of list item tags to be included in an HTML list.
215
- */
216
- public function display_link_list_items() {
217
-
218
- foreach ( $this->links as $link ) {
219
- echo '<li>' . $link->get_link_display() . '</li>';
220
- }
221
-
222
- }
223
-
224
- }
225
-
226
- /**
227
- * Purchase Log Action Link Class
228
- *
229
- * Creates, styles and handles a purchase log action link.
230
- *
231
- * @since 3.9.0
232
- */
233
- class WPSC_Purchase_Log_Action_Link {
234
-
235
- /**
236
- * Action Link ID.
237
- *
238
- * @since 3.9.0
239
- * @access private
240
- * @var string
241
- */
242
- private $id;
243
-
244
- /**
245
- * Action Link Title Text.
246
- *
247
- * @since 3.9.0
248
- * @access private
249
- * @var string
250
- */
251
- private $title;
252
-
253
- /**
254
- * Purchase Log ID.
255
- *
256
- * @since 3.9.0
257
- * @access private
258
- * @var int
259
- */
260
- private $log_id;
261
-
262
- /**
263
- * Action Link Settings.
264
- *
265
- * @since 3.9.0
266
- * @access private
267
- * @var array
268
- */
269
- private $args;
270
-
271
- /**
272
- * Define the action link.
273
- *
274
- * @since 3.9.0
275
- *
276
- * @param string $id Action link ID (will be sanitized).
277
- * @param string $title Link text.
278
- * @param array $args Action link settings.
279
- */
280
- public function __construct( $id, $title, $log_id, $args = array() ) {
281
-
282
- $this->id = sanitize_key( $id );
283
- $this->title = $title;
284
- $this->log_id = absint( $log_id );
285
- $this->args = $this->_validate_settings( $args );
286
-
287
- }
288
-
289
- /**
290
- * Validate Settings
291
- *
292
- * Checks settings and adds defaults where required.
293
- *
294
- * The 'attributes' setting allows additional attributes to be added to the link tag if required.
295
- * 'title' and 'href' attributes are removed as these are created via the 'url' and 'description' settings.
296
- *
297
- * Any class attributes are added to the 'wpsc-purchlog-action-{$id}' class we generate.
298
- *
299
- * @since 3.9.0
300
- * @access private
301
- *
302
- * @param array $args Supplied settings.
303
- * @return array Validated settings.
304
- */
305
- private function _validate_settings( $args ) {
306
-
307
- $args = wp_parse_args( $args, array(
308
- 'url' => '',
309
- 'description' => '',
310
- 'dashicon' => '',
311
- 'attributes' => array(),
312
- 'ajax' => false
313
- ) );
314
-
315
- // Use title if no description.
316
- if ( empty( $args['description'] ) ) {
317
- $args['description'] = $this->title;
318
- }
319
-
320
- // Use default arrow dashicon if none specified.
321
- if ( empty( $args['dashicon'] ) ) {
322
- $args['dashicon'] = 'dashicons-arrow-right-alt';
323
- }
324
-
325
- // Remove href and title attributes.
326
- if ( is_array( $args['attributes'] ) ) {
327
- if ( array_key_exists( 'title', $args['attributes'] ) ) {
328
- unset( $args['attributes']['title'] );
329
- }
330
- if ( array_key_exists( 'href', $args['attributes'] ) ) {
331
- unset( $args['attributes']['href'] );
332
- }
333
- } else {
334
- $args['attributes'] = array();
335
- }
336
-
337
- // Add class and append any extra classes.
338
- if ( ! array_key_exists( 'class', $args['attributes'] ) ) {
339
- $args['attributes']['class'] = '';
340
- }
341
- $args['attributes']['class'] = 'wpsc-purchlog-action-link ' . trim( $this->get_html_class() . ' ' . $args['attributes']['class'] );
342
-
343
- // Add AJAX class
344
- if ( $args['ajax'] ) {
345
- $args['attributes']['class'] .= ' is-ajax';
346
- }
347
-
348
- return $args;
349
-
350
- }
351
-
352
- /**
353
- * Get HTML Class
354
- *
355
- * @since 3.9.0
356
- *
357
- * @return string Action link class.
358
- */
359
- public function get_html_class() {
360
-
361
- return 'wpsc-purchlog-action-link-' . sanitize_html_class( $this->id );
362
-
363
- }
364
-
365
- /**
366
- * Get Link Display
367
- *
368
- * @since 3.9.0
369
- *
370
- * @return string HTML action link.
371
- */
372
- public function get_link_display() {
373
-
374
- return sprintf( '<a href="%s" title="%s" %s>%s%s</a>',
375
- esc_attr( $this->get_link_url() ),
376
- esc_attr( $this->args['description'] ),
377
- $this->_get_link_attributes_string(),
378
- $this->_get_dashicon_display(),
379
- esc_html( $this->title )
380
- );
381
-
382
- }
383
-
384
- /**
385
- * Get Link URL
386
- *
387
- * Returns the custom URL if specified.
388
- * Otherwise returns a callback URL.
389
- *
390
- * @since 3.9.0
391
- *
392
- * @return string URL.
393
- */
394
- public function get_link_url() {
395
-
396
- // Custom URL
397
- if ( ! empty( $this->args['url'] ) ) {
398
- return $this->args['url'];
399
- }
400
-
401
- // Callback URL
402
- $url = add_query_arg( array( 'wpsc_purchase_log_action' => $this->id, 'id' => $this->log_id ) );
403
- $url = wp_nonce_url( $url, 'wpsc_purchase_log_action_' . $this->id );
404
-
405
- return esc_url( $url );
406
-
407
- }
408
-
409
- /**
410
- * Get Link Attributes String
411
- *
412
- * @since 3.9.0
413
- * @access private
414
- *
415
- * @return string Link attributes HTML.
416
- */
417
- private function _get_link_attributes_string() {
418
-
419
- $atts = array();
420
- foreach ( $this->args['attributes'] as $att => $val ) {
421
- $att_key = sanitize_html_class( $att );
422
-
423
- // Don't override attributes that we set elsewhere
424
- if ( in_array( $att_key, array( 'href', 'title' ) ) ) {
425
- continue;
426
- }
427
-
428
- $atts[] = $att_key . '="' . esc_attr( $val ) . '"';
429
- }
430
-
431
- // Data attributes for JS/AJAX
432
- $atts[] = 'data-purchase-log-action="' . esc_attr( $this->id ) . '"';
433
- $atts[] = 'data-nonce="' . esc_attr( wp_create_nonce( 'wpsc_purchase_log_action_ajax_' . $this->id ) ) . '"';
434
-
435
- return implode( ' ', $atts );
436
-
437
- }
438
-
439
- /**
440
- * Get Dashicon Display
441
- *
442
- * @since 3.9.0
443
- * @access private
444
- *
445
- * @return string Dashicon HTML element.
446
- */
447
- private function _get_dashicon_display() {
448
-
449
- return '<span class="dashicons ' . $this->_sanitize_html_classes( $this->args['dashicon'] ) . '"></span>';
450
-
451
- }
452
-
453
- /**
454
- * Sanitize HTML Classes
455
- *
456
- * Handles sanitizing multiple classes provided as a string.
457
- *
458
- * @since 3.9.0
459
- * @access private
460
- *
461
- * @param string|array $classes Classes.
462
- * @return string Santized classes.
463
- */
464
- private function _sanitize_html_classes( $classes ) {
465
-
466
- // Convert multiple classes string to an array.
467
- if ( ! is_array( $classes ) && strpos( $classes, ' ' ) !== false ) {
468
- $classes = explode( ' ', $classes );
469
- }
470
-
471
- // Sanitize and return multiple classes.
472
- if ( is_array( $classes ) ) {
473
- $classes = array_map( 'sanitize_html_class', $classes );
474
- return implode( ' ', $classes );
475
- }
476
-
477
- // Sanitize single class.
478
- return sanitize_html_class( $classes );
479
-
480
- }
481
-
482
- }
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
trunk/wpsc-admin/includes/purchase-log-list-table-class.php DELETED
@@ -1,872 +0,0 @@
1
- <?php
2
- /* The WP_List_Table class isn't automatically available to plugins, so we need
3
- * to check if it's available and load it if necessary.
4
- */
5
- require_once( ABSPATH . 'wp-admin/includes/class-wp-list-table.php' );
6
- require_once( ABSPATH . 'wp-admin/includes/class-wp-posts-list-table.php' );
7
-
8
- class WPSC_Purchase_Log_List_Table extends WP_List_Table {
9
- private $search_box = true;
10
- private $bulk_actions = true;
11
- private $sortable = true;
12
- private $month_filter = true;
13
- private $views = true;
14
- private $status = 'all';
15
- private $per_page = 20;
16
- private $total_amount = 0;
17
- private $joins;
18
- private $where;
19
- private $where_no_filter;
20
-
21
- public function __construct( $args = array() ) {
22
- $args['plural'] = 'purchase-logs';
23
-
24
- $this->set_per_page( $this->set_purchase_logs_per_page_by_user() );
25
-
26
- parent::__construct( $args );
27
-
28
- if ( defined( 'DOING_AJAX' ) && DOING_AJAX )
29
- $_SERVER['REQUEST_URI'] = wp_get_referer();
30
- }
31
-
32
- public function disable_sortable() {
33
- $this->sortable = false;
34
- }
35
-
36
- public function disable_search_box() {
37
- $this->search_box = false;
38
- }
39
-
40
- public function disable_bulk_actions() {
41
- $this->bulk_actions = false;
42
- }
43
-
44
- public function disable_month_filter() {
45
- $this->month_filter = false;
46
- }
47
-
48
- public function disable_views() {
49
- $this->views = false;
50
- }
51
-
52
- private function set_purchase_logs_per_page_by_user() {
53
-
54
- $per_page = get_user_meta( get_current_user_id(), 'wpsc_purchases_per_page', true );
55
-
56
- return empty( $per_page ) || $per_page < 1 ? 20 : $per_page;
57
- }
58
-
59
- // Override the default Purchase Logs Per Page
60
- public function set_per_page( $per_page ) {
61
- $this->per_page = (int) $per_page;
62
- }
63
-
64
- public function prepare_items() {
65
- global $wpdb;
66
-
67
- $page = $this->get_pagenum();
68
- $offset = ( $page - 1 ) * $this->per_page;
69
-
70
- $checkout_fields_sql = "
71
- SELECT id, unique_name FROM " . WPSC_TABLE_CHECKOUT_FORMS . " WHERE unique_name IN ('billingfirstname', 'billinglastname', 'billingemail') AND active='1' AND checkout_set='0'
72
- ";
73
- $checkout_fields = $wpdb->get_results( $checkout_fields_sql );
74
-
75
- $joins = array();
76
- $where = array( '1 = 1' );
77
-
78
- if ( isset( $_REQUEST['post'] ) ) {
79
- $posts = array_map( 'absint', $_REQUEST['post'] );
80
- $where[] = ' and (p.id IN (' . implode( ', ', $posts ) . '))';
81
- }
82
-
83
- $i = 1;
84
- $selects = array( 'p.id', 'p.totalprice AS amount', 'p.processed AS status', 'p.track_id', 'p.date' );
85
- $selects[] = '
86
- (
87
- SELECT SUM(quantity) FROM ' . WPSC_TABLE_CART_CONTENTS . ' AS c
88
- WHERE c.purchaseid = p.id
89
- ) AS item_count';
90
-
91
- $search_terms = empty( $_REQUEST['s'] ) ? array() : explode( ' ', $_REQUEST['s'] );
92
- $search_sql = array();
93
-
94
- foreach ( $checkout_fields as $field ) {
95
- $table_as = 's' . $i;
96
- $select_as = str_replace('billing', '', $field->unique_name );
97
- $selects[] = $table_as . '.value AS ' . $select_as;
98
- $joins[] = $wpdb->prepare( "LEFT OUTER JOIN " . WPSC_TABLE_SUBMITTED_FORM_DATA . " AS {$table_as} ON {$table_as}.log_id = p.id AND {$table_as}.form_id = %d", $field->id );
99
-
100
- // build search term queries for first name, last name, email
101
- foreach ( $search_terms as $term ) {
102
-
103
- if ( version_compare( $GLOBALS['wp_version'], '4.0', '>=' ) ) {
104
- $escaped_term = esc_sql( like_escape( $term ) );
105
- } else {
106
- $escaped_term = esc_sql( $wpdb->esc_like( $term ) );
107
- }
108
-
109
- if ( ! array_key_exists( $term, $search_sql ) ) {
110
- $search_sql[ $term ] = array();
111
- }
112
-
113
- $search_sql[ $term ][] = $table_as . ".value LIKE '%" . $escaped_term . "%'";
114
- }
115
-
116
- $i++;
117
- }
118
-
119
- // combine query phrases into a single query string
120
- foreach ( $search_terms as $term ) {
121
- $search_sql[ $term ][] = "p.track_id = '" . esc_sql( $term ) . "'";
122
- if ( is_numeric( $term ) )
123
- $search_sql[ $term ][] = 'p.id = ' . esc_sql( $term );
124
- $search_sql[ $term ] = '(' . implode( ' OR ', $search_sql[ $term ] ) . ')';
125
- }
126
- $search_sql = implode( ' AND ', array_values( $search_sql ) );
127
-
128
- if ( $search_sql ) {
129
- $where[] = " AND ({$search_sql})";
130
- }
131
-
132
- // filter by status
133
- if ( ! empty( $_REQUEST['status'] ) && $_REQUEST['status'] != 'all' ) {
134
- $this->status = absint( $_REQUEST['status'] );
135
- $where[] = ' AND (processed = ' . $this->status .')';
136
- }
137
-
138
- $this->where_no_filter = implode( ' ', $where );
139
-
140
- // filter by month
141
- if ( ! empty( $_REQUEST['m'] ) ) {
142
-
143
- // so we can tell WP_Date_Query we're legit
144
- add_filter( 'date_query_valid_columns', array( $this, 'set_date_column_to_date') );
145
-
146
- if ( strlen( $_REQUEST['m'] ) < 4 ) {
147
- $query_args = $this->assemble_predefined_periods_query( $_REQUEST['m'] );
148
- } else {
149
- $query_args = array(
150
- 'year' => (int) substr( $_REQUEST['m'], 0, 4),
151
- 'monthnum' => (int) substr( $_REQUEST['m'], -2 ),
152
- );
153
- }
154
-
155
- $date_query = new WP_Date_Query( $query_args , $column = '__date__' );
156
- /* this is a subtle hack since the FROM_UNIXTIME doesn't survive WP_Date_Query
157
- * so we use __date__ as a proxy
158
- */
159
- $where[] = str_replace( '__date__', 'FROM_UNIXTIME(p.date)', $date_query->get_sql() );
160
- }
161
-
162
- $selects = apply_filters( 'wpsc_manage_purchase_logs_selects', implode( ', ', $selects ) );
163
- $this->joins = apply_filters( 'wpsc_manage_purchase_logs_joins' , implode( ' ', $joins ) );
164
- $this->where = apply_filters( 'wpsc_manage_purchase_logs_where' , implode( ' ', $where ) );
165
-
166
- $limit = ( $this->per_page !== 0 ) ? "LIMIT {$offset}, {$this->per_page}" : '';
167
-
168
- $orderby = empty( $_REQUEST['orderby'] ) ? 'p.id' : 'p.' . $_REQUEST['orderby'];
169
- $order = empty( $_REQUEST['order'] ) ? 'DESC' : $_REQUEST['order'];
170
-
171
- $orderby = esc_sql( apply_filters( 'wpsc_manage_purchase_logs_orderby', $orderby ) );
172
- $order = esc_sql( $order );
173
-
174
- $purchase_log_sql = apply_filters( 'wpsc_manage_purchase_logs_sql', "
175
- SELECT SQL_CALC_FOUND_ROWS {$selects}
176
- FROM " . WPSC_TABLE_PURCHASE_LOGS . " AS p
177
- {$this->joins}
178
- WHERE {$this->where}
179
- ORDER BY {$orderby} {$order}
180
- {$limit}
181
- " );
182
-
183
- $this->items = apply_filters( 'wpsc_manage_purchase_logs_items', $wpdb->get_results( $purchase_log_sql ) );
184
- if ( $this->per_page ) {
185
- $total_items = $wpdb->get_var( "SELECT FOUND_ROWS()" );
186
-
187
- $this->set_pagination_args( array(
188
- 'total_items' => $total_items,
189
- 'per_page' => $this->per_page,
190
- ) );
191
- }
192
-
193
- $total_where = apply_filters( 'wpsc_manage_purchase_logs_total_where', $this->where );
194
-
195
- if ( $this->status == 'all' ) {
196
- $total_where .= ' AND p.processed IN (3, 4, 5) ';
197
- }
198
-
199
- $total_sql = "
200
- SELECT SUM(totalprice)
201
- FROM " . WPSC_TABLE_PURCHASE_LOGS . " AS p
202
- {$this->joins}
203
- WHERE {$total_where}
204
- ";
205
-
206
- $this->total_amount = $wpdb->get_var( $total_sql );
207
- }
208
-
209
- /**
210
- * Construct the date queries for pre-defined periods in the Sales Log.
211
- *
212
- * Supports pre-defined periods for the purchase log, including today, yesterday, this week,
213
- * last week, this month, last month, last two months + month to date (this quarter),
214
- * prior 3 months, this year, last year. You can insert your own custom periods by filtering
215
- * either based on the $period_flag or just filter the final query setup.
216
- *
217
- * @since 3.11.5
218
- *
219
- * @param array $period_flag The period requested from $_REQUEST['m'].
220
- *
221
- * @return array formatted to pass to WP_Date_Query.
222
- */
223
-
224
- private function assemble_predefined_periods_query( $period_flag ){
225
- // warning: period flag is unsanitized user input directly from $_REQUEST - only compare against actual values
226
-
227
- /**
228
- * date functions
229
- */
230
- $now_string = current_time( 'mysql' );
231
- $week_start_end = get_weekstartend( $now_string ); // returns array with start/end
232
- $blog_time_zone = get_option( 'timezone_string' );
233
-
234
- if ( empty( $blog_time_zone ) ) {
235
- $blog_time_zone = date_default_timezone_get();
236
- }
237
-
238
- $timezone = new DateTimeZone( $blog_time_zone );
239
- $now = new DateTime( 'now', $timezone );
240
-
241
- // Based on $_REQUEST['m']
242
- switch ( $period_flag ) {
243
- // Today
244
- case 1:
245
- $date_query = array(
246
- 'year' => $now->format( 'Y' ),
247
- 'monthnum' => $now->format( 'n' ),
248
- 'day' => $now->format( 'd' )
249
- );
250
- break;
251
-
252
- // Yesterday
253
- case 2:
254
- $yesterday = new DateTime( date( 'Y-m-d', strtotime( 'yesterday' ) ), $timezone );
255
- $date_query = array(
256
- 'year' => $yesterday->format( 'Y' ),
257
- 'monthnum' => $yesterday->format( 'n' ),
258
- 'day' => $yesterday->format( 'd' )
259
- );
260
- break;
261
-
262
- // This Week-to-date
263
- case 3:
264
- $start_of_this_week = new DateTime( date( 'Y-m-d 00:00:00', $week_start_end['start'] ), $timezone );
265
- $date_query = array( 'date_query' => array(
266
- 'after' => $start_of_this_week->format('Y-m-d 00:00:00'),
267
- 'compare' => '>',
268
- 'inclusive' => true
269
- ));
270
- break;
271
-
272
- // Last Week
273
- case 4:
274
- $start_of_last_week = new DateTime( date('Y-m-d 00:00:00', $week_start_end['start'] - ( DAY_IN_SECONDS * 7 ) ), $timezone );
275
- $start = $start_of_last_week->format( 'Y-m-d 00:00:00' );
276
- $start_of_last_week->modify( '+7 days' );
277
- $date_query = array( 'date_query' => array(
278
- 'after' => $start,
279
- 'before' => $start_of_last_week->format( 'Y-m-d 00:00:00' ),
280
- 'inclusive' => false,
281
- ));
282
- break;
283
-
284
- // This Month-to-Date (Same as choosing the explicit month on selector)
285
- case 5:
286
- $date_query = array(
287
- 'year' => $now->format('Y'),
288
- 'monthnum' => $now->format('n'),
289
- );
290
- break;
291
-
292
- // Last Month (Same as choosing the explicit month on selector)
293
- case 6:
294
- $now->modify('-1 month');
295
- $date_query = array(
296
- 'year' => $now->format('Y'),
297
- 'monthnum' => $now->format('n'),
298
- );
299
- break;
300
-
301
- // This Quarter (last three months inclusive)
302
- case 7:
303
- $date_query = array('date_query' => array(
304
- 'after' => 'first day of -2 months' ),
305
- 'compare' => '>',
306
- 'inclusive' => true,
307
- );
308
-
309
- break;
310
-
311
- // Prior Three Months
312
- case 8:
313
- $date_query = array( 'date_query' => array(
314
- 'after' => 'first day of -2 months',
315
- 'before' => 'last day of -1 month',
316
- 'inclusive' => true,
317
- ));
318
- break;
319
-
320
- // This Year
321
- case 9:
322
- $date_query = array( 'date_query' => array(
323
- 'after' => '1/1 this year',
324
- 'compare' => '>',
325
- 'inclusive' => true,
326
- ));
327
- break;
328
-
329
- // Last year
330
- case 10:
331
- $date_query = array( 'date_query' => array(
332
- 'after' => '1/1 last year',
333
- 'before' => '12/31 last year',
334
- 'inclusive' => true,
335
- ));
336
- break;
337
-
338
- // default - return empty where clause
339
- default:
340
- /**
341
- * Return a custom date query for custom period_flag's.
342
- *
343
- * This filter extends the functionality allowing for custom periods if a new value
344
- * is passed via $_REQUEST['m']. {@see 'purchase_log_special_periods'}.
345
- *
346
- * @since 4.1.0
347
- *
348
- * @param array Empty array to be filled with a valid query {@see WP_Date_Query}.
349
- */
350
- $date_query = apply_filters( 'wpsc_purchase_log_predefined_periods_' . $period_flag, array() );
351
- }
352
-
353
- /**
354
- * Filter the parsed date query.
355
- *
356
- * This filter can be used to override the constructed date_query.
357
- *
358
- * @since 4.1.0
359
- *
360
- * @param array $date_query Empty array to be filled with a valid date query {@see WP_Date_Query}
361
- * @param string $period_flag Value passed from $_REQUEST['m'].
362
- */
363
- return apply_filters( 'wpsc_purchase_log_predefined_periods', $date_query, $period_flag );
364
- }
365
-
366
- public function set_date_column_to_date( $columns ){
367
-
368
- $columns[] = '__date__';
369
- return $columns;
370
-
371
- }
372
-
373
- public function is_pagination_enabled() {
374
- return $this->per_page !== 0;
375
- }
376
-
377
- public function is_sortable() {
378
- return $this->sortable;
379
- }
380
-
381
- public function is_views_enabled() {
382
- return $this->views;
383
- }
384
-
385
- public function is_search_box_enabled() {
386
- return $this->search_box;
387
- }
388
-
389
- /**
390
- * Define the columns in our list table. You can add/amend this list using
391
- * WordPress core filter manage_{screen}_columns, specifically
392
- * manage_dashboard_page_wpsc-purchase-logs_columns.
393
- *
394
- * @return array[string]string List of column headings
395
- */
396
- public function get_columns() {
397
- return array(
398
- 'cb' => '<input type="checkbox" />',
399
- 'id' => __( 'Order ID', 'wp-e-commerce' ),
400
- 'customer' => __( 'Customer', 'wp-e-commerce' ),
401
- 'amount' => __( 'Amount', 'wp-e-commerce' ),
402
- 'status' => _x( 'Status', 'sales log list table column', 'wp-e-commerce' ),
403
- 'date' => __( 'Date', 'wp-e-commerce' ),
404
- 'tracking' => _x( 'Tracking ID', 'purchase log', 'wp-e-commerce' ),
405
- ) ;
406
- }
407
-
408
- /**
409
- * Define the columns in the table which are sortable. You can add/amend
410
- * this list using the WordPress core filter manage_{screen}_sortable_columns
411
- * Specifically: manage_dashboard_page_wpsc-purchase-logs_sortable_columns
412
- *
413
- * @return array[string]string List of sortable column IDs and corresponding db column of the item
414
- */
415
- public function get_sortable_columns() {
416
- if ( ! $this->sortable )
417
- return array();
418
-
419
- return array(
420
- 'date' => 'id',
421
- 'status' => 'processed',
422
- 'amount' => 'totalprice',
423
- ) ;
424
- }
425
-
426
- private function get_months() {
427
- global $wpdb;
428
-
429
- // "date" column is not indexed. Might be better to use transient just in case
430
- // there are lots of logs
431
- $today = getdate();
432
- $transient_key = 'wpsc_purchase_logs_months_' . $today['year'] . $today['month'];
433
- /* if ( $months = get_transient( $transient_key ) )
434
- return $months; */
435
-
436
- $sql = "
437
- SELECT DISTINCT YEAR(FROM_UNIXTIME(date)) AS year, MONTH(FROM_UNIXTIME(date)) AS month
438
- FROM " . WPSC_TABLE_PURCHASE_LOGS . " AS p
439
- {$this->joins}
440
- WHERE {$this->where_no_filter}
441
- ORDER BY date DESC
442
- ";
443
-
444
- $months = $wpdb->get_results( $sql );
445
- set_transient( $transient_key, $months, 60 * 24 * 7 );
446
- return $months;
447
- }
448
-
449
- /**
450
- * Get an array of the untranslated, base view labels for the purchase log statuses.
451
- *
452
- * @return array The untranslated, base view label for each status.
453
- */
454
- private function get_status_view_labels() {
455
-
456
- global $wpsc_purchlog_statuses;
457
-
458
- $view_labels = array();
459
- foreach ( $wpsc_purchlog_statuses as $status ) {
460
- if ( ! empty( $status['view_label'] ) ) {
461
- // The status provides a view label i18n _nx_noop-able object.
462
- $view_labels[$status['order']]['view_label'] = $status['view_label'];
463
- } else {
464
- // The status doesn't provide a view label i18n string. Use a generic one.
465
- $view_labels[$status['order']]['view_label'] = _nx_noop(
466
- '%s <span class="count">(%d)</span>',
467
- '%s <span class="count">(%d)</span>',
468
- 'Purchase log view links for custom status with no explicit translation.',
469
- 'wp-e-commerce'
470
- );
471
- $view_labels[$status['order']]['label'] = $status['label'];
472
- }
473
- }
474
- return $view_labels;
475
- }
476
-
477
- /**
478
- * Returns a list of the purchase logs indexed on status number. Also includes a grand total
479
- * indexed as 'all'.
480
- *
481
- * @return array An array indexed on status number giving the count of purchase logs in that status.
482
- */
483
- private function get_per_status_counts() {
484
-
485
- global $wpdb;
486
-
487
- $sql = 'SELECT DISTINCT processed, COUNT(*) AS count FROM ' . WPSC_TABLE_PURCHASE_LOGS . ' GROUP BY processed ORDER BY processed';
488
- $results = $wpdb->get_results( $sql );
489
- $statuses = array(
490
- 'all' => 0,
491
- );
492
-
493
- if ( ! empty( $results ) ) {
494
- foreach ( $results as $status ) {
495
- $statuses[$status->processed] = $status->count;
496
- $statuses['all'] += $status->count;
497
- }
498
- }
499
- return $statuses;
500
- }
501
-
502
- /**
503
- * Get the sub-views of the list table.
504
- *
505
- * Allows user to limit the list to orders in a particular status.
506
- *
507
- * @return array The available view links.
508
- */
509
- public function get_views() {
510
-
511
- $view_labels = $this->get_status_view_labels();
512
- $statuses = $this->get_per_status_counts();
513
-
514
- $all_text = sprintf(
515
- _nx( 'All <span class="count">(%s)</span>', 'All <span class="count">(%s)</span>', $statuses['all'], 'purchase logs', 'wp-e-commerce' ),
516
- number_format_i18n( $statuses['all'] )
517
- );
518
-
519
- $all_href = remove_query_arg( array(
520
- 'status',
521
- 'paged',
522
- 'action',
523
- 'action2',
524
- 'm',
525
- 'deleted',
526
- 'updated',
527
- 'paged',
528
- 's',
529
- ) );
530
- $all_class = ( $this->status == 'all' && empty( $_REQUEST['m'] ) && empty( $_REQUEST['s'] ) ) ? 'class="current"' : '';
531
- $views = array(
532
- 'all' => sprintf(
533
- '<a href="%s" %s>%s</a>',
534
- esc_url( $all_href ),
535
- $all_class,
536
- $all_text
537
- ),
538
- );
539
-
540
- foreach ( $statuses as $status => $count ) {
541
- if ( ! isset( $view_labels[$status] ) ) {
542
- continue;
543
- }
544
- if ( empty( $view_labels[$status]['label'] ) ) {
545
- // This translation needs only the quantity dropping in.
546
- $text = sprintf(
547
- translate_nooped_plural( $view_labels[$status]['view_label'], $count, 'wp-e-commerce' ),
548
- number_format_i18n( $count )
549
- );
550
- } else {
551
- // This translation needs the status label, and quantity dropping in.
552
- $text = sprintf(
553
- translate_nooped_plural( $view_labels[$status]['view_label'], $count, 'wp-e-commerce' ),
554
- $view_labels[$status]['label'],
555
- number_format_i18n( $count )
556
- );
557
- }
558
- $href = add_query_arg( 'status', $status );
559
- $href = remove_query_arg( array(
560
- 'deleted',
561
- 'updated',
562
- 'action',
563
- 'action2',
564
- 'm',
565
- 'paged',
566
- 's',
567
- ), $href );
568
- $class = ( $this->status == $status ) ? 'class="current"' : '';
569
- $views[$status] = sprintf(
570
- '<a href="%s" %s>%s</a>',
571
- esc_url( $href ),
572
- $class,
573
- $text
574
- );
575
- }
576
-
577
- return $views;
578
- }
579
-
580
- public function months_dropdown( $post_type = '' ) {
581
- global $wp_locale;
582
-
583
- $m = isset( $_REQUEST['m'] ) ? $_REQUEST['m'] : 0;
584
-
585
- if ( ! $this->month_filter ) {
586
- if ( $m !== 0 )
587
- echo '<input type="hidden" name="m" value="' . esc_attr( $m ) . '" />';
588
-
589
- return false;
590
- }
591
-
592
- $months = $this->get_months();
593
- if ( ! empty( $months ) ) {
594
- ?>
595
- <select name="m">
596
- <option <?php selected( 0, $m ); ?> value="0"><?php _e( 'Show all dates', 'wp-e-commerce' ); ?></option>
597
- <?php
598
-
599
- $this->special_periods( $m );
600
-
601
- foreach ( $months as $arc_row ) {
602
- $month = zeroise( $arc_row->month, 2 );
603
- $year = $arc_row->year;
604
-
605
- printf( "<option %s value='%s'>%s</option>\n",
606
- selected( $arc_row->year . $month, $m, false ),
607
- esc_attr( $arc_row->year . $month ),
608
- $wp_locale->get_month( $month ) . ' ' . $year
609
- );
610
- }
611
- ?>
612
- </select>
613
- <?php
614
- submit_button( _x( 'Filter', 'extra navigation in purchase log page', 'wp-e-commerce' ), 'secondary', false, false, array( 'id' => 'post-query-submit' ) );
615
-
616
- }
617
- }
618
-
619
- /**
620
- * Outputs the pre-defined selectable periods.
621
- *
622
- * Inserts new predefined periods into the period filter select on sales log screen.
623
- *
624
- * @since 4.1.0
625
- *
626
- * @param string $selected The value of $_REQUEST['m'] - unsanitized.
627
- */
628
- private function special_periods( $selected ){
629
-
630
- /**
631
- * Filter the available special periods on the purchase log listing screen.
632
- *
633
- * Can Used to remove periods or add new period definitions {@see wpsc_purchase_log_predefined_periods_}
634
- *
635
- * @since 4.1.0
636
- *
637
- * @param array array() The periods currently defined.
638
- */
639
- $periods = apply_filters( 'wpsc_purchase_log_special_periods', array(
640
- 1 => _x('Today', 'time period for the current day', 'wp-e-commerce'),
641
- 2 => _x('Yesterday', 'time period for the previous day', 'wp-e-commerce'),
642
- 3 => _x('This Week', 'time period for the current week', 'wp-e-commerce'),
643
- 4 => _x('Last Week', 'time period for the prior week', 'wp-e-commerce'),
644
- 5 => _x('This Month', 'time period for the current month to date', 'wp-e-commerce'),
645
- 6 => _x('Last Month', 'time period for the prior month', 'wp-e-commerce'),
646
- 7 => _x('This Quarter', 'time period for the prior two months plus this month-to-date', 'wp-e-commerce'),
647
- 8 => _x('Prior 3 Months', 'time period for the three months prior to the current month', 'wp-e-commerce'),
648
- 9 => _x('This Year', 'time period for the current year to date', 'wp-e-commerce'),
649
- 10 => _x('Last Year', 'time period for the prior year', 'wp-e-commerce'),
650
- ) );
651
-
652
- echo '<option disabled="disabled">---------</option>';
653
- foreach( $periods as $value => $label ){
654
- printf( "<option %s value='%s'>%s</option>\n",
655
- selected( $value, $selected, false ),
656
- esc_attr( $value ),
657
- esc_html( $label )
658
- );
659
- }
660
- echo '<option disabled="disabled">---------</option>';
661
-
662
- }
663
-
664
- public function extra_tablenav( $which ) {
665
- if ( 'top' == $which ) {
666
- echo '<div class="alignleft actions">';
667
- $this->months_dropdown();
668
- do_action( 'wpsc_sales_log_extra_tablenav' );
669
- echo '</div>';
670
- }
671
- }
672
-
673
- public function pagination( $which ) {
674
- ob_start();
675
- parent::pagination( $which );
676
- $output = ob_get_clean();
677
- if ( $this->status == 'all' )
678
- $string = _x( 'Total (excluding Incomplete and Declined): %s', 'sales log page total', 'wp-e-commerce' );
679
- else
680
- $string = _x( 'Total: %s', 'sales log page total', 'wp-e-commerce' );
681
- $total_amount = ' - ' . sprintf( $string, wpsc_currency_display( $this->total_amount ) );
682
- $total_amount = str_replace( '$', '\$', $total_amount );
683
- $output = preg_replace( '/(<span class="displaying-num">)([^<]+)(<\/span>)/', '${1}${2}' . ' ' . $total_amount . '${3}', $output );
684
-
685
- echo $output;
686
- }
687
-
688
- public function column_cb( $item ){
689
- $checked = isset( $_REQUEST['post'] ) ? checked( in_array( $item->id, $_REQUEST['post'] ), true, false ) : '';
690
- return sprintf(
691
- '<input type="checkbox" ' . $checked . ' name="%1$s[]" value="%2$s" />',
692
- /*$1%s*/ 'post',
693
- /*$2%s*/ $item->id
694
- );
695
- }
696
-
697
- private function item_url( $item ) {
698
- $location = remove_query_arg( array(
699
- 'paged',
700
- 'order',
701
- 'orderby',
702
- 's',
703
- 'updated',
704
- 'deleted',
705
- ) );
706
- $location = add_query_arg( array(
707
- 'c' => 'item_details',
708
- 'id' => $item->id,
709
- ), $location );
710
- return $location;
711
- }
712
-
713
- public function column_customer( $item ) {
714
-
715
- $name = '';
716
-
717
- if ( isset( $item->firstname ) ) {
718
- $name .= $item->firstname;
719
- }
720
-
721
- if ( isset( $item->lastname ) ) {
722
- $name .= ' ' . $item->lastname;
723
- }
724
-
725
- $name = trim( $name );
726
-
727
- if ( empty( $name ) ) {
728
- $name = apply_filters( 'wpsc_purchase_log_list_no_name', __( 'No name provided', 'wp-e-commerce' ), $item );
729
- }
730
-
731
-
732
- ?>
733
- <strong>
734
- <a class="row-title" href="<?php echo esc_url( $this->item_url( $item ) ); ?>" title="<?php esc_attr_e( 'View order details', 'wp-e-commerce' ) ?>"><?php echo esc_html( $name ); ?></a>
735
- </strong><br />
736
-
737
- <?php if ( isset( $item->email ) ) : ?>
738
- <small><?php echo make_clickable( $item->email ); ?></small>
739
- <?php endif; ?>
740
- <?php
741
- }
742
-
743
- private function delete_url( $item ) {
744
- $nonce = wp_create_nonce( 'bulk-' . $this->_args['plural'] );
745
- $location = add_query_arg( array(
746
- '_wpnonce' => $nonce,
747
- '_wp_http_referer' => urlencode( $_SERVER['REQUEST_URI'] ),
748
- 'action' => 'delete',
749
- urlencode( 'post[]' ) => $item->id,
750
- ) );
751
- $location = remove_query_arg( array(
752
- 'updated',
753
- 'deleted',
754
- ), $location );
755
- return $location;
756
- }
757
-
758
- public function column_id( $item ) {
759
- ?>
760
- <a href="<?php echo esc_url( $this->item_url( $item ) ); ?>" title="<?php esc_attr_e( 'View order details', 'wp-e-commerce' ) ?>"><?php echo esc_html( $item->id ); ?></a>
761
- <?php if ( ! $this->current_action() == 'delete' ): ?>
762
- <br />
763
- <small><a class="delete" href="<?php echo esc_url( $this->delete_url( $item ) ); ?>"><?php echo esc_html_x( 'Delete', 'Sales log page', 'wp-e-commerce' ); ?></a></small>
764
- <?php endif ?>
765
- <?php
766
- }
767
-
768
- public function column_date( $item ) {
769
- $format = _x( 'Y/m/d g:i:s A', 'default date format for purchase log columns', 'wp-e-commerce' );
770
- $timestamp = (int) $item->date;
771
- $full_time = date( $format, $timestamp );
772
- $time_diff = time() - $timestamp;
773
- if ( $time_diff > 0 && $time_diff < 24 * 60 * 60 )
774
- $h_time = $h_time = sprintf( __( '%s ago', 'wp-e-commerce' ), human_time_diff( $timestamp ) );
775
- else
776
- $h_time = date( get_option( 'date_format', 'Y/m/d' ), $timestamp );
777
-
778
- echo '<abbr title="' . esc_attr( $full_time ) . '">' . esc_html( $h_time ) . '</abbr>';
779
- }
780
-
781
- public function column_amount( $item ) {
782
- echo '<a href="' . esc_attr( $this->item_url( $item ) ) . '" title="' . esc_attr__( 'View order details', 'wp-e-commerce' ) . '">';
783
- echo wpsc_currency_display( $item->amount ) . "<br />";
784
- echo '<small>' . sprintf( _n( '1 item', '%s items', $item->item_count, 'wp-e-commerce' ), number_format_i18n( $item->item_count ) ) . '</small>';
785
- echo '</a>';
786
- }
787
-
788
- public function column_default( $item, $column_name ) {
789
- $default = isset( $item->$column_name ) ? $item->$column_name : '';
790
- $output = apply_filters( 'wpsc_manage_purchase_logs_custom_column', $default, $column_name, $item );
791
- return $output;
792
- }
793
-
794
- public function column_status( $item ) {
795
- global $wpsc_purchlog_statuses;
796
- $dropdown_options = '';
797
- $current_status = false;
798
- foreach ( $wpsc_purchlog_statuses as $status ) {
799
- $selected = '';
800
- if ( $status['order'] == $item->status ) {
801
- $current_status = esc_html( $status['label'] );
802
- $selected = 'selected="selected"';
803
- }
804
- $dropdown_options .= '<option value="' . esc_attr( $status['order'] ) . '" ' . $selected . '>' . esc_html( $status['label'] ) . '</option>';
805
- }
806
-
807
- echo '<span>' . $current_status . '</span>';
808
- echo '<select class="wpsc-purchase-log-status" data-log-id="' . $item->id . '">';
809
- echo $dropdown_options;
810
- echo '</select>';
811
- echo '<img src="' . esc_url( wpsc_get_ajax_spinner() ) . '" class="ajax-feedback" title="" alt="" />';
812
- }
813
-
814
- public function column_tracking( $item ) {
815
- $classes = array( 'wpsc-purchase-log-tracking-id' );
816
- $empty = empty( $item->track_id );
817
- ?>
818
- <div data-log-id="<?php echo esc_attr( $item->id ); ?>" <?php echo $empty ? ' class="empty"' : ''; ?>>
819
- <a class="add" href="#"><?php echo esc_html_x( 'Add Tracking ID', 'add purchase log tracking id', 'wp-e-commerce' ); ?></a>
820
- <input type="text" class="wpsc-purchase-log-tracking-id" value="<?php echo esc_attr( $item->track_id ); ?>" />
821
- <a class="button save" href="#"><?php echo esc_html_x( 'Save', 'save sales log tracking id', 'wp-e-commerce' ); ?></a>
822
- <img src="<?php echo esc_url( wpsc_get_ajax_spinner() ); ?>" class="ajax-feedback" title="" alt="" /><br class="clear" />
823
- <small class="send-email"><a href="#"><?php echo esc_html_x( 'Send Email', 'sales log', 'wp-e-commerce' ); ?></a></small>
824
- </div>
825
- <?php
826
- }
827
-
828
- /**
829
- * Provide bulk actions for sales logs.
830
- *
831
- * Generates bulk actions for standard order statuses. Also generates a "delete" bulk action,
832
- * and actions for any additional statuses that have been registered via the
833
- * wpsc_set_purchlog_statuses filter.
834
- *
835
- * @return array Array of bulk actions available.
836
- */
837
- public function get_bulk_actions() {
838
-
839
- global $wpsc_purchlog_statuses;
840
-
841
- if ( ! $this->bulk_actions ) {
842
- return array();
843
- }
844
-
845
- // Standard actions.
846
- $actions = array(
847
- 'delete' => _x( 'Delete', 'bulk action', 'wp-e-commerce' ),
848
- );
849
-
850
- // Loop through all statuses and register bulk actions for them.
851
- foreach ( $wpsc_purchlog_statuses as $status ) {
852
- $actions[$status['order']] = $status['label'];
853
- }
854
-
855
- /**
856
- * Filter the available bulk actions on the purchase log listing screen.
857
- *
858
- * @since 3.11.5
859
- *
860
- * @param array $actions The bulk actions currently defined.
861
- */
862
- return apply_filters( 'wpsc_manage_purchase_logs_bulk_actions', $actions );
863
- }
864
-
865
- public function search_box( $text, $input_id ) {
866
- if ( ! $this->search_box ) {
867
- return '';
868
- }
869
-
870
- parent::search_box( $text, $input_id );
871
- }
872
- }
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
trunk/wpsc-admin/includes/purchase-logs-page/bulk-delete-confirm.php DELETED
@@ -1,9 +0,0 @@
1
- <h3>
2
- <?php esc_html_e( 'Are you sure you want to delete these purchase logs?', 'wp-e-commerce' ); ?><br />
3
- </h3>
4
- <div>
5
- <a href="<?php echo esc_url( wp_get_referer() ); ?>" class="button"><?php esc_html_e( 'Go Back', 'wp-e-commerce' ); ?></a>
6
- <input class="button-primary" type="submit" value="<?php esc_attr_e( 'Delete', 'wp-e-commerce' ); ?>" />
7
- <input type="hidden" name="confirm" value="1" />
8
- <input type="hidden" name="action" value="delete" />
9
- </div>
 
 
 
 
 
 
 
 
 
trunk/wpsc-admin/includes/purchase-logs-page/item-details.php DELETED
@@ -1,120 +0,0 @@
1
- <div class="wrap" id="poststuff">
2
- <h2 class="log-details-title-area">
3
- <span class="log-title-details">
4
- <?php esc_html_e( 'Sales Log Details', 'wp-e-commerce' ); ?>
5
- <span class="subtitle">#<?php echo $this->log_id; ?> – <?php echo wpsc_purchaselog_details_date_time(); ?></span>
6
- </span>
7
- <?php $this->purchase_logs_pagination() ?>
8
- </h2>
9
- <?php if ( $receipt_sent ): ?>
10
- <div class="updated">
11
- <p><?php esc_html_e( 'Receipt has been resent successfully.', 'wp-e-commerce' ); ?></p>
12
- </div>
13
- <?php elseif ( $receipt_not_sent ) : ?>
14
- <div class="error">
15
- <p><?php esc_html_e( 'Receipt could not be sent to buyer. Please contact your hosting service and make sure your server can send emails.', 'wp-e-commerce' ); ?></p>
16
- </div>
17
- <?php endif; ?>
18
-
19
- <?php do_action( 'wpsc_purchlog_before_metaboxes', $this->log_id ); ?>
20
-
21
- <div id="post-body">
22
- <?php if ( wpsc_has_purchlog_shipping() ): ?>
23
- <?php do_action( 'wpsc_shipping_details_top', $this->log_id ); ?>
24
- <div id="wpsc_shipping_details_box" class="log-details-box">
25
- <h3>
26
- <?php esc_html_e( 'Shipping Address', 'wp-e-commerce' ); ?>
27
- <?php if ( $this->can_edit ) : ?>
28
- <a class="edit-log-details edit-shipping-details" href="#edit-shipping-address"><?php _e( 'Edit', 'wp-e-commerce' ); ?></a>
29
- <?php endif; ?>
30
- </h3>
31
- <blockquote id="wpsc-shipping-details">
32
- <?php self::shipping_address_output(); ?>
33
- </blockquote>
34
-
35
- <?php $method = wpsc_display_purchlog_shipping_method(); ?>
36
- <?php if ( ! empty( $method ) ) : ?>
37
- <h4><?php esc_html_e( 'Shipping Details', 'wp-e-commerce' ); ?></h4>
38
- <blockquote>
39
- <strong><?php esc_html_e( 'Shipping Method:', 'wp-e-commerce' ); ?></strong> <?php echo $method; ?><br />
40
- <strong><?php esc_html_e( 'Shipping Option:', 'wp-e-commerce' ); ?></strong> <?php echo wpsc_display_purchlog_shipping_option(); ?><br />
41
- <?php $purchase_weight = wpsc_purchlogs_get_weight_text(); ?>
42
- <?php if ( ! empty( $purchase_weight ) ) { ?>
43
- <strong><?php esc_html_e( 'Purchase Weight:', 'wp-e-commerce' ); ?></strong> <?php echo $purchase_weight; ?><br />
44
- <?php } ?>
45
- <?php if ( wpsc_purchlogs_has_tracking() ) { ?>
46
- <strong><?php echo esc_html_x( 'Tracking ID:', 'purchase log', 'wp-e-commerce' ); ?></strong> <?php echo wpsc_purchlogitem_trackid(); ?><br />
47
-
48
- <?php $tracking_status = wpsc_purchlogitem_trackstatus(); ?>
49
- <?php if ( ! empty ( $tracking_status ) ) { ?>
50
- <strong><?php esc_html_e( 'Shipping Status:', 'wp-e-commerce' ); ?></strong> <?php echo $tracking_status ?><br />
51
- <?php } ?>
52
-
53
- <?php $tracking_history = wpsc_purchlogitem_trackhistory(); ?>
54
- <?php if ( ! empty ( $tracking_history ) ) { ?>
55
- <strong><?php esc_html_e( 'Track History:', 'wp-e-commerce' ); ?></strong> <?php echo $tracking_history; ?><br />
56
- <?php } ?>
57
-
58
- <?php } ?>
59
- </blockquote>
60
- <?php do_action( 'wpsc_shipping_details_bottom', $this->log_id ); ?>
61
- <?php endif; ?>
62
- </div>
63
- <?php endif ?>
64
-
65
- <div id="wpsc_billing_details_box" class="log-details-box">
66
- <?php do_action( 'wpsc_billing_details_top', $this->log_id ); ?>
67
- <h3>
68
- <?php esc_html_e( 'Billing Details', 'wp-e-commerce' ); ?>
69
- <?php if ( $this->can_edit ) : ?>
70
- <a class="edit-log-details edit-billing-details" href="#edit-billing-address"><?php _e( 'Edit', 'wp-e-commerce' ); ?></a>
71
- <?php endif; ?>
72
- </h3>
73
- <blockquote id="wpsc-billing-details">
74
- <?php self::billing_address_output(); ?>
75
- </blockquote>
76
- <h4><?php esc_html_e( 'Payment Details', 'wp-e-commerce' ); ?></h4>
77
- <blockquote id="wpsc-payment-details">
78
- <?php self::payment_details_output(); ?>
79
- </blockquote>
80
- <?php do_action( 'wpsc_billing_details_bottom', $this->log_id ); ?>
81
- </div>
82
-
83
- <?php if ( $this->can_edit ) : ?>
84
- <div class="wpsc-controller postbox" id="edit-shipping-billing" style="display:none;">
85
- <?php $this->edit_contact_details_form(); ?>
86
- </div>
87
- <?php endif; ?>
88
-
89
- <?php do_meta_boxes( get_current_screen()->id, 'normal', $this->log ); ?>
90
-
91
- <?php do_meta_boxes( get_current_screen()->id, 'low', $this->log ); ?>
92
- </div>
93
-
94
-
95
- <div id="wpsc_purchlogitems_links">
96
- <h3><?php esc_html_e( 'Actions', 'wp-e-commerce' ); ?></h3>
97
- <?php do_action( 'wpsc_purchlogitem_links_start' ); ?>
98
- <ul>
99
- <?php
100
- require_once( WPSC_FILE_PATH . '/wpsc-admin/includes/purchase-log-action-links.php' );
101
- $action_links = new WPSC_Purchase_Log_Action_Links( $this->log_id );
102
- $action_links->display_link_list_items();
103
- ?>
104
- </ul>
105
- </div>
106
-
107
- </div>
108
-
109
- <script type="text/html" id="tmpl-wpsc-found-products">
110
- <table class="widefat"><thead><tr><th class="found-radio"><br /></th><th><?php esc_html_e( 'Title', 'wp-e-commerce' ); ?></th><th class="no-break"><?php esc_html_e( 'Date', 'wp-e-commerce' ); ?></th><th class="no-break"><?php esc_html_e( 'Status', 'wp-e-commerce' ); ?></th></tr></thead><tbody></tbody></table>
111
- </script>
112
-
113
- <script type="text/html" id="tmpl-wpsc-found-product-rows">
114
- <# _.each( data.posts, function( post ) { #>
115
- <tr class="found-posts {{ post.class }}">
116
- <td class="found-radio"><input type="checkbox" id="found-{{ post.ID }}" name="found_post_id" value="{{ post.ID }}"></td>
117
- <td><label for="found-{{ post.ID }}">{{ post.title }}</label></td><td class="no-break">{{ post.time }}</td><td class="no-break">{{ post.status }}</td>
118
- </tr>
119
- <#} ); #>
120
- </script>
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
trunk/wpsc-admin/includes/purchase-logs-page/list-table.php DELETED
@@ -1,83 +0,0 @@
1
- <div class="wrap">
2
- <div id="icon-users" class="icon32"><br/></div>
3
- <h2>
4
- <?php esc_html_e( 'Sales Log', 'wp-e-commerce' ); ?>
5
-
6
- <?php
7
- if ( isset($_REQUEST['s']) && $_REQUEST['s'] )
8
- printf( '<span class="subtitle">' . __( 'Search results for &#8220;%s&#8221;', 'wp-e-commerce' ) . '</span>', esc_html( stripslashes( $_REQUEST['s'] ) ) ); ?>
9
- </h2>
10
-
11
- <?php if ( ! empty( $_REQUEST['updated'] ) || ! empty( $_REQUEST['deleted'] ) ): ?>
12
- <div id="message" class="updated">
13
- <p>
14
- <?php
15
- if ( ! empty( $_REQUEST['updated'] ) )
16
- printf( _n( '%s item updated.', '%s items updated.', $_REQUEST['updated'], 'wp-e-commerce' ), number_format_i18n( $_REQUEST['updated'] ) );
17
- ?>
18
- <?php
19
- if ( ! empty( $_REQUEST['deleted'] ) )
20
- printf( _n( '%s item deleted.', '%s items deleted.', $_REQUEST['deleted'], 'wp-e-commerce' ), number_format_i18n( $_REQUEST['deleted'] ) );
21
- ?>
22
- </p>
23
- </div>
24
- <?php endif ?>
25
-
26
- <?php if( get_option( 'wpsc_purchaselogs_fixed' ) == false || ( wpsc_check_uniquenames() ) ): ?>
27
- <div class='error' style='padding:8px;line-spacing:8px;'><span ><?php printf( __( 'When upgrading the WP eCommerce Plugin from 3.6.* to 3.7, it is required that you associate your checkout form fields with the new Purchase Logs system. To do so please <a href="%s">click here</a>', 'wp-e-commerce' ), esc_url( add_query_arg( 'c', 'upgrade_purchase_logs_3_7' ) ) ); ?></span></div>
28
- <?php endif; ?>
29
-
30
- <?php if ( $this->needs_update() ): ?>
31
- <div class='error' style='padding:8px;line-spacing:8px;'><span ><?php printf( __( 'It has been detected that some of your purchase logs were not updated properly when you upgrade to WP eCommerce %s. Please <a href="%s">click here</a> to fix this problem.', 'wp-e-commerce' ), WPSC_VERSION, esc_url( add_query_arg( 'c', 'upgrade_purchase_logs_3_8' ) ) ); ?></span></div>
32
- <?php endif; ?>
33
-
34
- <form id="purchase-logs-search" method-"get" action="">
35
- <input type="hidden" name="page" value="<?php echo esc_attr( $_REQUEST['page'] ); ?>" />
36
- <?php $this->list_table->search_box( __( 'Search Sales Logs', 'wp-e-commerce' ), 'post' ); ?>
37
- <?php if ( ! empty( $_REQUEST['status'] ) ): ?>
38
- <input type="hidden" name="status" value="<?php echo esc_attr( $_REQUEST['status'] ); ?>" />
39
- <?php endif ?>
40
- </form>
41
-
42
-
43
- <?php
44
- if ( $this->list_table->is_views_enabled() )
45
- $this->list_table->views();
46
- ?>
47
- <br class="clear" />
48
-
49
- <!-- Forms are NOT created automatically, so you need to wrap the table in one to use features like bulk actions -->
50
- <form id="purchase-logs-filter" method="get" action="">
51
- <?php do_action( 'wpsc_purchase_logs_list_table_before' ); ?>
52
- <!-- For plugins, we also need to ensure that the form posts back to our current page -->
53
- <!-- Now we can render the completed list table -->
54
-
55
- <?php $this->list_table->display() ?>
56
- <input type="hidden" name="page" value="wpsc-purchase-logs" />
57
-
58
- <?php if ( ! $this->list_table->is_pagination_enabled() && $this->list_table->get_pagenum() ):?>
59
- <input type="hidden" name="last_paged" value="<?php echo esc_attr( $this->list_table->get_pagenum() ); ?>" />
60
- <?php endif ?>
61
-
62
- <?php if ( ! $this->list_table->is_sortable() && isset( $_REQUEST['orderby'] ) && isset( $_REQUEST['order'] ) ): ?>
63
- <input type="hidden" name="orderby" value="<?php echo esc_attr( $_REQUEST['orderby'] ); ?>" />
64
- <input type="hidden" name="order" value="<?php echo esc_attr( $_REQUEST['order'] ); ?>" />
65
- <?php endif; ?>
66
-
67
- <?php if ( isset( $_REQUEST['s'] ) ): ?>
68
- <input type="hidden" name="s" value="<?php echo esc_attr( $_REQUEST['s'] ); ?>" />
69
- <?php endif; ?>
70
-
71
- <?php if ( ! empty( $_REQUEST['status'] ) ): ?>
72
- <input type="hidden" name="status" value="<?php echo esc_attr( $_REQUEST['status'] ); ?>" />
73
- <?php endif ?>
74
- <?php do_action( 'wpsc_purchase_logs_list_table_after' ); ?>
75
- </form>
76
-
77
- <p>
78
- <a class='admin_download' href='<?php echo esc_url( add_query_arg( 'action', 'download_csv' ) ); ?>' >
79
- <img class='wpsc_pushdown_img' src='<?php echo WPSC_CORE_IMAGES_URL; ?>/download.gif' alt='' title='' />
80
- <span><?php _e( 'Download CSV', 'wp-e-commerce' ); ?></span>
81
- </a>
82
- </p>
83
- </div>
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
trunk/wpsc-admin/includes/purchase-logs-page/packing-slip.php DELETED
@@ -1,162 +0,0 @@
1
- <!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Strict//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-strict.dtd">
2
- <html xmlns="http://www.w3.org/1999/xhtml">
3
- <head>
4
- <title><?php printf( esc_html__( 'Packing Slip for Order #%s', 'wp-e-commerce' ), $this->log_id ); ?></title>
5
- <meta http-equiv="Content-Type" content="text/html; charset=utf-8" />
6
- <style type="text/css">
7
- body {
8
- font-family:"Helvetica Neue", Helvetica, Arial, Verdana, sans-serif;
9
- }
10
-
11
- h1 span {
12
- font-size:0.75em;
13
- }
14
-
15
- h2 {
16
- color: #333;
17
- }
18
-
19
- #wrapper {
20
- margin:0 auto;
21
- width:95%;
22
- }
23
-
24
- #header {
25
- }
26
-
27
- #customer {
28
- overflow:hidden;
29
- }
30
-
31
- #customer .shipping, #customer .billing {
32
- float: left;
33
- width: 50%;
34
- }
35
-
36
- table {
37
- border:1px solid #000;
38
- border-collapse:collapse;
39
- margin-top:1em;
40
- width:100%;
41
- }
42
-
43
- th {
44
- background-color:#efefef;
45
- text-align:center;
46
- }
47
-
48
- th, td {
49
- padding:5px;
50
- }
51
-
52
- td {
53
- text-align:center;
54
- }
55
-
56
- #cart-items td.amount {
57
- text-align:right;
58
- }
59
-
60
- td, tbody th {
61
- border-top:1px solid #ccc;
62
- }
63
- th.column-total {
64
- width:90px;
65
- }
66
- th.column-shipping {
67
- width:120px;
68
- }
69
- th.column-price {
70
- width:100px;
71
- }
72
- </style>
73
- </head>
74
- <body onload="window.print()">
75
- <div id="wrapper">
76
- <div id="header">
77
- <h1>
78
- <?php bloginfo( 'name' ); ?><br />
79
- <span><?php printf( esc_html__( 'Packing Slip for Order #%s', 'wp-e-commerce' ), $this->log_id ); ?></span>
80
- </h1>
81
- </div>
82
- <div id="customer">
83
- <div class="shipping">
84
- <h2><?php echo esc_html_x( 'Ship To:', 'packing slip', 'wp-e-commerce' ); ?></h2>
85
- <strong><?php echo wpsc_display_purchlog_shipping_name(); ?></strong><br />
86
- <?php echo wpsc_display_purchlog_shipping_address(); ?><br />
87
- <?php echo wpsc_display_purchlog_shipping_city(); ?><br />
88
- <?php echo wpsc_display_purchlog_shipping_state_and_postcode(); ?><br />
89
- <?php echo wpsc_display_purchlog_shipping_country(); ?><br />
90
- </div>
91
- <div class="billing">
92
- <h2><?php echo esc_html_x( 'Bill To:', 'packing slip', 'wp-e-commerce' ); ?></h2>
93
- <strong><?php echo wpsc_display_purchlog_buyers_name(); ?></strong><br />
94
- <?php echo wpsc_display_purchlog_buyers_address(); ?><br />
95
- <?php echo wpsc_display_purchlog_buyers_city(); ?><br />
96
- <?php echo wpsc_display_purchlog_buyers_state_and_postcode(); ?><br />
97
- <?php echo wpsc_display_purchlog_buyers_country(); ?><br />
98
- </div>
99
- </div>
100
- <table id="order">
101
- <thead>
102
- <tr>
103
- <th><?php echo esc_html_x( 'Order Date', 'packing slip', 'wp-e-commerce' ); ?></th>
104
- <th><?php echo esc_html_x( 'Order ID', 'packing slip', 'wp-e-commerce' ); ?></th>
105
- <th><?php echo esc_html_x( 'Shipping Method', 'packing slip', 'wp-e-commerce' ); ?></th>
106
- <th><?php echo esc_html_x( 'Payment Method', 'packing slip', 'wp-e-commerce' ); ?></th>
107
- <?php wpsc_purchaselog_order_summary_headers(); ?>
108
- </tr>
109
- </thead>
110
- <tbody>
111
- <tr>
112
- <td><?php echo wpsc_purchaselog_details_date(); ?></td>
113
- <td><?php echo wpsc_purchaselog_details_purchnumber(); ?></td>
114
- <td><?php echo wpsc_display_purchlog_shipping_method(); ?></td>
115
- <td><?php echo wpsc_display_purchlog_paymentmethod(); ?></td>
116
- <?php wpsc_purchaselog_order_summary(); ?>
117
- </tr>
118
- </tbody>
119
- </table>
120
- <table id="cart-items" class="widefat" cellspacing="0">
121
- <thead>
122
- <tr>
123
- <?php print_column_headers( 'wpsc_purchase_log_item_details' ); ?>
124
- </tr>
125
- </thead>
126
-
127
- <tbody>
128
- <?php $this->purchase_log_cart_items(); ?>
129
-
130
- <tr class="wpsc_purchaselog_start_totals">
131
- <td colspan="<?php echo $this->cols; ?>">
132
- <?php if ( wpsc_purchlog_has_discount_data() ): ?>
133
- <?php esc_html_e( 'Coupon Code', 'wp-e-commerce' ); ?>: <?php echo wpsc_display_purchlog_discount_data(); ?>
134
- <?php endif; ?>
135
- </td>
136
- <th><?php esc_html_e( 'Discount', 'wp-e-commerce' ); ?> </th>
137
- <td class="amount"><?php echo wpsc_display_purchlog_discount(); ?></td>
138
- </tr>
139
-
140
- <?php if( ! wpec_display_product_tax() ): ?>
141
- <tr>
142
- <td colspan='<?php echo $this->cols; ?>'></td>
143
- <th><?php esc_html_e( 'Taxes', 'wp-e-commerce' ); ?> </th>
144
- <td class="amount"><?php echo wpsc_display_purchlog_taxes(); ?></td>
145
- </tr>
146
- <?php endif; ?>
147
-
148
- <tr>
149
- <td colspan='<?php echo $this->cols; ?>'></td>
150
- <th><?php esc_html_e( 'Shipping', 'wp-e-commerce' ); ?> </th>
151
- <td class="amount"><?php echo wpsc_display_purchlog_shipping(); ?></td>
152
- </tr>
153
- <tr>
154
- <td colspan='<?php echo $this->cols; ?>'></td>
155
- <th><?php esc_html_e( 'Total', 'wp-e-commerce' ); ?> </th>
156
- <td class="amount"><?php echo wpsc_display_purchlog_totalprice(); ?></td>
157
- </tr>
158
- </tbody>
159
- </table>
160
- </div>
161
- </body>
162
- </html>
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
trunk/wpsc-admin/includes/purchase-logs-page/upgrade.php DELETED
@@ -1,45 +0,0 @@
1
- <div class='wrap'>
2
-
3
- <h2><?php esc_html_e( 'Sales Upgrade Fix', 'wp-e-commerce' ); ?> </h2>
4
-
5
- <?php if ( $numChanged != 0 && $numQueries != 0 ): ?>
6
- <div class="updated">
7
- <p><?php printf( __( 'Your purchase logs have been updated! <a href="%s">Click here</a> to return.' , 'wp-e-commerce' ), esc_url( remove_query_arg( 'c' ) ) ); ?></p>
8
- </div>
9
- <?php else: ?>
10
- <p><?php _e( 'Upgrading to WP eCommerce 3.7 and later requires you to run this fix once. The following boxes correspond to the form fields in your current checkout page. All you have to do is select from the drop-down menu box what each of the following fields represent. Sorry for any inconvenience caused, but we\'re sure you\'ll agree that the new purchase logs are worth this minor hassle.', 'wp-e-commerce' ); ?> </p>
11
-
12
- <div class="metabox-holder" style="width:700px">
13
- <form action='' method='post'>
14
-
15
- <?php
16
-
17
- $duplicate = array();
18
- foreach($formfields as $fields){
19
- if(!in_array($fields->name,$duplicate) && $fields->name != 'State'){
20
- echo '<div class="postbox" style="width:70%">';
21
- echo '<h3 class="handle">Billing '.$fields->name.'</h3>';
22
- echo '<div class="inside" style="padding:20px;">';
23
- echo '<label style="width:120px;float:left;" for="'.$fields->id.'">'.$fields->value.'</label>';
24
- echo $this->purchase_logs_fix_options( $fields->id );
25
- echo '</div>';
26
- echo '</div>';
27
- $duplicate[] = $fields->name;
28
- }else{
29
- echo '<div class="postbox" style="width:70%">';
30
- echo '<h3 class="handle">Shipping '.$fields->name.'</h3>';
31
- echo '<div class="inside" style="padding:20px;">';
32
- echo '<label style="width:120px;float:left;" for="'.$fields->id.'">'.$fields->value.'</label>';
33
- echo $this->purchase_logs_fix_options( $fields->id );
34
- echo '</div>';
35
- echo '</div>';
36
-
37
- }
38
-
39
- }
40
- ?>
41
- <input type='submit' value='<?php _e( 'Apply', 'wp-e-commerce' ); ?>' class='button-secondary action' />
42
- </form>
43
- </div>
44
- <?php endif; ?>
45
- </div>
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
trunk/wpsc-admin/includes/save-data.functions.php DELETED
@@ -1,577 +0,0 @@
1
- <?php
2
- /**
3
- * This file used for adding fields to the products category taxonomy page and saving those values correctly :)
4
- *
5
- * @package wp-e-commerce
6
- * @since 3.8
7
- * @todo UI needs a lot of loving - lots of padding issues, if we have these boxes, they should be sortable, closable, hidable, etc.
8
- */
9
- function wpsc_ajax_set_variation_order(){
10
- global $wpdb;
11
- $sort_order = $_POST['sort_order'];
12
- $parent_id = $_POST['parent_id'];
13
-
14
- $result = true;
15
- foreach( $sort_order as $key => $value ) {
16
-
17
- if ( empty( $value ) ) {
18
- continue;
19
- }
20
-
21
- $value = preg_replace( '/[^0-9]/', '', $value );
22
-
23
- if ( ! wpsc_update_meta( $value, 'sort_order', absint( $key ), 'wpsc_variation' ) ) {
24
- $result = false;
25
- }
26
- }
27
- }
28
-
29
- /**
30
- * WP eCommerce edit and add product category page functions
31
- *
32
- * These are the main WPSC Admin functions
33
- *
34
- * @package wp-e-commerce
35
- * @since 3.7
36
- */
37
-
38
- function wpsc_ajax_set_category_order(){
39
- global $wpdb;
40
- $sort_order = $_POST['sort_order'];
41
- $parent_id = $_POST['parent_id'];
42
-
43
- $result = true;
44
- foreach ( $sort_order as $key=>$value ){
45
- if ( empty( $value ) )
46
- continue;
47
-
48
- $value = preg_replace( '/[^0-9]/', '', $value );
49
-
50
- if ( ! wpsc_update_meta( $value, 'sort_order', $key, 'wpsc_category' ) )
51
- $result = false;
52
- }
53
- }
54
-
55
- add_filter( 'manage_edit-wpsc_product_category_columns', 'wpsc_custom_category_columns' );
56
- add_filter( 'manage_wpsc_product_category_custom_column', 'wpsc_custom_category_column_data', 10, 3);
57
- add_action( 'wpsc_product_category_add_form_fields', 'wpsc_admin_category_forms_add' ); // After left-col
58
- add_action( 'wpsc_product_category_edit_form_fields', 'wpsc_admin_category_forms_edit' ); // After left-col
59
- add_action( 'created_wpsc_product_category', 'wpsc_save_category_set', 10 , 2 ); //After created
60
- add_action( 'edited_wpsc_product_category', 'wpsc_save_category_set', 10 , 2 ); //After saved
61
-
62
- /**
63
- * wpsc_custom_category_columns
64
- * Adds images column to category column.
65
- * @internal Don't feel handle column is necessary, but you would add it here if you wanted to
66
- * @param (array) columns | Array of columns assigned to this taxonomy
67
- * @return (array) columns | Modified array of columns
68
- */
69
-
70
- function wpsc_custom_category_columns( $columns ) {
71
- // Doing it this funny way to ensure that image stays in far left, even if other items are added via plugin.
72
- unset( $columns["cb"] );
73
-
74
- $custom_array = array(
75
- 'cb' => '<input type="checkbox" />',
76
- 'image' => __( 'Image', 'wp-e-commerce' )
77
- );
78
-
79
- $columns = array_merge( $custom_array, $columns );
80
-
81
- return $columns;
82
- }
83
-
84
- /**
85
- * Custom Category Column Data
86
- *
87
- * Adds images to the custom category column.
88
- *
89
- * @param string $string Column output.
90
- * @param string $column_name Column name.
91
- * @param string $term_id Term ID.
92
- * @return string Updated column output.
93
- */
94
- function wpsc_custom_category_column_data( $string, $column_name, $term_id ) {
95
- if ( 'image' == $column_name ) {
96
- $term = get_term_by( 'id', $term_id, 'wpsc_product_category' );
97
- $image = wpsc_get_categorymeta( $term_id, 'image' );
98
- $noimage = defined( 'WPSC_CORE_THEME_URL' ) ? WPSC_CORE_THEME_URL . '/wpsc-images/noimage.png' : WPSC_TE_V2_URL . '/theming/assets/images/noimage.png';
99
-
100
- $format = '<img src="%s" title="%s" alt="%2$s" width="30" height="30" />';
101
- if ( ! empty( $image ) ) {
102
- $string = sprintf( $format, WPSC_CATEGORY_URL . $image, esc_attr( $term->name ) );
103
- } else {
104
- $string = sprintf( $format, $noimage, esc_attr( $term->name ) );
105
- }
106
- }
107
- return $string;
108
- }
109
-
110
- /**
111
- * wpsc_admin_get_category_array
112
- * Recursively step through the categories and return it in a clean multi demensional array
113
- * for use in other list functions
114
- * @param int $parent_id
115
- */
116
- function wpsc_admin_get_category_array( $parent_id = null ){
117
- global $wpdb;
118
-
119
- $orderedList = array();
120
-
121
- if ( ! isset( $parent_id ) )
122
- $parent_id = 0;
123
-
124
- $category_list = get_terms( 'wpsc_product_category', 'hide_empty=0&parent=' . $parent_id );
125
-
126
- if ( ! is_array( $category_list ) ) {
127
- return false;
128
- }
129
-
130
- foreach ( $category_list as $category ) {
131
- $category_order = wpsc_get_categorymeta( $category->term_id, 'order' );
132
- $category_image = wpsc_get_categorymeta( $category->term_id, 'image' );
133
-
134
- if ( ! isset( $category_order ) || $category_order == 0 )
135
- $category_order = ( count( $orderedList ) + 1 );
136
- print "<!-- setting category Order number to " . $category_order . "-->";
137
- $orderedList[$category_order]['id'] = $category->term_id;
138
- $orderedList[$category_order]['name'] = $category->name;
139
- $orderedList[$category_order]['image'] = $category_image;
140
- $orderedList[$category_order]['parent_id'] = $parent_id;
141
- $orderedList[$category_order]['children'] = wpsc_admin_get_category_array( $category->term_id );
142
- }
143
-
144
- ksort( $orderedList );
145
- return $orderedList;
146
- }
147
-
148
- /**
149
- * wpsc_admin_category_group_list, prints the left hand side of the add categories page
150
- * nothing returned
151
- */
152
- function wpsc_admin_category_forms_add() {
153
- global $wpdb;
154
- $category_value_count = 0;
155
- $display_type = isset( $category['display_type'] ) ? $category['display_type'] : '';
156
- ?>
157
-
158
- <h3><?php esc_html_e('Advanced Store Settings', 'wp-e-commerce'); ?></h3>
159
- <h4><?php esc_html_e('Presentation Settings', 'wp-e-commerce'); ?></h4>
160
- <p class='description'><?php esc_html_e( 'These settings override the general presentation settings found in Settings &gt; Store &gt; Presentation.', 'wp-e-commerce' ); ?></p>
161
- <div style="margin: 15px 0 15px 0">
162
- <label for='image'><?php esc_html_e( 'Category Image' , 'wp-e-commerce' ); ?></label>
163
- <input type='file' name='image' value='' />
164
- </div>
165
- <div class="form-field">
166
- <label for='display_type'><?php esc_html_e( 'Product Display', 'wp-e-commerce' ); ?></label>
167
- <select name='display_type'>
168
- <option value='default'<?php checked( $display_type, 'default' ); ?>><?php esc_html_e('Default View', 'wp-e-commerce'); ?></option>
169
- <option value='list'<?php disabled( _wpsc_is_display_type_supported( 'list' ), false ); ?><?php checked( $display_type, 'list' ); ?>><?php esc_html_e('List View', 'wp-e-commerce'); ?></option>
170
- <option value='grid'<?php disabled( _wpsc_is_display_type_supported( 'grid' ), false ); ?><?php checked( $display_type, 'grid' ); ?>><?php esc_html_e('Grid View', 'wp-e-commerce'); ?></option>
171
- </select>
172
- </div>
173
- <?php if ( function_exists( "getimagesize" ) ) : ?>
174
- <div class="form-field">
175
- <?php esc_html_e( 'Thumbnail Size', 'wp-e-commerce' ); ?>
176
- <fieldset class="wpsc-width-height-fields">
177
- <legend class="screen-reader-text"><span><?php esc_html_e( 'Thumbnail Size', 'wp-e-commerce' ); ?></span></legend>
178
- <label for="image_width"><?php esc_html_e( 'Width', 'wp-e-commerce' ); ?></label>
179
- <input name="image_width" type="number" step="1" min="0" id="image_width" value="<?php if ( isset( $category['image_width'] ) ) echo esc_attr( $category['image_width'] ); ?>" class="small-text" style="width: 70px">
180
- <label for="large_size_h"><?php esc_html_e( 'Height', 'wp-e-commerce' ); ?></label>
181
- <input name="image_height" type="number" step="1" min="0" id="image_height" value="<?php if ( isset( $category['image_height'] ) ) echo esc_attr( $category['image_height'] ); ?>" class="small-text" style="width: 70px">
182
- </fieldset>
183
- </div>
184
- <?php endif;?>
185
-
186
- <!-- START OF TARGET MARKET SELECTION -->
187
- <?php
188
-
189
- $category_id = '';
190
-
191
- if ( isset( $_GET['tag_ID'] ) ) {
192
- $category_id = absint( $_GET['tag_ID'] );
193
- }
194
-
195
- $countrylist = WPSC_Countries::get_countries_array( true, true );
196
- $selectedCountries = wpsc_get_meta( $category_id, 'target_market', 'wpsc_category' );
197
- ?>
198
- <h4><?php esc_html_e( 'Restrict to Target Markets', 'wp-e-commerce' )?></h4>
199
- <div class='form-field'>
200
- <?php if ( wpsc_is_suhosin_enabled() ) : ?>
201
- <em><?php esc_html_e( "The Target Markets feature has been disabled because you have the Suhosin PHP extension installed on this server. If you need to use the Target Markets feature, then disable the suhosin extension. If you can not do this, you will need to contact your hosting provider.", 'wp-e-commerce' ); ?></em>
202
- <?php else: ?>
203
- <div class='multiple-select-container'>
204
- <span><?php esc_html_e( 'Select', 'wp-e-commerce' ); ?> <a href='' class='wpsc_select_all'><?php esc_html_e( 'All', 'wp-e-commerce' ); ?></a>&nbsp; <a href='' class='wpsc_select_none'><?php esc_html_e( 'None', 'wp-e-commerce' ); ?></a></span><br />
205
- <div id='resizeable' class='ui-widget-content multiple-select'>
206
- <?php foreach( $countrylist as $country ): ?>
207
- <?php if ( in_array( $country['id'], (array)$selectedCountries ) ): ?>
208
- <input type='checkbox' name='countrylist2[]' id='countrylist2-<?php echo $country['id']; ?>' value='<?php echo $country['id']; ?>' checked='<?php echo $country['visible']; ?>' />
209
- <label for="countrylist2-<?php echo $country['id']; ?>"><?php echo esc_html( $country['country'] ); ?></label><br />
210
- <?php else: ?>
211
- <input type='checkbox' name='countrylist2[]' id='countrylist2-<?php echo $country['id']; ?>' value='<?php echo $country['id']; ?>' />
212
- <label for="countrylist2-<?php echo $country['id']; ?>"><?php echo esc_html( $country['country'] ); ?></label><br />
213
- <?php endif; ?>
214
- <?php endforeach; ?>
215
- </div>
216
- </div>
217
- <span class='wpscsmall description'><?php esc_html_e( 'Select the markets you are selling this category to.', 'wp-e-commerce' ); ?><span>
218
- <?php endif; ?>
219
- </div>
220
-
221
- <!-- Checkout settings -->
222
- <h4><?php esc_html_e( 'Checkout Settings', 'wp-e-commerce' ); ?></h4>
223
-
224
- <?php
225
- if ( ! isset( $category['term_id'] ) ) $category['term_id'] = '';
226
- $used_additonal_form_set = wpsc_get_categorymeta( $category['term_id'], 'use_additional_form_set' );
227
- ?>
228
- <div class='form-field'>
229
- <label for="use_additional_form_set"><?php esc_html_e( 'Category requires additional checkout form fields', 'wp-e-commerce' ); ?></label>
230
- <select name='use_additional_form_set'>
231
- <option value=''><?php esc_html_e( 'None', 'wp-e-commerce' ); ?></option>
232
- <?php
233
- $checkout_sets = get_option( 'wpsc_checkout_form_sets' );
234
- unset( $checkout_sets[0] );
235
-
236
- foreach ( (array)$checkout_sets as $key => $value ) {
237
- $selected_state = "";
238
- if ( $used_additonal_form_set == $key )
239
- $selected_state = "selected='selected'";
240
- ?>
241
- <option <?php echo $selected_state; ?> value='<?php echo $key; ?>'><?php echo esc_html( $value ); ?></option>
242
- <?php
243
- }
244
- ?>
245
- </select>
246
- </div>
247
-
248
- <?php $uses_billing_address = (bool)wpsc_get_categorymeta( $category['term_id'], 'uses_billing_address' ); ?>
249
- <div>
250
- <label><?php esc_html_e( 'Address to calculate shipping with', 'wp-e-commerce' ); ?></label>
251
- <label><input type="radio" value="0" name="uses_billing_address" <?php checked( $uses_billing_address, 0 ); ?> /> <?php esc_html_e( 'Shipping Address (default)', 'wp-e-commerce' ); ?></label>
252
- <label><input type="radio" value="1" name="uses_billing_address" <?php checked( $uses_billing_address, 1 ); ?> /> <?php esc_html_e( 'Billing Address', 'wp-e-commerce' ); ?></label>
253
- <p class='description'><?php esc_html_e( 'Products in this category will use the address specified to calculate shipping costs.', 'wp-e-commerce' ); ?></p>
254
- </div>
255
-
256
- <table class="category_forms">
257
- <tr>
258
-
259
- </tr>
260
- </table>
261
- <?php
262
- }
263
-
264
- /**
265
- * Check whether a display type (such as grid, list) is supported.
266
- *
267
- * @since 3.8.9
268
- * @access private
269
- * @param string $display_type Display type
270
- * @return bool Return true if display type is supported.
271
- */
272
- function _wpsc_is_display_type_supported( $display_type ) {
273
- $callback = 'product_display_' . $display_type;
274
- return function_exists( $callback );
275
- }
276
-
277
- function wpsc_admin_category_forms_edit() {
278
- global $wpdb;
279
-
280
- $category_value_count = 0;
281
- $category_name = '';
282
- $category = array();
283
-
284
- $category_id = absint( $_REQUEST["tag_ID"] );
285
- $category = get_term( $category_id, 'wpsc_product_category', ARRAY_A );
286
- $category['nice-name'] = wpsc_get_categorymeta( $category['term_id'], 'nice-name' );
287
- $category['description'] = wpsc_get_categorymeta( $category['term_id'], 'description' );
288
- $category['image'] = wpsc_get_categorymeta( $category['term_id'], 'image' );
289
- $category['fee'] = wpsc_get_categorymeta( $category['term_id'], 'fee' );
290
- $category['active'] = wpsc_get_categorymeta( $category['term_id'], 'active' );
291
- $category['order'] = wpsc_get_categorymeta( $category['term_id'], 'order' );
292
- $category['display_type'] = wpsc_get_categorymeta( $category['term_id'], 'display_type' );
293
- $category['image_height'] = wpsc_get_categorymeta( $category['term_id'], 'image_height' );
294
- $category['image_width'] = wpsc_get_categorymeta( $category['term_id'], 'image_width' );
295
- $category['use_additional_form_set'] = wpsc_get_categorymeta( $category['term_id'], 'use_additional_form_set' );
296
-
297
- ?>
298
-
299
- <tr>
300
- <td colspan="2">
301
- <h3><?php esc_html_e( 'Advanced Store Settings', 'wp-e-commerce' ); ?></h3>
302
- <h4><?php esc_html_e( 'Shortcodes and Template Tags', 'wp-e-commerce' ); ?></h4>
303
- <p class='description'><?php esc_html_e( 'These settings override the general presentation settings found in Settings &gt; Store &gt; Presentation.', 'wp-e-commerce' ); ?></p>
304
- </td>
305
- </tr>
306
-
307
-
308
- <tr class="form-field">
309
- <th scope="row" valign="top">
310
- <label for="display_type"><?php esc_html_e( 'Catalog View', 'wp-e-commerce' ); ?></label>
311
- </th>
312
- <td>
313
- <?php
314
- $display_type = isset( $category['display_type'] ) ? $category['display_type'] : '';
315
- ?>
316
- <select name='display_type'>
317
- <option value='default'<?php selected( $display_type, 'default' ); ?>><?php esc_html_e( 'Default View', 'wp-e-commerce' ); ?></option>
318
- <option value='list'<?php disabled( _wpsc_is_display_type_supported( 'list' ), false ); ?><?php selected( $display_type, 'list' ); ?>><?php esc_html_e('List View', 'wp-e-commerce'); ?></option>
319
- <option value='grid' <?php disabled( _wpsc_is_display_type_supported( 'grid' ), false ); ?><?php selected( $display_type, 'grid' ); ?>><?php esc_html_e( 'Grid View', 'wp-e-commerce' ); ?></option>
320
- </select><br />
321
- </td>
322
- </tr>
323
- <tr class="form-field">
324
- <th scope="row" valign="top">
325
- <label for="image"><?php esc_html_e( 'Category Image', 'wp-e-commerce' ); ?></label>
326
- </th>
327
- <td>
328
- <?php
329
- $category_image = wpsc_category_image( $category['term_id'] );
330
- if ( $category_image )
331
- echo '<p><img src=' . esc_url( $category_image ) . ' alt="' . esc_attr( $category['name'] ) . '" title="' . esc_attr( $category['name'] ) . '" class="wpsc_category_image" /></p>';
332
- ?>
333
- <input type='file' name='image' value='' /><br />
334
- <label><input type='checkbox' name='deleteimage' class="wpsc_cat_box" value='1' /><?php esc_html_e( 'Delete Image', 'wp-e-commerce' ); ?></label><br/>
335
- <span class="description"><?php esc_html_e( 'You can set an image for the category here. If one exists, check the box to delete.', 'wp-e-commerce' ); ?></span>
336
- </td>
337
- </tr>
338
- <?php if ( function_exists( "getimagesize" ) ) : ?>
339
- <tr class="form-field">
340
- <th scope="row" valign="top">
341
- <label for="image"><?php esc_html_e( 'Thumbnail Size', 'wp-e-commerce' ); ?></label>
342
- </th>
343
- <td>
344
- <fieldset class="wpsc-width-height-fields">
345
- <legend class="screen-reader-text"><span><?php esc_html_e( 'Thumbnail Size', 'wp-e-commerce' ); ?></span></legend>
346
- <label for="image_width"><?php esc_html_e( 'Width', 'wp-e-commerce' ); ?></label>
347
- <input name="image_width" type="number" step="1" min="0" id="image_width" value="<?php if ( isset( $category['image_width'] ) ) echo esc_attr( $category['image_width'] ); ?>" class="small-text">
348
- <label for="large_size_h"><?php esc_html_e( 'Height', 'wp-e-commerce' ); ?></label>
349
- <input name="image_height" type="number" step="1" min="0" id="image_height" value="<?php if ( isset( $category['image_height'] ) ) echo esc_attr( $category['image_height'] ); ?>" class="small-text">
350
- </fieldset>
351
- </td>
352
- </tr>
353
- <?php endif; // 'getimagesize' condition ?>
354
-
355
-
356
- <tr>
357
- <td colspan="2"><h4><?php esc_html_e( 'Shortcodes and Template Tags', 'wp-e-commerce' ); ?></h4></td>
358
- </tr>
359
-
360
- <tr class="form-field">
361
- <th scope="row" valign="top">
362
- <label for="image"><?php esc_html_e( 'Display Category Shortcode', 'wp-e-commerce' ); ?></label>
363
- </th>
364
- <td>
365
- <code>[wpsc_products category_url_name='<?php echo $category["slug"]; ?>']</code><br />
366
- <span class="description"><?php esc_html_e( 'Shortcodes are used to display a particular category or group within any WordPress page or post.', 'wp-e-commerce' ); ?></span>
367
- </td>
368
- </tr>
369
- <tr class="form-field">
370
- <th scope="row" valign="top">
371
- <label for="image"><?php esc_html_e( 'Display Category Template Tag', 'wp-e-commerce' ); ?></label>
372
- </th>
373
- <td>
374
- <code>&lt;?php echo wpsc_display_products_page( array( 'category_url_name' => '<?php echo $category["slug"]; ?>' ) ); ?&gt;</code><br />
375
- <span class="description"><?php esc_html_e( 'Template tags are used to display a particular category or group within your theme / template.', 'wp-e-commerce' ); ?></span>
376
- </td>
377
- </tr>
378
-
379
- <!-- START OF TARGET MARKET SELECTION -->
380
-
381
- <tr>
382
- <td colspan="2">
383
- <h4><?php esc_html_e( 'Target Market Restrictions', 'wp-e-commerce' ); ?></h4>
384
- </td>
385
- </tr>
386
- <?php
387
- $countrylist = WPSC_Countries::get_countries_array( true, true );
388
- $selectedCountries = wpsc_get_meta( $category_id,'target_market','wpsc_category' );
389
- ?>
390
- <tr>
391
- <th scope="row" valign="top">
392
- <label for="image"><?php esc_html_e( 'Target Markets', 'wp-e-commerce' ); ?></label>
393
- </th>
394
- <td>
395
- <?php if ( wpsc_is_suhosin_enabled() ) : ?>
396
- <em><?php esc_html_e( 'The Target Markets feature has been disabled because you have the Suhosin PHP extension installed on this server. If you need to use the Target Markets feature, then disable the suhosin extension. If you can not do this, you will need to contact your hosting provider.','wp-e-commerce' ); ?></em>
397
- <?php else : ?>
398
- <span><?php esc_html_e( 'Select', 'wp-e-commerce' ); ?>: <a href='' class='wpsc_select_all'><?php esc_html_e( 'All', 'wp-e-commerce' ); ?></a>&nbsp; <a href='' class='wpsc_select_none'><?php esc_html_e( 'None', 'wp-e-commerce' ); ?></a></span><br />
399
- <div id='resizeable' class='ui-widget-content multiple-select'>
400
- <?php foreach( $countrylist as $country ) {
401
- if ( in_array( $country['id'], (array)$selectedCountries ) ) {
402
- ?>
403
- <input type='checkbox' name='countrylist2[]' id='countrylist2-<?php echo $country['id']; ?>' value='<?php echo $country['id']; ?>' checked='<?php echo $country['visible']; ?>' />
404
- <label for="countrylist2-<?php echo $country['id']; ?>"><?php echo esc_html( $country['country'] ); ?></label><br />
405
- <?php
406
- } else {
407
- ?>
408
- <input type='checkbox' name='countrylist2[]' id='countrylist2-<?php echo $country['id']; ?>' value='<?php echo $country['id']; ?>' />
409
- <label for="countrylist2-<?php echo $country['id']; ?>"><?php echo esc_html( $country['country'] ); ?></label><br />
410
- <?php
411
- }
412
- } ?>
413
- </div>
414
- <?php endif; ?><br />
415
- <span class="description"><?php esc_html_e( 'Select the markets you are selling this category to.', 'wp-e-commerce' ); ?></span>
416
- </td>
417
- </tr>
418
-
419
- <!-- Checkout settings -->
420
-
421
- <tr>
422
- <td colspan="2">
423
- <h4><?php esc_html_e( 'Checkout Settings', 'wp-e-commerce' ); ?></h4>
424
- </td>
425
- </tr>
426
- <?php
427
- if ( !isset( $category['term_id'] ) )
428
- $category['term_id'] = '';
429
-
430
- $used_additonal_form_set = wpsc_get_categorymeta( $category['term_id'], 'use_additional_form_set' );
431
- $checkout_sets = get_option('wpsc_checkout_form_sets');
432
- unset($checkout_sets[0]);
433
- $uses_billing_address = (bool)wpsc_get_categorymeta( $category['term_id'], 'uses_billing_address' );
434
- ?>
435
- <tr class="form-field">
436
- <th scope="row" valign="top">
437
- <label for="image"><?php esc_html_e( 'Category requires additional checkout form fields', 'wp-e-commerce' ); ?></label>
438
- </th>
439
- <td>
440
- <select name='use_additional_form_set'>
441
- <option value=''><?php esc_html_e( 'None', 'wp-e-commerce' ); ?></option>
442
- <?php
443
- foreach( (array) $checkout_sets as $key => $value ) {
444
- $selected_state = "";
445
- if ( $used_additonal_form_set == $key ) {
446
- $selected_state = "selected='selected'";
447
- } ?>
448
- <option <?php echo $selected_state; ?> value='<?php echo $key; ?>'><?php echo esc_html( $value ); ?></option>
449
- <?php
450
- }
451
- ?>
452
- </select>
453
- </td>
454
- </tr>
455
-
456
- <tr class="form-field">
457
- <th scope="row" valign="top">
458
- <label><?php esc_html_e( 'Address to calculate shipping with', 'wp-e-commerce' ); ?></label>
459
- </th>
460
- <td>
461
- <label><input type="radio" class="wpsc_cat_box" value="0" name="uses_billing_address" <?php echo ( ( $uses_billing_address != true ) ? 'checked="checked"' : '' ); ?> /> <?php esc_html_e( 'Shipping Address (default)', 'wp-e-commerce' ); ?></label><br />
462
- <label><input type="radio" class="wpsc_cat_box" value="1" name="uses_billing_address" <?php echo ( ( $uses_billing_address == true ) ? 'checked="checked"' : '' ); ?> /> <?php esc_html_e( 'Billing Address', 'wp-e-commerce' ); ?></label>
463
- <p class='description'><?php esc_html_e( 'Products in this category will use the address specified to calculate shipping costs.', 'wp-e-commerce' ); ?></p>
464
- </td>
465
- </tr>
466
-
467
- <?php
468
- }
469
-
470
- /**
471
- * wpsc_save_category_set, Saves the category set data
472
- * @param nothing
473
- * @return nothing
474
- */
475
- function wpsc_save_category_set( $category_id, $tt_id ) {
476
- global $wpdb;
477
-
478
- if ( ! empty( $_POST ) ) {
479
- /* Image Processing Code*/
480
- if ( ! empty( $_FILES['image'] ) && preg_match( "/\.(gif|jp(e)*g|png){1}$/i", $_FILES['image']['name'] ) ) {
481
- if ( function_exists( "getimagesize" ) ) {
482
- if ( isset( $_POST['width'] ) && ( (int) $_POST['width'] > 10 && (int) $_POST['width'] < 512 ) && ( (int)$_POST['height'] > 10 && (int)$_POST['height'] < 512 ) ) {
483
- $width = (int) $_POST['width'];
484
- $height = (int) $_POST['height'];
485
- image_processing( $_FILES['image']['tmp_name'], ( WPSC_CATEGORY_DIR.$_FILES['image']['name'] ), $width, $height, 'image' );
486
- } else {
487
- image_processing( $_FILES['image']['tmp_name'], ( WPSC_CATEGORY_DIR.$_FILES['image']['name'] ), null, null, 'image' );
488
- }
489
- $image = esc_sql( $_FILES['image']['name'] );
490
- } else {
491
- $new_image_path = ( WPSC_CATEGORY_DIR.basename($_FILES['image']['name'] ) );
492
- move_uploaded_file( $_FILES['image']['tmp_name'], $new_image_path );
493
- $stat = stat( dirname( $new_image_path ) );
494
- $perms = $stat['mode'] & 0000666;
495
- @ chmod( $new_image_path, $perms );
496
- $image = esc_sql( $_FILES['image']['name'] );
497
- }
498
- } else {
499
- $image = '';
500
- }
501
- //Good to here
502
- if ( isset( $_POST['tag_ID'] ) ) {
503
- //Editing
504
- $category_id = (int) $_POST['tag_ID'];
505
- $category = get_term_by( 'id', $category_id, 'wpsc_product_category' );
506
- $url_name = $category->slug;
507
-
508
- }
509
- if ( isset( $_POST['deleteimage'] ) && $_POST['deleteimage'] == 1 ) {
510
- wpsc_delete_categorymeta( $category_id, 'image' );
511
- } else if ( $image != '' ) {
512
- wpsc_update_categorymeta( $category_id, 'image', $image );
513
- }
514
-
515
- if ( ! empty( $_POST['height'] ) && is_numeric( $_POST['height'] ) && ! empty( $_POST['width'] ) && is_numeric( $_POST['width'] ) && $image == null ) {
516
- $imagedata = wpsc_get_categorymeta( $category_id, 'image' );
517
- if ( $imagedata != null ) {
518
- $height = (int) $_POST['height'];
519
- $width = (int) $_POST['width'];
520
- $imagepath = WPSC_CATEGORY_DIR . $imagedata;
521
- $image_output = WPSC_CATEGORY_DIR . $imagedata;
522
- image_processing( $imagepath, $image_output, $width, $height );
523
- }
524
- }
525
-
526
- wpsc_update_categorymeta( $category_id, 'fee', '0' );
527
- wpsc_update_categorymeta( $category_id, 'active', '1' );
528
- wpsc_update_categorymeta( $category_id, 'order', '0' );
529
-
530
- if ( isset( $_POST['display_type'] ) ) {
531
- wpsc_update_categorymeta( $category_id, 'display_type', esc_sql( stripslashes( $_POST['display_type'] ) ) );
532
- }
533
-
534
- if ( isset( $_POST['image_height'] ) ) {
535
- wpsc_update_categorymeta( $category_id, 'image_height', (int) $_POST['image_height'] );
536
- }
537
-
538
- if ( isset( $_POST['image_width'] ) ) {
539
- wpsc_update_categorymeta( $category_id, 'image_width', (int) $_POST['image_width'] );
540
- }
541
-
542
- if ( ! empty( $_POST['use_additional_form_set'] ) ) {
543
- wpsc_update_categorymeta( $category_id, 'use_additional_form_set', absint( $_POST['use_additional_form_set'] ) );
544
- } else {
545
- wpsc_delete_categorymeta( $category_id, 'use_additional_form_set' );
546
- }
547
-
548
- if ( ! empty( $_POST['uses_billing_address'] ) ) {
549
- wpsc_update_categorymeta( $category_id, 'uses_billing_address', 1 );
550
- $uses_additional_forms = true;
551
- } else {
552
- wpsc_update_categorymeta( $category_id, 'uses_billing_address', 0 );
553
- $uses_additional_forms = false;
554
- }
555
-
556
- if ( ! empty( $_POST['countrylist2'] ) && ( $category_id > 0 ) ) {
557
- $AllSelected = false;
558
- $countryList = $wpdb->get_col( "SELECT `id` FROM `" . WPSC_TABLE_CURRENCY_LIST . "`" );
559
-
560
- if ( $AllSelected != true ){
561
- $posted_countries = array_map( 'intval', $_POST['countrylist2'] );
562
- $unselectedCountries = array_diff( $countryList, $posted_countries );
563
- //find the countries that are selected
564
- $selectedCountries = array_intersect( $countryList, $posted_countries );
565
- wpsc_update_categorymeta( $category_id, 'target_market', $selectedCountries );
566
- }
567
-
568
- } elseif ( ! isset( $_POST['countrylist2'] ) ){
569
- wpsc_update_categorymeta( $category_id, 'target_market', '' );
570
- $AllSelected = true;
571
- }
572
-
573
- }
574
- }
575
-
576
-
577
- ?>
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
trunk/wpsc-admin/includes/settings-tabs/admin.php DELETED
@@ -1,153 +0,0 @@
1
- <?php
2
-
3
- /**
4
- * The Admin Settings Tab class
5
- *
6
- * @package wp-e-commerce
7
- */
8
-
9
- class WPSC_Settings_Tab_Admin extends WPSC_Settings_Tab {
10
- public function display() {
11
- ?>
12
- <h3><?php esc_html_e( 'Admin Settings', 'wp-e-commerce' ); ?></h3>
13
- <table class='wpsc_options form-table'>
14
- <tr>
15
- <th scope="row"><?php esc_html_e( 'Max downloads per file', 'wp-e-commerce' ); ?>: </th>
16
- <td>
17
- <input type="number" min="0" size="10" value="<?php echo esc_attr( get_option('max_downloads') ); ?>" name="wpsc_options[max_downloads]" />
18
- </td>
19
- </tr>
20
- <?php
21
- $wpsc_ip_lock_downloads1 = "";
22
- $wpsc_ip_lock_downloads2 = "";
23
- switch( esc_attr( get_option('wpsc_ip_lock_downloads') ) ) {
24
- case 1:
25
- $wpsc_ip_lock_downloads1 = "checked ='checked'";
26
- break;
27
-
28
- case 0:
29
- default:
30
- $wpsc_ip_lock_downloads2 = "checked ='checked'";
31
- break;
32
- }
33
-
34
- ?>
35
- <tr>
36
- <th scope="row">
37
- <?php esc_html_e( 'Lock downloads to IP address', 'wp-e-commerce' ); ?>:
38
- </th>
39
- <td>
40
- <input type='radio' value='1' name='wpsc_options[wpsc_ip_lock_downloads]' id='wpsc_ip_lock_downloads2' <?php echo $wpsc_ip_lock_downloads1; ?> /> <label for='wpsc_ip_lock_downloads2'><?php _e('Yes', 'wp-e-commerce');?></label>&nbsp;
41
- <input type='radio' value='0' name='wpsc_options[wpsc_ip_lock_downloads]' id='wpsc_ip_lock_downloads1' <?php echo $wpsc_ip_lock_downloads2; ?> /> <label for='wpsc_ip_lock_downloads1'><?php _e('No', 'wp-e-commerce');?></label><br />
42
- </td>
43
- </tr>
44
-
45
-
46
- <?php
47
- $wpsc_check_mime_types1 = "";
48
- $wpsc_check_mime_types2 = "";
49
- switch( esc_attr( get_option('wpsc_check_mime_types') ) ) {
50
- case 1:
51
- $wpsc_check_mime_types2 = "checked ='checked'";
52
- break;
53
-
54
- case 0:
55
- default:
56
- $wpsc_check_mime_types1 = "checked ='checked'";
57
- break;
58
- }
59
-
60
- ?>
61
- <tr>
62
- <th scope="row">
63
- <?php esc_html_e( 'Check MIME types on file uploads', 'wp-e-commerce' ); ?>:
64
- </th>
65
- <td>
66
- <input type='radio' value='0' name='wpsc_options[wpsc_check_mime_types]' id='wpsc_check_mime_types2' <?php echo $wpsc_check_mime_types1; ?> /> <label for='wpsc_check_mime_types2'><?php _e('Yes', 'wp-e-commerce');?></label>&nbsp;
67
- <input type='radio' value='1' name='wpsc_options[wpsc_check_mime_types]' id='wpsc_check_mime_types1' <?php echo $wpsc_check_mime_types2; ?> /> <label for='wpsc_check_mime_types1'><?php _e('No', 'wp-e-commerce');?></label><br />
68
-
69
- <span class="wpscsmall description">
70
- <?php esc_html_e( 'Warning: Disabling this exposes your site to greater possibility of malicious files being uploaded, we recommend installing the Fileinfo extension for PHP rather than disabling this.', 'wp-e-commerce' ); ?>
71
- </span>
72
- </td>
73
- </tr>
74
-
75
-
76
- <tr>
77
- <th scope="row">
78
- <?php esc_html_e( 'Store Admin Email', 'wp-e-commerce' );?>:
79
- </th>
80
- <td>
81
- <input class='text' name='wpsc_options[purch_log_email]' type='text' size='40' value='<?php echo esc_attr( get_option( 'purch_log_email' ) ); ?>' />
82
- <p class="howto"><?php esc_html_e( 'Admin notifications will be sent here.', 'wp-e-commerce' ); ?></p>
83
- </td>
84
- </tr>
85
-
86
- <tr>
87
- <th scope="row">
88
- <?php esc_html_e( 'Terms and Conditions', 'wp-e-commerce' );?>:
89
- </th>
90
- <td>
91
- <textarea name='wpsc_options[terms_and_conditions]' cols='' rows='' style='width: 300px; height: 200px;'><?php echo esc_textarea( get_option( 'terms_and_conditions' ) ); ?></textarea>
92
- </td>
93
- </tr>
94
-
95
- </table>
96
- <h3 class="form_group"><?php esc_html_e( 'Customer Purchase Receipt', 'wp-e-commerce' );?>:</h3>
97
- <table class='wpsc_options form-table'>
98
- <tr>
99
- <th colspan="2"><?php esc_html_e( 'Tags can be used', 'wp-e-commerce' );?>: <?php echo esc_html( '%purchase_id%, %shop_name%, %product_list%, %total_price%, %total_shipping%, %find_us%, %total_tax%' ); ?></th>
100
- </tr>
101
- <tr>
102
- <td class='wpsc_td_note' colspan='2'>
103
- <span class="wpscsmall description">
104
- <?php esc_html_e( 'Note: The purchase receipt is the message e-mailed to users after purchasing products from your shop.' , 'wp-e-commerce' ); ?>
105
- <br />
106
- <?php esc_html_e( 'Note: You need to have the %product_list% in your purchase receipt in order for digital download links to be emailed to your buyers.' , 'wp-e-commerce' ); ?>
107
- </span>
108
- </td>
109
- </tr>
110
- <tr>
111
- <th scope="row">
112
- <?php echo esc_html_x( 'From Address', 'purchase receipt', 'wp-e-commerce' );?>:
113
- </th>
114
- <td>
115
- <input class='text' name='wpsc_options[return_email]' type='text' size='40' value='<?php echo esc_attr( get_option( 'return_email' ) ); ?>' />
116
- </td>
117
- </tr>
118
-
119
- <tr>
120
- <th scope="row">
121
- <?php esc_html_e( 'Sender Name', 'wp-e-commerce' );?>:
122
- </th>
123
- <td>
124
- <input class='text' name='wpsc_options[return_name]' type='text' size='40' value='<?php echo esc_attr( get_option( 'return_name' ) ); ?>' />
125
- </td>
126
- </tr>
127
- <tr>
128
- <th><?php esc_html_e( 'Message Body', 'wp-e-commerce' ); ?></th>
129
- <td><textarea name="wpsc_options[wpsc_email_receipt]" cols='' rows='' style='width: 300px; height: 200px;'><?php echo esc_textarea( get_option( 'wpsc_email_receipt' ) );?></textarea></td>
130
- </tr>
131
- </table>
132
-
133
- <h3 class="form_group"><?php esc_html_e( 'Track and Trace settings', 'wp-e-commerce' ); ?>:</h3>
134
- <table class='wpsc_options form-table'>
135
- <tr>
136
- <td class='wpsc_td_note' colspan='2'>
137
- <span class="wpscsmall description">
138
- <?php esc_html_e( 'Note: The Tracking Subject, is the subject for The Tracking Message email. The Tracking Message is the message e-mailed to users when you click \'Email buyer\' on the sales log. This option is only available for purchases with the status of \'Job Dispatched\'. Tags you can use in the email message section are %trackid% and %shop_name%' , 'wp-e-commerce' ); ?>
139
- </span>
140
- </td>
141
- </tr>
142
- <tr>
143
- <th><strong><?php esc_html_e( 'Tracking Email Subject', 'wp-e-commerce' );?></strong></th>
144
- <td><input name="wpsc_options[wpsc_trackingid_subject]" type='text' value='<?php echo esc_attr( get_option( 'wpsc_trackingid_subject' ) );?>' /></td>
145
- </tr>
146
- <tr>
147
- <th><strong><?php esc_html_e( 'Tracking Email Message', 'wp-e-commerce' );?></strong></th>
148
- <td><textarea name="wpsc_options[wpsc_trackingid_message]" cols='' rows='' style='width: 300px; height: 200px;'><?php echo esc_textarea( get_option( 'wpsc_trackingid_message' ) );?></textarea></td>
149
- </tr>
150
- </table>
151
- <?php
152
- }
153
- }
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
trunk/wpsc-admin/includes/settings-tabs/checkout.php DELETED
@@ -1,525 +0,0 @@
1
- <?php
2
-
3
- class WPSC_Settings_Tab_Checkout extends WPSC_Settings_Tab {
4
-
5
- private $require_register;
6
- private $shipping_same_as_billing;
7
- private $force_ssl;
8
- private $checkout_sets;
9
- private $current_checkout_set;
10
- private $field_types;
11
- private $user_field_types;
12
- private $form_fields;
13
-
14
- public function __construct() {
15
- global $wpdb;
16
-
17
- $this->require_register = get_option( 'require_register', 0 );
18
- $this->shipping_same_as_billing = get_option( 'shippingsameasbilling', 0 );
19
- $this->force_ssl = get_option( 'wpsc_force_ssl', 0 );
20
- $this->checkout_sets = get_option( 'wpsc_checkout_form_sets' );
21
- $this->current_checkout_set = empty( $_GET['checkout_set'] ) ? 0 : (int) $_GET['checkout_set'];
22
- $this->field_types = get_option( 'wpsc_checkout_form_fields' );
23
- $this->user_field_types = array('text','textarea','heading','select','radio','checkbox');
24
-
25
- if ( ! isset( $this->checkout_sets[$this->current_checkout_set] ) ) {
26
- wp_redirect( esc_url_raw( remove_query_arg( 'checkout_set' ) ) );
27
- exit;
28
- }
29
-
30
- $form_sql = $wpdb->prepare( "
31
- SELECT *
32
- FROM " . WPSC_TABLE_CHECKOUT_FORMS . "
33
- WHERE checkout_set = %s
34
- ORDER BY checkout_order
35
- ", $this->current_checkout_set );
36
-
37
- $this->form_fields = $wpdb->get_results( $form_sql );
38
-
39
- $columns = array(
40
- 'drag' => __( 'Drag', 'wp-e-commerce' ),
41
- 'name' => __( 'Title', 'wp-e-commerce' ),
42
- 'type' => __( 'Type', 'wp-e-commerce' ),
43
- 'unique_name' => '&nbsp;',
44
- 'display' => __( 'Display', 'wp-e-commerce' ),
45
- 'mandatory' => __( 'Mandatory', 'wp-e-commerce' ),
46
- 'actions' => '&nbsp;',
47
- );
48
- register_column_headers( 'display-checkout-list', $columns );
49
- }
50
-
51
- private function delete_form_set() {
52
- global $wpdb;
53
-
54
- $selected_checkout_set = $_REQUEST['checkout_set'];
55
-
56
- if ( empty( $selected_checkout_set ) )
57
- return;
58
-
59
- $form_sets = get_option( 'wpsc_checkout_form_sets' );
60
- unset( $form_sets[$selected_checkout_set] );
61
- update_option( 'wpsc_checkout_form_sets', $form_sets );
62
-
63
- $sql = $wpdb->prepare( 'DELETE FROM ' . WPSC_TABLE_CHECKOUT_FORMS . ' WHERE checkout_set = %s', $selected_checkout_set );
64
- $wpdb->query( $sql );
65
- }
66
-
67
- public function callback_submit_options() {
68
- global $wpdb;
69
-
70
- if ( ! empty( $_POST['wpsc_checkout_set_delete'] ) ) {
71
- $this->delete_form_set();
72
- return;
73
- }
74
-
75
- if ( ! empty( $_POST['new_form_set'] ) ) {
76
- $checkout_sets = get_option( 'wpsc_checkout_form_sets' );
77
- $checkout_sets[] = sanitize_text_field( $_POST['new_form_set'] );
78
- update_option( 'wpsc_checkout_form_sets', $checkout_sets );
79
- add_settings_error( 'wpsc-settings', 'wpsc_form_set_added', __( 'New form set successfully created.', 'wp-e-commerce' ), 'updated' );
80
- }
81
-
82
- if ( isset( $_POST['checkout_set'] ) ) {
83
- $_SERVER['REQUEST_URI'] = esc_url_raw( add_query_arg( 'checkout_set', $_POST['checkout_set'] ) );
84
- }
85
-
86
- if ( ! isset( $_POST['form_name'] ) && ! isset( $_POST['new_field_name'] ) )
87
- return;
88
-
89
- $existing_orders = array();
90
- $new_field_orders = array();
91
- if ( ! empty( $_POST['sort_order'] ) ) {
92
- foreach ( $_POST['sort_order'] as $order => $field_id ) {
93
- $id = absint( preg_replace('/[^0-9]+/', '', $field_id) );
94
-
95
- if ( strpos( $field_id, 'new-field' ) === 0 )
96
- $new_field_orders[$id] = $order;
97
- else
98
- $existing_orders[$id] = $order;
99
- }
100
- }
101
-
102
- $sql = $wpdb->prepare( "SELECT id FROM " . WPSC_TABLE_CHECKOUT_FORMS . " WHERE checkout_set = %s", $this->current_checkout_set );
103
- $ids = $wpdb->get_col( $sql );
104
-
105
- if ( ! empty( $_POST['form_name'] ) ) {
106
- foreach ( $_POST['form_name'] as $field_id => $name ) {
107
- $data = array(
108
- 'name' => $name,
109
- 'active' => empty( $_POST['form_display'][$field_id] ) ? 0 : 1,
110
- 'mandatory' => empty( $_POST['form_mandatory'][$field_id] ) ? 0 : 1,
111
- );
112
-
113
- $data_format = array(
114
- '%s', // name
115
- '%s', // active
116
- '%s', // mandatory
117
- );
118
-
119
- $where = array( 'id' => $field_id );
120
-
121
- if ( isset( $_POST['form_type'][$field_id] ) ) {
122
- $data['type'] = $_POST['form_type'][$field_id];
123
- $data_format[] = '%s';
124
- }
125
-
126
- if ( isset( $existing_orders[$field_id] ) ) {
127
- $data['checkout_order'] = $existing_orders[$field_id];
128
- $data_format[] = '%d';
129
- }
130
-
131
- if ( isset( $_POST['form_options'][$field_id]['label'] ) ) {
132
- $options = array();
133
- foreach( $_POST['form_options'][$field_id]['label'] as $key => $label ) {
134
- $value = $_POST['form_options'][$field_id]['value'][$key];
135
- if ( $label === '' && $value === '')
136
- continue;
137
- $label = sanitize_text_field( $label );
138
- $options[$label] = sanitize_text_field( $value );
139
- }
140
- $data['options'] = serialize( $options );
141
- $data_format[] = '%s';
142
- }
143
-
144
- $index = array_search( $field_id, $ids );
145
- if ( $index !== false ) {
146
- unset( $ids[$index] );
147
- }
148
-
149
- $wpdb->update( WPSC_TABLE_CHECKOUT_FORMS, $data, $where, $data_format, '%d' );
150
- }
151
- }
152
-
153
- // delete all other fields that are not present in the submitted form
154
- if ( ! empty( $ids ) ) {
155
- $sql = "DELETE FROM " . WPSC_TABLE_CHECKOUT_FORMS . " WHERE id IN (" . implode( ', ', $ids ) . ")";
156
- $wpdb->query( $sql );
157
- }
158
-
159
- foreach ( $_POST['new_field_name'] as $key => $name ) {
160
- if ( $key === 0 || empty( $name ) )
161
- continue;
162
-
163
- $data = array(
164
- 'name' => $name,
165
- 'type' => $_POST['new_field_type'][$key],
166
- 'active' => empty( $_POST['new_field_display'][$key] ) ? 0 : 1,
167
- 'mandatory' => empty( $_POST['new_field_mandatory'][$key] ) ? 0 : 1,
168
- 'checkout_set' => $this->current_checkout_set,
169
- 'unique_name' => sanitize_title( $name ),
170
- );
171
-
172
- $data_format = array(
173
- '%s', // name
174
- '%s', // type
175
- '%s', // active
176
- '%s', // mandatory
177
- '%s', // checkout set
178
- '%s', // unique name
179
- );
180
-
181
- if ( isset( $new_field_orders[$key] ) ) {
182
- $data['checkout_order'] = $new_field_orders[$key];
183
- $data_format[] = '%d';
184
- }
185
-
186
- if ( isset( $_POST['new_field_options'][$key]['label'] ) ) {
187
- $options = array();
188
- foreach( $_POST['new_field_options'][$key]['label'] as $index => $label ) {
189
- $value = $_POST['new_field_options'][$key]['value'][$index];
190
- if ( $label === '' && $value === '')
191
- continue;
192
- $options[$label] = $value;
193
- }
194
-
195
- $data['options'] = serialize( $options );
196
- $data_format[] = '%s';
197
- }
198
-
199
- $wpdb->insert( WPSC_TABLE_CHECKOUT_FORMS, $data, $data_format );
200
- }
201
- }
202
-
203
- /**
204
- * Determine whether this field is default or not.
205
- *
206
- * We do not let default fields to be deleted from 3.8.8. However, if the user upgrades from
207
- * 3.7.x, the "default" column of the checkout form table does not correctly specify
208
- * whether the fields are default or not.
209
- *
210
- * Also, if in any case the user has deleted a default field in versions older than 3.8.8,
211
- * the field's "active" column will be set to 0. We should let users delete those fields as well.
212
- *
213
- * As a result, to determine whether a field is default or not, we have to rely on the field's
214
- * unique name and "active" status.
215
- *
216
- * @param object $field Field object
217
- * @return boolean True if the field is default.
218
- */
219
- private function is_field_default( $field ) {
220
- global $wpdb;
221
-
222
- if ( $field->default == 1 ) {
223
- return true;
224
- }
225
-
226
- if ( empty( $field->unique_name) || $this->current_checkout_set !== 0 || empty( $field->active ) ) {
227
- return false;
228
- }
229
-
230
- $default_fields = array(
231
- 'billingfirstname',
232
- 'billinglastname',
233
- 'billingaddress',
234
- 'billingcity',
235
- 'billingstate',
236
- 'billingcountry',
237
- 'billingpostcode',
238
- 'billingemail',
239
- 'billingphone',
240
- 'shippingfirstname',
241
- 'shippinglastname',
242
- 'shippingaddress',
243
- 'shippingcity',
244
- 'shippingstate',
245
- 'shippingcountry',
246
- 'shippingpostcode',
247
- 'shippingemail',
248
- );
249
- return in_array( $field->unique_name, $default_fields );
250
- }
251
-
252
- private function prototype_field( $mode = 'hidden' ) {
253
- $row_id = 'field-prototype';
254
- $row_class = 'new-field';
255
- $data = '';
256
- $new_field_id = 0;
257
- $style = '';
258
-
259
- if ( $mode == 'new' ) {
260
- $new_field_id = 1;
261
- $row_id = 'new-field-1';
262
- $row_class .= ' checkout_form_field';
263
- $data = 'data-new-field-id="1"';
264
- $style = 'style="display:table-row;"';
265
- }
266
- ?>
267
- <tr id="<?php echo $row_id; ?>" class="<?php echo $row_class; ?>" <?php echo $data; ?> <?php echo $style; ?>>
268
- <td class="drag">
269
- <div class="cell-wrapper">
270
- <a title="<?php esc_attr_e( 'Click and Drag to Order Checkout Fields', 'wp-e-commerce' ); ?>">
271
- <img src="<?php echo esc_url( WPSC_CORE_IMAGES_URL . '/drag.png' ); ?>" />
272
- </a>
273
- <img src="<?php echo esc_url( wpsc_get_ajax_spinner() ); ?>" class="ajax-feedback" title="" alt="" />
274
- </div>
275
- </td>
276
- <td class="namecol">
277
- <div class="cell-wrapper">
278
- <input type="text" name="new_field_name[<?php echo $new_field_id; ?>]" value="" /><br />
279
- </div>
280
- </td>
281
- <td class="typecol">
282
- <div class="cell-wrapper">
283
- <select name="new_field_type[<?php echo $new_field_id; ?>]">
284
- <?php foreach ( $this->field_types as $name => $type ): ?>
285
- <?php if( in_array($type, $this->user_field_types) ): ?>
286
- <option value="<?php echo esc_attr( $type ); ?>"><?php echo esc_html( $name ); ?></option>
287
- <?php endif ?>
288
- <?php endforeach ?>
289
- </select>
290
- </div>
291
- </td>
292
- <td class="uniquenamecol">
293
- <a class="edit-options" href="#"><?php esc_html_e( 'Edit Options', 'wp-e-commerce' ); ?></a>
294
- </td>
295
- <td class="displaycol">
296
- <div class="cell-wrapper">
297
- <input checked="checked" type="checkbox" name="new_field_display[<?php echo $new_field_id; ?>]" value="1" />
298
- </div>
299
- </td>
300
- <td class="mandatorycol">
301
- <div class="cell-wrapper">
302
- <input type="checkbox" name="new_field_mandatory[<?php echo $new_field_id; ?>]" value="1" />
303
- </div>
304
- </td>
305
- <td class="actionscol">
306
- <div class="cell-wrapper">
307
- <a tabindex="-1" title="<?php _e( 'Delete Field', 'wp-e-commerce' ); ?>" class="button-secondary wpsc-button-round wpsc-button-minus" href="#"><?php echo _x( '&ndash;', 'delete item', 'wp-e-commerce' ); ?></a>
308
- <a tabindex="-1" title="<?php _e( 'Add Field', 'wp-e-commerce' ); ?>" class="button-secondary wpsc-button-round wpsc-button-plus" href="#"><?php echo _x( '+', 'add item', 'wp-e-commerce' ); ?></a>
309
- </div>
310
- </td>
311
- </tr>
312
- <tr id="field-options-prototype" class="form-field-options">
313
- <td></td>
314
- <td>
315
- <div class="cell-wrapper">
316
- <h4></h4>
317
- <table class="wpsc-field-options-table">
318
- <thead>
319
- <th class="column-labels"><?php echo esc_html_x( 'Label', "checkout field's options", 'wp-e-commerce' ); ?></th>
320
- <th class="column-values"><?php echo esc_html_x( 'Value', "checkout field's options", 'wp-e-commerce' ); ?></th>
321
- <th class="column-actions">&nbsp;</th>
322
- </thead>
323
- <tbody>
324
- <tr class="new-option">
325
- <td class="column-labels">
326
- <div class="field-option-cell-wrapper">
327
- <input type="text" name="form_options[<?php echo $new_field_id; ?>][labels][]" value="" />
328
- </div>
329
- </td>
330
- <td class="column-values">
331
- <div class="field-option-cell-wrapper">
332
- <input type="text" name="form_options[<?php echo $new_field_id; ?>][values][]" value="" />
333
- </div>
334
- </td>
335
- <td class="column-actions">
336
- <div class="field-option-cell-wrapper">
337
- <a tabindex="-1" title="<?php _e( 'Delete Field', 'wp-e-commerce' ); ?>" class="button-secondary wpsc-button-round wpsc-button-minus" href="#"><?php echo _x( '&ndash;', 'delete item', 'wp-e-commerce' ); ?></a>
338
- <a tabindex="-1" title="<?php _e( 'Add Field', 'wp-e-commerce' ); ?>" class="button-secondary wpsc-button-round wpsc-button-plus" href="#"><?php echo _x( '+', 'add item', 'wp-e-commerce' ); ?></a>
339
- </div>
340
- </td>
341
- </tr>
342
- </tbody>
343
- </table>
344
- </div>
345
- </td>
346
- <td colspan="5"></td>
347
- </tr>
348
- <?php
349
- }
350
-
351
- public function display() {
352
- global $wpdb;
353
-
354
- //not to sure if we still need these any more - $form_types, $unique_names
355
- $form_types = get_option( 'wpsc_checkout_form_fields' );
356
- $unique_names = get_option( 'wpsc_checkout_unique_names' );
357
-
358
- do_action( 'wpsc_checkout_form_fields_page' );
359
- ?>
360
-
361
- <input type='hidden' name='checkout_submits' value='true' />
362
- <h3><?php esc_html_e( 'Checkout Settings' , 'wp-e-commerce' ); ?></h3>
363
- <table class='form-table'>
364
- <tr>
365
- <th scope="row"><?php esc_html_e('Force User Registration', 'wp-e-commerce'); ?></th>
366
- <td>
367
- <input type='radio' value='0' name='wpsc_options[require_register]' id='require_register2' <?php checked( $this->require_register, 0 ); ?> />
368
- <label for='require_register2'><?php _e( 'Users can checkout without a user account', 'wp-e-commerce' );?></label><br />
369
- <input type='radio' value='1' name='wpsc_options[require_register]' id='require_register1' <?php checked( $this->require_register, 1 ); ?> />
370
- <label for='require_register1'><?php _e( 'Users must register before checking out', 'wp-e-commerce' );?></label>
371
- <p class='description'><?php esc_attr_e( 'Enabling this will also turn on "Membership: Anyone can register" from within WordPress Settings > General if it\'s not already enabled', 'wp-e-commerce' ); ?></p>
372
- </td>
373
- </tr>
374
-
375
- <tr>
376
- <th scope="row"><?php esc_html_e('Shipping Same as Billing', 'wp-e-commerce' ); ?></th>
377
- <td>
378
- <input type='radio' value='1' name='wpsc_options[shippingsameasbilling]' id='shippingsameasbilling1' <?php checked( $this->shipping_same_as_billing, 1 ); ?> />
379
- <label for='shippingsameasbilling1'><?php _e( 'Enable "Same as billing address" checkbox with Shipping Address fields', 'wp-e-commerce' );?></label><br />
380
- <input type='radio' value='0' name='wpsc_options[shippingsameasbilling]' id='shippingsameasbilling2' <?php checked( $this->shipping_same_as_billing, 0 ); ?> />
381
- <label for='shippingsameasbilling2'><?php _e( 'Users must re-enter Shipping Address', 'wp-e-commerce' );?></label>
382
- </td>
383
- </tr>
384
- <tr>
385
- <th scope="row"><?php _e('Security and Encryption', 'wp-e-commerce'); ?></th>
386
- <td>
387
- <input type='radio' value='1' name='wpsc_options[wpsc_force_ssl]' id='wpsc_force_ssl1' <?php checked( $this->force_ssl, 1 ); ?> />
388
- <label for='wpsc_force_ssl1'><?php _e( 'Force users to use SSL Encryption', 'wp-e-commerce' );?></label><br />
389
- <input type='radio' value='0' name='wpsc_options[wpsc_force_ssl]' id='wpsc_force_ssl2' <?php checked( $this->force_ssl, 0 ); ?> />
390
- <label for='wpsc_force_ssl2'><?php _e( 'Allow site to be used insecurely and unencrypted', 'wp-e-commerce' );?></label>
391
- <p class='description'><?php esc_html_e( 'This can cause warnings for your users if you do not have a properly configured SSL certificate', 'wp-e-commerce' );?></p>
392
- </td>
393
- </tr>
394
- </table>
395
-
396
-
397
- <h3><?php esc_html_e( 'Checkout Form Fields', 'wp-e-commerce' ); ?></h3>
398
- <p><?php esc_html_e( 'Here you can customise the forms to be displayed in your checkout page. The checkout page is where you collect important user information that will show up in your purchase logs i.e. the buyer\'s address, and name...', 'wp-e-commerce' );?></p>
399
-
400
- <p>
401
- <label for='wpsc_form_set'><?php esc_html_e( 'Select a Form Set' , 'wp-e-commerce' ); ?>:</label>
402
- <select id='wpsc_form_set' name='checkout_set'>
403
- <?php foreach ( $this->checkout_sets as $key => $value ): ?>
404
- <option <?php selected( $this->current_checkout_set, $key ); ?> value="<?php echo esc_attr( $key ); ?>"><?php echo esc_html( $value ); ?></option>
405
- <?php endforeach; ?>
406
- </select>
407
-
408
- <input type='submit' value='<?php esc_attr_e( 'Filter', 'wp-e-commerce' ); ?>' name='wpsc_checkout_set_filter' class='button-secondary' />
409
- <input <?php if (! $this->current_checkout_set) echo 'style="display:none;"'; ?> id="wpsc-delete-checkout-set" type='submit' value='<?php esc_attr_e( 'Delete', 'wp-e-commerce' ); ?>' name='wpsc_checkout_set_delete' class='button-secondary' />
410
- </p>
411
-
412
- <p><a class="add_new_form_set button-secondary" href='#'><?php esc_html_e("Add New Form Set", 'wp-e-commerce'); ?></a></p>
413
-
414
- <p class='add_new_form_set_forms'>
415
- <label><?php esc_html_e( "Add new Form Set", 'wp-e-commerce' ); ?>:
416
- <input type="text" value="" name="new_form_set" /></label>
417
- <input type="submit" value="<?php esc_attr_e( 'Add', 'wp-e-commerce' ); ?>" class="button-primary" id="formset-add-sumbit"/>
418
- </p>
419
-
420
- <input type="hidden" name="selected_form_set" value="<?php echo esc_attr( $this->current_checkout_set ); ?>" />
421
-
422
- <table id="wpsc_checkout_list" class="widefat page fixed" cellspacing="0">
423
- <thead>
424
- <tr>
425
- <?php print_column_headers( 'display-checkout-list' ); ?>
426
- </tr>
427
- </thead>
428
-
429
- <tfoot>
430
- <tr>
431
- <?php print_column_headers( 'display-checkout-list', false ); ?>
432
- </tr>
433
- </tfoot>
434
-
435
- <tbody id='wpsc_checkout_list_body'>
436
- <?php if ( empty( $this->form_fields ) ): ?>
437
- <?php $this->prototype_field( 'new' ); ?>
438
- <?php else: ?>
439
- <?php foreach ( $this->form_fields as $form_field ): ?>
440
-
441
- <tr data-field-id="<?php echo esc_attr( $form_field->id ); ?>" data-field-type="<?php echo $form_field->type; ?>" id="checkout_<?php echo esc_attr( $form_field->id ); ?>" class="checkout_form_field field_type_<?php echo $form_field->type; ?>">
442
- <td class="drag">
443
- <div class="cell-wrapper">
444
- <a title="<?php esc_attr_e( 'Click and Drag to Order Checkout Fields', 'wp-e-commerce' ); ?>">
445
- <img src="<?php echo esc_url( WPSC_CORE_IMAGES_URL . '/drag.png' ); ?>" />
446
- </a>
447
- <img src="<?php echo esc_url( wpsc_get_ajax_spinner() ); ?>" class="ajax-feedback" title="" alt="" />
448
- </div>
449
- </td>
450
- <td class="namecol">
451
- <div class="cell-wrapper">
452
- <input type="text" name="form_name[<?php echo esc_attr( $form_field->id ); ?>]" value="<?php echo esc_attr( $form_field->name ); ?>" />
453
- </div>
454
- </td>
455
- <td class="typecol">
456
- <div class="cell-wrapper">
457
- <?php if ( $this->is_field_default( $form_field ) ): ?>
458
- <strong><?php echo esc_html( $form_field->type ); ?></strong>
459
- <?php else: ?>
460
- <select name="form_type[<?php echo esc_attr( $form_field->id ); ?>]">
461
- <?php foreach ($this->field_types as $label => $name): ?>
462
- <option <?php selected( $form_field->type, $name ); ?> value="<?php echo esc_attr( $name ); ?>"><?php echo esc_html( $label ); ?></option>
463
- <?php endforeach ?>
464
- </select>
465
- <?php
466
- $field_options = unserialize( $form_field->options );
467
- if ( empty( $field_options ) )
468
- $field_options = array();
469
-
470
- $i = 0;
471
- foreach ( $field_options as $label => $value ):
472
- $i ++;
473
- ?>
474
- <input type="hidden" name="form_options[<?php echo esc_attr( $form_field->id ); ?>][label][]" value="<?php echo esc_attr( $label ); ?>" />
475
- <input type="hidden" name="form_options[<?php echo esc_attr( $form_field->id ); ?>][value][]" value="<?php echo esc_attr( $value ); ?>" />
476
- <?php endforeach; ?>
477
- <?php endif; ?>
478
- </div>
479
- </td>
480
-
481
- <td class="uniquenamecol">
482
- <div class="cell-wrapper">
483
- <?php if ( $form_field->type != 'heading' && ! empty( $form_field->unique_name ) ): ?>
484
- <small><?php echo esc_html( $form_field->unique_name ); ?></small>
485
- <?php endif ?>
486
- <?php
487
- $style = '';
488
- if ( in_array( $form_field->type, array( 'select', 'radio', 'checkbox' ) ) ) {
489
- $style = 'style="display: inline;"';
490
- }
491
- ?>
492
- <a class="edit-options" href="#" <?php echo $style; ?> ><?php esc_html_e( 'Edit Options', 'wp-e-commerce' ); ?></a>
493
- </div>
494
- </td>
495
- <td class="displaycol">
496
- <div class="cell-wrapper">
497
- <input <?php checked( $form_field->active, 1 ); ?> type="checkbox" name="form_display[<?php echo esc_attr( $form_field->id ); ?>]" value="1" />
498
- </div>
499
- </td>
500
- <td class="mandatorycol">
501
- <div class="cell-wrapper">
502
- <?php if ( $form_field->type != 'heading' ): ?>
503
- <input <?php checked( $form_field->mandatory, 1 ); ?> type="checkbox" name="form_mandatory[<?php echo esc_attr( $form_field->id ); ?>]" value="1" />
504
- <?php endif ?>
505
- </div>
506
- </td>
507
- <td class="actionscol">
508
- <div class="cell-wrapper">
509
- <?php if ( ! $this->is_field_default( $form_field ) ): ?>
510
- <a tabindex="-1" title="<?php esc_attr_e( 'Delete Field', 'wp-e-commerce' ); ?>" class="button-secondary wpsc-button-round wpsc-button-minus" href="#"><?php echo _x( '&ndash;', 'delete item', 'wp-e-commerce' ); ?></a>
511
- <?php else: ?>
512
- <span title="<?php _e( 'Cannot Delete Default Fields', 'wp-e-commerce' ); ?>" class="button-secondary wpsc-button-round wpsc-button-minus"><?php echo _x( '&ndash;', 'delete item', 'wp-e-commerce' ); ?></span>
513
- <?php endif; ?>
514
- <a tabindex="-1" title="<?php _e( 'Add Field', 'wp-e-commerce' ); ?>" class="button-secondary wpsc-button-round wpsc-button-plus" href="#"><?php echo _x( '+', 'add item', 'wp-e-commerce' ); ?></a>
515
- </div>
516
- </td>
517
- </tr>
518
- <?php endforeach; ?>
519
- <?php endif; ?>
520
- <?php $this->prototype_field(); ?>
521
- </tbody>
522
- </table>
523
- <?php
524
- }
525
- }
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
trunk/wpsc-admin/includes/settings-tabs/gateway.php DELETED
@@ -1,168 +0,0 @@
1
- <?php
2
-
3
- class WPSC_Settings_Tab_Gateway extends WPSC_Settings_Tab {
4
- private $active_gateways;
5
- private $gateway_names;
6
-
7
- public function __construct() {
8
- if ( isset( $_REQUEST['payment_gateway_id'] ) ) {
9
- update_user_option( get_current_user_id(), 'wpsc_settings_selected_payment_gateway', sanitize_text_field( $_REQUEST['payment_gateway_id'] ) );
10
- } else {
11
- update_user_option( get_current_user_id(), 'wpsc_settings_selected_payment_gateway', '' );
12
- }
13
-
14
- $this->active_gateways = get_option( 'custom_gateway_options' );
15
- $this->gateway_names = get_option( 'payment_gateway_names' );
16
-
17
- $this->hide_submit_button();
18
- }
19
-
20
- private function get_gateway_form( $selected_gateway ) {
21
- return apply_filters( 'wpsc_settings_gateway_form', array(), $selected_gateway );
22
- }
23
-
24
- private function get_gateway_settings_url( $gateway ) {
25
- $location = isset( $_REQUEST['current_url'] ) ? $_REQUEST['current_url'] : $_SERVER['REQUEST_URI'];
26
- $gateway = ! empty( $gateway ) ? $gateway : '';
27
-
28
- return esc_url( add_query_arg( array(
29
- 'tab' => 'gateway',
30
- 'page' => 'wpsc-settings',
31
- 'payment_gateway_id' => $gateway
32
- ), $location ) );
33
- }
34
-
35
- public function display_payment_gateway_settings_form( $selected_gateway = null ) {
36
- if ( ! $selected_gateway ) {
37
- $selected_gateway = (string) get_user_option( 'wpsc_settings_selected_payment_gateway', get_current_user_id() );
38
- }
39
- $payment_data = $this->get_gateway_form( $selected_gateway );
40
- if ( ! $payment_data ) {
41
- $payment_data = array(
42
- 'name' => __( 'Edit Gateway Settings', 'wp-e-commerce' ),
43
- 'form_fields' => __( 'Modify the settings of a payment gateway by clicking the "Edit" link on the left.', 'wp-e-commerce' ),
44
- 'has_submit_button' => 1,
45
- );
46
- }
47
-
48
- ?>
49
- <div id="gateway_settings_<?php echo esc_attr( $selected_gateway ); ?>_form" class='gateway_settings_form'>
50
- <table class='form-table'>
51
- <tbody>
52
- <?php echo $payment_data['form_fields']; ?>
53
- <tr><td colspan="2">
54
- <?php // hidden because most gateways provide their own update button. ?>
55
- <?php if ( $payment_data['has_submit_button'] !== 1 ) { ?>
56
- <p class="submit inline-edit-save">
57
- <a class="button edit-payment-module-cancel" title="<?php esc_attr_e( "Cancel editing this Payment Gateway's settings", 'wp-e-commerce' ) ?>"><?php esc_html_e( "Cancel", 'wp-e-commerce' ); ?></a>
58
- <input type="submit" name="submit" class="button button-primary edit-payment-module-update" value='<?php _e( "Update &raquo;", 'wp-e-commerce' ); ?>'>
59
- </p>
60
- <?php } ?>
61
- </td></tr>
62
- </tbody>
63
- </table>
64
- </div>
65
- <?php
66
- }
67
-
68
- public function display() {
69
- global $wpdb, $nzshpcrt_gateways;
70
- ?>
71
-
72
- <h3><?php _e( 'Select Payment Gateways', 'wp-e-commerce' ); ?></h3>
73
- <p><?php _e( 'Activate the payment gateways that you want to make available to your customers by selecting them below.', 'wp-e-commerce' ); ?></p>
74
-
75
- <table id='wpsc-payment-gateway-settings' class='wpsc-edit-module-options wp-list-table widefat plugins'>
76
- <thead>
77
- <tr>
78
- <th scope="col" id="wpsc-gateway-active" class="manage-column"></th>
79
- <th scope="col" id="wpsc-gateway-name" class="manage-column column-name"><?php _e( 'Payment Gateway', 'wp-e-commerce' ); ?></th>
80
- <th scope="col" id="wpsc-gateway-display-name" class="manage-column column-description"><?php _e( 'Display Name', 'wp-e-commerce' ); ?></th>
81
- </tr>
82
- </thead>
83
- <tfoot>
84
- <tr>
85
- <th scope="col" id="wpsc-gateway-active" class="manage-column"></th>
86
- <th scope="col" id="wpsc-gateway-name" class="manage-column column-name"><?php _e( 'Payment Gateway', 'wp-e-commerce' ); ?></th>
87
- <th scope="col" id="wpsc-gateway-display-name" class="manage-column column-description"><?php _e( 'Display Name', 'wp-e-commerce' ); ?></th>
88
- </tr>
89
- </tfoot>
90
- <tbody>
91
- <?php $this->gateway_list(); ?>
92
- </tbody>
93
- </table>
94
- <?php submit_button( __( 'Save Changes', 'wp-e-commerce' ) );
95
- }
96
-
97
- private function gateway_list_item( $gateway, $force ) {
98
- $checked = in_array( $gateway['id'], $this->active_gateways );
99
-
100
- $active = $checked ? 'active' : 'inactive';
101
- $hidden = $force ? '' : "style='display: none;'";
102
-
103
- $edithidden = $hidden;
104
-
105
- $payment_gateway_names = get_option( 'payment_gateway_names' );
106
- $display_name = isset( $payment_gateway_names[ $gateway['id'] ] ) ? $payment_gateway_names[ $gateway['id'] ] : '' ;
107
- $gateway_data = false;
108
- ?>
109
- <tr class="wpsc-select-gateway <?php echo $active; ?>" data-gateway-id="<?php echo esc_attr( $gateway['id'] ); ?>" id="gateway_list_item_<?php echo $gateway['id'];?>">
110
- <th scope="row" class="check-column">
111
- <label class="screen-reader-text" for="<?php echo esc_attr( $gateway['id'] ); ?>_id"><?php _e( "Select", 'wp-e-commerce' ); ?> <?php echo esc_html( $gateway['name'] ); ?></label>
112
- <input name='wpsc_options[custom_gateway_options][]' <?php checked( $checked ); ?> type='checkbox' value='<?php echo esc_attr( $gateway['id'] ); ?>' id='<?php echo esc_attr( $gateway['id'] ); ?>_id' />
113
- </th>
114
- <td class="plugin-title">
115
- <label for='<?php echo esc_attr( $gateway['id'] ); ?>_id'><strong><?php echo esc_html( $gateway['name'] ); ?></strong></label>
116
- <div class="row-actions-visible">
117
- <span class="edit">
118
- <a class='edit-payment-module' title="<?php esc_attr_e( "Edit this Payment Gateway's Settings", 'wp-e-commerce' ) ?>" href='<?php echo esc_url( $this->get_gateway_settings_url( $gateway['id'] ) ); ?>'><?php esc_html_e( 'Settings', 'wp-e-commerce' ); ?></a>
119
- <img src="<?php echo esc_url( wpsc_get_ajax_spinner() ); ?>" class="ajax-feedback" title="" alt="" />
120
- </span>
121
- </div>
122
- </td>
123
- <td class="plugin-description">
124
- <?php echo esc_html( $display_name ); ?>
125
- </td>
126
- </tr>
127
- <tr id="wpsc_gateway_settings_<?php echo esc_attr( $gateway['id'] ); ?>" data-gateway-id="<?php echo esc_attr( $gateway['id'] ); ?>" class='gateway_settings <?php echo $active; ?>' <?php echo $hidden; ?> >
128
- <td colspan="3" id="wpsc_gateway_settings_<?php echo esc_attr( $gateway['id'] ); ?>_container">
129
- <?php if ( $force ) {
130
- $this->display_payment_gateway_settings_form( $gateway['id'] );
131
- } ?>
132
- </td>
133
- </tr>
134
-
135
- <?php
136
- }
137
-
138
- private function gateway_list() {
139
-
140
- $gateways = apply_filters( 'wpsc_settings_get_gateways', array() );
141
-
142
- usort( $gateways, apply_filters( 'wpsc_settings_get_gateways_sort_callback', array( $this, 'gateway_usort_callback' ), $gateways, $this ) );
143
-
144
- $selected_gateway = (string) get_user_option( 'wpsc_settings_selected_payment_gateway', get_current_user_id() );
145
-
146
- foreach ( $gateways as $gateway ) {
147
- $this->gateway_list_item( $gateway, $selected_gateway === $gateway['id'] );
148
- }
149
- }
150
-
151
- /**
152
- * Usort callback used to order gateways by their name.
153
- *
154
- * @param array $a A gateway array.
155
- * @param array $b A different gateway array.
156
- *
157
- * @since 3.9.0
158
- *
159
- * @return bool True if $b should be ordered after $a based on its name.
160
- */
161
- private function gateway_usort_callback( $a, $b ) {
162
- return $a['name'] > $b['name'];
163
- }
164
-
165
- public function callback_submit_options() {
166
- do_action( 'wpsc_submit_gateway_options' );
167
- }
168
- }
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
trunk/wpsc-admin/includes/settings-tabs/general.php DELETED
@@ -1,240 +0,0 @@
1
- <?php
2
- class WPSC_Settings_Tab_General extends WPSC_Settings_Tab {
3
- private $regions = array();
4
-
5
- public function __construct() {
6
- $this->get_regions();
7
- add_action( 'admin_notices', array( $this, 'no_target_markets' ) );
8
- }
9
-
10
- public function no_target_markets() {
11
-
12
- $countries = WPSC_Countries::get_countries();
13
-
14
- if ( empty( $countries ) ) {
15
- ?>
16
- <div class="notice error is-dismissible below-h2">
17
- <p><?php _e( '<strong>You have not enabled any target markets.</strong> To sell tangible goods, you will need to set at least one target market.', 'wp-e-commerce' ); ?></p>
18
- </div>
19
- <?php
20
- }
21
- }
22
-
23
- private function get_regions() {
24
- global $wpdb;
25
- if ( defined( 'DOING_AJAX' ) && DOING_AJAX && isset( $_POST['country'] ) )
26
- $base_country = $_POST['country'];
27
- else
28
- $base_country = get_option( 'base_country' );
29
- $from = WPSC_TABLE_REGION_TAX . ' AS r';
30
- $join = WPSC_TABLE_CURRENCY_LIST . ' AS c';
31
- $sql = $wpdb->prepare( "
32
- SELECT r.id, r.name
33
- FROM {$from}
34
- INNER JOIN {$join} ON r.country_id = c.id AND c.isocode = %s
35
- ", $base_country );
36
- $this->regions = $wpdb->get_results( $sql );
37
- }
38
-
39
- public function display_region_drop_down() {
40
- $base_region = get_option( 'base_region' );
41
- if ( ! empty( $this->regions ) ):
42
- ?>
43
- <select name='wpsc_options[base_region]'>
44
- <?php foreach ( $this->regions as $region ): ?>
45
- <option value='<?php echo esc_attr( $region->id ); ?>' <?php selected( $region->id, $base_region ); ?>><?php echo esc_html( $region->name ); ?></option>
46
- <?php endforeach ?>
47
- </select>
48
- <?php
49
- endif;
50
- }
51
-
52
- public function display() {
53
- global $wpdb;
54
- ?>
55
- <h3><?php echo esc_html_e( 'General Settings', 'wp-e-commerce' ); ?></h3>
56
- <table class='wpsc_options form-table'>
57
- <tr>
58
- <th scope="row"><label for="wpsc-base-country-drop-down"><?php esc_html_e( 'Base Country/Region', 'wp-e-commerce' ); ?></label></th>
59
- <td>
60
- <?php
61
- wpsc_country_dropdown( array(
62
- 'id' => 'wpsc-base-country-drop-down',
63
- 'name' => 'wpsc_options[base_country]',
64
- 'selected' => get_option( 'base_country' ),
65
- 'include_invisible' => true,
66
- ) );
67
- ?>
68
- <span id='wpsc-base-region-drop-down'>
69
- <?php $this->display_region_drop_down(); ?>
70
- <img src="<?php echo esc_url( wpsc_get_ajax_spinner() ); ?>" class="ajax-feedback" title="" alt="" />
71
- </span>
72
- <p class='description'><?php esc_html_e( 'Select your primary business location.', 'wp-e-commerce' ); ?></p>
73
- </td>
74
- </tr>
75
-
76
- <?php
77
- /* START OF TARGET MARKET SELECTION */
78
- $countrylist = WPSC_Countries::get_countries_array( true, true );
79
- ?>
80
- <tr>
81
- <th scope="row">
82
- <?php esc_html_e( 'Target Markets', 'wp-e-commerce' ); ?>
83
- </th>
84
- <td>
85
- <?php
86
- // check for the suhosin module
87
- if ( wpsc_is_suhosin_enabled() ) {
88
- echo "<em>" . __( "The Target Markets feature has been disabled because you have the Suhosin PHP extension installed on this server. If you need to use the Target Markets feature, then disable the suhosin extension. If you can not do this, you will need to contact your hosting provider.", 'wp-e-commerce' ) . "</em>";
89
- } else {
90
- ?>
91
- <span>
92
- <?php printf( __( 'Select: <a href="%1$s" class="wpsc-select-all" title="All">All</a> <a href="%2$s" class="wpsc-select-none" title="None">None</a>' , 'wp-e-commerce') , esc_url( add_query_arg( array( 'selected_all' => 'all' ) ) ), esc_url( add_query_arg( array( 'selected_all' => 'none' ) ) ) ); ?>
93
- </span><br />
94
- <div id='wpsc-target-markets' class='ui-widget-content multiple-select'>
95
- <?php foreach ( (array)$countrylist as $country ) : ?>
96
- <?php if ( $country['visible'] == 1 ) : ?>
97
- <input type='checkbox' id="countrylist2-<?php echo $country['id']; ?>" name='countrylist2[]' value='<?php echo $country['id']; ?>' checked='checked' />
98
- <label for="countrylist2-<?php echo $country['id']; ?>"><?php echo esc_html( $country['country'] ); ?></label><br />
99
- <?php else : ?>
100
- <input type='checkbox' id="countrylist2-<?php echo $country['id']; ?>" name='countrylist2[]' value='<?php echo $country['id']; ?>' />
101
- <label for="countrylist2-<?php echo $country['id']; ?>"><?php echo esc_html( $country['country'] ); ?></label><br />
102
- <?php endif; ?>
103
- <?php endforeach; ?>
104
- </div>
105
-
106
- <p class='description'><?php esc_html_e( 'Select the markets you are selling products to.' , 'wp-e-commerce'); ?></p>
107
- <?php
108
- }
109
- ?>
110
- </td>
111
- </tr>
112
-
113
- <?php
114
- $stock_keeping_time = wpsc_get_stock_keeping_time();
115
- $stock_keeping_interval = wpsc_get_stock_keeping_interval();
116
- ?>
117
- <tr>
118
- <th scope="row">
119
- <label for="wpsc-stock-keeping-time"><?php esc_html_e( 'Keep stock in cart for', 'wp-e-commerce' ); ?></label>
120
- </th>
121
- <td>
122
- <input type="text" name="wpsc_options[wpsc_stock_keeping_time]" id="wpsc-stock-keeping-time" size="2" value="<?php echo esc_attr( $stock_keeping_time ); ?>" />
123
- <select name="wpsc_options[wpsc_stock_keeping_interval]">
124
- <option value="hour" <?php selected( 'hour', $stock_keeping_interval ); ?>><?php echo _n( 'hour', 'hours', $stock_keeping_time, 'wp-e-commerce' ); ?></option>
125
- <option value="day" <?php selected( 'day', $stock_keeping_interval ); ?>><?php echo _n( 'day', 'days', $stock_keeping_time, 'wp-e-commerce' ) ?></option>
126
- <option value="week" <?php selected( 'week', $stock_keeping_interval ); ?>><?php echo _n( 'week', 'weeks', $stock_keeping_time, 'wp-e-commerce' ) ?></option>
127
- </select>
128
- <p class='description'><?php esc_html_e( "Set the amount of time items in a customer's cart are reserved. You can also specify decimal amounts such as '0.5 days' or '1.25 weeks'. Note that the minimum interval you can enter is 1 hour, i.e. you can't schedule it to run every 0.5 hour.", 'wp-e-commerce' ) ?></p>
129
- </td>
130
- </tr>
131
-
132
- <?php
133
- $hierarchical_category = get_option( 'product_category_hierarchical_url', 0 );
134
- ?>
135
- <tr>
136
- <th scope="row">
137
- <?php _e( 'Use Hierarchical Product Category URL', 'wp-e-commerce' ); ?>
138
- </th>
139
- <td>
140
- <label><input type="radio" <?php checked( $hierarchical_category, 1 ); ?> name="wpsc_options[product_category_hierarchical_url]" value="1" /> <?php _e( 'Yes', 'wp-e-commerce' ); ?></label>&nbsp;&nbsp;
141
- <label><input type="radio" <?php checked( $hierarchical_category, 0 ); ?>name="wpsc_options[product_category_hierarchical_url]" value="0" /> <?php _e( 'No', 'wp-e-commerce' ); ?></label><br />
142
- <p class='description'><?php _e( 'When Hierarchical Product Category URL is enabled, parent product categories are also included in the product URL.<br />For example: <code>http://example.com/products-page/parent-cat/sub-cat/product-name</code>', 'wp-e-commerce' ); ?></p>
143
- </td>
144
- </tr>
145
- </table>
146
-
147
- <h3 class="form_group"><?php esc_html_e( 'Currency Settings', 'wp-e-commerce' ); ?></h3>
148
- <table class='wpsc_options form-table'>
149
- <?php
150
- $currency_data = $wpdb->get_results( "SELECT * FROM `" . WPSC_TABLE_CURRENCY_LIST . "` ORDER BY `country` ASC", ARRAY_A );
151
- $currency_type = esc_attr( get_option( 'currency_type' ) );
152
- ?>
153
- <tr>
154
- <th scope="row"><label for="wpsc_options_currency_type"><?php esc_html_e( 'Currency Type', 'wp-e-commerce' ); ?></label></th>
155
- <td>
156
- <select id="wpsc_options_currency_type" name='wpsc_options[currency_type]' onchange='getcurrency(this.options[this.selectedIndex].value);'>
157
- <?php foreach ( $currency_data as $currency ) : ?>
158
- <option value='<?php echo $currency['id']; ?>' <?php selected( $currency['id'], $currency_type ); ?>><?php echo esc_html( $currency['country'] ); ?> (<?php echo $currency['currency']; ?>)</option>
159
- <?php endforeach; ?>
160
- </select>
161
- </td>
162
- </tr>
163
-
164
- <?php
165
- $currency_data = $wpdb->get_row( "SELECT `symbol`,`symbol_html`,`code` FROM `" . WPSC_TABLE_CURRENCY_LIST . "` WHERE `id`='" . esc_attr( get_option( 'currency_type' ) ) . "' LIMIT 1", ARRAY_A );
166
-
167
- if ( $currency_data['symbol'] != '' ) {
168
- $currency_sign = esc_attr( $currency_data['symbol_html'] );
169
- } else {
170
- $currency_sign = esc_attr( $currency_data['code'] );
171
- }
172
-
173
- $currency_sign_location = esc_attr( get_option( 'currency_sign_location' ) );
174
- $csl1 = "";
175
- $csl2 = "";
176
- $csl3 = "";
177
- $csl4 = "";
178
- switch ( $currency_sign_location ) {
179
- case 1:
180
- $csl1 = "checked='checked'";
181
- break;
182
-
183
- case 2:
184
- $csl2 = "checked='checked'";
185
- break;
186
-
187
- case 3:
188
- $csl3 = "checked='checked'";
189
- break;
190
-
191
- case 4:
192
- $csl4 = "checked='checked'";
193
- break;
194
- }
195
- ?>
196
- <tr>
197
- <th scope="row"><?php esc_html_e( 'Currency Sign Location', 'wp-e-commerce' ); ?></th>
198
- <td>
199
- <input type='radio' value='1' name='wpsc_options[currency_sign_location]' id='csl1' <?php echo $csl1; ?> />
200
- <label for='csl1'><?php _ex( '100', 'Currency sign location - option 1', 'wp-e-commerce' ); ?><span id='cslchar1'><?php echo $currency_sign; ?></span></label> &nbsp;
201
- <input type='radio' value='2' name='wpsc_options[currency_sign_location]' id='csl2' <?php echo $csl2; ?> />
202
- <label for='csl2'><?php _ex( '100', 'Currency sign location - option 2', 'wp-e-commerce' ); ?> <span id='cslchar2'><?php echo $currency_sign; ?></span></label> &nbsp;
203
- <input type='radio' value='3' name='wpsc_options[currency_sign_location]' id='csl3' <?php echo $csl3; ?> />
204
- <label for='csl3'><span id='cslchar3'><?php echo $currency_sign; ?></span><?php _ex( '100', 'Currency sign location - option 3', 'wp-e-commerce' ); ?></label> &nbsp;
205
- <input type='radio' value='4' name='wpsc_options[currency_sign_location]' id='csl4' <?php echo $csl4; ?> />
206
- <label for='csl4'><span id='cslchar4'><?php echo $currency_sign; ?></span> <?php _ex( '100', 'Currency sign location - option 4', 'wp-e-commerce' ); ?></label>
207
- </td>
208
- </tr>
209
- <tr>
210
- <th scope="row"><?php esc_html_e( 'Thousands and decimal separators', 'wp-e-commerce' ); ?></th>
211
- <td>
212
- <label for="wpsc_options_wpsc_thousands_separator"><?php esc_html_e( 'Thousands separator', 'wp-e-commerce' ); ?></label>: <input name="wpsc_options[wpsc_thousands_separator]" id="wpsc_options_wpsc_thousands_separator" type="text" maxlength="1" size="1" value="<?php echo esc_attr( get_option( 'wpsc_thousands_separator' ) ); ?>" /><br />
213
- <label for="wpsc_options_wpsc_decimal_separator"><?php esc_html_e( 'Decimal separator', 'wp-e-commerce' ); ?></label>: <input name="wpsc_options[wpsc_decimal_separator]" id="wpsc_options_wpsc_decimal_separator" type="text" maxlength="1" size="1" value="<?php echo esc_attr( get_option( 'wpsc_decimal_separator' ) ); ?>" /><br />
214
- <?php esc_html_e( 'Preview:', 'wp-e-commerce' ); ?> 10<?php echo esc_attr( get_option( 'wpsc_thousands_separator' ) ); ?>000<?php echo esc_attr( get_option( 'wpsc_decimal_separator' ) ); ?>00
215
- </td>
216
- </tr>
217
- </table>
218
-
219
- <h3 class="form_group"><?php esc_html_e( 'Usage Tracking', 'wp-e-commerce' ); ?></h3>
220
- <table class='wpsc_options form-table'>
221
- <tr>
222
- <th scope="row">
223
- <label for="wpsc_options_usage_tracking"><?php esc_html_e( 'Allow Usage Tracking ?', 'wp-e-commerce' ); ?></label>
224
- </th>
225
- <td>
226
- <?php $usage_tracking = get_option( 'wpsc_usage_tracking', 0 ); ?>
227
- <label><input type="radio" <?php checked( $usage_tracking, 1 ); ?> name="wpsc_options[wpsc_usage_tracking]" value="1" /> <?php _e( 'Yes', 'wp-e-commerce' ); ?></label>&nbsp;&nbsp;
228
- <label><input type="radio" <?php checked( $usage_tracking, 0 ); ?>name="wpsc_options[wpsc_usage_tracking]" value="0" /> <?php _e( 'No', 'wp-e-commerce' ); ?></label><br />
229
- <p class='description'>
230
- <?php echo sprintf(
231
- __( 'Allow WP eCommerce to anonymously track how this plugin is used and help us make the plugin better. Opt-in to tracking and our newsletter and immediately be emailed a 20&#37; discount to the WPeC shop, valid towards the <a href="%s" target="_blank">purchase of extensions</a>. No sensitive data is tracked.', 'wp-e-commerce' ),
232
- 'https://wpecommerce.org/store/' );
233
- ?>
234
- </p>
235
- </td>
236
- </tr>
237
- </table>
238
- <?php
239
- }
240
- } // end class
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
trunk/wpsc-admin/includes/settings-tabs/import.php DELETED
@@ -1,367 +0,0 @@
1
- <?php
2
-
3
- class WPSC_Settings_Tab_Import extends WPSC_Settings_Tab {
4
-
5
- private $file = false;
6
- private $step = 1;
7
- private $display_data = array();
8
- private $completed = false;
9
- private $default_fields = array();
10
-
11
- public function __construct() {
12
-
13
- parent::__construct();
14
-
15
- $file = get_transient( 'wpsc_settings_tab_import_file' );
16
-
17
- if ( $file ) {
18
- $this->file = $file;
19
- }
20
-
21
- $this->step = empty( $_REQUEST['step'] ) ? 1 : (int) $_REQUEST['step'];
22
-
23
- if ( $this->step < 1 || $this->step > 3 ) {
24
- $this->step = 1;
25
- }
26
-
27
- $this->default_fields = apply_filters( 'wpsc_product_import_default_fields', array(
28
- 'column_name' => __( 'Product Name' , 'wp-e-commerce' ),
29
- 'column_description' => __( 'Description' , 'wp-e-commerce' ),
30
- 'column_additional_description' => __( 'Additional Description', 'wp-e-commerce' ),
31
- 'column_price' => __( 'Price' , 'wp-e-commerce' ),
32
- 'column_sku' => __( 'SKU' , 'wp-e-commerce' ),
33
- 'column_weight' => __( 'Weight' , 'wp-e-commerce' ),
34
- 'column_weight_unit' => __( 'Weight Unit' , 'wp-e-commerce' ),
35
- 'column_quantity' => __( 'Stock Quantity' , 'wp-e-commerce' ),
36
- 'column_quantity_limited' => __( 'Stock Quantity Limit' , 'wp-e-commerce' )
37
- ) );
38
-
39
- switch ( $this->step ) {
40
- case 2:
41
- $this->prepare_import_columns();
42
- break;
43
- case 3:
44
- $this->import_data();
45
- break;
46
- }
47
-
48
- $this->hide_submit_button();
49
- }
50
-
51
- private function prepare_import_columns() {
52
- $this->hide_update_message();
53
-
54
- ini_set( 'auto_detect_line_endings', 1 );
55
- $handle = @fopen( $this->file, 'r' );
56
-
57
- if ( ! $handle ) {
58
- $this->reset_state();
59
- return;
60
- }
61
-
62
- $rows = array();
63
-
64
- while ( count( $rows ) < 5 && ( false !== ( $data = fgetcsv( $handle ) ) ) ) {
65
- array_push( $rows, $data );
66
- }
67
-
68
- $sample_row_data = array();
69
-
70
- foreach ( $rows as $row => $columns ) {
71
- foreach ( $columns as $column => $data ) {
72
-
73
- if ( ! isset( $sample_row_data[ $column ] ) ) {
74
- $sample_row_data[ $column ] = array();
75
- }
76
-
77
- array_push( $sample_row_data[ $column ], $data );
78
- }
79
- }
80
-
81
- $categories = get_terms( 'wpsc_product_category', 'hide_empty=0' );
82
-
83
- $this->display_data = array(
84
- 'sample_row_data' => $sample_row_data,
85
- 'categories' => $categories,
86
- );
87
- }
88
-
89
- private function reset_state() {
90
- delete_transient( 'wpsc_settings_tab_import_file' );
91
- $this->file = false;
92
- $this->completed = false;
93
- $this->display_data = array();
94
- }
95
-
96
- private function import_data() {
97
- ini_set( 'auto_detect_line_endings', 1 );
98
-
99
- $handle = @fopen( $this->file, 'r' );
100
-
101
- if ( ! $handle ) {
102
- $this->reset_state();
103
- return;
104
- }
105
-
106
- $length = filesize( $this->file );
107
-
108
- $column_map = array_flip( $_POST['value_name'] );
109
-
110
- extract( $column_map, EXTR_SKIP );
111
-
112
- $record_count = 0;
113
-
114
- while ( $row = @fgetcsv( $handle, $length, ',' ) ) {
115
-
116
- $product = array(
117
- 'post_title' => isset( $row[ $column_name ] ) ? $row[ $column_name ] : '',
118
- 'content' => isset( $row[ $column_description ] ) ? $row[ $column_description ] : '',
119
- 'price' => isset( $row[ $column_price ] ) ? str_replace( '$', '', $row[ $column_price ] ) : 0,
120
- 'weight' => isset( $row[ $column_weight ] ) ? $row[ $column_weight] : '',
121
- 'weight_unit' => isset( $row[ $column_weight_unit ] ) ? $row[ $column_weight_unit ] : '',
122
- 'additional_description' => isset( $row[ $column_additional_description ] ) ? $row[ $column_additional_description ] : '',
123
- 'pnp' => null,
124
- 'international_pnp' => null,
125
- 'file' => null,
126
- 'image' => '0',
127
- 'quantity_limited' => isset( $row[ $column_quantity_limited ] ) ? $row[ $column_quantity_limited ] : '',
128
- 'quantity' => isset( $row[ $column_quantity ] ) ? $row[ $column_quantity ] : null,
129
- 'special' => null,
130
- 'special_price' => null,
131
- 'display_frontpage' => null,
132
- 'notax' => null,
133
- 'active' => null,
134
- 'donation' => null,
135
- 'no_shipping' => null,
136
- 'thumbnail_image' => null,
137
- 'thumbnail_state' => null,
138
- 'meta' => array(
139
- '_wpsc_price' => isset( $row[$column_price] ) ? str_replace( '$', '', $row[$column_price] ) : 0,
140
- '_wpsc_special_price' => '',
141
- '_wpsc_sku' => isset( $row[$column_sku] ) ? $row[$column_sku] : '',
142
- '_wpsc_stock' => isset( $row[$column_quantity] ) ? $row[$column_quantity] : null,
143
- '_wpsc_limited_stock' => isset( $row[$column_quantity_limited] ) ? $row[$column_quantity_limited] : '',
144
- '_wpsc_product_metadata' => array(
145
- 'weight' => isset( $row[$column_weight] ) ? $row[$column_weight] : '',
146
- 'weight_unit' => isset( $row[$column_weight_unit] ) ? $row[$column_weight_unit] : '',
147
- )
148
- )
149
- );
150
-
151
- $product = apply_filters( 'wpsc_product_import_row', $product, $row, $this );
152
-
153
- if ( empty( $product['post_title'] ) && apply_filters( 'wpsc_product_import_require_title', true, $product, $row, $this ) ) {
154
- continue;
155
- }
156
-
157
- $product = wpsc_sanitise_product_forms( $product );
158
-
159
- // status needs to be set here because wpsc_sanitise_product_forms overwrites it :/
160
- $product['post_status'] = $_POST['post_status'];
161
-
162
- $product_id = wpsc_insert_product( $product );
163
-
164
- if ( (int) $_POST['category'] > 0 ) {
165
- wp_set_object_terms( $product_id , array( (int) $_POST['category'] ) , 'wpsc_product_category' );
166
- }
167
-
168
- $record_count += 1;
169
- }
170
-
171
- $this->reset_state();
172
- $this->completed = true;
173
- add_settings_error( 'wpsc-settings', 'settings_updated', sprintf( __( 'CSV file successfully processed. %s record(s) imported.', 'wp-e-commerce' ), $record_count ), 'updated' );
174
- }
175
-
176
- public function callback_submit_options() {
177
- if ( isset( $_FILES['csv_file'] ) && isset( $_FILES['csv_file']['name'] ) && ($_FILES['csv_file']['name'] != '') ) {
178
- $this->hide_update_message();
179
- ini_set( 'auto_detect_line_endings', 1 );
180
- $file = $_FILES['csv_file'];
181
- $file_path = WPSC_FILE_DIR . $file['name'];
182
- if ( move_uploaded_file( $file['tmp_name'], WPSC_FILE_DIR . $file['name'] ) ) {
183
- set_transient( 'wpsc_settings_tab_import_file', $file_path );
184
- return array( 'step' => 2 );
185
- }
186
- }
187
-
188
- if ( $this->completed ) {
189
- return array( 'step' => 1 );
190
- }
191
-
192
- return array( 'step' => $this->step + 1 );
193
- }
194
-
195
- private function display_imported_columns() {
196
- extract( $this->display_data );
197
- ?>
198
- <h3 class='hndle'><?php esc_html_e( 'Assign CSV Columns to Product Fields', 'wp-e-commerce'); ?></h3>
199
- <p><?php esc_html_e( 'For each column, select the field it corresponds to in \'Product Field\'.', 'wp-e-commerce' ); ?></p>
200
- <p><?php esc_html_e( 'Note: In this view we only show sample data from the first 5 records. All records in the uploaded import file will actually be imported.', 'wp-e-commerce' ); ?></p>
201
- <table class='wp-list-table widefat plugins' id="wpsc_imported_columns">
202
- <thead>
203
- <tr>
204
- <th scope="col" class="manage-column"><?php _e( 'Column', 'wp-e-commerce' ); ?></th>
205
- <th scope="col" class="manage-column"><?php _e( 'Sample Data from Column', 'wp-e-commerce' ); ?></th>
206
- <th scope="col" class="manage-column"><?php _e( 'Product Field', 'wp-e-commerce' ); ?></th>
207
- </tr>
208
- </thead>
209
- <tbody>
210
- <?php foreach ( $sample_row_data as $key => $sample_data ) : ?>
211
- <tr>
212
- <td>
213
- <p><?php printf( __('Column %s', 'wp-e-commerce' ), $this->num_to_alphacolumn( $key ) ); ?></p>
214
- </td>
215
- <td>
216
- <ol>
217
- <?php foreach ($sample_data as $datum) : ?>
218
- <li>
219
- <?php if ( $datum != "" ): ?>
220
- <code><?php echo esc_html( $datum ); ?></code>
221
- <?php else: ?>
222
- <?php _e( '<em class="empty">empty</em>', 'wp-e-commerce' ); ?>
223
- <?php endif; ?>
224
- </li>
225
- <?php endforeach; ?>
226
- </ol>
227
- </td>
228
- <td>
229
- <p>
230
- <select name='value_name[<?php echo $key; ?>]'>
231
- <?php
232
- $i = 0;
233
- foreach ( $this->default_fields as $value => $label ) :
234
- ?>
235
- <option <?php selected( $key, $i ); ?> value='<?php echo esc_attr( $value ); ?>'><?php echo esc_html( $label ); ?></option>
236
- <?php
237
- $i++;
238
- endforeach;
239
- ?>
240
- </select>
241
- </p>
242
- </td>
243
- </tr>
244
- <?php endforeach; ?>
245
- </tbody>
246
- </table>
247
- <h3><?php esc_html_e( 'Import Options', 'wp-e-commerce' ); ?></h3>
248
- <table class='form-table'>
249
- <tr>
250
- <th>
251
- <label for='post_status'><?php esc_html_e( 'Product Status' , 'wp-e-commerce' ); ?>
252
- </th>
253
- <td>
254
- <select name='post_status' id='post_status'>
255
- <option value='publish'><?php esc_html_e( 'Publish', 'wp-e-commerce' ); ?></option>
256
- <option value='draft' ><?php esc_html_e( 'Draft' , 'wp-e-commerce' ); ?></option>
257
- </select>
258
- <p class="description">
259
- <?php esc_html_e( 'Set your imported products as drafts, or publish them right away.' , 'wp-e-commerce' ); ?>
260
- </p>
261
- </td>
262
- </tr>
263
- <tr>
264
- <th><label for="category"><?php esc_html_e( 'Import to Category', 'wp-e-commerce' ); ?></label></th>
265
- <td>
266
- <select id='category' name='category'>
267
- <option value=""><?php esc_html_e( "No Category", 'wp-e-commerce' ); ?></option>
268
- <?php foreach ( $categories as $category ): ?>
269
- <option value="<?php echo $category->term_id; ?>"><?php echo esc_html( $category->name ); ?></option>
270
- <?php endforeach; ?>
271
- </select>
272
- <p class="description">
273
- <?php esc_html_e( 'Products imported from this CSV file will be placed in the selected category.', 'wp-e-commerce' ); ?></p>
274
- </p>
275
- </td>
276
- </tr>
277
- </table>
278
- <input type="hidden" name="step" value="3" />
279
- <input type='submit' value='<?php echo esc_html_x( 'Import Products', 'import csv', 'wp-e-commerce' ); ?>' class='button-primary'>
280
- <?php
281
- }
282
-
283
- private function num_to_alphacolumn($n) {
284
- // from http://stackoverflow.com/questions/3302857/algorithm-to-get-the-excel-like-column-name-of-a-number
285
-
286
- for( $r = ""; $n >= 0; $n = intval( $n / 26 ) - 1 ) {
287
- $r = chr( $n % 26 + 0x41) . $r;
288
- }
289
-
290
- return $r;
291
- }
292
-
293
- private function display_default() {
294
- extract( $this->display_data );
295
- ?>
296
- <h3><?php _e( 'Import Products', 'wp-e-commerce' ); ?></h3>
297
- <p><?php _e( 'You can import your products from a <a href="http://en.wikipedia.org/wiki/Comma-separated_values"><abbr title="Comma-separated values">CSV</abbr> (Comma-separated values) file</a>, exportable from most spread-sheet programs or other software.</p>', 'wp-e-commerce' ); ?></p>
298
-
299
- <h4><?php _e( 'Import New Products from CSV', 'wp-e-commerce' ); ?></h4>
300
- <table class='form-table'>
301
- <tr>
302
- <th><label for='wpsc_csv_file'><?php _e( 'CSV File', 'wp-e-commerce' ); ?><label></th>
303
- <td>
304
- <input type='file' name='csv_file' id='wpsc_csv_file' />
305
- </td>
306
- </tr>
307
- </table>
308
-
309
- <?php submit_button( esc_html_x( 'Upload', 'import csv', 'wp-e-commerce' ) ); ?>
310
-
311
- <h4><?php _e( 'Useful Information', 'wp-e-commerce' ); ?></h4>
312
- <table class='form-table'>
313
- <tr>
314
- <th><?php echo _e( 'Supported Fields', 'wp-e-commerce' ); ?></th>
315
- <td>
316
- <?php _e( 'Columns supported are, in their default order:', 'wp-e-commerce'); ?><br />
317
- <code>
318
- <?php echo implode( ', ', $this->default_fields ); ?>
319
- </code>
320
- </td>
321
- </tr>
322
- <tr>
323
- <th><?php _e( 'Understood Weight Units', 'wp-e-commerce' ); ?></th>
324
- <td>
325
- <?php _e( 'Metric', 'wp-e-commerce' ); ?>: <code>kilogram</code>,<code>kilograms</code>,<code>kg</code>,<code>kgs</code>,<code>gram</code>,<code>grams</code>,<code>g</code>,<code>gs</code><br />
326
- <?php _e( 'Imperial', 'wp-e-commerce' ); ?>: <code>ounce</code>,<code>ounces</code>,<code>oz</code>,<code>pound</code>,<code>pounds</code>,<code>lb</code>,<code>lbs</code>
327
- </td>
328
- </tr>
329
- <tr>
330
- <th><?php _e( 'Stock Fields', 'wp-e-commerce' ); ?></th>
331
- <td>
332
- <?php _e( '<code>Stock Quantity</code> values are used only when <code>Stock Quantity Limited</code> is blank or <code>""</code>.', 'wp-e-commerce' ); ?>
333
- </td>
334
- </tr>
335
- <tr>
336
- <th><?php _e( 'HTML', 'wp-e-commerce' ); ?></th>
337
- <td>
338
- <?php _e( 'Supported in <code>Description</code> and <code>Additional Description</code>. Be sure you "quote" the whole description, and slash-escape \"quotes\" inside the description itself.', 'wp-e-commerce' ); ?>
339
- </tr>
340
- <tr>
341
- <th><?php _e( 'Example CSV File', 'wp-e-commerce' ); ?></th>
342
- <td>
343
- <ol>
344
- <li><code><?php esc_html_e( 'Banana, The Yellow Fruit, Contains Potassium, 0.67, "BANANA", 150, "g", 0, ""', 'wp-e-commerce' ); ?></code></li>
345
- <li><code><?php esc_html_e( '"Apple, red", "Red, round, juicy. Isn\'t an <a href=\"http://example.com\">orange</a>.", "Red Delicious", 0.25, "RED_DELICIOUS", 5, "oz", 10, true', 'wp-e-commerce' ); ?></code></li>
346
- </ol>
347
- </td>
348
- </tr>
349
- </table>
350
-
351
- <?php
352
- }
353
-
354
- public function display() {
355
- switch ( $this->step ) {
356
- case 1:
357
- $this->display_default();
358
- break;
359
- case 2:
360
- $this->display_imported_columns();
361
- break;
362
- default:
363
- $this->display_default();
364
- break;
365
- }
366
- }
367
- }
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
trunk/wpsc-admin/includes/settings-tabs/marketing.php DELETED
@@ -1,210 +0,0 @@
1
- <?php
2
-
3
- class WPSC_Settings_Tab_Marketing extends WPSC_Settings_Tab {
4
-
5
- public function __construct() {
6
- add_action( 'admin_notices', array( $this, 'yoast_check' ) );
7
- }
8
-
9
- public function yoast_check() {
10
- $yoast_options = get_option( 'Yoast_Google_Analytics' );
11
- $wpec_tracking = isset( $yoast_options['wpec_tracking'] ) && $yoast_options['wpec_tracking'] ? true : false;
12
-
13
- if ( $wpec_tracking ) {
14
- ?>
15
- <div class="error">
16
- <p><?php _e( '<strong>You appear to have Google Analytics for WordPress installed.</strong>. <br /> This is not a problem, however, you also appear to have the WPeC tracking enabled. We highly recommend disabling that setting and using the settings on this page.', 'wp-e-commerce' ); ?></p>
17
- </div>
18
- <?php
19
- }
20
- }
21
-
22
- public function display() {
23
- $this->marketing_settings_form();
24
- $this->rss_address_settings_form();
25
- $this->google_merch_center_settings_form();
26
- $this->google_analytics_integration_settings_form();
27
- }
28
-
29
- public function marketing_settings_form() {
30
-
31
- $wpsc_also_bought = get_option( 'wpsc_also_bought' );
32
- $wpsc_also_bought1 = '';
33
-
34
- if ( '1' == $wpsc_also_bought )
35
- $wpsc_also_bought1 = "checked='checked'";
36
-
37
- $wpsc_share_this = get_option( 'wpsc_share_this' );
38
- $wpsc_share_this1 = '';
39
-
40
- if ( '1' == $wpsc_share_this )
41
- $wpsc_share_this1 = "checked='checked'";
42
-
43
- $facebook_like = get_option( 'wpsc_facebook_like' );
44
- $facebook_like1 = '';
45
- if ( 'on' == $facebook_like )
46
- $facebook_like1 = "checked='checked'";
47
-
48
- $display_find_us = get_option( 'display_find_us' );
49
- $display_find_us1 = '';
50
-
51
- if ( '1' == $display_find_us )
52
- $display_find_us1 = "checked='checked'";
53
-
54
- ?>
55
-
56
- <h3><?php esc_html_e( 'Marketing Settings', 'wp-e-commerce'); ?></h3>
57
- <table class='form-table'>
58
- <tr>
59
- <th>
60
- <?php esc_html_e( "'Users who bought this also bought'", 'wp-e-commerce' ); ?>
61
- </th>
62
- <td>
63
- <label>
64
- <input <?php echo $wpsc_also_bought1; ?> type='checkbox' name='wpsc_also_bought' />
65
- <?php esc_html_e( "Add 'Users who bought this also bought' item to the single products page.", 'wp-e-commerce' ); ?>
66
- </label>
67
- </td>
68
- </tr>
69
- <tr>
70
- <th>
71
- <?php esc_html_e( "'Share This' Social Bookmarks", 'wp-e-commerce' ); ?>
72
- </th>
73
- <td>
74
- <label>
75
- <input <?php echo $wpsc_share_this1; ?> type='checkbox' name='wpsc_share_this' />
76
- <?php esc_html_e( 'Add the \'Share this link\' item to the single products page.', 'wp-e-commerce' ); ?>
77
- </label>
78
- </td>
79
- </tr>
80
- <tr>
81
- <th>
82
- <?php esc_html_e( "'How Customer Found Us' Survey", 'wp-e-commerce' ) ?>
83
- </th>
84
- <td>
85
- <label>
86
- <input <?php echo $display_find_us1; ?> type='checkbox' name='display_find_us' />
87
- <?php esc_html_e( 'Add the \'How did you find out about us\' drop-down option at checkout.', 'wp-e-commerce' ); ?>
88
- </label>
89
- </td>
90
- </tr>
91
- <tr>
92
- <th>
93
- <?php esc_html_e( "Facebook 'Like' Button", 'wp-e-commerce' ) ?>
94
- </th>
95
- <td>
96
- <input type='hidden' value='0' name='wpsc_options[wpsc_facebook_like]' />
97
- <input <?php echo $facebook_like1; ?> type='checkbox' name='wpsc_options[wpsc_facebook_like]' />
98
- <?php esc_html_e( 'Add the Facebook Like button on your single products page.', 'wp-e-commerce' ); ?>
99
- </td>
100
- </tr>
101
- </table>
102
- <?php
103
- }
104
-
105
- public function rss_address_settings_form() {
106
- ?>
107
- <h3><?php esc_html_e( 'Product RSS Address', 'wp-e-commerce'); ?></h3>
108
- <p><?php esc_html_e( 'People can use this RSS feed to keep up to date with your product list.', 'wp-e-commerce' ); ?></p>
109
-
110
- <table class='form-table'>
111
- <tr>
112
- <th>
113
- <?php esc_html_e( 'RSS Feed Address', 'wp-e-commerce' ); ?>
114
- </th>
115
- <td>
116
- <?php $rss_url = add_query_arg( array( 'rss' => 'true', 'action' => 'product_list' ), home_url( '/' ) ); ?>
117
- <a href="<?php echo esc_url( $rss_url ); ?>"><code><?php echo esc_url( $rss_url ); ?></code></a>
118
- </td>
119
- </tr>
120
- </table>
121
- <?php
122
- }
123
-
124
- public function google_merch_center_settings_form() {
125
- ?>
126
- <h3><?php esc_html_e( 'Google Merchant Centre / Google Product Search', 'wp-e-commerce'); ?></h3>
127
- <p><?php printf( __( 'To import your products into <a href="%s" target="_blank">Google Merchant Centre</a> so that they appear within Google Product Search results, sign up for a Google Merchant Centre account and add a scheduled data feed with the following URL:', 'wp-e-commerce' ), 'http://www.google.com/merchants/' ); ?></p>
128
-
129
- <table class='form-table'>
130
- <tr>
131
- <th>
132
- <?php esc_html_e( 'Google Product Feed', 'wp-e-commerce' ); ?>
133
- </th>
134
- <td>
135
- <?php $google_feed_url = add_query_arg( array( 'rss' => 'true', 'action' => 'product_list', 'xmlformat' => 'google' ), home_url( '/' ) ); ?>
136
- <a href="<?php echo esc_url( $google_feed_url ); ?>"><code><?php echo esc_url( $google_feed_url ); ?></code></a>
137
- </td>
138
- </tr>
139
- </table>
140
- <?php
141
- }
142
-
143
- public function google_analytics_integration_settings_form() {
144
- ?>
145
- <h3><?php esc_html_e( 'Google Analytics E-Commerce Tracking', 'wp-e-commerce' ); ?></h3>
146
- <p><?php printf( __( 'Track successful transactions and items purchased in <a href="%s">Google Analytics</a>.', 'wp-e-commerce' ), 'http://www.google.com/analytics/' ); ?></p>
147
- <input type='hidden' name='change-settings' value='true' />
148
- <table class='form-table'>
149
- <tr>
150
- <th>
151
- <?php _e( 'Enable', 'wp-e-commerce' ); ?>
152
- </th>
153
- <td>
154
- <label>
155
- <input value='1' type='hidden' name='wpsc_ga_disable_tracking' />
156
- <input value='0' <?php checked( '0', get_option( 'wpsc_ga_disable_tracking' ) ); ?> type='checkbox' name='wpsc_ga_disable_tracking' />
157
- <?php _e( 'Enable Google Analytics tracking', 'wp-e-commerce' ); ?>
158
- </label>
159
- <p class='description'><?php _e( 'If, for whatever reason, you decide you do not want any tracking, disable it.', 'wp-e-commerce' ); ?></p>
160
- </td>
161
- </tr>
162
- <tr>
163
- <th>
164
- <?php _ex( 'Google Analytics Tracking ID', 'google analytics', 'wp-e-commerce' ); ?>
165
- </th>
166
- <td>
167
- <input value="<?php echo esc_attr( get_option( 'wpsc_ga_tracking_id' ) ); ?>" type='text' name='wpsc_ga_tracking_id' />
168
- <span class='description'><?php _e( 'e.g. <code>UA-XXXXX-Y</code>', 'wp-e-commerce' ); ?></span>
169
- </td>
170
- </tr>
171
- <tr>
172
- <th>
173
- <?php _e( 'Universal Analytics', 'wp-e-commerce' ); ?>
174
- </th>
175
- <td>
176
- <label>
177
- <input value="1" <?php checked( '1', get_option( 'wpsc_ga_use_universal' ) ); ?> type="checkbox" name="wpsc_ga_use_universal" />
178
- <?php printf( __( 'Use <a%s>Universal Analytics</a> tracking code', 'wp-e-commerce' ), ' href="https://support.google.com/analytics/answer/2790010?hl=en-GB&ref_topic=6010376" target="universal_analytics"' ); ?>
179
- </label>
180
- </td>
181
- </tr>
182
- <tr>
183
- <th>
184
- <?php _e( 'Tracking Code Present', 'wp-e-commerce' ); ?>
185
- </th>
186
- <td>
187
- <label>
188
- <input value='1' <?php checked( '1', get_option( 'wpsc_ga_currently_tracking' ) ); ?> type='checkbox' name='wpsc_ga_currently_tracking' />
189
- <?php _e( 'Google Analytics is tracking my site', 'wp-e-commerce' ); ?>
190
- </label>
191
- <p class='description'><?php printf( __( 'Enable this if the Google Analytics tracking code is already present on your site, e.g. manually placed in your theme, or managed by another plugin. We will only insert the <a href="%s">E-Commerce tracking events</a> on the transaction results page.', 'wp-e-commerce' ), 'https://developers.google.com/analytics/devguides/collection/gajs/methods/gaJSApiEcommerce'); ?></p>
192
- </td>
193
- </tr>
194
- <tr>
195
- <th>
196
- <?php _e( 'Advanced Mode', 'wp-e-commerce' ); ?>
197
- </th>
198
- <td>
199
- <label>
200
- <input value='1' <?php checked( '1', get_option( 'wpsc_ga_advanced' ) ); ?> type='checkbox' name='wpsc_ga_advanced' />
201
- <?php _e( 'Enable Advanced Mode', 'wp-e-commerce' ); ?>
202
- </label>
203
- <p class='description'><?php _e( 'By default, we insert the multiple-domain asynchronous tracking code. This should be fine for 99% of users. If you need to fine-tune it, select the Advanced option. Then, instead of simply entering your tracking ID, you will enter the tracking code from Google Analytics into the header.php file of your theme.', 'wp-e-commerce' ); ?></p>
204
- </td>
205
- </tr>
206
- </table>
207
- <?php
208
- }
209
-
210
- }
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
trunk/wpsc-admin/includes/settings-tabs/shipping.php DELETED
@@ -1,344 +0,0 @@
1
- <?php
2
- class WPSC_Settings_Tab_Shipping extends WPSC_Settings_Tab {
3
- public function __construct() {
4
- parent::__construct();
5
-
6
- if ( isset( $_REQUEST['shipping_module_id'] ) )
7
- update_user_option( get_current_user_id(), 'wpsc_settings_selected_shipping_module', sanitize_text_field( $_REQUEST['shipping_module_id'] ) );
8
-
9
- add_action( 'admin_notices', array( $this, 'no_shipping_notice' ) );
10
- }
11
-
12
- /**
13
- * Hooks shipping notice into admin_notice if shipping is enabled but no shipping methods are selected
14
- *
15
- * @since 3.8.9
16
- * @return null
17
- */
18
- public function no_shipping_notice() {
19
- if ( ! empty( $_GET['shipping_disabled'] ) ) {
20
- ?>
21
- <div class="notice error is-dismissible below-h2">
22
- <p><?php _e( '<strong>Shipping has been disabled.</strong> You enabled shipping but none of the shipping methods were selected. Please re-enable shipping, select and configure a shipping method, and then update your settings.', 'wp-e-commerce' ); ?></p>
23
- </div>
24
- <?php
25
- }
26
- }
27
-
28
- public function callback_submit_options() {
29
- global $wpsc_shipping_modules;
30
-
31
- foreach ( $wpsc_shipping_modules as $shipping ) {
32
- if ( is_object( $shipping ) )
33
- $shipping->submit_form();
34
- }
35
-
36
- //This is for submitting shipping details to the shipping module
37
- if ( ! isset( $_POST['update_gateways'] ) )
38
- $_POST['update_gateways'] = '';
39
-
40
- if ( ! isset( $_POST['custom_shipping_options'] ) )
41
- $_POST['custom_shipping_options'] = array();
42
-
43
- update_option( 'custom_shipping_options', array_map( 'sanitize_text_field', $_POST['custom_shipping_options'] ) );
44
-
45
- $shipadd = 0;
46
- foreach ( $wpsc_shipping_modules as $shipping ) {
47
- foreach ( (array) $_POST['custom_shipping_options'] as $shippingoption ) {
48
- if ( $shipping->getInternalName() == $shippingoption ) {
49
- $shipadd++;
50
- }
51
- }
52
- }
53
-
54
- if ( isset( $_POST['wpsc_options']['shipping_discount_value'] ) ) {
55
- update_option( 'shipping_discount_value', wpsc_string_to_float( $_POST['wpsc_options']['shipping_discount_value'] ) );
56
- }
57
-
58
- if ( ! get_option( 'do_not_use_shipping' ) && ! get_option( 'custom_shipping_options' ) && ! ( bool ) get_option( 'shipwire' ) ) {
59
- update_option( 'do_not_use_shipping', '1' );
60
- return array( 'shipping_disabled' => 1 );
61
- } else {
62
- $_SERVER['REQUEST_URI'] = esc_url_raw( remove_query_arg( 'shipping_disabled' ) );
63
- }
64
- }
65
-
66
- public function display_shipping_module_settings_form( $selected_module_id = null ) {
67
- global $wpsc_shipping_modules;
68
- if ( ! $selected_module_id ) {
69
- $selected_module_id = (string) get_user_option( 'wpsc_settings_selected_shipping_module', get_current_user_id() );
70
- }
71
-
72
- $found_selected_module = array_key_exists( $selected_module_id, $wpsc_shipping_modules );
73
-
74
- if ( $found_selected_module ) {
75
- $selected_module = $wpsc_shipping_modules[$selected_module_id];
76
- $title = $selected_module->getName();
77
- $content = apply_filters( 'wpsc_shipping_module_settings_form', $selected_module->getForm(), $selected_module );
78
- } else {
79
- $title = __( 'Edit Shipping Module Settings', 'wp-e-commerce' );
80
- $content = __( 'To configure a shipping module select one on the left.', 'wp-e-commerce' );
81
- }
82
-
83
- ?>
84
- <div id='wpsc_shipping_settings_<?php echo esc_attr( $selected_module_id ); ?>_form' class='shipping-module-settings-form'>
85
- <table class='form-table'>
86
- <?php echo $content; ?>
87
- </table>
88
- <table class='form-table'>
89
- <tr><td colspan='2'>
90
- <p class="submit inline-edit-save">
91
- <a class="button edit-shipping-module-cancel" title="<?php esc_attr_e( "Cancel editing this shipping calculator's settings", 'wp-e-commerce' ) ?>"><?php esc_html_e( "Cancel", 'wp-e-commerce' ); ?></a>
92
- <input type="submit" name="submit" class="button button-primary edit-shipping-module-update" value='<?php _e( "Update &raquo;", 'wp-e-commerce' ); ?>'>
93
- </p>
94
- </td></tr>
95
- </table>
96
- </div>
97
- <?php
98
- }
99
-
100
- private function get_shipping_module_url( $shipping ) {
101
- $location = ( isset( $_REQUEST['current_url'] ) ? $_REQUEST['current_url'] : $_SERVER['REQUEST_URI'] );
102
- $location = add_query_arg( array(
103
- 'tab' => 'shipping',
104
- 'page' => 'wpsc-settings',
105
- 'shipping_module_id' => $shipping->getInternalName(),
106
- ), $location );
107
- $location .= '#wpsc-shipping-module-options';
108
- return esc_url( $location );
109
- }
110
-
111
- public function display() {
112
- global $wpdb, $wpsc_shipping_modules, $external_shipping_modules, $internal_shipping_modules;
113
-
114
- // sort into external and internal arrays.
115
- foreach ( $GLOBALS['wpsc_shipping_modules'] as $key => $module ) {
116
- if ( empty( $module ) )
117
- continue;
118
-
119
- if ( isset( $module->is_external ) && $module->is_external ) {
120
- $external_shipping_modules[$key] = $module;
121
- } else {
122
- $internal_shipping_modules[$key] = $module;
123
- }
124
- }
125
-
126
- ?>
127
-
128
- <h3><?php esc_html_e( 'Shipping Settings', 'wp-e-commerce'); ?></h3>
129
- <input type='hidden' name='shipping_submits' value='true' />
130
- <?php wp_nonce_field( 'update-options', 'wpsc-update-options' ); ?>
131
- <input type='hidden' name='wpsc_admin_action' value='submit_options' />
132
- <table class='form-table'>
133
- <?php
134
- /* wpsc_setting_page_update_notification displays the wordpress styled notifications */
135
- wpsc_settings_page_update_notification();
136
- ?>
137
- <tr>
138
- <th scope="row"><?php _e( 'Use Shipping', 'wp-e-commerce' ); ?></th>
139
- <td>
140
- <input type='hidden' value='1' name='wpsc_options[do_not_use_shipping]' />
141
- <input type='checkbox' value='0' name='wpsc_options[do_not_use_shipping]' id='do_not_use_shipping' <?php checked( '0', get_option( 'do_not_use_shipping' ) ); ?> /> <label for='do_not_use_shipping'><?php _e( 'Enable Shipping settings', 'wp-e-commerce' ); ?></label>
142
- <p class='description'><?php esc_html_e( 'If you are only selling digital downloads, you should turn this off.', 'wp-e-commerce' ); ?></p>
143
- </td>
144
- </tr>
145
-
146
- <tr>
147
- <th><?php esc_html_e( 'Shipping Origin City', 'wp-e-commerce' ); ?></th>
148
- <td>
149
- <input type='text' name='wpsc_options[base_city]' value='<?php echo esc_attr( get_option( 'base_city' ) ); ?>' />
150
- <p class='description'><?php esc_html_e( 'The name of the city where you fulfill and ship orders from. This enables us to give your customers more accurate shipping pricing.', 'wp-e-commerce' ); ?></p>
151
- </td>
152
- </tr>
153
- <tr>
154
- <th><?php esc_html_e( 'Shipping Origin Zipcode/Postcode', 'wp-e-commerce' ); ?></th>
155
- <td>
156
- <input type='text' name='wpsc_options[base_zipcode]' value='<?php echo esc_attr( get_option( 'base_zipcode' ) ); ?>' />
157
- <p class='description'>
158
- <?php esc_html_e( 'The ZIP code / Postal code from where you fulfill and ship orders.', 'wp-e-commerce' ); ?><br />
159
- <?php esc_html_e( 'If you are based in the United States, then this field is required in order for the UPS and USPS Shipping Calculators to work.', 'wp-e-commerce' ); ?>
160
- </p>
161
- </td>
162
- </tr>
163
- <tr>
164
- <th scope="row"><?php _e( 'Shipwire', 'wp-e-commerce' ); ?><span style='color: red;'></span></th>
165
- <td>
166
- <input type='hidden' value='0' name='wpsc_options[shipwire]' />
167
- <input type='checkbox' onclick='jQuery("#wpsc_shipwire_setting").toggle( jQuery(this).prop("checked") );' value='1' name='wpsc_options[shipwire]' id='shipwire' <?php checked( '1', get_option( 'shipwire' ) ); ?> />
168
- <label for='shipwire'><?php _e( 'Enable Shipwire Integration', 'wp-e-commerce' ); ?></label>
169
- <p class='description'><?php printf( __( '<a href="%1$s" target="_blank">Shipwire</a> provide e-commerce fulfillment warehouses. WP eCommerce can integrate stock inventory and shipping tracking with their service.', 'wp-e-commerce' ), 'http://www.shipwire.com/pp/o.php?id=11922' ); ?></p>
170
- </td>
171
- </tr>
172
- <?php
173
- switch ( get_option( 'shipwire' ) ) {
174
- case 1:
175
- $shipwire_settings = '';
176
- break;
177
-
178
- case 0:
179
- default:
180
- $shipwire_settings = 'style="display: none;"';
181
- break;
182
- }
183
- ?>
184
- <tr id='wpsc_shipwire_setting' <?php echo $shipwire_settings; ?>>
185
- <th>&nbsp;</th>
186
- <td>
187
- <table>
188
- <tr>
189
- <th><?php esc_html_e( 'Shipwire Email', 'wp-e-commerce' ); ?></th>
190
- <td><input type="text" name='wpsc_options[shipwireemail]' value="<?php echo esc_attr( get_option( 'shipwireemail' ) ); ?>" /></td>
191
- </tr>
192
- <tr>
193
- <th><?php esc_html_e( 'Shipwire Password', 'wp-e-commerce' ); ?></th>
194
- <td><input type="text" name='wpsc_options[shipwirepassword]' value="<?php echo esc_attr( get_option( 'shipwirepassword' ) ); ?>" /></td>
195
- </tr>
196
- <tr>
197
- <th><?php esc_html_e( 'Use Test Server?', 'wp-e-commerce' ); ?></th>
198
- <td><input type="checkbox" name='wpsc_options[shipwire_test_server]' value="0" <?php checked( '1', get_option( 'shipwire_test_server', '0' ) ); ?> /></td>
199
- </tr>
200
- <tr>
201
- <th><?php esc_html_e( 'Force Sync with Shipwire', 'wp-e-commerce' ); ?></th>
202
- <td>
203
- <a class="shipwire_sync button"><?php esc_html_e( 'Update Tracking and Inventory', 'wp-e-commerce' ); ?></a>
204
- <img src="<?php echo esc_url( wpsc_get_ajax_spinner() ); ?>" class="ajax-feedback" title="" alt="" />
205
- </td>
206
- </tr>
207
- </table>
208
- </td>
209
- </tr>
210
- <?php
211
- $currency_data = WPSC_Countries::get_currency_data( get_option( 'currency_type' ), true );
212
- if ( $currency_data['symbol'] != '' ) {
213
- $currency_sign = $currency_data['symbol_html'];
214
- } else {
215
- $currency_sign = $currency_data['code'];
216
- }
217
- ?>
218
- <tr>
219
- <th><?php _e( 'Free Shipping Discount', 'wp-e-commerce' ); ?></th>
220
- <td>
221
- <?php
222
- if ( get_option( 'shipping_discount' ) == 1 ) {
223
- $shipping_discount_settings = 'style=\'display: block;\'';
224
- } else {
225
- $shipping_discount_settings = '';
226
- }
227
- ?>
228
- <input type='hidden' value='0' name='wpsc_options[shipping_discount]' />
229
- <input type='checkbox' onclick='jQuery("#shipping_discount_value").toggle( jQuery(this).prop("checked") );' value='1' name='wpsc_options[shipping_discount]' id='shipping_discount' <?php checked( '1', get_option( 'shipping_discount' ) ); ?> />
230
- <label for='shipping_discount'><?php _e( 'Enable Free Shipping Discount', 'wp-e-commerce' ); ?></label>
231
-
232
- </td>
233
- </tr>
234
- <tr>
235
- <td>&nbsp;</td>
236
- <td colspan="2">
237
- <?php
238
- $value = wpsc_format_number( get_option( 'shipping_discount_value' ) );
239
- ?>
240
- <div <?php echo $shipping_discount_settings; ?> id='shipping_discount_value'>
241
-
242
- <?php printf( __( 'Sales over or equal to %1$s<input type="text" size="6" name="wpsc_options[shipping_discount_value]" value="%2$s" id="shipping_discount_value" /> will receive free shipping.', 'wp-e-commerce' ), $currency_sign, esc_attr( $value ) ); ?>
243
- </div>
244
- </td>
245
- </tr>
246
- </table>
247
-
248
- <?php submit_button( __( 'Save Changes', 'wp-e-commerce' ) ); ?>
249
-
250
- <h3><?php _e( 'Shipping Modules', 'wp-e-commerce' ) ?></h3>
251
- <p class='description'><?php _e( 'To enable shipping in WP eCommerce you must select which shipping methods you want to enable on your site.', 'wp-e-commerce' ); ?></p>
252
- <p class='description'>
253
- <strong><?php _e( 'Tip', 'wp-e-commerce' ); ?></strong>:
254
- <?php printf( __( 'For fixed-price shipping options such as "Pickup - $0, Overnight - $10, Same day - $20, etc.", install our free <a href="%1$s">Fixed Rate Shipping</a> plugin.', 'wp-e-commerce' ), 'http://wordpress.org/extend/plugins/wp-e-commerce-fixed-rate-shipping/' ); ?>
255
- </p>
256
-
257
- <h4><?php _e( 'Internal Shipping Calculators', 'wp-e-commerce' ); ?></h4>
258
- <table id='wpsc-shipping-options-internal' class='wpsc-edit-module-options wp-list-table widefat plugins'>
259
- <thead>
260
- <tr>
261
- <th scope="col" id="wpsc-shipping-options-internal-active" class="manage-column"><?php _e( 'Active', 'wp-e-commerce' ); ?></th>
262
- <th scope="col" id="wpsc-shipping-options-internal-name" class="manage-column column-name"><?php _e( 'Shipping Calculator', 'wp-e-commerce' ); ?></th>
263
- </tr>
264
- </thead>
265
- <tfoot>
266
- <tr>
267
- <th scope="col" id="wpsc-shipping-options-internal-active" class="manage-column"><?php _e( 'Active', 'wp-e-commerce' ); ?></th>
268
- <th scope="col" id="wpsc-shipping-options-internal-name" class="manage-column column-name"><?php _e( 'Shipping Calculator', 'wp-e-commerce' ); ?></th>
269
- </tr>
270
- </tfoot>
271
- <tbody>
272
- <?php
273
- foreach ( $internal_shipping_modules as $shipping ) {
274
- $force = ( $shipping->getInternalName() === (string) get_user_option( 'wpsc_settings_selected_shipping_module', get_current_user_id() ) );
275
- $this->shipping_list_item( $shipping, $force );
276
- }
277
- ?>
278
- </tbody>
279
- </table>
280
- <?php submit_button( __( 'Save Changes', 'wp-e-commerce' ) ); ?>
281
-
282
- <h4><?php _e( 'External Shipping Calculators', 'wp-e-commerce' ); ?></h4>
283
- <?php if ( ! function_exists( 'curl_init' ) ) : ?>
284
- <p style='color: red; font-size:8pt; line-height:10pt;'>
285
- <?php _e( 'The following shipping modules all need cURL which is not installed on this server. You may need to contact your web hosting provider to get it set up. ', 'wp-e-commerce' ); ?>
286
- </p>
287
- <?php endif; ?>
288
- <table id='wpsc-shipping-options-external' class='wpsc-edit-module-options wp-list-table widefat plugins'>
289
- <thead>
290
- <tr>
291
- <th scope="col" id="wpsc-shipping-options-external-active" class="manage-column"><?php _e( 'Active', 'wp-e-commerce' ); ?></th>
292
- <th scope="col" id="wpsc-shipping-options-external-name" class="manage-column column-name"><?php _e( 'Shipping Calculator', 'wp-e-commerce' ); ?></th>
293
- </tr>
294
- </thead>
295
- <tfoot>
296
- <tr>
297
- <th scope="col" id="wpsc-shipping-options-external-active" class="manage-column"><?php _e( 'Active', 'wp-e-commerce' ); ?></th>
298
- <th scope="col" id="wpsc-shipping-options-external-name" class="manage-column column-name"><?php _e( 'Shipping Calculator', 'wp-e-commerce' ); ?></th>
299
- </tr>
300
- </tfoot>
301
- <tbody>
302
- <?php
303
- foreach ( $external_shipping_modules as $shipping ) {
304
- $force = ( $shipping->getInternalName() === (string) get_user_option( 'wpsc_settings_selected_shipping_module', get_current_user_id() ) );
305
- $this->shipping_list_item( $shipping, $force );
306
- }
307
- ?>
308
- </tbody>
309
- </table>
310
- <?php
311
- }
312
-
313
- private function shipping_list_item ( $shipping, $force ) {
314
- //get shipping options that are selected
315
- $selected_shippings = get_option( 'custom_shipping_options' );
316
-
317
- $shipping->checked = is_object( $shipping ) && in_array( $shipping->getInternalName(), (array) $selected_shippings );
318
- $shipping->active = $shipping->checked ? 'active' : 'inactive';
319
- $shipping->hidden = $force ? '' : "style='display: none;'";
320
- $shipping->disabled = isset( $shipping->requires_curl ) && $shipping->requires_curl && ! function_exists( 'curl_init' ) ;
321
-
322
- ?>
323
- <tr class="wpsc-select-shipping <?php echo $shipping->active; ?>" data-shipping-id="<?php echo esc_attr( $shipping->getInternalName() ); ?>" id="shipping_list_item_<?php echo $shipping->getInternalName();?>">
324
- <th scope="row" class="check-column">
325
- <input name='custom_shipping_options[]' <?php disabled( $shipping->disabled ); ?> <?php checked( $shipping->checked ); ?> type='checkbox' value='<?php echo $shipping->getInternalName(); ?>' id='<?php echo $shipping->getInternalName(); ?>_id' />
326
- </th>
327
- <td class="plugin-title">
328
- <label for='<?php echo $shipping->getInternalName(); ?>_id'><strong><?php echo $shipping->getName(); ?></strong></label>
329
- <div class="row-actions-visible">
330
- <span class="edit">
331
- <a class='edit-shipping-module' data-module-id="<?php echo $shipping->getInternalName(); ?>" title="<?php esc_attr_e( 'Edit this Shipping Module', 'wp-e-commerce' ); ?>" href='<?php echo esc_url( $this->get_shipping_module_url( $shipping ) ); ?>'><?php _ex( 'Settings', 'Shipping modules link to individual settings', 'wp-e-commerce' ); ?>
332
- <img src="<?php echo esc_url( wpsc_get_ajax_spinner() ); ?>" class="ajax-feedback" title="" alt="" />
333
- </span>
334
- </div>
335
- </td>
336
- </tr>
337
- <tr id="wpsc_shipping_settings_<?php echo esc_attr( $shipping->getInternalName() ); ?>" data-shipping-id="<?php echo esc_attr( $shipping->getInternalName() ); ?>" class='wpsc-select-shipping <?php echo $shipping->active; ?>' <?php echo $shipping->hidden; ?> >
338
- <td colspan="3" id="wpsc_shipping_settings_<?php echo esc_attr( $shipping->getInternalName() ); ?>_container">
339
- <?php $this->display_shipping_module_settings_form( $shipping->getInternalName() ); ?>
340
- </td>
341
- </tr>
342
- <?php
343
- }
344
- }
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
trunk/wpsc-admin/includes/settings-tabs/taxes.php DELETED
@@ -1,221 +0,0 @@
1
- <?php
2
-
3
- class WPSC_Settings_Tab_Taxes extends WPSC_Settings_Tab {
4
- public function __construct() {
5
- }
6
-
7
- public function callback_submit_options() {
8
- $taxes_enabled = ( isset( $_POST['wpsc_options']['wpec_taxes_enabled'] ) ) ? 1 : 0;
9
- update_option( 'wpec_taxes_enabled', $taxes_enabled );
10
-
11
- //currently there are two types - bands and rates
12
- $taxes_rates_types = array( 'rates', 'bands' );
13
-
14
- foreach ( $taxes_rates_types as $taxes_type ) {
15
- $saved_rates = array( ); //keep track of saved rates
16
- $exists = array( ); //keep track of what rates or names have been saved
17
- //check the rates
18
- if ( isset( $_POST['wpsc_options']['wpec_taxes_' . $taxes_type] ) ) {
19
- foreach ( $_POST['wpsc_options']['wpec_taxes_' . $taxes_type] as $tax_rate ) {
20
- if( !isset( $tax_rate['region_code'] ) )
21
- $tax_rate['region_code'] = '';
22
-
23
- //if there is no country then skip
24
- if ( empty( $tax_rate['country_code'] ) ) {
25
- continue;
26
- }
27
-
28
- //bands - if the name already exists then skip - if not save it
29
- if ( $taxes_type == 'bands' ) {
30
- if ( empty( $tax_rate['name'] ) || in_array( $tax_rate['name'], $exists ) || $tax_rate['name'] == 'Disabled' ) {
31
- continue;
32
- } else {
33
- $exists[] = $tax_rate['name'];
34
- $saved_rates[] = $tax_rate;
35
- }// if
36
- }// if
37
- //rates - check the shipping checkbox
38
- if ( $taxes_type == 'rates' ) {
39
- //if there is no rate then skip
40
- if ( empty( $tax_rate['rate'] ) ) {
41
- continue;
42
- }
43
-
44
- $tax_rate['shipping'] = (isset( $tax_rate['shipping'] )) ? 1 : 0;
45
-
46
- //check if country exists
47
- if ( array_key_exists( $tax_rate['country_code'], $exists ) ) {
48
- //if region already exists skip
49
- if ( array_search( $tax_rate['region_code'], $exists[$tax_rate['country_code']] ) == $tax_rate['country_code'] ) {
50
- continue;
51
- } else {
52
- //it's not in the array add it
53
- $exists[$tax_rate['country_code']][] = $tax_rate['region_code'];
54
-
55
- //save it
56
- $saved_rates[] = $tax_rate;
57
- }// if
58
- } else {
59
- //add codes to exists array
60
- $exists[$tax_rate['country_code']][] = $tax_rate['region_code'];
61
-
62
- //save it
63
- $saved_rates[] = $tax_rate;
64
- }// if
65
- }// if
66
- }// foreach
67
- }// if
68
- //replace post tax rates with filtered rates
69
- update_option( 'wpec_taxes_' . $taxes_type, $saved_rates );
70
- }
71
- }
72
-
73
- public function display() {
74
- $wpec_taxes_controller = new wpec_taxes_controller;
75
- $wpec_taxes_options = $wpec_taxes_controller->wpec_taxes->wpec_taxes_get_options();
76
-
77
- ?>
78
- <h3><?php esc_html_e( 'Tax Settings', 'wp-e-commerce' ); ?></h3>
79
- <table class='form-table'>
80
- <tr>
81
- <th><?php esc_html_e( "Enable Tax", 'wp-e-commerce' ); ?></th>
82
- <td>
83
- <input <?php if ( $wpec_taxes_options['wpec_taxes_enabled'] ) echo 'checked="checked"'; ?> type="checkbox" id='wpec_taxes_enabled' name='wpsc_options[wpec_taxes_enabled]' />
84
- <label for='wpec_taxes_enabled'>
85
- <?php esc_html_e( 'Turn tax on', 'wp-e-commerce' ); ?>
86
- </label>
87
- </td>
88
- </tr>
89
- <tr>
90
- <th><?php esc_html_e( "Product Prices", 'wp-e-commerce' ); ?></th>
91
- <td>
92
- <input <?php if ( $wpec_taxes_options['wpec_taxes_inprice'] == 'exclusive' ) echo 'checked="checked"'; ?> type="radio" value='exclusive' id='wpec_taxes_inprice1' name='wpsc_options[wpec_taxes_inprice]' />
93
- <label for='wpec_taxes_inprice1'>
94
- <?php esc_html_e( 'Product prices are tax exclusive - add tax to the price during checkout', 'wp-e-commerce' ); ?>
95
- </label><br />
96
- <input <?php if ( $wpec_taxes_options['wpec_taxes_inprice'] == 'inclusive' ) echo 'checked="checked"'; ?> type="radio" value='inclusive' id='wpec_taxes_inprice2' name='wpsc_options[wpec_taxes_inprice]' />
97
- <label for='wpec_taxes_inprice2'>
98
- <?php esc_html_e( "Product prices are tax inclusive - during checkout the total price doesn't increase but tax is shown as a line item", 'wp-e-commerce' ); ?>
99
- </label>
100
- </td>
101
- </tr>
102
- <tr>
103
- <th><?php esc_html_e( 'Product Specific Tax', 'wp-e-commerce' ); ?></th>
104
- <td>
105
- <input <?php if ( $wpec_taxes_options['wpec_taxes_product'] == 'add' ) echo 'checked="checked"'; ?> type="radio" value='add' id='wpec_taxes_product_1' name='wpsc_options[wpec_taxes_product]' />
106
- <label for='wpec_taxes_product_1'>
107
- <?php esc_html_e( 'Add per product tax to tax percentage if product has a specific tax rate', 'wp-e-commerce' ); ?>
108
- </label><br />
109
- <input <?php if ( $wpec_taxes_options['wpec_taxes_product'] == 'replace' ) echo 'checked="checked"'; ?> type="radio" value='replace' id='wpec_taxes_product_2' name='wpsc_options[wpec_taxes_product]' />
110
- <label for='wpec_taxes_product_2'>
111
- <?php esc_html_e( 'Replace tax percentage with product specific tax rate', 'wp-e-commerce' ); ?>
112
- </label>
113
- </td>
114
- </tr>
115
- <tr>
116
- <th><?php _e( 'Tax Logic', 'wp-e-commerce' ); ?></th>
117
- <td>
118
- <input <?php if ( $wpec_taxes_options['wpec_taxes_logic'] == 'billing_shipping' ) echo 'checked="checked"'; ?> type="radio" value='billing_shipping' id='wpec_taxes_logic_1' name='wpsc_options[wpec_taxes_logic]' />
119
- <label for='wpec_taxes_logic_1'>
120
- <?php esc_html_e( 'Apply tax when Billing and Shipping Region is the same as Tax Rate', 'wp-e-commerce' ); ?>
121
- </label>
122
- <div id='billing_shipping_preference_container' style='margin-left: 20px;'>
123
- <?php
124
- $checked = ( $wpec_taxes_options['wpec_taxes_logic'] == 'billing_shipping' && $wpec_taxes_options['wpec_billing_shipping_preference'] == 'billing_address' ? 'checked="checked"' : '' );
125
- ?>
126
- <input <?php echo $checked;?> type="radio" value='billing_address' id='wpec_billing_preference' name='wpsc_options[wpec_billing_shipping_preference]' />
127
- <label for='wpec_billing_preference'>
128
- <?php esc_html_e( 'Apply tax to Billing Address', 'wp-e-commerce' ); ?>
129
- </label><br />
130
- <?php
131
- $checked = ( $wpec_taxes_options['wpec_taxes_logic'] == 'billing_shipping' && $wpec_taxes_options['wpec_billing_shipping_preference'] == 'shipping_address' ? 'checked="checked"' : '' );
132
- ?>
133
- <input <?php echo $checked; ?>type="radio" value='shipping_address' id='wpec_shipping_preference' name='wpsc_options[wpec_billing_shipping_preference]' />
134
- <label for='wpec_shipping_preference'>
135
- <?php esc_html_e( 'Apply tax to Shipping Address', 'wp-e-commerce' ); ?>
136
- </label>
137
- </div>
138
- <input <?php if ( $wpec_taxes_options['wpec_taxes_logic'] == 'billing' ) echo 'checked="checked"'; ?> type="radio" value='billing' id='wpec_taxes_logic_2' name='wpsc_options[wpec_taxes_logic]' />
139
- <label for='wpec_taxes_logic_2'>
140
- <?php esc_html_e( 'Apply tax when Billing Region is the same as Tax Rate', 'wp-e-commerce' ); ?>
141
- </label><br />
142
- <input <?php if ( $wpec_taxes_options['wpec_taxes_logic'] == 'shipping' ) echo 'checked="checked"'; ?> type="radio" value='shipping' id='wpec_taxes_logic_3' name='wpsc_options[wpec_taxes_logic]' />
143
- <label for='wpec_taxes_logic_3'>
144
- <?php esc_html_e( 'Apply tax when Shipping Region is the same as Tax Rate', 'wp-e-commerce' ); ?>
145
- </label>
146
- </td>
147
- </tr>
148
- </table>
149
-
150
- <h3><?php esc_html_e( 'Tax Rates', 'wp-e-commerce' ); ?></h3>
151
- <div id='wpec-taxes-rates'>
152
- <!--Start Taxes Output-->
153
- <table class='widefat page fixed ui-sortable'>
154
- <thead>
155
- <th scope='col' width='60%'><?php _e( 'Market', 'wp-e-commerce' ); ?></th>
156
- <th scope='col' width='10%'><?php _e( 'Tax Rate', 'wp-e-commerce' ); ?></th>
157
- <th scope='col'><?php _e( 'Tax Shipping?', 'wp-e-commerce' ); ?></th>
158
- <th scope='col' style='width: 60px'><?php _e( 'Actions', 'wp-e-commerce' ); ?></th>
159
- </thead>
160
- <tbody>
161
- <?php
162
- $tax_rates = $wpec_taxes_controller->wpec_taxes->wpec_taxes_get_rates();
163
- echo $wpec_taxes_controller->wpsc_build_taxes_row( 'rates', 'prototype', array( 'row_class' => 'prototype' ) );
164
- if ( count( $tax_rates ) === 0 ) {
165
- echo $wpec_taxes_controller->wpsc_build_taxes_row( 'rates', 0, null );
166
- }
167
- $tax_rate_count = 0;
168
- if ( ! empty( $tax_rates ) ) {
169
- foreach ( $tax_rates as $tax_rate ) {
170
- // OLD: echo $wpec_taxes_controller->wpec_taxes_build_form( $tax_rate_count, $tax_rate );
171
- echo $wpec_taxes_controller->wpsc_build_taxes_row( 'rates', $tax_rate_count, $tax_rate );
172
- $tax_rate_count++;
173
- }
174
- }
175
- ?>
176
- </tbody>
177
- </table>
178
- <!--End Taxes Output-->
179
- </div>
180
- <div id='wpec-taxes-bands-container'>
181
- <h3><?php esc_html_e( 'Tax Bands', 'wp-e-commerce' ); ?></h3>
182
- <div id='wpec-taxes-bands'>
183
- <div class="updated inline">
184
- <p><?php _e( 'Note: Tax Bands are special tax rules you can create and apply on a per-product basis. Please visit the product page to apply your Tax Band.', 'wp-e-commerce' ); ?></p>
185
- </div>
186
- <?php if ( !$wpec_taxes_controller->wpec_taxes_isincluded() ) : ?>
187
- <div class="error inline">
188
- <p><?php _e( 'Warning: Tax Bands do not take effect when product prices are tax exclusive.', 'wp-e-commerce' ); ?></p>
189
- </div>
190
- <?php endif; ?>
191
- <table class='widefat page fixed ui-sortable'>
192
- <thead>
193
- <th scope='col'><?php _e( 'Band Name', 'wp-e-commerce' ); ?></th>
194
- <th scope='col' width="50%"><?php _e( 'Market', 'wp-e-commerce' ); ?></th>
195
- <th scope='col' width='20%'><?php _e( 'Tax Rate', 'wp-e-commerce' ); ?></th>
196
- <th scope='col' style='width: 60px'><?php _e( 'Actions', 'wp-e-commerce' ); ?></th>
197
- </thead>
198
- <tbody>
199
- <?php
200
- $tax_bands = $wpec_taxes_controller->wpec_taxes->wpec_taxes_get_bands();
201
- echo $wpec_taxes_controller->wpsc_build_taxes_row( 'bands', 'prototype', array( 'row_class' => 'prototype' ) );
202
- if ( count( $tax_bands ) === 0 ) {
203
- echo $wpec_taxes_controller->wpsc_build_taxes_row( 'bands', 0, null );
204
- }
205
- $tax_band_count = 0;
206
- if ( ! empty( $tax_bands ) ) {
207
- foreach ( $tax_bands as $tax_band ) {
208
- // OLD: echo $wpec_taxes_controller->wpec_taxes_build_form( $tax_band_count, $tax_band, 'bands' );
209
- echo $wpec_taxes_controller->wpsc_build_taxes_row( 'bands', $tax_band_count, $tax_band );
210
- $tax_band_count++;
211
- }
212
- }
213
- ?>
214
-
215
- </tbody>
216
- </table>
217
- </div>
218
- </div><!--wpec-taxes-bands-container-->
219
- <?php
220
- }
221
- }
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
trunk/wpsc-admin/includes/tax_and_shipping.php DELETED
@@ -1,67 +0,0 @@
1
- <?php
2
- /**
3
- * The HTML outputting the tax and shipping form
4
- *
5
- * @package wp-e-commerce
6
- * @since 3.8
7
- */
8
-
9
- global $wpdb;
10
- $changes_made = false;
11
- $country_isocode = preg_match( "/[a-zA-Z]{2,4}/", $_GET['isocode'] ) ? $_GET['isocode'] : get_option( 'base_country' );
12
- $base_region = get_option('base_region');
13
- ?>
14
- <div class="wrap">
15
- <h2><?php esc_html_e( 'GST/Tax Rate', 'wp-e-commerce' );?></h2>
16
- <?php
17
- if($changes_made === true)
18
- {
19
- echo esc_html__( 'Thanks, your changes have been made', 'wp-e-commerce' ) . "<br />";
20
- }
21
- ?>
22
- <form action='' method='post' name='regional_tax' class='wpsc_form_track'>
23
- <?php
24
- $country_data = $wpdb->get_row( $wpdb->prepare( "SELECT * FROM `".WPSC_TABLE_CURRENCY_LIST."` WHERE `isocode` IN(%s) LIMIT 1", $country_isocode ), ARRAY_A );
25
- if(($country_data['has_regions'] == 1))
26
- {
27
- $region_data = $wpdb->get_results("SELECT `".WPSC_TABLE_REGION_TAX."`.* FROM `".WPSC_TABLE_REGION_TAX."` WHERE `".WPSC_TABLE_REGION_TAX."`.`country_id` IN('".$country_data['id']."') ",ARRAY_A) ;
28
- $region_data = array_chunk($region_data, 14);
29
-
30
- echo "<table>\n\r";
31
- echo " <tr>\n\r";
32
- foreach($region_data as $region_col)
33
- {
34
- echo " <td style='vertical-align: top; padding-right: 3em;'>\n\r";
35
- echo "<table>\n\r";
36
- foreach($region_col as $region)
37
- {
38
- $tax_percentage = $region['tax'];
39
- echo " <tr>\n\r";
40
- if($region['id'] == $base_region)
41
- {
42
- echo " <td><label for='region_tax_".$region['id']."' style='text-decoration: underline;'>".$region['name'].":</label></td>\n\r";
43
- }
44
- else
45
- {
46
- echo " <td><label for='region_tax_".$region['id']."'>".$region['name'].":</label></td>\n\r";
47
- }
48
- echo " <td><input type='text' id='region_tax_".$region['id']."' name='region_tax[".$region['id']."]' value='".$tax_percentage."' class='tax_forms' size='2'/>%</td>\n\r";
49
- echo " </tr>\n\r";
50
- }
51
- echo "</table>\n\r";
52
- echo " </td>\n\r";
53
- }
54
- echo " </tr>\n\r";
55
- echo "</table>\n\r";
56
- }
57
- else
58
- {
59
- $tax_percentage = $country_data['tax'];
60
- echo "<label for='country_tax'>" . esc_html__( 'Tax Rate', 'wp-e-commerce' ) .":</label> ";
61
- echo "<input type='text' id='country_tax' name='country_tax' value='".$tax_percentage."' class='tax_forms' maxlength='3' size='3'/>%";
62
- }
63
- ?>
64
- <input type='hidden' name='wpsc_admin_action' value='change_region_tax' />
65
- <input class='button-secondary' type='submit' name='submit' value='<?php esc_attr_e( 'Save Changes', 'wp-e-commerce' );?>' />
66
- </form>
67
- </div>
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
trunk/wpsc-admin/includes/updating-functions.php DELETED
@@ -1,898 +0,0 @@
1
- <?php
2
- /**
3
- * WP eCommerce database updating functions
4
- *
5
- * @package wp-e-commerce
6
- * @since 3.8
7
- */
8
-
9
- class WPSC_Update {
10
- private static $instance;
11
- private $timeout;
12
- private $script_start;
13
- private $stages;
14
-
15
- public static function get_instance() {
16
- if ( empty( self::$instance ) )
17
- self::$instance = new WPSC_Update();
18
-
19
- return self::$instance;
20
- }
21
-
22
- private function __construct() {
23
- $this->timeout = ini_get( 'max_execution_time' );
24
- $this->script_start = time();
25
-
26
- if ( ! $this->stages = get_transient( 'wpsc_update_progress' ) ) {
27
- $this->stages = array();
28
- }
29
- }
30
-
31
- public function clean_up() {
32
- delete_transient( 'wpsc_update_progress' );
33
- delete_transient( 'wpsc_update_product_offset' );
34
- delete_transient( 'wpsc_update_variation_comb_offset' );
35
- delete_transient( 'wpsc_update_current_product' );
36
- delete_transient( 'wpsc_update_current_child_products' );
37
- }
38
-
39
- public function check_timeout() {
40
- $safety = 2; // refresh page within 2 seconds of PHP max execution time limit
41
- $wiggle_room = $this->timeout - $safety;
42
-
43
- $terminate = time() - $this->script_start >= $wiggle_room;
44
-
45
- if ( $terminate ) {
46
- do_action( 'wpsc_update_timeout_terminate' );
47
- $location = remove_query_arg( array( 'start_over', 'eta', 'current_percent' ) );
48
- $location = add_query_arg( 'run_updates', 1, $location );
49
- $location = esc_url_raw( apply_filters( 'wpsc_update_terminate_location', $location ) );
50
- ?>
51
- <script type="text/javascript">
52
- location.href = "<?php echo $location; ?>"
53
- </script>
54
- <?php
55
- exit;
56
- }
57
- }
58
-
59
- public function run( $function, $message = '' ) {
60
-
61
- if ( $message ) {
62
- echo "<p>{$message}</p>";
63
- }
64
-
65
- if ( empty( $this->stages[$function] ) ) {
66
- call_user_func( 'wpsc_' . $function );
67
- $this->stages[ $function ] = true;
68
- set_transient( 'wpsc_update_progress', $this->stages, WEEK_IN_SECONDS );
69
- }
70
- }
71
- }
72
-
73
- class WPSC_Update_Progress {
74
- private $milestone;
75
- private $start;
76
- private $count;
77
- private $current_percent = 0;
78
- private $total;
79
- private $eta;
80
- private $i;
81
-
82
- public function __construct( $total ) {
83
- $this->total = $total;
84
- $this->milestone = $this->start = time();
85
- if ( ! empty( $_REQUEST['current_percent'] ) )
86
- $this->current_percent = (int) $_REQUEST['current_percent'];
87
-
88
- add_filter( 'wpsc_update_terminate_location', array( $this, 'filter_terminate_location' ) );
89
-
90
- echo '<div class="wpsc-progress-bar">';
91
- if ( ! empty( $_REQUEST['start_over'] ) )
92
- return;
93
-
94
- if ( isset( $_REQUEST['current_percent'] ) ) {
95
- echo "<div class='block' style='width:" . absint( $_REQUEST['current_percent'] ) . "%;'>&nbsp;</div>";
96
- }
97
-
98
- if ( isset( $_REQUEST['eta'] ) ) {
99
- $this->eta = (int) $_REQUEST['eta'];
100
- $this->print_eta();
101
- }
102
-
103
- if ( isset( $_REQUEST['i'] ) )
104
- echo "<span>" . absint( $_REQUEST['i'] ) . "/{$this->total}</span>";
105
- }
106
-
107
- public function filter_terminate_location( $location ) {
108
- $location = add_query_arg( array(
109
- 'current_percent' => $this->current_percent,
110
- 'i' => $this->i,
111
- ), $location );
112
- if ( $this->eta !== null )
113
- $location = add_query_arg( 'eta', $this->eta, $location );
114
- else
115
- $location = remove_query_arg( 'eta', $location );
116
- return esc_url_raw( $location );
117
- }
118
-
119
- private function print_eta() {
120
- echo '<div class="eta">';
121
- _e( 'Estimated time left:', 'wp-e-commerce' );
122
- echo ' ';
123
- if ( $this->eta == 0 )
124
- _e( 'Under a minute', 'wp-e-commerce' );
125
- else
126
- printf( _n( '%d minute', '%d minutes', $this->eta, 'wp-e-commerce' ), $this->eta );
127
- echo '</div>';
128
- }
129
-
130
- public function update( $i ) {
131
- if ( empty( $this->count ) )
132
- $this->count = $i;
133
-
134
- $this->i = $i;
135
- $now = time();
136
- $percent = min( floor( $i * 100 / $this->total ), 100 );
137
-
138
- if ( $percent != $this->current_percent ) {
139
- echo "<div class='block' style='width:{$percent}%;'>&nbsp;</div>";
140
- $this->current_percent = $percent;
141
- }
142
-
143
- echo "<span>{$i}/{$this->total}</span>";
144
-
145
- if ( $now - $this->milestone >= 5 ) {
146
- $processed = $i - $this->count + 1;
147
- $this->eta = floor( ( $this->total - $i ) * ( $now - $this->start ) / ( $processed * 60 ) );
148
- $this->print_eta();
149
- $this->milestone = $now;
150
- }
151
-
152
- if ( $percent == 100 ) {
153
- remove_filter( 'wpsc_update_terminate_location', array( $this, 'filter_terminate_location' ) );
154
- echo '<div class="eta">' . _x( 'Done!', 'Update routine completed', 'wp-e-commerce' ) . '</div>';
155
- echo '</div>';
156
- }
157
- }
158
- }
159
-
160
- function wpsc_update_step( $i, $total ) {
161
- static $current;
162
- static $milestone;
163
- static $start;
164
- static $count;
165
- static $current_percent;
166
-
167
- $now = time();
168
-
169
- if ( $current != $total ) {
170
- $current = $total;
171
- $milestone = $start = $now;
172
- $count = $i;
173
- }
174
-
175
- $percent = min( round( $i * 100 / $total, 2 ), 100 );
176
-
177
- if ( floor( $percent ) != $current_percent ) {
178
- echo "<div class='block' style='width:{$percent}%;'>&nbsp;</div>";
179
- $current_percent = floor( $percent );
180
- }
181
-
182
- if ( $now - $milestone == 5 ) {
183
- $processed = $i - $count + 1;
184
- $eta = floor( ( $total - $i ) * ( $now - $start ) / ( $processed * 60 ) );
185
- echo '<div class="eta">';
186
- _e( 'Estimated time left:', 'wp-e-commerce' );
187
- echo ' ';
188
- if ( $eta == 0 )
189
- _e( 'Under a minute', 'wp-e-commerce' );
190
- else
191
- printf( _n( '%d minute', '%d minutes', $eta, 'wp-e-commerce' ), $eta );
192
- echo '</div>';
193
- $milestone = $now;
194
- }
195
- }
196
-
197
- function wpsc_update_purchase_logs() {
198
- global $wpdb;
199
-
200
- // bump all purchase log status
201
- $wpdb->query( "UPDATE " . WPSC_TABLE_PURCHASE_LOGS . " SET processed = processed + 1, plugin_version = '" . WPSC_VERSION . "' WHERE plugin_version IN ('3.6', '3.7') " );
202
- }
203
-
204
- /**
205
- * wpsc_convert_category_groups function.
206
- *
207
- * @access public
208
- * @return void
209
- */
210
- function wpsc_convert_category_groups() {
211
- global $wpdb, $user_ID;
212
- $wpsc_update = WPSC_Update::get_instance();
213
-
214
- //if they're updating from 3.6, and they've got categories with no group, let's fix that problem, eh?
215
- $categorisation_groups = $wpdb->get_results("SELECT * FROM `".WPSC_TABLE_CATEGORISATION_GROUPS."` WHERE `active` IN ('1')");
216
- if(count($categorisation_groups) == 0) {
217
- $sql = "insert into `".WPSC_TABLE_CATEGORISATION_GROUPS."` set `id` = 1000, `name` = 'Default Group', `description` = 'This is your default category group', `active` = 1, `default` = 1;";
218
- $wpdb->query($sql);
219
- $sql = "update `".WPSC_TABLE_PRODUCT_CATEGORIES."` set group_id = 1000";
220
- $wpdb->query($sql);
221
- $categorisation_groups = $wpdb->get_results("SELECT * FROM `".WPSC_TABLE_CATEGORISATION_GROUPS."` WHERE `active` IN ('1')");
222
- }
223
-
224
- foreach((array)$categorisation_groups as $cat_group) {
225
- $wpsc_update->check_timeout();
226
-
227
- $category_id = wpsc_get_meta($cat_group->id, 'category_group_id', 'wpsc_category_group');
228
-
229
- if(!is_numeric($category_id) || ( $category_id < 1)) {
230
- $new_category = wp_insert_term( $cat_group->name, 'wpsc_product_category', array('description' => $cat_group->description));
231
- if(!is_wp_error($new_category))
232
- $category_id = $new_category['term_id'];
233
-
234
- }
235
- if(is_numeric($category_id)) {
236
-
237
- wpsc_update_meta($cat_group->id, 'category_group_id', $category_id, 'wpsc_category_group');
238
- wpsc_update_categorymeta($category_id, 'category_group_id', $cat_group->id);
239
-
240
- wpsc_update_categorymeta($category_id, 'image', '');
241
- wpsc_update_categorymeta($category_id, 'uses_billing_address', 0);
242
- }
243
-
244
- if(! isset( $new_category ) || !is_wp_error($new_category))
245
- wpsc_convert_categories($category_id, $cat_group->id);
246
- }
247
- delete_option("wpsc_product_category_children");
248
- _get_term_hierarchy('wpsc_product_category');
249
- }
250
-
251
- /**
252
- * wpsc_convert_categories function.
253
- *
254
- * @access public
255
- * @param int $parent_category. (default: 0)
256
- * @return void
257
- */
258
- function wpsc_convert_categories($new_parent_category, $group_id, $old_parent_category = 0) {
259
- global $wpdb, $user_ID;
260
-
261
- if($old_parent_category > 0) {
262
- $categorisation = $wpdb->get_results( $wpdb->prepare( "SELECT * FROM `".WPSC_TABLE_PRODUCT_CATEGORIES."` WHERE `active` IN ('1') AND `group_id` IN (%d) AND `category_parent` IN (%d)", $group_id, $old_parent_category ) );
263
- } else {
264
- $categorisation = $wpdb->get_results( $wpdb->prepare( "SELECT * FROM `".WPSC_TABLE_PRODUCT_CATEGORIES."` WHERE `active` IN ('1') AND `group_id` IN (%d) AND `category_parent` IN (0)", $group_id ) );
265
- }
266
- $wpsc_update = WPSC_Update::get_instance();
267
-
268
- if($categorisation > 0) {
269
-
270
- foreach((array)$categorisation as $category) {
271
- $wpsc_update->check_timeout();
272
- $category_id = wpsc_get_meta($category->id, 'category_id', 'wpsc_old_category');
273
-
274
- if(!is_numeric($category_id) || ( $category_id < 1)) {
275
- $new_category = wp_insert_term( $category->name, 'wpsc_product_category', array('description' => $category->description, 'parent' => $new_parent_category));
276
- if(!is_wp_error($new_category))
277
- $category_id = $new_category['term_id'];
278
- }
279
-
280
- if(is_numeric($category_id)) {
281
-
282
- wpsc_update_meta($category->id, 'category_id', $category_id, 'wpsc_old_category');
283
- wpsc_update_categorymeta($category_id, 'category_id', $category->id);
284
-
285
- wpsc_update_categorymeta($category_id, 'image', $category->image);
286
- wpsc_update_categorymeta($category_id, 'display_type', $category->display_type);
287
-
288
- wpsc_update_categorymeta($category_id, 'image_height', $category->image_height);
289
- wpsc_update_categorymeta($category_id, 'image_width', $category->image_width);
290
-
291
- $use_additonal_form_set = wpsc_get_categorymeta($category->id, 'use_additonal_form_set');
292
- if($use_additonal_form_set != '') {
293
- wpsc_update_categorymeta($category_id, 'use_additonal_form_set', $use_additonal_form_set);
294
- } else {
295
- wpsc_delete_categorymeta($category_id, 'use_additonal_form_set');
296
- }
297
-
298
-
299
- wpsc_update_categorymeta($category_id, 'uses_billing_address', (bool)(int)wpsc_get_categorymeta($category->id, 'uses_billing_address'));
300
-
301
-
302
- }
303
- if($category_id > 0) {
304
- wpsc_convert_categories($category_id, $group_id, $category->id);
305
- }
306
-
307
- }
308
- }
309
- }
310
-
311
- function wpsc_convert_variation_sets() {
312
- global $wpdb, $user_ID;
313
- $variation_sets = $wpdb->get_results("SELECT * FROM `".WPSC_TABLE_PRODUCT_VARIATIONS."`");
314
- $wpsc_update = WPSC_Update::get_instance();
315
-
316
- foreach((array)$variation_sets as $variation_set) {
317
- $wpsc_update->check_timeout();
318
- $variation_set_id = wpsc_get_meta($variation_set->id, 'variation_set_id', 'wpsc_variation_set');
319
-
320
- if(!is_numeric($variation_set_id) || ( $variation_set_id < 1)) {
321
- $slug = sanitize_title( $variation_set->name );
322
- $dummy_term = (object) array(
323
- 'taxonomy' => 'wpsc-variation',
324
- 'parent' => 0,
325
- );
326
- $slug = wp_unique_term_slug( $slug, $dummy_term );
327
- $new_variation_set = wp_insert_term( $variation_set->name, 'wpsc-variation',array('parent' => 0, 'slug' => $slug ) );
328
- if( ! is_wp_error( $new_variation_set ) )
329
- $variation_set_id = $new_variation_set['term_id'];
330
- }
331
-
332
- if( ! empty( $variation_set_id ) && is_numeric($variation_set_id)) {
333
- wpsc_update_meta($variation_set->id, 'variation_set_id', $variation_set_id, 'wpsc_variation_set');
334
-
335
-
336
- $variations = $wpdb->get_results("SELECT * FROM `".WPSC_TABLE_VARIATION_VALUES."` WHERE `variation_id` IN ({$variation_set->id})");
337
- foreach((array)$variations as $variation) {
338
- $variation_id = wpsc_get_meta($variation->id, 'variation_id', 'wpsc_variation');
339
-
340
- if(!is_numeric($variation_id) || ( $variation_id < 1)) {
341
- $new_variation = wp_insert_term( $variation->name, 'wpsc-variation',array('parent' => $variation_set_id));
342
-
343
- if(!is_wp_error($new_variation))
344
- $variation_id = $new_variation['term_id'];
345
- }
346
- if(is_numeric($variation_id)) {
347
- wpsc_update_meta($variation->id, 'variation_id', $variation_id, 'wpsc_variation');
348
-
349
- }
350
- }
351
- }
352
- }
353
- }
354
-
355
- /**
356
- * wpsc_convert_products_to_posts function.
357
- *
358
- * @access public
359
- * @return void
360
- */
361
- function wpsc_convert_products_to_posts() {
362
- global $wpdb, $user_ID;
363
- // Select all products
364
- $wpsc_update = WPSC_Update::get_instance();
365
- if ( ! empty($wpdb->charset) )
366
- $charset_collate = "DEFAULT CHARACTER SET $wpdb->charset";
367
- if ( ! empty($wpdb->collate) )
368
- $charset_collate .= " COLLATE $wpdb->collate";
369
-
370
- if ( ! $offset = get_transient( 'wpsc_update_product_offset' ) )
371
- $offset = 0;
372
- $limit = 90;
373
- $sql = "
374
- SELECT * FROM " . WPSC_TABLE_PRODUCT_LIST . "
375
- WHERE active = '1'
376
- LIMIT %d, %d
377
- ";
378
- $post_created = get_transient( 'wpsc_update_current_product' );
379
- $total = $wpdb->get_var( "SELECT COUNT(*) FROM " . WPSC_TABLE_PRODUCT_LIST . " WHERE active='1'" );
380
- $progress = new WPSC_Update_Progress( $total );
381
-
382
- while (true) {
383
- $product_data = $wpdb->get_results( $wpdb->prepare( $sql, $offset, $limit ), ARRAY_A );
384
- $i = $offset;
385
-
386
- if ( empty( $product_data ) )
387
- break;
388
-
389
- foreach((array)$product_data as $product) {
390
- $wpsc_update->check_timeout( '</div>' );
391
-
392
- $post_id = 0;
393
-
394
- // if a product is in the middle of being converted
395
- if ( $post_created && ! empty( $post_created['original_id'] ) && $post_created['original_id'] == $product['id'] )
396
- $post_id = $post_created['post_id'];
397
-
398
- $sku = old_get_product_meta($product['id'], 'sku', true);
399
-
400
- if($post_id == 0) {
401
- $post_status = "publish";
402
- if($product['publish'] != 1) {
403
- $post_status = "draft";
404
- }
405
-
406
- //check the product added time with the current time to make sure its not out - this aviods the future post status
407
- $product_added_time = strtotime($product['date_added']);
408
- $current_time = time();
409
-
410
- $post_date = $product['date_added'];
411
- if ((int)$current_time < (int)$product_added_time)
412
- $post_date = date("Y-m-d H:i:s");
413
-
414
- $product_post_values = array(
415
- 'post_author' => $user_ID,
416
- 'post_date' => $post_date,
417
- 'post_content' => $product['description'],
418
- 'post_excerpt' => $product['additional_description'],
419
- 'post_title' => $product['name'],
420
- 'post_status' => $post_status,
421
- 'post_type' => "wpsc-product",
422
- 'post_name' => $product['name']
423
- );
424
-
425
- $product['order'] = $wpdb->get_var( $wpdb->prepare( "
426
- SELECT `order` FROM " . WPSC_TABLE_PRODUCT_ORDER . "
427
- WHERE product_id = %d
428
- ", $product['id'] ) );
429
-
430
- $product_post_values['menu_order'] = $product['order'];
431
-
432
- $post_id = wp_insert_post($product_post_values);
433
- $post_created = array(
434
- 'original_id' => $product['id'],
435
- 'post_id' => $post_id,
436
- );
437
- set_transient( 'wpsc_update_current_product', $post_created, 604800 );
438
- }
439
- $product_meta_sql = $wpdb->prepare( "
440
- SELECT IF( ( `custom` != 1 ),
441
- CONCAT( '_wpsc_', `meta_key` ) ,
442
- `meta_key`
443
- ) AS `meta_key`,
444
- `meta_value`
445
- FROM `".WPSC_TABLE_PRODUCTMETA."`
446
- WHERE `product_id` = %d
447
- AND `meta_value` != ''", $product['id'] );
448
-
449
- $product_meta = $wpdb->get_results( $product_meta_sql, ARRAY_A );
450
-
451
- $post_data = array();
452
-
453
- foreach($product_meta as $k => $pm) :
454
- if($pm['meta_value'] == 'om')
455
- $pm['meta_value'] = 1;
456
- $pm['meta_value'] = maybe_unserialize($pm['meta_value']);
457
- if(strpos($pm['meta_key'], '_wpsc_') === 0)
458
- $post_data['_wpsc_product_metadata'][$pm['meta_key']] = $pm['meta_value'];
459
- else
460
- update_post_meta($post_id, $pm['meta_key'], $pm['meta_value']);
461
- endforeach;
462
-
463
-
464
- $post_data['_wpsc_original_id'] = (int)$product['id'];
465
- $post_data['_wpsc_price'] = (float)$product['price'];
466
- $post_data['_wpsc_special_price'] = $post_data['_wpsc_price'] - (float)$product['special_price']; // special price get stored in a weird way in 3.7.x
467
- $post_data['_wpsc_stock'] = (float)$product['quantity'];
468
- $post_data['_wpsc_is_donation'] = $product['donation'];
469
- $post_data['_wpsc_sku'] = $sku;
470
- if((bool)$product['quantity_limited'] != true) {
471
- $post_data['_wpsc_stock'] = false;
472
- }
473
- unset($post_data['_wpsc_limited_stock']);
474
-
475
- $post_data['_wpsc_product_metadata']['is_stock_limited'] = (int)(bool)$product['quantity_limited'];
476
-
477
- // Product Weight
478
- $post_data['_wpsc_product_metadata']['weight'] = wpsc_convert_weight($product['weight'], $product['weight_unit'], "pound", true);
479
- $post_data['_wpsc_product_metadata']['weight_unit'] = $product['weight_unit'];
480
- $post_data['_wpsc_product_metadata']['display_weight_as'] = $product['weight_unit'];
481
-
482
- $post_data['_wpsc_product_metadata']['has_no_shipping'] = (int)(bool)$product['no_shipping'];
483
- $post_data['_wpsc_product_metadata']['shipping'] = array('local' => $product['pnp'], 'international' => $product['international_pnp']);
484
-
485
-
486
- $post_data['_wpsc_product_metadata']['quantity_limited'] = (int)(bool)$product['quantity_limited'];
487
- $post_data['_wpsc_product_metadata']['special'] = (int)(bool)$product['special'];
488
- if(isset($post_data['meta'])) {
489
- $post_data['_wpsc_product_metadata']['notify_when_none_left'] = (int)(bool)$post_data['meta']['_wpsc_product_metadata']['notify_when_none_left'];
490
- $post_data['_wpsc_product_metadata']['unpublish_when_none_left'] = (int)(bool)$post_data['meta']['_wpsc_product_metadata']['unpublish_when_none_left'];
491
- }
492
- $post_data['_wpsc_product_metadata']['no_shipping'] = (int)(bool)$product['no_shipping'];
493
-
494
- foreach($post_data as $meta_key => $meta_value) {
495
- // prefix all meta keys with _wpsc_
496
- update_post_meta($post_id, $meta_key, $meta_value);
497
- }
498
-
499
- // get the wordpress upload directory data
500
- $wp_upload_dir_data = wp_upload_dir();
501
- $wp_upload_basedir = $wp_upload_dir_data['basedir'];
502
-
503
- $category_ids = array();
504
- $category_data = $wpdb->get_col("SELECT `category_id` FROM `".WPSC_TABLE_ITEM_CATEGORY_ASSOC."` WHERE `product_id` IN ('{$product['id']}')");
505
- foreach($category_data as $old_category_id) {
506
- $category_ids[] = wpsc_get_meta($old_category_id, 'category_id', 'wpsc_old_category');
507
-
508
- }
509
- wp_set_product_categories($post_id, $category_ids);
510
-
511
- $product_data = get_post($post_id);
512
- $image_data_sql = $wpdb->prepare( "SELECT * FROM `".WPSC_TABLE_PRODUCT_IMAGES."` WHERE `product_id` = %d ORDER BY `image_order` ASC", $product['id'] );
513
- $image_data = $wpdb->get_results( $image_data_sql, ARRAY_A );
514
- foreach((array)$image_data as $image_row) {
515
- $wpsc_update->check_timeout( '</div>' );
516
- // Get the image path info
517
- $image_pathinfo = pathinfo($image_row['image']);
518
-
519
- // use the path info to clip off the file extension
520
- $image_name = basename($image_pathinfo['basename'], ".{$image_pathinfo['extension']}");
521
-
522
- // construct the full image path
523
- $full_image_path = WPSC_IMAGE_DIR.$image_row['image'];
524
- $attached_file_path = str_replace($wp_upload_basedir."/", '', $full_image_path);
525
- $upload_dir = wp_upload_dir();
526
- $new_path = $upload_dir['path'].'/'.$image_name.'.'.$image_pathinfo['extension'];
527
- if(is_file($full_image_path)){
528
- copy($full_image_path, $new_path);
529
- }else{
530
- continue;
531
- }
532
- // construct the full image url
533
- $subdir = $upload_dir['subdir'].'/'.$image_name.'.'.$image_pathinfo['extension'];
534
- $subdir = substr($subdir , 1);
535
- $attachment_id_sql = $wpdb->prepare( "SELECT `ID` FROM `{$wpdb->posts}` WHERE `post_title` = %s AND `post_parent` = %d LIMIT 1", $image_name, $post_id );
536
- $attachment_id = (int)$wpdb->get_var( $attachment_id_sql );
537
-
538
- // get the image MIME type
539
- $mime_type_data = wpsc_get_mimetype($full_image_path, true);
540
- if((int)$attachment_id == 0 ) {
541
- // construct the image data array
542
- $image_post_values = array(
543
- 'post_author' => $user_ID,
544
- 'post_parent' => $post_id,
545
- 'post_date' => $product_data->post_date,
546
- 'post_content' => $image_name,
547
- 'post_title' => $image_name,
548
- 'post_status' => "inherit",
549
- 'post_type' => "attachment",
550
- 'post_name' => sanitize_title($image_name),
551
- 'post_mime_type' => $mime_type_data['mime_type'],
552
- 'menu_order' => absint($image_row['image_order']),
553
- 'guid' => $new_path
554
- );
555
- $attachment_id = wp_insert_post($image_post_values);
556
- }
557
-
558
- update_attached_file( $attachment_id, $new_path );
559
- wp_update_attachment_metadata( $attachment_id, wp_generate_attachment_metadata( $attachment_id, $new_path ) );
560
- }
561
- $i ++;
562
- $progress->update( $i );
563
- set_transient( 'wpsc_update_product_offset', $i, 604800 );
564
- }
565
-
566
- $offset += $limit;
567
- }
568
- //Just throwing the payment gateway update in here because it doesn't really warrant it's own function :)
569
- $custom_gateways = get_option('custom_gateway_options');
570
- array_walk($custom_gateways, "wpec_update_gateway");
571
- update_option('custom_gateway_options', $custom_gateways);
572
- }
573
-
574
- function wpec_update_gateway(&$value,$key) {
575
- if ( $value == "testmode" )
576
- $value = "wpsc_merchant_testmode";
577
- if ( $value == "paypal_certified" )
578
- $value = "wpsc_merchant_paypal_express";
579
- if ( $value == "paypal_multiple" )
580
- $value = "wpsc_merchant_paypal_standard";
581
- if ( $value == "paypal_pro" )
582
- $value = "wpsc_merchant_paypal_pro";
583
-
584
- }
585
- function wpsc_convert_variation_combinations() {
586
- global $wpdb, $user_ID, $current_version_number;
587
- $wpsc_update = WPSC_Update::get_instance();
588
- remove_filter( 'get_terms', 'wpsc_get_terms_category_sort_filter' );
589
- if ( ! $offset = get_transient( 'wpsc_update_variation_comb_offset' ) )
590
- $offset = 0;
591
- $limit = 150;
592
- wp_defer_term_counting( true );
593
- $sql = "SELECT * FROM {$wpdb->posts} WHERE post_type = 'wpsc-product' AND post_parent = 0 LIMIT %d, %d";
594
-
595
- $total = $wpdb->get_var( "SELECT COUNT(*) FROM {$wpdb->posts} WHERE post_type = 'wpsc-product' AND post_parent = 0" );
596
- $progress = new WPSC_Update_Progress( $total );
597
-
598
- while ( true ) {
599
- // get the posts
600
- // I use a direct SQL query here because the get_posts function sometimes does not function for a reason that is not clear.
601
- $posts = $wpdb->get_results( $wpdb->prepare( $sql, $offset, $limit ) );
602
- $i = $offset;
603
- if ( empty( $posts ) )
604
- break;
605
-
606
- foreach((array)$posts as $post) {
607
- if ( ! $child_products = get_transient( 'wpsc_update_current_child_products' ) )
608
- $child_products = array();
609
-
610
- $wpsc_update->check_timeout();
611
- $base_product_terms = array();
612
- //create a post template
613
- $child_product_template = array(
614
- 'post_author' => $user_ID,
615
- 'post_content' => $post->post_content,
616
- 'post_excerpt' => $post->post_excerpt,
617
- 'post_title' => $post->post_title,
618
- 'post_status' => 'inherit',
619
- 'post_type' => "wpsc-product",
620
- 'post_name' => $post->post_title,
621
- 'post_parent' => $post->ID
622
- );
623
-
624
- // select the original product ID
625
- $original_id = get_post_meta($post->ID, '_wpsc_original_id', true);
626
- $parent_stock = get_post_meta($post->ID, '_wpsc_stock', true);
627
-
628
- // select the variation set associations
629
- $variation_set_associations = $wpdb->get_col("SELECT `variation_id` FROM ".WPSC_TABLE_VARIATION_ASSOC." WHERE `associated_id` = '{$original_id}'");
630
- // select the variation associations if the count of variation sets is greater than zero
631
- if(($original_id > 0) && (count($variation_set_associations) > 0)) {
632
- $variation_associations = $wpdb->get_col("SELECT `value_id` FROM ".WPSC_TABLE_VARIATION_VALUES_ASSOC." WHERE `product_id` = '{$original_id}' AND `variation_id` IN(".implode(", ", $variation_set_associations).") AND `visible` IN ('1')");
633
- } else {
634
- // otherwise, we have no active variations, skip to the next product
635
- $i++;
636
- $progress->update( $i );
637
- set_transient( 'wpsc_update_variation_comb_offset', $i, 604800 );
638
- continue;
639
- }
640
-
641
- $variation_set_id_sql = "SELECT meta_value FROM " . WPSC_TABLE_META . " WHERE object_type='wpsc_variation_set' AND object_id IN (" . implode( ',', $variation_set_associations ) . ") AND meta_key = 'variation_set_id'";
642
-
643
- $variation_set_terms = $wpdb->get_col( $variation_set_id_sql );
644
-
645
- $variation_associations_sql = "SELECT meta_value FROM " . WPSC_TABLE_META . " WHERE object_type='wpsc_variation' AND object_id IN (" . implode( ',', $variation_associations ) . ") AND meta_key = 'variation_id'";
646
-
647
- $variation_associations_terms = $wpdb->get_col( $variation_associations_sql );
648
-
649
- $base_product_terms = array_merge( $base_product_terms, $variation_set_terms, $variation_associations_terms );
650
-
651
- // Now that we have the term IDs, we need to retrieve the slugs, as wp_set_object_terms will not use IDs in the way we want
652
- // If we pass IDs into wp_set_object_terms, it creates terms using the ID as the name.
653
- $parent_product_terms = get_terms('wpsc-variation', array(
654
- 'hide_empty' => 0,
655
- 'include' => implode(",", $base_product_terms),
656
- 'orderby' => 'parent'
657
- ));
658
- $base_product_term_slugs = array();
659
- foreach($parent_product_terms as $parent_product_term) {
660
- $base_product_term_slugs[] = $parent_product_term->slug;
661
-
662
- }
663
-
664
- wp_set_object_terms($post->ID, $base_product_term_slugs, 'wpsc-variation');
665
-
666
- // select all variation "products"
667
- $variation_items = $wpdb->get_results("SELECT * FROM ".WPSC_TABLE_VARIATION_PROPERTIES." WHERE `product_id` = '{$original_id}'");
668
-
669
- foreach((array)$variation_items as $variation_item) {
670
- $wpsc_update->check_timeout();
671
- // initialize the requisite arrays to empty
672
- $variation_ids = array();
673
- $term_data = array(
674
- 'ids' => array(),
675
- 'slugs' => array(),
676
- 'names' => array(),
677
- );
678
- // make a temporary copy of the product teplate
679
- $product_values = $child_product_template;
680
-
681
- // select all values this "product" is associated with, then loop through them, getting the term id of the variation using the value ID
682
- $variation_associations_combinations = $wpdb->get_results("SELECT * FROM ".WPSC_TABLE_VARIATION_COMBINATIONS." WHERE `priceandstock_id` = '{$variation_item->id}'");
683
- foreach((array)$variation_associations_combinations as $association) {
684
- $variation_id = (int)wpsc_get_meta($association->value_id, 'variation_id', 'wpsc_variation');
685
- // discard any values that are null, as they break the selecting of the terms
686
- if($variation_id > 0 && in_array($association->value_id, $variation_associations) ) {
687
- $variation_ids[] = $variation_id;
688
- }
689
- }
690
-
691
- // if we have more than zero remaining terms, get the term data, then loop through it to convert it to a more useful set of arrays.
692
- if(count($variation_ids) > 0 && ( count($variation_set_associations) == count($variation_ids) ) ) {
693
- $combination_terms = get_terms('wpsc-variation', array(
694
- 'hide_empty' => 0,
695
- 'include' => implode(",", $variation_ids),
696
- ));
697
-
698
- foreach($combination_terms as $term) {
699
- $term_data['ids'][] = $term->term_id;
700
- $term_data['slugs'][] = $term->slug;
701
- $term_data['names'][] = $term->name;
702
- }
703
-
704
- $product_values['post_title'] .= " (".implode(", ", $term_data['names']).")";
705
- $product_values['post_name'] = sanitize_title($product_values['post_title']);
706
-
707
- $selected_post = get_posts(array(
708
- 'name' => $product_values['post_name'],
709
- 'post_parent' => $post->ID,
710
- 'post_type' => "wpsc-product",
711
- 'post_status' => 'all',
712
- 'suppress_filters' => true
713
- ));
714
-
715
- $selected_post = array_shift($selected_post);
716
- $key = md5( $post->ID . ':' . count( $term_data['ids'] ) . ':' . implode(',', $term_data['ids'] ) );
717
- $child_product_id = false;
718
-
719
- if ( ! empty( $child_products[$key] ) )
720
- $child_product_id = $child_products[$key];
721
-
722
- $post_data = array();
723
- $post_data['_wpsc_price'] = (float)$variation_item->price;
724
- $post_data['_wpsc_stock'] = (float)$variation_item->stock;
725
- if( !is_numeric( $parent_stock ) )
726
- $post_data['_wpsc_stock'] = false;
727
-
728
- $post_data['_wpsc_original_variation_id'] = (float)$variation_item->id;
729
-
730
- // Product Weight
731
- $post_data['_wpsc_product_metadata']['weight'] = wpsc_convert_weight($variation_item->weight, $variation_item->weight_unit, "pound", true);
732
- $post_data['_wpsc_product_metadata']['display_weight_as'] = $variation_item->weight_unit;
733
- $post_data['_wpsc_product_metadata']['weight_unit'] = $variation_item->weight_unit;
734
-
735
- // Parts of the code (eg wpsc_product_variation_price_from() make the assumption that these meta keys exist
736
- $post_data['_wpsc_special_price'] = 0;
737
- $post_data['_wpsc_sku'] = '';
738
-
739
- $already_exists = true;
740
-
741
- if ( ! empty( $selected_post ) && $selected_post->ID != $child_product_id ) {
742
- $child_product_id = $selected_post->ID;
743
- } elseif ( empty( $child_product_id ) ) {
744
- $child_product_id = wp_insert_post( $product_values );
745
- $already_exists = false;
746
- }
747
-
748
- if($child_product_id > 0) {
749
-
750
- foreach($post_data as $meta_key => $meta_value) {
751
- // prefix all meta keys with _wpsc_
752
- update_post_meta($child_product_id, $meta_key, $meta_value);
753
- }
754
-
755
-
756
- wp_set_object_terms($child_product_id, $term_data['slugs'], 'wpsc-variation');
757
- if ( ! $already_exists ) {
758
- $child_products[$key] = $child_product_id;
759
- set_transient( 'wpsc_update_current_child_products', $child_products, 604800 );
760
- }
761
- }
762
-
763
- unset($term_data);
764
- }
765
-
766
- }
767
- $i++;
768
- $progress->update( $i );
769
- set_transient( 'wpsc_update_variation_comb_offset', $i, 604800 );
770
- delete_transient( 'wpsc_update_current_child_products' );
771
- }
772
-
773
- $offset += $limit;
774
-
775
- }
776
- delete_option("wpsc-variation_children");
777
- _get_term_hierarchy('wpsc-variation');
778
- delete_option("wpsc_product_category_children");
779
- _get_term_hierarchy('wpsc_product_category');
780
- }
781
-
782
- function wpsc_update_files() {
783
- global $wpdb, $user_ID;
784
- $product_files = $wpdb->get_results("SELECT * FROM ".WPSC_TABLE_PRODUCT_FILES."");
785
- $wpsc_update = WPSC_Update::get_instance();
786
-
787
- foreach($product_files as $product_file) {
788
- $wpsc_update->check_timeout();
789
- $variation_post_ids = array();
790
- if(!empty($product_file->product_id)){
791
- $product_post_id = (int)$wpdb->get_var($wpdb->prepare( "SELECT `post_id` FROM `{$wpdb->postmeta}` WHERE meta_key = %s AND `meta_value` = %d LIMIT 1", '_wpsc_original_id', $product_file->product_id ));
792
- }else{
793
- $product_post_id = (int)$wpdb->get_var("SELECT `id` FROM ".WPSC_TABLE_PRODUCT_LIST." WHERE file=".$product_file->id);
794
- $product_post_id = (int)$wpdb->get_var($wpdb->prepare( "SELECT `post_id` FROM `{$wpdb->postmeta}` WHERE meta_key = %s AND `meta_value` = %d LIMIT 1", '_wpsc_original_id', $product_post_id ));
795
- }
796
- $variation_items = $wpdb->get_col("SELECT `id` FROM ".WPSC_TABLE_VARIATION_PROPERTIES." WHERE `file` = '{$product_file->id}'");
797
-
798
- if(count($variation_items) > 0) {
799
- $variation_post_ids = $wpdb->get_col("SELECT `post_id` FROM `{$wpdb->postmeta}` WHERE meta_key = '_wpsc_original_variation_id' AND `meta_value` IN(".implode(", ", $variation_items).")");
800
- }
801
-
802
- $attachment_template = array(
803
- 'post_mime_type' => $product_file->mimetype,
804
- 'post_title' => $product_file->filename,
805
- 'post_name' => $product_file->idhash,
806
- 'post_content' => '',
807
- 'post_parent' => $product_post_id,
808
- 'post_type' => "wpsc-product-file",
809
- 'post_status' => 'inherit'
810
- );
811
-
812
- $file_id = wpsc_get_meta($product_file->id, '_new_file_id', 'wpsc_files');
813
-
814
- if($file_id == null && count($variation_post_ids) == 0) {
815
- $file_data = $attachment_template;
816
- $file_data['post_parent'] = $product_post_id;
817
- $new_file_id = wp_insert_post($file_data);
818
- wpsc_update_meta($product_file->id, '_new_file_id', $new_file_id, 'wpsc_files');
819
- }
820
- if(count($variation_post_ids) > 0) {
821
- foreach($variation_post_ids as $variation_post_id) {
822
- $old_file_id = get_product_meta($variation_post_id, 'old_file_id', true);
823
- if($old_file_id == null) {
824
- $file_data = $attachment_template;
825
- $file_data['post_parent'] = $variation_post_id;
826
- $new_file_id = wp_insert_post($file_data);
827
- update_product_meta($variation_post_id, 'old_file_id', $product_file->id, 'wpsc_files');
828
- }
829
- }
830
- }
831
-
832
- if(!empty($product_file->preview)){
833
- $preview_template = array(
834
- 'post_mime_type' => $product_file->preview_mimetype,
835
- 'post_title' => $product_file->preview,
836
- 'post_name' => $product_file->filename,
837
- 'post_content' => '',
838
- 'post_parent' => $new_file_id,
839
- 'post_type' => "wpsc-product-preview",
840
- 'post_status' => 'inherit'
841
- );
842
- wp_insert_post($preview_template);
843
-
844
-
845
- }
846
- }
847
-
848
- $download_ids = $wpdb->get_col("SELECT `id` FROM ".WPSC_TABLE_DOWNLOAD_STATUS."");
849
- foreach($download_ids as $download_id) {
850
- if(wpsc_get_meta($download_id, '_is_legacy', 'wpsc_downloads') !== 'false') {
851
- wpsc_update_meta($download_id, '_is_legacy', 'true', 'wpsc_downloads');
852
- }
853
- }
854
- }
855
-
856
- function wpsc_update_database() {
857
- global $wpdb;
858
-
859
- $result = $wpdb->get_results("SHOW COLUMNS FROM ". WPSC_TABLE_PURCHASE_LOGS."", ARRAY_A);
860
- if (!$result) {
861
- echo 'Could not run query: ' . $wpdb->last_error;
862
- exit;
863
- }
864
- foreach($result as $row_key=>$value) {
865
- $has_taxes = ($value["Field"] == "wpec_taxes_total" || $value["Field"] == "wpec_taxes_rate") ? true: false;
866
- }
867
- if (!$has_taxes) {
868
- $add_fields = $wpdb->query( "ALTER TABLE ".WPSC_TABLE_PURCHASE_LOGS." ADD wpec_taxes_total decimal(11,2)" );
869
- $add_fields = $wpdb->query( "ALTER TABLE ".WPSC_TABLE_PURCHASE_LOGS." ADD wpec_taxes_rate decimal(11,2)" );
870
- }
871
- }
872
- /*
873
- * The Old Get Product Meta for 3.7 Tables used in converting Products to Posts
874
- */
875
-
876
- function old_get_product_meta($product_id, $key, $single = false) {
877
- global $wpdb, $post_meta_cache, $blog_id;
878
- $product_id = (int)$product_id;
879
- $meta_values = false;
880
- if($product_id > 0) {
881
- $meta_id = $wpdb->get_var( $wpdb->prepare( "SELECT `id` FROM `".WPSC_TABLE_PRODUCTMETA."` WHERE `meta_key` IN(%s) AND `product_id` = %d LIMIT 1", $key, $product_id ) );
882
- //exit($meta_id);
883
- if(is_numeric($meta_id) && ($meta_id > 0)) {
884
- if($single != false) {
885
- $meta_values = maybe_unserialize($wpdb->get_var("SELECT `meta_value` FROM `".WPSC_TABLE_PRODUCTMETA."` WHERE `meta_key` IN('$key') AND `product_id` = '$product_id' LIMIT 1"));
886
- } else {
887
- $meta_values = $wpdb->get_col( $wpdb->prepare( "SELECT `meta_value` FROM `".WPSC_TABLE_PRODUCTMETA."` WHERE `meta_key` IN(%s) AND `product_id` = %d", $key, $product_id ) );
888
- $meta_values = array_map('maybe_unserialize', $meta_values);
889
- }
890
- }
891
- }
892
- if (is_array($meta_values) && (count($meta_values) == 1)) {
893
- return array_pop($meta_values);
894
- } else {
895
- return $meta_values;
896
- }
897
- }
898
- ?>
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
trunk/wpsc-admin/includes/walker-variation-checklist.php DELETED
@@ -1,57 +0,0 @@
1
- <?php
2
- /**
3
- * Walker Variation Checklist
4
- * Outputs checkboxes for variation sets
5
- */
6
- class WPSC_Walker_Variation_Checklist extends Walker_Category_Checklist {
7
- private $highlighted = array();
8
-
9
- public function __construct( $highlighted = array() ) {
10
- $this->highlighted = $highlighted;
11
- }
12
-
13
- public function start_el( &$output, $category, $depth = 0, $args = array(), $current_object_id = 0 ) {
14
- extract( $args );
15
-
16
- if ( empty( $taxonomy ) ) {
17
- $taxonomy = 'category';
18
- }
19
-
20
- if ( empty( $selected_cats ) ) {
21
- $selected_cats = array();
22
- }
23
-
24
- $checked = in_array( $category->term_id, $selected_cats );
25
- $input_class = ( $depth === 0 ) ? ' class="variation-set"' : '';
26
- $li_classes = array( 'wpsc-variation-checklist-item' );
27
-
28
- if ( $depth === 0 && wpsc_is_doing_ajax( 'add_variation_set' ) ) {
29
- $li_classes[] = 'ajax';
30
- $li_classes[] = 'expanded';
31
- } elseif ( in_array( $category->term_id, $this->highlighted ) ) {
32
- $li_classes[] = 'ajax';
33
- }
34
-
35
- ob_start();
36
- ?>
37
- <li id="<?php echo esc_attr( $taxonomy ); ?>-<?php echo $category->term_id; ?>" class="<?php echo implode( ' ', $li_classes ); ?>">
38
- <?php if ( $depth == 0 ): ?>
39
- <a href="#" class="expand"><?php echo esc_html_x( 'Expand', 'product variation set', 'wp-e-commerce' ); ?></a>
40
- <?php endif ?>
41
-
42
- <label class="selectit">
43
- <input
44
- <?php echo $input_class; ?>
45
- type="checkbox" value="1"
46
- <?php if ( $depth !== 0 ): ?>
47
- name="edit_var_val[<?php echo $category->parent; ?>][<?php echo $category->term_id ?>]"
48
- <?php endif ?>
49
- id="in-<?php echo esc_attr( $taxonomy ) . '-' . $category->term_id; ?>"
50
- <?php checked( $checked, true ); disabled( empty( $args['disabled'] ), false ); ?>
51
- />
52
- <?php echo esc_html( apply_filters( 'wpsc_variation_name', $category->name, $category ) ); ?>
53
- </label>
54
- <?php
55
- $output .= ob_get_clean();
56
- }
57
- }
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
trunk/wpsc-admin/init.php DELETED
@@ -1,894 +0,0 @@
1
- <?php
2
- function wpsc_ajax_sales_quarterly() {
3
-
4
- if ( ! wpsc_is_store_admin() ) {
5
- return;
6
- }
7
-
8
- $lastdate = sanitize_text_field( $_POST['add_start'] );
9
- $date = preg_split( '/-/', $lastdate );
10
- if ( !isset( $date[0] ) )
11
- $date[0] = 0;
12
- if ( !isset( $date[1] ) )
13
- $date[1] = 0;
14
- if ( !isset( $date[2] ) )
15
- $date[2] = 0;
16
- $lastquart = mktime( 0, 0, 0, $date[1], $date[2], $date[0] );
17
- if ( $lastquart != get_option( 'wpsc_last_quarter' ) ) {
18
- update_option( 'wpsc_last_date', $lastdate );
19
- update_option( 'wpsc_fourth_quart', $lastquart );
20
- $thirdquart = mktime( 0, 0, 0, $date[1] - 3, $date[2], $date[0] );
21
- update_option( 'wpsc_third_quart', $thirdquart );
22
- $secondquart = mktime( 0, 0, 0, $date[1] - 6, $date[2], $date[0] );
23
- update_option( 'wpsc_second_quart', $secondquart );
24
- $firstquart = mktime( 0, 0, 0, $date[1] - 9, $date[2], $date[0] );
25
- update_option( 'wpsc_first_quart', $firstquart );
26
- $finalquart = mktime( 0, 0, 0, $date[1], $date[2], $date[0] - 1 );
27
- update_option( 'wpsc_final_quart', $finalquart );
28
- }
29
- }
30
-
31
- if ( isset( $_REQUEST['wpsc_admin_action'] ) && ($_REQUEST['wpsc_admin_action'] == 'wpsc_quarterly') )
32
- add_action( 'admin_init', 'wpsc_ajax_sales_quarterly' );
33
-
34
- function wpsc_delete_file() {
35
- $product_id = absint( $_REQUEST['product_id'] );
36
- $file_name = basename( $_REQUEST['file_name'] );
37
- check_admin_referer( 'delete_file_' . $file_name );
38
-
39
- _wpsc_delete_file( $product_id, $file_name );
40
-
41
- $sendback = wp_get_referer();
42
- wp_redirect( $sendback );
43
- exit;
44
- }
45
-
46
-
47
- if ( isset( $_REQUEST['wpsc_admin_action'] ) && ($_REQUEST['wpsc_admin_action'] == 'delete_file') )
48
- add_action( 'admin_init', 'wpsc_delete_file' );
49
-
50
- /**
51
- * Function and action for publishing or unpublishing single products
52
- */
53
- function wpsc_ajax_toggle_published() {
54
- $product_id = absint( $_GET['product'] );
55
- check_admin_referer( 'toggle_publish_' . $product_id );
56
-
57
- $status = (wpsc_toggle_publish_status( $product_id )) ? ('true') : ('false');
58
- $sendback = add_query_arg( 'flipped', "1", wp_get_referer() );
59
- wp_redirect( esc_url_raw( $sendback ) );
60
- exit();
61
- }
62
-
63
- if ( isset( $_REQUEST['wpsc_admin_action'] ) && ($_REQUEST['wpsc_admin_action'] == 'toggle_publish') )
64
- add_action( 'admin_init', 'wpsc_ajax_toggle_published' );
65
-
66
- /**
67
- * Function and action for duplicating products,
68
- * Refactored for 3.8
69
- * Purposely not duplicating stick post status (logically, products are most often duplicated because they share many attributes, where products are generally 'featured' uniquely.)
70
- */
71
- function wpsc_duplicate_product() {
72
-
73
- if ( ! wpsc_is_store_admin() ) {
74
- return;
75
- }
76
-
77
- // Get the original post
78
- $id = absint( $_GET['product'] );
79
- $post = get_post( $id );
80
-
81
- // Copy the post and insert it
82
- if ( isset( $post ) && $post != null ) {
83
-
84
- $duplicate = new WPSC_Duplicate_Product( $post->ID );
85
- $new_id = $duplicate->duplicate_product_process();
86
-
87
- $duplicated = true;
88
- $sendback = wp_get_referer();
89
- $sendback = add_query_arg( 'duplicated', (int) $duplicated, $sendback );
90
-
91
- wp_redirect( esc_url_raw( $sendback ) );
92
- exit();
93
- } else {
94
- wp_die( __( 'Sorry, for some reason, we couldn\'t duplicate this product because it could not be found in the database, check there for this ID: ', 'wp-e-commerce' ) . $id );
95
- }
96
- }
97
-
98
- if ( isset( $_GET['wpsc_admin_action'] ) && ( $_GET['wpsc_admin_action'] == 'duplicate_product' ) )
99
- add_action( 'admin_init', 'wpsc_duplicate_product' );
100
-
101
- function wpsc_purchase_log_csv() {
102
- if ( 'key' == $_REQUEST['rss_key'] && wpsc_is_store_admin() ) {
103
- _wpsc_download_purchase_log_csv( $_REQUEST );
104
- }
105
- }
106
-
107
- function _wpsc_download_purchase_log_csv( $args = array() ) {
108
- global $wpdb, $wpsc_gateways;
109
- get_currentuserinfo();
110
- $count = 0;
111
-
112
- if ( isset( $args['start_timestamp'] ) && isset( $args['end_timestamp'] ) ) {
113
- $start_timestamp = $args['start_timestamp'];
114
- $end_timestamp = $args['end_timestamp'];
115
- $start_end_sql = "SELECT * FROM `" . WPSC_TABLE_PURCHASE_LOGS . "` WHERE `date` BETWEEN '%d' AND '%d' ORDER BY `date` DESC";
116
- $start_end_sql = apply_filters( 'wpsc_purchase_log_start_end_csv', $start_end_sql );
117
- $data = $wpdb->get_results( $wpdb->prepare( $start_end_sql, $start_timestamp, $end_timestamp ), ARRAY_A );
118
- /* translators: %1$s is "start" date, %2$s is "to" date */
119
- $csv_name = _x( 'Purchase Log %1$s to %2$s.csv', 'exported purchase log csv file name', 'wp-e-commerce' );
120
- $csv_name = sprintf( $csv_name, date( "M-d-Y", $start_timestamp ), date( "M-d-Y", $end_timestamp ) );
121
- } elseif ( isset( $args['m'] ) ) {
122
- $year = (int) substr( $args['m'], 0, 4);
123
- $month = (int) substr( $args['m'], -2 );
124
- $month_year_sql = "
125
- SELECT *
126
- FROM " . WPSC_TABLE_PURCHASE_LOGS . "
127
- WHERE YEAR(FROM_UNIXTIME(date)) = %d AND MONTH(FROM_UNIXTIME(date)) = %d
128
- ORDER BY `id` DESC
129
- ";
130
- $month_year_sql = apply_filters( 'wpsc_purchase_log_month_year_csv', $month_year_sql );
131
- $data = $wpdb->get_results( $wpdb->prepare( $month_year_sql, $year, $month ), ARRAY_A );
132
- /* translators: %1$s is month, %2$s is year */
133
- $csv_name = _x( 'Purchase Log %1$s/%2$s.csv', 'exported purchase log csv file name', 'wp-e-commerce' );
134
- $csv_name = sprintf( $csv_name, $month, $year );
135
- } else {
136
- $sql = apply_filters( 'wpsc_purchase_log_month_year_csv', "SELECT * FROM " . WPSC_TABLE_PURCHASE_LOGS . " ORDER BY `id` DESC" );
137
- $data = $wpdb->get_results( $sql, ARRAY_A );
138
- $csv_name = _x( "All Purchase Logs.csv", 'exported purchase log csv file name', 'wp-e-commerce' );
139
- }
140
-
141
- $form_sql = "SELECT * FROM `" . WPSC_TABLE_CHECKOUT_FORMS . "` WHERE `active` = '1' AND `type` != 'heading' ORDER BY `checkout_order` DESC;";
142
- $form_data = $wpdb->get_results( $form_sql, ARRAY_A );
143
-
144
- $headers_array = array(
145
- _x( 'Purchase ID' , 'purchase log csv headers', 'wp-e-commerce' ),
146
- _x( 'Purchase Total', 'purchase log csv headers', 'wp-e-commerce' ),
147
- );
148
- $headers2_array = array(
149
- _x( 'Payment Gateway', 'purchase log csv headers', 'wp-e-commerce' ),
150
- _x( 'Payment Status' , 'purchase log csv headers', 'wp-e-commerce' ),
151
- _x( 'Purchase Date' , 'purchase log csv headers', 'wp-e-commerce' ),
152
- );
153
- $form_headers_array = array();
154
-
155
- $output = '';
156
-
157
- foreach ( (array) $form_data as $form_field ) {
158
- if ( empty ( $form_field['unique_name'] ) ) {
159
- $form_headers_array[] = $form_field['name'];
160
- } else {
161
- $prefix = false === strstr( $form_field['unique_name'], 'billing' ) ? _x( 'Shipping ', 'purchase log csv header field prefix', 'wp-e-commerce' ) : _x( 'Billing ', 'purchase log csv header field prefix', 'wp-e-commerce' );
162
- $form_headers_array[] = $prefix . $form_field['name'];
163
- }
164
- }
165
-
166
- foreach ( (array) $data as $purchase ) {
167
- $form_headers = '';
168
- $output .= "\"" . $purchase['id'] . "\","; //Purchase ID
169
- $output .= "\"" . $purchase['totalprice'] . "\","; //Purchase Total
170
- foreach ( (array) $form_data as $form_field ) {
171
- $collected_data_sql = "SELECT * FROM `" . WPSC_TABLE_SUBMITTED_FORM_DATA . "` WHERE `log_id` = '" . $purchase['id'] . "' AND `form_id` = '" . $form_field['id'] . "' LIMIT 1";
172
- $collected_data = $wpdb->get_results( $collected_data_sql, ARRAY_A );
173
- $collected_data = $collected_data[0];
174
-
175
- if ( ( 'billingstate' == $form_field['unique_name'] || 'shippingstate' == $form_field['unique_name'] ) && is_numeric( $collected_data['value'] ) )
176
- $output .= "\"" . wpsc_get_state_by_id( $collected_data['value'], 'code' ) . "\","; // get form fields
177
- else
178
- $output .= "\"" . str_replace( array( "\r", "\r\n", "\n" ), ' ', $collected_data['value'] ) . "\","; // get form fields
179
- }
180
-
181
- if ( isset( $wpsc_gateways[$purchase['gateway']] ) && isset( $wpsc_gateways[$purchase['gateway']]['display_name'] ) )
182
- $output .= "\"" . $wpsc_gateways[$purchase['gateway']]['display_name'] . "\","; //get gateway name
183
- else
184
- $output .= "\"\",";
185
-
186
-
187
- $status_name = wpsc_find_purchlog_status_name( $purchase['processed'] );
188
-
189
- $output .= "\"" . $status_name . "\","; //get purchase status
190
- $output .= "\"" . date( apply_filters( 'wpsc_purchase_log_csv_date_format', 'jS M Y' ), $purchase['date'] ) . "\","; //date
191
-
192
- $cartsql = "SELECT `prodid`, `quantity`, `name` FROM `" . WPSC_TABLE_CART_CONTENTS . "` WHERE `purchaseid`=" . $purchase['id'] . "";
193
- $cart = $wpdb->get_results( $cartsql, ARRAY_A );
194
-
195
- if ( $count < count( $cart ) )
196
- $count = count( $cart );
197
-
198
- $items = count( $cart );
199
- $i = 1;
200
-
201
- // Go through all products in cart and display quantity and sku
202
- foreach ( (array) $cart as $item ) {
203
- $skuvalue = get_product_meta( $item['prodid'], 'sku', true );
204
- if( empty( $skuvalue ) )
205
- $skuvalue = __( 'N/A', 'wp-e-commerce' );
206
- $output .= "\"" . $item['quantity'] . "\",";
207
- $output .= "\"" . str_replace( '"', '\"', $item['name'] ) . "\",";
208
-
209
- if ( $items <= 1 )
210
- $output .= "\"" . $skuvalue . "\"" ;
211
- elseif ( $items > 1 && $i != $items )
212
- $output .= "\"" . $skuvalue . "\"," ;
213
- else
214
- $output .= "\"" . $skuvalue . "\"" ;
215
-
216
- $i++;
217
- }
218
-
219
- $output .= "\n"; // terminates the row/line in the CSV file
220
- }
221
- // Get the most number of products and create a header for them
222
- $headers3 = array();
223
- for( $i = 0; $i < $count; $i++ ){
224
- $headers3[] = _x( 'Quantity', 'purchase log csv headers', 'wp-e-commerce' );
225
- $headers3[] = _x( 'Product Name', 'purchase log csv headers', 'wp-e-commerce' );
226
- $headers3[] = _x( 'SKU', 'purchase log csv headers', 'wp-e-commerce' );
227
- }
228
-
229
- $headers = '"' . implode( '","', $headers_array ) . '",';
230
- $form_headers = '"' . implode( '","', $form_headers_array ) . '",';
231
- $headers2 = '"' . implode( '","', $headers2_array ) . '",';
232
- $headers3 = '"' . implode( '","', $headers3 ) . '"';
233
-
234
- $headers = apply_filters( 'wpsc_purchase_log_csv_headers', $headers . $form_headers . $headers2 . $headers3, $data, $form_data );
235
- $output = apply_filters( 'wpsc_purchase_log_csv_output' , $output, $data, $form_data );
236
-
237
- /**
238
- * Fires when the WPSC purchase log is exported as a CSV
239
- */
240
- do_action( 'wpsc_purchase_log_csv' );
241
-
242
- header( 'Content-Type: text/csv' );
243
- header( 'Content-Disposition: inline; filename="' . $csv_name . '"' );
244
- echo $headers . "\n". $output;
245
- exit;
246
- }
247
-
248
- if ( isset( $_REQUEST['wpsc_admin_action'] ) && ($_REQUEST['wpsc_admin_action'] == 'wpsc_downloadcsv') ) {
249
- add_action( 'admin_init', 'wpsc_purchase_log_csv' );
250
- }
251
-
252
- if ( isset( $_GET['purchase_log_csv'] ) && ( 'true' == $_GET['purchase_log_csv'] ) )
253
- add_action( 'admin_init', 'wpsc_purchase_log_csv' );
254
-
255
- function wpsc_admin_sale_rss() {
256
-
257
- if ( ! wpsc_is_store_admin() ) {
258
- return;
259
- }
260
-
261
- global $wpdb;
262
- if ( ($_GET['rss'] == "true") && ($_GET['rss_key'] == 'key') && ($_GET['action'] == "purchase_log") ) {
263
- $sql = "SELECT * FROM `" . WPSC_TABLE_PURCHASE_LOGS . "` WHERE `date`!='' ORDER BY `date` DESC";
264
- $purchase_log = $wpdb->get_results( $sql, ARRAY_A );
265
- header( "Content-Type: application/xml; charset=UTF-8" );
266
- header( 'Content-Disposition: inline; filename="WP_E-Commerce_Purchase_Log.rss"' );
267
- $output = '';
268
- $output .= "<?xml version='1.0'?>\n\r";
269
- $output .= "<rss version='2.0'>\n\r";
270
- $output .= " <channel>\n\r";
271
- $output .= " <title>" . _x( 'WP eCommerce Product Log', 'admin rss product feed', 'wp-e-commerce' ) . "</title>\n\r";
272
- $output .= " <link>" . admin_url( 'admin.php?page=' . WPSC_DIR_NAME . '/display-log.php' ) . "</link>\n\r";
273
- $output .= " <description>" . _x( 'This is the WP eCommerce Product Log RSS feed', 'admin rss product feed', 'wp-e-commerce' ) . "</description>\n\r";
274
- $output .= " <generator>" . _x( 'WP eCommerce Plugin', 'admin rss product feed', 'wp-e-commerce' ) . "</generator>\n\r";
275
-
276
- foreach ( (array)$purchase_log as $purchase ) {
277
- $purchase_link = admin_url( 'admin.php?page=' . WPSC_DIR_NAME . '/display-log.php' ) . "&amp;purchaseid=" . $purchase['id'];
278
- $purchase_title = _x( 'Purchase # %d', 'admin rss product feed', 'wp-e-commerce' );
279
- $purchase_title = sprintf( $purchase_title, $purchase['id'] );
280
- $output .= " <item>\n\r";
281
- $output .= " <title>{$purchase_title}</title>\n\r";
282
- $output .= " <link>$purchase_link</link>\n\r";
283
- $output .= " <description>" . _x( 'This is an entry in the purchase log', 'admin rss product feed', 'wp-e-commerce' ) . ".</description>\n\r";
284
- $output .= " <pubDate>" . date( "r", $purchase['date'] ) . "</pubDate>\n\r";
285
- $output .= " <guid>$purchase_link</guid>\n\r";
286
- $output .= " </item>\n\r";
287
- }
288
- $output .= " </channel>\n\r";
289
- $output .= "</rss>";
290
- echo $output;
291
- exit();
292
- }
293
- }
294
-
295
- if ( isset( $_GET['action'] ) && ( 'purchase_log' == $_GET['action'] ) ) {
296
- add_action( 'admin_init', 'wpsc_admin_sale_rss' );
297
- }
298
-
299
- /**
300
- * Do Purchase Log Actions
301
- *
302
- * All purchase log actions are capability and nonce checked before calling
303
- * the relevent 'wpsc_purchase_log_action-{wpsc_purchase_log_action}' hook.
304
- *
305
- * @since 3.9.0
306
- */
307
- function wpsc_do_purchase_log_actions() {
308
-
309
- if ( ! wpsc_is_store_admin() ) {
310
- return;
311
- }
312
-
313
- if ( isset( $_GET['wpsc_purchase_log_action'] ) && isset( $_GET['id'] ) && isset( $_GET['_wpnonce'] ) ) {
314
- $wpsc_purchase_log_action = sanitize_key( $_GET['wpsc_purchase_log_action'] );
315
-
316
- if ( wp_verify_nonce( $_GET['_wpnonce'], 'wpsc_purchase_log_action_' . $wpsc_purchase_log_action ) ) {
317
-
318
- do_action( 'wpsc_purchase_log_action-' . $wpsc_purchase_log_action, absint( $_GET['id'] ) );
319
-
320
- }
321
- }
322
-
323
- }
324
- add_action( 'admin_init', 'wpsc_do_purchase_log_actions' );
325
-
326
- /**
327
- * Handle clear downloads lock purchase log action
328
- *
329
- * The 'wpsc_purchase_log_action-downloads_lock' action hook which calls this function is nonce and capability checked
330
- * in wpsc_do_purchase_log_actions() before triggering do_action( 'wpsc_purchase_log_action-downloads_lock' ).
331
- *
332
- * @since 3.9.0
333
- *
334
- * @param int $log_id Purchase log ID.
335
- */
336
- function wpsc_purchase_log_action_downloads_lock( $log_id ) {
337
-
338
- wpsc_purchlog_clear_download_items( $log_id );
339
-
340
- // Redirect back to purchase logs list
341
- $sendback = wp_get_referer();
342
- $sendback = esc_url_raw( add_query_arg( 'cleared', 1, $sendback ) );
343
- wp_redirect( $sendback );
344
- exit();
345
-
346
- }
347
- add_action( 'wpsc_purchase_log_action-downloads_lock', 'wpsc_purchase_log_action_downloads_lock' );
348
-
349
- /**
350
- * Handle delete purchase log action
351
- *
352
- * The 'wpsc_purchase_log_action-delete' action hook which calls this function is nonce and capability checked
353
- * in wpsc_do_purchase_log_actions() before triggering do_action( 'wpsc_purchase_log_action-delete' ).
354
- *
355
- * @since 3.9.0
356
- *
357
- * @param int $log_id Purchase log ID.
358
- */
359
- function wpsc_purchase_log_action_delete( $log_id ) {
360
-
361
- $log = wpsc_get_order( $log_id );
362
- $deleted = $log->delete();
363
-
364
- // Redirect back to purchase logs list
365
- $sendback = wp_get_referer();
366
- $sendback = remove_query_arg( array( 'c', 'id' ), $sendback );
367
- $sendback = esc_url_raw( add_query_arg( 'deleted', absint( $deleted ), $sendback ) );
368
- wp_redirect( $sendback );
369
- exit();
370
-
371
- }
372
- add_action( 'wpsc_purchase_log_action-delete', 'wpsc_purchase_log_action_delete' );
373
-
374
- /**
375
- * Handle email receipt purchase log action
376
- *
377
- * The 'wpsc_purchase_log_action-email_receipt' action hook which calls this function is nonce and capability checked
378
- * in wpsc_do_purchase_log_actions() before triggering do_action( 'wpsc_purchase_log_action-email_receipt' ).
379
- *
380
- * @since 3.9.0
381
- *
382
- * @param int $log_id Purchase log ID.
383
- */
384
- function wpsc_purchase_log_action_email_receipt( $log_id ) {
385
-
386
- $sent = wpsc_purchlog_resend_email( $log_id );
387
-
388
- // Redirect back to purchase logs list
389
- $sendback = wp_get_referer();
390
- $sendback = esc_url_raw( add_query_arg( 'sent', absint( $sent ), $sendback ) );
391
- wp_redirect( $sendback );
392
- exit();
393
-
394
- }
395
- add_action( 'wpsc_purchase_log_action-email_receipt', 'wpsc_purchase_log_action_email_receipt' );
396
-
397
- /**
398
- * Resend Purchase Log Email
399
- *
400
- * @param int|string $log_id Required. Purchase log ID (empty string is deprecated).
401
- * @return boolean Sent successfully.
402
- */
403
- function wpsc_purchlog_resend_email( $log_id = '' ) {
404
-
405
- if ( ! wpsc_is_store_admin() ) {
406
- return;
407
- }
408
-
409
- global $wpdb;
410
-
411
- // Deprecate empty purchase log ID parameter.
412
- if ( $log_id == '' ) {
413
- _wpsc_doing_it_wrong( 'wpsc_purchlog_resend_email', __( '$log_id parameter requires a numeric purchase log ID.', 'wp-e-commerce' ), '3.9.0' );
414
-
415
- // Support redirect for legacy purposes for the moment
416
- $sendback = esc_url_raw( add_query_arg( 'sent', 0, wp_get_referer() ) );
417
- wp_redirect( $sendback );
418
- exit();
419
-
420
- }
421
-
422
- $log_id = absint( $log_id );
423
-
424
- if ( $log_id > 0 ) {
425
-
426
- $wpec_taxes_controller = new wpec_taxes_controller();
427
-
428
- if ( is_numeric( $log_id ) ) {
429
- $purchase_log = wpsc_get_order( $log_id );
430
- return wpsc_send_customer_email( $purchase_log );
431
- }
432
- }
433
-
434
- return false;
435
- }
436
-
437
- // Deprecate resending purchase log email receipt via URL query
438
- if ( isset( $_REQUEST['email_buyer_id'] ) && is_numeric( $_REQUEST['email_buyer_id'] ) ) {
439
- _wpsc_doing_it_wrong( 'wpsc_purchlog_resend_email', __( 'Do not trigger resend purchase log email action via email_buyer_id URL query. Instead use the Purchase Log Action Links API.', 'wp-e-commerce' ), '3.9.0' );
440
- }
441
-
442
- /**
443
- * Clear Purchase Log Download Locks
444
- *
445
- * @param string $log_id Required. Purchase log ID (empty string is deprecated).
446
- * @return boolean
447
- */
448
- function wpsc_purchlog_clear_download_items( $log_id = '' ) {
449
-
450
- if ( ! wpsc_is_store_admin() ) {
451
- return;
452
- }
453
-
454
- global $wpdb;
455
-
456
- // Deprecate empty purchase log ID parameter.
457
- if ( $log_id == '' ) {
458
- _wpsc_doing_it_wrong( 'wpsc_purchlog_clear_download_items', __( '$log_id parameter requires a numeric purchase log ID.', 'wp-e-commerce' ), '3.9.0' );
459
- return false;
460
- }
461
-
462
- $log_id = absint( $log_id );
463
-
464
- if ( $log_id > 0 ) {
465
-
466
- $downloadable_items = (array) $wpdb->get_results( $wpdb->prepare( "SELECT * FROM `" . WPSC_TABLE_DOWNLOAD_STATUS . "` WHERE `purchid` = %d", $log_id ), ARRAY_A );
467
-
468
- $wpdb->update( WPSC_TABLE_DOWNLOAD_STATUS, array( 'ip_number' => '' ), array( 'purchid' => $log_id ), '%s', '%d' );
469
-
470
- $email_form_field = $wpdb->get_var( "SELECT `id` FROM `" . WPSC_TABLE_CHECKOUT_FORMS . "` WHERE `type` IN ('email') AND `active` = '1' ORDER BY `checkout_order` ASC LIMIT 1" );
471
- $email_address = $wpdb->get_var( $wpdb->prepare( "SELECT `value` FROM `" . WPSC_TABLE_SUBMITTED_FORM_DATA . "` WHERE `log_id` = %d AND `form_id` = '{$email_form_field}' LIMIT 1", $log_id ) );
472
-
473
- foreach ( $downloadable_items as $downloadable_item ) {
474
- $download_links .= add_query_arg( 'downloadid', $downloadable_item['uniqueid'], home_url() ) . "\n";
475
- }
476
-
477
- wp_mail( $email_address, __( 'The administrator has unlocked your file', 'wp-e-commerce' ), str_replace( "[download_links]", $download_links, __( 'Dear Customer, We are pleased to advise you that your order has been updated and your downloads are now active. Please download your purchase using the links provided below. [download_links] Thank you for your order.', 'wp-e-commerce' ) ), "From: " . get_option( 'return_email' ) );
478
-
479
- return true;
480
-
481
- }
482
-
483
- return false;
484
-
485
- }
486
-
487
- // Deprecate clearing purchase log download locks via URL query
488
- if ( isset( $_REQUEST['wpsc_admin_action'] ) && ($_REQUEST['wpsc_admin_action'] == 'clear_locks') ) {
489
- _wpsc_doing_it_wrong( 'wpsc_purchlog_clear_download_items', __( 'Do not trigger clear purchase log download locks action via wpsc_admin_action = clear_locks URL query. Instead use the Purchase Log Action Links API.', 'wp-e-commerce' ), '3.9.0' );
490
- }
491
-
492
- //bulk actions for purchase log
493
- function wpsc_purchlog_bulk_modify() {
494
-
495
- if ( ! wpsc_is_store_admin() ) {
496
- return;
497
- }
498
-
499
- if ( $_POST['purchlog_multiple_status_change'] != -1 ) {
500
- if ( is_numeric( $_POST['purchlog_multiple_status_change'] ) && $_POST['purchlog_multiple_status_change'] != 'delete' ) {
501
- foreach ( (array)$_POST['purchlogids'] as $purchlogid ) {
502
- wpsc_purchlog_edit_status( $purchlogid, $_POST['purchlog_multiple_status_change'] );
503
- $updated++;
504
- }
505
- } elseif ( $_POST['purchlog_multiple_status_change'] == 'delete' ) {
506
- foreach ( (array)$_POST['purchlogids'] as $purchlogid ) {
507
-
508
- $log = wpsc_get_order( $purchlogid );
509
- $deleted_log = $log->delete();
510
- if ( $deleted_log ) {
511
- $deleted++;
512
- }
513
- }
514
- }
515
- }
516
- $sendback = wp_get_referer();
517
- if ( isset( $updated ) ) {
518
- $sendback = add_query_arg( 'updated', $updated, $sendback );
519
- }
520
- if ( isset( $deleted ) ) {
521
- $sendback = add_query_arg( 'deleted', $deleted, $sendback );
522
- }
523
- if ( isset( $_POST['view_purchlogs_by'] ) ) {
524
- $sendback = add_query_arg( 'view_purchlogs_by', $_POST['view_purchlogs_by'], $sendback );
525
- }
526
- if ( isset( $_POST['view_purchlogs_by_status'] ) ) {
527
- $sendback = add_query_arg( 'view_purchlogs_by_status', $_POST['view_purchlogs_by_status'], $sendback );
528
- }
529
- wp_redirect( esc_url_raw( $sendback ) );
530
- exit();
531
- }
532
-
533
- if ( isset( $_REQUEST['wpsc_admin_action2'] ) && ($_REQUEST['wpsc_admin_action2'] == 'purchlog_bulk_modify') ) {
534
- add_action( 'admin_init', 'wpsc_purchlog_bulk_modify' );
535
- }
536
-
537
- /**
538
- * Update Purchase Log Notes
539
- *
540
- * @param int $purchlog_id Purchase log ID.
541
- * @param string $purchlog_notes Notes.
542
- *
543
- * @return mixed Result of save.
544
- */
545
- function wpsc_purchlogs_update_notes( $purchlog_id = 0, $purchlog_notes = '' ) {
546
- if ( empty( $purchlog_id ) && isset( $_POST['purchlog_id'] ) && '' == $purchlog_notes ) {
547
- $purchlog_id = absint( $_POST['purchlog_id'] );
548
-
549
- if ( isset( $_POST['purchlog_notes'] ) ) {
550
- $purchlog_notes = wp_unslash( $_POST['purchlog_notes'] );
551
- }
552
- }
553
-
554
- if ( ! $purchlog_id ) {
555
- return;
556
- }
557
-
558
- $purchase_log = $purchlog_id instanceof WPSC_Purchase_Log
559
- ? $purchlog_id
560
- : wpsc_get_order( $purchlog_id );
561
-
562
- $notes = wpsc_get_order_notes( $purchase_log );
563
- $notes->add( $purchlog_notes )->save();
564
-
565
- return $notes;
566
- }
567
-
568
- /**
569
- * Delete a purchase log
570
- *
571
- * @deprecated Use WPSC_Purchase_Log->delete() instead.
572
- *
573
- * @param int|string $purchlog_id Required. Purchase log ID (empty string is deprecated).
574
- * @return boolean Deleted successfully.
575
- */
576
- function wpsc_delete_purchlog( $purchlog_id = '' ) {
577
-
578
- global $wpdb;
579
-
580
- // Deprecate empty purchase log ID parameter.
581
- if ( $purchlog_id == '' ) {
582
- _wpsc_doing_it_wrong( 'wpsc_delete_purchlog', __( '$purchlog_id parameter requires a numeric purchase log ID.', 'wp-e-commerce' ), '3.9.0' );
583
- return false;
584
- }
585
-
586
- $log = wpsc_get_order( $purchlog_id );
587
-
588
- return $log->delete();
589
-
590
- }
591
-
592
- // Deprecate deleting purchase log via URL query
593
- if ( isset( $_REQUEST['wpsc_admin_action'] ) && ( $_REQUEST['wpsc_admin_action'] == 'delete_purchlog' ) ) {
594
- _wpsc_doing_it_wrong( 'wpsc_delete_purchlog', __( 'Do not trigger delete purchase log action via wpsc_admin_action = delete_purchlog URL query. Instead use the Purchase Log Action Links API.', 'wp-e-commerce' ), '3.9.0' );
595
- }
596
-
597
- function _wpsc_action_flush_rewrite_rules() {
598
- flush_rewrite_rules( false );
599
- }
600
-
601
- function wpsc_update_option_product_category_hierarchical_url() {
602
- _wpsc_action_flush_rewrite_rules();
603
- }
604
-
605
- add_action( 'update_option_product_category_hierarchical_url', 'wpsc_update_option_product_category_hierarchical_url' );
606
-
607
- function _wpsc_action_sanitize_option_grid_number_per_row( $value, $option ) {
608
- $value = (int) $value;
609
- if ( $value === 0 ) {
610
- add_settings_error( $option, 'invalid_grid_number_per_row', __( 'You just set the number of item per row for the grid view to 0. This means the column width will fall back to using whatever CSS you have for it. This could break your theme layout, so please make sure you have adjusted your theme\'s CSS accordingly.', 'wp-e-commerce' ) );
611
- }
612
-
613
- return $value;
614
- }
615
- add_filter( 'sanitize_option_grid_number_per_row', '_wpsc_action_sanitize_option_grid_number_per_row', 10, 2 );
616
-
617
- /**
618
- * Automatically enable "Anyone can register" if registration before checkout is required.
619
- *
620
- * @since 3.8.9
621
- * @access private
622
- * @param mixed $old_value Old value
623
- * @param mixed $new_value New value
624
- */
625
- function _wpsc_action_update_option_require_register( $old_value, $new_value ) {
626
- if ( $new_value == 1 && ! get_option( 'users_can_register' ) ) {
627
- update_option( 'users_can_register', 1 );
628
- $message = __( 'You wanted to require your customers to log in before checking out. However, the WordPress setting <a href="%s">"Anyone can register"</a> was disabled. WP eCommerce has enabled that setting for you automatically.', 'wp-e-commerce' );
629
- $message = sprintf( $message, admin_url( 'options-general.php' ) );
630
- add_settings_error( 'require_register', 'users_can_register_turned_on', $message, 'updated' );
631
- }
632
- }
633
- add_action( 'update_option_require_register', '_wpsc_action_update_option_require_register', 10, 2 );
634
-
635
- /**
636
- * Automatically turn off "require registration before checkout" if "Anyone can register" is disabled.
637
- *
638
- * @since 3.8.9
639
- * @access private
640
- * @param mixed $old_value Old value
641
- * @param mixed $new_value New value
642
- */
643
- function _wpsc_action_update_option_users_can_register( $old_value, $new_value ) {
644
- if ( ! $new_value && get_option( 'require_register' ) ) {
645
- update_option( 'require_register', 0 );
646
- $message = __( 'You just disabled the "Anyone can register" setting. As a result, the <a href="%s">"Require registration before checking out"</a> setting has been disabled.', 'wp-e-commerce' );
647
- $message = sprintf( $message, admin_url( 'options-general.php?page=wpsc-settings&tab=checkout' ) );
648
- add_settings_error( 'users_can_register', 'require_register_turned_off', $message, 'updated' );
649
- }
650
- }
651
- add_action( 'update_option_users_can_register', '_wpsc_action_update_option_users_can_register', 10, 2 );
652
-
653
- /**
654
- * wpsc_update_page_urls gets the permalinks for products pages and stores them in the options for quick reference
655
- * @public
656
- *
657
- * @since 3.6
658
- * @param $auto (Boolean) true if coming from WordPress Permalink Page, false otherwise
659
- * @return nothing
660
- */
661
- function wpsc_update_page_urls( $auto = false ) {
662
-
663
- if ( ! wpsc_is_store_admin() ) {
664
- return;
665
- }
666
-
667
- wpsc_update_permalink_slugs();
668
- wpsc_core_load_page_titles();
669
- wpsc_register_post_types();
670
-
671
- if ( ! $auto ) {
672
- $sendback = wp_get_referer();
673
- if ( isset( $updated ) )
674
- $sendback = add_query_arg( 'updated', $updated, $sendback );
675
-
676
- if ( isset( $_SESSION['wpsc_settings_curr_page'] ) )
677
- $sendback = add_query_arg( 'tab', $_SESSION['wpsc_settings_curr_page'], $sendback );
678
-
679
- wp_redirect( esc_url_raw( $sendback ) );
680
- exit();
681
- }
682
- }
683
- if ( isset( $_REQUEST['wpsc_admin_action'] ) && ($_REQUEST['wpsc_admin_action'] == 'update_page_urls') )
684
- add_action( 'admin_init', 'wpsc_update_page_urls' );
685
-
686
- //change the regions tax settings
687
- function wpsc_change_region_tax() {
688
-
689
- if ( ! wpsc_is_store_admin() ) {
690
- return;
691
- }
692
-
693
- global $wpdb;
694
- if ( is_array( $_POST['region_tax'] ) ) {
695
- foreach ( $_POST['region_tax'] as $region_id => $tax ) {
696
- if ( is_numeric( $region_id ) && is_numeric( $tax ) ) {
697
- $previous_tax = $wpdb->get_var( $wpdb->prepare( "SELECT `tax` FROM `" . WPSC_TABLE_REGION_TAX . "` WHERE `id` = %d LIMIT 1", $region_id ) );
698
- if ( $tax != $previous_tax ) {
699
- $wpdb->update(
700
- WPSC_TABLE_REGION_TAX,
701
- array(
702
- 'tax' => $tax
703
- ),
704
- array(
705
- 'id' => $region_id
706
- ),
707
- '%s',
708
- '%d'
709
- );
710
- $changes_made = true;
711
- }
712
- }
713
- }
714
- $sendback = wp_get_referer();
715
- wp_redirect( $sendback );
716
- }
717
- }
718
- if ( isset( $_REQUEST['wpsc_admin_action'] ) && ($_REQUEST['wpsc_admin_action'] == 'change_region_tax') )
719
- add_action( 'admin_init', 'wpsc_change_region_tax' );
720
-
721
- function wpsc_product_files_existing() {
722
- //List all product_files, with checkboxes
723
-
724
- if ( ! wpsc_is_store_admin() ) {
725
- return;
726
- }
727
-
728
- $product_id = absint( $_GET["product_id"] );
729
- $file_list = wpsc_uploaded_files();
730
-
731
- $args = array(
732
- 'post_type' => 'wpsc-product-file',
733
- 'post_parent' => $product_id,
734
- 'numberposts' => -1,
735
- 'post_status' => 'all'
736
- );
737
- $attached_files = (array)get_posts( $args );
738
-
739
- $attached_files_by_file = array();
740
- foreach ( $attached_files as $key => $attached_file ) {
741
- $attached_files_by_file[$attached_file->post_title] = & $attached_files[$key];
742
- }
743
-
744
- $output = "<span class='admin_product_notes select_product_note '>" . esc_html__( 'Choose a downloadable file for this product:', 'wp-e-commerce' ) . "</span><br>";
745
- $output .= "<form method='post' class='product_upload'>";
746
- $output .= '<div class="ui-widget-content multiple-select select_product_file" style="width:100%">';
747
- $num = 0;
748
- foreach ( (array)$file_list as $file ) {
749
- $num++;
750
- $checked_curr_file = "";
751
- if ( isset( $attached_files_by_file[$file['display_filename']] ) ) {
752
- $checked_curr_file = "checked='checked'";
753
- }
754
-
755
- $output .= "<p " . ((($num % 2) > 0) ? '' : "class='alt'") . " id='select_product_file_row_$num'>\n";
756
- $output .= " <input type='checkbox' name='select_product_file[]' value='" . $file['real_filename'] . "' id='select_product_file_$num' " . $checked_curr_file . " />\n";
757
- $output .= " <label for='select_product_file_$num'>" . $file['display_filename'] . "</label>\n";
758
- $output .= "</p>\n";
759
- }
760
-
761
- $output .= "</div>";
762
- $output .= "<input type='hidden' id='hidden_id' value='$product_id' />";
763
- $output .= "<input data-nonce='" . _wpsc_create_ajax_nonce( 'upload_product_file' ) . "' type='submit' name='save' name='product_files_submit' class='button-primary prdfil' value='" . esc_html__( 'Save Product Files', 'wp-e-commerce' ) . "' />";
764
- $output .= "</form>";
765
- $output .= "<div class='" . ((is_numeric( $product_id )) ? "edit_" : "") . "select_product_handle'><div></div></div>";
766
- $output .= "<script type='text/javascript'>\n\r";
767
- $output .= "var select_min_height = " . (25 * 3) . ";\n\r";
768
- $output .= "var select_max_height = " . (25 * ($num + 1)) . ";\n\r";
769
- $output .= "</script>";
770
- echo $output;
771
- }
772
- if ( isset( $_REQUEST['wpsc_admin_action'] ) && ($_REQUEST['wpsc_admin_action'] == 'product_files_existing') )
773
- add_action( 'admin_init', 'wpsc_product_files_existing' );
774
-
775
- function wpsc_update_variations() {
776
- $product_id = absint( $_POST["product_id"] );
777
- $product_type_object = get_post_type_object('wpsc-product');
778
- if (!current_user_can($product_type_object->cap->edit_post, $product_id))
779
- return;
780
-
781
- //Setup postdata
782
- $post_data = array();
783
- $post_data['edit_var_val'] = isset( $_POST['edit_var_val'] ) ? $_POST["edit_var_val"] : '';
784
-
785
- //Add or delete variations
786
- wpsc_edit_product_variations( $product_id, $post_data );
787
- }
788
-
789
- if ( isset($_POST["edit_var_val"]) )
790
- add_action( 'admin_init', 'wpsc_update_variations', 50 );
791
-
792
- function wpsc_delete_variation_set() {
793
- check_admin_referer( 'delete-variation' );
794
-
795
- if ( is_numeric( $_GET['deleteid'] ) ) {
796
- $variation_id = absint( $_GET['deleteid'] );
797
-
798
- $variation_set = get_term( $variation_id, 'wpsc-variation', ARRAY_A );
799
-
800
- $variations = get_terms( 'wpsc-variation', array(
801
- 'hide_empty' => 0,
802
- 'parent' => $variation_id
803
- ) );
804
-
805
- foreach ( (array) $variations as $variation ) {
806
- $return_value = wp_delete_term( $variation->term_id, 'wpsc-variation' );
807
- }
808
-
809
- if ( !empty( $variation_set ) ) {
810
- $return_value = wp_delete_term( $variation_set['term_id'], 'wpsc-variation' );
811
- }
812
- $deleted = 1;
813
- }
814
-
815
- $sendback = wp_get_referer();
816
- if ( isset( $deleted ) ) {
817
- $sendback = add_query_arg( 'deleted', $deleted, $sendback );
818
- }
819
- $sendback = remove_query_arg( array(
820
- 'deleteid',
821
- 'variation_id'
822
- ), $sendback );
823
-
824
- wp_redirect( esc_url_raw( $sendback ) );
825
- exit();
826
- }
827
-
828
- if ( isset( $_REQUEST['wpsc_admin_action'] ) && ( 'wpsc-delete-variation-set' == $_REQUEST['wpsc_admin_action'] ) )
829
- add_action( 'admin_init', 'wpsc_delete_variation_set' );
830
-
831
- function wpsc_backup_theme() {
832
-
833
- if ( ! wpsc_is_store_admin() ) {
834
- return;
835
- }
836
-
837
- $wp_theme_path = get_stylesheet_directory();
838
- wpsc_recursive_copy( $wp_theme_path, WPSC_THEME_BACKUP_DIR );
839
- $_SESSION['wpsc_themes_backup'] = true;
840
- $sendback = wp_get_referer();
841
- wp_redirect( $sendback );
842
-
843
- exit();
844
- }
845
- if ( isset( $_REQUEST['wpsc_admin_action'] ) && ( $_REQUEST['wpsc_admin_action'] == 'backup_themes' ) )
846
- add_action( 'admin_init', 'wpsc_backup_theme' );
847
-
848
- /**
849
- * Delete a coupon
850
- *
851
- * @since 3.8
852
- */
853
- function wpsc_delete_coupon(){
854
-
855
- global $wpdb;
856
-
857
- check_admin_referer( 'delete-coupon' );
858
-
859
- if ( ! function_exists( 'wpsc_is_store_admin' ) || ! wpsc_is_store_admin() ) {
860
- return;
861
- }
862
-
863
- $deleted = 0;
864
-
865
- if ( isset( $_GET['delete_id'] ) ) {
866
- $coupon = new WPSC_Coupon( $_GET['delete_id'] );
867
- $coupon->delete();
868
- $deleted = 1;
869
- }
870
-
871
- $sendback = wp_get_referer();
872
-
873
- if ( $deleted ) {
874
- $sendback = add_query_arg( 'deleted', $deleted, $sendback );
875
- }
876
-
877
- $sendback = remove_query_arg( array( 'deleteid', 'wpsc_admin_action' ), $sendback );
878
- wp_redirect( esc_url_raw( $sendback ) );
879
- exit();
880
-
881
- }
882
-
883
- // Delete Coupon
884
- if ( isset( $_REQUEST['wpsc_admin_action'] ) && ( 'wpsc-delete-coupon' == $_REQUEST['wpsc_admin_action'] ) ) {
885
- add_action( 'admin_init', 'wpsc_delete_coupon' );
886
- }
887
-
888
- function _wpsc_action_update_option_base_country( $old_value, $new_value ) {
889
- global $wpdb;
890
- $region_count = $wpdb->get_var( $wpdb->prepare( "SELECT COUNT(`regions`.`id`) FROM `" . WPSC_TABLE_REGION_TAX . "` AS `regions` INNER JOIN `" . WPSC_TABLE_CURRENCY_LIST . "` AS `country` ON `country`.`id` = `regions`.`country_id` WHERE `country`.`isocode` IN('%s')", $new_value ) );
891
- if ( ! $region_count )
892
- update_option( 'base_region', '' );
893
- }
894
- add_action( 'update_option_base_country', '_wpsc_action_update_option_base_country', 10, 2 );
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
trunk/wpsc-admin/js/admin-legacy.js DELETED
@@ -1,1066 +0,0 @@
1
- var someresults=function() {
2
- document.getElementById('changenotice').innerHTML = "Thank you, your change has been saved";
3
- }
4
-
5
- var noresults=function() {
6
- // see nothing, know nothing, do nothing
7
- }
8
-
9
- if(typeof(select_min_height) == undefined) {
10
- var select_min_height = 0;
11
- var select_max_height = 200;
12
- }
13
-
14
- jQuery(document).ready(
15
- function() {
16
- // jQuery('div.select_product_file').Resizable({
17
- // minWidth: 300,
18
- // minHeight: select_min_height,
19
- // maxWidth: 300,
20
- // maxHeight: select_max_height,
21
- // handlers: {
22
- // s: '.select_product_handle'
23
- // }
24
- // });
25
-
26
- jQuery("div.admin_product_name a.shorttag_toggle").toggle(
27
- function () {
28
- jQuery("div.admin_product_shorttags", jQuery(this).parent("div.admin_product_name")).css('display', 'block');
29
- },
30
- function () {
31
- //jQuery("div#admin_product_name a.shorttag_toggle").toggleClass('toggled');
32
- jQuery("div.admin_product_shorttags", jQuery(this).parent("div.admin_product_name")).css('display', 'none');
33
- }
34
- );
35
- enablebuttons();
36
-
37
- }
38
- );
39
-
40
- function activate_resizable() {
41
- // jQuery('div.edit_select_product_file').Resizable({
42
- // minWidth: 300,
43
- // minHeight: select_min_height,
44
- // maxWidth: 300,
45
- // maxHeight: select_max_height,
46
- // handlers: {
47
- // s: '.edit_select_product_handle'
48
- // }
49
- // });
50
- }
51
-
52
-
53
-
54
- jQuery(document).ready(function(){
55
- // bind_shipping_rate_deletion();
56
- jQuery(function() {
57
- // set us up some mighty fine tabs for the options page
58
-
59
- if (typeof jQuery('#wpsc_options > ul#tabs').tabs != "undefined") {
60
- $tabs = jQuery('#wpsc_options > ul#tabs').tabs();
61
- }
62
- // current_tab = window.location.href.split('#');
63
-
64
- // this here code handles remembering what tab you were on
65
- jQuery('#wpsc_options > ul').bind('tabsselect', function(event, ui) {
66
- form_action = jQuery('#cart_options').attr('action').split('#'); //split at the #
67
- form_action = form_action[0]+"#"+ui.panel.id; // get the first item, add the hash then our current tab ID
68
- jQuery('#cart_options').attr('action', form_action); // stick it all back in the action attribute
69
- // var current_tab = $tabs.data('selected.tabs');
70
- // alert(current_tab);
71
- // if (current_tab == '3') {
72
- // form_action = jQuery('#shipping_options').attr('action').split('#'); //split at the #
73
- // form_action = form_action[0]+"#"+ui.panel.id; // get the first item, add the hash then our current tab ID
74
- //
75
- // jQuery('#shipping_options').attr('action', form_action); // stick it all back in the action attribute
76
- // }
77
- // if (current_tab == '4') {
78
- // form_action = jQuery('#gateway_options').attr('action').split('#'); //split at the #
79
- // form_action = form_action[0]+"#"+ui.panel.id; // get the first item, add the hash then our current tab ID
80
- // jQuery('#gateway_options').attr('action', form_action); // stick it all back in the action attribute
81
- // }
82
- });
83
- jQuery('#wpsc_options > ul').bind('tabsload', function(event, ui) {
84
- bind_shipping_rate_deletion();
85
- // form_action = jQuery('#cart_options').attr('action').split('#'); //split at the #
86
- // form_action = form_action[0]+"#"+ui.panel.id; // get the first item, add the hash then our current tab ID
87
- // jQuery('#cart_options').attr('action', form_action); // stick it all back in the action attribute
88
- var current_tab = $tabs.data('selected.tabs');
89
- if (current_tab == '3') {
90
- form_action = jQuery('#shipping_options').attr('action').split('#'); //split at the #
91
- form_action = form_action[0]+"#"+ui.panel.id; // get the first item, add the hash then our current tab ID
92
- jQuery('#shipping_options').attr('action', form_action); // stick it all back in the action attribute
93
- }
94
- if (current_tab == '4') {
95
- form_action = jQuery('#gateway_options_tbl').attr('action').split('#'); //split at the #
96
- form_action = form_action[0]+"#"+ui.panel.id; // get the first item, add the hash then our current tab ID
97
- jQuery('#gateway_options_tbl').attr('action', form_action); // stick it all back in the action attribute
98
- }
99
- if (current_tab == '5') {
100
- form_action = jQuery('#chekcout_options_tbl').attr('action').split('#'); //split at the #
101
- form_action = form_action[0]+"#"+ui.panel.id; // get the first item, add the hash then our current tab ID
102
- jQuery('#chekcout_options_tbl').attr('action', form_action); // stick it all back in the action attribute
103
- }
104
- if (current_tab == '6') {
105
- form_action = jQuery('#gold_cart_form').attr('action').split('#'); //split at the #
106
- form_action = form_action[0]+"#"+ui.panel.id; // get the first item, add the hash then our current tab ID
107
- jQuery('#gold_cart_form').attr('action', form_action); // stick it all back in the action attribute
108
- }
109
-
110
- });
111
- });
112
- });
113
-
114
-
115
- function categorylist(url) {
116
- self.location = url;
117
- }
118
-
119
- function submit_change_country() {
120
- document.cart_options.submit();
121
- //document.cart_options.submit();
122
- }
123
-
124
- var getresults=function(results) {
125
- document.getElementById('formcontent').innerHTML = results;
126
- jQuery('form.edititem').css('display', 'block');
127
- jQuery('form.edititem').css('display', 'block');
128
- jQuery('#additem').css('display', 'none');
129
- jQuery('#productform').css('display', 'block');
130
- jQuery("#loadingindicator_span").css('visibility','hidden');
131
- enablebuttons();
132
-
133
- jQuery("#gallery_list").sortable({
134
- revert: false,
135
- placeholder: "ui-selected",
136
- start: function(e,ui) {
137
- jQuery('#image_settings_box').hide();
138
- jQuery('a.editButton').hide();
139
- jQuery('img.deleteButton').hide();
140
- jQuery('ul#gallery_list').children('li').removeClass('first');
141
- },
142
- stop:function (e,ui) {
143
- jQuery('ul#gallery_list').children('li:first').addClass('first');
144
- },
145
- update: function (e,ui){
146
- set = jQuery("#gallery_list").sortable('toArray');
147
- img_id = jQuery('#gallery_image_'+set[0]).parent('li').attr('id');
148
-
149
- jQuery('#gallery_image_'+set[0]).children('img.deleteButton').remove();
150
- jQuery('#gallery_image_'+set[0]).append("<a class='editButton'>Edit <img src='" + WPSC_CORE_IMAGES_URL + "/pencil.png' alt='' /></a>");
151
- jQuery('#gallery_image_'+set[0]).parent('li').attr('id', 0);
152
- //for(i=1;i<set.length;i++) {
153
- // jQuery('#gallery_image_'+set[i]).children('a.editButton').remove();
154
- // jQuery('#gallery_image_'+set[i]).append("<img alt='-' class='deleteButton' src='" + WPSC_CORE_IMAGES_URL + "cross.png'/>");
155
- //}
156
-
157
- for(i=1;i<set.length;i++) {
158
- jQuery('#gallery_image_'+set[i]).children('a.editButton').remove();
159
- jQuery('#gallery_image_'+set[i]).append("<img alt='-' class='deleteButton' src='" + WPSC_CORE_IMAGES_URL + "/cross.png'/>");
160
-
161
- element_id = jQuery('#gallery_image_'+set[i]).parent('li').attr('id');
162
- if(element_id == 0) {
163
- jQuery('#gallery_image_'+set[i]).parent('li').attr('id', img_id);
164
- }
165
- }
166
-
167
- order = set.join(',');
168
- prodid = jQuery('#prodid').val();
169
- ajax.post("index.php",imageorderresults,"admin=true&ajax=true&prodid="+prodid+"&imageorder=true&order="+order);
170
- },
171
- 'opacity':0.5
172
- });
173
-
174
- function imageorderresults(results) {
175
- eval(results);
176
-
177
- jQuery('#gallery_image_'+ser).append(output);
178
-
179
- enablebuttons();
180
- }
181
-
182
- jQuery("div.previewimage").hover(
183
- function () {
184
- jQuery(this).children('img.deleteButton').show();
185
- if(jQuery('#image_settings_box').css('display')!='block')
186
- jQuery(this).children('a.editButton').show();
187
- },
188
- function () {
189
- jQuery(this).children('img.deleteButton').hide();
190
- jQuery(this).children('a.editButton').hide();
191
- }
192
- );
193
-
194
- jQuery("a.closeimagesettings").click(
195
- function (e) {
196
- jQuery("div#image_settings_box").hide();
197
- }
198
- );
199
-
200
- jQuery("#table_rate_price").click(
201
- function() {
202
- if (this.checked) {
203
- jQuery("#table_rate").slideDown("fast");
204
- } else {
205
- jQuery("#table_rate").slideUp("fast");
206
- }
207
- }
208
- );
209
-
210
- jQuery(".add_level").click(
211
- function() {
212
- jQuery(this).parent().children('table').append('<tr><td><input type="text" size="10" value="" name="productmeta_values[table_rate_price][quantity][]"/> and above</td><td><input type="text" size="10" value="" name="productmeta_values[table_rate_price][table_price][]"/></td><td><img src="' + WPSC_CORE_IMAGES_URL + '/cross.png" class="remove_line"></td></tr>');
213
- }
214
- );
215
-
216
-
217
- jQuery("#add_label").click(
218
- function(){
219
- jQuery("#labels").append("<br><table><tr><td>"+TXT_WPSC_LABEL+" :</td><td><input type='text' name='productmeta_values[labels][]'></td></tr><tr><td>"+TXT_WPSC_LIFE_NUMBER+" :</td><td><input type='text' name='productmeta_values[life_number][]'></td></tr><tr><td>"+TXT_WPSC_ITEM_NUMBER+" :</td><td><input type='text' name='productmeta_values[item_number][]'></td></tr><tr><td>"+TXT_WPSC_PRODUCT_CODE+" :</td><td><input type='text' name='productmeta_values[product_code][]'></td></tr><tr><td>"+TXT_WPSC_PDF+" :</td><td><input type='file' name='productmeta_values[product_pdf][]'></td></tr></table>");
220
- }
221
- );
222
-
223
- jQuery(".remove_line").click(
224
- function() {
225
- jQuery(this).parent().parent('tr').remove();
226
- }
227
- );
228
-
229
- jQuery("div.admin_product_name a.shorttag_toggle").toggle(
230
- function () {
231
- jQuery("div.admin_product_shorttags", jQuery(this).parent("div.admin_product_name")).css('display', 'block');
232
- },
233
- function () {
234
- //jQuery("div#admin_product_name a.shorttag_toggle").toggleClass('toggled');
235
- jQuery("div.admin_product_shorttags", jQuery(this).parent("div.admin_product_name")).css('display', 'none');
236
- }
237
- );
238
- jQuery(".file_delete_button").click(
239
- function() {
240
- jQuery(this).parent().remove();
241
- file_hash = jQuery(this).siblings("input").val();
242
- ajax.post("index.php",noresults,"admin=true&ajax=true&del_file=true&del_file_hash="+file_hash);
243
- }
244
- );
245
- boxes = ["price_and_stock", "shipping", "variation", "advanced", "product_image", "product_download"];
246
- for (i=0;i<boxes.length;i++) {
247
- if ( ! jQuery('#'+boxes[i]+'-hide').is(':checked')){
248
- if (IS_WP27) {
249
- jQuery('#'+boxes[i]).hide();
250
- }
251
- }
252
- }
253
- }
254
-
255
- function filleditform(prodid) {
256
- jQuery(document).ready(function(){
257
- ajax.post("index.php",getresults,"ajax=true&admin=true&prodid="+prodid);
258
- jQuery('.loadingimage').attr('src', jQuery(".loadingimage").attr('src'));
259
- jQuery('#loadingindicator_span').css('visibility','visible');
260
- });
261
- }
262
-
263
- function fillvariationform(variation_id) {
264
- ajax.post("index.php",getresults,"ajax=true&admin=true&variation_id="+variation_id);
265
- jQuery('.loadingimage').attr('src', WPSC_CORE_IMAGES_URL + 'indicator.gif');
266
- jQuery('#loadingindicator_span').css('visibility','visible');
267
- }
268
-
269
- function showaddform() {
270
- document.getElementById('productform').style.display = 'none';
271
- document.getElementById('additem').style.display = 'block';
272
- return false;
273
- }
274
-
275
- function showadd_categorisation_form() {
276
- if(jQuery('div#add_categorisation').css('display') != 'block') {
277
- jQuery('div#add_categorisation').css('display', 'block');
278
- jQuery('div#edit_categorisation').css('display', 'none');
279
- } else {
280
- jQuery('div#add_categorisation').css('display', 'none');
281
- }
282
- return false;
283
- }
284
-
285
-
286
- function showedit_categorisation_form() {
287
- if(jQuery('div#edit_categorisation').css('display') != 'block') {
288
- jQuery('div#edit_categorisation').css('display', 'block');
289
- jQuery('div#add_categorisation').css('display', 'none');
290
- } else {
291
- jQuery('div#edit_categorisation').css('display', 'none');
292
- }
293
- return false;
294
- }
295
-
296
- function fillcategoryform(catid) {
297
- ajax.post("index.php",getresults,"ajax=true&admin=true&catid="+catid);
298
- }
299
-
300
- function fillbrandform(catid) {
301
- ajax.post("index.php",getresults,"ajax=true&admin=true&brandid="+catid);
302
- }
303
-
304
- var gercurrency=function(results) {
305
- document.getElementById('cslchar1').innerHTML = results;
306
- document.getElementById('cslchar2').innerHTML = results;
307
- document.getElementById('cslchar3').innerHTML = results;
308
- document.getElementById('cslchar4').innerHTML = results;
309
- }
310
-
311
-
312
-
313
- function country_list(id) {
314
- var country_list=function(results) {
315
- document.getElementById('options_region').innerHTML = results;
316
- }
317
- ajax.post("index.php",country_list,"ajax=true&get_country_tax=true&country_id="+id);
318
- }
319
-
320
- function hideelement(id) {
321
- state = document.getElementById(id).style.display;
322
- //alert(document.getElementById(id).style.display);
323
- if(state != 'block') {
324
- document.getElementById(id).style.display = 'block';
325
- } else {
326
- document.getElementById(id).style.display = 'none';
327
- }
328
- }
329
-
330
- function update_preview_url(prodid) {
331
- image_height = document.getElementById("image_height").value;
332
- image_width = document.getElementById("image_width").value;
333
- if(((image_height > 0) && (image_height <= 1024)) && ((image_width > 0) && (image_width <= 1024))) {
334
- new_url = "index.php?productid="+prodid+"&height="+image_height+"&width="+image_width+"";
335
- document.getElementById("preview_link").setAttribute('href',new_url);
336
- } else {
337
- new_url = "index.php?productid="+prodid+"";
338
- document.getElementById("preview_link").setAttribute('href',new_url);
339
- }
340
- return false;
341
- }
342
-
343
-
344
- function add_variation_value(value_type) {
345
- container_id = value_type+"_variation_values";
346
- //alert(container_id);
347
- last_element_id = document.getElementById(container_id).lastChild.id;
348
- // last_element_id = last_element_id.split("_");
349
- // last_element_id = last_element_id.reverse();
350
- date = new Date;
351
- new_element_id = "variation_value_"+date.getTime();
352
-
353
-
354
- old_elements = document.getElementById(container_id).innerHTML;
355
- new_element_contents = "";
356
- if(value_type == "edit") {
357
- new_element_contents += "<input type='text' class='text' name='new_variation_values[]' value='' />";
358
- } else {
359
- new_element_contents += "<input type='text' class='text' name='variation_values[]' value='' />";
360
- }
361
- new_element_contents += " <a class='image_link' href='#' onclick='remove_variation_value_field(\""+new_element_id+"\")'><img src='" + WPSC_CORE_IMAGES_URL + "trash.gif' alt='"+TXT_WPSC_DELETE+"' title='"+TXT_WPSC_DELETE+"' /></a><br />";
362
- //new_element_contents += "</span>";
363
-
364
- new_element = document.createElement('span');
365
- new_element.id = new_element_id;
366
-
367
- document.getElementById(container_id).appendChild(new_element);
368
- document.getElementById(new_element_id).innerHTML = new_element_contents;
369
- return false;
370
- }
371
-
372
- function remove_variation_value(element,variation_value) {
373
- var delete_variation_value=function(results)
374
- {
375
- }
376
-
377
- element_count = jQuery("div#edit_variation_values span").size();
378
- if(element_count > 1) {
379
- ajax.post("index.php",delete_variation_value,"admin=true&ajax=true&remove_variation_value=true&variation_value_id="+variation_value);
380
- jQuery(element).parent("span.variation_value").remove();
381
- }
382
- return false;
383
- }
384
-
385
-
386
-
387
-
388
- function checkimageresize() {
389
- document.getElementById('image_resize2').checked = true;
390
- }
391
-
392
- function submit_status_form(id) {
393
- document.getElementById(id).submit();
394
- }
395
-
396
- // pe.{
397
- var prevElement = null;
398
- var prevOption = null;
399
-
400
- function hideOptionElement(id, option) {
401
- if (prevOption == option) {
402
- return;
403
- }
404
- if (prevElement != null) {
405
- prevElement.style.display = "none";
406
- }
407
-
408
- if (id == null) {
409
- prevElement = null;
410
- } else {
411
- prevElement = document.getElementById(id);
412
- jQuery('#'+id).css( 'display','block');
413
- }
414
- prevOption = option;
415
- }
416
-
417
-
418
- // }.pe
419
-
420
- function toggle_display_options(state) {
421
- switch(state) {
422
- case 'list':
423
- document.getElementById('grid_view_options').style.display = 'none';
424
- document.getElementById('list_view_options').style.display = 'block';
425
- break;
426
-
427
- case 'grid':
428
- document.getElementById('list_view_options').style.display = 'none';
429
- document.getElementById('grid_view_options').style.display = 'block';
430
- break;
431
-
432
- default:
433
- document.getElementById('list_view_options').style.display = 'none';
434
- document.getElementById('grid_view_options').style.display = 'none';
435
- break;
436
- }
437
- }
438
-
439
- function log_submitform(id) {
440
- value1 = document.getElementById(id);
441
- if (ajax.serialize(value1).search(/value=3/)!=-1) {
442
- document.getElementById("track_id_"+id).style.display="block";
443
- } else {
444
- document.getElementById("track_id_"+id).style.display="none";
445
- }
446
- var get_log_results=function(results) {
447
- eval(results);
448
- }
449
- frm = document.getElementById(id);
450
- ajax.post("index.php?admin=true&ajax=true&log_state=true",get_log_results,ajax.serialize(frm));
451
- return false;
452
- }
453
-
454
- function save_tracking_id(id) {
455
- value1 = document.getElementById('tracking_id_'+id).value;
456
- value1 ="id="+id +"&value="+value1;
457
- ajax.post("index.php?admin=true&ajax=true&save_tracking_id=true",noresults,value1);
458
- return false;
459
- }
460
-
461
- var select_min_height = 75;
462
- var select_max_height = 50;
463
- /*
464
- //ToolTip JavaScript
465
- jQuery('img').Tooltip(
466
- {
467
- className: 'inputsTooltip',
468
- position: 'mouse',
469
- delay: 200
470
- }
471
- );
472
- */
473
- jQuery(window).load( function () {
474
-
475
- jQuery('a.closeEl').bind('click', toggleContent);
476
- /*
477
- jQuery('div.groupWrapper').sortable( {
478
- accept: 'groupItem',
479
- helperclass: 'sortHelper',
480
- activeclass : 'sortableactive',
481
- hoverclass : 'sortablehover',
482
- handle: 'div.itemHeader',
483
- tolerance: 'pointer',
484
- onStart : function() {
485
- jQuery.iAutoscroller.start(this, document.getElementsByTagName('body'));
486
- },
487
- onStop : function() {
488
- jQuery.iAutoscroller.stop();
489
- },
490
- update : function(e,ui) {
491
- serial = jQuery('div.groupWrapper').sortable('toArray');
492
- category_id = jQuery("input#item_list_category_id").val();
493
-
494
- ajax.post("index.php", noresults, "admin=true&ajax=true&changeorder=true&category_id="+category_id+"&sort1="+serial);
495
- }
496
- }
497
- );
498
- */
499
-
500
- jQuery('a#close_news_box').click( function () {
501
- jQuery('div.wpsc_news').css( 'display', 'none' );
502
- ajax.post("index.php", noresults, "ajax=true&admin=true&hide_ecom_dashboard=true");
503
- return false;
504
- });
505
- });
506
- var toggleContent = function(e)
507
- {
508
- var targetContent = jQuery('div.itemContent', this.parentNode.parentNode);
509
- if (targetContent.css('display') == 'none') {
510
- targetContent.slideDown(300);
511
- jQuery(this).html('[-]');
512
- } else {
513
- targetContent.slideUp(300);
514
- jQuery(this).html('[+]');
515
- }
516
- return false;
517
- };
518
-
519
-
520
- function hideelement1(id, item_value)
521
- {
522
- //alert(value);
523
- if(item_value == 5) {
524
- jQuery(document.getElementById(id)).css('display', 'block');
525
- } else {
526
- jQuery(document.getElementById(id)).css('display', 'none');
527
- }
528
- }
529
-
530
-
531
- function suspendsubs(user_id)
532
- {
533
- var comm =jQuery("#suspend_subs"+user_id).attr("checked");
534
- //alert(comm);
535
- if (comm == true){
536
- ajax.post("index.php",noresults,"admin=true&ajax=true&log_state=true&suspend=true&value=1&id="+user_id);
537
- } else {
538
- ajax.post("index.php",noresults,"admin=true&ajax=true&log_state=true&suspend=true&value=2&id="+user_id);
539
- }
540
- return false;
541
- }
542
-
543
- function delete_extra_preview(preview_name, prodid) {
544
- var preview_name_results=function(results) {
545
- filleditform(prodid);
546
- }
547
- ajax.post("index.php",preview_name_results,"ajax=true&admin=true&prodid="+prodid+"&preview_name="+preview_name);
548
- }
549
-
550
- function shipwire_sync() {
551
- ajax.post("index.php",noresults,"ajax=true&shipwire_sync=ture");
552
- }
553
-
554
- function shipwire_tracking() {
555
- ajax.post("index.php",noresults,"ajax=true&shipwire_tracking=ture");
556
- }
557
-
558
- function display_settings_button() {
559
- jQuery("#settings_button").slideToggle(200);
560
- //document.getElementById("settings_button").style.display='block';
561
- }
562
-
563
- function submittogoogle(id){
564
- value1=document.getElementById("google_command_list_"+id).value;
565
- value2=document.getElementById("partial_amount_"+id).value;
566
- reason=document.getElementById("cancel_reason_"+id).value;
567
- comment=document.getElementById("cancel_comment_"+id).value;
568
- message=document.getElementById("message_to_buyer_message_"+id).value;
569
- document.getElementById("google_command_indicator").style.display='inline';
570
- ajax.post("index.php",submittogoogleresults,"ajax=true&submittogoogle=true&message="+message+"&value="+value1+"&amount="+value2+"&comment="+comment+"&reason="+reason+"&id="+id);
571
- return true;
572
- }
573
-
574
- var submittogoogleresults=function (results) {
575
- window.location.reload(true);
576
- }
577
-
578
- function display_partial_box(id){
579
- value1=document.getElementById("google_command_list_"+id).value;
580
- if ((value1=='Refund') || (value1=='Charge')){
581
- document.getElementById("google_partial_radio_"+id).style.display='inline';
582
- if (value1=='Refund'){
583
- document.getElementById("google_cancel_"+id).style.display='block';
584
- document.getElementById("cancel_reason_"+id).style.display='inline';
585
- document.getElementById("cancel_div_comment_"+id).style.display='none';
586
- }
587
- }else if ((value1=='Cancel')||(value1=='Refund')) {
588
- document.getElementById("google_cancel_"+id).style.display='block';
589
- document.getElementById("cancel_reason_"+id).style.display='inline';
590
- }else if (value1=='Send Message') {
591
- document.getElementById("message_to_buyer_"+id).style.display='block';
592
- } else {
593
- document.getElementById("cancel_div_comment_"+id).style.display='none';
594
- document.getElementById("google_cancel_"+id).style.display='none';
595
- document.getElementById("cancel_reason_"+id).style.display='none';
596
- document.getElementById("message_to_buyer_"+id).style.display='none';
597
- document.getElementById("google_partial_radio_"+id).style.display='none';
598
- document.getElementById("partial_amount_"+id).style.display='none';
599
- }
600
- }
601
-
602
- function add_more_meta(e) {
603
- current_meta_forms = jQuery(e).parent().children("div.product_custom_meta:last"); // grab the form container
604
- new_meta_forms = current_meta_forms.clone(true); // clone the form container
605
- jQuery("label input", new_meta_forms).val(''); // reset all contained forms to empty
606
- current_meta_forms.after(new_meta_forms); // append it after the container of the clicked element
607
- return false;
608
- }
609
-
610
- function remove_meta(e, meta_id) {
611
- current_meta_form = jQuery(e).parent("div.product_custom_meta"); // grab the form container
612
- //meta_name = jQuery("input#custom_meta_name_"+meta_id, current_meta_form).val();
613
- //meta_value = jQuery("input#custom_meta_value_"+meta_id, current_meta_form).val();
614
- returned_value = jQuery.ajax({
615
- type: "POST",
616
- url: "admin.php?ajax=true",
617
- data: "admin=true&remove_meta=true&meta_id="+meta_id+"",
618
- success: function(results) {
619
- if(results > 0) {
620
- jQuery("div#custom_meta_"+meta_id).remove();
621
- }
622
- }
623
- });
624
- return false;
625
- }
626
-
627
-
628
- function wpsc_save_postboxes_state(page, container) {
629
- var closed = jQuery(container+' .postbox').filter('.closed').map(function() {
630
- return this.id;
631
- }).get().join(',');
632
- jQuery.post(postboxL10n.requestFile, {
633
- action: 'closed-postboxes',
634
- closed: closed,
635
- closedpostboxesnonce: jQuery('#closedpostboxesnonce').val(),
636
- page: page
637
- });
638
- }
639
-
640
- jQuery(document).ready(function(){
641
-
642
- jQuery('.deleteproducts > button').click(
643
- function () {
644
- var ids='0';
645
- jQuery('.deletecheckbox:checked').each(
646
- function () {
647
- ids += ","+jQuery(this).val();
648
- }
649
- );
650
- var r=confirm("Please confirm deletion");
651
- if (r==true) {
652
- ajax.post("index.php",reloadresults,"admin=true&ajax=true&del_prod=true&del_prod_id="+ids);
653
- }
654
- }
655
- );
656
- jQuery('#selectall').click(
657
- function () {
658
- if (this.checked) {
659
- jQuery('.deletecheckbox').each(function(){
660
- this.checked = true;
661
- });
662
- } else {
663
- jQuery('.deletecheckbox').each(function(){
664
- this.checked = false;
665
- });
666
- }
667
- }
668
- );
669
-
670
- if (typeof jQuery('.pickdate').datepicker != "undefined") {
671
- jQuery('.pickdate').datepicker({
672
- dateFormat: 'yy-mm-dd'
673
- });
674
- }
675
- filesizeLimit = 5120000;
676
-
677
- // alert('test 1');
678
- if (typeof SWFUpload != "undefined") {
679
- var swfu = new SWFUpload({
680
- flash_url : WPSC_CORE_JS_URL + '/swfupload.swf',
681
- upload_url: base_url+'/?action=wpsc_add_image',
682
- button_placeholder_id : "spanButtonPlaceholder",
683
- button_width: 103,
684
- button_height: 24,
685
- button_window_mode: SWFUpload.WINDOW_MODE.TRANSPARENT,
686
- button_cursor: SWFUpload.CURSOR.HAND,
687
- post_params: {
688
- "prodid" : 0
689
- },
690
- file_queue_limit : 1,
691
- file_size_limit : filesizeLimit+'b',
692
- file_types : "*.jpg;*.jpeg;*.png;*.gif;*.JPG;*.JPEG;*.PNG;*.GIF",
693
- file_types_description : "Web-compatible Image Files",
694
- file_upload_limit : filesizeLimit,
695
- custom_settings : {
696
- targetHolder : false,
697
- progressBar : false,
698
- sorting : false
699
- },
700
- debug: false,
701
-
702
- file_queued_handler : imageFileQueued,
703
- file_queue_error_handler : imageFileQueueError,
704
- file_dialog_complete_handler : imageFileDialogComplete,
705
- upload_start_handler : startImageUpload,
706
- upload_progress_handler : imageUploadProgress,
707
- upload_error_handler : imageUploadError,
708
- upload_success_handler : imageUploadSuccess,
709
- upload_complete_handler : imageUploadComplete,
710
- queue_complete_handler : imageQueueComplete
711
- });
712
- }
713
- jQuery("#add-product-image").click(function(){
714
- swfu.selectFiles();
715
- });
716
- });
717
-
718
- function addlayer(){
719
- jQuery("tr.addlayer").before("<tr class='rate_row'><td><i style='color:grey'>"+TXT_WPSC_IF_PRICE_IS+"</i><input type='text' name='layer[]' size='10'> <i style='color:grey'>"+TXT_WPSC_AND_ABOVE+"</i></td><td><input type='text' name='shipping[]' size='10'>&nbsp;&nbsp;<a href='#' class='delete_button nosubmit' >"+TXT_WPSC_DELETE+"</a></td></tr>");
720
- bind_shipping_rate_deletion();
721
- }
722
-
723
- function addweightlayer(){
724
- jQuery("tr.addlayer").before("<tr class='rate_row'><td><i style='color:grey'>"+TXT_WPSC_IF_WEIGHT_IS+"</i><input type='text' name='weight_layer[]' size='10'> <i style='color:grey'>"+TXT_WPSC_AND_ABOVE+"</i></td><td><input type='text' name='weight_shipping[]' size='10'>&nbsp;&nbsp;<a href='#' class='delete_button nosubmit' >"+TXT_WPSC_DELETE+"</a></td></tr>");
725
- bind_shipping_rate_deletion();
726
- }
727
-
728
- function removelayer() {
729
- this.parent.parent.innerHTML='';
730
- }
731
-
732
- /**
733
- * SWFUpload Image Uploading events
734
- **/
735
-
736
- function imageFileQueued (file) {
737
-
738
- }
739
-
740
- function imageFileQueueError (file, error, message) {
741
- if (error == SWFUpload.QUEUE_ERROR.QUEUE_LIMIT_EXCEEDED) {
742
- alert("You selected too many files to upload at one time. " + (message === 0 ? "You have reached the upload limit." : "You may upload " + (message > 1 ? "up to " + message + " files." : "only one file.")));
743
- return;
744
- }
745
-
746
- }
747
-
748
- function imageFileDialogComplete (selected, queued) {
749
- try {
750
- this.startUpload();
751
- } catch (ex) {
752
- this.debug(ex);
753
- }
754
- }
755
-
756
- function startImageUpload (file) {
757
- // alert('start '+jQuery("div#swfupload_img_indicator").css('display'));
758
- jQuery("div#swfupload_img_indicator").css('display', 'block');
759
- var cell = jQuery('<li></li>').appendTo(jQuery('#gallery_list'));
760
- var sorting = jQuery('<input type="hidden" name="images[]" value="" />').appendTo(cell);
761
- var progress = jQuery('<div class="progress"></div>').appendTo(cell);
762
- var bar = jQuery('<div class="bar"></div>').appendTo(progress);
763
- var art = jQuery('<div class="gloss"></div>').appendTo(progress);
764
- this.targetHolder = cell;
765
- this.progressBar = bar;
766
- this.sorting = sorting;
767
- return true;
768
- }
769
-
770
- function imageUploadProgress (file, loaded, total) {
771
- var progress = Math.ceil((loaded/total)*76);
772
- jQuery(this.progressBar).animate({
773
- 'width':progress+'px'
774
- },100);
775
- }
776
-
777
- function imageUploadError (file, error, message) {
778
- console.log(error+": "+message);
779
- }
780
-
781
- function imageUploadSuccess (file, results) {
782
- //Don't delete, initiate id is neccesary.
783
- var id = null;
784
- var pid = null;
785
-
786
- jQuery("span.swfupload_loadingindicator").css('visibility', 'hidden');
787
- eval(results);
788
- // jQuery(this).css('border', '1px solid red');
789
- if(pid >= 1) {
790
- context = jQuery("div#productform");
791
- } else {
792
- context = jQuery("div#additem");
793
- }
794
-
795
- if (id == null ) {
796
- if(replacement_src != null) {
797
- jQuery("li.first div.previewimage a.thickbox", context).attr('href', replacement_src);
798
- jQuery("li.first div.previewimage a.thickbox img.previewimage", context).attr('src', replacement_src);
799
- } else {
800
- if (jQuery('#gold_present', context).val() != '1') {
801
- jQuery('#add-product-image', context).remove();
802
- }
803
- jQuery(this.sorting).attr({
804
- 'value':src
805
- });
806
- var img = jQuery('<div class="previewimage" id="'+id+'"><a href="'+WPSC_IMAGE_URL+src+'" rel="product_extra_image_'+id+'" class="thickbox"><img src="'+WPSC_IMAGE_URL+src+'" width="60" height="60" class="previewimage" /></a></div>').appendTo(this.targetHolder).hide();
807
- set = jQuery("#gallery_list", context).sortable('toArray');
808
-
809
- jQuery('#gallery_image_0', context).append("<a class='editButton'>Edit <img src='" + WPSC_IMAGE_URL + "pencil.png'/></a>");
810
- jQuery('#gallery_image_0', context).parent('li').addClass('first');
811
- jQuery('#gallery_image_0', context).parent('li').attr('id', 0);
812
- jQuery('#gallery_image_0 img.deleteButton', context).remove();
813
- enablebuttons();
814
- }
815
- } else {
816
- //jQuery(this.targetHolder).attr({'id':'image-'+src});
817
- jQuery(this.targetHolder).attr({
818
- 'id':id
819
- });
820
- div_id = 'gallery_image_'+id;
821
- jQuery(this.targetHolder).html('');
822
- var img = jQuery('<div class="previewimage" id="'+div_id+'"><input type="hidden" name="images[]" value="'+src+'"><a href="'+WPSC_IMAGE_URL+src+'" rel="product_extra_image_'+id+'" class="thickbox"><img src="'+WPSC_IMAGE_URL+src+'" width="60" height="60" class="previewimage" /></a></div>').appendTo(this.targetHolder).hide();
823
-
824
- jQuery('#gallery_image_0', context).append("<a class='editButton'>Edit <img src='"+WPSC_CORE_IMAGES_URL+"/pencil.png'/></a>");
825
- jQuery('#gallery_image_0', context).parent('li').addClass('first');
826
- jQuery('#gallery_image_0', context).parent('li').attr('id', 0);
827
- jQuery('#gallery_image_0 img.deleteButton', context).remove();
828
-
829
-
830
- if (jQuery('#gallery_list li', context).size() > 1) {
831
- jQuery('#gallery_list', context).sortable('refresh');
832
- } else {
833
- jQuery('#gallery_list', context).sortable();
834
- }
835
- set = jQuery("#gallery_list", context).sortable('toArray');
836
- order = set.join(',');
837
- prodid = jQuery('#prodid', context).val();
838
-
839
- if(prodid == null) {
840
- prodid = 0;
841
- }
842
-
843
- function imageorderresults(results) {
844
- eval(results);
845
- jQuery('#gallery_image_'+ser).append(output);
846
- enablebuttons();
847
- }
848
-
849
- ajax.post("index.php",imageorderresults,"admin=true&ajax=true&prodid="+prodid+"&imageorder=true&order="+order+"");
850
-
851
-
852
- enablebuttons();
853
-
854
- }
855
- jQuery(this.progressBar).animate({
856
- 'width':'76px'
857
- },250,function () {
858
- jQuery(this).parent().fadeOut(500,function() {
859
- jQuery(this).remove();
860
- jQuery(img).fadeIn('500');
861
- jQuery(img).append('<img class="deleteButton" src="'+WPSC_CORE_IMAGES_URL+'/cross.png" alt="-" style="display: none;"/>');
862
- enablebuttons()
863
- //enableDeleteButton(deleteButton);
864
- });
865
- });
866
- }
867
-
868
- function imageUploadComplete (file) {
869
-
870
- jQuery("div#swfupload_img_indicator").css('display', 'none');
871
- if (jQuery('#gallery_list li').size() > 1)
872
- jQuery('#gallery_list').sortable('refresh');
873
- else
874
- jQuery('#gallery_list').sortable();
875
- }
876
-
877
- function imageQueueComplete (uploads) {
878
-
879
- }
880
-
881
- function enablebuttons(){
882
- jQuery("img.deleteButton").click(
883
- function(){
884
- var r=confirm("Please confirm deletion");
885
- if (r==true) {
886
- img_id = jQuery(this).parent().parent('li').attr('id');
887
- jQuery(this).parent().parent('li').remove();
888
- ajax.post("index.php",noresults,"admin=true&ajax=true&del_img=true&del_img_id="+img_id);
889
- }
890
- }
891
- );
892
-
893
- jQuery("a.delete_primary_image").click(
894
- function(){
895
- var r=confirm("Please confirm deletion");
896
- if (r==true) {
897
- img_id = jQuery(this).parents('li.first').attr('id');
898
- //ajax.post("index.php",noresults,"ajax=true&del_img=true&del_img_id="+img_id);
899
- jQuery(this).parents('li.first').remove();
900
-
901
-
902
-
903
- set = jQuery("#gallery_list").sortable('toArray');
904
- jQuery('#gallery_image_'+set[0]).children('img.deleteButton').remove();
905
- jQuery('#gallery_image_'+set[0]).append("<a class='editButton'>Edit <img src='"+WPSC_CORE_IMAGES_URL+"/pencil.png'/></a>");
906
- jQuery('#gallery_image_'+set[0]).parent('li').addClass('first');
907
- jQuery('#gallery_image_'+set[0]).parent('li').attr('id', 0);
908
- for(i=1;i<set.length;i++) {
909
- jQuery('#gallery_image_'+set[i]).children('a.editButton').remove();
910
- jQuery('#gallery_image_'+set[i]).append("<img alt='-' class='deleteButton' src='"+WPSC_CORE_IMAGES_URL+"/cross.png'/>");
911
-
912
- if(element_id == 0) {
913
- jQuery('#gallery_image_'+set[i]).parent('li').attr('id', img_id);
914
- }
915
- }
916
- order = set.join(',');
917
- prodid = jQuery('#prodid').val();
918
- ajax.post("index.php",imageorderresults,"admin=true&ajax=true&prodid="+prodid+"&imageorder=true&order="+order+"&delete_primary=true");
919
-
920
- jQuery(this).parents('li.first').attr('id', '0');
921
- }
922
- return false;
923
- }
924
- );
925
-
926
- jQuery("div.previewimage").hover(
927
- function () {
928
- jQuery(this).children('img.deleteButton').show();
929
- if(jQuery('#image_settings_box').css('display')!='block')
930
- jQuery(this).children('a.editButton').show();
931
- },
932
- function () {
933
- jQuery(this).children('img.deleteButton').hide();
934
- jQuery(this).children('a.editButton').hide();
935
- }
936
- );
937
-
938
- jQuery("a.editButton").click(
939
- function(){
940
- jQuery(this).hide();
941
- jQuery('#image_settings_box').show('fast');
942
- }
943
- );
944
-
945
- jQuery("a.closeimagesettings").click(
946
- function (e) {
947
- jQuery("div#image_settings_box").hide();
948
- }
949
- );
950
-
951
- function imageorderresults(results) {
952
- eval(results);
953
- jQuery('#gallery_image_'+ser).append(output);
954
- enablebuttons();
955
- }
956
-
957
- jQuery("input.limited_stock_checkbox").click( function () {
958
- parent_form = jQuery(this).parents('form');
959
- if(jQuery(this).is(':checked')) {
960
- jQuery("div.edit_stock",parent_form).show();
961
- jQuery("th.stock, td.stock", parent_form).show();
962
- jQuery(".stock_limit_quantity", parent_form).show();
963
- } else {
964
- jQuery("div.edit_stock", parent_form).hide();
965
- jQuery("th.stock, td.stock", parent_form).hide();
966
- jQuery(".stock_limit_quantity", parent_form).hide();
967
- }
968
- });
969
- }
970
-
971
- function reloadresults(){
972
- window.location = window.location.href;
973
- }
974
-
975
- jQuery(document).ready(function(){
976
- jQuery(".wpsc-row-actions").parent().parent("tr").mouseover(
977
- function() {
978
- jQuery(this).children("td").children(".wpsc-row-actions").css("visibility", "visible");
979
- }
980
- ).mouseout(
981
- function() {
982
- jQuery(this).children("td").children(".wpsc-row-actions").css("visibility", "hidden");
983
- }
984
- );
985
- /*
986
- jQuery(".wpsc-shipping-actions").hide();
987
- jQuery("#wpsc_shipping_options").hover(
988
- function() {
989
- alert('hovering');
990
- jQuery(this).children(".wpsc-shipping-actions").css("visibility", "visible");
991
- }
992
- );
993
- *//*
994
- .mouseout(
995
- function() {
996
- jQuery(this).children(".wpsc-shipping-actions").css("visibility", "hidden");
997
- }
998
- );
999
- */
1000
-
1001
- jQuery("#table_rate_price").click(
1002
- function() {
1003
- if (this.checked) {
1004
- jQuery("#table_rate").slideDown("fast");
1005
- } else {
1006
- jQuery("#table_rate").slideUp("fast");
1007
- }
1008
- }
1009
- );
1010
- jQuery("#add_label").click(
1011
- function(){
1012
- jQuery("#labels").append("<br><table><tr><td>"+TXT_WPSC_LABEL+" :</td><td><input type='text' name='productmeta_values[labels][]'></td></tr><tr><td>"+TXT_WPSC_LABEL_DESC+" :</td><td><textarea name='productmeta_values[labels_desc][]'></textarea></td></tr><tr><td>"+TXT_WPSC_LIFE_NUMBER+" :</td><td><input type='text' name='productmeta_values[life_number][]'></td></tr><tr><td>"+TXT_WPSC_ITEM_NUMBER+" :</td><td><input type='text' name='productmeta_values[item_number][]'></td></tr><tr><td>"+TXT_WPSC_PRODUCT_CODE+" :</td><td><input type='text' name='productmeta_values[product_code][]'></td></tr><tr><td>"+TXT_WPSC_PDF+" :</td><td><input type='file' name='productmeta_values[product_pdf][]'></td></tr></table>");
1013
- }
1014
- );
1015
- jQuery(".add_level").click(
1016
- function() {
1017
- added = jQuery(this).parent().children('table').append('<tr><td><input type="text" size="10" value="" name="productmeta_values[table_rate_price][quantity][]"/> and above</td><td><input type="text" size="10" value="" name="productmeta_values[table_rate_price][table_price][]"/></td></tr>');
1018
- }
1019
- );
1020
-
1021
- jQuery(".file_delete_button").click(
1022
- function() {
1023
- jQuery(this).parent().remove();
1024
- file_hash = jQuery(this).siblings("input").val();
1025
- ajax.post("index.php",noresults,"admin=true&ajax=true&del_file=true&del_file_hash="+file_hash);
1026
- }
1027
- );
1028
-
1029
- jQuery("table#itemlist .pricedisplay").each(
1030
- function () {
1031
- jQuery(this).attr("id",jQuery(this).parent().attr('id'));
1032
- }
1033
- );
1034
-
1035
- jQuery("#submit_category_select").click(
1036
- function() {
1037
- new_url = jQuery("#category_select").children("option:selected").val();
1038
- window.location = new_url;
1039
- }
1040
- );
1041
- });
1042
-
1043
-
1044
-
1045
- function wpsc_upload_switcher(target_state) {
1046
- switch(target_state) {
1047
- case 'flash':
1048
- jQuery("table.browser-image-uploader").css("display","none");
1049
- jQuery("table.flash-image-uploader").css("display","block");
1050
- ajax.post("index.php",noresults,"admin=true&ajax=true&save_image_upload_state=true&image_upload_state=1");
1051
- break;
1052
-
1053
- case 'browser':
1054
- jQuery("table.flash-image-uploader").css("display","none");
1055
- jQuery("table.browser-image-uploader").css("display","block");
1056
- ajax.post("index.php",noresults,"admin=true&ajax=true&save_image_upload_state=true&image_upload_state=0");
1057
- break;
1058
- }
1059
- }
1060
-
1061
-
1062
-
1063
- function open_variation_settings(element_id) {
1064
- jQuery("tr#"+element_id+" td div.variation_settings").toggle();
1065
- return false;
1066
- }
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
trunk/wpsc-admin/js/admin.js DELETED
@@ -1,665 +0,0 @@
1
- /*global ajaxurl, WPSC_Term_List_Levels, validateForm, tb_remove, alert, setUserSetting, wpsc_adminL10n, typenow, adminpage */
2
- (function($){
3
- /**
4
- * Wrapper for $.post. Takes care of the 'wpsc_action' and 'action' data arguments.
5
- *
6
- * @since 3.8.9
7
- * @param {object} data Data to pass to the AJAX destination
8
- * @param {function} handler Response handler
9
- */
10
- $.wpsc_post = function(data, handler) {
11
- data.wpsc_action = data.action;
12
- data.action = 'wpsc_ajax';
13
-
14
- return $.post( ajaxurl, data, handler, 'json' );
15
- };
16
-
17
- /**
18
- * Wrapper for $.get. Takes care of the 'wpsc_action' and 'action' data arguments.
19
- *
20
- * @since 3.8.9
21
- * @param {object} data Data to pass to the AJAX destination
22
- * @param {function} handler Response handler
23
- */
24
- $.wpsc_get = function(data, handler) {
25
- data.wpsc_action = data.action;
26
- data.action = 'wpsc_ajax';
27
-
28
- return $.get( ajaxurl, data, handler, 'json' );
29
- };
30
-
31
- var pagenow = pagenow || '';
32
-
33
- function category_sort(){
34
- var order = $(this).sortable('toArray'),
35
- data = {
36
- action: 'category_sort_order',
37
- sort_order: order,
38
- parent_id: 0
39
- };
40
-
41
- jQuery.post( ajaxurl, data );
42
- }
43
-
44
- var submit_handlers = [];
45
-
46
- var disable_ajax_submit = function() {
47
- var t = $('#submit');
48
-
49
- if ( t.data( 'events' ) ) {
50
- submit_handlers = t.data('events').click;
51
- }
52
-
53
- t.off( 'click' );
54
-
55
- t.on('click', function() {
56
- var form = $(this).parents('form');
57
- if ( ! validateForm( form ) ) {
58
- return false;
59
- }
60
- });
61
- };
62
-
63
- var restore_ajax_submit = function() {
64
- var t = $('#submit');
65
- t.off('click');
66
- $.each(submit_handlers, function(index, obj) {
67
- t.on('click', obj.handler);
68
- });
69
- };
70
-
71
- $(function(){
72
-
73
- if ( 'undefined' === typeof WPSC_Term_List_Levels || pagenow !== 'edit-wpsc_product_category' ) {
74
- return;
75
- }
76
-
77
- var table = $('body.edit-tags-php .wp-list-table');
78
- table.find('tbody tr').each(function(){
79
- var t = $(this),
80
- id = t.attr('id').replace(/[^0-9]+/g, '');
81
- t.data('level', WPSC_Term_List_Levels[id]);
82
- t.data('id', id);
83
- });
84
- table.wpsc_sortable_table({
85
- stop : category_sort
86
- });
87
-
88
- $('[name="image"]').on('change', function() {
89
- var t = $(this);
90
-
91
- if ( t.val() ) {
92
- disable_ajax_submit();
93
- } else {
94
- restore_ajax_submit();
95
- }
96
- });
97
- });
98
-
99
- $(function() {
100
- $('.wpsc_select_all').click(function(){
101
- $('input:checkbox', $(this).parent().siblings('.multiple-select') ).each(function(){ this.checked = true; });
102
- return false;
103
- });
104
- $('.wpsc_select_none').click(function(){
105
- $('input:checkbox', $(this).parent().siblings('.multiple-select') ).each(function(){ this.checked = false; });
106
- return false;
107
- });
108
- });
109
-
110
- $(document).on( 'click', 'form input.prdfil', function(){
111
- var t = $(this);
112
- var post_data = {
113
- 'select_product_file[]' : [],
114
- product_id : t.parent('form.product_upload').find('input#hidden_id').val(),
115
- nonce : t.data('nonce'),
116
- action : 'upload_product_file'
117
- };
118
-
119
- var products = jQuery(this).parent( 'form.product_upload' ).find( 'input' ).serializeArray();
120
-
121
- for (var index in products) {
122
- post_data['select_product_file[]'].push(products[index].value);
123
- }
124
-
125
- jQuery.wpsc_post(post_data, function(response){
126
- tb_remove();
127
- if (! response.is_successful) {
128
- alert(response.error.messages.join( ' ' ));
129
- return;
130
- }
131
- jQuery('#wpsc_product_download_forms .select_product_file tbody').append(response.obj.content).
132
- find('p.no-item').hide().end().
133
- find('p:even').removeClass('alt').end().
134
- find('p:odd').addClass('alt');
135
- });
136
- return false;
137
- });
138
-
139
- // delete upload
140
- $(document).on( 'click', '.file_delete_button', function(){
141
- var t = $(this),
142
- post_values = {
143
- action : 'delete_file',
144
- file_name : t.data('file-name'),
145
- product_id : t.data('product-id'),
146
- nonce : t.data('nonce')
147
- },
148
- response_handler = function(response) {
149
- if (! response.is_successful) {
150
- alert(response.error.messages.join( ' ' ));
151
- return;
152
- }
153
-
154
- t.closest('.wpsc_product_download_row').fadeOut('fast', function() {
155
- $('div.select_product_file p:even').removeClass('alt');
156
- $('div.select_product_file p:odd').addClass('alt');
157
- $(this).remove();
158
- });
159
- };
160
-
161
- $.wpsc_post( post_values, response_handler);
162
-
163
- return false;
164
- });
165
- }(jQuery));
166
-
167
- jQuery(document).ready(function($){
168
-
169
- $('.ui-sortable li .list_gallery_image').mouseover(function(){
170
- $('.product_gallery_image_delete_button', $(this).parent()).show();
171
- }).mouseout(function(){
172
- $('.product_gallery_image_delete_button', $(this).parent()).hide();
173
- });
174
-
175
- $('.product_gallery_image_delete_button').click(function(){
176
- var product_gallery_image_data = {
177
- action: 'product_gallery_image_delete',
178
- product_gallery_image_id: $(this).parent().parent().find('.product_gallery_image_id').val(),
179
- product_gallery_post_id: $(this).parent().parent().find('.product_gallery_post_id').val(),
180
- wpsc_gallery_nonce_check: $('.nonce_class').val()
181
- };
182
- $.post(ajaxurl, product_gallery_image_data, function(){});
183
- $(this).parent().parent().fadeOut( 'slow' );
184
- });
185
-
186
- $( document ).on( 'wp-collapse-menu', function() {
187
-
188
- if ( $( 'body' ).hasClass( 'folded' ) ) {
189
- $( 'body' ).removeClass( 'folded' );
190
- setUserSetting('mfold', 'o');
191
- } else {
192
- $( 'body' ).addClass( 'folded' );
193
- setUserSetting('mfold', 'f');
194
- }
195
- } );
196
-
197
- $( '#wpsc_price' ).on( 'change', wpsc_update_price_live_preview );
198
- $( '#wpsc_sale_price' ).on( 'change', wpsc_update_price_live_preview );
199
-
200
- jQuery('td.hidden_alerts img').each(function(){
201
- var t = jQuery(this);
202
- t.appendTo(t.parents('tr').find('td.column-title strong'));
203
- });
204
-
205
-
206
- jQuery( '#stock_limit_quantity' ).change( function(){
207
- wpsc_push_v2t( '#stock_limit_quantity', '#wpsc_product_stock_metabox_live_title > p > span' );
208
- });
209
-
210
- jQuery( 'em.wpsc_metabox_live_title' ).each( function() {
211
- var $em = jQuery( this ), $parent = $em.parents( 'div.postbox' ), $h3 = $parent.find( 'h3' );
212
- $em.appendTo( $h3 );
213
-
214
- });
215
-
216
- /* Coupon edit functionality */
217
- jQuery('.modify_coupon').hide();
218
- jQuery('.wpsc_edit_coupon').click(function(){
219
- var id;
220
- id = jQuery(this).attr('rel');
221
- id = 'coupon_box_'+id;
222
- if(jQuery('#'+id).hasClass('displaynone')){
223
- jQuery('#'+id).show();
224
- jQuery('#'+id).removeClass('displaynone');
225
- }else{
226
- jQuery('#'+id).addClass('displaynone');
227
- jQuery('#'+id).hide();
228
- }
229
-
230
- });
231
- jQuery('form[name="add_coupon"]').submit(function() {
232
- var title = jQuery('form[name="add_coupon"] input[name="add_coupon_code"]').val();
233
- if ( title === '' ) {
234
- jQuery('<div id="notice" class="error"><p>' + wpsc_adminL10n.empty_coupon + '</p></div>').insertAfter('div.wrap > h2').delay(2500).hide(350);
235
- return false;
236
- }
237
- });
238
-
239
- /*
240
- Alternative Currencies
241
- Trigger and handle UI events for adding and removing currency layers.
242
- */
243
-
244
- var currencyRowTemplate = jQuery( '.wpsc-currency-layers tr.template' ).remove().removeClass( 'template hidden' ).removeAttr( 'id' );
245
-
246
- // Hide table if empty
247
- if ( jQuery( '.wpsc-currency-layers tbody tr' ).length === 0 ) {
248
- jQuery( '.wpsc-currency-layers table' ).hide();
249
- }
250
-
251
- // Add new currency layer
252
- jQuery( '.wpsc-currency-layers' ).on( 'click', 'a.wpsc_add_new_currency', function( e ) {
253
- jQuery( this ).siblings( 'table' ).show();
254
- jQuery( '.wpsc-currency-layers tbody' ).append( currencyRowTemplate.clone() );
255
- e.preventDefault();
256
- });
257
-
258
- // Delete currency layer in admin product page
259
- jQuery( '.wpsc-currency-layers' ).on( 'click', 'a.wpsc_delete_currency_layer', function( e ) {
260
- var currencyRow = jQuery( this ).closest( 'tr' );
261
- currencyRow.find( 'input' ).val( '' );
262
- currencyRow.find( 'select' ).val( '' );
263
- if ( currencyRow.siblings().length === 0 ) {
264
- currencyRow.closest( 'table' ).hide();
265
- }
266
- currencyRow.remove();
267
- e.preventDefault();
268
- });
269
-
270
- /*
271
- Quantity Discounts
272
- Trigger and handle UI events for adding and removing quantity dicounts.
273
- */
274
-
275
- var qtyRowTemplate = jQuery( '.wpsc-quantity-discounts tr.template' ).remove().removeClass( 'template hidden' ).removeAttr( 'id' );
276
-
277
- // Hide table if empty
278
- if ( jQuery( '.wpsc-quantity-discounts tbody tr' ).length === 0 ) {
279
- jQuery( '.wpsc-quantity-discounts table' ).hide();
280
- }
281
-
282
- // Add new row to rate table
283
- jQuery( '.wpsc-quantity-discounts' ).on( 'click', '.add_level', function( e ) {
284
- jQuery( this ).siblings( 'table' ).show();
285
- jQuery( '.wpsc-quantity-discounts tbody' ).append( qtyRowTemplate.clone() );
286
- e.preventDefault();
287
- });
288
-
289
- // Remove a row from rate table
290
- jQuery( '.wpsc-quantity-discounts' ).on( 'click', '.remove_line', function( e ) {
291
- var qtyRow = jQuery( this ).closest( 'tr' );
292
- qtyRow.find( 'input' ).val( '' );
293
- if ( qtyRow.siblings().length === 0 ) {
294
- qtyRow.closest( 'table' ).hide();
295
- }
296
- qtyRow.remove();
297
- e.preventDefault();
298
- });
299
-
300
- /*
301
- As far as I can tell, WP provides no good way of unsetting elements in the bulk edit area...
302
- tricky jQuery action will do for now....not ideal whatsoever, nor eternally stable.
303
- */
304
- var pagenow = pagenow || '';
305
-
306
- if( pagenow === 'edit-wpsc-product' ) {
307
- jQuery('.inline-edit-password-input').closest('.inline-edit-group').css('display', 'none');
308
- var vcl = jQuery('.inline-edit-col input[name="tax_input[wpsc-variation][]"]').css('display', 'none');
309
- vcl.each(function(){
310
- jQuery(this).prev().css('display', 'none');
311
- jQuery(this).next().css('display', 'none');
312
- jQuery(this).css('display', 'none');
313
- });
314
- jQuery('#bulk-edit select[name=post_parent]').closest('fieldset').css('display', 'none');
315
- jQuery('.inline-edit-col select[name=post_parent]').parent().css('display', 'none');
316
- jQuery('.inline-edit-status').parent().css('display', 'none');
317
- }
318
- if ( wpsc_adminL10n.dragndrop_set === 'true' && typenow === 'wpsc-product' && adminpage === 'edit-php' ) {
319
- // this makes the product list table sortable
320
- jQuery('table.widefat:not(.tags)').sortable({
321
- update: function() {
322
- var category_id = jQuery('select#wpsc_product_category option:selected').val(),
323
- product_order = jQuery('table.widefat').sortable( 'toArray' ),
324
- post_data = {
325
- action : 'save_product_order',
326
- 'category_id' : category_id,
327
- 'post[]' : product_order,
328
- nonce : wpsc_adminL10n.save_product_order_nonce
329
- };
330
- jQuery.wpsc_post(post_data, function(response) {
331
- if (! response.is_successful) {
332
- alert(response.error.messages.join( ' ' ));
333
- }
334
- });
335
- },
336
- items: 'tbody tr',
337
- axis: 'y',
338
- containment: 'table.widefat tbody',
339
- placeholder: 'product-placeholder',
340
- cursor: 'move',
341
- cancel: 'tr.inline-edit-wpsc-product'
342
- });
343
- }
344
-
345
- var limited_stock_checkbox = jQuery('input.limited_stock_checkbox');
346
- var toggle_stock_fields = function(checked) {
347
- jQuery('div.edit_stock').toggle(checked);
348
- jQuery('th.column-stock input, td.stock input').each(function(){
349
- this.disabled = ! checked;
350
- });
351
- };
352
-
353
- if (limited_stock_checkbox.length > 0) {
354
- toggle_stock_fields(limited_stock_checkbox.is(':checked'));
355
- }
356
-
357
- // show or hide the stock input forms
358
- limited_stock_checkbox.on('click', function () {
359
- toggle_stock_fields(limited_stock_checkbox.is(':checked'));
360
- });
361
-
362
- jQuery( '#custom_tax_checkbox' ).on( 'click', function(){
363
- if (this.checked) {
364
- jQuery('#custom_tax').show();
365
- } else {
366
- jQuery('#custom_tax input').val('');
367
- jQuery('#custom_tax').hide();
368
- }
369
- });
370
-
371
- jQuery( '.wpsc_featured_product_toggle' ).on( 'click', function(){
372
- var post_values = {
373
- product_id : jQuery( this ).parents( 'tr' ).attr( 'id' ).replace( 'post-', '' ),
374
- action : 'update_featured_product'
375
- };
376
-
377
- jQuery.post( ajaxurl, post_values, function( response ) {
378
- jQuery( '.featured_toggle_' + response.product_id ).html( '<img class="' + response.color + '" src="' + response.image + '" alt="' + response.text + '" title="' + response.text + '" />' );
379
- }, 'json' );
380
-
381
- return false;
382
- });
383
-
384
- jQuery( 'div.coupon-condition' ).each( function() {
385
- if( jQuery( 'select[name="rules[operator][]"]', jQuery( this ) ).length !== 0 ) {
386
- var margin = jQuery( 'select.ruleprops', jQuery( this ) ).offset().left - jQuery( this ).offset().left;
387
- margin = parseInt( margin, 10 ) - 1;
388
- jQuery( 'select[name="rules[operator][]"]', jQuery( this ) ).css( 'margin-left', '-' + margin + 'px' );
389
- }
390
- });
391
-
392
- jQuery( '.coupon-conditions' ).on( 'click', '.wpsc-button-plus', function() {
393
- var parent = jQuery( this ).closest( '.coupon-condition' ),
394
- prototype = parent.clone(),
395
- operator_box = jQuery('<select/>',{name:'rules[operator][]'});
396
-
397
- if ( jQuery( 'select[name="rules[operator][]"]', prototype ).length === 0 ) {
398
- operator_box.append('<option value="and">' + wpsc_adminL10n.coupons_compare_and + '</option>');
399
- operator_box.append('<option value="or">' + wpsc_adminL10n.coupons_compare_or + '</option>');
400
- prototype.prepend(operator_box);
401
- }
402
-
403
- prototype.find('select').val('');
404
- prototype.find('input').val('');
405
- prototype.css( { 'opacity' : '0' } );
406
- prototype.insertAfter(parent);
407
-
408
- var margin = jQuery( 'select.ruleprops', prototype ).offset().left - prototype.offset().left;
409
- margin = parseInt( margin, 10 ) - 1;
410
- prototype.find('input').focus();
411
-
412
- prototype.animate( { opacity: 1, 'margin-left': '-' + margin + 'px', height: 'show' }, 150 );
413
-
414
- return false;
415
- });
416
-
417
- jQuery('.coupon-conditions').on( 'click', '.wpsc-button-minus', function() {
418
- var parent = jQuery(this).closest('.coupon-condition'),
419
- conditions_count = jQuery('.coupon-condition').length,
420
- prototype;
421
-
422
- if ( jQuery( this ).index( jQuery( '.wpsc-button-minus' ) ) === 0 ) {
423
- return false;
424
- }
425
-
426
- if ( conditions_count === 1 ) {
427
- prototype = parent.clone();
428
- prototype.find('select').val('');
429
- prototype.find('input').val('');
430
- prototype.hide();
431
- jQuery('.coupon-conditions').find('td').prepend(prototype);
432
- parent.slideUp(150, function(){
433
- prototype.slideDown(150);
434
- parent.remove();
435
- });
436
-
437
- return false;
438
- }
439
-
440
- parent.slideUp(150, function(){
441
- parent.remove();
442
- });
443
-
444
- return false;
445
- });
446
-
447
- jQuery( '#wpsc_product_details_forms .category-tabs a, #wpsc_product_delivery_forms .category-tabs a' ).click(function(event){
448
- var $this = jQuery(this), href = $this.attr('href');
449
-
450
- $this.closest('ul').find('li').removeClass('tabs');
451
- $this.closest('li').addClass('tabs');
452
- $this.closest('div').find('.tabs-panel').hide();
453
- jQuery(href).show();
454
- event.preventDefault();
455
- });
456
-
457
- // Meta table
458
- var meta_inp_tem = jQuery('#wpsc_new_meta_template').remove().removeAttr('id');
459
-
460
- jQuery('#wpsc_add_custom_meta').click(function(){
461
- if ( jQuery( 'tr.no-meta' ).is( ':visible' ) ) {
462
- jQuery( 'tr.no-meta' ).hide();
463
- }
464
-
465
- jQuery('#wpsc_product_meta_table tbody').append(meta_inp_tem.clone());
466
- event.preventDefault();
467
- });
468
-
469
- // Init delivery metabox live title
470
- if (jQuery('#wpsc_product_delivery_forms').length > 0){
471
- jQuery('#wpsc_product_delivery_forms input, #wpsc_product_delivery_forms select').change(wpsc_update_delivery_metabox_live_title);
472
- wpsc_update_delivery_metabox_live_title();
473
- }
474
-
475
- // Init product details metabox live title
476
- if (jQuery('#wpsc_product_details_forms').length > 0){
477
- jQuery('#wpsc_product_details_forms a').click(wpsc_update_product_details_metabox_live_title);
478
- wpsc_update_product_details_metabox_live_title();
479
- }
480
-
481
- wpsc_update_price_live_preview();
482
- });
483
-
484
-
485
- // Remove new/empty custom meta input row
486
- function wpsc_remove_empty_meta( caller ) {
487
- jQuery(caller).closest('tr').remove();
488
-
489
- wpsc_update_product_details_metabox_live_title();
490
-
491
- if ( ! jQuery( '#wpsc_product_meta_table tbody tr' ).not( '.no-meta' ).length ) {
492
- jQuery( 'tr.no-meta' ).show();
493
- }
494
-
495
- event.preventDefault();
496
- }
497
-
498
- // function for removing custom meta
499
- function wpsc_remove_custom_meta(caller, meta_id) {
500
- var post_data = {
501
- action : 'remove_product_meta',
502
- 'meta_id' : meta_id,
503
- nonce : jQuery(caller).data('nonce')
504
- };
505
-
506
- var response_handler = function(response) {
507
- if (! response.is_successful) {
508
- alert(response.error.messages.join( ' ' ));
509
- return;
510
- }
511
- jQuery(caller).closest('tr').remove();
512
- };
513
-
514
- jQuery.wpsc_post(post_data, response_handler);
515
- wpsc_update_product_details_metabox_live_title();
516
-
517
- if ( ! jQuery( '#wpsc_product_meta_table tbody tr' ).not( '.no-meta' ).length ) {
518
- jQuery( 'tr.no-meta' ).show();
519
- }
520
-
521
- event.preventDefault();
522
- }
523
-
524
- // Copy value of caller to target text
525
- function wpsc_push_v2t(caller, target_slt){
526
- jQuery(target_slt).text(jQuery(caller).val());
527
- }
528
-
529
- function wpsc_update_price_live_preview(){
530
- var price = jQuery('#wpsc_price').val();
531
- var sale_price = jQuery('#wpsc_sale_price').val();
532
-
533
- if (sale_price > 0){
534
- jQuery('#wpsc_product_price_metabox_live_title>p>span').text(sale_price);
535
- jQuery('#wpsc_product_price_metabox_live_title>del>span').text(price);
536
- jQuery('#wpsc_product_price_metabox_live_title>del').show();
537
- } else {
538
- jQuery('#wpsc_product_price_metabox_live_title>p>span').text(price);
539
- jQuery('#wpsc_product_price_metabox_live_title>del').hide();
540
- }
541
- }
542
-
543
- // Compose and update live title for shipping metabox
544
- function wpsc_update_delivery_metabox_live_title(){
545
-
546
- if ( ! jQuery('#wpsc_product_delivery_forms').length ) {
547
- return;
548
- }
549
-
550
- var weight = jQuery('#wpsc-product-shipping-weight').val();
551
- var weight_unit = jQuery('#wpsc-product-shipping-weight-unit').val();
552
- var length = jQuery('#wpsc-product-shipping-length').val();
553
- var width = jQuery('#wpsc-product-shipping-width').val();
554
- var height = jQuery('#wpsc-product-shipping-height').val();
555
- var dimensions_unit = jQuery('#wpsc-product-shipping-dimensions-unit').val();
556
- var number_of_downloads = jQuery('.wpsc_product_download_row').length;
557
-
558
- var vol = Math.round( ( length * width * height ) * 100) / 100; // Round up to two decimal
559
- var downloads_name = ( number_of_downloads !== 1 ) ? wpsc_adminL10n.meta_downloads_plural : wpsc_adminL10n.meta_downloads_singular;
560
- var output = '';
561
-
562
- if ( jQuery( '.wpsc-product-shipping-section' ).length ) {
563
- output += weight + ' ' + weight_unit + ', ' + vol + ' ' + dimensions_unit + '<sup>3</sup>, ';
564
- }
565
-
566
- output += number_of_downloads + downloads_name;
567
-
568
- jQuery( '#wpsc_product_delivery_metabox_live_title > p' ).html( output );
569
- }
570
-
571
- function wpsc_update_product_details_metabox_live_title(){
572
- if ( jQuery('#wpsc_product_details_forms').length <= 0 ){
573
- return;
574
- }
575
-
576
- var number_of_photos = jQuery('#wpsc_product_gallery img').length;
577
- var number_of_meta = jQuery('#wpsc_product_meta_table tbody tr').not('.no-meta').length;
578
-
579
- var output = number_of_photos + ' images, ';
580
- output += number_of_meta + ' metadata';
581
-
582
- jQuery('#wpsc_product_details_metabox_live_title>p').html(output);
583
- }
584
-
585
- function wpsc_update_product_gallery_tab(obj){
586
- var output, url;
587
-
588
- output = '<div id="wpsc_product_gallery">';
589
- output += '<ul>';
590
-
591
- for (var i = 0; i < obj.length; i++) {
592
-
593
- if ( 'undefined' !== typeof obj[i].sizes.thumbnail ) {
594
- url = obj[i].sizes.thumbnail.url;
595
- } else {
596
- url = obj[i].sizes.full.url;
597
- }
598
-
599
- output += '<li>';
600
- output += '<img src="' + url + '">';
601
- output += '<input type="hidden" name="wpsc-product-gallery-imgs[]" value="' + obj[i].id + '">';
602
-
603
- output += '</li>';
604
- }
605
-
606
- output += '</ul>';
607
- output += '<div class="clear"></div>';
608
- output += '</div>';
609
-
610
- jQuery('#wpsc_product_gallery').replaceWith(output);
611
- wpsc_update_product_details_metabox_live_title();
612
- }
613
-
614
- var prevElement = null;
615
- var prevOption = null;
616
-
617
- function hideOptionElement(id, option) {
618
- if (prevOption === option) {
619
- return;
620
- }
621
- if (prevElement !== null) {
622
- prevElement.style.display = 'none';
623
- }
624
-
625
- if (id === null) {
626
- prevElement = null;
627
- } else {
628
- prevElement = document.getElementById(id);
629
- jQuery('#'+id).css( 'display','block');
630
- }
631
- prevOption = option;
632
- }
633
-
634
- function hideelement(id) {
635
- var state = document.getElementById(id).style.display;
636
- if(state !== 'block') {
637
- document.getElementById(id).style.display = 'block';
638
- } else {
639
- document.getElementById(id).style.display = 'none';
640
- }
641
- }
642
-
643
- function getcurrency() {
644
- //ajax.post("index.php",gercurrency,"wpsc_admin_action=change_currency&currencyid="+id);
645
- }
646
-
647
- function hideelement1(id, item_value) {
648
- if(item_value === 5) {
649
- jQuery(document.getElementById(id)).css('display', 'block');
650
- } else {
651
- jQuery(document.getElementById(id)).css('display', 'none');
652
- }
653
- }
654
-
655
- function show_status_box(id,image_id) {
656
- var state = document.getElementById(id).style.display;
657
- if(state !== 'block') {
658
- document.getElementById(id).style.display = 'block';
659
- document.getElementById(image_id).src = wpsc_adminL10n.wpsc_core_images_url + '/icon_window_collapse.gif';
660
- } else {
661
- document.getElementById(id).style.display = 'none';
662
- document.getElementById(image_id).src = wpsc_adminL10n.wpsc_core_images_url + '/icon_window_expand.gif';
663
- }
664
- return false;
665
- }
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
trunk/wpsc-admin/js/media.js DELETED
@@ -1,401 +0,0 @@
1
- /*global _, WPSC_Media, Backbone, alert, WPSC, wp, wpsc_refresh_variation_iframe, wpsc_set_variation_product_thumbnail, jQuery, WPRemoveThumbnail */
2
- (function($) {
3
- "use strict";
4
- window.WPSC = window.WPSC || {};
5
-
6
- /**
7
- * Inspired by Cocktail (https://github.com/onsi/cocktail/) but with some
8
- * important modifications.
9
- *
10
- * Mixing an object into a class' prototype will make sure that object is
11
- * extended from previous Mixins / oroginal prototype.
12
- *
13
- * Primitive values can also be mixed in.
14
- *
15
- * @param {Object} object The original object
16
- * @param {...Object} mixins Mixins
17
- */
18
- window.WPSC.mixin = function( clss ) {
19
- var modules = _.rest( arguments );
20
- var chain = {};
21
-
22
- _.each( modules, function( module ) {
23
- var override = module._mixin_override || [];
24
- module = _.omit( module, [ '_mixin_override'] );
25
-
26
- _.each( module, function( value, key ) {
27
- if ( _.contains( override, key ) ) {
28
- chain[key] = [value];
29
- return;
30
- }
31
-
32
- if ( _.isFunction( value ) ) {
33
- if ( clss.prototype[key] )
34
- chain[key] = [clss.prototype[key]];
35
-
36
- chain[key].push( value );
37
- } else if ( _.isObject( value ) ) {
38
- chain[key] = chain[key] || [{}];
39
- if ( clss.prototype[key] )
40
- chain[key] = [clss.prototype[key]];
41
-
42
- chain[key].push( _.extend( {}, chain[key][0], value ) );
43
- } else {
44
- chain[key] = chain[key] || [];
45
- chain[key].push( value );
46
- }
47
- } );
48
- } );
49
-
50
- _.each( chain, function( values, key ) {
51
- var last = _.last( values );
52
-
53
- if ( ! _.isFunction( last ) ) {
54
- clss.prototype[key] = last;
55
- return;
56
- }
57
-
58
- clss.prototype[key] = function() {
59
- var ret, args = arguments, that = this;
60
- _.each( values, function( fn ) {
61
- var fnRet = fn.apply( that, args );
62
- ret =
63
- _.isUndefined( fnRet ) ?
64
- ret :
65
- fnRet;
66
- });
67
-
68
- return ret;
69
- };
70
- } );
71
- };
72
-
73
- var media = window.wp.media;
74
-
75
- var backup = _.clone( media.view.settings.post );
76
-
77
- media.controller.wpsc = {
78
- ProductGallery: media.controller.Library.extend({
79
- defaults: _.defaults({
80
- id : 'wpsc-product-gallery',
81
- filterable : 'uploaded',
82
- multiple : 'add',
83
- toolbar : 'wpsc-save-gallery',
84
- title : WPSC_Media.l10n.productMediaTitle,
85
- priority : 50,
86
- library : media.query( { type: 'image' } ),
87
- syncSelection: false
88
- }, media.controller.Library.prototype.defaults ),
89
-
90
- initialize: function( options ) {
91
- options = options || {};
92
- var selection = new media.model.wpsc.ProductGallerySelection(
93
- [],
94
- {
95
- postId: media.model.settings.post.id,
96
- multiple: this.get( 'multiple' ),
97
- updateNonce: options.updateNonce || WPSC_Media.updateGalleryNonce,
98
- getNonce: options.getNonce || WPSC_Media.getGalleryNonce
99
- }
100
- );
101
- this.set(
102
- 'selection',
103
- selection
104
- );
105
-
106
- var models = options.models || WPSC_Media.gallery;
107
-
108
- // work around for backbone.js 0.9.2
109
- if ( _.isUndefined( Backbone.Collection.prototype.set ) ) {
110
- // force parse the response
111
- models = selection.parse( models );
112
- selection.reset( models );
113
- } else {
114
- selection.set( models, { parse: true } );
115
- }
116
-
117
- media.controller.Library.prototype.initialize.apply( this, arguments );
118
-
119
- this.on( 'select', function() {
120
- selection.save_gallery();
121
- } );
122
-
123
- this.on( 'reset', function() {
124
- selection.get_gallery();
125
- }) ;
126
-
127
- this.get( 'library' ).observe( selection );
128
- }
129
- })
130
- };
131
-
132
- media.model.wpsc = {
133
- ProductGallerySelection: media.model.Selection.extend( {
134
- initialize: function( models, options ) {
135
- media.model.Selection.prototype.initialize.apply( this, [models, options] );
136
- this.postId = options && options.postId;
137
- this.updateNonce = options.updateNonce || WPSC_Media.updateGalleryNonce;
138
- this.getNonce = options.getNonce || WPSC_Media.getGalleryNonce;
139
- },
140
-
141
- save_gallery: function( options ) {
142
- options = _.extend( options || {}, {
143
- data: {
144
- items: this.pluck( 'id' )
145
- },
146
- success: function( resp, status, xhr ) {
147
- // in case of backbone 0.9.2
148
- if ( _.isUndefined( this.set ) ) {
149
- // force parse the response
150
- resp.obj = this.parse( resp.obj, xhr );
151
- this.reset( resp.obj );
152
- } else {
153
- this.set( resp.obj, { parse: true } );
154
- }
155
-
156
- wpsc_update_product_gallery_tab(resp.obj);
157
- },
158
- error: function( resp ) {
159
- alert( resp.error.messages.join( "\n" ) );
160
- }
161
- } );
162
- this.sync( 'update', this, options );
163
- },
164
-
165
- get_gallery: function( options ) {
166
- options = _.extend( options || {}, {
167
- success: function( resp, status, xhr ) {
168
- // in case of backbone 0.9.2
169
- if ( _.isUndefined( this.set ) ) {
170
- // force parse the response
171
- resp.obj = this.parse( resp.obj, xhr );
172
- this.reset( resp.obj );
173
- } else {
174
- this.set( resp.obj, { parse: true } );
175
- }
176
- wpsc_refresh_variation_iframe();
177
- },
178
- error: function( resp ) {
179
- alert( resp.error.messages.join( "\n" ) );
180
- }
181
- } );
182
- this.sync( 'read', this, options );
183
- },
184
-
185
- sync: function( method, collection, options ) {
186
-
187
- var data;
188
- options = options ? _.clone( options ) : {};
189
-
190
- options.success = _.bind( options.success, this );
191
- options.error = _.bind( options.error, this );
192
-
193
- switch (method) {
194
- case 'read':
195
- options.data = options.data || {};
196
- data = _.defaults( {
197
- action: 'get_product_gallery',
198
- nonce : this.getNonce,
199
- postId: this.postId
200
- }, options.data );
201
- break;
202
-
203
- case 'update':
204
- options.data = options.data || {};
205
- data = _.defaults( {
206
- action: 'save_product_gallery',
207
- nonce : this.updateNonce,
208
- items : this.pluck( 'id' ),
209
- postId: this.postId
210
- }, options.data );
211
-
212
- break;
213
-
214
- case 'create':
215
- case 'delete':
216
- // do nothing for now
217
- break;
218
- }
219
-
220
- $.wpsc_post( data ).done( function( resp, status, xhr ) {
221
- if ( resp.is_successful ) {
222
- options.success( resp, status, xhr );
223
- } else {
224
- options.error( resp, status, xhr );
225
- }
226
- } );
227
- }
228
- } )
229
- };
230
-
231
- media.view.wpsc = {
232
- };
233
-
234
- /**
235
- * Extend the MediaFrame.Post class so that we can inject a custom tab
236
- * dynamically using JavaScript.
237
- */
238
- WPSC.mixin(
239
- media.view.MediaFrame.Post,
240
- {
241
- wpsc: {
242
- saveGalleryStatusBar: function( view ) {
243
- this.selectionStatusToolbar(view);
244
- },
245
- saveGalleryToolbar: function( toolbar ) {
246
- this.createSelectToolbar( toolbar, {
247
- text : WPSC_Media.l10n.saveGallery,
248
- state: this.options.state,
249
- reset: false
250
- } );
251
- },
252
- createStates: function() {
253
- this.states.add( new media.controller.wpsc.ProductGallery( { models: this.options.models, updateNonce: this.options.updateNonce, getNonce: this.options.getNonce } ) );
254
- },
255
- bindHandlers: function() {
256
- this.on( 'toolbar:create:wpsc-save-gallery', this.wpsc.saveGalleryToolbar, this );
257
- this.on( 'toolbar:render:wpsc-save-gallery', this.wpsc.saveGalleryStatusBar, this );
258
- }
259
- },
260
-
261
- initialize: function() {
262
- if ( ! this.options.models )
263
- this.options.models = WPSC_Media.gallery;
264
-
265
- if ( ! this.options.updateNonce )
266
- this.options.updateNonce = WPSC_Media.updateGalleryNonce;
267
-
268
- if ( ! this.options.getNonce )
269
- this.options.getNonce = WPSC_Media.getGalleryNonce;
270
-
271
- this.wpsc.createStates.apply( this );
272
- this.wpsc.bindHandlers.apply( this );
273
- }
274
- }
275
- );
276
-
277
- /**
278
- * Extend media.view.Attachment
279
- */
280
- WPSC.mixin(
281
- media.view.Attachment,
282
- {
283
- render: function() {
284
- if ( this.controller.state().id != 'wpsc-product-gallery' )
285
- return;
286
-
287
- if ( this.model.id != media.view.settings.post.featuredImageId )
288
- return;
289
-
290
- this.$el.find( '.thumbnail' ).append('<span class="wpsc-featured-label">featured</span>');
291
- }
292
- }
293
- );
294
-
295
- WPSC_Media.open = function( options ) {
296
- var workflow;
297
-
298
- media.view.settings.post.id = options.id;
299
- media.view.settings.post.featuredImageId = options.featuredId;
300
- media.view.settings.post.nonce = options.featuredNonce;
301
- media.model.settings.post = media.view.settings.post;
302
- media.editor.remove( 'wpsc-variation-media' );
303
- media.editor.add( 'wpsc-variation-media', {
304
- models: options.models,
305
- updateNonce: options.galleryUpdateNonce,
306
- getNonce: options.galleryGetNonce
307
- });
308
- workflow = media.editor.open( 'wpsc-variation-media' );
309
- };
310
-
311
- var oldEditorOpen = media.editor.open;
312
- media.editor.open = function( id ) {
313
- if ( id == 'content' ) {
314
- if ( media.view.settings.post.id == backup.id ) {
315
- // always make sure the backup copy is up to date
316
- backup = _.clone( media.view.settings.post );
317
- } else {
318
- // if the frame was opened for a variation previously, this time
319
- // restore the globals from the backup
320
- media.view.settings.post = _.clone( backup );
321
- media.model.settings.post = media.view.settings.post;
322
- }
323
- }
324
- return oldEditorOpen.apply( this, arguments );
325
- };
326
-
327
- // hack the set featured image function
328
- wp.media.featuredImage.set = function( id ) {
329
- var settings = wp.media.view.settings;
330
- var currentId = settings.post.id;
331
-
332
- settings.post.featuredImageId = id;
333
-
334
- wp.media.post( 'set-post-thumbnail', {
335
- json: true,
336
- post_id: settings.post.id,
337
- thumbnail_id: settings.post.featuredImageId,
338
- _wpnonce: settings.post.nonce
339
- }).done( function( html ) {
340
- if ( currentId == backup.id ) {
341
- wpsc_refresh_variation_iframe();
342
- $( '.inside', '#postimagediv' ).html( html );
343
- } else {
344
- wpsc_set_variation_product_thumbnail( currentId, $( html ).find( 'img' ).attr( 'src' ), id );
345
- }
346
- });
347
- };
348
-
349
- // hack the Remove thumbnail link so that it refreshes the variation iframe
350
- // after the AJAX request is processed
351
- WPRemoveThumbnail = function(nonce){
352
- $.post( ajaxurl, {
353
- action:"set-post-thumbnail", post_id: $('#post_ID').val(), thumbnail_id: -1, _ajax_nonce: nonce, cookie: encodeURIComponent(document.cookie)
354
- }, function(str){
355
- if ( str == '0' ) {
356
- alert( setPostThumbnailL10n.error );
357
- } else {
358
- WPSetThumbnailHTML(str);
359
- wpsc_refresh_variation_iframe();
360
- }
361
- }
362
- );
363
- };
364
-
365
-
366
- $(function() {
367
- $('#wpsc-manage-product-gallery').on('click', function( e ) {
368
- var frame;
369
-
370
- e.preventDefault();
371
- e.stopPropagation();
372
-
373
- frame = wp.media({
374
- state: 'wpsc-product-gallery',
375
- states: [ new wp.media.controller.wpsc.ProductGallery() ]
376
- });
377
-
378
- frame.on( 'toolbar:create:wpsc-save-gallery', function(toolbar) {
379
- this.createSelectToolbar( toolbar, {
380
- text : WPSC_Media.l10n.saveGallery,
381
- state: this.options.state
382
- } );
383
- }, frame );
384
- frame.on( 'toolbar:render:wpsc-save-gallery', function( view ) {
385
- view.set( 'selection', new media.view.Selection({
386
- controller: this,
387
- collection: this.state().get( 'selection' ),
388
- priority: -40,
389
- editable: this.state().get('editable')
390
- }).render());
391
- }, frame );
392
-
393
- frame.open();
394
- });
395
- // make our gallery sortable
396
- $( 'div#wpsc_product_gallery' ).find( 'ul' ).sortable({
397
- cursor: 'move',
398
- revert: 300,
399
- }).disableSelection();
400
- });
401
- }(jQuery));
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
trunk/wpsc-admin/js/product-variations.js DELETED
@@ -1,249 +0,0 @@
1
- /* global WPSC_Product_Variations, alert */
2
- (function($){
3
- var resize_iframe = function() {
4
- if (typeof window.parent.wpsc_resize_iframe !== 'undefined') {
5
- window.parent.wpsc_resize_iframe();
6
- }
7
- };
8
-
9
- $(function(){
10
- resize_iframe();
11
-
12
- $('.wpsc-variation-stock-editor-link').click( function( event ) {
13
- var parent = $(this).closest('tr'),
14
- target_row = parent.next('.wpsc-stock-editor-row');
15
-
16
- event.preventDefault();
17
-
18
- target_row.toggle( 100 );
19
- parent.toggleClass('active');
20
- resize_iframe();
21
-
22
- return false;
23
- });
24
- });
25
-
26
- $(function(){
27
- $('.variation_checkboxes').on( 'click', '.variation-set', event_toggle_checkboxes );
28
- $('.variation_checkboxes').on( 'click', 'a.expand', event_toggle_children );
29
- $('.variation_checkboxes').on( 'click', '.selectit input:checkbox', event_display_apply_variations );
30
- $('.variation_checkboxes').on( 'click', '.children input:checkbox', event_toggle_parent );
31
-
32
- $('a.add_variation_set_action').on( 'click', event_add_new_variation_set );
33
- $('#add-new-variation-set .button').on( 'click', event_variation_set_add );
34
- $('#add-new-variation-set input[type="text"]').on( 'keypress', event_variation_set_inputs_keypress );
35
- $('#add-new-variation-set input[type="text"]').on( 'focus', event_variation_set_inputs_focus );
36
- $('#add-new-variation-set input[type="text"]').on( 'blur', event_variation_set_inputs_blur );
37
-
38
- $('.wpsc-product-variation-thumbnail a').on( 'click', event_variation_thumbnail_click );
39
- $('.wpsc-bulk-edit').on( 'change', 'input.wpsc-bulk-edit-fields', event_bulk_edit_checkboxes_changed );
40
- $('.wpsc-bulk-edit').on( 'keyup', 'input[type="text"]', event_bulk_edit_textboxes_keyup );
41
- });
42
-
43
- var event_bulk_edit_textboxes_keyup = function() {
44
- var t = $(this),
45
- checkbox = t.siblings('input.wpsc-bulk-edit-fields')[0];
46
-
47
- if ($.trim(t.val()) !== '') {
48
- checkbox.checked = true;
49
- }
50
- };
51
-
52
- var event_bulk_edit_checkboxes_changed = function() {
53
- var t = $(this);
54
- if (t[0].checked) {
55
- t.siblings('input[type="text"]').focus();
56
- }
57
- };
58
-
59
- var event_variation_thumbnail_click = function() {
60
- var t = $( this ), postId = t.data( 'id' ), nonce = t.data( 'nonce' );
61
-
62
- $.wpsc_post(
63
- {
64
- action: 'get_variation_gallery',
65
- nonce: nonce,
66
- id: postId
67
- },
68
- function( response ) {
69
- if ( ! response.is_successful ) {
70
- alert( response.error.messages.join( '\n' ) );
71
- return;
72
- }
73
-
74
- window.parent.WPSC_Media.open({
75
- id: postId,
76
- featuredId: response.obj.featuredId,
77
- models: response.obj.models,
78
- galleryUpdateNonce: t.data( 'save-gallery-nonce' ),
79
- galleryGetNonce: t.data( 'get-gallery-nonce' ),
80
- featuredNonce: t.data( 'featured-nonce' )
81
- });
82
- }
83
- );
84
-
85
- return false;
86
- };
87
-
88
- /**
89
- * Save new variation set using AJAX
90
- * @since 3.8.8
91
- */
92
- var event_variation_set_add = function() {
93
- var form = $('#add-new-variation-set');
94
-
95
- form.find('.error').removeClass('error');
96
-
97
- form.find('input[type="text"]').each(function(){
98
- var t = $(this);
99
- if (t.val() === '') {
100
- t.parent().addClass('error');
101
- }
102
- });
103
-
104
- if (form.find('.error').size() === 0) {
105
- var spinner = $(this).siblings('.ajax-feedback'),
106
- post_data = {
107
- action : 'add_variation_set',
108
- variation_set : $('#new-variation-set-name').val(),
109
- variants : $('#new-variants').val(),
110
- post_id : WPSC_Product_Variations.product_id,
111
- nonce : WPSC_Product_Variations.add_variation_set_nonce
112
- },
113
- ajax_callback = function(response) {
114
- var checklist, color, set_id, existing_set, content;
115
- if (response.is_successful) {
116
- checklist = $('.variation_checkboxes');
117
- content = $(response.obj.content);
118
- set_id = content.attr('id');
119
- existing_set = checklist.find('#' + set_id);
120
- if (existing_set.size() > 0) {
121
- existing_set.find('.children').append(content.find('.children .ajax'));
122
- } else {
123
- checklist.append(content);
124
- }
125
-
126
- color = checklist.find('li').css('backgroundColor') || '#FFFFFF';
127
- checklist.find('.ajax').
128
- animate({ backgroundColor: '#FFFF33' }, 'fast').
129
- animate({ backgroundColor: color }, 'fast', function(){
130
- $(this).css('backgroundColor', 'transparent');
131
- }).
132
- removeClass('ajax');
133
- } else {
134
- alert(response.error.messages.join('\n'));
135
- }
136
- form.hide().find('input:text').val('');
137
- form.find('label').show().css('opacity', '1');
138
- spinner.toggleClass('ajax-feedback-active');
139
- };
140
-
141
- spinner.toggleClass('ajax-feedback-active');
142
- $.wpsc_post(post_data, ajax_callback);
143
- }
144
-
145
- return false;
146
- };
147
-
148
- /**
149
- * Dim the new variation set inputs' labels when focused.
150
- * @since 3.8.8
151
- */
152
- var event_variation_set_inputs_focus = function() {
153
- $(this).siblings('label').animate({opacity:0.5}, 150);
154
- };
155
-
156
- /**
157
- * Restore opacity to the "new variation set" inputs' labels when blurred.
158
- * @since 3.8.8
159
- */
160
- var event_variation_set_inputs_blur = function() {
161
- var t = $(this);
162
- if (t.val() === '') {
163
- t.siblings('label').show().animate({opacity:1}, 150);
164
- }
165
- };
166
-
167
- /**
168
- * Remove class "error" when something is typed into the new variation set textboxes
169
- * @since 3.8.8
170
- */
171
- var event_variation_set_inputs_keypress = function(e) {
172
- var code = e.keyCode ? e.keyCode : e.which;
173
- if (code === 13) {
174
- $('#add-new-variation-set .button').trigger('click');
175
- e.preventDefault();
176
- } else {
177
- $(this).siblings('label').hide().removeClass('error');
178
- }
179
- };
180
-
181
- /**
182
- * Show the Add Variation Set form and focus on the first text field
183
- * @since 3.8.8
184
- */
185
- var event_add_new_variation_set = function() {
186
- $('#add-new-variation-set').show().find('#new-variation-set-name').focus();
187
- window.parent.wpsc_resize_iframe();
188
- };
189
-
190
- /**
191
- * Deselect or Select all children variations when variation set is ticked.
192
- * @since 3.8.8
193
- */
194
- var event_toggle_checkboxes = function() {
195
- var t = $(this), checked;
196
-
197
- if (t.is(':checked')) {
198
- checked = true;
199
- } else {
200
- checked = false;
201
- }
202
-
203
- t.closest('li').find('.children input:checkbox').each(function(){
204
- this.checked = checked;
205
- });
206
-
207
- if (checked !== t.closest('li').hasClass('expanded')) {
208
- t.parent().siblings('.expand').trigger('click');
209
- }
210
- };
211
-
212
- /**
213
- * Show children variant checkboxes when the triangle is clicked.
214
- * @since 3.8.8
215
- */
216
- var event_toggle_children = function() {
217
- var t = $(this);
218
- t.siblings('ul').toggle();
219
- resize_iframe();
220
- t.closest('li').toggleClass('expanded');
221
- return false;
222
- };
223
-
224
- /**
225
- * Show the update variation button.
226
- * @since 3.8.8
227
- */
228
- var event_display_apply_variations = function() {
229
- $('.update-variations').fadeIn(150);
230
- };
231
-
232
- /**
233
- * Deselect the variation set if none of its variants are selected.
234
- * Or select the variation set when at least one of its variants is selected.
235
- * @since 3.8.8
236
- */
237
- var event_toggle_parent = function() {
238
- var t = $(this),
239
- parent = t.closest('.children').parent(),
240
- parent_checkbox = parent.find('.variation-set');
241
-
242
- if (this.checked) {
243
- parent_checkbox[0].checked = true;
244
- } else if (parent.find('.children input:checked').size() === 0) {
245
- parent_checkbox[0].checked = false;
246
- parent.find('.expand').trigger('click');
247
- }
248
- };
249
- })(jQuery);
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
trunk/wpsc-admin/js/purchase-log-action-links.js DELETED
@@ -1,126 +0,0 @@
1
- /* global WPSC_Purchase_Log_Action_Links, alert */
2
- ( function( $ ) {
3
-
4
- /**
5
- * Purchase Log Action Links
6
- */
7
- $.extend( WPSC_Purchase_Log_Action_Links, {
8
-
9
- /**
10
- * Setup purchase log action links and event handlers.
11
- *
12
- * @since 3.9.0
13
- */
14
- init : function() {
15
-
16
- $( function() {
17
- var wrapper = $( '#wpsc_purchlogitems_links ul' );
18
-
19
- // Add spinners to AJAX links
20
- wrapper.find( 'a.wpsc-purchlog-action-link.is-ajax' ).each( function() {
21
- $( this ).prepend( $( '<span class="spinner is-active" />' ) );
22
- } );
23
-
24
- wrapper.on( 'click', 'a.wpsc-purchlog-action-link.is-ajax', WPSC_Purchase_Log_Action_Links.event_ajax_link_clicked );
25
- } );
26
-
27
- },
28
-
29
- /**
30
- * Handle purchase log action link click.
31
- *
32
- * @since 3.9.0
33
- */
34
- event_ajax_link_clicked : function( e ) {
35
-
36
- var action = $( this ).data( 'purchase-log-action' );
37
- var nonce = $( this ).data( 'nonce' );
38
-
39
- if ( action ) {
40
-
41
- // Only do AJAX request if not already doing it.
42
- if ( ! $( this ).hasClass( 'doing' ) ) {
43
-
44
- var post_data = {
45
- 'action' : 'purchase_log_action_link',
46
- 'purchase_log_action_link' : action,
47
- 'purchase_log_action_nonce' : nonce,
48
- 'log_id' : WPSC_Purchase_Log_Action_Links.log_id,
49
- 'nonce' : WPSC_Purchase_Log_Action_Links.purchase_log_action_link_nonce
50
- };
51
-
52
- $( this ).addClass( 'doing' );
53
- $.wpsc_post( post_data, WPSC_Purchase_Log_Action_Links.ajax_callback );
54
-
55
- }
56
-
57
- e.preventDefault();
58
-
59
- }
60
-
61
- },
62
-
63
- /**
64
- * Handle purchase log action AJAX response.
65
- *
66
- * @since 3.9.0
67
- */
68
- ajax_callback : function( response ) {
69
- var dashicon, dashicon_class;
70
-
71
- // If AJAX successful and purchase log action successful.
72
- if ( response.is_successful && response.obj.success ) {
73
-
74
- dashicon = $( '#wpsc_purchlogitems_links ul a.wpsc-purchlog-action-link-' + response.obj.purchase_log_action_link + ' .dashicons' );
75
- dashicon_class = dashicon.attr( 'class' );
76
-
77
- // Successful notification.
78
- dashicon.removeClass().addClass( 'dashicons dashicons-yes' );
79
- setTimeout( function() {
80
- dashicon.removeClass().addClass( dashicon_class );
81
- }, 3000 );
82
-
83
- // Remove spinner
84
- $( '#wpsc_purchlogitems_links ul a.wpsc-purchlog-action-link.doing' ).removeClass( 'doing' );
85
-
86
- } else {
87
-
88
- // Ideally we'd always like to know which link was clicked, but we don't
89
- // so just clear all spinners and only clear specific spinner if AJAX response was processed.
90
-
91
- dashicon = $( '#wpsc_purchlogitems_links ul a.wpsc-purchlog-action-link.doing .dashicons' );
92
-
93
- if ( response.is_successful ) {
94
- dashicon = $( '#wpsc_purchlogitems_links ul a.wpsc-purchlog-action-link-' + response.obj.purchase_log_action_link + ' .dashicons' );
95
- }
96
- dashicon_class = dashicon.attr( 'class' );
97
-
98
- if ( response.obj.success != null ) {
99
-
100
- // Failure notification.
101
- dashicon.removeClass().addClass( 'dashicons dashicons-no' );
102
- setTimeout( function() {
103
- dashicon.removeClass().addClass( dashicon_class );
104
- }, 3000 );
105
-
106
- } else {
107
- dashicon.removeClass().addClass( dashicon_class );
108
- }
109
-
110
- // Remove spinner.
111
- $( '#wpsc_purchlogitems_links ul a.wpsc-purchlog-action-link.doing' ).removeClass( 'doing' );
112
-
113
- // Show error message.
114
- if ( typeof response.error !== 'undefined' ) {
115
- alert( response.error.messages.join( "\n" ) );
116
- }
117
-
118
- }
119
-
120
- }
121
-
122
- } );
123
-
124
- } )( jQuery );
125
-
126
- WPSC_Purchase_Log_Action_Links.init();
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
trunk/wpsc-admin/js/purchase-logs.js DELETED
@@ -1,693 +0,0 @@
1
- window.WPSC_Purchase_Logs_Admin = window.WPSC_Purchase_Logs_Admin || {};
2
-
3
- ( function( window, document, $, wpsc, undefined ) {
4
- 'use strict';
5
- var ENTER = 13;
6
- var ESCAPE = 27;
7
- var BR = "\n";
8
- var $c = {};
9
- var $id = function( id ) {
10
- return $( document.getElementById( id ) );
11
- };
12
-
13
- var admin = {
14
- blur_timeout : null,
15
- reset_textbox_width : true,
16
- $ : $c
17
- };
18
-
19
- admin.cache = function() {
20
- $c.body = $( document.body );
21
- $c.wrapper = $( 'table.purchase-logs' );
22
- $c.details = $( '.log-details-box' );
23
- $c.editDetails = $id( 'edit-shipping-billing' );
24
- $c.editActions = $c.editDetails.find( '.wpsc-form-actions' );
25
- $c.log = $id( 'wpsc_items_ordered' );
26
- $c.discount_data = $id( 'wpsc_discount_data' );
27
- $c.total_taxes = $id( 'wpsc_total_taxes' );
28
- $c.total_shipping = $id( 'wpsc_total_shipping' );
29
- $c.final_total = $id( 'wpsc_final_total' );
30
- $c.spinner = $c.final_total.find( 'td:last .spinner' );
31
- $c.billingForm = $id( 'wpsc-checkout-form-billing' );
32
- $c.shippingForm = $id( 'wpsc-checkout-form-shipping' );
33
- $c.copyForm = $id( 'wpsc-terms-and-conditions-control' );
34
- $c.notes = $id( 'purchlogs_notes' );
35
- };
36
-
37
- admin.init = function() {
38
- admin.cache();
39
-
40
- if ( $c.wrapper.length ) {
41
- $c.wrapper.on( 'change' , '.wpsc-purchase-log-status' , admin.event_log_status_change );
42
- $c.wrapper.on( 'focus' , '.wpsc-purchase-log-tracking-id', admin.event_tracking_id_focused );
43
- $c.wrapper.on( 'click' , '.column-tracking a.add' , admin.event_button_add_clicked );
44
- $c.wrapper.on( 'blur' , '.wpsc-purchase-log-tracking-id', admin.event_tracking_id_blurred );
45
- $c.wrapper.on( 'click' , '.column-tracking a.save' , admin.event_button_save_clicked );
46
- $c.wrapper.on( 'click' , '.column-tracking .send-email a', admin.event_button_send_email_clicked );
47
- $c.wrapper.on( 'keypress' , '.wpsc-purchase-log-tracking-id', admin.event_enter_key_pressed );
48
- $c.wrapper.on( 'mousedown', '.column-tracking a.save' , admin.event_disable_textbox_resize );
49
- $c.wrapper.on( 'focus' , '.column-tracking a.save' , admin.event_disable_textbox_resize );
50
- }
51
-
52
- if ( $c.log.length ) {
53
-
54
- admin.product_search = admin.init_search_view();
55
-
56
- $c.log
57
- .on( 'click', '.wpsc-remove-item-button', admin.remove_item )
58
- .on( 'keypress', '.wpsc_item_qty', admin.maybe_update_qty )
59
- .on( 'change', '.wpsc_item_qty', admin.update_qty )
60
- .on( 'click', '.wpsc-add-item-button', function() { admin.product_search.trigger( 'open' ); } )
61
- .on( 'click', '.refund-items', admin.toggleRefundsUI )
62
- .on( 'click', '.capture-payment', admin.capturePayment )
63
- .on( 'click', 'button.do-api-refund, button.do-manual-refund', admin.refundItem );
64
- $c.body.on( 'click', '.ui-find-overlay', function() { admin.product_search.trigger( 'close' ); } );
65
-
66
- $c.editDetails
67
- .on( 'submit', 'form', admin.handleEditDetails )
68
- .on( 'click', '.button-secondary', admin.toggleEditDetails );
69
-
70
- $c.details
71
- .on( 'click', '.edit-log-details', admin.toggleEditDetails );
72
-
73
- $c.notes
74
- .on( 'submit' , '#note-submit-form' , admin.addNote )
75
- .on( 'keydown', '#note-submit-form' , admin.commandEnterAddNote )
76
- .on( 'click' , '.wpsc-remove-note-button', admin.deleteNote );
77
-
78
- window.postboxes.add_postbox_toggles( window.pagenow );
79
-
80
- $c.editActions.prepend( '<button type="button" class="button-secondary">'+ wpsc.strings.cancel_btn +'</button>' );
81
- }
82
-
83
- };
84
-
85
- admin.toggleRefundsUI = function() {
86
- $( '.wpsc-refund-ui' ).toggle();
87
- };
88
-
89
- admin.refundItem = function( evt ) {
90
- var $button = $( this );
91
- var $spinner = $button.parents( 'tr' ).find('.spinner');
92
- var api_refund = $button.is( '.do-api-refund' );
93
- var refund_string = api_refund ? wpsc.strings.confirm_refund_order : wpsc.strings.confirm_refund_order_manually;
94
-
95
- if ( ! window.confirm( refund_string ) ) {
96
- return;
97
- }
98
-
99
- var data = {
100
- action : 'purchase_log_refund_items',
101
- order_id : wpsc.log_id,
102
- refund_reason : $( 'input#refund_reason' ).val(),
103
- refund_amount : $( 'input#refund_amount' ).val(),
104
- api_refund : api_refund,
105
- nonce : wpsc.purchase_log_refund_items_nonce
106
- };
107
-
108
- var ajax_callback = function( response ) {
109
- $spinner.removeClass( 'is-active' );
110
- if ( ! response.is_successful ) {
111
- if ( response.error ) {
112
- window.alert( response.error.messages.join( BR ) );
113
- }
114
- } else {
115
-
116
- setTimeout( function() {
117
- // Re-spinner while we refresh page.
118
- $spinner.addClass( 'is-active' );
119
- }, 900 );
120
-
121
- window.location.href = window.location.href;
122
- }
123
- };
124
-
125
- $spinner.addClass( 'is-active' );
126
-
127
- $.wpsc_post( data, ajax_callback );
128
- };
129
-
130
- admin.capturePayment = function( evt ) {
131
- var $button = $( this );
132
- var $spinner = $button.siblings( '.spinner' );
133
-
134
- var data = {
135
- action : 'purchase_log_capture_payment',
136
- order_id : wpsc.log_id,
137
- nonce : wpsc.purchase_log_capture_payment_nonce
138
- };
139
-
140
- var ajax_callback = function( response ) {
141
- $spinner.removeClass( 'is-active' );
142
- if ( ! response.is_successful ) {
143
- if ( response.error ) {
144
- window.alert( response.error.messages.join( BR ) );
145
- }
146
- } else {
147
- setTimeout( function() {
148
- // Re-spinner while we refresh page.
149
- $spinner.addClass( 'is-active' );
150
- }, 900 );
151
-
152
- window.location.href = window.location.href;
153
- }
154
- };
155
-
156
- $spinner.addClass( 'is-active' );
157
-
158
- $.wpsc_post( data, ajax_callback );
159
- };
160
-
161
- admin.event_enter_key_pressed = function(evt) {
162
- var code = evt.keyCode ? evt.keyCode : evt.which;
163
- if ( ENTER === code ) {
164
- $(this).siblings('.save').click();
165
- evt.preventDefault();
166
- }
167
- };
168
-
169
- admin.event_button_send_email_clicked = function() {
170
- var $this = $(this);
171
-
172
- var post_data = {
173
- action : 'purchase_log_send_tracking_email',
174
- log_id : $this.closest('div').data('log-id'),
175
- nonce : wpsc.purchase_log_send_tracking_email_nonce
176
- };
177
-
178
- var ajax_callback = function(response) {
179
- if (! response.is_successful) {
180
- window.alert(response.error.messages.join(BR));
181
- $this.show().siblings('em').remove();
182
- return;
183
- }
184
- $this.siblings('em').addClass('sent').text(wpsc.sent_message);
185
- $this.remove();
186
- };
187
-
188
- $this.hide().after('<em>' + wpsc.sending_message + '</em>');
189
- $.wpsc_post(post_data, ajax_callback);
190
-
191
- return false;
192
- };
193
-
194
- admin.event_button_save_clicked = function() {
195
- var $this = $(this);
196
- var $textbox = $this.siblings('.wpsc-purchase-log-tracking-id');
197
- var $spinner = $this.siblings('.ajax-feedback');
198
-
199
- var post_data = {
200
- action : 'purchase_log_save_tracking_id',
201
- value : $textbox.val(),
202
- log_id : $this.parent().data('log-id'),
203
- nonce : wpsc.purchase_log_save_tracking_id_nonce
204
- };
205
-
206
- var ajax_callback = function(response) {
207
- $spinner.toggleClass('ajax-feedback-active');
208
- $textbox.blur();
209
- if (! response.is_successful) {
210
- window.alert(response.error.messages.join(BR));
211
- return;
212
- }
213
- $this.parent().removeClass('empty');
214
- admin.reset_tracking_id_width($this.siblings('.wpsc-purchase-log-tracking-id'));
215
- };
216
-
217
- $this.hide();
218
- $spinner.toggleClass('ajax-feedback-active');
219
- $textbox.width(160);
220
-
221
- $.wpsc_post(post_data, ajax_callback);
222
-
223
- return false;
224
- };
225
-
226
- admin.event_disable_textbox_resize = function() {
227
- admin.reset_textbox_width = false;
228
- };
229
-
230
- admin.event_button_add_clicked = function() {
231
- $(this).siblings('.wpsc-purchase-log-tracking-id').trigger('focus');
232
- return false;
233
- };
234
-
235
- admin.reset_tracking_id_width = function($obj) {
236
- var reset_width = function() {
237
- if (admin.reset_textbox_width) {
238
- $obj.siblings('a.save').hide();
239
- $obj.width('');
240
- if ($obj.val() === '') {
241
- $obj.siblings('.add').show();
242
- }
243
- }
244
-
245
- admin.reset_textbox_width = true;
246
- };
247
-
248
- admin.blur_timeout = setTimeout(reset_width, 100);
249
- };
250
-
251
- admin.event_tracking_id_blurred = function() {
252
- admin.reset_tracking_id_width( $(this) );
253
- };
254
-
255
- admin.event_tracking_id_focused = function() {
256
- var $this = $(this);
257
- $this.width(128);
258
- $this.siblings('a.save').show();
259
- $this.siblings('a.add').hide();
260
- };
261
-
262
- admin.event_log_status_change = function() {
263
- var $this = $(this);
264
- var post_data = {
265
- nonce : wpsc.change_purchase_log_status_nonce,
266
- action : 'change_purchase_log_status',
267
- id : $this.data('log-id'),
268
- new_status : $this.val(),
269
- m : wpsc.current_filter,
270
- status : wpsc.current_view,
271
- paged : wpsc.current_page,
272
- _wp_http_referer : window.location.href
273
- };
274
- var spinner = $this.siblings('.ajax-feedback');
275
- spinner.addClass('ajax-feedback-active');
276
- var ajax_callback = function(response) {
277
- if (! response.is_successful) {
278
- window.alert(response.error.messages.join(BR));
279
- return;
280
- }
281
- spinner.removeClass('ajax-feedback-active');
282
- $('ul.subsubsub').replaceWith(response.obj.views);
283
- $('.tablenav.top').replaceWith(response.obj.tablenav_top);
284
- $('.tablenav.bottom').replaceWith(response.obj.tablenav_bottom);
285
- };
286
-
287
- $.wpsc_post(post_data, ajax_callback);
288
- };
289
-
290
- admin.remove_item = function() {
291
- if ( ! window.confirm( wpsc.strings.confirm_delete_item ) ) {
292
- return;
293
- }
294
-
295
- var $this = $( this );
296
- var $row = $this.parents( '.purchase-log-line-item' );
297
- var args = {
298
- action : 'remove_log_item',
299
- log_id : wpsc.log_id,
300
- item_id : $row.data( 'id' ),
301
- nonce : wpsc.remove_log_item_nonce
302
- };
303
-
304
- var ajax_callback = function(response) {
305
- if ( ! response.is_successful ) {
306
- if ( response.error ) {
307
- window.alert( response.error.messages.join( BR ) );
308
- }
309
-
310
- return;
311
- }
312
-
313
- admin.update_totals( response.obj );
314
-
315
- $row.fadeOut( 600, function() {
316
- $( this ).remove();
317
- } );
318
- };
319
-
320
- $c.spinner.addClass( 'is-active' );
321
-
322
- $.wpsc_post( args, ajax_callback );
323
- };
324
-
325
- admin.maybe_update_qty = function( evt ) {
326
- var code = evt.keyCode ? evt.keyCode : evt.which;
327
- if ( ENTER === code ) {
328
- evt.preventDefault();
329
- admin.update_qty.call( this, evt );
330
- }
331
- };
332
-
333
- admin.update_qty = function( evt ) {
334
- if ( 'keypress' === evt.type ) {
335
- admin.update_qty.disable_change = true;
336
- }
337
-
338
- if ( 'change' === evt.type && true === admin.update_qty.disable_change ) {
339
- admin.update_qty.disable_change = false;
340
- return;
341
- }
342
-
343
- var $this = $( this );
344
- var $row = $this.parents( '.purchase-log-line-item' );
345
- var args = {
346
- action : 'update_log_item_qty',
347
- log_id : wpsc.log_id,
348
- item_id : $row.data( 'id' ),
349
- qty : $this.val(),
350
- nonce : wpsc.update_log_item_qty_nonce
351
- };
352
-
353
- if ( 0 === parseInt( args.qty, 10 ) ) {
354
- return $row.find( '.wpsc-remove-item-button' ).trigger( 'click' );
355
- }
356
-
357
- var ajax_callback = function(response) {
358
- if ( ! response.is_successful ) {
359
- if ( response.error ) {
360
- window.alert( response.error.messages.join( BR ) );
361
- }
362
-
363
- return;
364
- }
365
-
366
- if ( response.obj.final_total ) {
367
- admin.update_totals( response.obj );
368
- }
369
- };
370
-
371
- $c.spinner.addClass( 'is-active' );
372
- $.wpsc_post( args, ajax_callback );
373
- };
374
-
375
- admin.update_totals = function( data ) {
376
- $c.discount_data.find( 'td' ).first().html( data.discount_data );
377
- $c.discount_data.find( 'td' ).last().html( data.discount );
378
-
379
- if ( $c.total_taxes.length ) {
380
- $c.total_taxes.find( 'td' ).last().html( data.total_taxes );
381
- }
382
-
383
- $c.total_shipping.find( 'td' ).last().html( data.total_shipping );
384
- $c.final_total.find( 'td:last span' ).html( data.final_total );
385
-
386
- $c.spinner.removeClass( 'is-active' );
387
-
388
- $.each( data.quantities, function( id, qty ) {
389
- qty = parseInt( qty, 10 );
390
- var $input = $c.log.find( '#purchase-log-item-' + id + ' .wpsc_item_qty' );
391
- var val = $input.val();
392
- var $price, $new_price;
393
-
394
- if ( parseInt( val, 10 ) !== parseInt( qty, 10 ) ) {
395
- $input.val( qty );
396
- }
397
-
398
- $price = $c.log.find( '#purchase-log-item-' + id + ' .amount .pricedisplay' );
399
- $new_price = $( data.htmls[ id ] ).find( '.amount .pricedisplay' );
400
- if ( $price.length && $new_price.length ) {
401
- $price.text( $new_price.text() );
402
- }
403
- } );
404
- };
405
-
406
- admin.toggleEditDetails = function( evt ) {
407
- evt.preventDefault();
408
-
409
- var strings = window.WPSC.copyBilling.strings;
410
-
411
- $c.editDetails.slideToggle( 400, function() {
412
- if ( $( evt.target ).hasClass( 'edit-shipping-details' ) ) {
413
- $c.billingForm.find( 'h2' ).replaceWith( strings.billing );
414
- $c.shippingForm.removeClass( 'ui-helper-hidden' );
415
-
416
- } else if ( $c.copyForm.is( ':checked' ) ) {
417
- $c.billingForm.find( 'h2' ).replaceWith( strings.billing_and_shipping );
418
- $c.shippingForm.addClass( 'ui-helper-hidden' );
419
- }
420
- } );
421
- };
422
-
423
- admin.handleEditDetails = function( evt ) {
424
- evt.preventDefault();
425
-
426
- var args = {
427
- action : 'edit_contact_details',
428
- log_id : wpsc.log_id,
429
- nonce : wpsc.edit_contact_details_nonce,
430
- fields : $c.editDetails.find( 'form' ).serialize()
431
- };
432
-
433
- var ajax_callback = function( response ) {
434
- $c.editActions.find( '.spinner' ).remove();
435
-
436
- if ( ! response.is_successful ) {
437
- if ( response.error ) {
438
- window.alert( response.error.messages.join( BR ) );
439
- }
440
-
441
- return;
442
- }
443
-
444
- $id( 'wpsc-shipping-details' ).html( response.obj.shipping );
445
- $id( 'wpsc-billing-details' ).html( response.obj.billing );
446
- $id( 'wpsc-payment-details' ).html( response.obj.payment );
447
-
448
- // Trigger the edit form to slide closed.
449
- admin.toggleEditDetails( evt );
450
- };
451
-
452
- $c.editActions.prepend( '<div class="spinner is-active"></div>' );
453
-
454
- $.wpsc_post( args, ajax_callback );
455
- };
456
-
457
- admin.commandEnterAddNote = function( evt ) {
458
- if ( ( evt.metaKey || evt.ctrlKey ) && evt.keyCode === ENTER ) {
459
- admin.addNote( evt );
460
- }
461
- };
462
-
463
- admin.addNote = function( evt ) {
464
- evt.preventDefault();
465
-
466
- $c.notesText = $c.notesText || $id( 'purchlog_notes' );
467
- var args = {
468
- action : 'add_note',
469
- log_id : wpsc.log_id,
470
- nonce : wpsc.add_note_nonce,
471
- note : $c.notesText.val()
472
- };
473
-
474
- var ajax_callback = function(response) {
475
- $c.notes.find( '.spinner' ).removeClass( 'is-active' );
476
-
477
- if ( ! response.is_successful ) {
478
- if ( response.error ) {
479
- window.alert( response.error.messages.join( BR ) );
480
- }
481
-
482
- return;
483
- }
484
-
485
- $c.notes.find( '.wpsc-notes' ).prepend( response.obj );
486
- $c.notesText.val( '' );
487
- };
488
-
489
- $c.notes.find( '.spinner' ).addClass( 'is-active' );
490
-
491
- $.wpsc_post( args, ajax_callback );
492
- };
493
-
494
- admin.deleteNote = function( evt ) {
495
- evt.preventDefault();
496
-
497
- if ( ! window.confirm( wpsc.strings.confirm_delete_note ) ) {
498
- return;
499
- }
500
-
501
- var $this = $( this );
502
- var $row = $this.parents( '.wpsc-note' );
503
- var args = {
504
- action : 'delete_note',
505
- log_id : wpsc.log_id,
506
- nonce : wpsc.delete_note_nonce,
507
- note : $row.data( 'id' )
508
- };
509
-
510
- var ajax_callback = function(response) {
511
- if ( ! response.is_successful ) {
512
- if ( response.error ) {
513
- $this.find( '.spinner' ).remove();
514
- window.alert( response.error.messages.join( BR ) );
515
- }
516
-
517
- return;
518
- }
519
-
520
- $row.slideUp( 600, function() {
521
- $( this ).remove();
522
- } );
523
- };
524
-
525
- $this.prepend( '<div class="spinner is-active"></div>' );
526
-
527
- $.wpsc_post( args, ajax_callback );
528
- };
529
-
530
- admin.init_search_view = function() {
531
- var SearchView = window.Backbone.View.extend( {
532
- el : '#find-posts',
533
- overlaySet : false,
534
- $overlay : false,
535
- $checked : false,
536
- $table : false,
537
- template : wp.template( 'wpsc-found-product-rows' ),
538
-
539
- events : {
540
- 'keypress .find-box-search :input' : 'maybeStartSearch',
541
- 'keyup #find-posts-input' : 'escClose',
542
- 'click #find-posts-submit' : 'selectPost',
543
- 'click #find-posts-search' : 'send',
544
- 'click #find-posts-close' : 'close'
545
- },
546
-
547
- initialize: function() {
548
- this.$spinner = this.$el.find( '.find-box-search .spinner' );
549
- this.$input = this.$el.find( '#find-posts-input' );
550
- this.$response = this.$el.find( '#find-posts-response' );
551
- this.$overlay = $( '.ui-find-overlay' );
552
- this.$table = $( $id( 'tmpl-wpsc-found-products' ).html() );
553
-
554
- this.listenTo( this, 'open', this.open );
555
- this.listenTo( this, 'close', this.close );
556
- },
557
-
558
- escClose: function( evt ) {
559
- var code = evt.keyCode ? evt.keyCode : evt.which;
560
- if ( ESCAPE === code ) {
561
- this.close();
562
- }
563
- },
564
-
565
- close: function() {
566
- this.$overlay.hide();
567
- this.$el.hide();
568
- },
569
-
570
- open: function() {
571
- this.$response.html('');
572
-
573
- // WP, why you gotta be like that? (why isn't text in its own dom node?)
574
- this.$el.show().find( '#find-posts-head' ).html( wpsc.strings.search_head + '<div id="find-posts-close"></div>' );
575
-
576
- this.$input.focus();
577
-
578
- if ( ! this.$overlay.length ) {
579
- $( 'body' ).append( '<div class="ui-find-overlay"></div>' );
580
- this.$overlay = $( '.ui-find-overlay' );
581
- }
582
-
583
- this.$overlay.show();
584
-
585
- // Pull some results up by default
586
- this.send();
587
-
588
- return false;
589
- },
590
-
591
- maybeStartSearch: function( evt ) {
592
- var code = evt.keyCode ? evt.keyCode : evt.which;
593
- if ( ENTER === code ) {
594
- this.send();
595
- return false;
596
- }
597
- },
598
-
599
- send: function() {
600
-
601
- var that = this;
602
- that.$spinner.addClass( 'is-active' );
603
-
604
- var args = {
605
- action : 'search_products',
606
- search : that.$input.val(),
607
- nonce : wpsc.search_products_nonce
608
- };
609
-
610
- $.wpsc_post( args )
611
- .always( function() {
612
-
613
- that.$spinner.removeClass('is-active');
614
-
615
- } ).done( function( response ) {
616
-
617
- if ( ! response.is_successful ) {
618
- if ( response.error ) {
619
- that.$response.text( response.error.messages.join( BR ) );
620
- }
621
- return;
622
- }
623
-
624
- that.$table.children( 'tbody' ).html( that.template( { posts : response.obj } ) );
625
- that.$response.html( that.$table );
626
-
627
- } ).fail( function() {
628
- that.$response.text( that.errortxt );
629
- } );
630
- },
631
-
632
- selectPost: function( evt ) {
633
- evt.preventDefault();
634
-
635
- this.$checked = $( '#find-posts-response input[type="checkbox"]:checked' );
636
-
637
- var checked = this.$checked.map(function() { return this.value; }).get();
638
-
639
- if ( ! checked.length ) {
640
- this.close();
641
- return;
642
- }
643
-
644
- this.handleSelected( checked );
645
- },
646
-
647
- handleSelected: function( checked ) {
648
- var that = this;
649
-
650
- var existing = $c.log.find( '[data-productid]' ).map( function() {
651
- return $( this ).data( 'productid' );
652
- } ).get();
653
-
654
- var args = {
655
- action : 'add_log_item',
656
- product_ids : checked,
657
- existing : existing,
658
- log_id : wpsc.log_id,
659
- nonce : wpsc.add_log_item_nonce
660
- };
661
-
662
- var ajax_callback = function(response) {
663
- if ( ! response.is_successful ) {
664
- if ( response.error ) {
665
- window.alert( response.error.messages.join( BR ) );
666
- }
667
-
668
- return;
669
- }
670
-
671
- $c.log.find( '.wpsc_purchaselog_add_product' ).before( response.obj.html );
672
-
673
- admin.update_totals( response.obj );
674
-
675
- that.close();
676
- };
677
-
678
- $c.spinner.addClass( 'is-active' );
679
-
680
- $.wpsc_post( args, ajax_callback );
681
- }
682
-
683
- } );
684
-
685
- return new SearchView();
686
- };
687
-
688
-
689
- $.extend( wpsc, admin );
690
-
691
- $( wpsc.init );
692
-
693
- } )( window, document, jQuery, window.WPSC_Purchase_Logs_Admin );
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
trunk/wpsc-admin/js/quick-edit.js DELETED
@@ -1,40 +0,0 @@
1
- (function($) {
2
-
3
- // we create a copy of the WP inline edit post function
4
- var $wp_inline_edit = inlineEditPost.edit;
5
-
6
- // and then we overwrite the function with our own code
7
- inlineEditPost.edit = function( id ) {
8
-
9
- // "call" the original WP edit function
10
- // we don't want to leave WordPress hanging
11
- $wp_inline_edit.apply( this, arguments );
12
-
13
- // now we take care of our business
14
-
15
- // get the post ID
16
- var $post_id = 0;
17
- if ( typeof(