Version Description
Download this release
Release Info
Developer | mordauk |
Plugin | Easy Digital Downloads |
Version | 2.4 |
Comparing to | |
See all releases |
Code changes from version 2.3.9 to 2.4
- assets/css/edd-admin.css +53 -12
- assets/css/edd-admin.min.css +1 -1
- assets/images/screenshots/24-category-earnings.png +0 -0
- assets/images/screenshots/24-checkout.png +0 -0
- assets/images/screenshots/24-export.png +0 -0
- assets/js/admin-scripts.js +222 -67
- assets/js/admin-scripts.min.js +1 -1
- assets/js/edd-ajax.js +28 -10
- assets/js/edd-ajax.min.js +1 -1
- assets/js/edd-checkout-global.js +366 -330
- assets/js/edd-checkout-global.min.js +1 -1
- assets/js/jquery.flot.pie.js +820 -0
- assets/js/jquery.flot.pie.min.js +7 -0
- easy-digital-downloads.php +10 -6
- includes/admin/admin-pages.php +295 -23
- includes/admin/class-api-keys-table.php +58 -13
- includes/admin/class-edd-notices.php +2 -0
- includes/admin/downloads/dashboard-columns.php +9 -13
- includes/admin/downloads/metabox.php +26 -0
- includes/admin/reporting/class-api-requests-logs-list-table.php +10 -6
- includes/admin/reporting/class-categories-reports-table.php +317 -0
- includes/admin/reporting/class-edd-graph.php +3 -1
- includes/admin/reporting/class-edd-pie-graph.php +202 -0
- includes/admin/reporting/class-export-payments.php +1 -1
- includes/admin/reporting/export/class-batch-export-customers.php +160 -0
- includes/admin/reporting/export/class-batch-export-file-downloads.php +159 -0
- includes/admin/reporting/export/class-batch-export-payments.php +239 -0
- includes/admin/reporting/export/class-batch-export.php +253 -0
- includes/admin/reporting/export/export-functions.php +150 -0
- includes/admin/reporting/graphing.php +64 -18
- includes/admin/reporting/pdf-reports.php +2 -1
- includes/admin/reporting/reports.php +83 -29
- includes/admin/settings/register-settings.php +255 -204
- includes/admin/tools.php +16 -11
- includes/admin/tracking.php +1 -2
- includes/admin/upgrades/upgrade-functions.php +92 -0
- includes/admin/welcome.php +38 -28
- includes/ajax-functions.php +30 -4
- includes/api/class-edd-api-v1.php +24 -0
- includes/api/class-edd-api.php +1948 -0
- includes/cart/template.php +21 -9
- includes/checkout/functions.php +186 -2
- includes/checkout/template.php +57 -22
- includes/class-edd-cli.php +1 -1
- includes/class-edd-db-customers.php +74 -63
- includes/class-edd-db.php +22 -4
- includes/class-edd-html-elements.php +23 -2
- includes/class-edd-license-handler.php +23 -8
- includes/class-edd-session.php +3 -1
- includes/discount-functions.php +88 -38
- includes/emails/functions.php +11 -5
- includes/error-tracking.php +1 -1
- includes/gateways/amazon-payments.php +1147 -0
- includes/gateways/functions.php +35 -9
- includes/gateways/libs/amazon/Client.php +1579 -0
- includes/gateways/libs/amazon/HttpCurl.php +126 -0
- includes/gateways/libs/amazon/Interface.php +479 -0
- includes/gateways/libs/amazon/IpnHandler.php +418 -0
- includes/gateways/libs/amazon/ResponseParser.php +83 -0
- includes/gateways/paypal-standard.php +5 -5
- includes/install.php +5 -1
- includes/misc-functions.php +23 -0
- includes/payments/actions.php +11 -23
- includes/payments/class-payment-stats.php +22 -7
- includes/payments/functions.php +117 -31
- includes/post-types.php +148 -117
- includes/process-purchase.php +35 -32
- includes/scripts.php +73 -44
- includes/shortcodes.php +5 -0
- includes/template-functions.php +26 -10
- includes/widgets.php +150 -134
- languages/edd.pot +1009 -773
- readme.txt +44 -2
- templates/checkout_cart.php +17 -3
- templates/edd.css +115 -8
- templates/edd.min.css +1 -1
- templates/images/icons/amazon.gif +0 -0
- templates/shortcode-profile-editor.php +2 -2
- templates/shortcode-receipt.php +2 -2
- templates/widget-cart-checkout.php +5 -1
- templates/widget-cart-empty.php +5 -1
- templates/widget-cart.php +1 -1
assets/css/edd-admin.css
CHANGED
@@ -13,12 +13,14 @@
|
|
13 |
a.edd-delete { color: #a00; }
|
14 |
a.edd-delete:hover { color: #f00; }
|
15 |
|
16 |
-
|
17 |
/* General Settings Styles
|
18 |
-------------------------------------------------------------- */
|
19 |
-
.download_page_edd-settings .form-table label {
|
20 |
-
.download_page_edd-settings .form-table select +
|
21 |
-
.download_page_edd-settings .
|
|
|
|
|
|
|
22 |
|
23 |
/* =Add Ons Styles
|
24 |
-------------------------------------------------------------- */
|
@@ -131,7 +133,7 @@ textarea#edd-payment-note { width: 100%; height: 4em; margin: 0; }
|
|
131 |
#edd-edit-order-form .column .description { padding-right: 10px; }
|
132 |
#edd-edit-order-form .column,
|
133 |
#edd-purchased-files .row > ul > li,
|
134 |
-
#edd-purchased-files .inside > ul > li { display: inline-block; position: relative; vertical-align:
|
135 |
#edd-purchased-files li.actions { text-align: right; min-width: 200px; }
|
136 |
#edd-purchased-files ul li.remove { text-align: right; }
|
137 |
#edd-purchased-files .row { padding: 12px; border-bottom: 1px solid #eee; }
|
@@ -230,6 +232,27 @@ td.edd_order_price { text-align: right; }
|
|
230 |
#edd-graphs-date-options,
|
231 |
#edd-date-range-options { float: left; }
|
232 |
#edd-date-range-options span { float: left; margin-right: 6px; height: 24px; line-height: 24px; }
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
233 |
|
234 |
/* Upgrades page styles
|
235 |
-------------------------------------------------------------- */
|
@@ -259,6 +282,15 @@ td.edd_order_price { text-align: right; }
|
|
259 |
-------------------------------------------------------------- */
|
260 |
#TB_window #edd-add-download:hover, #TB_window #edd-add-download:active, #TB_window #edd-add-download:focus { color: #fff; }
|
261 |
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
262 |
/* General styles
|
263 |
-------------------------------------------------------------- */
|
264 |
.edd-select-chosen { width: 300px; }
|
@@ -275,14 +307,23 @@ td.edd_order_price { text-align: right; }
|
|
275 |
.edd_user_search_results a.edd-ajax-user-cancel { position: absolute; right: 6px; top: 2px; }
|
276 |
.edd_user_search_results ul { padding: 10px 10px 4px; margin: 0; background: #f0f0f0; border: 1px solid #DFDFDF; width: 300px; max-height: 200px; overflow-y: scroll; }
|
277 |
|
278 |
-
|
279 |
-
|
280 |
-
|
281 |
-
|
|
|
|
|
282 |
|
283 |
-
|
284 |
-
|
285 |
-
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
286 |
|
287 |
/* Customer Styles
|
288 |
-------------------------------------------------------------- */
|
13 |
a.edd-delete { color: #a00; }
|
14 |
a.edd-delete:hover { color: #f00; }
|
15 |
|
|
|
16 |
/* General Settings Styles
|
17 |
-------------------------------------------------------------- */
|
18 |
+
.download_page_edd-settings .form-table label { color: #666; font-size: 14px; font-style: italic; margin: 4px 0 0; }
|
19 |
+
.download_page_edd-settings .form-table select + label,
|
20 |
+
.download_page_edd-settings .form-table input.regular-text ~ label { display:block; }
|
21 |
+
.download_page_edd-settings .form-table input.small-text ~ label,
|
22 |
+
.download_page_edd-settings .form-table input[type="checkbox"] + label { display: inline; }
|
23 |
+
.download_page_edd-settings .form-table tr > th > strong { font-size: 18px; font-style: italic; }
|
24 |
|
25 |
/* =Add Ons Styles
|
26 |
-------------------------------------------------------------- */
|
133 |
#edd-edit-order-form .column .description { padding-right: 10px; }
|
134 |
#edd-edit-order-form .column,
|
135 |
#edd-purchased-files .row > ul > li,
|
136 |
+
#edd-purchased-files .inside > ul > li { display: inline-block; position: relative; vertical-align: middle; margin-right: 5%; line-height:30px; }
|
137 |
#edd-purchased-files li.actions { text-align: right; min-width: 200px; }
|
138 |
#edd-purchased-files ul li.remove { text-align: right; }
|
139 |
#edd-purchased-files .row { padding: 12px; border-bottom: 1px solid #eee; }
|
232 |
#edd-graphs-date-options,
|
233 |
#edd-date-range-options { float: left; }
|
234 |
#edd-date-range-options span { float: left; margin-right: 6px; height: 24px; line-height: 24px; }
|
235 |
+
.edd-export-form { position: relative; }
|
236 |
+
.edd-export-form .edd-progress {background: #ddd; position: absolute; bottom: -20px; height: 15px; width: 100%; }
|
237 |
+
.edd-export-form .edd-progress div { height: 100%; background: #ccc; width: 0; }
|
238 |
+
.admin-color-fresh .edd-export-form .edd-progress div { background: #0073aa; }
|
239 |
+
.admin-color-light .edd-export-form .edd-progress div { background: #888; }
|
240 |
+
.admin-color-blue .edd-export-form .edd-progress div { background: #096484; }
|
241 |
+
.admin-color-coffee .edd-export-form .edd-progress div { background: #c7a589; }
|
242 |
+
.admin-color-ectoplasm .edd-export-form .edd-progress div { background: #a3b745; }
|
243 |
+
.admin-color-midnight .edd-export-form .edd-progress div { background: #e14d43; }
|
244 |
+
.admin-color-sunrise .edd-export-form .edd-progress div { background: #dd823b; }
|
245 |
+
#edd-graphs-filter label { vertical-align: inherit; }
|
246 |
+
#edd-graphs-filter .graph-option-section { float: left; line-height: 2.5em; padding-right: 5px; }
|
247 |
+
.edd-mix-totals { padding: 10px; background-color: #fff; box-shadow: 0 1px 1px rgba(0,0,0,0.04); border: 1px solid #e5e5e5; }
|
248 |
+
.edd-mix-chart { display: inline-block; width: 49%; }
|
249 |
+
.edd-graph-notes { color: #9c9c9c; }
|
250 |
+
.edd-graph-notes span { display: block; }
|
251 |
+
.edd-pie-graph .legend { display: none; }
|
252 |
+
.edd-pie-legend { margin-top: 10px; overflow: auto; }
|
253 |
+
.edd-legend-item-wrapper { width: 48%; display:inline-block; font-size:8pt; padding:2px; color:#333; padding: 2px 5px 0px 5px; height: 20px; }
|
254 |
+
.edd-legend-color { display: inline-block; height: 15px; width: 20px; border: 1px solid #cfcfcf; margin-right: 5px; }
|
255 |
+
.edd-pie-legend-item { display: inline-block; vertical-align: top; width: 80%; }
|
256 |
|
257 |
/* Upgrades page styles
|
258 |
-------------------------------------------------------------- */
|
282 |
-------------------------------------------------------------- */
|
283 |
#TB_window #edd-add-download:hover, #TB_window #edd-add-download:active, #TB_window #edd-add-download:focus { color: #fff; }
|
284 |
|
285 |
+
/* Global Graph Styles
|
286 |
+
-------------------------------------------------------------- */
|
287 |
+
.edd-graph .y1Axis { color: rgb( 237, 194, 64 )!important; }
|
288 |
+
.edd-graph .y2Axis { color: rgb( 175, 216, 248 )!important; }
|
289 |
+
|
290 |
+
/* API Table Styles
|
291 |
+
-------------------------------------------------------------- */
|
292 |
+
.download_page_edd-tools .apikeys .column-user { width: 192px; }
|
293 |
+
|
294 |
/* General styles
|
295 |
-------------------------------------------------------------- */
|
296 |
.edd-select-chosen { width: 300px; }
|
307 |
.edd_user_search_results a.edd-ajax-user-cancel { position: absolute; right: 6px; top: 2px; }
|
308 |
.edd_user_search_results ul { padding: 10px 10px 4px; margin: 0; background: #f0f0f0; border: 1px solid #DFDFDF; width: 300px; max-height: 200px; overflow-y: scroll; }
|
309 |
|
310 |
+
@media screen and ( max-width: 1100px ) {
|
311 |
+
.edd-mix-chart {
|
312 |
+
display: block;
|
313 |
+
width: 100%;
|
314 |
+
}
|
315 |
+
}
|
316 |
|
317 |
+
@media screen and ( max-width: 782px ) {
|
318 |
+
.post-type-download .nav-tab-wrapper a {
|
319 |
+
padding: 2px 4px;
|
320 |
+
font-size: 50%;
|
321 |
+
}
|
322 |
+
.download_page_edd-tools .apikeys .column-user {
|
323 |
+
width: 80px;
|
324 |
+
}
|
325 |
+
|
326 |
+
}
|
327 |
|
328 |
/* Customer Styles
|
329 |
-------------------------------------------------------------- */
|
assets/css/edd-admin.min.css
CHANGED
@@ -1 +1 @@
|
|
1 |
-
.edd-hidden{display:none}.edd-clearfix:after{display:block;visibility:hidden;content:".";text-indent:-9999px;height:0}.edd-wrap a{text-decoration:none}a.edd-delete{color:#a00}a.edd-delete:hover{color:red}.download_page_edd-settings .form-table label{font-size:13px;color:#aaa;font-style:italic;cursor:default;margin:5px 0}.download_page_edd-settings .form-table input.regular-text+label,.download_page_edd-settings .form-table input.small-text+label,.download_page_edd-settings .form-table select+label{display:block}.download_page_edd-settings .field-section-title{font-style:italic;color:#aaa}.edd-tab-span{float:right;bottom:15px;position:relative}.edd-add-ons-footer{padding-top:10px}#edd-add-ons h2{margin:0 0 15px}#edd-add-ons h2 .button-primary{position:absolute}#edd-add-ons .edd-extension{float:left;margin:0 15px 15px 0;background:#fff;border:1px solid #ccc;width:320px;padding:14px;height:315px;position:relative}#edd-add-ons .edd-extension h3{margin:0 0 8px;font-size:13px}#edd-add-ons .edd-extension .button-secondary{position:absolute;bottom:14px;left:14px}#edd-add-ons .edd-browse-all{clear:both;width:100%}#edd-add-ons .edd-extension .third-party{display:none}#edd-add-ons .edd-starter-package{border-color:#62a9d7;background-color:#85c0e5;color:#fff}#edd-add-ons .edd-starter-package h3{color:#fff}#edd-add-ons .edd-extension .wp-post-image{width:100%;height:auto}#edd-products{height:100px;min-width:200px}#edd-add-discount input[type=checkbox],#edd-edit-discount input[type=checkbox]{width:15px}#edd-payment-filters{clear:both;background:#f5f5f5;background-image:-webkit-gradient(linear,left bottom,left top,from(#f5f5f5),to(#fafafa));background-image:-webkit-linear-gradient(bottom,#f5f5f5,#fafafa);background-image:-moz-linear-gradient(bottom,#f5f5f5,#fafafa);background-image:-o-linear-gradient(bottom,#f5f5f5,#fafafa);background-image:linear-gradient(to top,#f5f5f5,#fafafa);border-color:#dfdfdf;overflow:auto;margin:8px 0;padding:12px;border-width:1px;border-style:solid;border-radius:3px;font-size:13px;line-height:2.1em}#edd-payments-filter ul.subsubsub{margin-bottom:8px}#edd-payment-filters p{color:#777}tr.status-refunded td{background:#cecece;border-top-color:#ccc}.wp-list-table.downloads th#ID{width:80px}.wp-list-table.downloads th#details{width:130px}.wp-list-table.downloads th#date{width:140px}.wp-list-table.downloads th#user{width:130px}.edd-mobile-link{line-height:32px;vertical-align:middle}.edd-mobile-link img{max-width:80%;height:auto;float:left}@media handheld,only screen and (max-width:640px){.wp-list-table.downloads th{width:auto!important}}.download_page_edd-payment-history .ui-dialog .ui-dialog-titlebar-close span{margin-left:-8px;margin-top:-8px}#edd-download-link-textarea{width:100%}.edd_files_name_label{width:225px;float:left}.edd_files_url_label{width:220px;float:left}#postbox-container-1 .edd_files_name_label,#postbox-container-1 .edd_files_url_label{width:80px}.edd_add_repeatable{display:inline-block}.edd_repeatable_row td{vertical-align:middle}#downloadinformation .edd_meta_table_wrap table input,#downloadinformation .edd_meta_table_wrap table select,#downloadinformation .edd_meta_table_wrap table textarea{margin:4px 0;width:100%}#downloadinformation .edd_meta_table_wrap table .submit input{width:auto}.edd_repeatable_upload_wrapper .edd_repeatable_upload_field_container{position:relative}.edd_upload_file{position:absolute;top:3px;right:7px;padding:2px 8px;display:block;background:#fff}.edd_upload_field{padding-right:8em}.edd_remove_repeatable{margin:8px 0 0;cursor:pointer;width:10px;height:10px;display:inline-block;text-indent:-9999px;overflow:hidden}.edd_remove_repeatable:active,.edd_remove_repeatable:hover{background-position:-10px 0!important}.edd_draghandle{display:block;width:20px;height:20px;background:url(../images/edd-cross-hair.png);cursor:move;margin:4px 0 0}textarea#edd-payment-note{width:100%;height:4em;margin:0}#edd_product_notes_field{width:98%;margin:0;height:4em}.edd_repeatable_default_wrapper{text-align:center;width:25px}.edd-admin-box .label{font-weight:600}.edd-admin-box-inside{margin:0;padding:3px 12px;clear:both;border-bottom:1px solid #eee}.rtl .edd-admin-box-inside{padding:5px 10px 5px 0}.edd-admin-box-inside .strong{font-weight:600}.edd-payment-fees .fee-label{font-weight:400;color:#666}.edd-admin-box .right{float:right}.rtl .edd-admin-box .right{float:left;margin-left:10px}#edd-order-details .inside,#edd-order-update .inside{margin:0;padding:0}#edd-order-update input.edd_datepicker{width:180px}#edd-order-update input[type=number].edd-payment-time-hour,#edd-order-update input[type=number].edd-payment-time-min{width:50px}.edd-admin-box-inside:last-child{border-bottom:0}#edd-edit-order-form .data-payment-key{word-break:break-all}.edd-order-update-box #major-publishing-actions .button-secondary{margin-right:10px}#edd-purchased-files .edd-select-chosen{width:196px}#edd-customer-details .order-data-address input,#edd-customer-details .order-data-column p.data input,#edd-edit-order-form .column input,#edd-order-address-country-wrap select,#edd-purchased-files ul{clear:both;display:block}#edd-customer-details .actions{float:right}.edd-order-data input.small-text{margin:0}.edd-order-data input.med-text{margin:0;width:100px}#edd-order-update span.label{display:inline;width:50px}.edd-order-update-box .button-primary{margin-right:0}#edd-edit-order-form .column .description{padding-right:10px}#edd-edit-order-form .column,#edd-purchased-files .inside>ul>li,#edd-purchased-files .row>ul>li{display:inline-block;position:relative;vertical-align:bottom;margin-right:5%;line-height:30px}#edd-purchased-files li.actions{text-align:right;min-width:200px}#edd-purchased-files ul li.remove{text-align:right}#edd-purchased-files .row{padding:12px;border-bottom:1px solid #eee}#edd-purchased-files ul{font-size:0}#edd-purchased-files ul li{font-size:13px}#edd-order-data .data span{color:#666;font-weight:600}#edd-purchased-files .inside{padding:12px}#edd-order-recalc-total{float:right}.edd-price-field{width:80px}#edd_products .edd-select,.edd_repeatable_product_wrapper .edd-select,.edd_repeatable_upload_wrapper .pricing select{min-width:100%;max-width:200px}.edd_repeatable_product_wrapper td{overflow:visible}@media screen and (max-width:782px){.order-data-column input[type=email]{padding:6px 10px}}@media screen and (min-width:851px){#edd-purchased-files .inside li.actions{text-align:right}}@media screen and (max-width:1024px){#edd-edit-order-form .column{width:49%}}@media screen and (max-width:1280px) and (min-width:1279px){#edd-purchased-files .inside li.actions{width:35%}#edd-edit-order-form .column{width:32%}}@media screen and (min-width:1280px){#edd-edit-order-form .column,#edd-purchased-files.columns-3 .inside>ul>li,#edd-purchased-files.columns-3 .row>ul>li{width:32%;margin-right:3%}#edd-edit-order-form .columns-4 .column,#edd-purchased-files.columns-4 .inside>ul>li,#edd-purchased-files.columns-4 .row>ul>li{width:22%;margin-right:2%}#edd-edit-order-form .column:nth-child(2n+1),#edd-edit-order-form .columns-3 .column:nth-child(2n+1),#edd-edit-order-form .columns-4 .column:nth-child(3n+1){margin-right:0}#edd-purchased-files.columns-4 li.download{width:33%}#edd-purchased-files.columns-3 .inside>ul>li.price,#edd-purchased-files.columns-3 .row>ul>li.price,#edd-purchased-files.columns-4 li.price{width:14%}#edd-purchased-files.columns-4 li.actions{width:25%;margin-top:0;margin-right:0}}@media screen and (max-width:1284px){#edd-edit-order-form .column strong{display:block}}#edd_product_stats .label{width:70px;display:inline-block}#edd_product_stats hr{border-style:solid;border-width:1px;border-color:#ccc #fff #fff #ccc}.edd_dashboard_widget table thead td{border-bottom:1px solid #ececec;color:#777}.edd_dashboard_widget .table_left{float:left;width:45%}.edd_dashboard_widget .table_right{float:right;width:45%}.edd_dashboard_widget .inside{font-size:12px}.edd_dashboard_widget td{padding:3px 0}.edd_dashboard_widget .b{font-size:14px;font-family:Georgia,"Times New Roman","Bitstream Charter",Times,serif;padding-right:6px;width:auto}.edd_dashboard_widget .t{font-size:12px;padding-right:12px;padding-top:6px;color:#777;width:100%}.edd_dashboard_widget .label_heading{margin:0 0 8px 12px;display:block;font-size:12px;font-family:Helvetica,Arial,sans-serif;color:#8f8f8f;font-weight:400;padding-top:10px;border-top:1px solid #ececec}.edd_dashboard_widget .edd_dashboard_widget_subheading{margin:1em 0 0;border-top:1px solid #ececec;padding-top:10px;color:#8f8f8f;font-size:14px}.edd_dashboard_widget .edd_dashboard_widget_subheading+.table{margin:8px 0 0}.edd_dashboard_widget .edd_price_label{background:#00769c;padding:2px 4px;border-radius:3px;color:#fff;margin-right:2px;font-size:10px}.edd_dashboard_widget table{width:100%;margin-left:0;margin-bottom:1em}td.edd_order_label{width:80%}td.edd_order_price{text-align:right}@media handheld,only screen and (max-width:1000px){.edd_dashboard_widget .edd-recent-email{display:none}}#edd-dashboard-widgets-wrap .postbox h3{cursor:default}#edd-date-range-options,#edd-graphs-date-options{float:left}#edd-date-range-options span{float:left;margin-right:6px;height:24px;line-height:24px}#edd_tax_rates{margin:1em 0 0}#edd_tax_rates .edd_tax_country *,#edd_tax_rates .edd_tax_state *{max-width:100%}#edd_tax_rates .edd_tax_country,#edd_tax_rates .edd_tax_state{width:180px}#edd_tax_rates .edd_tax_rate{width:80px}#edd_tax_rates th{padding:15px 10px}.post-type-download .fixed .column-name{width:27%}.post-type-download .fixed .column-description{width:30%}.post-type-download .fixed .column-slug{width:23%}.post-type-download .fixed .column-posts{text-align:left;width:17%}#system-info-textarea{width:800px;height:400px;font-family:Menlo,Monaco,monospace;background:0 0;white-space:pre;overflow:auto;display:block}#TB_window #edd-add-download:active,#TB_window #edd-add-download:focus,#TB_window #edd-add-download:hover{color:#fff}.edd-select-chosen{width:300px}.chosen-container-multi .chosen-choices{-webkit-border-radius:3px;border-radius:3px;border-color:#dfdfdf;background-image:none}.chosen-container-multi .chosen-choices input{margin:2px;height:27px!important;border-color:#dfdfdf}.chosen-container .chosen-drop{border-color:#aaa;-webkit-box-shadow:1px 1px 2px rgba(0,0,0,.1);box-shadow:1px 1px 2px rgba(0,0,0,.1)}.chosen-container .search-field{float:none!important}.chosen-container .search-field input{width:90%!important}.chosen-container-active .chosen-choices{-webkit-border-top-left-radius:3px;border-radius:3px 3px 0 0;-webkit-border-top-right-radius:3px;-webkit-border-bottom-left-radius:0;border-color:#aaa;-webkit-box-shadow:1px 1px 2px rgba(0,0,0,.1);box-shadow:1px 1px 2px rgba(0,0,0,.1)}.download_page_edd-tools .tablenav .actions{overflow:visible}.edd_user_search_wrap{position:relative;overflow:visible}.edd_user_search_results{position:absolute;left:0;top:27px}.edd_user_search_results a.edd-ajax-user-cancel{position:absolute;right:6px;top:2px}.edd_user_search_results ul{padding:10px 10px 4px;margin:0;background:#f0f0f0;border:1px solid #DFDFDF;width:300px;max-height:200px;overflow-y:scroll}.edd-graph .y1Axis{color:#edc240!important}.edd-graph .y2Axis{color:#afd8f8!important}.download_page_edd-tools .apikeys .column-user{width:192px}#customer-tab-wrapper{margin-left:-1px;z-index:1;text-align:center;display:inline-block}#customer-tab-wrapper-list li{background-color:#fff;width:32px;height:32px}#customer-tab-wrapper-list .inactive{background-color:#fff;color:#eee;border-left:1px solid #e5e5e5}#customer-tab-wrapper-list .active{border-width:1px 1px 1px 0;border-style:solid;border-color:#e5e5e5}#customer-tab-wrapper-list :not(:last-child){margin-bottom:3px}#customer-tab-wrapper-list .dashicons{font-size:24px;line-height:32px}#edd-customer-card-wrapper .left{float:left}#edd-customer-card-wrapper .right{float:right}#edd-customer-card-wrapper input{font-weight:400}#edd-customer-card-wrapper{display:inline-block;margin-left:-1px;z-index:2;width:700px;background-color:#FFF;min-height:200px;border:1px solid #e5e5e5;webkit-box-shadow:0 1px 1px rgba(0,0,0,.04);box-shadow:0 1px 1px rgba(0,0,0,.04)}#edd-customer-card-wrapper .customer-section{border-bottom:1px solid #eee;margin-bottom:10px}#edd-customer-card-wrapper .customer-section table{margin-bottom:20px}#edd-customer-card-wrapper>div{padding:0 20px}#edd-customer-card-wrapper>div:first-child{padding-top:20px}#edd-customer-card-wrapper>div:last-child{padding-bottom:20px;border:none}#edd-customer-card-wrapper .avatar-wrap{padding-right:10px;text-align:center}#edd-customer-card-wrapper .customer-id{font-size:24px;font-weight:600}#edd-customer-card-wrapper .customer-main-wrapper input{width:200px}#edd-customer-card-wrapper .customer-address-wrapper{max-width:33%;margin-right:25px;width:202px}#edd-customer-card-wrapper .customer-address-wrapper select{width:200px}#edd-customer-card-wrapper .customer-info{margin-top:5px;min-height:185px;margin-bottom:10px}#edd-customer-card-wrapper .info-wrapper{min-height:125px}#edd-customer-card-wrapper a.delete{text-decoration:none;color:red;margin-right:5px}.customer-info .customer-name{font-size:24px;font-weight:600}.customer-edit-link a,.disconnect-user a{font-size:12px;font-weight:400;text-decoration:none}#customer-edit-actions{text-align:center;margin-bottom:20px;line-height:28px}#customer-edit-actions .button-secondary{margin-right:10px}#edd-customer-card-wrapper .info-item{line-height:16px;display:block;padding-bottom:5px}#edd-customer-card-wrapper .edit-item{display:none}#edd-customer-card-wrapper .edd_user_search_results{left:1px;top:16px}#edd-customer-card-wrapper .edd_user_search_results ul{width:200px}#customer-stats-wrapper{margin:0 auto;text-align:center;min-height:30px}#customer-stats-wrapper li{width:50%;float:left;line-height:22px;font-size:14px}#customer-stats-wrapper a{text-decoration:none}#customer-stats-wrapper .dashicons{color:#888}#customer-tables-wrapper table{width:100%;text-align:center}#customer-tables-wrapper th{text-align:center}#customer-tables-wrapper .downloads tr>td:first-child,#customer-tables-wrapper .downloads tr>th:first-child{text-align:left}#customer-tables-wrapper .downloads tr>td:only-child{text-align:center}#customer-notes-wrapper{min-height:50px}.customer-notes-header img,.customer-notes-header span{font-weight:600;line-height:30px;vertical-align:middle}.customer-note-input{width:100%;margin-bottom:5px}#edd-customer-notes div:nth-of-type(even){background-color:#fcfcfc}.customer-note-wrapper{border-bottom:1px solid #f9f9f9;min-height:38px;padding:7px 0 7px 7px}.customer-note-wrapper span{display:block}.note-content-wrap{padding-top:7px}.delete-customer{text-align:center}
|
1 |
+
.edd-hidden{display:none}.edd-clearfix:after{display:block;visibility:hidden;content:".";text-indent:-9999px;height:0}.edd-wrap a{text-decoration:none}a.edd-delete{color:#a00}a.edd-delete:hover{color:red}.download_page_edd-settings .form-table label{color:#666;font-size:14px;font-style:italic;margin:4px 0 0}.download_page_edd-settings .form-table input.regular-text~label,.download_page_edd-settings .form-table select+label{display:block}.download_page_edd-settings .form-table input.small-text~label,.download_page_edd-settings .form-table input[type=checkbox]+label{display:inline}.download_page_edd-settings .form-table tr>th>strong{font-size:18px;font-style:italic}.edd-tab-span{float:right;bottom:15px;position:relative}.edd-add-ons-footer{padding-top:10px}#edd-add-ons h2{margin:0 0 15px}#edd-add-ons h2 .button-primary{position:absolute}#edd-add-ons .edd-extension{float:left;margin:0 15px 15px 0;background:#fff;border:1px solid #ccc;width:320px;padding:14px;height:315px;position:relative}#edd-add-ons .edd-extension h3{margin:0 0 8px;font-size:13px}#edd-add-ons .edd-extension .button-secondary{position:absolute;bottom:14px;left:14px}#edd-add-ons .edd-browse-all{clear:both;width:100%}#edd-add-ons .edd-extension .third-party{display:none}#edd-add-ons .edd-starter-package{border-color:#62a9d7;background-color:#85c0e5;color:#fff}#edd-add-ons .edd-starter-package h3{color:#fff}#edd-add-ons .edd-extension .wp-post-image{width:100%;height:auto}#edd-products{height:100px;min-width:200px}#edd-add-discount input[type=checkbox],#edd-edit-discount input[type=checkbox]{width:15px}#edd-payment-filters{clear:both;background:#f5f5f5;background-image:-webkit-gradient(linear,left bottom,left top,from(#f5f5f5),to(#fafafa));background-image:-webkit-linear-gradient(bottom,#f5f5f5,#fafafa);background-image:-moz-linear-gradient(bottom,#f5f5f5,#fafafa);background-image:-o-linear-gradient(bottom,#f5f5f5,#fafafa);background-image:linear-gradient(to top,#f5f5f5,#fafafa);border-color:#dfdfdf;overflow:auto;margin:8px 0;padding:12px;border-width:1px;border-style:solid;border-radius:3px;font-size:13px;line-height:2.1em}#edd-payments-filter ul.subsubsub{margin-bottom:8px}#edd-payment-filters p{color:#777}tr.status-refunded td{background:#cecece;border-top-color:#ccc}.wp-list-table.downloads th#ID{width:80px}.wp-list-table.downloads th#details{width:130px}.wp-list-table.downloads th#date{width:140px}.wp-list-table.downloads th#user{width:130px}.edd-mobile-link{line-height:32px;vertical-align:middle}.edd-mobile-link img{max-width:80%;height:auto;float:left}@media handheld,only screen and (max-width:640px){.wp-list-table.downloads th{width:auto!important}}.download_page_edd-payment-history .ui-dialog .ui-dialog-titlebar-close span{margin-left:-8px;margin-top:-8px}#edd-download-link-textarea{width:100%}.edd_files_name_label{width:225px;float:left}.edd_files_url_label{width:220px;float:left}#postbox-container-1 .edd_files_name_label,#postbox-container-1 .edd_files_url_label{width:80px}.edd_add_repeatable{display:inline-block}.edd_repeatable_row td{vertical-align:middle}#downloadinformation .edd_meta_table_wrap table input,#downloadinformation .edd_meta_table_wrap table select,#downloadinformation .edd_meta_table_wrap table textarea{margin:4px 0;width:100%}#downloadinformation .edd_meta_table_wrap table .submit input{width:auto}.edd_repeatable_upload_wrapper .edd_repeatable_upload_field_container{position:relative}.edd_upload_file{position:absolute;top:3px;right:7px;padding:2px 8px;display:block;background:#fff}.edd_upload_field{padding-right:8em}.edd_remove_repeatable{margin:8px 0 0;cursor:pointer;width:10px;height:10px;display:inline-block;text-indent:-9999px;overflow:hidden}.edd_remove_repeatable:active,.edd_remove_repeatable:hover{background-position:-10px 0!important}.edd_draghandle{display:block;width:20px;height:20px;background:url(../images/edd-cross-hair.png);cursor:move;margin:4px 0 0}textarea#edd-payment-note{width:100%;height:4em;margin:0}#edd_product_notes_field{width:98%;margin:0;height:4em}.edd_repeatable_default_wrapper{text-align:center;width:25px}.edd-admin-box .label{font-weight:600}.edd-admin-box-inside{margin:0;padding:3px 12px;clear:both;border-bottom:1px solid #eee}.rtl .edd-admin-box-inside{padding:5px 10px 5px 0}.edd-admin-box-inside .strong{font-weight:600}.edd-payment-fees .fee-label{font-weight:400;color:#666}.edd-admin-box .right{float:right}.rtl .edd-admin-box .right{float:left;margin-left:10px}#edd-order-details .inside,#edd-order-update .inside{margin:0;padding:0}#edd-order-update input.edd_datepicker{width:180px}#edd-order-update input[type=number].edd-payment-time-hour,#edd-order-update input[type=number].edd-payment-time-min{width:50px}.edd-admin-box-inside:last-child{border-bottom:0}#edd-edit-order-form .data-payment-key{word-break:break-all}.edd-order-update-box #major-publishing-actions .button-secondary{margin-right:10px}#edd-purchased-files .edd-select-chosen{width:196px}#edd-customer-details .order-data-address input,#edd-customer-details .order-data-column p.data input,#edd-edit-order-form .column input,#edd-order-address-country-wrap select,#edd-purchased-files ul{clear:both;display:block}#edd-customer-details .actions{float:right}.edd-order-data input.small-text{margin:0}.edd-order-data input.med-text{margin:0;width:100px}#edd-order-update span.label{display:inline;width:50px}.edd-order-update-box .button-primary{margin-right:0}#edd-edit-order-form .column .description{padding-right:10px}#edd-edit-order-form .column,#edd-purchased-files .inside>ul>li,#edd-purchased-files .row>ul>li{display:inline-block;position:relative;vertical-align:middle;margin-right:5%;line-height:30px}#edd-purchased-files li.actions{text-align:right;min-width:200px}#edd-purchased-files ul li.remove{text-align:right}#edd-purchased-files .row{padding:12px;border-bottom:1px solid #eee}#edd-purchased-files ul{font-size:0}#edd-purchased-files ul li{font-size:13px}#edd-order-data .data span{color:#666;font-weight:600}#edd-purchased-files .inside{padding:12px}#edd-order-recalc-total{float:right}.edd-price-field{width:80px}#edd_products .edd-select,.edd_repeatable_product_wrapper .edd-select,.edd_repeatable_upload_wrapper .pricing select{min-width:100%;max-width:200px}.edd_repeatable_product_wrapper td{overflow:visible}@media screen and (max-width:782px){.order-data-column input[type=email]{padding:6px 10px}}@media screen and (min-width:851px){#edd-purchased-files .inside li.actions{text-align:right}}@media screen and (max-width:1024px){#edd-edit-order-form .column{width:49%}}@media screen and (max-width:1280px) and (min-width:1279px){#edd-purchased-files .inside li.actions{width:35%}#edd-edit-order-form .column{width:32%}}@media screen and (min-width:1280px){#edd-edit-order-form .column,#edd-purchased-files.columns-3 .inside>ul>li,#edd-purchased-files.columns-3 .row>ul>li{width:32%;margin-right:3%}#edd-edit-order-form .columns-4 .column,#edd-purchased-files.columns-4 .inside>ul>li,#edd-purchased-files.columns-4 .row>ul>li{width:22%;margin-right:2%}#edd-edit-order-form .column:nth-child(2n+1),#edd-edit-order-form .columns-3 .column:nth-child(2n+1),#edd-edit-order-form .columns-4 .column:nth-child(3n+1){margin-right:0}#edd-purchased-files.columns-4 li.download{width:33%}#edd-purchased-files.columns-3 .inside>ul>li.price,#edd-purchased-files.columns-3 .row>ul>li.price,#edd-purchased-files.columns-4 li.price{width:14%}#edd-purchased-files.columns-4 li.actions{width:25%;margin-top:0;margin-right:0}}@media screen and (max-width:1284px){#edd-edit-order-form .column strong{display:block}}#edd_product_stats .label{width:70px;display:inline-block}#edd_product_stats hr{border-style:solid;border-width:1px;border-color:#ccc #fff #fff #ccc}.edd_dashboard_widget table thead td{border-bottom:1px solid #ececec;color:#777}.edd_dashboard_widget .table_left{float:left;width:45%}.edd_dashboard_widget .table_right{float:right;width:45%}.edd_dashboard_widget .inside{font-size:12px}.edd_dashboard_widget td{padding:3px 0}.edd_dashboard_widget .b{font-size:14px;font-family:Georgia,"Times New Roman","Bitstream Charter",Times,serif;padding-right:6px;width:auto}.edd_dashboard_widget .t{font-size:12px;padding-right:12px;padding-top:6px;color:#777;width:100%}.edd_dashboard_widget .label_heading{margin:0 0 8px 12px;display:block;font-size:12px;font-family:Helvetica,Arial,sans-serif;color:#8f8f8f;font-weight:400;padding-top:10px;border-top:1px solid #ececec}.edd_dashboard_widget .edd_dashboard_widget_subheading{margin:1em 0 0;border-top:1px solid #ececec;padding-top:10px;color:#8f8f8f;font-size:14px}.edd_dashboard_widget .edd_dashboard_widget_subheading+.table{margin:8px 0 0}.edd_dashboard_widget .edd_price_label{background:#00769c;padding:2px 4px;border-radius:3px;color:#fff;margin-right:2px;font-size:10px}.edd_dashboard_widget table{width:100%;margin-left:0;margin-bottom:1em}td.edd_order_label{width:80%}td.edd_order_price{text-align:right}@media handheld,only screen and (max-width:1000px){.edd_dashboard_widget .edd-recent-email{display:none}}#edd-dashboard-widgets-wrap .postbox h3{cursor:default}#edd-date-range-options,#edd-graphs-date-options{float:left}#edd-date-range-options span{float:left;margin-right:6px;height:24px;line-height:24px}.edd-export-form{position:relative}.edd-export-form .edd-progress{background:#ddd;position:absolute;bottom:-20px;height:15px;width:100%}.edd-export-form .edd-progress div{height:100%;background:#ccc;width:0}.admin-color-fresh .edd-export-form .edd-progress div{background:#0073aa}.admin-color-light .edd-export-form .edd-progress div{background:#888}.admin-color-blue .edd-export-form .edd-progress div{background:#096484}.admin-color-coffee .edd-export-form .edd-progress div{background:#c7a589}.admin-color-ectoplasm .edd-export-form .edd-progress div{background:#a3b745}.admin-color-midnight .edd-export-form .edd-progress div{background:#e14d43}.admin-color-sunrise .edd-export-form .edd-progress div{background:#dd823b}#edd-graphs-filter label{vertical-align:inherit}#edd-graphs-filter .graph-option-section{float:left;line-height:2.5em;padding-right:5px}.edd-mix-totals{padding:10px;background-color:#fff;box-shadow:0 1px 1px rgba(0,0,0,.04);border:1px solid #e5e5e5}.edd-mix-chart{display:inline-block;width:49%}.edd-graph-notes{color:#9c9c9c}.edd-graph-notes span{display:block}.edd-pie-graph .legend{display:none}.edd-pie-legend{margin-top:10px;overflow:auto}.edd-legend-item-wrapper{width:48%;display:inline-block;font-size:8pt;color:#333;padding:2px 5px 0;height:20px}.edd-legend-color{display:inline-block;height:15px;width:20px;border:1px solid #cfcfcf;margin-right:5px}.edd-pie-legend-item{display:inline-block;vertical-align:top;width:80%}#edd_tax_rates{margin:1em 0 0}#edd_tax_rates .edd_tax_country *,#edd_tax_rates .edd_tax_state *{max-width:100%}#edd_tax_rates .edd_tax_country,#edd_tax_rates .edd_tax_state{width:180px}#edd_tax_rates .edd_tax_rate{width:80px}#edd_tax_rates th{padding:15px 10px}.post-type-download .fixed .column-name{width:27%}.post-type-download .fixed .column-description{width:30%}.post-type-download .fixed .column-slug{width:23%}.post-type-download .fixed .column-posts{text-align:left;width:17%}#system-info-textarea{width:800px;height:400px;font-family:Menlo,Monaco,monospace;background:0 0;white-space:pre;overflow:auto;display:block}#TB_window #edd-add-download:active,#TB_window #edd-add-download:focus,#TB_window #edd-add-download:hover{color:#fff}.edd-graph .y1Axis{color:#edc240!important}.edd-graph .y2Axis{color:#afd8f8!important}.download_page_edd-tools .apikeys .column-user{width:192px}.edd-select-chosen{width:300px}.chosen-container-multi .chosen-choices{-webkit-border-radius:3px;border-radius:3px;border-color:#dfdfdf;background-image:none}.chosen-container-multi .chosen-choices input{margin:2px;height:27px!important;border-color:#dfdfdf}.chosen-container .chosen-drop{border-color:#aaa;-webkit-box-shadow:1px 1px 2px rgba(0,0,0,.1);box-shadow:1px 1px 2px rgba(0,0,0,.1)}.chosen-container .search-field{float:none!important}.chosen-container .search-field input{width:90%!important}.chosen-container-active .chosen-choices{-webkit-border-top-left-radius:3px;border-radius:3px 3px 0 0;-webkit-border-top-right-radius:3px;-webkit-border-bottom-left-radius:0;border-color:#aaa;-webkit-box-shadow:1px 1px 2px rgba(0,0,0,.1);box-shadow:1px 1px 2px rgba(0,0,0,.1)}.download_page_edd-tools .tablenav .actions{overflow:visible}.edd_user_search_wrap{position:relative;overflow:visible}.edd_user_search_results{position:absolute;left:0;top:27px}.edd_user_search_results a.edd-ajax-user-cancel{position:absolute;right:6px;top:2px}.edd_user_search_results ul{padding:10px 10px 4px;margin:0;background:#f0f0f0;border:1px solid #DFDFDF;width:300px;max-height:200px;overflow-y:scroll}@media screen and (max-width:1100px){.edd-mix-chart{display:block;width:100%}}@media screen and (max-width:782px){.post-type-download .nav-tab-wrapper a{padding:2px 4px;font-size:50%}.download_page_edd-tools .apikeys .column-user{width:80px}}#customer-tab-wrapper{margin-left:-1px;z-index:1;text-align:center;display:inline-block}#customer-tab-wrapper-list li{background-color:#fff;width:32px;height:32px}#customer-tab-wrapper-list .inactive{background-color:#fff;color:#eee;border-left:1px solid #e5e5e5}#customer-tab-wrapper-list .active{border-width:1px 1px 1px 0;border-style:solid;border-color:#e5e5e5}#customer-tab-wrapper-list :not(:last-child){margin-bottom:3px}#customer-tab-wrapper-list .dashicons{font-size:24px;line-height:32px}#edd-customer-card-wrapper .left{float:left}#edd-customer-card-wrapper .right{float:right}#edd-customer-card-wrapper input{font-weight:400}#edd-customer-card-wrapper{display:inline-block;margin-left:-1px;z-index:2;width:700px;background-color:#FFF;min-height:200px;border:1px solid #e5e5e5;webkit-box-shadow:0 1px 1px rgba(0,0,0,.04);box-shadow:0 1px 1px rgba(0,0,0,.04)}#edd-customer-card-wrapper .customer-section{border-bottom:1px solid #eee;margin-bottom:10px}#edd-customer-card-wrapper .customer-section table{margin-bottom:20px}#edd-customer-card-wrapper>div{padding:0 20px}#edd-customer-card-wrapper>div:first-child{padding-top:20px}#edd-customer-card-wrapper>div:last-child{padding-bottom:20px;border:none}#edd-customer-card-wrapper .avatar-wrap{padding-right:10px;text-align:center}#edd-customer-card-wrapper .customer-id{font-size:24px;font-weight:600}#edd-customer-card-wrapper .customer-main-wrapper input{width:200px}#edd-customer-card-wrapper .customer-address-wrapper{max-width:33%;margin-right:25px;width:202px}#edd-customer-card-wrapper .customer-address-wrapper select{width:200px}#edd-customer-card-wrapper .customer-info{margin-top:5px;min-height:185px;margin-bottom:10px}#edd-customer-card-wrapper .info-wrapper{min-height:125px}#edd-customer-card-wrapper a.delete{text-decoration:none;color:red;margin-right:5px}.customer-info .customer-name{font-size:24px;font-weight:600}.customer-edit-link a,.disconnect-user a{font-size:12px;font-weight:400;text-decoration:none}#customer-edit-actions{text-align:center;margin-bottom:20px;line-height:28px}#customer-edit-actions .button-secondary{margin-right:10px}#edd-customer-card-wrapper .info-item{line-height:16px;display:block;padding-bottom:5px}#edd-customer-card-wrapper .edit-item{display:none}#edd-customer-card-wrapper .edd_user_search_results{left:1px;top:16px}#edd-customer-card-wrapper .edd_user_search_results ul{width:200px}#customer-stats-wrapper{margin:0 auto;text-align:center;min-height:30px}#customer-stats-wrapper li{width:50%;float:left;line-height:22px;font-size:14px}#customer-stats-wrapper a{text-decoration:none}#customer-stats-wrapper .dashicons{color:#888}#customer-tables-wrapper table{width:100%;text-align:center}#customer-tables-wrapper th{text-align:center}#customer-tables-wrapper .downloads tr>td:first-child,#customer-tables-wrapper .downloads tr>th:first-child{text-align:left}#customer-tables-wrapper .downloads tr>td:only-child{text-align:center}#customer-notes-wrapper{min-height:50px}.customer-notes-header img,.customer-notes-header span{font-weight:600;line-height:30px;vertical-align:middle}.customer-note-input{width:100%;margin-bottom:5px}#edd-customer-notes div:nth-of-type(even){background-color:#fcfcfc}.customer-note-wrapper{border-bottom:1px solid #f9f9f9;min-height:38px;padding:7px 0 7px 7px}.customer-note-wrapper span{display:block}.note-content-wrap{padding-top:7px}.delete-customer{text-align:center}
|
assets/images/screenshots/24-category-earnings.png
ADDED
Binary file
|
assets/images/screenshots/24-checkout.png
ADDED
Binary file
|
assets/images/screenshots/24-export.png
ADDED
Binary file
|
assets/js/admin-scripts.js
CHANGED
@@ -128,14 +128,18 @@ jQuery(document).ready(function ($) {
|
|
128 |
|
129 |
$( 'body' ).on( 'change', '#_edd_product_type', function(e) {
|
130 |
|
|
|
|
|
|
|
|
|
131 |
if ( 'bundle' === $( this ).val() ) {
|
132 |
-
|
133 |
-
|
134 |
-
|
135 |
} else {
|
136 |
-
|
137 |
-
|
138 |
-
|
139 |
}
|
140 |
|
141 |
});
|
@@ -292,9 +296,10 @@ jQuery(document).ready(function ($) {
|
|
292 |
//$('#edit-slug-box').remove();
|
293 |
|
294 |
// Date picker
|
295 |
-
|
|
|
296 |
var dateFormat = 'mm/dd/yy';
|
297 |
-
|
298 |
dateFormat: dateFormat
|
299 |
} );
|
300 |
}
|
@@ -329,10 +334,11 @@ jQuery(document).ready(function ($) {
|
|
329 |
field_name: 'edd-payment-address[0][state]'
|
330 |
};
|
331 |
$.post(ajaxurl, data, function (response) {
|
|
|
332 |
if( 'nostates' == response ) {
|
333 |
-
|
334 |
} else {
|
335 |
-
|
336 |
}
|
337 |
});
|
338 |
|
@@ -345,6 +351,14 @@ jQuery(document).ready(function ($) {
|
|
345 |
|
346 |
// Remove a download from a purchase
|
347 |
$('#edd-purchased-files').on('click', '.edd-order-remove-download', function() {
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
348 |
if( confirm( edd_vars.delete_payment_download ) ) {
|
349 |
var key = $(this).data('key');
|
350 |
|
@@ -383,10 +397,11 @@ jQuery(document).ready(function ($) {
|
|
383 |
$('.customer-info').toggle();
|
384 |
$('.new-customer').toggle();
|
385 |
|
|
|
386 |
if ($('.new-customer').is(":visible")) {
|
387 |
-
|
388 |
} else {
|
389 |
-
|
390 |
}
|
391 |
|
392 |
});
|
@@ -400,12 +415,17 @@ jQuery(document).ready(function ($) {
|
|
400 |
|
401 |
e.preventDefault();
|
402 |
|
403 |
-
var
|
404 |
-
|
405 |
-
|
406 |
-
|
407 |
-
|
408 |
-
var
|
|
|
|
|
|
|
|
|
|
|
409 |
|
410 |
if( download_id < 1 ) {
|
411 |
return false;
|
@@ -479,9 +499,11 @@ jQuery(document).ready(function ($) {
|
|
479 |
// Remove a download from a purchase
|
480 |
$('#edd-order-recalc-total').on('click', function(e) {
|
481 |
e.preventDefault();
|
482 |
-
var total
|
483 |
-
|
484 |
-
|
|
|
|
|
485 |
total += parseFloat( $(this).val() );
|
486 |
});
|
487 |
}
|
@@ -668,14 +690,12 @@ jQuery(document).ready(function ($) {
|
|
668 |
|
669 |
$('#products').change(function() {
|
670 |
|
671 |
-
|
672 |
-
|
673 |
-
$('#edd-discount-product-conditions').show();
|
674 |
|
|
|
|
|
675 |
} else {
|
676 |
-
|
677 |
-
$('#edd-discount-product-conditions').hide();
|
678 |
-
|
679 |
}
|
680 |
|
681 |
});
|
@@ -700,11 +720,13 @@ jQuery(document).ready(function ($) {
|
|
700 |
|
701 |
// Show hide extended date options
|
702 |
$( '#edd-graphs-date-options' ).change( function() {
|
703 |
-
var $this = $(this)
|
|
|
|
|
704 |
if ( 'other' === $this.val() ) {
|
705 |
-
|
706 |
} else {
|
707 |
-
|
708 |
}
|
709 |
});
|
710 |
|
@@ -716,12 +738,14 @@ jQuery(document).ready(function ($) {
|
|
716 |
|
717 |
$( '#edd_customer_export_download' ).change( function() {
|
718 |
|
719 |
-
var $this = $(this),
|
|
|
|
|
720 |
|
721 |
if ( '0' === $this.val() ) {
|
722 |
-
|
723 |
} else {
|
724 |
-
|
725 |
}
|
726 |
|
727 |
// On Download Select, Check if Variable Prices Exist
|
@@ -730,12 +754,15 @@ jQuery(document).ready(function ($) {
|
|
730 |
action : 'edd_check_for_download_price_variations',
|
731 |
download_id: download_id
|
732 |
};
|
|
|
|
|
|
|
733 |
$.post(ajaxurl, data, function(response) {
|
734 |
-
|
735 |
$this.after( response );
|
736 |
});
|
737 |
} else {
|
738 |
-
|
739 |
}
|
740 |
});
|
741 |
|
@@ -759,17 +786,20 @@ jQuery(document).ready(function ($) {
|
|
759 |
|
760 |
general : function() {
|
761 |
|
762 |
-
|
763 |
-
|
|
|
|
|
764 |
}
|
765 |
|
766 |
// Settings Upload field JS
|
767 |
if ( typeof wp === "undefined" || '1' !== edd_vars.new_media_ui ) {
|
768 |
//Old Thickbox uploader
|
769 |
-
|
|
|
770 |
window.formfield = '';
|
771 |
|
772 |
-
$('body').on('click',
|
773 |
e.preventDefault();
|
774 |
window.formfield = $(this).parent().prev();
|
775 |
window.tbframe_interval = setInterval(function() {
|
@@ -861,9 +891,9 @@ jQuery(document).ready(function ($) {
|
|
861 |
},
|
862 |
|
863 |
taxes : function() {
|
864 |
-
|
865 |
-
if(
|
866 |
-
|
867 |
}
|
868 |
|
869 |
// Update base state field based on selected base country
|
@@ -950,9 +980,10 @@ jQuery(document).ready(function ($) {
|
|
950 |
emails : function() {
|
951 |
|
952 |
// Show the email template previews
|
953 |
-
|
|
|
954 |
var emailPreview = $('#email-preview');
|
955 |
-
|
956 |
inline: true,
|
957 |
href: emailPreview,
|
958 |
width: '80%',
|
@@ -964,22 +995,23 @@ jQuery(document).ready(function ($) {
|
|
964 |
|
965 |
misc : function() {
|
966 |
|
|
|
|
|
|
|
967 |
// Hide Symlink option if Download Method is set to Direct
|
968 |
-
if(
|
969 |
-
|
970 |
-
|
971 |
}
|
972 |
// Toggle download method option
|
973 |
-
|
974 |
-
var symlink = $(this).parent().parent().next();
|
975 |
if( $(this).val() == 'direct' ) {
|
976 |
symlink.hide();
|
|
|
977 |
} else {
|
978 |
symlink.show();
|
979 |
-
symlink.find('input').attr('checked', false);
|
980 |
}
|
981 |
});
|
982 |
-
|
983 |
}
|
984 |
|
985 |
}
|
@@ -1030,10 +1062,10 @@ jQuery(document).ready(function ($) {
|
|
1030 |
var $price = $( '#edd-download-data input[name="_edd_regprice"]' ).val();
|
1031 |
|
1032 |
var data = {
|
1033 |
-
action:
|
1034 |
-
edd_bulk_nonce:
|
1035 |
-
post_ids:
|
1036 |
-
price:
|
1037 |
};
|
1038 |
|
1039 |
// save the data
|
@@ -1154,11 +1186,88 @@ jQuery(document).ready(function ($) {
|
|
1154 |
};
|
1155 |
EDD_Tools.init();
|
1156 |
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
1157 |
/**
|
1158 |
* Customer management screen JS
|
1159 |
*/
|
1160 |
var EDD_Customer = {
|
1161 |
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
1162 |
init : function() {
|
1163 |
this.edit_customer();
|
1164 |
this.user_search();
|
@@ -1171,8 +1280,9 @@ jQuery(document).ready(function ($) {
|
|
1171 |
edit_customer: function() {
|
1172 |
$( 'body' ).on( 'click', '#edit-customer', function( e ) {
|
1173 |
e.preventDefault();
|
1174 |
-
|
1175 |
-
|
|
|
1176 |
});
|
1177 |
},
|
1178 |
user_search: function() {
|
@@ -1180,7 +1290,7 @@ jQuery(document).ready(function ($) {
|
|
1180 |
$('body').on('click.eddSelectUser', '.edd_user_search_results a', function( e ) {
|
1181 |
e.preventDefault();
|
1182 |
var user_id = $(this).data('userid');
|
1183 |
-
|
1184 |
});
|
1185 |
},
|
1186 |
remove_user: function() {
|
@@ -1205,8 +1315,9 @@ jQuery(document).ready(function ($) {
|
|
1205 |
cancel_edit: function() {
|
1206 |
$( 'body' ).on( 'click', '#edd-edit-customer-cancel', function( e ) {
|
1207 |
e.preventDefault();
|
1208 |
-
|
1209 |
-
|
|
|
1210 |
$( '.edd_user_search_results' ).html('');
|
1211 |
});
|
1212 |
},
|
@@ -1220,9 +1331,9 @@ jQuery(document).ready(function ($) {
|
|
1220 |
};
|
1221 |
$.post(ajaxurl, data, function (response) {
|
1222 |
if( 'nostates' == response ) {
|
1223 |
-
|
1224 |
} else {
|
1225 |
-
|
1226 |
}
|
1227 |
});
|
1228 |
|
@@ -1235,7 +1346,7 @@ jQuery(document).ready(function ($) {
|
|
1235 |
var postData = {
|
1236 |
edd_action : 'add-customer-note',
|
1237 |
customer_id : $( '#customer-id' ).val(),
|
1238 |
-
customer_note :
|
1239 |
add_customer_note_nonce: $( '#add_customer_note_nonce' ).val()
|
1240 |
};
|
1241 |
|
@@ -1248,7 +1359,7 @@ jQuery(document).ready(function ($) {
|
|
1248 |
success: function ( response ) {
|
1249 |
$( '#edd-customer-notes' ).prepend( response );
|
1250 |
$( '.edd-no-customer-notes' ).hide();
|
1251 |
-
|
1252 |
}
|
1253 |
}).fail( function ( data ) {
|
1254 |
if ( window.console && window.console.log ) {
|
@@ -1257,10 +1368,10 @@ jQuery(document).ready(function ($) {
|
|
1257 |
});
|
1258 |
|
1259 |
} else {
|
1260 |
-
var border_color =
|
1261 |
-
|
1262 |
setTimeout( function() {
|
1263 |
-
|
1264 |
}, 500 );
|
1265 |
}
|
1266 |
});
|
@@ -1351,3 +1462,47 @@ jQuery(document).ready(function ($) {
|
|
1351 |
});
|
1352 |
|
1353 |
});
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
128 |
|
129 |
$( 'body' ).on( 'change', '#_edd_product_type', function(e) {
|
130 |
|
131 |
+
var edd_products = $( '#edd_products' ),
|
132 |
+
edd_download_files = $( '#edd_download_files' ),
|
133 |
+
edd_download_limit_wrap = $( '#edd_download_limit_wrap' );
|
134 |
+
|
135 |
if ( 'bundle' === $( this ).val() ) {
|
136 |
+
edd_products.show();
|
137 |
+
edd_download_files.hide();
|
138 |
+
edd_download_limit_wrap.hide();
|
139 |
} else {
|
140 |
+
edd_products.hide();
|
141 |
+
edd_download_files.show();
|
142 |
+
edd_download_limit_wrap.show();
|
143 |
}
|
144 |
|
145 |
});
|
296 |
//$('#edit-slug-box').remove();
|
297 |
|
298 |
// Date picker
|
299 |
+
var edd_datepicker = $( '.edd_datepicker' );
|
300 |
+
if ( edd_datepicker.length > 0 ) {
|
301 |
var dateFormat = 'mm/dd/yy';
|
302 |
+
edd_datepicker.datepicker( {
|
303 |
dateFormat: dateFormat
|
304 |
} );
|
305 |
}
|
334 |
field_name: 'edd-payment-address[0][state]'
|
335 |
};
|
336 |
$.post(ajaxurl, data, function (response) {
|
337 |
+
var state_wrapper = $( '#edd-order-address-state-wrap select, #edd-order-address-state-wrap input' );
|
338 |
if( 'nostates' == response ) {
|
339 |
+
state_wrapper.replaceWith( '<input type="text" name="edd-payment-address[0][state]" value="" class="edd-edit-toggles medium-text"/>' );
|
340 |
} else {
|
341 |
+
state_wrapper.replaceWith( response );
|
342 |
}
|
343 |
});
|
344 |
|
351 |
|
352 |
// Remove a download from a purchase
|
353 |
$('#edd-purchased-files').on('click', '.edd-order-remove-download', function() {
|
354 |
+
|
355 |
+
var count = $('body').find( '#edd-purchased-files > .row' ).length;
|
356 |
+
|
357 |
+
if ( count === 1 ) {
|
358 |
+
alert( edd_vars.one_download_min );
|
359 |
+
return false;
|
360 |
+
}
|
361 |
+
|
362 |
if( confirm( edd_vars.delete_payment_download ) ) {
|
363 |
var key = $(this).data('key');
|
364 |
|
397 |
$('.customer-info').toggle();
|
398 |
$('.new-customer').toggle();
|
399 |
|
400 |
+
var new_customer = $( '#edd-new-customer' );
|
401 |
if ($('.new-customer').is(":visible")) {
|
402 |
+
new_customer.val(1);
|
403 |
} else {
|
404 |
+
new_customer.val(0);
|
405 |
}
|
406 |
|
407 |
});
|
415 |
|
416 |
e.preventDefault();
|
417 |
|
418 |
+
var order_download_select = $( '#edd_order_download_select' ),
|
419 |
+
order_download_quantity = $( '#edd-order-download-quantity' ),
|
420 |
+
order_download_amount = $( '#edd-order-download-amount' ),
|
421 |
+
selected_price_option = $( '.edd_price_options_select option:selected' );
|
422 |
+
|
423 |
+
var download_id = order_download_select.val();
|
424 |
+
var download_title = order_download_select.find(':selected').text();
|
425 |
+
var quantity = order_download_quantity.val();
|
426 |
+
var amount = order_download_amount.val();
|
427 |
+
var price_id = selected_price_option.val();
|
428 |
+
var price_name = selected_price_option.text();
|
429 |
|
430 |
if( download_id < 1 ) {
|
431 |
return false;
|
499 |
// Remove a download from a purchase
|
500 |
$('#edd-order-recalc-total').on('click', function(e) {
|
501 |
e.preventDefault();
|
502 |
+
var total = 0,
|
503 |
+
purchased_files = $( '#edd-purchased-files .row .edd-payment-details-download-amount' );
|
504 |
+
|
505 |
+
if( purchased_files.length ) {
|
506 |
+
purchased_files.each(function() {
|
507 |
total += parseFloat( $(this).val() );
|
508 |
});
|
509 |
}
|
690 |
|
691 |
$('#products').change(function() {
|
692 |
|
693 |
+
var product_conditions = $( '#edd-discount-product-conditions' );
|
|
|
|
|
694 |
|
695 |
+
if( $(this).val() ) {
|
696 |
+
product_conditions.show();
|
697 |
} else {
|
698 |
+
product_conditions.hide();
|
|
|
|
|
699 |
}
|
700 |
|
701 |
});
|
720 |
|
721 |
// Show hide extended date options
|
722 |
$( '#edd-graphs-date-options' ).change( function() {
|
723 |
+
var $this = $(this),
|
724 |
+
date_range_options = $( '#edd-date-range-options' );
|
725 |
+
|
726 |
if ( 'other' === $this.val() ) {
|
727 |
+
date_range_options.show();
|
728 |
} else {
|
729 |
+
date_range_options.hide();
|
730 |
}
|
731 |
});
|
732 |
|
738 |
|
739 |
$( '#edd_customer_export_download' ).change( function() {
|
740 |
|
741 |
+
var $this = $(this),
|
742 |
+
download_id = $('option:selected', $this).val(),
|
743 |
+
customer_export_option = $( '#edd_customer_export_option' );
|
744 |
|
745 |
if ( '0' === $this.val() ) {
|
746 |
+
customer_export_option.show();
|
747 |
} else {
|
748 |
+
customer_export_option.hide();
|
749 |
}
|
750 |
|
751 |
// On Download Select, Check if Variable Prices Exist
|
754 |
action : 'edd_check_for_download_price_variations',
|
755 |
download_id: download_id
|
756 |
};
|
757 |
+
|
758 |
+
var price_options_select = $('.edd_price_options_select');
|
759 |
+
|
760 |
$.post(ajaxurl, data, function(response) {
|
761 |
+
price_options_select.remove();
|
762 |
$this.after( response );
|
763 |
});
|
764 |
} else {
|
765 |
+
price_options_select.remove();
|
766 |
}
|
767 |
});
|
768 |
|
786 |
|
787 |
general : function() {
|
788 |
|
789 |
+
var edd_color_picker = $('.edd-color-picker');
|
790 |
+
|
791 |
+
if( edd_color_picker.length ) {
|
792 |
+
edd_color_picker.wpColorPicker();
|
793 |
}
|
794 |
|
795 |
// Settings Upload field JS
|
796 |
if ( typeof wp === "undefined" || '1' !== edd_vars.new_media_ui ) {
|
797 |
//Old Thickbox uploader
|
798 |
+
var edd_settings_upload_button = $( '.edd_settings_upload_button' );
|
799 |
+
if ( edd_settings_upload_button.length > 0 ) {
|
800 |
window.formfield = '';
|
801 |
|
802 |
+
$('body').on('click', edd_settings_upload_button, function(e) {
|
803 |
e.preventDefault();
|
804 |
window.formfield = $(this).parent().prev();
|
805 |
window.tbframe_interval = setInterval(function() {
|
891 |
},
|
892 |
|
893 |
taxes : function() {
|
894 |
+
var no_states = $('select.edd-no-states');
|
895 |
+
if( no_states.length ) {
|
896 |
+
no_states.closest('tr').hide();
|
897 |
}
|
898 |
|
899 |
// Update base state field based on selected base country
|
980 |
emails : function() {
|
981 |
|
982 |
// Show the email template previews
|
983 |
+
var email_preview_wrap = $('#email-preview-wrap');
|
984 |
+
if( email_preview_wrap.length ) {
|
985 |
var emailPreview = $('#email-preview');
|
986 |
+
email_preview_wrap.colorbox({
|
987 |
inline: true,
|
988 |
href: emailPreview,
|
989 |
width: '80%',
|
995 |
|
996 |
misc : function() {
|
997 |
|
998 |
+
var downloadMethod = $('select[name="edd_settings[download_method]"]');
|
999 |
+
var symlink = downloadMethod.parent().parent().next();
|
1000 |
+
|
1001 |
// Hide Symlink option if Download Method is set to Direct
|
1002 |
+
if( downloadMethod.val() == 'direct' ) {
|
1003 |
+
symlink.hide();
|
1004 |
+
symlink.find('input').prop('checked', false);
|
1005 |
}
|
1006 |
// Toggle download method option
|
1007 |
+
downloadMethod.on('change', function() {
|
|
|
1008 |
if( $(this).val() == 'direct' ) {
|
1009 |
symlink.hide();
|
1010 |
+
symlink.find('input').prop('checked', false);
|
1011 |
} else {
|
1012 |
symlink.show();
|
|
|
1013 |
}
|
1014 |
});
|
|
|
1015 |
}
|
1016 |
|
1017 |
}
|
1062 |
var $price = $( '#edd-download-data input[name="_edd_regprice"]' ).val();
|
1063 |
|
1064 |
var data = {
|
1065 |
+
action: 'edd_save_bulk_edit',
|
1066 |
+
edd_bulk_nonce: $post_ids,
|
1067 |
+
post_ids: $post_ids,
|
1068 |
+
price: $price
|
1069 |
};
|
1070 |
|
1071 |
// save the data
|
1186 |
};
|
1187 |
EDD_Tools.init();
|
1188 |
|
1189 |
+
/**
|
1190 |
+
* Export screen JS
|
1191 |
+
*/
|
1192 |
+
var EDD_Export = {
|
1193 |
+
|
1194 |
+
init : function() {
|
1195 |
+
this.submit();
|
1196 |
+
},
|
1197 |
+
|
1198 |
+
submit : function() {
|
1199 |
+
|
1200 |
+
var self = this;
|
1201 |
+
|
1202 |
+
$('body').on( 'submit', '.edd-export-form', function(e) {
|
1203 |
+
e.preventDefault();
|
1204 |
+
|
1205 |
+
var data = $(this).serialize();
|
1206 |
+
|
1207 |
+
$(this).append( '<span class="spinner is-active"></span><div class="edd-progress"><div></div></div>' );
|
1208 |
+
|
1209 |
+
// start the process
|
1210 |
+
self.process_step( 1, data, self );
|
1211 |
+
|
1212 |
+
});
|
1213 |
+
},
|
1214 |
+
|
1215 |
+
process_step : function( step, data, self ) {
|
1216 |
+
|
1217 |
+
$.ajax({
|
1218 |
+
type: 'POST',
|
1219 |
+
url: ajaxurl,
|
1220 |
+
data: {
|
1221 |
+
form: data,
|
1222 |
+
action: 'edd_do_ajax_export',
|
1223 |
+
step: step,
|
1224 |
+
},
|
1225 |
+
dataType: "json",
|
1226 |
+
success: function( response ) {
|
1227 |
+
|
1228 |
+
if( 'done' == response.step ) {
|
1229 |
+
|
1230 |
+
var export_form = $('.edd-export-form');
|
1231 |
+
|
1232 |
+
export_form.find('.spinner').remove();
|
1233 |
+
export_form.find('.edd-progress').remove();
|
1234 |
+
|
1235 |
+
window.location = response.url;
|
1236 |
+
|
1237 |
+
} else {
|
1238 |
+
|
1239 |
+
$('.edd-progress div').animate({
|
1240 |
+
width: response.percentage + '%',
|
1241 |
+
}, 50, function() {
|
1242 |
+
// Animation complete.
|
1243 |
+
});
|
1244 |
+
self.process_step( parseInt( response.step ), data, self );
|
1245 |
+
}
|
1246 |
+
|
1247 |
+
}
|
1248 |
+
}).fail(function (response) {
|
1249 |
+
if ( window.console && window.console.log ) {
|
1250 |
+
console.log( response );
|
1251 |
+
}
|
1252 |
+
});
|
1253 |
+
|
1254 |
+
}
|
1255 |
+
|
1256 |
+
};
|
1257 |
+
EDD_Export.init();
|
1258 |
+
|
1259 |
/**
|
1260 |
* Customer management screen JS
|
1261 |
*/
|
1262 |
var EDD_Customer = {
|
1263 |
|
1264 |
+
vars: {
|
1265 |
+
customer_card_wrap_editable: $( '#edd-customer-card-wrapper .editable' ),
|
1266 |
+
customer_card_wrap_edit_item: $( '#edd-customer-card-wrapper .edit-item' ),
|
1267 |
+
user_id: $('input[name="customerinfo[user_id]"]'),
|
1268 |
+
state_input: $(':input[name="customerinfo[state]"]'),
|
1269 |
+
note: $( '#customer-note' ),
|
1270 |
+
},
|
1271 |
init : function() {
|
1272 |
this.edit_customer();
|
1273 |
this.user_search();
|
1280 |
edit_customer: function() {
|
1281 |
$( 'body' ).on( 'click', '#edit-customer', function( e ) {
|
1282 |
e.preventDefault();
|
1283 |
+
|
1284 |
+
EDD_Customer.vars.customer_card_wrap_editable.hide();
|
1285 |
+
EDD_Customer.vars.customer_card_wrap_edit_item.fadeIn().css( 'display', 'block' );
|
1286 |
});
|
1287 |
},
|
1288 |
user_search: function() {
|
1290 |
$('body').on('click.eddSelectUser', '.edd_user_search_results a', function( e ) {
|
1291 |
e.preventDefault();
|
1292 |
var user_id = $(this).data('userid');
|
1293 |
+
EDD_Customer.vars.user_id.val(user_id);
|
1294 |
});
|
1295 |
},
|
1296 |
remove_user: function() {
|
1315 |
cancel_edit: function() {
|
1316 |
$( 'body' ).on( 'click', '#edd-edit-customer-cancel', function( e ) {
|
1317 |
e.preventDefault();
|
1318 |
+
EDD_Customer.vars.customer_card_wrap_edit_item.hide();
|
1319 |
+
EDD_Customer.vars.customer_card_wrap_editable.show();
|
1320 |
+
|
1321 |
$( '.edd_user_search_results' ).html('');
|
1322 |
});
|
1323 |
},
|
1331 |
};
|
1332 |
$.post(ajaxurl, data, function (response) {
|
1333 |
if( 'nostates' == response ) {
|
1334 |
+
EDD_Customer.vars.state_input.replaceWith( '<input type="text" name="' + data.field_name + '" value="" class="edd-edit-toggles medium-text"/>' );
|
1335 |
} else {
|
1336 |
+
EDD_Customer.vars.state_input.replaceWith( response );
|
1337 |
}
|
1338 |
});
|
1339 |
|
1346 |
var postData = {
|
1347 |
edd_action : 'add-customer-note',
|
1348 |
customer_id : $( '#customer-id' ).val(),
|
1349 |
+
customer_note : EDD_Customer.vars.note.val(),
|
1350 |
add_customer_note_nonce: $( '#add_customer_note_nonce' ).val()
|
1351 |
};
|
1352 |
|
1359 |
success: function ( response ) {
|
1360 |
$( '#edd-customer-notes' ).prepend( response );
|
1361 |
$( '.edd-no-customer-notes' ).hide();
|
1362 |
+
EDD_Customer.vars.note.val( '' );
|
1363 |
}
|
1364 |
}).fail( function ( data ) {
|
1365 |
if ( window.console && window.console.log ) {
|
1368 |
});
|
1369 |
|
1370 |
} else {
|
1371 |
+
var border_color = EDD_Customer.vars.note.css( 'border-color' );
|
1372 |
+
EDD_Customer.vars.note.css( 'border-color', 'red' );
|
1373 |
setTimeout( function() {
|
1374 |
+
EDD_Customer.vars.note.css( 'border-color', border_color );
|
1375 |
}, 500 );
|
1376 |
}
|
1377 |
});
|
1462 |
});
|
1463 |
|
1464 |
});
|
1465 |
+
|
1466 |
+
// Graphing Helper Functions
|
1467 |
+
|
1468 |
+
var eddFormatCurrency = function (value) {
|
1469 |
+
// Convert the value to a floating point number in case it arrives as a string.
|
1470 |
+
var numeric = parseFloat(value);
|
1471 |
+
// Specify the local currency.
|
1472 |
+
var storeCurrency = edd_vars.currency;
|
1473 |
+
var decimalPlaces = edd_vars.currency_decimals;
|
1474 |
+
return numeric.toLocaleString(storeCurrency, { style: 'currency', currency: storeCurrency, minimumFractionDigits: decimalPlaces, maximumFractionDigits: decimalPlaces });
|
1475 |
+
}
|
1476 |
+
|
1477 |
+
var eddFormatNumber = function(value) {
|
1478 |
+
// Convert the value to a floating point number in case it arrives as a string.
|
1479 |
+
var numeric = parseFloat(value);
|
1480 |
+
// Specify the local currency.
|
1481 |
+
var storeCurrency = edd_vars.currency;
|
1482 |
+
var decimalPlaces = edd_vars.currency_decimals;
|
1483 |
+
return numeric.toLocaleString(storeCurrency, { style: 'decimal', minimumFractionDigits: 0, maximumFractionDigits: 0 });
|
1484 |
+
}
|
1485 |
+
|
1486 |
+
var eddLabelFormatter = function (label, series) {
|
1487 |
+
return '<div style="font-size:12px; text-align:center; padding:2px">' + label + '</div>';
|
1488 |
+
}
|
1489 |
+
|
1490 |
+
var eddLegendFormatterSales = function (label, series) {
|
1491 |
+
var slug = label.toLowerCase().replace(/\s/g, '-');
|
1492 |
+
var color = '<div class="edd-legend-color" style="background-color: ' + series.color + '"></div>';
|
1493 |
+
var value = '<div class="edd-pie-legend-item">' + label + ': ' + Math.round(series.percent) + '% (' + eddFormatNumber(series.data[0][1]) + ')</div>';
|
1494 |
+
var item = '<div id="' + series.edd_vars.id + slug + '" class="edd-legend-item-wrapper">' + color + value + '</div>';
|
1495 |
+
|
1496 |
+
jQuery('#edd-pie-legend-' + series.edd_vars.id).append( item );
|
1497 |
+
return item;
|
1498 |
+
}
|
1499 |
+
|
1500 |
+
var eddLegendFormatterEarnings = function (label, series) {
|
1501 |
+
var slug = label.toLowerCase().replace(/\s/g, '-');
|
1502 |
+
var color = '<div class="edd-legend-color" style="background-color: ' + series.color + '"></div>';
|
1503 |
+
var value = '<div class="edd-pie-legend-item">' + label + ': ' + Math.round(series.percent) + '% (' + eddFormatCurrency(series.data[0][1]) + ')</div>';
|
1504 |
+
var item = '<div id="' + series.edd_vars.id + slug + '" class="edd-legend-item-wrapper">' + color + value + '</div>';
|
1505 |
+
|
1506 |
+
jQuery('#edd-pie-legend-' + series.edd_vars.id).append( item );
|
1507 |
+
return item;
|
1508 |
+
}
|
assets/js/admin-scripts.min.js
CHANGED
@@ -1 +1 @@
|
|
1 |
-
jQuery(document).ready(function(e){var t={init:function(){this.add(),this.move(),this.remove(),this.type(),this.prices(),this.files(),this.updatePrices()},clone_repeatable:function(t){var d=highest=1;return t.parent().find("tr.edd_repeatable_row").each(function(){var t=e(this).data("key");parseInt(t)>highest&&(highest=t)}),d=highest+=1,clone=t.clone(),clone.find("select").each(function(){e(this).val(t.find('select[name="'+e(this).attr("name")+'"]').val())}),clone.removeClass("edd_add_blank"),clone.attr("data-key",d),clone.find("td input, td select, textarea").val(""),clone.find("input, select, textarea").each(function(){var t=e(this).attr("name");t=t.replace(/\[(\d+)\]/,"["+parseInt(d)+"]"),e(this).attr("name",t).attr("id",t)}),clone.find("span.edd_price_id").each(function(){e(this).text(parseInt(d))}),clone.find(".edd_repeatable_default_input").each(function(){e(this).val(parseInt(d)).removeAttr("checked")}),clone},add:function(){e("body").on("click",".submit .edd_add_repeatable",function(d){d.preventDefault();var n=e(this),a=n.parent().parent().prev("tr"),o=t.clone_repeatable(a);o.insertAfter(a).find("input, textarea, select").filter(":visible").eq(0).focus()})},move:function(){e(".edd_repeatable_table tbody").sortable({handle:".edd_draghandle",items:".edd_repeatable_row",opacity:.6,cursor:"move",axis:"y",update:function(){var t=0;e(this).find("tr").each(function(){e(this).find("input.edd_repeatable_index").each(function(){e(this).val(t)}),t++})}})},remove:function(){e("body").on("click",".edd_remove_repeatable",function(t){t.preventDefault();var d=e(this).parent().parent("tr"),n=d.parent().find("tr").length-1,a=e(this).data("type"),o="tr.edd_repeatable_"+a+"s";if("price"===a){var i=d.data("key");e('.edd_repeatable_condition_field option[value="'+i+'"]').remove()}if(n>1)e("input, select",d).val(""),d.fadeOut("fast").remove();else switch(a){case"price":alert(edd_vars.one_price_min);break;case"file":e("input, select",d).val("");break;default:alert(edd_vars.one_field_min)}e(o).each(function(t){e(this).find("input, select").each(function(){var d=e(this).attr("name");d=d.replace(/\[(\d+)\]/,"["+t+"]"),e(this).attr("name",d).attr("id",d)})})})},type:function(){e("body").on("change","#_edd_product_type",function(){"bundle"===e(this).val()?(e("#edd_products").show(),e("#edd_download_files").hide(),e("#edd_download_limit_wrap").hide()):(e("#edd_products").hide(),e("#edd_download_files").show(),e("#edd_download_limit_wrap").show())})},prices:function(){e("body").on("change","#edd_variable_pricing",function(){e(".edd_pricing_fields,.edd_repeatable_table .pricing").toggle()})},files:function(){if("undefined"==typeof wp||"1"!==edd_vars.new_media_ui)e(".edd_upload_file_button").length>0&&(window.formfield="",e("body").on("click",".edd_upload_file_button",function(t){if(t.preventDefault(),window.formfield=e(this).parent().prev(),window.tbframe_interval=setInterval(function(){jQuery("#TB_iframeContent").contents().find(".savesend .button").val(edd_vars.use_this_file).end().find("#insert-gallery, .wp-post-thumbnail").hide()},2e3),null!=edd_vars.post_id)var d="post_id="+edd_vars.post_id+"&";tb_show(edd_vars.add_new_download,"media-upload.php?"+d+"TB_iframe=true")}),window.edd_send_to_editor=window.send_to_editor,window.send_to_editor=function(t){window.formfield?(imgurl=e("a","<div>"+t+"</div>").attr("href"),window.formfield.val(imgurl),window.clearInterval(window.tbframe_interval),tb_remove()):window.edd_send_to_editor(t),window.send_to_editor=window.edd_send_to_editor,window.formfield="",window.imagefield=!1});else{var d;window.formfield="",e("body").on("click",".edd_upload_file_button",function(n){n.preventDefault();var a=e(this);return window.formfield=e(this).closest(".edd_repeatable_upload_wrapper"),d?void d.open():(d=wp.media.frames.file_frame=wp.media({frame:"post",state:"insert",title:a.data("uploader-title"),button:{text:a.data("uploader-button-text")},multiple:"0"==e(this).data("multiple")?!1:!0}),d.on("menu:render:default",function(e){var t={};e.unset("library-separator"),e.unset("gallery"),e.unset("featured-image"),e.unset("embed"),e.set(t)}),d.on("insert",function(){var e=d.state().get("selection");e.each(function(e,d){if(e=e.toJSON(),0===d)window.formfield.find(".edd_repeatable_attachment_id_field").val(e.id),window.formfield.find(".edd_repeatable_upload_field").val(e.url),window.formfield.find(".edd_repeatable_name_field").val(e.title);else{var n=window.formfield,a=t.clone_repeatable(n);a.find(".edd_repeatable_attachment_id_field").val(e.id),a.find(".edd_repeatable_upload_field").val(e.url),a.find(".edd_repeatable_name_field").val(e.title.length>0?e.title:e.filename),a.insertAfter(n)}})}),void d.open())});var d;window.formfield=""}},updatePrices:function(){e("#edd_price_fields").on("keyup",".edd_variable_prices_name",function(){var t=e(this).parents("tr").data("key"),d=e(this).val(),n=e(".edd_repeatable_condition_field option[value="+t+"]");n.length>0?n.text(d):e(".edd_repeatable_condition_field").append(e("<option></option>").attr("value",t).text(d))})}};if(t.init(),e(".edd_datepicker").length>0){var d="mm/dd/yy";e(".edd_datepicker").datepicker({dateFormat:d})}var n={init:function(){this.edit_address(),this.remove_download(),this.add_download(),this.new_customer(),this.recalculate_total(),this.variable_prices_check(),this.add_note(),this.remove_note(),this.resend_receipt(),this.copy_download_link()},edit_address:function(){e('select[name="edd-payment-address[0][country]"]').change(function(){var t=e(this);return data={action:"edd_get_shop_states",country:t.val(),field_name:"edd-payment-address[0][state]"},e.post(ajaxurl,data,function(t){e("#edd-order-address-state-wrap select, #edd-order-address-state-wrap input").replaceWith("nostates"==t?'<input type="text" name="edd-payment-address[0][state]" value="" class="edd-edit-toggles medium-text"/>':t)}),!1})},remove_download:function(){e("#edd-purchased-files").on("click",".edd-order-remove-download",function(){if(confirm(edd_vars.delete_payment_download)){var t=e(this).data("key"),d=(e(".edd-payment-id").val(),e('input[name="edd-payment-details-downloads['+t+'][id]"]').val()),n=e('input[name="edd-payment-details-downloads['+t+'][price_id]"]').val(),a=e('input[name="edd-payment-details-downloads['+t+'][quantity]"]').val(),o=e('input[name="edd-payment-details-downloads['+t+'][amount]"]').val(),i=e('input[name="edd-payment-removed"]').val();i=e.parseJSON(i),i.length<1&&(i={});var r=[{id:d,price_id:n,quantity:a,amount:o}];i[t]=r,e('input[name="edd-payment-removed"]').val(JSON.stringify(i)),e(this).parent().parent().parent().remove(),e("#edd-payment-downloads-changed").val(1),e(".edd-order-payment-recalc-totals").show()}return!1})},new_customer:function(){e("#edd-customer-details").on("click",".edd-payment-new-customer, .edd-payment-new-customer-cancel",function(t){t.preventDefault(),e(".customer-info").toggle(),e(".new-customer").toggle(),e("#edd-new-customer").val(e(".new-customer").is(":visible")?1:0)})},add_download:function(){e("#edd-purchased-files").on("click","#edd-order-add-download",function(t){t.preventDefault();var d=e("#edd_order_download_select").val(),n=e("#edd_order_download_select").find(":selected").text(),a=e("#edd-order-download-quantity").val(),o=e("#edd-order-download-amount").val(),i=e(".edd_price_options_select option:selected").val(),r=e(".edd_price_options_select option:selected").text();if(1>d)return!1;if(o||(o=0),o=parseFloat(o),isNaN(o))return alert(edd_vars.numeric_item_price),!1;if("1"===edd_vars.quantities_enabled){if(isNaN(parseInt(a)))return alert(edd_vars.numeric_quantity),!1;o*=a}o=o.toFixed(edd_vars.currency_decimals);var s=o+edd_vars.currency_sign;"before"===edd_vars.currency_pos&&(s=edd_vars.currency_sign+o),r&&(n=n+" - "+r);var c=e("#edd-purchased-files div.row").length,l=e("#edd-purchased-files div.row:last").clone();l.find(".download span").html('<a href="post.php?post='+d+'&action=edit"></a>'),l.find(".download span a").text(n),l.find(".price-text").text(s),l.find(".item-quantity").text(a),l.find(".item-price").text(edd_vars.currency_sign+(o/a).toFixed(edd_vars.currency_decimals)),l.find("input.edd-payment-details-download-id").val(d),l.find("input.edd-payment-details-download-price-id").val(i),l.find("input.edd-payment-details-download-amount").val(o),l.find("input.edd-payment-details-download-quantity").val(a),l.find("input.edd-payment-details-download-has-log").val(0),l.find("input").each(function(){var t=e(this).attr("name");t=t.replace(/\[(\d+)\]/,"["+parseInt(c)+"]"),e(this).attr("name",t).attr("id",t)}),e("#edd-payment-downloads-changed").val(1),e(l).insertAfter("#edd-purchased-files div.row:last"),e(".edd-order-payment-recalc-totals").show()})},recalculate_total:function(){e("#edd-order-recalc-total").on("click",function(t){t.preventDefault();var d=0;e("#edd-purchased-files .row .edd-payment-details-download-amount").length&&e("#edd-purchased-files .row .edd-payment-details-download-amount").each(function(){d+=parseFloat(e(this).val())}),e(".edd-payment-fees").length&&e(".edd-payment-fees span.fee-amount").each(function(){d+=parseFloat(e(this).data("fee"))}),e("input[name=edd-payment-total]").val(d)})},variable_prices_check:function(){e("#edd-purchased-files").on("change","select#edd_order_download_select",function(){var t=e(this),d=t.val();if(parseInt(d)>0){var n={action:"edd_check_for_download_price_variations",download_id:d};e.ajax({type:"POST",data:n,url:ajaxurl,success:function(d){e(".edd_price_options_select").remove(),e(d).insertAfter(t.next())}}).fail(function(e){window.console&&window.console.log&&console.log(e)})}})},add_note:function(){e("#edd-add-payment-note").on("click",function(t){t.preventDefault();var d={action:"edd_insert_payment_note",payment_id:e(this).data("payment-id"),note:e("#edd-payment-note").val()};if(d.note)e.ajax({type:"POST",data:d,url:ajaxurl,success:function(t){e("#edd-payment-notes-inner").append(t),e(".edd-no-payment-notes").hide(),e("#edd-payment-note").val("")}}).fail(function(e){window.console&&window.console.log&&console.log(e)});else{var n=e("#edd-payment-note").css("border-color");e("#edd-payment-note").css("border-color","red"),setTimeout(function(){e("#edd-payment-note").css("border-color",n)},500)}})},remove_note:function(){e("body").on("click",".edd-delete-payment-note",function(t){if(t.preventDefault(),confirm(edd_vars.delete_payment_note)){var d={action:"edd_delete_payment_note",payment_id:e(this).data("payment-id"),note_id:e(this).data("note-id")};return e.ajax({type:"POST",data:d,url:ajaxurl,success:function(){return e("#edd-payment-note-"+d.note_id).remove(),e(".edd-payment-note").length||e(".edd-no-payment-notes").show(),!1}}).fail(function(e){window.console&&window.console.log&&console.log(e)}),!0}})},resend_receipt:function(){e("body").on("click","#edd-resend-receipt",function(){return confirm(edd_vars.resend_receipt)})},copy_download_link:function(){e("body").on("click",".edd-copy-download-link",function(t){t.preventDefault();var d=e(this),n={action:"edd_get_file_download_link",payment_id:e('input[name="edd_payment_id"]').val(),download_id:d.data("download-id"),price_id:d.data("price-id")};e.ajax({type:"POST",data:n,url:ajaxurl,success:function(t){return e("#edd-download-link").dialog({width:400}).html('<textarea rows="10" cols="40" id="edd-download-link-textarea">'+t+"</textarea>"),e("#edd-download-link-textarea").focus().select(),!1}}).fail(function(e){window.console&&window.console.log&&console.log(e)})})}};n.init();var a={init:function(){this.type_select(),this.product_requirements()},type_select:function(){e("#edd-edit-discount #edd-type, #edd-add-discount #edd-type").change(function(){e(".edd-amount-description").toggle()})},product_requirements:function(){e("#products").change(function(){e(this).val()?e("#edd-discount-product-conditions").show():e("#edd-discount-product-conditions").hide()})}};a.init();var o={init:function(){this.date_options(),this.customers_export()},date_options:function(){e("#edd-graphs-date-options").change(function(){var t=e(this);"other"===t.val()?e("#edd-date-range-options").show():e("#edd-date-range-options").hide()})},customers_export:function(){e("#edd_customer_export_download").change(function(){var t=e(this),d=e("option:selected",t).val();if("0"===t.val()?e("#edd_customer_export_option").show():e("#edd_customer_export_option").hide(),0!=parseInt(d)){var n={action:"edd_check_for_download_price_variations",download_id:d};e.post(ajaxurl,n,function(d){e(".edd_price_options_select").remove(),t.after(d)})}else e(".edd_price_options_select").remove()})}};o.init();var i={init:function(){this.general(),this.taxes(),this.emails(),this.misc()},general:function(){if(e(".edd-color-picker").length&&e(".edd-color-picker").wpColorPicker(),"undefined"==typeof wp||"1"!==edd_vars.new_media_ui)e(".edd_settings_upload_button").length>0&&(window.formfield="",e("body").on("click",".edd_settings_upload_button",function(t){t.preventDefault(),window.formfield=e(this).parent().prev(),window.tbframe_interval=setInterval(function(){jQuery("#TB_iframeContent").contents().find(".savesend .button").val(edd_vars.use_this_file).end().find("#insert-gallery, .wp-post-thumbnail").hide()},2e3),tb_show(edd_vars.add_new_download,"media-upload.php?TB_iframe=true")}),window.edd_send_to_editor=window.send_to_editor,window.send_to_editor=function(t){window.formfield?(imgurl=e("a","<div>"+t+"</div>").attr("href"),window.formfield.val(imgurl),window.clearInterval(window.tbframe_interval),tb_remove()):window.edd_send_to_editor(t),window.send_to_editor=window.edd_send_to_editor,window.formfield="",window.imagefield=!1});else{var t;window.formfield="",e("body").on("click",".edd_settings_upload_button",function(d){d.preventDefault();var n=e(this);return window.formfield=e(this).parent().prev(),t?void t.open():(t=wp.media.frames.file_frame=wp.media({frame:"post",state:"insert",title:n.data("uploader_title"),button:{text:n.data("uploader_button_text")},multiple:!1}),t.on("menu:render:default",function(e){var t={};e.unset("library-separator"),e.unset("gallery"),e.unset("featured-image"),e.unset("embed"),e.set(t)}),t.on("insert",function(){var e=t.state().get("selection");e.each(function(e){e=e.toJSON(),window.formfield.val(e.url)})}),void t.open())});var t;window.formfield=""}},taxes:function(){e("select.edd-no-states").length&&e("select.edd-no-states").closest("tr").hide(),e('select[name="edd_settings[base_country]"]').change(function(){var t=e(this),d=t.closest("tr");return data={action:"edd_get_shop_states",country:e(this).val(),field_name:"edd_settings[base_state]"},e.post(ajaxurl,data,function(e){"nostates"==e?d.next().hide():(d.next().show(),d.next().find("select").replaceWith(e))}),!1}),e("body").on("change","#edd_tax_rates select.edd-tax-country",function(){var t=e(this);return data={action:"edd_get_shop_states",country:e(this).val(),field_name:t.attr("name").replace("country","state")},e.post(ajaxurl,data,function(e){if("nostates"==e){var d='<input type="text" name="'+data.field_name+'" value=""/>';t.parent().next().find("select").replaceWith(d)}else t.parent().next().find("input,select").show(),t.parent().next().find("input,select").replaceWith(e)}),!1}),e("#edd_add_tax_rate").on("click",function(){var t=e("#edd_tax_rates tr:last"),d=t.clone(),n=t.parent().find("tr").length;return d.find("td input").not(":input[type=checkbox]").val(""),d.find('td [type="checkbox"]').attr("checked",!1),d.find("input, select").each(function(){var t=e(this).attr("name");t=t.replace(/\[(\d+)\]/,"["+parseInt(n)+"]"),e(this).attr("name",t).attr("id",t)}),d.find("label").each(function(){var t=e(this).attr("for");t=t.replace(/\[(\d+)\]/,"["+parseInt(n)+"]"),e(this).attr("for",t)}),d.insertAfter(t),!1}),e("body").on("click","#edd_tax_rates .edd_remove_tax_rate",function(){if(confirm(edd_vars.delete_tax_rate)){var t=e("#edd_tax_rates tr:visible").length;2===t?(e("#edd_tax_rates select").val(""),e('#edd_tax_rates input[type="text"]').val(""),e('#edd_tax_rates input[type="number"]').val(""),e('#edd_tax_rates input[type="checkbox"]').attr("checked",!1)):e(this).closest("tr").remove()}return!1})},emails:function(){if(e("#email-preview-wrap").length){var t=e("#email-preview");e("#open-email-preview").colorbox({inline:!0,href:t,width:"80%",height:"auto"})}},misc:function(){"direct"!=e('select[name="edd_settings[download_method]"]:selected').val()&&(e('select[name="edd_settings[download_method]"]').parent().parent().next().hide(),e('select[name="edd_settings[download_method]"]').parent().parent().next().find("input").attr("checked",!1)),e('select[name="edd_settings[download_method]"]').on("change",function(){var t=e(this).parent().parent().next();"direct"==e(this).val()?t.hide():(t.show(),t.find("input").attr("checked",!1))})}};i.init(),e(".download_page_edd-payment-history .row-actions .delete a").on("click",function(){return confirm(edd_vars.delete_payment)?!0:!1}),e("#the-list").on("click",".editinline",function(){inlineEditPost.revert();var t=e(this).closest("tr").attr("id");t=t.replace("post-","");var d=e("#post-"+t),n=d.find(".column-price .downloadprice-"+t).val();n!=e("#post-"+t+".column-price .downloadprice-"+t).val()?e(".regprice","#edd-download-data").val(n).attr("disabled",!1):e(".regprice","#edd-download-data").val(edd_vars.quick_edit_warning).attr("disabled","disabled")}),e("body").on("click","#bulk_edit",function(){var t=e("#bulk-edit"),d=new Array;t.find("#bulk-titles").children().each(function(){d.push(e(this).attr("id").replace(/^(ttle)/i,""))});var n=e('#edd-download-data input[name="_edd_regprice"]').val(),a={action:"edd_save_bulk_edit",edd_bulk_nonce:d,post_ids:d,price:n};e.post(ajaxurl,a)}),e(".edd-select-chosen").chosen({inherit_select_classes:!0,placeholder_text_single:edd_vars.one_option,placeholder_text_multiple:edd_vars.one_or_more_option}),e(".chosen-choices").on("click",function(){e(this).children("li").children("input").attr("placeholder",edd_vars.type_to_search)});var r,s=342;e(".edd-select.chosen-container .chosen-search input, .edd-select.chosen-container .search-field input").keyup(function(t){var d=e(this).val(),n=e(this).closest(".edd-select-chosen"),a=n.attr("id").replace("_chosen",""),o=(t.which,"edd_download_search");n.attr("id").indexOf("customer")>=0&&(o="edd_customer_search"),d.length<=3&&"edd_download_search"==o||16==t.which||13==t.which||91==t.which||17==t.which||37==t.which||38==t.which||39==t.which||40==t.which||(clearTimeout(r),r=setTimeout(function(){e.ajax({type:"GET",url:ajaxurl,data:{action:o,s:d,current_id:edd_vars.post_id},dataType:"json",beforeSend:function(){e("ul.chosen-results").empty()},success:function(t){e("#"+a+" option:not(:selected)").remove(),e.each(t,function(t,d){e("#"+a+' option[value="'+d.id+'"]').length||e("#"+a).prepend('<option value="'+d.id+'">'+d.name+"</option>")}),e(".edd-select-chosen").trigger("chosen:updated"),e("#"+a).next().find("input").val(d)}}).fail(function(e){window.console&&window.console.log&&console.log(e)}).done(function(){})},s))}),e("#post").on("click",".edd-thickbox",function(){e(".edd-select-chosen","#choose-download").css("width","100%")});var c={init:function(){this.revoke_api_key(),this.regenerate_api_key()},revoke_api_key:function(){e("body").on("click",".edd-revoke-api-key",function(){return confirm(edd_vars.revoke_api_key)})},regenerate_api_key:function(){e("body").on("click",".edd-regenerate-api-key",function(){return confirm(edd_vars.regenerate_api_key)})}};c.init();var l={init:function(){this.edit_customer(),this.user_search(),this.remove_user(),this.cancel_edit(),this.change_country(),this.add_note(),this.delete_checked()},edit_customer:function(){e("body").on("click","#edit-customer",function(t){t.preventDefault(),e("#edd-customer-card-wrapper .editable").hide(),e("#edd-customer-card-wrapper .edit-item").fadeIn().css("display","block")})},user_search:function(){e("body").on("click.eddSelectUser",".edd_user_search_results a",function(t){t.preventDefault();var d=e(this).data("userid");e('input[name="customerinfo[user_id]"]').val(d)})},remove_user:function(){e("body").on("click","#disconnect-customer",function(t){t.preventDefault();var d=e('input[name="customerinfo[id]"]').val(),n={edd_action:"disconnect-userid",customer_id:d,_wpnonce:e("#edit-customer-info #_wpnonce").val()};e.post(ajaxurl,n,function(){window.location.href=window.location.href},"json")})},cancel_edit:function(){e("body").on("click","#edd-edit-customer-cancel",function(t){t.preventDefault(),e("#edd-customer-card-wrapper .edit-item").hide(),e("#edd-customer-card-wrapper .editable").show(),e(".edd_user_search_results").html("")})},change_country:function(){e('select[name="customerinfo[country]"]').change(function(){var t=e(this);return data={action:"edd_get_shop_states",country:t.val(),field_name:"customerinfo[state]"},e.post(ajaxurl,data,function(t){e(':input[name="customerinfo[state]"]').replaceWith("nostates"==t?'<input type="text" name="'+data.field_name+'" value="" class="edd-edit-toggles medium-text"/>':t)}),!1})},add_note:function(){e("body").on("click","#add-customer-note",function(t){t.preventDefault();var d={edd_action:"add-customer-note",customer_id:e("#customer-id").val(),customer_note:e("#customer-note").val(),add_customer_note_nonce:e("#add_customer_note_nonce").val()};if(d.customer_note)e.ajax({type:"POST",data:d,url:ajaxurl,success:function(t){e("#edd-customer-notes").prepend(t),e(".edd-no-customer-notes").hide(),e("#customer-note").val("")}}).fail(function(e){window.console&&window.console.log&&console.log(e)});else{var n=e("#customer-note").css("border-color");e("#customer-note").css("border-color","red"),setTimeout(function(){e("#customer-note").css("border-color",n)},500)}})},delete_checked:function(){e("#edd-customer-delete-confirm").change(function(){var t=e("#edd-customer-delete-records"),d=e("#edd-delete-customer");e(this).prop("checked")?(t.attr("disabled",!1),d.attr("disabled",!1)):(t.attr("disabled",!0),t.prop("checked",!1),d.attr("disabled",!0))})}};l.init(),e(".edd-ajax-user-search").keyup(function(){var t=e(this).val(),d="";e(this).data("exclude")&&(d=e(this).data("exclude")),e(".edd-ajax").show(),data={action:"edd_search_users",user_name:t,exclude:d},document.body.style.cursor="wait",e.ajax({type:"POST",data:data,dataType:"json",url:ajaxurl,success:function(t){e(".edd-ajax").hide(),e(".edd_user_search_results").removeClass("hidden"),e(".edd_user_search_results span").html(""),e(t.results).appendTo(".edd_user_search_results span"),document.body.style.cursor="default"}})}),e("body").on("click.eddSelectUser",".edd_user_search_results span a",function(t){t.preventDefault();var d=e(this).data("login");e(".edd-ajax-user-search").val(d),e(".edd_user_search_results").addClass("hidden"),e(".edd_user_search_results span").html("")}),e("body").on("click.eddCancelUserSearch",".edd_user_search_results a.edd-ajax-user-cancel",function(t){t.preventDefault(),e(".edd-ajax-user-search").val(""),e(".edd_user_search_results").addClass("hidden"),e(".edd_user_search_results span").html("")}),e.ajax({type:"GET",data:{action:"edd_load_dashboard_widget"},url:ajaxurl,success:function(t){e("#edd_dashboard_sales .inside").html(t)}}),e(document).on("keydown",".customer-note-input",function(t){13==t.keyCode&&(t.metaKey||t.ctrlKey)&&e("#add-customer-note").click()})});
|
1 |
+
jQuery(document).ready(function(a){var b={init:function(){this.add(),this.move(),this.remove(),this.type(),this.prices(),this.files(),this.updatePrices()},clone_repeatable:function(b){var c=highest=1;return b.parent().find("tr.edd_repeatable_row").each(function(){var b=a(this).data("key");parseInt(b)>highest&&(highest=b)}),c=highest+=1,clone=b.clone(),clone.find("select").each(function(){a(this).val(b.find('select[name="'+a(this).attr("name")+'"]').val())}),clone.removeClass("edd_add_blank"),clone.attr("data-key",c),clone.find("td input, td select, textarea").val(""),clone.find("input, select, textarea").each(function(){var b=a(this).attr("name");b=b.replace(/\[(\d+)\]/,"["+parseInt(c)+"]"),a(this).attr("name",b).attr("id",b)}),clone.find("span.edd_price_id").each(function(){a(this).text(parseInt(c))}),clone.find(".edd_repeatable_default_input").each(function(){a(this).val(parseInt(c)).removeAttr("checked")}),clone},add:function(){a("body").on("click",".submit .edd_add_repeatable",function(c){c.preventDefault();var d=a(this),e=d.parent().parent().prev("tr"),f=b.clone_repeatable(e);f.insertAfter(e).find("input, textarea, select").filter(":visible").eq(0).focus()})},move:function(){a(".edd_repeatable_table tbody").sortable({handle:".edd_draghandle",items:".edd_repeatable_row",opacity:.6,cursor:"move",axis:"y",update:function(){var b=0;a(this).find("tr").each(function(){a(this).find("input.edd_repeatable_index").each(function(){a(this).val(b)}),b++})}})},remove:function(){a("body").on("click",".edd_remove_repeatable",function(b){b.preventDefault();var c=a(this).parent().parent("tr"),d=c.parent().find("tr").length-1,e=a(this).data("type"),f="tr.edd_repeatable_"+e+"s";if("price"===e){var g=c.data("key");a('.edd_repeatable_condition_field option[value="'+g+'"]').remove()}if(d>1)a("input, select",c).val(""),c.fadeOut("fast").remove();else switch(e){case"price":alert(edd_vars.one_price_min);break;case"file":a("input, select",c).val("");break;default:alert(edd_vars.one_field_min)}a(f).each(function(b){a(this).find("input, select").each(function(){var c=a(this).attr("name");c=c.replace(/\[(\d+)\]/,"["+b+"]"),a(this).attr("name",c).attr("id",c)})})})},type:function(){a("body").on("change","#_edd_product_type",function(){var c=a("#edd_products"),d=a("#edd_download_files"),e=a("#edd_download_limit_wrap");"bundle"===a(this).val()?(c.show(),d.hide(),e.hide()):(c.hide(),d.show(),e.show())})},prices:function(){a("body").on("change","#edd_variable_pricing",function(){a(".edd_pricing_fields,.edd_repeatable_table .pricing").toggle()})},files:function(){if("undefined"==typeof wp||"1"!==edd_vars.new_media_ui)a(".edd_upload_file_button").length>0&&(window.formfield="",a("body").on("click",".edd_upload_file_button",function(b){if(b.preventDefault(),window.formfield=a(this).parent().prev(),window.tbframe_interval=setInterval(function(){jQuery("#TB_iframeContent").contents().find(".savesend .button").val(edd_vars.use_this_file).end().find("#insert-gallery, .wp-post-thumbnail").hide()},2e3),null!=edd_vars.post_id)var c="post_id="+edd_vars.post_id+"&";tb_show(edd_vars.add_new_download,"media-upload.php?"+c+"TB_iframe=true")}),window.edd_send_to_editor=window.send_to_editor,window.send_to_editor=function(b){window.formfield?(imgurl=a("a","<div>"+b+"</div>").attr("href"),window.formfield.val(imgurl),window.clearInterval(window.tbframe_interval),tb_remove()):window.edd_send_to_editor(b),window.send_to_editor=window.edd_send_to_editor,window.formfield="",window.imagefield=!1});else{var c;window.formfield="",a("body").on("click",".edd_upload_file_button",function(d){d.preventDefault();var e=a(this);return window.formfield=a(this).closest(".edd_repeatable_upload_wrapper"),c?(c.open(),void 0):(c=wp.media.frames.file_frame=wp.media({frame:"post",state:"insert",title:e.data("uploader-title"),button:{text:e.data("uploader-button-text")},multiple:"0"==a(this).data("multiple")?!1:!0}),c.on("menu:render:default",function(a){var b={};a.unset("library-separator"),a.unset("gallery"),a.unset("featured-image"),a.unset("embed"),a.set(b)}),c.on("insert",function(){var a=c.state().get("selection");a.each(function(a,c){if(a=a.toJSON(),0===c)window.formfield.find(".edd_repeatable_attachment_id_field").val(a.id),window.formfield.find(".edd_repeatable_upload_field").val(a.url),window.formfield.find(".edd_repeatable_name_field").val(a.title);else{var d=window.formfield,e=b.clone_repeatable(d);e.find(".edd_repeatable_attachment_id_field").val(a.id),e.find(".edd_repeatable_upload_field").val(a.url),a.title.length>0?e.find(".edd_repeatable_name_field").val(a.title):e.find(".edd_repeatable_name_field").val(a.filename),e.insertAfter(d)}})}),c.open(),void 0)});var c;window.formfield=""}},updatePrices:function(){a("#edd_price_fields").on("keyup",".edd_variable_prices_name",function(){var b=a(this).parents("tr").data("key"),c=a(this).val(),d=a(".edd_repeatable_condition_field option[value="+b+"]");d.length>0?d.text(c):a(".edd_repeatable_condition_field").append(a("<option></option>").attr("value",b).text(c))})}};b.init();var c=a(".edd_datepicker");if(c.length>0){var d="mm/dd/yy";c.datepicker({dateFormat:d})}var e={init:function(){this.edit_address(),this.remove_download(),this.add_download(),this.new_customer(),this.recalculate_total(),this.variable_prices_check(),this.add_note(),this.remove_note(),this.resend_receipt(),this.copy_download_link()},edit_address:function(){a('select[name="edd-payment-address[0][country]"]').change(function(){var b=a(this);return data={action:"edd_get_shop_states",country:b.val(),field_name:"edd-payment-address[0][state]"},a.post(ajaxurl,data,function(b){var c=a("#edd-order-address-state-wrap select, #edd-order-address-state-wrap input");"nostates"==b?c.replaceWith('<input type="text" name="edd-payment-address[0][state]" value="" class="edd-edit-toggles medium-text"/>'):c.replaceWith(b)}),!1})},remove_download:function(){a("#edd-purchased-files").on("click",".edd-order-remove-download",function(){var b=a("body").find("#edd-purchased-files > .row").length;if(1===b)return alert(edd_vars.one_download_min),!1;if(confirm(edd_vars.delete_payment_download)){var c=a(this).data("key");a(".edd-payment-id").val();var e=a('input[name="edd-payment-details-downloads['+c+'][id]"]').val(),f=a('input[name="edd-payment-details-downloads['+c+'][price_id]"]').val(),g=a('input[name="edd-payment-details-downloads['+c+'][quantity]"]').val(),h=a('input[name="edd-payment-details-downloads['+c+'][amount]"]').val(),i=a('input[name="edd-payment-removed"]').val();i=a.parseJSON(i),i.length<1&&(i={});var j=[{id:e,price_id:f,quantity:g,amount:h}];i[c]=j,a('input[name="edd-payment-removed"]').val(JSON.stringify(i)),a(this).parent().parent().parent().remove(),a("#edd-payment-downloads-changed").val(1),a(".edd-order-payment-recalc-totals").show()}return!1})},new_customer:function(){a("#edd-customer-details").on("click",".edd-payment-new-customer, .edd-payment-new-customer-cancel",function(b){b.preventDefault(),a(".customer-info").toggle(),a(".new-customer").toggle();var c=a("#edd-new-customer");a(".new-customer").is(":visible")?c.val(1):c.val(0)})},add_download:function(){a("#edd-purchased-files").on("click","#edd-order-add-download",function(b){b.preventDefault();var c=a("#edd_order_download_select"),d=a("#edd-order-download-quantity"),e=a("#edd-order-download-amount"),f=a(".edd_price_options_select option:selected"),g=c.val(),h=c.find(":selected").text(),i=d.val(),j=e.val(),k=f.val(),l=f.text();if(1>g)return!1;if(j||(j=0),j=parseFloat(j),isNaN(j))return alert(edd_vars.numeric_item_price),!1;if("1"===edd_vars.quantities_enabled){if(isNaN(parseInt(i)))return alert(edd_vars.numeric_quantity),!1;j*=i}j=j.toFixed(edd_vars.currency_decimals);var m=j+edd_vars.currency_sign;"before"===edd_vars.currency_pos&&(m=edd_vars.currency_sign+j),l&&(h=h+" - "+l);var n=a("#edd-purchased-files div.row").length,o=a("#edd-purchased-files div.row:last").clone();o.find(".download span").html('<a href="post.php?post='+g+'&action=edit"></a>'),o.find(".download span a").text(h),o.find(".price-text").text(m),o.find(".item-quantity").text(i),o.find(".item-price").text(edd_vars.currency_sign+(j/i).toFixed(edd_vars.currency_decimals)),o.find("input.edd-payment-details-download-id").val(g),o.find("input.edd-payment-details-download-price-id").val(k),o.find("input.edd-payment-details-download-amount").val(j),o.find("input.edd-payment-details-download-quantity").val(i),o.find("input.edd-payment-details-download-has-log").val(0),o.find("input").each(function(){var b=a(this).attr("name");b=b.replace(/\[(\d+)\]/,"["+parseInt(n)+"]"),a(this).attr("name",b).attr("id",b)}),a("#edd-payment-downloads-changed").val(1),a(o).insertAfter("#edd-purchased-files div.row:last"),a(".edd-order-payment-recalc-totals").show()})},recalculate_total:function(){a("#edd-order-recalc-total").on("click",function(b){b.preventDefault();var c=0,d=a("#edd-purchased-files .row .edd-payment-details-download-amount");d.length&&d.each(function(){c+=parseFloat(a(this).val())}),a(".edd-payment-fees").length&&a(".edd-payment-fees span.fee-amount").each(function(){c+=parseFloat(a(this).data("fee"))}),a("input[name=edd-payment-total]").val(c)})},variable_prices_check:function(){a("#edd-purchased-files").on("change","select#edd_order_download_select",function(){var b=a(this),c=b.val();if(parseInt(c)>0){var d={action:"edd_check_for_download_price_variations",download_id:c};a.ajax({type:"POST",data:d,url:ajaxurl,success:function(c){a(".edd_price_options_select").remove(),a(c).insertAfter(b.next())}}).fail(function(a){window.console&&window.console.log&&console.log(a)})}})},add_note:function(){a("#edd-add-payment-note").on("click",function(b){b.preventDefault();var c={action:"edd_insert_payment_note",payment_id:a(this).data("payment-id"),note:a("#edd-payment-note").val()};if(c.note)a.ajax({type:"POST",data:c,url:ajaxurl,success:function(b){a("#edd-payment-notes-inner").append(b),a(".edd-no-payment-notes").hide(),a("#edd-payment-note").val("")}}).fail(function(a){window.console&&window.console.log&&console.log(a)});else{var d=a("#edd-payment-note").css("border-color");a("#edd-payment-note").css("border-color","red"),setTimeout(function(){a("#edd-payment-note").css("border-color",d)},500)}})},remove_note:function(){a("body").on("click",".edd-delete-payment-note",function(b){if(b.preventDefault(),confirm(edd_vars.delete_payment_note)){var c={action:"edd_delete_payment_note",payment_id:a(this).data("payment-id"),note_id:a(this).data("note-id")};return a.ajax({type:"POST",data:c,url:ajaxurl,success:function(){return a("#edd-payment-note-"+c.note_id).remove(),a(".edd-payment-note").length||a(".edd-no-payment-notes").show(),!1}}).fail(function(a){window.console&&window.console.log&&console.log(a)}),!0}})},resend_receipt:function(){a("body").on("click","#edd-resend-receipt",function(){return confirm(edd_vars.resend_receipt)})},copy_download_link:function(){a("body").on("click",".edd-copy-download-link",function(b){b.preventDefault();var c=a(this),d={action:"edd_get_file_download_link",payment_id:a('input[name="edd_payment_id"]').val(),download_id:c.data("download-id"),price_id:c.data("price-id")};a.ajax({type:"POST",data:d,url:ajaxurl,success:function(b){return a("#edd-download-link").dialog({width:400}).html('<textarea rows="10" cols="40" id="edd-download-link-textarea">'+b+"</textarea>"),a("#edd-download-link-textarea").focus().select(),!1}}).fail(function(a){window.console&&window.console.log&&console.log(a)})})}};e.init();var f={init:function(){this.type_select(),this.product_requirements()},type_select:function(){a("#edd-edit-discount #edd-type, #edd-add-discount #edd-type").change(function(){a(".edd-amount-description").toggle()})},product_requirements:function(){a("#products").change(function(){var b=a("#edd-discount-product-conditions");a(this).val()?b.show():b.hide()})}};f.init();var g={init:function(){this.date_options(),this.customers_export()},date_options:function(){a("#edd-graphs-date-options").change(function(){var b=a(this),c=a("#edd-date-range-options");"other"===b.val()?c.show():c.hide()})},customers_export:function(){a("#edd_customer_export_download").change(function(){var b=a(this),c=a("option:selected",b).val(),d=a("#edd_customer_export_option");if("0"===b.val()?d.show():d.hide(),0!=parseInt(c)){var e={action:"edd_check_for_download_price_variations",download_id:c},f=a(".edd_price_options_select");a.post(ajaxurl,e,function(a){f.remove(),b.after(a)})}else f.remove()})}};g.init();var h={init:function(){this.general(),this.taxes(),this.emails(),this.misc()},general:function(){var b=a(".edd-color-picker");if(b.length&&b.wpColorPicker(),"undefined"==typeof wp||"1"!==edd_vars.new_media_ui){var c=a(".edd_settings_upload_button");c.length>0&&(window.formfield="",a("body").on("click",c,function(b){b.preventDefault(),window.formfield=a(this).parent().prev(),window.tbframe_interval=setInterval(function(){jQuery("#TB_iframeContent").contents().find(".savesend .button").val(edd_vars.use_this_file).end().find("#insert-gallery, .wp-post-thumbnail").hide()},2e3),tb_show(edd_vars.add_new_download,"media-upload.php?TB_iframe=true")}),window.edd_send_to_editor=window.send_to_editor,window.send_to_editor=function(b){window.formfield?(imgurl=a("a","<div>"+b+"</div>").attr("href"),window.formfield.val(imgurl),window.clearInterval(window.tbframe_interval),tb_remove()):window.edd_send_to_editor(b),window.send_to_editor=window.edd_send_to_editor,window.formfield="",window.imagefield=!1})}else{var d;window.formfield="",a("body").on("click",".edd_settings_upload_button",function(b){b.preventDefault();var c=a(this);return window.formfield=a(this).parent().prev(),d?(d.open(),void 0):(d=wp.media.frames.file_frame=wp.media({frame:"post",state:"insert",title:c.data("uploader_title"),button:{text:c.data("uploader_button_text")},multiple:!1}),d.on("menu:render:default",function(a){var b={};a.unset("library-separator"),a.unset("gallery"),a.unset("featured-image"),a.unset("embed"),a.set(b)}),d.on("insert",function(){var a=d.state().get("selection");a.each(function(a){a=a.toJSON(),window.formfield.val(a.url)})}),d.open(),void 0)});var d;window.formfield=""}},taxes:function(){var b=a("select.edd-no-states");b.length&&b.closest("tr").hide(),a('select[name="edd_settings[base_country]"]').change(function(){var b=a(this),c=b.closest("tr");return data={action:"edd_get_shop_states",country:a(this).val(),field_name:"edd_settings[base_state]"},a.post(ajaxurl,data,function(a){"nostates"==a?c.next().hide():(c.next().show(),c.next().find("select").replaceWith(a))}),!1}),a("body").on("change","#edd_tax_rates select.edd-tax-country",function(){var b=a(this);return data={action:"edd_get_shop_states",country:a(this).val(),field_name:b.attr("name").replace("country","state")},a.post(ajaxurl,data,function(a){if("nostates"==a){var c='<input type="text" name="'+data.field_name+'" value=""/>';b.parent().next().find("select").replaceWith(c)}else b.parent().next().find("input,select").show(),b.parent().next().find("input,select").replaceWith(a)}),!1}),a("#edd_add_tax_rate").on("click",function(){var b=a("#edd_tax_rates tr:last"),c=b.clone(),d=b.parent().find("tr").length;return c.find("td input").not(":input[type=checkbox]").val(""),c.find('td [type="checkbox"]').attr("checked",!1),c.find("input, select").each(function(){var b=a(this).attr("name");b=b.replace(/\[(\d+)\]/,"["+parseInt(d)+"]"),a(this).attr("name",b).attr("id",b)}),c.find("label").each(function(){var b=a(this).attr("for");b=b.replace(/\[(\d+)\]/,"["+parseInt(d)+"]"),a(this).attr("for",b)}),c.insertAfter(b),!1}),a("body").on("click","#edd_tax_rates .edd_remove_tax_rate",function(){if(confirm(edd_vars.delete_tax_rate)){var b=a("#edd_tax_rates tr:visible").length;2===b?(a("#edd_tax_rates select").val(""),a('#edd_tax_rates input[type="text"]').val(""),a('#edd_tax_rates input[type="number"]').val(""),a('#edd_tax_rates input[type="checkbox"]').attr("checked",!1)):a(this).closest("tr").remove()}return!1})},emails:function(){var b=a("#email-preview-wrap");if(b.length){var c=a("#email-preview");b.colorbox({inline:!0,href:c,width:"80%",height:"auto"})}},misc:function(){var b=a('select[name="edd_settings[download_method]"]'),c=b.parent().parent().next();"direct"==b.val()&&(c.hide(),c.find("input").prop("checked",!1)),b.on("change",function(){"direct"==a(this).val()?(c.hide(),c.find("input").prop("checked",!1)):c.show()})}};h.init(),a(".download_page_edd-payment-history .row-actions .delete a").on("click",function(){return confirm(edd_vars.delete_payment)?!0:!1}),a("#the-list").on("click",".editinline",function(){inlineEditPost.revert();var b=a(this).closest("tr").attr("id");b=b.replace("post-","");var c=a("#post-"+b),d=c.find(".column-price .downloadprice-"+b).val();d!=a("#post-"+b+".column-price .downloadprice-"+b).val()?a(".regprice","#edd-download-data").val(d).attr("disabled",!1):a(".regprice","#edd-download-data").val(edd_vars.quick_edit_warning).attr("disabled","disabled")}),a("body").on("click","#bulk_edit",function(){var b=a("#bulk-edit"),c=new Array;b.find("#bulk-titles").children().each(function(){c.push(a(this).attr("id").replace(/^(ttle)/i,""))});var d=a('#edd-download-data input[name="_edd_regprice"]').val(),e={action:"edd_save_bulk_edit",edd_bulk_nonce:c,post_ids:c,price:d};a.post(ajaxurl,e)}),a(".edd-select-chosen").chosen({inherit_select_classes:!0,placeholder_text_single:edd_vars.one_option,placeholder_text_multiple:edd_vars.one_or_more_option}),a(".chosen-choices").on("click",function(){a(this).children("li").children("input").attr("placeholder",edd_vars.type_to_search)});var i,j=342;a(".edd-select.chosen-container .chosen-search input, .edd-select.chosen-container .search-field input").keyup(function(b){var c=a(this).val(),d=a(this).closest(".edd-select-chosen"),e=d.attr("id").replace("_chosen","");b.which;var g="edd_download_search";d.attr("id").indexOf("customer")>=0&&(g="edd_customer_search"),c.length<=3&&"edd_download_search"==g||16==b.which||13==b.which||91==b.which||17==b.which||37==b.which||38==b.which||39==b.which||40==b.which||(clearTimeout(i),i=setTimeout(function(){a.ajax({type:"GET",url:ajaxurl,data:{action:g,s:c,current_id:edd_vars.post_id},dataType:"json",beforeSend:function(){a("ul.chosen-results").empty()},success:function(b){a("#"+e+" option:not(:selected)").remove(),a.each(b,function(b,c){a("#"+e+' option[value="'+c.id+'"]').length||a("#"+e).prepend('<option value="'+c.id+'">'+c.name+"</option>")}),a(".edd-select-chosen").trigger("chosen:updated"),a("#"+e).next().find("input").val(c)}}).fail(function(a){window.console&&window.console.log&&console.log(a)}).done(function(){})},j))}),a("#post").on("click",".edd-thickbox",function(){a(".edd-select-chosen","#choose-download").css("width","100%")});var k={init:function(){this.revoke_api_key(),this.regenerate_api_key()},revoke_api_key:function(){a("body").on("click",".edd-revoke-api-key",function(){return confirm(edd_vars.revoke_api_key)})},regenerate_api_key:function(){a("body").on("click",".edd-regenerate-api-key",function(){return confirm(edd_vars.regenerate_api_key)})}};k.init();var l={init:function(){this.submit()},submit:function(){var b=this;a("body").on("submit",".edd-export-form",function(c){c.preventDefault();var d=a(this).serialize();a(this).append('<span class="spinner is-active"></span><div class="edd-progress"><div></div></div>'),b.process_step(1,d,b)})},process_step:function(b,c,d){a.ajax({type:"POST",url:ajaxurl,data:{form:c,action:"edd_do_ajax_export",step:b},dataType:"json",success:function(b){if("done"==b.step){var e=a(".edd-export-form");e.find(".spinner").remove(),e.find(".edd-progress").remove(),window.location=b.url}else a(".edd-progress div").animate({width:b.percentage+"%"},50,function(){}),d.process_step(parseInt(b.step),c,d)}}).fail(function(a){window.console&&window.console.log&&console.log(a)})}};l.init();var m={vars:{customer_card_wrap_editable:a("#edd-customer-card-wrapper .editable"),customer_card_wrap_edit_item:a("#edd-customer-card-wrapper .edit-item"),user_id:a('input[name="customerinfo[user_id]"]'),state_input:a(':input[name="customerinfo[state]"]'),note:a("#customer-note")},init:function(){this.edit_customer(),this.user_search(),this.remove_user(),this.cancel_edit(),this.change_country(),this.add_note(),this.delete_checked()},edit_customer:function(){a("body").on("click","#edit-customer",function(a){a.preventDefault(),m.vars.customer_card_wrap_editable.hide(),m.vars.customer_card_wrap_edit_item.fadeIn().css("display","block")})},user_search:function(){a("body").on("click.eddSelectUser",".edd_user_search_results a",function(b){b.preventDefault();var c=a(this).data("userid");m.vars.user_id.val(c)})},remove_user:function(){a("body").on("click","#disconnect-customer",function(b){b.preventDefault();var c=a('input[name="customerinfo[id]"]').val(),d={edd_action:"disconnect-userid",customer_id:c,_wpnonce:a("#edit-customer-info #_wpnonce").val()};a.post(ajaxurl,d,function(){window.location.href=window.location.href},"json")})},cancel_edit:function(){a("body").on("click","#edd-edit-customer-cancel",function(b){b.preventDefault(),m.vars.customer_card_wrap_edit_item.hide(),m.vars.customer_card_wrap_editable.show(),a(".edd_user_search_results").html("")})},change_country:function(){a('select[name="customerinfo[country]"]').change(function(){var b=a(this);return data={action:"edd_get_shop_states",country:b.val(),field_name:"customerinfo[state]"},a.post(ajaxurl,data,function(a){"nostates"==a?m.vars.state_input.replaceWith('<input type="text" name="'+data.field_name+'" value="" class="edd-edit-toggles medium-text"/>'):m.vars.state_input.replaceWith(a)}),!1})},add_note:function(){a("body").on("click","#add-customer-note",function(b){b.preventDefault();var c={edd_action:"add-customer-note",customer_id:a("#customer-id").val(),customer_note:m.vars.note.val(),add_customer_note_nonce:a("#add_customer_note_nonce").val()};if(c.customer_note)a.ajax({type:"POST",data:c,url:ajaxurl,success:function(b){a("#edd-customer-notes").prepend(b),a(".edd-no-customer-notes").hide(),m.vars.note.val("")}}).fail(function(a){window.console&&window.console.log&&console.log(a)});else{var d=m.vars.note.css("border-color");m.vars.note.css("border-color","red"),setTimeout(function(){m.vars.note.css("border-color",d)},500)}})},delete_checked:function(){a("#edd-customer-delete-confirm").change(function(){var b=a("#edd-customer-delete-records"),c=a("#edd-delete-customer");a(this).prop("checked")?(b.attr("disabled",!1),c.attr("disabled",!1)):(b.attr("disabled",!0),b.prop("checked",!1),c.attr("disabled",!0))})}};m.init(),a(".edd-ajax-user-search").keyup(function(){var b=a(this).val(),c="";a(this).data("exclude")&&(c=a(this).data("exclude")),a(".edd-ajax").show(),data={action:"edd_search_users",user_name:b,exclude:c},document.body.style.cursor="wait",a.ajax({type:"POST",data:data,dataType:"json",url:ajaxurl,success:function(b){a(".edd-ajax").hide(),a(".edd_user_search_results").removeClass("hidden"),a(".edd_user_search_results span").html(""),a(b.results).appendTo(".edd_user_search_results span"),document.body.style.cursor="default"}})}),a("body").on("click.eddSelectUser",".edd_user_search_results span a",function(b){b.preventDefault();var c=a(this).data("login");a(".edd-ajax-user-search").val(c),a(".edd_user_search_results").addClass("hidden"),a(".edd_user_search_results span").html("")}),a("body").on("click.eddCancelUserSearch",".edd_user_search_results a.edd-ajax-user-cancel",function(b){b.preventDefault(),a(".edd-ajax-user-search").val(""),a(".edd_user_search_results").addClass("hidden"),a(".edd_user_search_results span").html("")}),a.ajax({type:"GET",data:{action:"edd_load_dashboard_widget"},url:ajaxurl,success:function(b){a("#edd_dashboard_sales .inside").html(b)}}),a(document).on("keydown",".customer-note-input",function(b){13==b.keyCode&&(b.metaKey||b.ctrlKey)&&a("#add-customer-note").click()})});var eddFormatCurrency=function(a){var b=parseFloat(a),c=edd_vars.currency,d=edd_vars.currency_decimals;return b.toLocaleString(c,{style:"currency",currency:c,minimumFractionDigits:d,maximumFractionDigits:d})},eddFormatNumber=function(a){var b=parseFloat(a),c=edd_vars.currency;return edd_vars.currency_decimals,b.toLocaleString(c,{style:"decimal",minimumFractionDigits:0,maximumFractionDigits:0})},eddLabelFormatter=function(a){return'<div style="font-size:12px; text-align:center; padding:2px">'+a+"</div>"},eddLegendFormatterSales=function(a,b){var c=a.toLowerCase().replace(/\s/g,"-"),d='<div class="edd-legend-color" style="background-color: '+b.color+'"></div>',e='<div class="edd-pie-legend-item">'+a+": "+Math.round(b.percent)+"% ("+eddFormatNumber(b.data[0][1])+")</div>",f='<div id="'+b.edd_vars.id+c+'" class="edd-legend-item-wrapper">'+d+e+"</div>";return jQuery("#edd-pie-legend-"+b.edd_vars.id).append(f),f},eddLegendFormatterEarnings=function(a,b){var c=a.toLowerCase().replace(/\s/g,"-"),d='<div class="edd-legend-color" style="background-color: '+b.color+'"></div>',e='<div class="edd-pie-legend-item">'+a+": "+Math.round(b.percent)+"% ("+eddFormatCurrency(b.data[0][1])+")</div>",f='<div id="'+b.edd_vars.id+c+'" class="edd-legend-item-wrapper">'+d+e+"</div>";return jQuery("#edd-pie-legend-"+b.edd_vars.id).append(f),f};
|
assets/js/edd-ajax.js
CHANGED
@@ -32,7 +32,7 @@ jQuery(document).ready(function ($) {
|
|
32 |
}
|
33 |
|
34 |
// Remove the selected cart item
|
35 |
-
$('.edd-cart').find("[data-cart-item='" + item + "']").parent().
|
36 |
|
37 |
//Reset the data-cart-item attributes to match their new values in the EDD session cart array
|
38 |
var cart_item_counter = 0;
|
@@ -52,11 +52,15 @@ jQuery(document).ready(function ($) {
|
|
52 |
|
53 |
$('span.edd-cart-quantity').text( response.cart_quantity );
|
54 |
$('body').trigger('edd_quantity_updated', [ response.cart_quantity ]);
|
|
|
|
|
|
|
|
|
55 |
|
56 |
-
$('.cart_item.
|
57 |
|
58 |
if( response.cart_quantity == 0 ) {
|
59 |
-
$('.cart_item.edd_subtotal,.edd-cart-number-of-items,.cart_item.edd_checkout').hide();
|
60 |
$('.edd-cart').append('<li class="cart_item empty">' + edd_scripts.empty_cart_message + '</li>');
|
61 |
}
|
62 |
|
@@ -163,23 +167,35 @@ jQuery(document).ready(function ($) {
|
|
163 |
withCredentials: true
|
164 |
},
|
165 |
success: function (response) {
|
166 |
-
|
167 |
-
if( edd_scripts.redirect_to_checkout == '1' ) {
|
168 |
|
169 |
window.location = edd_scripts.checkout_page;
|
170 |
|
171 |
} else {
|
172 |
|
173 |
// Add the new item to the cart widget
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
174 |
if ($('.cart_item.empty').length) {
|
175 |
-
$(response.cart_item).insertBefore('.
|
176 |
-
$('.cart_item.
|
177 |
-
$('.cart_item.empty').remove();
|
178 |
} else {
|
179 |
-
$(response.cart_item).insertBefore('.
|
|
|
|
|
|
|
|
|
|
|
|
|
180 |
}
|
181 |
|
182 |
-
|
183 |
|
184 |
// Update the cart quantity
|
185 |
var items_added = $( '.edd-cart-item-title', response.cart_item ).length;
|
@@ -328,11 +344,13 @@ jQuery(document).ready(function ($) {
|
|
328 |
$.post(edd_global_vars.ajaxurl, $('#edd_purchase_form').serialize() + '&action=edd_process_checkout&edd_ajax=true', function(data) {
|
329 |
if ( $.trim(data) == 'success' ) {
|
330 |
$('.edd_errors').remove();
|
|
|
331 |
$(eddPurchaseform).submit();
|
332 |
} else {
|
333 |
$('#edd-purchase-button').val(complete_purchase_val);
|
334 |
$('.edd-cart-ajax').remove();
|
335 |
$('.edd_errors').remove();
|
|
|
336 |
$('#edd_purchase_submit').before(data);
|
337 |
}
|
338 |
});
|
32 |
}
|
33 |
|
34 |
// Remove the selected cart item
|
35 |
+
$('.edd-cart').find("[data-cart-item='" + item + "']").parent().remove();
|
36 |
|
37 |
//Reset the data-cart-item attributes to match their new values in the EDD session cart array
|
38 |
var cart_item_counter = 0;
|
52 |
|
53 |
$('span.edd-cart-quantity').text( response.cart_quantity );
|
54 |
$('body').trigger('edd_quantity_updated', [ response.cart_quantity ]);
|
55 |
+
if ( edd_scripts.taxes_enabled ) {
|
56 |
+
$('.cart_item.edd_subtotal span').html( response.subtotal );
|
57 |
+
$('.cart_item.edd_cart_tax span').html( response.tax );
|
58 |
+
}
|
59 |
|
60 |
+
$('.cart_item.edd_total span').html( response.total );
|
61 |
|
62 |
if( response.cart_quantity == 0 ) {
|
63 |
+
$('.cart_item.edd_subtotal,.edd-cart-number-of-items,.cart_item.edd_checkout,.cart_item.edd_cart_tax,.cart_item.edd_total').hide();
|
64 |
$('.edd-cart').append('<li class="cart_item empty">' + edd_scripts.empty_cart_message + '</li>');
|
65 |
}
|
66 |
|
167 |
withCredentials: true
|
168 |
},
|
169 |
success: function (response) {
|
170 |
+
if( edd_scripts.redirect_to_checkout == '1' && form.find( '#edd_redirect_to_checkout' ).val() == '1' ) {
|
|
|
171 |
|
172 |
window.location = edd_scripts.checkout_page;
|
173 |
|
174 |
} else {
|
175 |
|
176 |
// Add the new item to the cart widget
|
177 |
+
if ( edd_scripts.taxes_enabled === '1' ) {
|
178 |
+
$('.cart_item.edd_subtotal').show();
|
179 |
+
$('.cart_item.edd_cart_tax').show();
|
180 |
+
}
|
181 |
+
|
182 |
+
$('.cart_item.edd_total').show();
|
183 |
+
$('.cart_item.edd_checkout').show();
|
184 |
+
|
185 |
if ($('.cart_item.empty').length) {
|
186 |
+
$(response.cart_item).insertBefore('.edd-cart-meta:first');
|
187 |
+
$('.cart_item.empty').hide();
|
|
|
188 |
} else {
|
189 |
+
$(response.cart_item).insertBefore('.edd-cart-meta:first');
|
190 |
+
}
|
191 |
+
|
192 |
+
// Update the totals
|
193 |
+
if ( edd_scripts.taxes_enabled === '1' ) {
|
194 |
+
$('.edd-cart-meta.edd_subtotal span').html( response.subtotal );
|
195 |
+
$('.edd-cart-meta.edd_cart_tax span').html( response.tax );
|
196 |
}
|
197 |
|
198 |
+
$('.edd-cart-meta.edd_total span').html( response.total );
|
199 |
|
200 |
// Update the cart quantity
|
201 |
var items_added = $( '.edd-cart-item-title', response.cart_item ).length;
|
344 |
$.post(edd_global_vars.ajaxurl, $('#edd_purchase_form').serialize() + '&action=edd_process_checkout&edd_ajax=true', function(data) {
|
345 |
if ( $.trim(data) == 'success' ) {
|
346 |
$('.edd_errors').remove();
|
347 |
+
$('.edd-error').hide();
|
348 |
$(eddPurchaseform).submit();
|
349 |
} else {
|
350 |
$('#edd-purchase-button').val(complete_purchase_val);
|
351 |
$('.edd-cart-ajax').remove();
|
352 |
$('.edd_errors').remove();
|
353 |
+
$('.edd-error').hide();
|
354 |
$('#edd_purchase_submit').before(data);
|
355 |
}
|
356 |
});
|
assets/js/edd-ajax.min.js
CHANGED
@@ -1 +1 @@
|
|
1 |
-
function edd_load_gateway(
|
1 |
+
function edd_load_gateway(a){jQuery(".edd-cart-ajax").show(),jQuery("#edd_purchase_form_wrap").html('<img src="'+edd_scripts.ajax_loader+'"/>'),jQuery.post(edd_scripts.ajaxurl+"?payment-mode="+a,{action:"edd_load_gateway",edd_payment_mode:a},function(a){jQuery("#edd_purchase_form_wrap").html(a),jQuery(".edd-no-js").hide()})}var edd_scripts;jQuery(document).ready(function(a){a(".edd-no-js").hide(),a("a.edd-add-to-cart").addClass("edd-has-js"),a("body").on("click.eddRemoveFromCart",".edd-remove-from-cart",function(){var c=a(this),d=c.data("cart-item"),e=c.data("action"),f=c.data("download-id"),g={action:e,cart_item:d};return a.ajax({type:"POST",data:g,dataType:"json",url:edd_scripts.ajaxurl,xhrFields:{withCredentials:!0},success:function(b){if(b.removed){if(parseInt(edd_scripts.position_in_cart,10)===parseInt(d,10))return window.location=window.location,!1;a(".edd-cart").find("[data-cart-item='"+d+"']").parent().remove();var c=0;a(".edd-cart").find("[data-cart-item]").each(function(){a(this).attr("data-cart-item",c),c+=1}),a("#edd_purchase_"+f).length&&(a("#edd_purchase_"+f+" .edd_go_to_checkout").hide(),a("#edd_purchase_"+f+" a.edd-add-to-cart").show().removeAttr("data-edd-loading"),"1"==edd_scripts.quantities_enabled&&a("#edd_purchase_"+f+" .edd_download_quantity_wrapper").show()),a("span.edd-cart-quantity").text(b.cart_quantity),a("body").trigger("edd_quantity_updated",[b.cart_quantity]),edd_scripts.taxes_enabled&&(a(".cart_item.edd_subtotal span").html(b.subtotal),a(".cart_item.edd_cart_tax span").html(b.tax)),a(".cart_item.edd_total span").html(b.total),0==b.cart_quantity&&(a(".cart_item.edd_subtotal,.edd-cart-number-of-items,.cart_item.edd_checkout,.cart_item.edd_cart_tax,.cart_item.edd_total").hide(),a(".edd-cart").append('<li class="cart_item empty">'+edd_scripts.empty_cart_message+"</li>")),a("body").trigger("edd_cart_item_removed",[b])}}}).fail(function(a){window.console&&window.console.log&&console.log(a)}).done(function(){}),!1}),a("body").on("click.eddAddToCart",".edd-add-to-cart",function(b){b.preventDefault();var c=a(this),d=c.closest("form"),e=c.find(".edd-loading"),f=c.closest("div"),g=e.width(),h=e.height();c.attr("data-edd-loading",""),e.css({"margin-left":g/-2,"margin-top":h/-2});var d=c.parents("form").last(),i=c.data("download-id"),j=c.data("variable-price"),k=c.data("price-mode"),l=[],m=!0;if("yes"==j)if(d.find(".edd_price_option_"+i).is("input:hidden"))l[0]=a(".edd_price_option_"+i,d).val();else{if(!d.find(".edd_price_option_"+i+":checked",d).length)return c.removeAttr("data-edd-loading"),alert(edd_scripts.select_option),void 0;d.find(".edd_price_option_"+i+":checked",d).each(function(b){if(l[b]=a(this).val(),!0===m){var c=a(this).data("price");c&&c>0&&(m=!1)}})}else l[0]=i,c.data("price")&&c.data("price")>0&&(m=!1);if(m&&d.find(".edd_action_input").val("add_to_cart"),"straight_to_gateway"==d.find(".edd_action_input").val())return d.submit(),!0;var n=c.data("action"),o={action:n,download_id:i,price_ids:l,post_data:a(d).serialize()};return a.ajax({type:"POST",data:o,dataType:"json",url:edd_scripts.ajaxurl,xhrFields:{withCredentials:!0},success:function(b){if("1"==edd_scripts.redirect_to_checkout&&"1"==d.find("#edd_redirect_to_checkout").val())window.location=edd_scripts.checkout_page;else{if("1"===edd_scripts.taxes_enabled&&(a(".cart_item.edd_subtotal").show(),a(".cart_item.edd_cart_tax").show()),a(".cart_item.edd_total").show(),a(".cart_item.edd_checkout").show(),a(".cart_item.empty").length?(a(b.cart_item).insertBefore(".edd-cart-meta:first"),a(".cart_item.empty").hide()):a(b.cart_item).insertBefore(".edd-cart-meta:first"),"1"===edd_scripts.taxes_enabled&&(a(".edd-cart-meta.edd_subtotal span").html(b.subtotal),a(".edd-cart-meta.edd_cart_tax span").html(b.tax)),a(".edd-cart-meta.edd_total span").html(b.total),a(".edd-cart-item-title",b.cart_item).length,a("span.edd-cart-quantity").each(function(){a(this).text(b.cart_quantity),a("body").trigger("edd_quantity_updated",[b.cart_quantity])}),"none"==a(".edd-cart-number-of-items").css("display")&&a(".edd-cart-number-of-items").show("slow"),("no"==j||"multi"!=k)&&(a("a.edd-add-to-cart",f).toggle(),a(".edd_go_to_checkout",f).css("display","inline-block")),"multi"==k&&c.removeAttr("data-edd-loading"),a(".edd_download_purchase_form").length&&("no"==j||!d.find(".edd_price_option_"+i).is("input:hidden"))){var g=a('.edd_download_purchase_form *[data-download-id="'+i+'"]').parents("form");a("a.edd-add-to-cart",g).hide(),"multi"!=k&&g.find(".edd_download_quantity_wrapper").slideUp(),a(".edd_go_to_checkout",g).show().removeAttr("data-edd-loading")}"incart"!=b&&(a(".edd-cart-added-alert",f).fadeIn(),setTimeout(function(){a(".edd-cart-added-alert",f).fadeOut()},3e3)),a("body").trigger("edd_cart_item_added",[b])}}}).fail(function(a){window.console&&window.console.log&&console.log(a)}).done(function(){}),!1}),a("#edd_checkout_form_wrap").on("click",".edd_checkout_register_login",function(){var b=a(this),c={action:b.data("action")};return a(".edd-cart-ajax").show(),a.post(edd_scripts.ajaxurl,c,function(b){a("#edd_checkout_login_register").html(edd_scripts.loading),a("#edd_checkout_login_register").html(b),a(".edd-cart-ajax").hide()}),!1}),a(document).on("click","#edd_purchase_form #edd_login_fields input[type=submit]",function(b){b.preventDefault();var c=a(this).val();a(this).val(edd_global_vars.purchase_loading),a(this).after('<span class="edd-cart-ajax"><i class="edd-icon-spinner edd-icon-spin"></i></span>');var d={action:"edd_process_checkout_login",edd_ajax:1,edd_user_login:a("#edd_login_fields #edd_user_login").val(),edd_user_pass:a("#edd_login_fields #edd_user_pass").val()};a.post(edd_global_vars.ajaxurl,d,function(b){"success"==a.trim(b)?(a(".edd_errors").remove(),window.location=edd_scripts.checkout_page):(a("#edd_login_fields input[type=submit]").val(c),a(".edd-cart-ajax").remove(),a(".edd_errors").remove(),a("#edd-user-login-submit").before(b))})}),a("select#edd-gateway, input.edd-gateway").change(function(){var c=a("#edd-gateway option:selected, input.edd-gateway:checked").val();return"0"==c?!1:(edd_load_gateway(c),!1)}),"1"==edd_scripts.is_checkout&&a("select#edd-gateway, input.edd-gateway").length&&setTimeout(function(){edd_load_gateway(edd_scripts.default_gateway)},200),a(document).on("click","#edd_purchase_form #edd_purchase_submit input[type=submit]",function(b){var c=document.getElementById("edd_purchase_form");if("function"!=typeof c.checkValidity||!1!==c.checkValidity()){b.preventDefault();var d=a(this).val();a(this).val(edd_global_vars.purchase_loading),a(this).after('<span class="edd-cart-ajax"><i class="edd-icon-spinner edd-icon-spin"></i></span>'),a.post(edd_global_vars.ajaxurl,a("#edd_purchase_form").serialize()+"&action=edd_process_checkout&edd_ajax=true",function(b){"success"==a.trim(b)?(a(".edd_errors").remove(),a(".edd-error").hide(),a(c).submit()):(a("#edd-purchase-button").val(d),a(".edd-cart-ajax").remove(),a(".edd_errors").remove(),a(".edd-error").hide(),a("#edd_purchase_submit").before(b))})}})});
|
assets/js/edd-checkout-global.js
CHANGED
@@ -1,336 +1,372 @@
|
|
1 |
-
|
2 |
-
|
3 |
-
|
4 |
-
|
5 |
-
|
6 |
-
|
7 |
-
|
8 |
-
|
9 |
-
|
10 |
-
|
11 |
-
|
12 |
-
|
13 |
-
|
14 |
-
|
15 |
-
|
16 |
-
|
17 |
-
|
18 |
-
|
19 |
-
|
20 |
-
|
21 |
-
|
22 |
-
|
23 |
-
|
24 |
-
|
25 |
-
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
26 |
if( 'nostates' == response ) {
|
27 |
var text_field = '<input type="text" name="card_state" class="cart-state edd-input required" value=""/>';
|
28 |
$form.find('input[name="card_state"], select[name="card_state"]').replaceWith( text_field );
|
29 |
} else {
|
30 |
$form.find('input[name="card_state"], select[name="card_state"]').replaceWith( response );
|
31 |
}
|
32 |
-
|
33 |
-
|
34 |
-
|
35 |
-
|
36 |
-
|
37 |
-
|
38 |
-
|
39 |
-
|
40 |
-
|
41 |
-
|
42 |
-
|
43 |
-
|
44 |
-
|
45 |
-
|
46 |
-
|
47 |
-
|
48 |
-
|
49 |
-
|
50 |
-
|
51 |
-
|
52 |
-
|
53 |
-
|
54 |
-
|
55 |
-
|
56 |
-
|
57 |
-
|
58 |
-
|
59 |
-
|
60 |
-
|
61 |
-
|
62 |
-
|
63 |
-
|
64 |
-
|
65 |
-
|
66 |
-
|
67 |
-
|
68 |
-
|
69 |
-
|
70 |
-
|
71 |
-
|
72 |
-
|
73 |
-
|
74 |
-
|
75 |
-
|
76 |
-
|
77 |
-
|
78 |
-
|
79 |
-
|
80 |
-
|
81 |
-
|
82 |
-
|
83 |
-
|
84 |
-
|
85 |
-
|
86 |
-
|
87 |
-
|
88 |
-
|
89 |
-
|
90 |
-
|
91 |
-
|
92 |
-
|
93 |
-
|
94 |
-
|
95 |
-
|
96 |
-
|
97 |
-
|
98 |
-
|
99 |
-
|
100 |
-
|
101 |
-
|
102 |
-
|
103 |
-
|
104 |
-
|
105 |
-
|
106 |
-
|
107 |
-
|
108 |
-
|
109 |
-
|
110 |
-
|
111 |
-
|
112 |
-
|
113 |
-
|
114 |
-
|
115 |
-
|
116 |
-
|
117 |
-
|
118 |
-
|
119 |
-
|
120 |
-
|
121 |
-
|
122 |
-
|
123 |
-
|
124 |
-
|
125 |
-
|
126 |
-
|
127 |
-
|
128 |
-
|
129 |
-
|
130 |
-
|
131 |
-
|
132 |
-
|
133 |
-
|
134 |
-
|
135 |
-
|
136 |
-
|
137 |
-
|
138 |
-
|
139 |
-
|
140 |
-
|
141 |
-
|
142 |
-
|
143 |
-
|
144 |
-
|
145 |
-
|
146 |
-
|
147 |
-
|
148 |
-
|
149 |
-
|
150 |
-
|
151 |
-
|
152 |
-
|
153 |
-
|
154 |
-
|
155 |
-
|
156 |
-
|
157 |
-
|
158 |
-
|
159 |
-
|
160 |
-
|
161 |
-
|
162 |
-
|
163 |
-
|
164 |
-
|
165 |
-
|
166 |
-
|
167 |
-
|
168 |
-
|
169 |
-
|
170 |
-
|
171 |
-
|
172 |
-
|
173 |
-
|
174 |
-
|
175 |
-
|
176 |
-
|
177 |
-
|
178 |
-
|
179 |
-
|
180 |
-
|
181 |
-
|
182 |
-
|
183 |
-
|
184 |
-
|
185 |
-
|
186 |
-
|
187 |
-
|
188 |
-
|
189 |
-
|
190 |
-
|
191 |
-
|
192 |
-
|
193 |
-
|
194 |
-
|
195 |
-
|
196 |
-
|
197 |
-
|
198 |
-
|
199 |
-
|
200 |
-
|
201 |
-
|
202 |
-
|
203 |
-
|
204 |
-
|
205 |
-
|
206 |
-
|
207 |
-
|
208 |
-
|
209 |
-
|
210 |
-
|
211 |
-
|
212 |
-
|
213 |
-
|
214 |
-
|
215 |
-
|
216 |
-
|
217 |
-
|
218 |
-
|
219 |
-
|
220 |
-
|
221 |
-
|
222 |
-
|
223 |
-
|
224 |
-
|
225 |
-
|
226 |
-
|
227 |
-
|
228 |
-
|
229 |
-
|
230 |
-
|
231 |
-
|
232 |
-
|
233 |
-
|
234 |
-
|
235 |
-
|
236 |
-
|
237 |
-
|
238 |
-
|
239 |
-
|
240 |
-
|
241 |
-
|
242 |
-
|
243 |
-
|
244 |
-
|
245 |
-
|
246 |
-
|
247 |
-
|
248 |
-
|
249 |
-
|
250 |
-
|
251 |
-
|
252 |
-
|
253 |
-
|
254 |
-
|
255 |
-
|
256 |
-
|
257 |
-
|
258 |
-
|
259 |
-
|
260 |
-
|
261 |
-
|
262 |
-
|
263 |
-
|
264 |
-
|
265 |
-
|
266 |
-
|
267 |
-
|
268 |
-
|
269 |
-
|
270 |
-
|
271 |
-
|
272 |
-
|
273 |
-
|
274 |
-
|
275 |
-
|
276 |
-
|
277 |
-
|
278 |
-
|
279 |
-
|
280 |
-
|
281 |
-
|
282 |
-
|
283 |
-
|
284 |
-
|
285 |
-
|
286 |
-
|
287 |
-
|
288 |
-
|
289 |
-
|
290 |
-
|
291 |
-
|
292 |
-
|
293 |
-
|
294 |
-
|
295 |
-
|
296 |
-
|
297 |
-
|
298 |
-
options: options
|
299 |
-
};
|
300 |
-
|
301 |
-
//edd_discount_loader.show();
|
302 |
-
|
303 |
-
$.ajax({
|
304 |
-
type: "POST",
|
305 |
-
data: postData,
|
306 |
-
dataType: "json",
|
307 |
-
url: edd_global_vars.ajaxurl,
|
308 |
-
xhrFields: {
|
309 |
-
withCredentials: true
|
310 |
-
},
|
311 |
-
success: function (response) {
|
312 |
-
|
313 |
-
console.log( response );
|
314 |
-
$('.edd_cart_subtotal_amount').each(function() {
|
315 |
-
$(this).text(response.subtotal);
|
316 |
-
});
|
317 |
-
|
318 |
-
$('.edd_cart_tax_amount').each(function() {
|
319 |
-
$(this).text(response.taxes);
|
320 |
-
});
|
321 |
-
|
322 |
-
$('.edd_cart_amount').each(function() {
|
323 |
-
$(this).text(response.total);
|
324 |
-
$('body').trigger('edd_quantity_updated', [ response ]);
|
325 |
-
});
|
326 |
-
}
|
327 |
-
}).fail(function (data) {
|
328 |
-
if ( window.console && window.console.log ) {
|
329 |
-
console.log( data );
|
330 |
-
}
|
331 |
-
});
|
332 |
-
|
333 |
-
return false;
|
334 |
-
});
|
335 |
-
|
336 |
-
});
|
1 |
+
window.EDD_Checkout = (function($) {
|
2 |
+
'use strict';
|
3 |
+
|
4 |
+
var $body,
|
5 |
+
$form,
|
6 |
+
$edd_cart_amount,
|
7 |
+
before_discount,
|
8 |
+
$checkout_form_wrap;
|
9 |
+
|
10 |
+
function init() {
|
11 |
+
$body = $(document.body);
|
12 |
+
$form = $("#edd_purchase_form");
|
13 |
+
$edd_cart_amount = $('.edd_cart_amount');
|
14 |
+
before_discount = $edd_cart_amount.text();
|
15 |
+
$checkout_form_wrap = $('#edd_checkout_form_wrap');
|
16 |
+
|
17 |
+
// Update state/province field on checkout page
|
18 |
+
$body.on('change', '#edd_cc_address input.card_state, #edd_cc_address select', update_state_field);
|
19 |
+
|
20 |
+
$body.on('keyup change', '.edd-do-validate .card-number', function() {
|
21 |
+
edd_validate_card( $(this) );
|
22 |
+
});
|
23 |
+
|
24 |
+
// Make sure a gateway is selected
|
25 |
+
$body.on('submit', '#edd_payment_mode', function() {
|
26 |
+
var gateway = $('#edd-gateway option:selected').val();
|
27 |
+
if( gateway == 0 ) {
|
28 |
+
alert( edd_global_vars.no_gateway );
|
29 |
+
return false;
|
30 |
+
}
|
31 |
+
});
|
32 |
+
|
33 |
+
// Add a class to the currently selected gateway on click
|
34 |
+
$body.on('click', '#edd_payment_mode_select input', function() {
|
35 |
+
$('#edd_payment_mode_select label.edd-gateway-option-selected').removeClass( 'edd-gateway-option-selected' );
|
36 |
+
$('#edd_payment_mode_select input:checked').parent().addClass( 'edd-gateway-option-selected' );
|
37 |
+
});
|
38 |
+
|
39 |
+
// Validate and apply a discount
|
40 |
+
$checkout_form_wrap.on('click', '.edd-apply-discount', apply_discount);
|
41 |
+
|
42 |
+
// Prevent the checkout form from submitting when hitting Enter in the discount field
|
43 |
+
$checkout_form_wrap.on('keypress', '#edd-discount', function (event) {
|
44 |
+
if (event.keyCode == '13') {
|
45 |
+
return false;
|
46 |
+
}
|
47 |
+
});
|
48 |
+
|
49 |
+
// Apply the discount when hitting Enter in the discount field instead
|
50 |
+
$checkout_form_wrap.on('keyup', '#edd-discount', function (event) {
|
51 |
+
if (event.keyCode == '13') {
|
52 |
+
$checkout_form_wrap.find('.edd-apply-discount').trigger('click');
|
53 |
+
}
|
54 |
+
});
|
55 |
+
|
56 |
+
// Remove a discount
|
57 |
+
$body.on('click', '.edd_discount_remove', remove_discount);
|
58 |
+
|
59 |
+
// When discount link is clicked, hide the link, then show the discount input and set focus.
|
60 |
+
$body.on('click', '.edd_discount_link', function(e) {
|
61 |
+
e.preventDefault();
|
62 |
+
$('.edd_discount_link').parent().hide();
|
63 |
+
$('#edd-discount-code-wrap').show().find('#edd-discount').focus();
|
64 |
+
});
|
65 |
+
|
66 |
+
// Hide / show discount fields for browsers without javascript enabled
|
67 |
+
$body.find('#edd-discount-code-wrap').hide();
|
68 |
+
$body.find('#edd_show_discount').show();
|
69 |
+
|
70 |
+
// Update the checkout when item quantities are updated
|
71 |
+
$body.on('change', '.edd-item-quantity', update_item_quantities);
|
72 |
+
|
73 |
+
$body.on('click', '.edd-amazon-logout #Logout', function(e) {
|
74 |
+
e.preventDefault();
|
75 |
+
amazon.Login.logout();
|
76 |
+
window.location = edd_amazon.checkoutUri;
|
77 |
+
});
|
78 |
+
|
79 |
+
}
|
80 |
+
|
81 |
+
function update_state_field() {
|
82 |
+
|
83 |
+
var $this = $(this);
|
84 |
+
if( 'card_state' != $this.attr('id') ) {
|
85 |
+
|
86 |
+
// If the country field has changed, we need to update the state/province field
|
87 |
+
var postData = {
|
88 |
+
action: 'edd_get_shop_states',
|
89 |
+
country: $this.val(),
|
90 |
+
field_name: 'card_state'
|
91 |
+
};
|
92 |
+
|
93 |
+
$.ajax({
|
94 |
+
type: "POST",
|
95 |
+
data: postData,
|
96 |
+
url: edd_global_vars.ajaxurl,
|
97 |
+
xhrFields: {
|
98 |
+
withCredentials: true
|
99 |
+
},
|
100 |
+
success: function (response) {
|
101 |
if( 'nostates' == response ) {
|
102 |
var text_field = '<input type="text" name="card_state" class="cart-state edd-input required" value=""/>';
|
103 |
$form.find('input[name="card_state"], select[name="card_state"]').replaceWith( text_field );
|
104 |
} else {
|
105 |
$form.find('input[name="card_state"], select[name="card_state"]').replaceWith( response );
|
106 |
}
|
107 |
+
|
108 |
+
$body.trigger('edd_cart_billing_address_updated', [ response ]);
|
109 |
+
|
110 |
+
}
|
111 |
+
}).fail(function (data) {
|
112 |
+
if ( window.console && window.console.log ) {
|
113 |
+
console.log( data );
|
114 |
+
}
|
115 |
+
}).done(function (data) {
|
116 |
+
recalculate_taxes();
|
117 |
+
});
|
118 |
+
} else {
|
119 |
+
recalculate_taxes();
|
120 |
+
}
|
121 |
+
|
122 |
+
return false;
|
123 |
+
}
|
124 |
+
|
125 |
+
function recalculate_taxes(state) {
|
126 |
+
|
127 |
+
if( '1' != edd_global_vars.taxes_enabled )
|
128 |
+
return; // Taxes not enabled
|
129 |
+
|
130 |
+
var $edd_cc_address = $('#edd_cc_address');
|
131 |
+
|
132 |
+
if( ! state ) {
|
133 |
+
state = $edd_cc_address.find('#card_state').val();
|
134 |
+
}
|
135 |
+
|
136 |
+
var postData = {
|
137 |
+
action: 'edd_recalculate_taxes',
|
138 |
+
billing_country: $edd_cc_address.find('#billing_country').val(),
|
139 |
+
state: state
|
140 |
+
};
|
141 |
+
|
142 |
+
$.ajax({
|
143 |
+
type: "POST",
|
144 |
+
data: postData,
|
145 |
+
dataType: "json",
|
146 |
+
url: edd_global_vars.ajaxurl,
|
147 |
+
xhrFields: {
|
148 |
+
withCredentials: true
|
149 |
+
},
|
150 |
+
success: function (tax_response) {
|
151 |
+
$('#edd_checkout_cart_form').replaceWith(tax_response.html);
|
152 |
+
$('.edd_cart_amount').html(tax_response.total);
|
153 |
+
var tax_data = new Object();
|
154 |
+
tax_data.postdata = postData;
|
155 |
+
tax_data.response = tax_response;
|
156 |
+
$body.trigger('edd_taxes_recalculated', [ tax_data ]);
|
157 |
+
}
|
158 |
+
}).fail(function (data) {
|
159 |
+
if ( window.console && window.console.log ) {
|
160 |
+
console.log( data );
|
161 |
+
$body.trigger('edd_taxes_recalculated', [ tax_data ]);
|
162 |
+
}
|
163 |
+
});
|
164 |
+
}
|
165 |
+
|
166 |
+
function edd_validate_card(field) {
|
167 |
+
var card_field = field;
|
168 |
+
card_field.validateCreditCard(function(result) {
|
169 |
+
var $card_type = $('.card-type');
|
170 |
+
|
171 |
+
if(result.card_type == null) {
|
172 |
+
$card_type.removeClass().addClass('off card-type');
|
173 |
+
card_field.removeClass('valid');
|
174 |
+
card_field.addClass('error');
|
175 |
+
} else {
|
176 |
+
$card_type.removeClass('off');
|
177 |
+
$card_type.addClass( result.card_type.name );
|
178 |
+
if (result.length_valid && result.luhn_valid) {
|
179 |
+
card_field.addClass('valid');
|
180 |
+
card_field.removeClass('error');
|
181 |
+
} else {
|
182 |
+
card_field.removeClass('valid');
|
183 |
+
card_field.addClass('error');
|
184 |
+
}
|
185 |
+
}
|
186 |
+
});
|
187 |
+
}
|
188 |
+
|
189 |
+
function apply_discount(event) {
|
190 |
+
|
191 |
+
event.preventDefault();
|
192 |
+
|
193 |
+
var $this = $(this),
|
194 |
+
discount_code = $('#edd-discount').val(),
|
195 |
+
edd_discount_loader = $('#edd-discount-loader');
|
196 |
+
|
197 |
+
if (discount_code == '' || discount_code == edd_global_vars.enter_discount ) {
|
198 |
+
return false;
|
199 |
+
}
|
200 |
+
|
201 |
+
var postData = {
|
202 |
+
action: 'edd_apply_discount',
|
203 |
+
code: discount_code,
|
204 |
+
form: $( '#edd_purchase_form' ).serialize()
|
205 |
+
};
|
206 |
+
|
207 |
+
$('#edd-discount-error-wrap').html('').hide();
|
208 |
+
edd_discount_loader.show();
|
209 |
+
|
210 |
+
$.ajax({
|
211 |
+
type: "POST",
|
212 |
+
data: postData,
|
213 |
+
dataType: "json",
|
214 |
+
url: edd_global_vars.ajaxurl,
|
215 |
+
xhrFields: {
|
216 |
+
withCredentials: true
|
217 |
+
},
|
218 |
+
success: function (discount_response) {
|
219 |
+
if( discount_response ) {
|
220 |
+
if (discount_response.msg == 'valid') {
|
221 |
+
$('.edd_cart_discount').html(discount_response.html);
|
222 |
+
$('.edd_cart_discount_row').show();
|
223 |
+
$('.edd_cart_amount').each(function() {
|
224 |
+
$(this).text(discount_response.total);
|
225 |
+
});
|
226 |
+
$('#edd-discount', $checkout_form_wrap ).val('');
|
227 |
+
|
228 |
+
recalculate_taxes();
|
229 |
+
|
230 |
+
if( '0.00' == discount_response.total_plain ) {
|
231 |
+
|
232 |
+
$('#edd_cc_fields,#edd_cc_address').slideUp();
|
233 |
+
$('input[name="edd-gateway"]').val( 'manual' );
|
234 |
+
|
235 |
+
} else {
|
236 |
+
|
237 |
+
$('#edd_cc_fields,#edd_cc_address').slideDown();
|
238 |
+
|
239 |
+
}
|
240 |
+
|
241 |
+
$body.trigger('edd_discount_applied', [ discount_response ]);
|
242 |
+
|
243 |
+
} else {
|
244 |
+
$('#edd-discount-error-wrap').html( '<span class="edd_error">' + discount_response.msg + '</span>' );
|
245 |
+
$('#edd-discount-error-wrap').show();
|
246 |
+
$body.trigger('edd_discount_invalid', [ discount_response ]);
|
247 |
+
}
|
248 |
+
} else {
|
249 |
+
if ( window.console && window.console.log ) {
|
250 |
+
console.log( discount_response );
|
251 |
+
}
|
252 |
+
$body.trigger('edd_discount_failed', [ discount_response ]);
|
253 |
+
}
|
254 |
+
edd_discount_loader.hide();
|
255 |
+
}
|
256 |
+
}).fail(function (data) {
|
257 |
+
if ( window.console && window.console.log ) {
|
258 |
+
console.log( data );
|
259 |
+
}
|
260 |
+
});
|
261 |
+
|
262 |
+
return false;
|
263 |
+
};
|
264 |
+
|
265 |
+
function remove_discount(event) {
|
266 |
+
|
267 |
+
var $this = $(this), postData = {
|
268 |
+
action: 'edd_remove_discount',
|
269 |
+
code: $this.data('code')
|
270 |
+
};
|
271 |
+
|
272 |
+
$.ajax({
|
273 |
+
type: "POST",
|
274 |
+
data: postData,
|
275 |
+
dataType: "json",
|
276 |
+
url: edd_global_vars.ajaxurl,
|
277 |
+
xhrFields: {
|
278 |
+
withCredentials: true
|
279 |
+
},
|
280 |
+
success: function (discount_response) {
|
281 |
+
|
282 |
+
$('.edd_cart_amount').each(function() {
|
283 |
+
if( edd_global_vars.currency_sign + '0.00' == $(this).text() || '0.00' + edd_global_vars.currency_sign == $(this).text() ) {
|
284 |
+
// We're removing a 100% discount code so we need to force the payment gateway to reload
|
285 |
+
window.location.reload();
|
286 |
+
}
|
287 |
+
$(this).text(discount_response.total);
|
288 |
+
});
|
289 |
+
|
290 |
+
$('.edd_cart_discount').html(discount_response.html);
|
291 |
+
|
292 |
+
if( ! discount_response.discounts ) {
|
293 |
+
|
294 |
+
$('.edd_cart_discount_row').hide();
|
295 |
+
|
296 |
+
}
|
297 |
+
|
298 |
+
recalculate_taxes();
|
299 |
+
|
300 |
+
$('#edd_cc_fields,#edd_cc_address').slideDown();
|
301 |
+
|
302 |
+
$body.trigger('edd_discount_removed', [ discount_response ]);
|
303 |
+
|
304 |
+
}
|
305 |
+
}).fail(function (data) {
|
306 |
+
if ( window.console && window.console.log ) {
|
307 |
+
console.log( data );
|
308 |
+
}
|
309 |
+
});
|
310 |
+
|
311 |
+
return false;
|
312 |
+
}
|
313 |
+
|
314 |
+
function update_item_quantities(event) {
|
315 |
+
|
316 |
+
var $this = $(this),
|
317 |
+
quantity = $this.val(),
|
318 |
+
key = $this.data('key'),
|
319 |
+
download_id = $this.closest('tr.edd_cart_item').data('download-id'),
|
320 |
+
options = $this.parent().find('input[name="edd-cart-download-' + key + '-options"]').val();
|
321 |
+
|
322 |
+
var postData = {
|
323 |
+
action: 'edd_update_quantity',
|
324 |
+
quantity: quantity,
|
325 |
+
download_id: download_id,
|
326 |
+
options: options
|
327 |
+
};
|
328 |
+
|
329 |
+
//edd_discount_loader.show();
|
330 |
+
|
331 |
+
$.ajax({
|
332 |
+
type: "POST",
|
333 |
+
data: postData,
|
334 |
+
dataType: "json",
|
335 |
+
url: edd_global_vars.ajaxurl,
|
336 |
+
xhrFields: {
|
337 |
+
withCredentials: true
|
338 |
+
},
|
339 |
+
success: function (response) {
|
340 |
+
|
341 |
+
$('.edd_cart_subtotal_amount').each(function() {
|
342 |
+
$(this).text(response.subtotal);
|
343 |
+
});
|
344 |
+
|
345 |
+
$('.edd_cart_tax_amount').each(function() {
|
346 |
+
$(this).text(response.taxes);
|
347 |
+
});
|
348 |
+
|
349 |
+
$('.edd_cart_amount').each(function() {
|
350 |
+
$(this).text(response.total);
|
351 |
+
$body.trigger('edd_quantity_updated', [ response ]);
|
352 |
+
});
|
353 |
+
}
|
354 |
+
}).fail(function (data) {
|
355 |
+
if ( window.console && window.console.log ) {
|
356 |
+
console.log( data );
|
357 |
+
}
|
358 |
+
});
|
359 |
+
|
360 |
+
return false;
|
361 |
+
}
|
362 |
+
|
363 |
+
// Expose some functions or variables to window.EDD_Checkout object
|
364 |
+
return {
|
365 |
+
'init': init,
|
366 |
+
'recalculate_taxes': recalculate_taxes
|
367 |
+
}
|
368 |
+
|
369 |
+
})(window.jQuery);
|
370 |
+
|
371 |
+
// init on document.ready
|
372 |
+
window.jQuery(document).ready(EDD_Checkout.init);
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
assets/js/edd-checkout-global.min.js
CHANGED
@@ -1 +1 @@
|
|
1 |
-
|
1 |
+
window.EDD_Checkout=function(e){"use strict";function d(){s=e(document.body),r=e("#edd_purchase_form"),l=e(".edd_cart_amount"),_=l.text(),u=e("#edd_checkout_form_wrap"),s.on("change","#edd_cc_address input.card_state, #edd_cc_address select",t),s.on("keyup change",".edd-do-validate .card-number",function(){o(e(this))}),s.on("submit","#edd_payment_mode",function(){var d=e("#edd-gateway option:selected").val();return 0==d?(alert(edd_global_vars.no_gateway),!1):void 0}),s.on("click","#edd_payment_mode_select input",function(){e("#edd_payment_mode_select label.edd-gateway-option-selected").removeClass("edd-gateway-option-selected"),e("#edd_payment_mode_select input:checked").parent().addClass("edd-gateway-option-selected")}),u.on("click",".edd-apply-discount",n),u.on("keypress","#edd-discount",function(e){return"13"==e.keyCode?!1:void 0}),u.on("keyup","#edd-discount",function(e){"13"==e.keyCode&&u.find(".edd-apply-discount").trigger("click")}),s.on("click",".edd_discount_remove",i),s.on("click",".edd_discount_link",function(d){d.preventDefault(),e(".edd_discount_link").parent().hide(),e("#edd-discount-code-wrap").show().find("#edd-discount").focus()}),s.find("#edd-discount-code-wrap").hide(),s.find("#edd_show_discount").show(),s.on("change",".edd-item-quantity",c),s.on("click",".edd-amazon-logout #Logout",function(e){e.preventDefault(),amazon.Login.logout(),window.location=edd_amazon.checkoutUri})}function t(){var d=e(this);if("card_state"!=d.attr("id")){var t={action:"edd_get_shop_states",country:d.val(),field_name:"card_state"};e.ajax({type:"POST",data:t,url:edd_global_vars.ajaxurl,xhrFields:{withCredentials:!0},success:function(e){if("nostates"==e){var d='<input type="text" name="card_state" class="cart-state edd-input required" value=""/>';r.find('input[name="card_state"], select[name="card_state"]').replaceWith(d)}else r.find('input[name="card_state"], select[name="card_state"]').replaceWith(e);s.trigger("edd_cart_billing_address_updated",[e])}}).fail(function(e){window.console&&window.console.log&&console.log(e)}).done(function(){a()})}else a();return!1}function a(d){if("1"==edd_global_vars.taxes_enabled){var t=e("#edd_cc_address");d||(d=t.find("#card_state").val());var a={action:"edd_recalculate_taxes",billing_country:t.find("#billing_country").val(),state:d};e.ajax({type:"POST",data:a,dataType:"json",url:edd_global_vars.ajaxurl,xhrFields:{withCredentials:!0},success:function(d){e("#edd_checkout_cart_form").replaceWith(d.html),e(".edd_cart_amount").html(d.total);var t=new Object;t.postdata=a,t.response=d,s.trigger("edd_taxes_recalculated",[t])}}).fail(function(e){window.console&&window.console.log&&(console.log(e),s.trigger("edd_taxes_recalculated",[tax_data]))})}}function o(d){var t=d;t.validateCreditCard(function(d){var a=e(".card-type");null==d.card_type?(a.removeClass().addClass("off card-type"),t.removeClass("valid"),t.addClass("error")):(a.removeClass("off"),a.addClass(d.card_type.name),d.length_valid&&d.luhn_valid?(t.addClass("valid"),t.removeClass("error")):(t.removeClass("valid"),t.addClass("error")))})}function n(d){d.preventDefault();var t=(e(this),e("#edd-discount").val()),o=e("#edd-discount-loader");if(""==t||t==edd_global_vars.enter_discount)return!1;var n={action:"edd_apply_discount",code:t,form:e("#edd_purchase_form").serialize()};return e("#edd-discount-error-wrap").html("").hide(),o.show(),e.ajax({type:"POST",data:n,dataType:"json",url:edd_global_vars.ajaxurl,xhrFields:{withCredentials:!0},success:function(d){d?"valid"==d.msg?(e(".edd_cart_discount").html(d.html),e(".edd_cart_discount_row").show(),e(".edd_cart_amount").each(function(){e(this).text(d.total)}),e("#edd-discount",u).val(""),a(),"0.00"==d.total_plain?(e("#edd_cc_fields,#edd_cc_address").slideUp(),e('input[name="edd-gateway"]').val("manual")):e("#edd_cc_fields,#edd_cc_address").slideDown(),s.trigger("edd_discount_applied",[d])):(e("#edd-discount-error-wrap").html('<span class="edd_error">'+d.msg+"</span>"),e("#edd-discount-error-wrap").show(),s.trigger("edd_discount_invalid",[d])):(window.console&&window.console.log&&console.log(d),s.trigger("edd_discount_failed",[d])),o.hide()}}).fail(function(e){window.console&&window.console.log&&console.log(e)}),!1}function i(){var d=e(this),t={action:"edd_remove_discount",code:d.data("code")};return e.ajax({type:"POST",data:t,dataType:"json",url:edd_global_vars.ajaxurl,xhrFields:{withCredentials:!0},success:function(d){e(".edd_cart_amount").each(function(){(edd_global_vars.currency_sign+"0.00"==e(this).text()||"0.00"+edd_global_vars.currency_sign==e(this).text())&&window.location.reload(),e(this).text(d.total)}),e(".edd_cart_discount").html(d.html),d.discounts||e(".edd_cart_discount_row").hide(),a(),e("#edd_cc_fields,#edd_cc_address").slideDown(),s.trigger("edd_discount_removed",[d])}}).fail(function(e){window.console&&window.console.log&&console.log(e)}),!1}function c(){var d=e(this),t=d.val(),a=d.data("key"),o=d.closest("tr.edd_cart_item").data("download-id"),n=d.parent().find('input[name="edd-cart-download-'+a+'-options"]').val(),i={action:"edd_update_quantity",quantity:t,download_id:o,options:n};return e.ajax({type:"POST",data:i,dataType:"json",url:edd_global_vars.ajaxurl,xhrFields:{withCredentials:!0},success:function(d){e(".edd_cart_subtotal_amount").each(function(){e(this).text(d.subtotal)}),e(".edd_cart_tax_amount").each(function(){e(this).text(d.taxes)}),e(".edd_cart_amount").each(function(){e(this).text(d.total),s.trigger("edd_quantity_updated",[d])})}}).fail(function(e){window.console&&window.console.log&&console.log(e)}),!1}var s,r,l,_,u;return{init:d,recalculate_taxes:a}}(window.jQuery),window.jQuery(document).ready(EDD_Checkout.init);
|
assets/js/jquery.flot.pie.js
ADDED
@@ -0,0 +1,820 @@
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
1 |
+
/* Flot plugin for rendering pie charts.
|
2 |
+
|
3 |
+
Copyright (c) 2007-2014 IOLA and Ole Laursen.
|
4 |
+
Licensed under the MIT license.
|
5 |
+
|
6 |
+
The plugin assumes that each series has a single data value, and that each
|
7 |
+
value is a positive integer or zero. Negative numbers don't make sense for a
|
8 |
+
pie chart, and have unpredictable results. The values do NOT need to be
|
9 |
+
passed in as percentages; the plugin will calculate the total and per-slice
|
10 |
+
percentages internally.
|
11 |
+
|
12 |
+
* Created by Brian Medendorp
|
13 |
+
|
14 |
+
* Updated with contributions from btburnett3, Anthony Aragues and Xavi Ivars
|
15 |
+
|
16 |
+
The plugin supports these options:
|
17 |
+
|
18 |
+
series: {
|
19 |
+
pie: {
|
20 |
+
show: true/false
|
21 |
+
radius: 0-1 for percentage of fullsize, or a specified pixel length, or 'auto'
|
22 |
+
innerRadius: 0-1 for percentage of fullsize or a specified pixel length, for creating a donut effect
|
23 |
+
startAngle: 0-2 factor of PI used for starting angle (in radians) i.e 3/2 starts at the top, 0 and 2 have the same result
|
24 |
+
tilt: 0-1 for percentage to tilt the pie, where 1 is no tilt, and 0 is completely flat (nothing will show)
|
25 |
+
offset: {
|
26 |
+
top: integer value to move the pie up or down
|
27 |
+
left: integer value to move the pie left or right, or 'auto'
|
28 |
+
},
|
29 |
+
stroke: {
|
30 |
+
color: any hexidecimal color value (other formats may or may not work, so best to stick with something like '#FFF')
|
31 |
+
width: integer pixel width of the stroke
|
32 |
+
},
|
33 |
+
label: {
|
34 |
+
show: true/false, or 'auto'
|
35 |
+
formatter: a user-defined function that modifies the text/style of the label text
|
36 |
+
radius: 0-1 for percentage of fullsize, or a specified pixel length
|
37 |
+
background: {
|
38 |
+
color: any hexidecimal color value (other formats may or may not work, so best to stick with something like '#000')
|
39 |
+
opacity: 0-1
|
40 |
+
},
|
41 |
+
threshold: 0-1 for the percentage value at which to hide labels (if they're too small)
|
42 |
+
},
|
43 |
+
combine: {
|
44 |
+
threshold: 0-1 for the percentage value at which to combine slices (if they're too small)
|
45 |
+
color: any hexidecimal color value (other formats may or may not work, so best to stick with something like '#CCC'), if null, the plugin will automatically use the color of the first slice to be combined
|
46 |
+
label: any text value of what the combined slice should be labeled
|
47 |
+
}
|
48 |
+
highlight: {
|
49 |
+
opacity: 0-1
|
50 |
+
}
|
51 |
+
}
|
52 |
+
}
|
53 |
+
|
54 |
+
More detail and specific examples can be found in the included HTML file.
|
55 |
+
|
56 |
+
*/
|
57 |
+
|
58 |
+
(function($) {
|
59 |
+
|
60 |
+
// Maximum redraw attempts when fitting labels within the plot
|
61 |
+
|
62 |
+
var REDRAW_ATTEMPTS = 10;
|
63 |
+
|
64 |
+
// Factor by which to shrink the pie when fitting labels within the plot
|
65 |
+
|
66 |
+
var REDRAW_SHRINK = 0.95;
|
67 |
+
|
68 |
+
function init(plot) {
|
69 |
+
|
70 |
+
var canvas = null,
|
71 |
+
target = null,
|
72 |
+
options = null,
|
73 |
+
maxRadius = null,
|
74 |
+
centerLeft = null,
|
75 |
+
centerTop = null,
|
76 |
+
processed = false,
|
77 |
+
ctx = null;
|
78 |
+
|
79 |
+
// interactive variables
|
80 |
+
|
81 |
+
var highlights = [];
|
82 |
+
|
83 |
+
// add hook to determine if pie plugin in enabled, and then perform necessary operations
|
84 |
+
|
85 |
+
plot.hooks.processOptions.push(function(plot, options) {
|
86 |
+
if (options.series.pie.show) {
|
87 |
+
|
88 |
+
options.grid.show = false;
|
89 |
+
|
90 |
+
// set labels.show
|
91 |
+
|
92 |
+
if (options.series.pie.label.show == "auto") {
|
93 |
+
if (options.legend.show) {
|
94 |
+
options.series.pie.label.show = false;
|
95 |
+
} else {
|
96 |
+
options.series.pie.label.show = true;
|
97 |
+
}
|
98 |
+
}
|
99 |
+
|
100 |
+
// set radius
|
101 |
+
|
102 |
+
if (options.series.pie.radius == "auto") {
|
103 |
+
if (options.series.pie.label.show) {
|
104 |
+
options.series.pie.radius = 3/4;
|
105 |
+
} else {
|
106 |
+
options.series.pie.radius = 1;
|
107 |
+
}
|
108 |
+
}
|
109 |
+
|
110 |
+
// ensure sane tilt
|
111 |
+
|
112 |
+
if (options.series.pie.tilt > 1) {
|
113 |
+
options.series.pie.tilt = 1;
|
114 |
+
} else if (options.series.pie.tilt < 0) {
|
115 |
+
options.series.pie.tilt = 0;
|
116 |
+
}
|
117 |
+
}
|
118 |
+
});
|
119 |
+
|
120 |
+
plot.hooks.bindEvents.push(function(plot, eventHolder) {
|
121 |
+
var options = plot.getOptions();
|
122 |
+
if (options.series.pie.show) {
|
123 |
+
if (options.grid.hoverable) {
|
124 |
+
eventHolder.unbind("mousemove").mousemove(onMouseMove);
|
125 |
+
}
|
126 |
+
if (options.grid.clickable) {
|
127 |
+
eventHolder.unbind("click").click(onClick);
|
128 |
+
}
|
129 |
+
}
|
130 |
+
});
|
131 |
+
|
132 |
+
plot.hooks.processDatapoints.push(function(plot, series, data, datapoints) {
|
133 |
+
var options = plot.getOptions();
|
134 |
+
if (options.series.pie.show) {
|
135 |
+
processDatapoints(plot, series, data, datapoints);
|
136 |
+
}
|
137 |
+
});
|
138 |
+
|
139 |
+
plot.hooks.drawOverlay.push(function(plot, octx) {
|
140 |
+
var options = plot.getOptions();
|
141 |
+
if (options.series.pie.show) {
|
142 |
+
drawOverlay(plot, octx);
|
143 |
+
}
|
144 |
+
});
|
145 |
+
|
146 |
+
plot.hooks.draw.push(function(plot, newCtx) {
|
147 |
+
var options = plot.getOptions();
|
148 |
+
if (options.series.pie.show) {
|
149 |
+
draw(plot, newCtx);
|
150 |
+
}
|
151 |
+
});
|
152 |
+
|
153 |
+
function processDatapoints(plot, series, datapoints) {
|
154 |
+
if (!processed) {
|
155 |
+
processed = true;
|
156 |
+
canvas = plot.getCanvas();
|
157 |
+
target = $(canvas).parent();
|
158 |
+
options = plot.getOptions();
|
159 |
+
plot.setData(combine(plot.getData()));
|
160 |
+
}
|
161 |
+
}
|
162 |
+
|
163 |
+
function combine(data) {
|
164 |
+
|
165 |
+
var total = 0,
|
166 |
+
combined = 0,
|
167 |
+
numCombined = 0,
|
168 |
+
color = options.series.pie.combine.color,
|
169 |
+
newdata = [];
|
170 |
+
|
171 |
+
// Fix up the raw data from Flot, ensuring the data is numeric
|
172 |
+
|
173 |
+
for (var i = 0; i < data.length; ++i) {
|
174 |
+
|
175 |
+
var value = data[i].data;
|
176 |
+
|
177 |
+
// If the data is an array, we'll assume that it's a standard
|
178 |
+
// Flot x-y pair, and are concerned only with the second value.
|
179 |
+
|
180 |
+
// Note how we use the original array, rather than creating a
|
181 |
+
// new one; this is more efficient and preserves any extra data
|
182 |
+
// that the user may have stored in higher indexes.
|
183 |
+
|
184 |
+
if ($.isArray(value) && value.length == 1) {
|
185 |
+
value = value[0];
|
186 |
+
}
|
187 |
+
|
188 |
+
if ($.isArray(value)) {
|
189 |
+
// Equivalent to $.isNumeric() but compatible with jQuery < 1.7
|
190 |
+
if (!isNaN(parseFloat(value[1])) && isFinite(value[1])) {
|
191 |
+
value[1] = +value[1];
|
192 |
+
} else {
|
193 |
+
value[1] = 0;
|
194 |
+
}
|
195 |
+
} else if (!isNaN(parseFloat(value)) && isFinite(value)) {
|
196 |
+
value = [1, +value];
|
197 |
+
} else {
|
198 |
+
value = [1, 0];
|
199 |
+
}
|
200 |
+
|
201 |
+
data[i].data = [value];
|
202 |
+
}
|
203 |
+
|
204 |
+
// Sum up all the slices, so we can calculate percentages for each
|
205 |
+
|
206 |
+
for (var i = 0; i < data.length; ++i) {
|
207 |
+
total += data[i].data[0][1];
|
208 |
+
}
|
209 |
+
|
210 |
+
// Count the number of slices with percentages below the combine
|
211 |
+
// threshold; if it turns out to be just one, we won't combine.
|
212 |
+
|
213 |
+
for (var i = 0; i < data.length; ++i) {
|
214 |
+
var value = data[i].data[0][1];
|
215 |
+
if (value / total <= options.series.pie.combine.threshold) {
|
216 |
+
combined += value;
|
217 |
+
numCombined++;
|
218 |
+
if (!color) {
|
219 |
+
color = data[i].color;
|
220 |
+
}
|
221 |
+
}
|
222 |
+
}
|
223 |
+
|
224 |
+
for (var i = 0; i < data.length; ++i) {
|
225 |
+
var value = data[i].data[0][1];
|
226 |
+
if (numCombined < 2 || value / total > options.series.pie.combine.threshold) {
|
227 |
+
newdata.push(
|
228 |
+
$.extend(data[i], { /* extend to allow keeping all other original data values
|
229 |
+
and using them e.g. in labelFormatter. */
|
230 |
+
data: [[1, value]],
|
231 |
+
color: data[i].color,
|
232 |
+
label: data[i].label,
|
233 |
+
angle: value * Math.PI * 2 / total,
|
234 |
+
percent: value / (total / 100)
|
235 |
+
})
|
236 |
+
);
|
237 |
+
}
|
238 |
+
}
|
239 |
+
|
240 |
+
if (numCombined > 1) {
|
241 |
+
newdata.push({
|
242 |
+
data: [[1, combined]],
|
243 |
+
color: color,
|
244 |
+
label: options.series.pie.combine.label,
|
245 |
+
angle: combined * Math.PI * 2 / total,
|
246 |
+
percent: combined / (total / 100)
|
247 |
+
});
|
248 |
+
}
|
249 |
+
|
250 |
+
return newdata;
|
251 |
+
}
|
252 |
+
|
253 |
+
function draw(plot, newCtx) {
|
254 |
+
|
255 |
+
if (!target) {
|
256 |
+
return; // if no series were passed
|
257 |
+
}
|
258 |
+
|
259 |
+
var canvasWidth = plot.getPlaceholder().width(),
|
260 |
+
canvasHeight = plot.getPlaceholder().height(),
|
261 |
+
legendWidth = target.children().filter(".legend").children().width() || 0;
|
262 |
+
|
263 |
+
ctx = newCtx;
|
264 |
+
|
265 |
+
// WARNING: HACK! REWRITE THIS CODE AS SOON AS POSSIBLE!
|
266 |
+
|
267 |
+
// When combining smaller slices into an 'other' slice, we need to
|
268 |
+
// add a new series. Since Flot gives plugins no way to modify the
|
269 |
+
// list of series, the pie plugin uses a hack where the first call
|
270 |
+
// to processDatapoints results in a call to setData with the new
|
271 |
+
// list of series, then subsequent processDatapoints do nothing.
|
272 |
+
|
273 |
+
// The plugin-global 'processed' flag is used to control this hack;
|
274 |
+
// it starts out false, and is set to true after the first call to
|
275 |
+
// processDatapoints.
|
276 |
+
|
277 |
+
// Unfortunately this turns future setData calls into no-ops; they
|
278 |
+
// call processDatapoints, the flag is true, and nothing happens.
|
279 |
+
|
280 |
+
// To fix this we'll set the flag back to false here in draw, when
|
281 |
+
// all series have been processed, so the next sequence of calls to
|
282 |
+
// processDatapoints once again starts out with a slice-combine.
|
283 |
+
// This is really a hack; in 0.9 we need to give plugins a proper
|
284 |
+
// way to modify series before any processing begins.
|
285 |
+
|
286 |
+
processed = false;
|
287 |
+
|
288 |
+
// calculate maximum radius and center point
|
289 |
+
|
290 |
+
maxRadius = Math.min(canvasWidth, canvasHeight / options.series.pie.tilt) / 2;
|
291 |
+
centerTop = canvasHeight / 2 + options.series.pie.offset.top;
|
292 |
+
centerLeft = canvasWidth / 2;
|
293 |
+
|
294 |
+
if (options.series.pie.offset.left == "auto") {
|
295 |
+
if (options.legend.position.match("w")) {
|
296 |
+
centerLeft += legendWidth / 2;
|
297 |
+
} else {
|
298 |
+
centerLeft -= legendWidth / 2;
|
299 |
+
}
|
300 |
+
if (centerLeft < maxRadius) {
|
301 |
+
centerLeft = maxRadius;
|
302 |
+
} else if (centerLeft > canvasWidth - maxRadius) {
|
303 |
+
centerLeft = canvasWidth - maxRadius;
|
304 |
+
}
|
305 |
+
} else {
|
306 |
+
centerLeft += options.series.pie.offset.left;
|
307 |
+
}
|
308 |
+
|
309 |
+
var slices = plot.getData(),
|
310 |
+
attempts = 0;
|
311 |
+
|
312 |
+
// Keep shrinking the pie's radius until drawPie returns true,
|
313 |
+
// indicating that all the labels fit, or we try too many times.
|
314 |
+
|
315 |
+
do {
|
316 |
+
if (attempts > 0) {
|
317 |
+
maxRadius *= REDRAW_SHRINK;
|
318 |
+
}
|
319 |
+
attempts += 1;
|
320 |
+
clear();
|
321 |
+
if (options.series.pie.tilt <= 0.8) {
|
322 |
+
drawShadow();
|
323 |
+
}
|
324 |
+
} while (!drawPie() && attempts < REDRAW_ATTEMPTS)
|
325 |
+
|
326 |
+
if (attempts >= REDRAW_ATTEMPTS) {
|
327 |
+
clear();
|
328 |
+
target.prepend("<div class='error'>Could not draw pie with labels contained inside canvas</div>");
|
329 |
+
}
|
330 |
+
|
331 |
+
if (plot.setSeries && plot.insertLegend) {
|
332 |
+
plot.setSeries(slices);
|
333 |
+
plot.insertLegend();
|
334 |
+
}
|
335 |
+
|
336 |
+
// we're actually done at this point, just defining internal functions at this point
|
337 |
+
|
338 |
+
function clear() {
|
339 |
+
ctx.clearRect(0, 0, canvasWidth, canvasHeight);
|
340 |
+
target.children().filter(".pieLabel, .pieLabelBackground").remove();
|
341 |
+
}
|
342 |
+
|
343 |
+
function drawShadow() {
|
344 |
+
|
345 |
+
var shadowLeft = options.series.pie.shadow.left;
|
346 |
+
var shadowTop = options.series.pie.shadow.top;
|
347 |
+
var edge = 10;
|
348 |
+
var alpha = options.series.pie.shadow.alpha;
|
349 |
+
var radius = options.series.pie.radius > 1 ? options.series.pie.radius : maxRadius * options.series.pie.radius;
|
350 |
+
|
351 |
+
if (radius >= canvasWidth / 2 - shadowLeft || radius * options.series.pie.tilt >= canvasHeight / 2 - shadowTop || radius <= edge) {
|
352 |
+
return; // shadow would be outside canvas, so don't draw it
|
353 |
+
}
|
354 |
+
|
355 |
+
ctx.save();
|
356 |
+
ctx.translate(shadowLeft,shadowTop);
|
357 |
+
ctx.globalAlpha = alpha;
|
358 |
+
ctx.fillStyle = "#000";
|
359 |
+
|
360 |
+
// center and rotate to starting position
|
361 |
+
|
362 |
+
ctx.translate(centerLeft,centerTop);
|
363 |
+
ctx.scale(1, options.series.pie.tilt);
|
364 |
+
|
365 |
+
//radius -= edge;
|
366 |
+
|
367 |
+
for (var i = 1; i <= edge; i++) {
|
368 |
+
ctx.beginPath();
|
369 |
+
ctx.arc(0, 0, radius, 0, Math.PI * 2, false);
|
370 |
+
ctx.fill();
|
371 |
+
radius -= i;
|
372 |
+
}
|
373 |
+
|
374 |
+
ctx.restore();
|
375 |
+
}
|
376 |
+
|
377 |
+
function drawPie() {
|
378 |
+
|
379 |
+
var startAngle = Math.PI * options.series.pie.startAngle;
|
380 |
+
var radius = options.series.pie.radius > 1 ? options.series.pie.radius : maxRadius * options.series.pie.radius;
|
381 |
+
|
382 |
+
// center and rotate to starting position
|
383 |
+
|
384 |
+
ctx.save();
|
385 |
+
ctx.translate(centerLeft,centerTop);
|
386 |
+
ctx.scale(1, options.series.pie.tilt);
|
387 |
+
//ctx.rotate(startAngle); // start at top; -- This doesn't work properly in Opera
|
388 |
+
|
389 |
+
// draw slices
|
390 |
+
|
391 |
+
ctx.save();
|
392 |
+
var currentAngle = startAngle;
|
393 |
+
for (var i = 0; i < slices.length; ++i) {
|
394 |
+
slices[i].startAngle = currentAngle;
|
395 |
+
drawSlice(slices[i].angle, slices[i].color, true);
|
396 |
+
}
|
397 |
+
ctx.restore();
|
398 |
+
|
399 |
+
// draw slice outlines
|
400 |
+
|
401 |
+
if (options.series.pie.stroke.width > 0) {
|
402 |
+
ctx.save();
|
403 |
+
ctx.lineWidth = options.series.pie.stroke.width;
|
404 |
+
currentAngle = startAngle;
|
405 |
+
for (var i = 0; i < slices.length; ++i) {
|
406 |
+
drawSlice(slices[i].angle, options.series.pie.stroke.color, false);
|
407 |
+
}
|
408 |
+
ctx.restore();
|
409 |
+
}
|
410 |
+
|
411 |
+
// draw donut hole
|
412 |
+
|
413 |
+
drawDonutHole(ctx);
|
414 |
+
|
415 |
+
ctx.restore();
|
416 |
+
|
417 |
+
// Draw the labels, returning true if they fit within the plot
|
418 |
+
|
419 |
+
if (options.series.pie.label.show) {
|
420 |
+
return drawLabels();
|
421 |
+
} else return true;
|
422 |
+
|
423 |
+
function drawSlice(angle, color, fill) {
|
424 |
+
|
425 |
+
if (angle <= 0 || isNaN(angle)) {
|
426 |
+
return;
|
427 |
+
}
|
428 |
+
|
429 |
+
if (fill) {
|
430 |
+
ctx.fillStyle = color;
|
431 |
+
} else {
|
432 |
+
ctx.strokeStyle = color;
|
433 |
+
ctx.lineJoin = "round";
|
434 |
+
}
|
435 |
+
|
436 |
+
ctx.beginPath();
|
437 |
+
if (Math.abs(angle - Math.PI * 2) > 0.000000001) {
|
438 |
+
ctx.moveTo(0, 0); // Center of the pie
|
439 |
+
}
|
440 |
+
|
441 |
+
//ctx.arc(0, 0, radius, 0, angle, false); // This doesn't work properly in Opera
|
442 |
+
ctx.arc(0, 0, radius,currentAngle, currentAngle + angle / 2, false);
|
443 |
+
ctx.arc(0, 0, radius,currentAngle + angle / 2, currentAngle + angle, false);
|
444 |
+
ctx.closePath();
|
445 |
+
//ctx.rotate(angle); // This doesn't work properly in Opera
|
446 |
+
currentAngle += angle;
|
447 |
+
|
448 |
+
if (fill) {
|
449 |
+
ctx.fill();
|
450 |
+
} else {
|
451 |
+
ctx.stroke();
|
452 |
+
}
|
453 |
+
}
|
454 |
+
|
455 |
+
function drawLabels() {
|
456 |
+
|
457 |
+
var currentAngle = startAngle;
|
458 |
+
var radius = options.series.pie.label.radius > 1 ? options.series.pie.label.radius : maxRadius * options.series.pie.label.radius;
|
459 |
+
|
460 |
+
for (var i = 0; i < slices.length; ++i) {
|
461 |
+
if (slices[i].percent >= options.series.pie.label.threshold * 100) {
|
462 |
+
if (!drawLabel(slices[i], currentAngle, i)) {
|
463 |
+
return false;
|
464 |
+
}
|
465 |
+
}
|
466 |
+
currentAngle += slices[i].angle;
|
467 |
+
}
|
468 |
+
|
469 |
+
return true;
|
470 |
+
|
471 |
+
function drawLabel(slice, startAngle, index) {
|
472 |
+
|
473 |
+
if (slice.data[0][1] == 0) {
|
474 |
+
return true;
|
475 |
+
}
|
476 |
+
|
477 |
+
// format label text
|
478 |
+
|
479 |
+
var lf = options.legend.labelFormatter, text, plf = options.series.pie.label.formatter;
|
480 |
+
|
481 |
+
if (lf) {
|
482 |
+
text = lf(slice.label, slice);
|
483 |
+
} else {
|
484 |
+
text = slice.label;
|
485 |
+
}
|
486 |
+
|
487 |
+
if (plf) {
|
488 |
+
text = plf(text, slice);
|
489 |
+
}
|
490 |
+
|
491 |
+
var halfAngle = ((startAngle + slice.angle) + startAngle) / 2;
|
492 |
+
var x = centerLeft + Math.round(Math.cos(halfAngle) * radius);
|
493 |
+
var y = centerTop + Math.round(Math.sin(halfAngle) * radius) * options.series.pie.tilt;
|
494 |
+
|
495 |
+
var html = "<span class='pieLabel' id='pieLabel" + index + "' style='position:absolute;top:" + y + "px;left:" + x + "px;'>" + text + "</span>";
|
496 |
+
target.append(html);
|
497 |
+
|
498 |
+
var label = target.children("#pieLabel" + index);
|
499 |
+
var labelTop = (y - label.height() / 2);
|
500 |
+
var labelLeft = (x - label.width() / 2);
|
501 |
+
|
502 |
+
label.css("top", labelTop);
|
503 |
+
label.css("left", labelLeft);
|
504 |
+
|
505 |
+
// check to make sure that the label is not outside the canvas
|
506 |
+
|
507 |
+
if (0 - labelTop > 0 || 0 - labelLeft > 0 || canvasHeight - (labelTop + label.height()) < 0 || canvasWidth - (labelLeft + label.width()) < 0) {
|
508 |
+
return false;
|
509 |
+
}
|
510 |
+
|
511 |
+
if (options.series.pie.label.background.opacity != 0) {
|
512 |
+
|
513 |
+
// put in the transparent background separately to avoid blended labels and label boxes
|
514 |
+
|
515 |
+
var c = options.series.pie.label.background.color;
|
516 |
+
|
517 |
+
if (c == null) {
|
518 |
+
c = slice.color;
|
519 |
+
}
|
520 |
+
|
521 |
+
var pos = "top:" + labelTop + "px;left:" + labelLeft + "px;";
|
522 |
+
$("<div class='pieLabelBackground' style='position:absolute;width:" + label.width() + "px;height:" + label.height() + "px;" + pos + "background-color:" + c + ";'></div>")
|
523 |
+
.css("opacity", options.series.pie.label.background.opacity)
|
524 |
+
.insertBefore(label);
|
525 |
+
}
|
526 |
+
|
527 |
+
return true;
|
528 |
+
} // end individual label function
|
529 |
+
} // end drawLabels function
|
530 |
+
} // end drawPie function
|
531 |
+
} // end draw function
|
532 |
+
|
533 |
+
// Placed here because it needs to be accessed from multiple locations
|
534 |
+
|
535 |
+
function drawDonutHole(layer) {
|
536 |
+
if (options.series.pie.innerRadius > 0) {
|
537 |
+
|
538 |
+
// subtract the center
|
539 |
+
|
540 |
+
layer.save();
|
541 |
+
var innerRadius = options.series.pie.innerRadius > 1 ? options.series.pie.innerRadius : maxRadius * options.series.pie.innerRadius;
|
542 |
+
layer.globalCompositeOperation = "destination-out"; // this does not work with excanvas, but it will fall back to using the stroke color
|
543 |
+
layer.beginPath();
|
544 |
+
layer.fillStyle = options.series.pie.stroke.color;
|
545 |
+
layer.arc(0, 0, innerRadius, 0, Math.PI * 2, false);
|
546 |
+
layer.fill();
|
547 |
+
layer.closePath();
|
548 |
+
layer.restore();
|
549 |
+
|
550 |
+
// add inner stroke
|
551 |
+
|
552 |
+
layer.save();
|
553 |
+
layer.beginPath();
|
554 |
+
layer.strokeStyle = options.series.pie.stroke.color;
|
555 |
+
layer.arc(0, 0, innerRadius, 0, Math.PI * 2, false);
|
556 |
+
layer.stroke();
|
557 |
+
layer.closePath();
|
558 |
+
layer.restore();
|
559 |
+
|
560 |
+
// TODO: add extra shadow inside hole (with a mask) if the pie is tilted.
|
561 |
+
}
|
562 |
+
}
|
563 |
+
|
564 |
+
//-- Additional Interactive related functions --
|
565 |
+
|
566 |
+
function isPointInPoly(poly, pt) {
|
567 |
+
for(var c = false, i = -1, l = poly.length, j = l - 1; ++i < l; j = i)
|
568 |
+
((poly[i][1] <= pt[1] && pt[1] < poly[j][1]) || (poly[j][1] <= pt[1] && pt[1]< poly[i][1]))
|
569 |
+
&& (pt[0] < (poly[j][0] - poly[i][0]) * (pt[1] - poly[i][1]) / (poly[j][1] - poly[i][1]) + poly[i][0])
|
570 |
+
&& (c = !c);
|
571 |
+
return c;
|
572 |
+
}
|
573 |
+
|
574 |
+
function findNearbySlice(mouseX, mouseY) {
|
575 |
+
|
576 |
+
var slices = plot.getData(),
|
577 |
+
options = plot.getOptions(),
|
578 |
+
radius = options.series.pie.radius > 1 ? options.series.pie.radius : maxRadius * options.series.pie.radius,
|
579 |
+
x, y;
|
580 |
+
|
581 |
+
for (var i = 0; i < slices.length; ++i) {
|
582 |
+
|
583 |
+
var s = slices[i];
|
584 |
+
|
585 |
+
if (s.pie.show) {
|
586 |
+
|
587 |
+
ctx.save();
|
588 |
+
ctx.beginPath();
|
589 |
+
ctx.moveTo(0, 0); // Center of the pie
|
590 |
+
//ctx.scale(1, options.series.pie.tilt); // this actually seems to break everything when here.
|
591 |
+
ctx.arc(0, 0, radius, s.startAngle, s.startAngle + s.angle / 2, false);
|
592 |
+
ctx.arc(0, 0, radius, s.startAngle + s.angle / 2, s.startAngle + s.angle, false);
|
593 |
+
ctx.closePath();
|
594 |
+
x = mouseX - centerLeft;
|
595 |
+
y = mouseY - centerTop;
|
596 |
+
|
597 |
+
if (ctx.isPointInPath) {
|
598 |
+
if (ctx.isPointInPath(mouseX - centerLeft, mouseY - centerTop)) {
|
599 |
+
ctx.restore();
|
600 |
+
return {
|
601 |
+
datapoint: [s.percent, s.data],
|
602 |
+
dataIndex: 0,
|
603 |
+
series: s,
|
604 |
+
seriesIndex: i
|
605 |
+
};
|
606 |
+
}
|
607 |
+
} else {
|
608 |
+
|
609 |
+
// excanvas for IE doesn;t support isPointInPath, this is a workaround.
|
610 |
+
|
611 |
+
var p1X = radius * Math.cos(s.startAngle),
|
612 |
+
p1Y = radius * Math.sin(s.startAngle),
|
613 |
+
p2X = radius * Math.cos(s.startAngle + s.angle / 4),
|
614 |
+
p2Y = radius * Math.sin(s.startAngle + s.angle / 4),
|
615 |
+
p3X = radius * Math.cos(s.startAngle + s.angle / 2),
|
616 |
+
p3Y = radius * Math.sin(s.startAngle + s.angle / 2),
|
617 |
+
p4X = radius * Math.cos(s.startAngle + s.angle / 1.5),
|
618 |
+
p4Y = radius * Math.sin(s.startAngle + s.angle / 1.5),
|
619 |
+
p5X = radius * Math.cos(s.startAngle + s.angle),
|
620 |
+
p5Y = radius * Math.sin(s.startAngle + s.angle),
|
621 |
+
arrPoly = [[0, 0], [p1X, p1Y], [p2X, p2Y], [p3X, p3Y], [p4X, p4Y], [p5X, p5Y]],
|
622 |
+
arrPoint = [x, y];
|
623 |
+
|
624 |
+
// TODO: perhaps do some mathmatical trickery here with the Y-coordinate to compensate for pie tilt?
|
625 |
+
|
626 |
+
if (isPointInPoly(arrPoly, arrPoint)) {
|
627 |
+
ctx.restore();
|
628 |
+
return {
|
629 |
+
datapoint: [s.percent, s.data],
|
630 |
+
dataIndex: 0,
|
631 |
+
series: s,
|
632 |
+
seriesIndex: i
|
633 |
+
};
|
634 |
+
}
|
635 |
+
}
|
636 |
+
|
637 |
+
ctx.restore();
|
638 |
+
}
|
639 |
+
}
|
640 |
+
|
641 |
+
return null;
|
642 |
+
}
|
643 |
+
|
644 |
+
function onMouseMove(e) {
|
645 |
+
triggerClickHoverEvent("plothover", e);
|
646 |
+
}
|
647 |
+
|
648 |
+
function onClick(e) {
|
649 |
+
triggerClickHoverEvent("plotclick", e);
|
650 |
+
}
|
651 |
+
|
652 |
+
// trigger click or hover event (they send the same parameters so we share their code)
|
653 |
+
|
654 |
+
function triggerClickHoverEvent(eventname, e) {
|
655 |
+
|
656 |
+
var offset = plot.offset();
|
657 |
+
var canvasX = parseInt(e.pageX - offset.left);
|
658 |
+
var canvasY = parseInt(e.pageY - offset.top);
|
659 |
+
var item = findNearbySlice(canvasX, canvasY);
|
660 |
+
|
661 |
+
if (options.grid.autoHighlight) {
|
662 |
+
|
663 |
+
// clear auto-highlights
|
664 |
+
|
665 |
+
for (var i = 0; i < highlights.length; ++i) {
|
666 |
+
var h = highlights[i];
|
667 |
+
if (h.auto == eventname && !(item && h.series == item.series)) {
|
668 |
+
unhighlight(h.series);
|
669 |
+
}
|
670 |
+
}
|
671 |
+
}
|
672 |
+
|
673 |
+
// highlight the slice
|
674 |
+
|
675 |
+
if (item) {
|
676 |
+
highlight(item.series, eventname);
|
677 |
+
}
|
678 |
+
|
679 |
+
// trigger any hover bind events
|
680 |
+
|
681 |
+
var pos = { pageX: e.pageX, pageY: e.pageY };
|
682 |
+
target.trigger(eventname, [pos, item]);
|
683 |
+
}
|
684 |
+
|
685 |
+
function highlight(s, auto) {
|
686 |
+
//if (typeof s == "number") {
|
687 |
+
// s = series[s];
|
688 |
+
//}
|
689 |
+
|
690 |
+
var i = indexOfHighlight(s);
|
691 |
+
|
692 |
+
if (i == -1) {
|
693 |
+
highlights.push({ series: s, auto: auto });
|
694 |
+
plot.triggerRedrawOverlay();
|
695 |
+
} else if (!auto) {
|
696 |
+
highlights[i].auto = false;
|
697 |
+
}
|
698 |
+
}
|
699 |
+
|
700 |
+
function unhighlight(s) {
|
701 |
+
if (s == null) {
|
702 |
+
highlights = [];
|
703 |
+
plot.triggerRedrawOverlay();
|
704 |
+
}
|
705 |
+
|
706 |
+
//if (typeof s == "number") {
|
707 |
+
// s = series[s];
|
708 |
+
//}
|
709 |
+
|
710 |
+
var i = indexOfHighlight(s);
|
711 |
+
|
712 |
+
if (i != -1) {
|
713 |
+
highlights.splice(i, 1);
|
714 |
+
plot.triggerRedrawOverlay();
|
715 |
+
}
|
716 |
+
}
|
717 |
+
|
718 |
+
function indexOfHighlight(s) {
|
719 |
+
for (var i = 0; i < highlights.length; ++i) {
|
720 |
+
var h = highlights[i];
|
721 |
+
if (h.series == s)
|
722 |
+
return i;
|
723 |
+
}
|
724 |
+
return -1;
|
725 |
+
}
|
726 |
+
|
727 |
+
function drawOverlay(plot, octx) {
|
728 |
+
|
729 |
+
var options = plot.getOptions();
|
730 |
+
|
731 |
+
var radius = options.series.pie.radius > 1 ? options.series.pie.radius : maxRadius * options.series.pie.radius;
|
732 |
+
|
733 |
+
octx.save();
|
734 |
+
octx.translate(centerLeft, centerTop);
|
735 |
+
octx.scale(1, options.series.pie.tilt);
|
736 |
+
|
737 |
+
for (var i = 0; i < highlights.length; ++i) {
|
738 |
+
drawHighlight(highlights[i].series);
|
739 |
+
}
|
740 |
+
|
741 |
+
drawDonutHole(octx);
|
742 |
+
|
743 |
+
octx.restore();
|
744 |
+
|
745 |
+
function drawHighlight(series) {
|
746 |
+
|
747 |
+
if (series.angle <= 0 || isNaN(series.angle)) {
|
748 |
+
return;
|
749 |
+
}
|
750 |
+
|
751 |
+
//octx.fillStyle = parseColor(options.series.pie.highlight.color).scale(null, null, null, options.series.pie.highlight.opacity).toString();
|
752 |
+
octx.fillStyle = "rgba(255, 255, 255, " + options.series.pie.highlight.opacity + ")"; // this is temporary until we have access to parseColor
|
753 |
+
octx.beginPath();
|
754 |
+
if (Math.abs(series.angle - Math.PI * 2) > 0.000000001) {
|
755 |
+
octx.moveTo(0, 0); // Center of the pie
|
756 |
+
}
|
757 |
+
octx.arc(0, 0, radius, series.startAngle, series.startAngle + series.angle / 2, false);
|
758 |
+
octx.arc(0, 0, radius, series.startAngle + series.angle / 2, series.startAngle + series.angle, false);
|
759 |
+
octx.closePath();
|
760 |
+
octx.fill();
|
761 |
+
}
|
762 |
+
}
|
763 |
+
} // end init (plugin body)
|
764 |
+
|
765 |
+
// define pie specific options and their default values
|
766 |
+
|
767 |
+
var options = {
|
768 |
+
series: {
|
769 |
+
pie: {
|
770 |
+
show: false,
|
771 |
+
radius: "auto", // actual radius of the visible pie (based on full calculated radius if <=1, or hard pixel value)
|
772 |
+
innerRadius: 0, /* for donut */
|
773 |
+
startAngle: 3/2,
|
774 |
+
tilt: 1,
|
775 |
+
shadow: {
|
776 |
+
left: 5, // shadow left offset
|
777 |
+
top: 15, // shadow top offset
|
778 |
+
alpha: 0.02 // shadow alpha
|
779 |
+
},
|
780 |
+
offset: {
|
781 |
+
top: 0,
|
782 |
+
left: "auto"
|
783 |
+
},
|
784 |
+
stroke: {
|
785 |
+
color: "#fff",
|
786 |
+
width: 1
|
787 |
+
},
|
788 |
+
label: {
|
789 |
+
show: "auto",
|
790 |
+
formatter: function(label, slice) {
|
791 |
+
return "<div style='font-size:x-small;text-align:center;padding:2px;color:" + slice.color + ";'>" + label + "<br/>" + Math.round(slice.percent) + "%</div>";
|
792 |
+
}, // formatter function
|
793 |
+
radius: 1, // radius at which to place the labels (based on full calculated radius if <=1, or hard pixel value)
|
794 |
+
background: {
|
795 |
+
color: null,
|
796 |
+
opacity: 0
|
797 |
+
},
|
798 |
+
threshold: 0 // percentage at which to hide the label (i.e. the slice is too narrow)
|
799 |
+
},
|
800 |
+
combine: {
|
801 |
+
threshold: -1, // percentage at which to combine little slices into one larger slice
|
802 |
+
color: null, // color to give the new slice (auto-generated if null)
|
803 |
+
label: "Other" // label to give the new slice
|
804 |
+
},
|
805 |
+
highlight: {
|
806 |
+
//color: "#fff", // will add this functionality once parseColor is available
|
807 |
+
opacity: 0.5
|
808 |
+
}
|
809 |
+
}
|
810 |
+
}
|
811 |
+
};
|
812 |
+
|
813 |
+
$.plot.plugins.push({
|
814 |
+
init: init,
|
815 |
+
options: options,
|
816 |
+
name: "pie",
|
817 |
+
version: "1.1"
|
818 |
+
});
|
819 |
+
|
820 |
+
})(jQuery);
|
assets/js/jquery.flot.pie.min.js
ADDED
@@ -0,0 +1,7 @@
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
1 |
+
/* Javascript plotting library for jQuery, version 0.8.3.
|
2 |
+
|
3 |
+
Copyright (c) 2007-2014 IOLA and Ole Laursen.
|
4 |
+
Licensed under the MIT license.
|
5 |
+
|
6 |
+
*/
|
7 |
+
(function($){var REDRAW_ATTEMPTS=10;var REDRAW_SHRINK=.95;function init(plot){var canvas=null,target=null,options=null,maxRadius=null,centerLeft=null,centerTop=null,processed=false,ctx=null;var highlights=[];plot.hooks.processOptions.push(function(plot,options){if(options.series.pie.show){options.grid.show=false;if(options.series.pie.label.show=="auto"){if(options.legend.show){options.series.pie.label.show=false}else{options.series.pie.label.show=true}}if(options.series.pie.radius=="auto"){if(options.series.pie.label.show){options.series.pie.radius=3/4}else{options.series.pie.radius=1}}if(options.series.pie.tilt>1){options.series.pie.tilt=1}else if(options.series.pie.tilt<0){options.series.pie.tilt=0}}});plot.hooks.bindEvents.push(function(plot,eventHolder){var options=plot.getOptions();if(options.series.pie.show){if(options.grid.hoverable){eventHolder.unbind("mousemove").mousemove(onMouseMove)}if(options.grid.clickable){eventHolder.unbind("click").click(onClick)}}});plot.hooks.processDatapoints.push(function(plot,series,data,datapoints){var options=plot.getOptions();if(options.series.pie.show){processDatapoints(plot,series,data,datapoints)}});plot.hooks.drawOverlay.push(function(plot,octx){var options=plot.getOptions();if(options.series.pie.show){drawOverlay(plot,octx)}});plot.hooks.draw.push(function(plot,newCtx){var options=plot.getOptions();if(options.series.pie.show){draw(plot,newCtx)}});function processDatapoints(plot,series,datapoints){if(!processed){processed=true;canvas=plot.getCanvas();target=$(canvas).parent();options=plot.getOptions();plot.setData(combine(plot.getData()))}}function combine(data){var total=0,combined=0,numCombined=0,color=options.series.pie.combine.color,newdata=[];for(var i=0;i<data.length;++i){var value=data[i].data;if($.isArray(value)&&value.length==1){value=value[0]}if($.isArray(value)){if(!isNaN(parseFloat(value[1]))&&isFinite(value[1])){value[1]=+value[1]}else{value[1]=0}}else if(!isNaN(parseFloat(value))&&isFinite(value)){value=[1,+value]}else{value=[1,0]}data[i].data=[value]}for(var i=0;i<data.length;++i){total+=data[i].data[0][1]}for(var i=0;i<data.length;++i){var value=data[i].data[0][1];if(value/total<=options.series.pie.combine.threshold){combined+=value;numCombined++;if(!color){color=data[i].color}}}for(var i=0;i<data.length;++i){var value=data[i].data[0][1];if(numCombined<2||value/total>options.series.pie.combine.threshold){newdata.push($.extend(data[i],{data:[[1,value]],color:data[i].color,label:data[i].label,angle:value*Math.PI*2/total,percent:value/(total/100)}))}}if(numCombined>1){newdata.push({data:[[1,combined]],color:color,label:options.series.pie.combine.label,angle:combined*Math.PI*2/total,percent:combined/(total/100)})}return newdata}function draw(plot,newCtx){if(!target){return}var canvasWidth=plot.getPlaceholder().width(),canvasHeight=plot.getPlaceholder().height(),legendWidth=target.children().filter(".legend").children().width()||0;ctx=newCtx;processed=false;maxRadius=Math.min(canvasWidth,canvasHeight/options.series.pie.tilt)/2;centerTop=canvasHeight/2+options.series.pie.offset.top;centerLeft=canvasWidth/2;if(options.series.pie.offset.left=="auto"){if(options.legend.position.match("w")){centerLeft+=legendWidth/2}else{centerLeft-=legendWidth/2}if(centerLeft<maxRadius){centerLeft=maxRadius}else if(centerLeft>canvasWidth-maxRadius){centerLeft=canvasWidth-maxRadius}}else{centerLeft+=options.series.pie.offset.left}var slices=plot.getData(),attempts=0;do{if(attempts>0){maxRadius*=REDRAW_SHRINK}attempts+=1;clear();if(options.series.pie.tilt<=.8){drawShadow()}}while(!drawPie()&&attempts<REDRAW_ATTEMPTS);if(attempts>=REDRAW_ATTEMPTS){clear();target.prepend("<div class='error'>Could not draw pie with labels contained inside canvas</div>")}if(plot.setSeries&&plot.insertLegend){plot.setSeries(slices);plot.insertLegend()}function clear(){ctx.clearRect(0,0,canvasWidth,canvasHeight);target.children().filter(".pieLabel, .pieLabelBackground").remove()}function drawShadow(){var shadowLeft=options.series.pie.shadow.left;var shadowTop=options.series.pie.shadow.top;var edge=10;var alpha=options.series.pie.shadow.alpha;var radius=options.series.pie.radius>1?options.series.pie.radius:maxRadius*options.series.pie.radius;if(radius>=canvasWidth/2-shadowLeft||radius*options.series.pie.tilt>=canvasHeight/2-shadowTop||radius<=edge){return}ctx.save();ctx.translate(shadowLeft,shadowTop);ctx.globalAlpha=alpha;ctx.fillStyle="#000";ctx.translate(centerLeft,centerTop);ctx.scale(1,options.series.pie.tilt);for(var i=1;i<=edge;i++){ctx.beginPath();ctx.arc(0,0,radius,0,Math.PI*2,false);ctx.fill();radius-=i}ctx.restore()}function drawPie(){var startAngle=Math.PI*options.series.pie.startAngle;var radius=options.series.pie.radius>1?options.series.pie.radius:maxRadius*options.series.pie.radius;ctx.save();ctx.translate(centerLeft,centerTop);ctx.scale(1,options.series.pie.tilt);ctx.save();var currentAngle=startAngle;for(var i=0;i<slices.length;++i){slices[i].startAngle=currentAngle;drawSlice(slices[i].angle,slices[i].color,true)}ctx.restore();if(options.series.pie.stroke.width>0){ctx.save();ctx.lineWidth=options.series.pie.stroke.width;currentAngle=startAngle;for(var i=0;i<slices.length;++i){drawSlice(slices[i].angle,options.series.pie.stroke.color,false)}ctx.restore()}drawDonutHole(ctx);ctx.restore();if(options.series.pie.label.show){return drawLabels()}else return true;function drawSlice(angle,color,fill){if(angle<=0||isNaN(angle)){return}if(fill){ctx.fillStyle=color}else{ctx.strokeStyle=color;ctx.lineJoin="round"}ctx.beginPath();if(Math.abs(angle-Math.PI*2)>1e-9){ctx.moveTo(0,0)}ctx.arc(0,0,radius,currentAngle,currentAngle+angle/2,false);ctx.arc(0,0,radius,currentAngle+angle/2,currentAngle+angle,false);ctx.closePath();currentAngle+=angle;if(fill){ctx.fill()}else{ctx.stroke()}}function drawLabels(){var currentAngle=startAngle;var radius=options.series.pie.label.radius>1?options.series.pie.label.radius:maxRadius*options.series.pie.label.radius;for(var i=0;i<slices.length;++i){if(slices[i].percent>=options.series.pie.label.threshold*100){if(!drawLabel(slices[i],currentAngle,i)){return false}}currentAngle+=slices[i].angle}return true;function drawLabel(slice,startAngle,index){if(slice.data[0][1]==0){return true}var lf=options.legend.labelFormatter,text,plf=options.series.pie.label.formatter;if(lf){text=lf(slice.label,slice)}else{text=slice.label}if(plf){text=plf(text,slice)}var halfAngle=(startAngle+slice.angle+startAngle)/2;var x=centerLeft+Math.round(Math.cos(halfAngle)*radius);var y=centerTop+Math.round(Math.sin(halfAngle)*radius)*options.series.pie.tilt;var html="<span class='pieLabel' id='pieLabel"+index+"' style='position:absolute;top:"+y+"px;left:"+x+"px;'>"+text+"</span>";target.append(html);var label=target.children("#pieLabel"+index);var labelTop=y-label.height()/2;var labelLeft=x-label.width()/2;label.css("top",labelTop);label.css("left",labelLeft);if(0-labelTop>0||0-labelLeft>0||canvasHeight-(labelTop+label.height())<0||canvasWidth-(labelLeft+label.width())<0){return false}if(options.series.pie.label.background.opacity!=0){var c=options.series.pie.label.background.color;if(c==null){c=slice.color}var pos="top:"+labelTop+"px;left:"+labelLeft+"px;";$("<div class='pieLabelBackground' style='position:absolute;width:"+label.width()+"px;height:"+label.height()+"px;"+pos+"background-color:"+c+";'></div>").css("opacity",options.series.pie.label.background.opacity).insertBefore(label)}return true}}}}function drawDonutHole(layer){if(options.series.pie.innerRadius>0){layer.save();var innerRadius=options.series.pie.innerRadius>1?options.series.pie.innerRadius:maxRadius*options.series.pie.innerRadius;layer.globalCompositeOperation="destination-out";layer.beginPath();layer.fillStyle=options.series.pie.stroke.color;layer.arc(0,0,innerRadius,0,Math.PI*2,false);layer.fill();layer.closePath();layer.restore();layer.save();layer.beginPath();layer.strokeStyle=options.series.pie.stroke.color;layer.arc(0,0,innerRadius,0,Math.PI*2,false);layer.stroke();layer.closePath();layer.restore()}}function isPointInPoly(poly,pt){for(var c=false,i=-1,l=poly.length,j=l-1;++i<l;j=i)(poly[i][1]<=pt[1]&&pt[1]<poly[j][1]||poly[j][1]<=pt[1]&&pt[1]<poly[i][1])&&pt[0]<(poly[j][0]-poly[i][0])*(pt[1]-poly[i][1])/(poly[j][1]-poly[i][1])+poly[i][0]&&(c=!c);return c}function findNearbySlice(mouseX,mouseY){var slices=plot.getData(),options=plot.getOptions(),radius=options.series.pie.radius>1?options.series.pie.radius:maxRadius*options.series.pie.radius,x,y;for(var i=0;i<slices.length;++i){var s=slices[i];if(s.pie.show){ctx.save();ctx.beginPath();ctx.moveTo(0,0);ctx.arc(0,0,radius,s.startAngle,s.startAngle+s.angle/2,false);ctx.arc(0,0,radius,s.startAngle+s.angle/2,s.startAngle+s.angle,false);ctx.closePath();x=mouseX-centerLeft;y=mouseY-centerTop;if(ctx.isPointInPath){if(ctx.isPointInPath(mouseX-centerLeft,mouseY-centerTop)){ctx.restore();return{datapoint:[s.percent,s.data],dataIndex:0,series:s,seriesIndex:i}}}else{var p1X=radius*Math.cos(s.startAngle),p1Y=radius*Math.sin(s.startAngle),p2X=radius*Math.cos(s.startAngle+s.angle/4),p2Y=radius*Math.sin(s.startAngle+s.angle/4),p3X=radius*Math.cos(s.startAngle+s.angle/2),p3Y=radius*Math.sin(s.startAngle+s.angle/2),p4X=radius*Math.cos(s.startAngle+s.angle/1.5),p4Y=radius*Math.sin(s.startAngle+s.angle/1.5),p5X=radius*Math.cos(s.startAngle+s.angle),p5Y=radius*Math.sin(s.startAngle+s.angle),arrPoly=[[0,0],[p1X,p1Y],[p2X,p2Y],[p3X,p3Y],[p4X,p4Y],[p5X,p5Y]],arrPoint=[x,y];if(isPointInPoly(arrPoly,arrPoint)){ctx.restore();return{datapoint:[s.percent,s.data],dataIndex:0,series:s,seriesIndex:i}}}ctx.restore()}}return null}function onMouseMove(e){triggerClickHoverEvent("plothover",e)}function onClick(e){triggerClickHoverEvent("plotclick",e)}function triggerClickHoverEvent(eventname,e){var offset=plot.offset();var canvasX=parseInt(e.pageX-offset.left);var canvasY=parseInt(e.pageY-offset.top);var item=findNearbySlice(canvasX,canvasY);if(options.grid.autoHighlight){for(var i=0;i<highlights.length;++i){var h=highlights[i];if(h.auto==eventname&&!(item&&h.series==item.series)){unhighlight(h.series)}}}if(item){highlight(item.series,eventname)}var pos={pageX:e.pageX,pageY:e.pageY};target.trigger(eventname,[pos,item])}function highlight(s,auto){var i=indexOfHighlight(s);if(i==-1){highlights.push({series:s,auto:auto});plot.triggerRedrawOverlay()}else if(!auto){highlights[i].auto=false}}function unhighlight(s){if(s==null){highlights=[];plot.triggerRedrawOverlay()}var i=indexOfHighlight(s);if(i!=-1){highlights.splice(i,1);plot.triggerRedrawOverlay()}}function indexOfHighlight(s){for(var i=0;i<highlights.length;++i){var h=highlights[i];if(h.series==s)return i}return-1}function drawOverlay(plot,octx){var options=plot.getOptions();var radius=options.series.pie.radius>1?options.series.pie.radius:maxRadius*options.series.pie.radius;octx.save();octx.translate(centerLeft,centerTop);octx.scale(1,options.series.pie.tilt);for(var i=0;i<highlights.length;++i){drawHighlight(highlights[i].series)}drawDonutHole(octx);octx.restore();function drawHighlight(series){if(series.angle<=0||isNaN(series.angle)){return}octx.fillStyle="rgba(255, 255, 255, "+options.series.pie.highlight.opacity+")";octx.beginPath();if(Math.abs(series.angle-Math.PI*2)>1e-9){octx.moveTo(0,0)}octx.arc(0,0,radius,series.startAngle,series.startAngle+series.angle/2,false);octx.arc(0,0,radius,series.startAngle+series.angle/2,series.startAngle+series.angle,false);octx.closePath();octx.fill()}}}var options={series:{pie:{show:false,radius:"auto",innerRadius:0,startAngle:3/2,tilt:1,shadow:{left:5,top:15,alpha:.02},offset:{top:0,left:"auto"},stroke:{color:"#fff",width:1},label:{show:"auto",formatter:function(label,slice){return"<div style='font-size:x-small;text-align:center;padding:2px;color:"+slice.color+";'>"+label+"<br/>"+Math.round(slice.percent)+"%</div>"},radius:1,background:{color:null,opacity:0},threshold:0},combine:{threshold:-1,color:null,label:"Other"},highlight:{opacity:.5}}}};$.plot.plugins.push({init:init,options:options,name:"pie",version:"1.1"})})(jQuery);
|
easy-digital-downloads.php
CHANGED
@@ -5,7 +5,7 @@
|
|
5 |
* Description: Serve Digital Downloads Through WordPress
|
6 |
* Author: Pippin Williamson
|
7 |
* Author URI: https://pippinsplugins.com
|
8 |
-
* Version: 2.
|
9 |
* Text Domain: edd
|
10 |
* Domain Path: languages
|
11 |
*
|
@@ -25,7 +25,7 @@
|
|
25 |
* @package EDD
|
26 |
* @category Core
|
27 |
* @author Pippin Williamson
|
28 |
-
* @version 2.
|
29 |
*/
|
30 |
|
31 |
// Exit if accessed directly
|
@@ -187,7 +187,7 @@ final class Easy_Digital_Downloads {
|
|
187 |
|
188 |
// Plugin version
|
189 |
if ( ! defined( 'EDD_VERSION' ) ) {
|
190 |
-
define( 'EDD_VERSION', '2.
|
191 |
}
|
192 |
|
193 |
// Plugin Folder Path
|
@@ -229,13 +229,13 @@ final class Easy_Digital_Downloads {
|
|
229 |
require_once EDD_PLUGIN_DIR . 'includes/deprecated-functions.php';
|
230 |
}
|
231 |
require_once EDD_PLUGIN_DIR . 'includes/ajax-functions.php';
|
|
|
232 |
require_once EDD_PLUGIN_DIR . 'includes/template-functions.php';
|
233 |
require_once EDD_PLUGIN_DIR . 'includes/checkout/template.php';
|
234 |
require_once EDD_PLUGIN_DIR . 'includes/checkout/functions.php';
|
235 |
require_once EDD_PLUGIN_DIR . 'includes/cart/functions.php';
|
236 |
require_once EDD_PLUGIN_DIR . 'includes/cart/template.php';
|
237 |
require_once EDD_PLUGIN_DIR . 'includes/cart/actions.php';
|
238 |
-
require_once EDD_PLUGIN_DIR . 'includes/class-edd-api.php';
|
239 |
require_once EDD_PLUGIN_DIR . 'includes/class-edd-db.php';
|
240 |
require_once EDD_PLUGIN_DIR . 'includes/class-edd-db-customers.php';
|
241 |
require_once EDD_PLUGIN_DIR . 'includes/class-edd-customer.php';
|
@@ -255,9 +255,13 @@ final class Easy_Digital_Downloads {
|
|
255 |
require_once EDD_PLUGIN_DIR . 'includes/country-functions.php';
|
256 |
require_once EDD_PLUGIN_DIR . 'includes/formatting.php';
|
257 |
require_once EDD_PLUGIN_DIR . 'includes/widgets.php';
|
|
|
258 |
require_once EDD_PLUGIN_DIR . 'includes/mime-types.php';
|
259 |
require_once EDD_PLUGIN_DIR . 'includes/gateways/actions.php';
|
260 |
require_once EDD_PLUGIN_DIR . 'includes/gateways/functions.php';
|
|
|
|
|
|
|
261 |
require_once EDD_PLUGIN_DIR . 'includes/gateways/paypal-standard.php';
|
262 |
require_once EDD_PLUGIN_DIR . 'includes/gateways/manual.php';
|
263 |
require_once EDD_PLUGIN_DIR . 'includes/discount-functions.php';
|
@@ -265,7 +269,6 @@ final class Easy_Digital_Downloads {
|
|
265 |
require_once EDD_PLUGIN_DIR . 'includes/payments/actions.php';
|
266 |
require_once EDD_PLUGIN_DIR . 'includes/payments/class-payment-stats.php';
|
267 |
require_once EDD_PLUGIN_DIR . 'includes/payments/class-payments-query.php';
|
268 |
-
require_once EDD_PLUGIN_DIR . 'includes/misc-functions.php';
|
269 |
require_once EDD_PLUGIN_DIR . 'includes/download-functions.php';
|
270 |
require_once EDD_PLUGIN_DIR . 'includes/scripts.php';
|
271 |
require_once EDD_PLUGIN_DIR . 'includes/post-types.php';
|
@@ -290,7 +293,6 @@ final class Easy_Digital_Downloads {
|
|
290 |
require_once EDD_PLUGIN_DIR . 'includes/admin/class-edd-notices.php';
|
291 |
require_once EDD_PLUGIN_DIR . 'includes/admin/admin-pages.php';
|
292 |
require_once EDD_PLUGIN_DIR . 'includes/admin/dashboard-widgets.php';
|
293 |
-
require_once EDD_PLUGIN_DIR . 'includes/admin/export-functions.php';
|
294 |
require_once EDD_PLUGIN_DIR . 'includes/admin/thickbox.php';
|
295 |
require_once EDD_PLUGIN_DIR . 'includes/admin/upload-functions.php';
|
296 |
require_once EDD_PLUGIN_DIR . 'includes/admin/downloads/dashboard-columns.php';
|
@@ -306,9 +308,11 @@ final class Easy_Digital_Downloads {
|
|
306 |
require_once EDD_PLUGIN_DIR . 'includes/admin/payments/payments-history.php';
|
307 |
require_once EDD_PLUGIN_DIR . 'includes/admin/payments/contextual-help.php';
|
308 |
require_once EDD_PLUGIN_DIR . 'includes/admin/reporting/contextual-help.php';
|
|
|
309 |
require_once EDD_PLUGIN_DIR . 'includes/admin/reporting/reports.php';
|
310 |
require_once EDD_PLUGIN_DIR . 'includes/admin/reporting/pdf-reports.php';
|
311 |
require_once EDD_PLUGIN_DIR . 'includes/admin/reporting/class-edd-graph.php';
|
|
|
312 |
require_once EDD_PLUGIN_DIR . 'includes/admin/reporting/graphing.php';
|
313 |
require_once EDD_PLUGIN_DIR . 'includes/admin/settings/display-settings.php';
|
314 |
require_once EDD_PLUGIN_DIR . 'includes/admin/settings/contextual-help.php';
|
5 |
* Description: Serve Digital Downloads Through WordPress
|
6 |
* Author: Pippin Williamson
|
7 |
* Author URI: https://pippinsplugins.com
|
8 |
+
* Version: 2.4
|
9 |
* Text Domain: edd
|
10 |
* Domain Path: languages
|
11 |
*
|
25 |
* @package EDD
|
26 |
* @category Core
|
27 |
* @author Pippin Williamson
|
28 |
+
* @version 2.4
|
29 |
*/
|
30 |
|
31 |
// Exit if accessed directly
|
187 |
|
188 |
// Plugin version
|
189 |
if ( ! defined( 'EDD_VERSION' ) ) {
|
190 |
+
define( 'EDD_VERSION', '2.4' );
|
191 |
}
|
192 |
|
193 |
// Plugin Folder Path
|
229 |
require_once EDD_PLUGIN_DIR . 'includes/deprecated-functions.php';
|
230 |
}
|
231 |
require_once EDD_PLUGIN_DIR . 'includes/ajax-functions.php';
|
232 |
+
require_once EDD_PLUGIN_DIR . 'includes/api/class-edd-api.php';
|
233 |
require_once EDD_PLUGIN_DIR . 'includes/template-functions.php';
|
234 |
require_once EDD_PLUGIN_DIR . 'includes/checkout/template.php';
|
235 |
require_once EDD_PLUGIN_DIR . 'includes/checkout/functions.php';
|
236 |
require_once EDD_PLUGIN_DIR . 'includes/cart/functions.php';
|
237 |
require_once EDD_PLUGIN_DIR . 'includes/cart/template.php';
|
238 |
require_once EDD_PLUGIN_DIR . 'includes/cart/actions.php';
|
|
|
239 |
require_once EDD_PLUGIN_DIR . 'includes/class-edd-db.php';
|
240 |
require_once EDD_PLUGIN_DIR . 'includes/class-edd-db-customers.php';
|
241 |
require_once EDD_PLUGIN_DIR . 'includes/class-edd-customer.php';
|
255 |
require_once EDD_PLUGIN_DIR . 'includes/country-functions.php';
|
256 |
require_once EDD_PLUGIN_DIR . 'includes/formatting.php';
|
257 |
require_once EDD_PLUGIN_DIR . 'includes/widgets.php';
|
258 |
+
require_once EDD_PLUGIN_DIR . 'includes/misc-functions.php';
|
259 |
require_once EDD_PLUGIN_DIR . 'includes/mime-types.php';
|
260 |
require_once EDD_PLUGIN_DIR . 'includes/gateways/actions.php';
|
261 |
require_once EDD_PLUGIN_DIR . 'includes/gateways/functions.php';
|
262 |
+
if ( version_compare( phpversion(), 5.3, '>' ) ) {
|
263 |
+
require_once EDD_PLUGIN_DIR . 'includes/gateways/amazon-payments.php';
|
264 |
+
}
|
265 |
require_once EDD_PLUGIN_DIR . 'includes/gateways/paypal-standard.php';
|
266 |
require_once EDD_PLUGIN_DIR . 'includes/gateways/manual.php';
|
267 |
require_once EDD_PLUGIN_DIR . 'includes/discount-functions.php';
|
269 |
require_once EDD_PLUGIN_DIR . 'includes/payments/actions.php';
|
270 |
require_once EDD_PLUGIN_DIR . 'includes/payments/class-payment-stats.php';
|
271 |
require_once EDD_PLUGIN_DIR . 'includes/payments/class-payments-query.php';
|
|
|
272 |
require_once EDD_PLUGIN_DIR . 'includes/download-functions.php';
|
273 |
require_once EDD_PLUGIN_DIR . 'includes/scripts.php';
|
274 |
require_once EDD_PLUGIN_DIR . 'includes/post-types.php';
|
293 |
require_once EDD_PLUGIN_DIR . 'includes/admin/class-edd-notices.php';
|
294 |
require_once EDD_PLUGIN_DIR . 'includes/admin/admin-pages.php';
|
295 |
require_once EDD_PLUGIN_DIR . 'includes/admin/dashboard-widgets.php';
|
|
|
296 |
require_once EDD_PLUGIN_DIR . 'includes/admin/thickbox.php';
|
297 |
require_once EDD_PLUGIN_DIR . 'includes/admin/upload-functions.php';
|
298 |
require_once EDD_PLUGIN_DIR . 'includes/admin/downloads/dashboard-columns.php';
|
308 |
require_once EDD_PLUGIN_DIR . 'includes/admin/payments/payments-history.php';
|
309 |
require_once EDD_PLUGIN_DIR . 'includes/admin/payments/contextual-help.php';
|
310 |
require_once EDD_PLUGIN_DIR . 'includes/admin/reporting/contextual-help.php';
|
311 |
+
require_once EDD_PLUGIN_DIR . 'includes/admin/reporting/export/export-functions.php';
|
312 |
require_once EDD_PLUGIN_DIR . 'includes/admin/reporting/reports.php';
|
313 |
require_once EDD_PLUGIN_DIR . 'includes/admin/reporting/pdf-reports.php';
|
314 |
require_once EDD_PLUGIN_DIR . 'includes/admin/reporting/class-edd-graph.php';
|
315 |
+
require_once EDD_PLUGIN_DIR . 'includes/admin/reporting/class-edd-pie-graph.php';
|
316 |
require_once EDD_PLUGIN_DIR . 'includes/admin/reporting/graphing.php';
|
317 |
require_once EDD_PLUGIN_DIR . 'includes/admin/settings/display-settings.php';
|
318 |
require_once EDD_PLUGIN_DIR . 'includes/admin/settings/contextual-help.php';
|
includes/admin/admin-pages.php
CHANGED
@@ -45,37 +45,309 @@ function edd_add_options_link() {
|
|
45 |
add_action( 'admin_menu', 'edd_add_options_link', 10 );
|
46 |
|
47 |
/**
|
48 |
-
* Determines whether the current admin page is
|
49 |
*
|
50 |
* Only works after the `wp_loaded` hook, & most effective
|
51 |
-
* starting on `admin_menu` hook.
|
|
|
52 |
*
|
53 |
* @since 1.9.6
|
54 |
-
*
|
|
|
|
|
|
|
55 |
*/
|
56 |
-
function edd_is_admin_page() {
|
57 |
-
|
58 |
-
global $pagenow, $typenow, $edd_discounts_page, $edd_payments_page, $edd_settings_page,
|
59 |
-
$edd_reports_page, $edd_system_info_page, $edd_add_ons_page, $edd_settings_export, $edd_upgrades_screen;
|
60 |
-
|
61 |
-
$ret = false;
|
62 |
-
$admin_pages = apply_filters( 'edd_admin_pages', array( $edd_discounts_page, $edd_payments_page, $edd_settings_page, $edd_reports_page, $edd_system_info_page, $edd_add_ons_page, $edd_settings_export ) );
|
63 |
-
|
64 |
-
if ( 'download' == $typenow || 'index.php' == $pagenow || 'post-new.php' == $pagenow || 'post.php' == $pagenow ) {
|
65 |
-
|
66 |
-
$ret = true;
|
67 |
-
|
68 |
-
if( isset( $_GET['page'] ) && 'edd-upgrades' == $_GET['page'] ) {
|
69 |
-
|
70 |
-
$ret = false;
|
71 |
-
|
72 |
-
}
|
73 |
|
74 |
-
|
75 |
|
76 |
-
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
77 |
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
78 |
}
|
79 |
|
80 |
-
return (bool) apply_filters( 'edd_is_admin_page', $
|
81 |
}
|
45 |
add_action( 'admin_menu', 'edd_add_options_link', 10 );
|
46 |
|
47 |
/**
|
48 |
+
* Determines whether the current admin page is a specific EDD admin page.
|
49 |
*
|
50 |
* Only works after the `wp_loaded` hook, & most effective
|
51 |
+
* starting on `admin_menu` hook. Failure to pass in $view will match all views of $main_page.
|
52 |
+
* Failure to pass in $main_page will return true if on any EDD page
|
53 |
*
|
54 |
* @since 1.9.6
|
55 |
+
*
|
56 |
+
* @param string $page Optional. Main page's slug
|
57 |
+
* @param string $view Optional. Page view ( ex: `edit` or `delete` )
|
58 |
+
* @return bool True if EDD admin page we're looking for or an EDD page or if $page is empty, any EDD page
|
59 |
*/
|
60 |
+
function edd_is_admin_page( $passed_page = '', $passed_view = '' ) {
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
61 |
|
62 |
+
global $pagenow, $typenow;
|
63 |
|
64 |
+
$found = false;
|
65 |
+
$post_type = isset( $_GET['post_type'] ) ? strtolower( $_GET['post_type'] ) : false;
|
66 |
+
$action = isset( $_GET['action'] ) ? strtolower( $_GET['action'] ) : false;
|
67 |
+
$taxonomy = isset( $_GET['taxonomy'] ) ? strtolower( $_GET['taxonomy'] ) : false;
|
68 |
+
$page = isset( $_GET['page'] ) ? strtolower( $_GET['page'] ) : false;
|
69 |
+
$view = isset( $_GET['view'] ) ? strtolower( $_GET['view'] ) : false;
|
70 |
+
$edd_action = isset( $_GET['edd-action'] ) ? strtolower( $_GET['edd-action'] ) : false;
|
71 |
+
$tab = isset( $_GET['tab'] ) ? strtolower( $_GET['tab'] ) : false;
|
72 |
|
73 |
+
switch ( $passed_page ) {
|
74 |
+
case 'download':
|
75 |
+
switch ( $passed_view ) {
|
76 |
+
case 'list-table':
|
77 |
+
if ( ( 'download' == $typenow || 'download' === $post_type ) && $pagenow == 'edit.php' ) {
|
78 |
+
$found = true;
|
79 |
+
}
|
80 |
+
break;
|
81 |
+
case 'edit':
|
82 |
+
if ( ( 'download' == $typenow || 'download' === $post_type ) && $pagenow == 'post.php' ) {
|
83 |
+
$found = true;
|
84 |
+
}
|
85 |
+
break;
|
86 |
+
case 'new':
|
87 |
+
if ( ( 'download' == $typenow || 'download' === $post_type ) && $pagenow == 'post-new.php' ) {
|
88 |
+
$found = true;
|
89 |
+
}
|
90 |
+
break;
|
91 |
+
default:
|
92 |
+
if ( ( 'download' == $typenow || 'download' === $post_type ) || 'download' === $post_type || ( 'post-new.php' == $pagenow && 'download' === $post_type ) ) {
|
93 |
+
$found = true;
|
94 |
+
}
|
95 |
+
break;
|
96 |
+
}
|
97 |
+
break;
|
98 |
+
case 'categories':
|
99 |
+
switch ( $passed_view ) {
|
100 |
+
case 'list-table':
|
101 |
+
case 'new':
|
102 |
+
if ( ( 'download' == $typenow || 'download' === $post_type ) && $pagenow == 'edit-tags.php' && 'edit' !== $action && 'download_category' === $taxonomy ) {
|
103 |
+
$found = true;
|
104 |
+
}
|
105 |
+
break;
|
106 |
+
case 'edit':
|
107 |
+
if ( ( 'download' == $typenow || 'download' === $post_type ) && $pagenow == 'edit-tags.php' && 'edit' === $action && 'download_category' === $taxonomy ) {
|
108 |
+
$found = true;
|
109 |
+
}
|
110 |
+
break;
|
111 |
+
default:
|
112 |
+
if ( ( 'download' == $typenow || 'download' === $post_type ) && $pagenow == 'edit-tags.php' && 'download_category' === $taxonomy ) {
|
113 |
+
$found = true;
|
114 |
+
}
|
115 |
+
break;
|
116 |
+
}
|
117 |
+
break;
|
118 |
+
case 'tags':
|
119 |
+
switch ( $passed_view ) {
|
120 |
+
case 'list-table':
|
121 |
+
case 'new':
|
122 |
+
if ( ( 'download' == $typenow || 'download' === $post_type ) && $pagenow == 'edit-tags.php' && 'edit' !== $action && 'download_tax' === $taxonomy ) {
|
123 |
+
$found = true;
|
124 |
+
}
|
125 |
+
break;
|
126 |
+
case 'edit':
|
127 |
+
if ( ( 'download' == $typenow || 'download' === $post_type ) && $pagenow == 'edit-tags.php' && 'edit' === $action && 'download_tax' === $taxonomy ) {
|
128 |
+
$found = true;
|
129 |
+
}
|
130 |
+
break;
|
131 |
+
default:
|
132 |
+
if ( ( 'download' == $typenow || 'download' === $post_type ) && $pagenow == 'edit-tags.php' && 'download_tax' === $taxonomy ) {
|
133 |
+
$found = true;
|
134 |
+
}
|
135 |
+
break;
|
136 |
+
}
|
137 |
+
break;
|
138 |
+
case 'payments':
|
139 |
+
switch ( $passed_view ) {
|
140 |
+
case 'list-table':
|
141 |
+
if ( ( 'download' == $typenow || 'download' === $post_type ) && $pagenow == 'edit.php' && 'edd-payment-history' === $page && false === $view ) {
|
142 |
+
$found = true;
|
143 |
+
}
|
144 |
+
break;
|
145 |
+
case 'edit':
|
146 |
+
if ( ( 'download' == $typenow || 'download' === $post_type ) && $pagenow == 'edit.php' && 'edd-payment-history' === $page && 'view-order-details' === $view ) {
|
147 |
+
$found = true;
|
148 |
+
}
|
149 |
+
break;
|
150 |
+
default:
|
151 |
+
if ( ( 'download' == $typenow || 'download' === $post_type ) && $pagenow == 'edit.php' && 'edd-payment-history' === $page ) {
|
152 |
+
$found = true;
|
153 |
+
}
|
154 |
+
break;
|
155 |
+
}
|
156 |
+
break;
|
157 |
+
case 'discounts':
|
158 |
+
switch ( $passed_view ) {
|
159 |
+
case 'list-table':
|
160 |
+
if ( ( 'download' == $typenow || 'download' === $post_type ) && $pagenow == 'edit.php' && 'edd-discounts' === $page && false === $edd_action ) {
|
161 |
+
$found = true;
|
162 |
+
}
|
163 |
+
break;
|
164 |
+
case 'edit':
|
165 |
+
if ( ( 'download' == $typenow || 'download' === $post_type ) && $pagenow == 'edit.php' && 'edd-discounts' === $page && 'edit_discount' === $edd_action ) {
|
166 |
+
$found = true;
|
167 |
+
}
|
168 |
+
break;
|
169 |
+
case 'new':
|
170 |
+
if ( ( 'download' == $typenow || 'download' === $post_type ) && $pagenow == 'edit.php' && 'edd-discounts' === $page && 'add_discount' === $edd_action ) {
|
171 |
+
$found = true;
|
172 |
+
}
|
173 |
+
break;
|
174 |
+
default:
|
175 |
+
if ( ( 'download' == $typenow || 'download' === $post_type ) && $pagenow == 'edit.php' && 'edd-discounts' === $page ) {
|
176 |
+
$found = true;
|
177 |
+
}
|
178 |
+
break;
|
179 |
+
}
|
180 |
+
break;
|
181 |
+
case 'reports':
|
182 |
+
switch ( $passed_view ) {
|
183 |
+
// If you want to do something like enqueue a script on a particular report's duration, look at $_GET[ 'range' ]
|
184 |
+
case 'earnings':
|
185 |
+
if ( ( 'download' == $typenow || 'download' === $post_type ) && $pagenow == 'edit.php' && 'edd-reports' === $page && ( 'earnings' === $view || '-1' === $view || false === $view ) ) {
|
186 |
+
$found = true;
|
187 |
+
}
|
188 |
+
break;
|
189 |
+
case 'downloads':
|
190 |
+
if ( ( 'download' == $typenow || 'download' === $post_type ) && $pagenow == 'edit.php' && 'edd-reports' === $page && 'downloads' === $view ) {
|
191 |
+
$found = true;
|
192 |
+
}
|
193 |
+
break;
|
194 |
+
case 'customers':
|
195 |
+
if ( ( 'download' == $typenow || 'download' === $post_type ) && $pagenow == 'edit.php' && 'edd-reports' === $page && 'customers' === $view ) {
|
196 |
+
$found = true;
|
197 |
+
}
|
198 |
+
break;
|
199 |
+
case 'gateways':
|
200 |
+
if ( ( 'download' == $typenow || 'download' === $post_type ) && $pagenow == 'edit.php' && 'edd-reports' === $page && 'gateways' === $view ) {
|
201 |
+
$found = true;
|
202 |
+
}
|
203 |
+
break;
|
204 |
+
case 'taxes':
|
205 |
+
if ( ( 'download' == $typenow || 'download' === $post_type ) && $pagenow == 'edit.php' && 'edd-reports' === $page && 'taxes' === $view ) {
|
206 |
+
$found = true;
|
207 |
+
}
|
208 |
+
break;
|
209 |
+
case 'export':
|
210 |
+
if ( ( 'download' == $typenow || 'download' === $post_type ) && $pagenow == 'edit.php' && 'edd-reports' === $page && 'export' === $view ) {
|
211 |
+
$found = true;
|
212 |
+
}
|
213 |
+
break;
|
214 |
+
case 'logs':
|
215 |
+
if ( ( 'download' == $typenow || 'download' === $post_type ) && $pagenow == 'edit.php' && 'edd-reports' === $page && 'logs' === $ivew ) {
|
216 |
+
$found = true;
|
217 |
+
}
|
218 |
+
break;
|
219 |
+
default:
|
220 |
+
if ( ( 'download' == $typenow || 'download' === $post_type ) && $pagenow == 'edit.php' && 'edd-reports' === $page ) {
|
221 |
+
$found = true;
|
222 |
+
}
|
223 |
+
break;
|
224 |
+
}
|
225 |
+
break;
|
226 |
+
case 'settings':
|
227 |
+
switch ( $passed_view ) {
|
228 |
+
case 'general':
|
229 |
+
if ( ( 'download' == $typenow || 'download' === $post_type ) && $pagenow == 'edit.php' && 'edd-settings' === $page && ( 'genera' === $tab || false === $tab ) ) {
|
230 |
+
$found = true;
|
231 |
+
}
|
232 |
+
break;
|
233 |
+
case 'gateways':
|
234 |
+
if ( ( 'download' == $typenow || 'download' === $post_type ) && $pagenow == 'edit.php' && 'edd-settings' === $page && 'gateways' === $tab ) {
|
235 |
+
$found = true;
|
236 |
+
}
|
237 |
+
break;
|
238 |
+
case 'emails':
|
239 |
+
if ( ( 'download' == $typenow || 'download' === $post_type ) && $pagenow == 'edit.php' && 'edd-settings' === $page && 'emails' === $tab ) {
|
240 |
+
$found = true;
|
241 |
+
}
|
242 |
+
break;
|
243 |
+
case 'styles':
|
244 |
+
if ( ( 'download' == $typenow || 'download' === $post_type ) && $pagenow == 'edit.php' && 'edd-settings' === $page && 'styles' === $tab ) {
|
245 |
+
$found = true;
|
246 |
+
}
|
247 |
+
break;
|
248 |
+
case 'taxes':
|
249 |
+
if ( ( 'download' == $typenow || 'download' === $post_type ) && $pagenow == 'edit.php' && 'edd-settings' === $page && 'taxes' === $tab ) {
|
250 |
+
$found = true;
|
251 |
+
}
|
252 |
+
break;
|
253 |
+
case 'extensions':
|
254 |
+
if ( ( 'download' == $typenow || 'download' === $post_type ) && $pagenow == 'edit.php' && 'edd-settings' === $page && 'extensions' === $tab ) {
|
255 |
+
$found = true;
|
256 |
+
}
|
257 |
+
break;
|
258 |
+
case 'licenses':
|
259 |
+
if ( ( 'download' == $typenow || 'download' === $post_type ) && $pagenow == 'edit.php' && 'edd-settings' === $page && 'licenses' === $tab ) {
|
260 |
+
$found = true;
|
261 |
+
}
|
262 |
+
break;
|
263 |
+
case 'misc':
|
264 |
+
if ( ( 'download' == $typenow || 'download' === $post_type ) && $pagenow == 'edit.php' && 'edd-settings' === $page && 'misc' === $tab ) {
|
265 |
+
$found = true;
|
266 |
+
}
|
267 |
+
break;
|
268 |
+
default:
|
269 |
+
if ( ( 'download' == $typenow || 'download' === $post_type ) && $pagenow == 'edit.php' && 'edd-settings' === $page ) {
|
270 |
+
$found = true;
|
271 |
+
}
|
272 |
+
break;
|
273 |
+
}
|
274 |
+
break;
|
275 |
+
case 'tools':
|
276 |
+
switch ( $passed_view ) {
|
277 |
+
case 'general':
|
278 |
+
if ( ( 'download' == $typenow || 'download' === $post_type ) && $pagenow == 'edit.php' && 'edd-tools' === $page && ( 'general' === $tab || false === $tab ) ) {
|
279 |
+
$found = true;
|
280 |
+
}
|
281 |
+
break;
|
282 |
+
case 'api_keys':
|
283 |
+
if ( ( 'download' == $typenow || 'download' === $post_type ) && $pagenow == 'edit.php' && 'edd-tools' === $page && 'api_keys' === $tab ) {
|
284 |
+
$found = true;
|
285 |
+
}
|
286 |
+
break;
|
287 |
+
case 'system_info':
|
288 |
+
if ( ( 'download' == $typenow || 'download' === $post_type ) && $pagenow == 'edit.php' && 'edd-tools' === $page && 'system_info' === $tab ) {
|
289 |
+
$found = true;
|
290 |
+
}
|
291 |
+
break;
|
292 |
+
case 'import_export':
|
293 |
+
if ( ( 'download' == $typenow || 'download' === $post_type ) && $pagenow == 'edit.php' && 'edd-tools' === $page && 'import_export' === $tab ) {
|
294 |
+
$found = true;
|
295 |
+
}
|
296 |
+
break;
|
297 |
+
default:
|
298 |
+
if ( ( 'download' == $typenow || 'download' === $post_type ) && $pagenow == 'edit.php' && 'edd-tools' === $page ) {
|
299 |
+
$found = true;
|
300 |
+
}
|
301 |
+
break;
|
302 |
+
}
|
303 |
+
break;
|
304 |
+
case 'addons':
|
305 |
+
if ( ( 'download' == $typenow || 'download' === $post_type ) && $pagenow == 'edit.php' && 'edd-addons' === $page ) {
|
306 |
+
$found = true;
|
307 |
+
}
|
308 |
+
break;
|
309 |
+
case 'customers':
|
310 |
+
switch ( $passed_view ) {
|
311 |
+
case 'list-table':
|
312 |
+
if ( ( 'download' == $typenow || 'download' === $post_type ) && $pagenow == 'edit.php' && 'edd-customers' === $page && false === $view ) {
|
313 |
+
$found = true;
|
314 |
+
}
|
315 |
+
break;
|
316 |
+
case 'overview':
|
317 |
+
if ( ( 'download' == $typenow || 'download' === $post_type ) && $pagenow == 'edit.php' && 'edd-customers' === $page && 'overview' === $view ) {
|
318 |
+
$found = true;
|
319 |
+
}
|
320 |
+
break;
|
321 |
+
case 'notes':
|
322 |
+
if ( ( 'download' == $typenow || 'download' === $post_type ) && $pagenow == 'edit.php' && 'edd-customers' === $page && 'notes' === $view ) {
|
323 |
+
$found = true;
|
324 |
+
}
|
325 |
+
break;
|
326 |
+
default:
|
327 |
+
if ( ( 'download' == $typenow || 'download' === $post_type ) && $pagenow == 'edit.php' && 'edd-customers' === $page ) {
|
328 |
+
$found = true;
|
329 |
+
}
|
330 |
+
break;
|
331 |
+
}
|
332 |
+
break;
|
333 |
+
case 'reports':
|
334 |
+
if ( ( 'download' == $typenow || 'download' === $post_type ) && $pagenow == 'edit.php' && 'edd-reports' === $page ) {
|
335 |
+
$found = true;
|
336 |
+
}
|
337 |
+
break;
|
338 |
+
default:
|
339 |
+
global $edd_discounts_page, $edd_payments_page, $edd_settings_page, $edd_reports_page, $edd_system_info_page, $edd_add_ons_page, $edd_settings_export, $edd_upgrades_screen, $edd_customers_page, $edd_reports_page;
|
340 |
+
$admin_pages = apply_filters( 'edd_admin_pages', array( $edd_discounts_page, $edd_payments_page, $edd_settings_page, $edd_reports_page, $edd_system_info_page, $edd_add_ons_page, $edd_settings_export, $edd_customers_page, $edd_reports_page ) );
|
341 |
+
if ( 'download' == $typenow || 'index.php' == $pagenow || 'post-new.php' == $pagenow || 'post.php' == $pagenow ) {
|
342 |
+
$found = true;
|
343 |
+
if( 'edd-upgrades' === $page ) {
|
344 |
+
$found = false;
|
345 |
+
}
|
346 |
+
} elseif ( in_array( $pagenow, $admin_pages ) ) {
|
347 |
+
$found = true;
|
348 |
+
}
|
349 |
+
break;
|
350 |
}
|
351 |
|
352 |
+
return (bool) apply_filters( 'edd_is_admin_page', $found, $page, $view, $passed_page, $passed_view );
|
353 |
}
|
includes/admin/class-api-keys-table.php
CHANGED
@@ -72,10 +72,55 @@ class EDD_API_Keys_Table extends WP_List_Table {
|
|
72 |
return $item[ $column_name ];
|
73 |
}
|
74 |
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
75 |
/**
|
76 |
* Renders the column for the user field
|
77 |
*
|
78 |
-
* @access public
|
79 |
* @since 2.0
|
80 |
* @return void
|
81 |
*/
|
@@ -118,8 +163,8 @@ class EDD_API_Keys_Table extends WP_List_Table {
|
|
118 |
$columns = array(
|
119 |
'user' => __( 'Username', 'edd' ),
|
120 |
'key' => __( 'Public Key', 'edd' ),
|
121 |
-
'
|
122 |
-
'
|
123 |
);
|
124 |
|
125 |
return $columns;
|
@@ -170,10 +215,10 @@ class EDD_API_Keys_Table extends WP_List_Table {
|
|
170 |
* @return void
|
171 |
*/
|
172 |
public function query() {
|
173 |
-
$users = get_users( array(
|
174 |
-
'
|
175 |
-
'number'
|
176 |
-
'offset'
|
177 |
) );
|
178 |
$keys = array();
|
179 |
|
@@ -182,9 +227,9 @@ class EDD_API_Keys_Table extends WP_List_Table {
|
|
182 |
$keys[$user->ID]['email'] = $user->user_email;
|
183 |
$keys[$user->ID]['user'] = '<a href="' . add_query_arg( 'user_id', $user->ID, 'user-edit.php' ) . '"><strong>' . $user->user_login . '</strong></a>';
|
184 |
|
185 |
-
$keys[$user->ID]['key'] =
|
186 |
-
$keys[$user->ID]['secret'] =
|
187 |
-
$keys[$user->ID]['token'] =
|
188 |
}
|
189 |
|
190 |
return $keys;
|
@@ -203,7 +248,7 @@ class EDD_API_Keys_Table extends WP_List_Table {
|
|
203 |
global $wpdb;
|
204 |
|
205 |
if( ! get_transient( 'edd_total_api_keys' ) ) {
|
206 |
-
$total_items = $wpdb->get_var( "SELECT count(user_id) FROM $wpdb->usermeta WHERE
|
207 |
|
208 |
set_transient( 'edd_total_api_keys', $total_items, 60 * 60 );
|
209 |
}
|
@@ -224,7 +269,7 @@ class EDD_API_Keys_Table extends WP_List_Table {
|
|
224 |
$hidden = array(); // No hidden columns
|
225 |
$sortable = array(); // Not sortable... for now
|
226 |
|
227 |
-
$this->_column_headers = array( $columns, $hidden, $sortable );
|
228 |
|
229 |
$data = $this->query();
|
230 |
|
@@ -239,4 +284,4 @@ class EDD_API_Keys_Table extends WP_List_Table {
|
|
239 |
)
|
240 |
);
|
241 |
}
|
242 |
-
}
|
72 |
return $item[ $column_name ];
|
73 |
}
|
74 |
|
75 |
+
/**
|
76 |
+
* Displays the public key rows
|
77 |
+
*
|
78 |
+
* @access public
|
79 |
+
* @since 2.4
|
80 |
+
*
|
81 |
+
* @param array $item Contains all the data of the keys
|
82 |
+
* @param string $column_name The name of the column
|
83 |
+
*
|
84 |
+
* @return string Column Name
|
85 |
+
*/
|
86 |
+
public function column_key( $item ) {
|
87 |
+
return '<input readonly="readonly" type="text" class="large-text" value="' . esc_attr( $item[ 'key' ] ) . '"/>';
|
88 |
+
}
|
89 |
+
|
90 |
+
/**
|
91 |
+
* Displays the token rows
|
92 |
+
*
|
93 |
+
* @access public
|
94 |
+
* @since 2.4
|
95 |
+
*
|
96 |
+
* @param array $item Contains all the data of the keys
|
97 |
+
* @param string $column_name The name of the column
|
98 |
+
*
|
99 |
+
* @return string Column Name
|
100 |
+
*/
|
101 |
+
public function column_token( $item ) {
|
102 |
+
return '<input readonly="readonly" type="text" class="large-text" value="' . esc_attr( $item[ 'token' ] ) . '"/>';
|
103 |
+
}
|
104 |
+
|
105 |
+
/**
|
106 |
+
* Displays the secret key rows
|
107 |
+
*
|
108 |
+
* @access public
|
109 |
+
* @since 2.4
|
110 |
+
*
|
111 |
+
* @param array $item Contains all the data of the keys
|
112 |
+
* @param string $column_name The name of the column
|
113 |
+
*
|
114 |
+
* @return string Column Name
|
115 |
+
*/
|
116 |
+
public function column_secret( $item ) {
|
117 |
+
return '<input readonly="readonly" type="text" class="large-text" value="' . esc_attr( $item[ 'secret' ] ) . '"/>';
|
118 |
+
}
|
119 |
+
|
120 |
/**
|
121 |
* Renders the column for the user field
|
122 |
*
|
123 |
+
* @access public
|
124 |
* @since 2.0
|
125 |
* @return void
|
126 |
*/
|
163 |
$columns = array(
|
164 |
'user' => __( 'Username', 'edd' ),
|
165 |
'key' => __( 'Public Key', 'edd' ),
|
166 |
+
'token' => __( 'Token', 'edd' ),
|
167 |
+
'secret' => __( 'Secret Key', 'edd' )
|
168 |
);
|
169 |
|
170 |
return $columns;
|
215 |
* @return void
|
216 |
*/
|
217 |
public function query() {
|
218 |
+
$users = get_users( array(
|
219 |
+
'meta_value' => 'edd_user_secret_key',
|
220 |
+
'number' => $this->per_page,
|
221 |
+
'offset' => $this->per_page * ( $this->get_paged() - 1 )
|
222 |
) );
|
223 |
$keys = array();
|
224 |
|
227 |
$keys[$user->ID]['email'] = $user->user_email;
|
228 |
$keys[$user->ID]['user'] = '<a href="' . add_query_arg( 'user_id', $user->ID, 'user-edit.php' ) . '"><strong>' . $user->user_login . '</strong></a>';
|
229 |
|
230 |
+
$keys[$user->ID]['key'] = EDD()->api->get_user_public_key( $user->ID );
|
231 |
+
$keys[$user->ID]['secret'] = EDD()->api->get_user_secret_key( $user->ID );
|
232 |
+
$keys[$user->ID]['token'] = EDD()->api->get_token( $user->ID );
|
233 |
}
|
234 |
|
235 |
return $keys;
|
248 |
global $wpdb;
|
249 |
|
250 |
if( ! get_transient( 'edd_total_api_keys' ) ) {
|
251 |
+
$total_items = $wpdb->get_var( "SELECT count(user_id) FROM $wpdb->usermeta WHERE meta_value='edd_user_secret_key'" );
|
252 |
|
253 |
set_transient( 'edd_total_api_keys', $total_items, 60 * 60 );
|
254 |
}
|
269 |
$hidden = array(); // No hidden columns
|
270 |
$sortable = array(); // Not sortable... for now
|
271 |
|
272 |
+
$this->_column_headers = array( $columns, $hidden, $sortable, 'id' );
|
273 |
|
274 |
$data = $this->query();
|
275 |
|
284 |
)
|
285 |
);
|
286 |
}
|
287 |
+
}
|
includes/admin/class-edd-notices.php
CHANGED
@@ -75,6 +75,7 @@ class EDD_Notices {
|
|
75 |
echo '</div>';
|
76 |
}
|
77 |
|
|
|
78 |
if( ! edd_test_ajax_works() && ! get_user_meta( get_current_user_id(), '_edd_admin_ajax_inaccessible_dismissed', true ) && current_user_can( 'manage_shop_settings' ) ) {
|
79 |
echo '<div class="error">';
|
80 |
echo '<p>' . __( 'Your site appears to be blocking the WordPress ajax interface. This may causes issues with your store.', 'edd' ) . '</p>';
|
@@ -82,6 +83,7 @@ class EDD_Notices {
|
|
82 |
echo '<p><a href="' . add_query_arg( array( 'edd_action' => 'dismiss_notices', 'edd_notice' => 'admin_ajax_inaccessible' ) ) . '">' . __( 'Dismiss Notice', 'edd' ) . '</a></p>';
|
83 |
echo '</div>';
|
84 |
}
|
|
|
85 |
|
86 |
if ( isset( $_GET['edd-message'] ) ) {
|
87 |
// Shop discounts errors
|
75 |
echo '</div>';
|
76 |
}
|
77 |
|
78 |
+
/* Commented out per https://github.com/easydigitaldownloads/Easy-Digital-Downloads/issues/3475
|
79 |
if( ! edd_test_ajax_works() && ! get_user_meta( get_current_user_id(), '_edd_admin_ajax_inaccessible_dismissed', true ) && current_user_can( 'manage_shop_settings' ) ) {
|
80 |
echo '<div class="error">';
|
81 |
echo '<p>' . __( 'Your site appears to be blocking the WordPress ajax interface. This may causes issues with your store.', 'edd' ) . '</p>';
|
83 |
echo '<p><a href="' . add_query_arg( array( 'edd_action' => 'dismiss_notices', 'edd_notice' => 'admin_ajax_inaccessible' ) ) . '">' . __( 'Dismiss Notice', 'edd' ) . '</a></p>';
|
84 |
echo '</div>';
|
85 |
}
|
86 |
+
*/
|
87 |
|
88 |
if ( isset( $_GET['edd-message'] ) ) {
|
89 |
// Shop discounts errors
|
includes/admin/downloads/dashboard-columns.php
CHANGED
@@ -23,15 +23,17 @@ if ( ! defined( 'ABSPATH' ) ) exit;
|
|
23 |
* Post Type List Table
|
24 |
*/
|
25 |
function edd_download_columns( $download_columns ) {
|
|
|
|
|
|
|
26 |
$download_columns = array(
|
27 |
'cb' => '<input type="checkbox"/>',
|
28 |
'title' => __( 'Name', 'edd' ),
|
29 |
-
'download_category' =>
|
30 |
-
'download_tag' =>
|
31 |
'price' => __( 'Price', 'edd' ),
|
32 |
'sales' => __( 'Sales', 'edd' ),
|
33 |
'earnings' => __( 'Earnings', 'edd' ),
|
34 |
-
'shortcode' => __( 'Purchase Short Code', 'edd' ),
|
35 |
'date' => __( 'Date', 'edd' )
|
36 |
);
|
37 |
|
@@ -49,11 +51,6 @@ add_filter( 'manage_edit-download_columns', 'edd_download_columns' );
|
|
49 |
*/
|
50 |
function edd_render_download_columns( $column_name, $post_id ) {
|
51 |
if ( get_post_type( $post_id ) == 'download' ) {
|
52 |
-
$style = edd_get_option( 'button_style', 'button' );
|
53 |
-
$color = edd_get_option( 'checkout_color', 'blue' );
|
54 |
-
$color = ( $color == 'inherit' ) ? '' : $color;
|
55 |
-
$purchase_text = edd_get_option( 'add_to_cart_text', __( 'Purchase', 'edd' ) );
|
56 |
-
|
57 |
switch ( $column_name ) {
|
58 |
case 'download_category':
|
59 |
echo get_the_term_list( $post_id, 'download_category', '', ', ', '');
|
@@ -87,9 +84,6 @@ function edd_render_download_columns( $column_name, $post_id ) {
|
|
87 |
echo '-';
|
88 |
}
|
89 |
break;
|
90 |
-
case 'shortcode':
|
91 |
-
echo '[purchase_link id="' . absint( $post_id ) . '" text="' . esc_html( $purchase_text ) . '" style="' . $style . '" color="' . esc_attr( $color ) . '"]';
|
92 |
-
break;
|
93 |
}
|
94 |
}
|
95 |
}
|
@@ -220,7 +214,8 @@ function edd_add_download_filters() {
|
|
220 |
$terms = get_terms( 'download_category' );
|
221 |
if ( count( $terms ) > 0 ) {
|
222 |
echo "<select name='download_category' id='download_category' class='postform'>";
|
223 |
-
|
|
|
224 |
foreach ( $terms as $term ) {
|
225 |
$selected = isset( $_GET['download_category'] ) && $_GET['download_category'] == $term->slug ? ' selected="selected"' : '';
|
226 |
echo '<option value="' . esc_attr( $term->slug ) . '"' . $selected . '>' . esc_html( $term->name ) .' (' . $term->count .')</option>';
|
@@ -231,7 +226,8 @@ function edd_add_download_filters() {
|
|
231 |
$terms = get_terms( 'download_tag' );
|
232 |
if ( count( $terms ) > 0) {
|
233 |
echo "<select name='download_tag' id='download_tag' class='postform'>";
|
234 |
-
|
|
|
235 |
foreach ( $terms as $term ) {
|
236 |
$selected = isset( $_GET['download_tag']) && $_GET['download_tag'] == $term->slug ? ' selected="selected"' : '';
|
237 |
echo '<option value="' . esc_attr( $term->slug ) . '"' . $selected . '>' . esc_html( $term->name ) .' (' . $term->count .')</option>';
|
23 |
* Post Type List Table
|
24 |
*/
|
25 |
function edd_download_columns( $download_columns ) {
|
26 |
+
$category_labels = edd_get_taxonomy_labels( 'download_category' );
|
27 |
+
$tag_labels = edd_get_taxonomy_labels( 'download_tag' );
|
28 |
+
|
29 |
$download_columns = array(
|
30 |
'cb' => '<input type="checkbox"/>',
|
31 |
'title' => __( 'Name', 'edd' ),
|
32 |
+
'download_category' => $category_labels['name'],
|
33 |
+
'download_tag' => $tag_labels['name'],
|
34 |
'price' => __( 'Price', 'edd' ),
|
35 |
'sales' => __( 'Sales', 'edd' ),
|
36 |
'earnings' => __( 'Earnings', 'edd' ),
|
|
|
37 |
'date' => __( 'Date', 'edd' )
|
38 |
);
|
39 |
|
51 |
*/
|
52 |
function edd_render_download_columns( $column_name, $post_id ) {
|
53 |
if ( get_post_type( $post_id ) == 'download' ) {
|
|
|
|
|
|
|
|
|
|
|
54 |
switch ( $column_name ) {
|
55 |
case 'download_category':
|
56 |
echo get_the_term_list( $post_id, 'download_category', '', ', ', '');
|
84 |
echo '-';
|
85 |
}
|
86 |
break;
|
|
|
|
|
|
|
87 |
}
|
88 |
}
|
89 |
}
|
214 |
$terms = get_terms( 'download_category' );
|
215 |
if ( count( $terms ) > 0 ) {
|
216 |
echo "<select name='download_category' id='download_category' class='postform'>";
|
217 |
+
$category_labels = edd_get_taxonomy_labels( 'download_category' );
|
218 |
+
echo "<option value=''>" . sprintf( __( 'Show all %s', 'edd' ), strtolower( $category_labels['name'] ) ) . "</option>";
|
219 |
foreach ( $terms as $term ) {
|
220 |
$selected = isset( $_GET['download_category'] ) && $_GET['download_category'] == $term->slug ? ' selected="selected"' : '';
|
221 |
echo '<option value="' . esc_attr( $term->slug ) . '"' . $selected . '>' . esc_html( $term->name ) .' (' . $term->count .')</option>';
|
226 |
$terms = get_terms( 'download_tag' );
|
227 |
if ( count( $terms ) > 0) {
|
228 |
echo "<select name='download_tag' id='download_tag' class='postform'>";
|
229 |
+
$tag_labels = edd_get_taxonomy_labels( 'download_tag' );
|
230 |
+
echo "<option value=''>" . sprintf( __( 'Show all %s', 'edd' ), strtolower( $tag_labels['name'] ) ) . "</option>";
|
231 |
foreach ( $terms as $term ) {
|
232 |
$selected = isset( $_GET['download_tag']) && $_GET['download_tag'] == $term->slug ? ' selected="selected"' : '';
|
233 |
echo '<option value="' . esc_attr( $term->slug ) . '"' . $selected . '>' . esc_html( $term->name ) .' (' . $term->count .')</option>';
|
includes/admin/downloads/metabox.php
CHANGED
@@ -848,6 +848,32 @@ function edd_render_dowwn_tax_options( $post_id = 0 ) {
|
|
848 |
}
|
849 |
add_action( 'edd_meta_box_settings_fields', 'edd_render_dowwn_tax_options', 30 );
|
850 |
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
851 |
/**
|
852 |
* Render Accounting Options
|
853 |
*
|
848 |
}
|
849 |
add_action( 'edd_meta_box_settings_fields', 'edd_render_dowwn_tax_options', 30 );
|
850 |
|
851 |
+
/**
|
852 |
+
* Add shortcode to settings meta box
|
853 |
+
*
|
854 |
+
* @since 2.5
|
855 |
+
* @global array $post Contains all the download data
|
856 |
+
* @return void
|
857 |
+
*/
|
858 |
+
function edd_render_meta_box_shortcode() {
|
859 |
+
global $post;
|
860 |
+
|
861 |
+
if( $post->post_type != 'download' ) {
|
862 |
+
return;
|
863 |
+
}
|
864 |
+
|
865 |
+
$purchase_text = edd_get_option( 'add_to_cart_text', __( 'Purchase', 'edd' ) );
|
866 |
+
$style = edd_get_option( 'button_style', 'button' );
|
867 |
+
$color = edd_get_option( 'checkout_color', 'blue' );
|
868 |
+
$color = ( $color == 'inherit' ) ? '' : $color;
|
869 |
+
$shortcode = '[purchase_link id="' . absint( $post->ID ) . '" text="' . esc_html( $purchase_text ) . '" style="' . $style . '" color="' . esc_attr( $color ) . '"]';
|
870 |
+
?>
|
871 |
+
<p><strong><?php _e( 'Purchase Shortcode:', 'edd' ); ?></strong></p>
|
872 |
+
<input type="text" id="edd-purchase-shortcode" class="widefat" readonly="readonly" value="<?php echo htmlentities( $shortcode ); ?>">
|
873 |
+
<?php
|
874 |
+
}
|
875 |
+
add_action( 'edd_meta_box_settings_fields', 'edd_render_meta_box_shortcode', 35 );
|
876 |
+
|
877 |
/**
|
878 |
* Render Accounting Options
|
879 |
*
|
includes/admin/reporting/class-api-requests-logs-list-table.php
CHANGED
@@ -88,7 +88,9 @@ class EDD_API_Request_Log_Table extends WP_List_Table {
|
|
88 |
$columns = array(
|
89 |
'ID' => __( 'Log ID', 'edd' ),
|
90 |
'details' => __( 'Request Details', 'edd' ),
|
|
|
91 |
'ip' => __( 'Request IP', 'edd' ),
|
|
|
92 |
'date' => __( 'Date', 'edd' )
|
93 |
);
|
94 |
|
@@ -175,8 +177,8 @@ class EDD_API_Request_Log_Table extends WP_List_Table {
|
|
175 |
} else if ( is_email( $search ) ) {
|
176 |
// This is an email search
|
177 |
$userdata = get_user_by( 'email', $search );
|
178 |
-
|
179 |
-
if( $userdata ) {
|
180 |
$search = $userdata->ID;
|
181 |
}
|
182 |
|
@@ -258,9 +260,11 @@ class EDD_API_Request_Log_Table extends WP_List_Table {
|
|
258 |
foreach ( $logs as $log ) {
|
259 |
|
260 |
$logs_data[] = array(
|
261 |
-
'ID'
|
262 |
-
'
|
263 |
-
'
|
|
|
|
|
264 |
);
|
265 |
}
|
266 |
}
|
@@ -287,7 +291,7 @@ class EDD_API_Request_Log_Table extends WP_List_Table {
|
|
287 |
$columns = $this->get_columns();
|
288 |
$hidden = array(); // No hidden columns
|
289 |
$sortable = $this->get_sortable_columns();
|
290 |
-
$this->_column_headers = array( $columns, $hidden, $sortable );
|
291 |
$this->items = $this->get_logs();
|
292 |
$total_items = $edd_logs->get_log_count( 0, 'api_requests' );
|
293 |
|
88 |
$columns = array(
|
89 |
'ID' => __( 'Log ID', 'edd' ),
|
90 |
'details' => __( 'Request Details', 'edd' ),
|
91 |
+
'version' => __( 'API Version', 'edd' ),
|
92 |
'ip' => __( 'Request IP', 'edd' ),
|
93 |
+
'speed' => __( 'Request Speed', 'edd' ),
|
94 |
'date' => __( 'Date', 'edd' )
|
95 |
);
|
96 |
|
177 |
} else if ( is_email( $search ) ) {
|
178 |
// This is an email search
|
179 |
$userdata = get_user_by( 'email', $search );
|
180 |
+
|
181 |
+
if( $userdata ) {
|
182 |
$search = $userdata->ID;
|
183 |
}
|
184 |
|
260 |
foreach ( $logs as $log ) {
|
261 |
|
262 |
$logs_data[] = array(
|
263 |
+
'ID' => $log->ID,
|
264 |
+
'version' => get_post_meta( $log->ID, '_edd_log_version', true ),
|
265 |
+
'speed' => get_post_meta( $log->ID, '_edd_log_time', true ),
|
266 |
+
'ip' => get_post_meta( $log->ID, '_edd_log_request_ip', true ),
|
267 |
+
'date' => $log->post_date
|
268 |
);
|
269 |
}
|
270 |
}
|
291 |
$columns = $this->get_columns();
|
292 |
$hidden = array(); // No hidden columns
|
293 |
$sortable = $this->get_sortable_columns();
|
294 |
+
$this->_column_headers = array( $columns, $hidden, $sortable, 'ID' );
|
295 |
$this->items = $this->get_logs();
|
296 |
$total_items = $edd_logs->get_log_count( 0, 'api_requests' );
|
297 |
|
includes/admin/reporting/class-categories-reports-table.php
ADDED
@@ -0,0 +1,317 @@
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
1 |
+
<?php
|
2 |
+
/**
|
3 |
+
* Gateways Reports Table Class
|
4 |
+
*
|
5 |
+
* @package EDD
|
6 |
+
* @subpackage Admin/Reports
|
7 |
+
* @copyright Copyright (c) 2015, Pippin Williamson
|
8 |
+
* @license http://opensource.org/licenses/gpl-2.0.php GNU Public License
|
9 |
+
* @since 2.4
|
10 |
+
*/
|
11 |
+
|
12 |
+
// Exit if accessed directly
|
13 |
+
if ( ! defined( 'ABSPATH' ) ) exit;
|
14 |
+
|
15 |
+
// Load WP_List_Table if not loaded
|
16 |
+
if ( ! class_exists( 'WP_List_Table' ) ) {
|
17 |
+
require_once ABSPATH . 'wp-admin/includes/class-wp-list-table.php';
|
18 |
+
}
|
19 |
+
|
20 |
+
/**
|
21 |
+
* EDD_Categories_Reports_Table Class
|
22 |
+
*
|
23 |
+
* Renders the Download Reports table
|
24 |
+
*
|
25 |
+
* @since 2.4
|
26 |
+
*/
|
27 |
+
class EDD_Categories_Reports_Table extends WP_List_Table {
|
28 |
+
|
29 |
+
/**
|
30 |
+
* Get things started
|
31 |
+
*
|
32 |
+
* @since 2.4
|
33 |
+
* @see WP_List_Table::__construct()
|
34 |
+
*/
|
35 |
+
public function __construct() {
|
36 |
+
global $status, $page;
|
37 |
+
}
|
38 |
+
|
39 |
+
/**
|
40 |
+
* This function renders most of the columns in the list table.
|
41 |
+
*
|
42 |
+
* @access public
|
43 |
+
* @since 2.4
|
44 |
+
*
|
45 |
+
* @param array $item Contains all the data of the downloads
|
46 |
+
* @param string $column_name The name of the column
|
47 |
+
*
|
48 |
+
* @return string Column Name
|
49 |
+
*/
|
50 |
+
public function column_default( $item, $column_name ) {
|
51 |
+
return $item[ $column_name ];
|
52 |
+
}
|
53 |
+
|
54 |
+
/**
|
55 |
+
* Retrieve the table columns
|
56 |
+
*
|
57 |
+
* @access public
|
58 |
+
* @since 2.4
|
59 |
+
* @return array $columns Array of all the list table columns
|
60 |
+
*/
|
61 |
+
public function get_columns() {
|
62 |
+
$columns = array(
|
63 |
+
'label' => __( 'Category', 'edd' ),
|
64 |
+
'total_sales' => __( 'Total Sales', 'edd' ),
|
65 |
+
'total_earnings' => __( 'Total Earnings', 'edd' ),
|
66 |
+
'avg_sales' => __( 'Monthly Sales Avg', 'edd' ),
|
67 |
+
'avg_earnings' => __( 'Monthly Earnings Avg', 'edd' ),
|
68 |
+
);
|
69 |
+
|
70 |
+
return $columns;
|
71 |
+
}
|
72 |
+
|
73 |
+
/**
|
74 |
+
* Retrieve the current page number
|
75 |
+
*
|
76 |
+
* @access public
|
77 |
+
* @since 2.4
|
78 |
+
* @return int Current page number
|
79 |
+
*/
|
80 |
+
public function get_paged() {
|
81 |
+
return isset( $_GET['paged'] ) ? absint( $_GET['paged'] ) : 1;
|
82 |
+
}
|
83 |
+
|
84 |
+
|
85 |
+
/**
|
86 |
+
* Outputs the reporting views
|
87 |
+
*
|
88 |
+
* @access public
|
89 |
+
* @since 2.4
|
90 |
+
* @return void
|
91 |
+
*/
|
92 |
+
public function bulk_actions( $which = '' ) {
|
93 |
+
// These aren't really bulk actions but this outputs the markup in the right place
|
94 |
+
edd_report_views();
|
95 |
+
}
|
96 |
+
|
97 |
+
|
98 |
+
/**
|
99 |
+
* Build all the reports data
|
100 |
+
*
|
101 |
+
* @access public
|
102 |
+
* @since 2.4
|
103 |
+
* @return array $reports_data All the data for customer reports
|
104 |
+
*/
|
105 |
+
public function reports_data() {
|
106 |
+
|
107 |
+
$cached_reports = get_transient( 'edd_earnings_by_category_data' );
|
108 |
+
if ( false !== $cached_reports ) {
|
109 |
+
$reports_data = $cached_reports;
|
110 |
+
} else {
|
111 |
+
$reports_data = array();
|
112 |
+
$term_args = array(
|
113 |
+
'parent' => 0,
|
114 |
+
'hierarchical' => 0,
|
115 |
+
);
|
116 |
+
|
117 |
+
$categories = get_terms( 'download_category', $term_args );
|
118 |
+
|
119 |
+
foreach ( $categories as $category_id => $category ) {
|
120 |
+
|
121 |
+
$category_slugs = array( $category->slug );
|
122 |
+
|
123 |
+
$child_args = array(
|
124 |
+
'parent' => $category->term_id,
|
125 |
+
'hierarchical' => 0,
|
126 |
+
);
|
127 |
+
|
128 |
+
$child_terms = get_terms( 'download_category', $child_args );
|
129 |
+
if ( ! empty( $child_terms ) ) {
|
130 |
+
|
131 |
+
foreach ( $child_terms as $child_term ) {
|
132 |
+
$category_slugs[] = $child_term->slug;
|
133 |
+
}
|
134 |
+
|
135 |
+
}
|
136 |
+
|
137 |
+
$download_args = array(
|
138 |
+
'post_type' => 'download',
|
139 |
+
'posts_per_page' => -1,
|
140 |
+
'fields' => 'ids',
|
141 |
+
'tax_query' => array(
|
142 |
+
array(
|
143 |
+
'taxonomy' => 'download_category',
|
144 |
+
'field' => 'slug',
|
145 |
+
'terms' => $category_slugs,
|
146 |
+
),
|
147 |
+
),
|
148 |
+
);
|
149 |
+
|
150 |
+
$downloads = get_posts( $download_args );
|
151 |
+
|
152 |
+
$sales = 0;
|
153 |
+
$earnings = 0.00;
|
154 |
+
$avg_sales = 0;
|
155 |
+
$avg_earnings = 0.00;
|
156 |
+
|
157 |
+
foreach ( $downloads as $download ) {
|
158 |
+
$sales += edd_get_download_sales_stats( $download );
|
159 |
+
$earnings += edd_get_download_earnings_stats( $download );
|
160 |
+
$avg_sales += edd_get_average_monthly_download_sales( $download );
|
161 |
+
$avg_earnings += edd_get_average_monthly_download_earnings( $download );
|
162 |
+
}
|
163 |
+
|
164 |
+
$avg_sales = round( $avg_sales / count( $downloads ) );
|
165 |
+
$avg_earnings = round( $avg_earnings / count( $downloads ), edd_currency_decimal_filter() );
|
166 |
+
|
167 |
+
$reports_data[] = array(
|
168 |
+
'ID' => $category->term_id,
|
169 |
+
'label' => $category->name,
|
170 |
+
'total_sales' => edd_format_amount( $sales, false ),
|
171 |
+
'total_sales_raw' => $sales,
|
172 |
+
'total_earnings' => edd_currency_filter( edd_format_amount( $earnings ) ),
|
173 |
+
'total_earnings_raw' => $earnings,
|
174 |
+
'avg_sales' => edd_format_amount( $avg_sales, false ),
|
175 |
+
'avg_earnings' => edd_currency_filter( edd_format_amount( $avg_earnings ) ),
|
176 |
+
'is_child' => false,
|
177 |
+
);
|
178 |
+
|
179 |
+
if ( ! empty( $child_terms ) ) {
|
180 |
+
|
181 |
+
foreach ( $child_terms as $child_term ) {
|
182 |
+
$child_args = array(
|
183 |
+
'post_type' => 'download',
|
184 |
+
'posts_per_page' => -1,
|
185 |
+
'fields' => 'ids',
|
186 |
+
'tax_query' => array(
|
187 |
+
array(
|
188 |
+
'taxonomy' => 'download_category',
|
189 |
+
'field' => 'slug',
|
190 |
+
'terms' => $child_term->slug,
|
191 |
+
),
|
192 |
+
),
|
193 |
+
);
|
194 |
+
|
195 |
+
$child_downloads = get_posts( $child_args );
|
196 |
+
|
197 |
+
$child_sales = 0;
|
198 |
+
$child_earnings = 0.00;
|
199 |
+
$child_avg_sales = 0;
|
200 |
+
$child_avg_earnings = 0.00;
|
201 |
+
|
202 |
+
foreach ( $child_downloads as $child_download ) {
|
203 |
+
$child_sales += edd_get_download_sales_stats( $child_download );
|
204 |
+
$child_earnings += edd_get_download_earnings_stats( $child_download );
|
205 |
+
$child_avg_sales += edd_get_average_monthly_download_sales( $child_download );
|
206 |
+
$child_avg_earnings += edd_get_average_monthly_download_earnings( $child_download );
|
207 |
+
}
|
208 |
+
|
209 |
+
$child_avg_sales = round( $child_avg_sales / count( $child_downloads ) );
|
210 |
+
$child_avg_earnings = round( $child_avg_earnings / count( $child_downloads ), edd_currency_decimal_filter() );
|
211 |
+
|
212 |
+
$reports_data[] = array(
|
213 |
+
'ID' => $child_term->term_id,
|
214 |
+
'label' => '— ' . $child_term->name,
|
215 |
+
'total_sales' => edd_format_amount( $child_sales, false ),
|
216 |
+
'total_sales_raw' => $child_sales,
|
217 |
+
'total_earnings' => edd_currency_filter( edd_format_amount( $child_earnings ) ),
|
218 |
+
'total_earnings_raw' => $child_earnings,
|
219 |
+
'avg_sales' => edd_format_amount( $child_avg_sales, false ),
|
220 |
+
'avg_earnings' => edd_currency_filter( edd_format_amount( $child_avg_earnings ) ),
|
221 |
+
'is_child' => true,
|
222 |
+
);
|
223 |
+
|
224 |
+
}
|
225 |
+
}
|
226 |
+
|
227 |
+
}
|
228 |
+
|
229 |
+
set_transient( 'edd_earnings_by_category_data', $reports_data, ( HOUR_IN_SECONDS / 4 ) );
|
230 |
+
}
|
231 |
+
|
232 |
+
return $reports_data;
|
233 |
+
}
|
234 |
+
|
235 |
+
/**
|
236 |
+
* Output the Category Sales Mix Pie Chart
|
237 |
+
*
|
238 |
+
* @since 2.4
|
239 |
+
* @return string The HTML for the outputted graph
|
240 |
+
*/
|
241 |
+
public function output_sales_graph() {
|
242 |
+
if ( empty( $this->items ) ) {
|
243 |
+
return;
|
244 |
+
}
|
245 |
+
|
246 |
+
$data = array();
|
247 |
+
foreach ( $this->items as $item ) {
|
248 |
+
if ( ! empty( $item['is_child'] ) || empty( $item['total_sales_raw'] ) ) {
|
249 |
+
continue;
|
250 |
+
}
|
251 |
+
|
252 |
+
$data[ $item['label'] ] = $item['total_sales_raw'];
|
253 |
+
}
|
254 |
+
|
255 |
+
// Sort High to Low, prior to filter so people can reorder if they please
|
256 |
+
arsort( $data );
|
257 |
+
$data = apply_filters( 'edd_category_sales_graph_data', $data );
|
258 |
+
|
259 |
+
$options = apply_filters( 'edd_category_sales_graph_options', array(
|
260 |
+
'legend_formatter' => 'eddLegendFormatterSales',
|
261 |
+
), $data );
|
262 |
+
|
263 |
+
$pie_graph = new EDD_Pie_Graph( $data, $options );
|
264 |
+
$pie_graph->display();
|
265 |
+
}
|
266 |
+
|
267 |
+
/**
|
268 |
+
* Output the Category Earnings Mix Pie Chart
|
269 |
+
*
|
270 |
+
* @since 2.4
|
271 |
+
* @return string The HTML for the outputted graph
|
272 |
+
*/
|
273 |
+
public function output_earnings_graph() {
|
274 |
+
if ( empty( $this->items ) ) {
|
275 |
+
return;
|
276 |
+
}
|
277 |
+
|
278 |
+
$data = array();
|
279 |
+
foreach ( $this->items as $item ) {
|
280 |
+
if ( ! empty( $item['is_child'] ) || empty( $item['total_earnings_raw'] ) ) {
|
281 |
+
continue;
|
282 |
+
}
|
283 |
+
|
284 |
+
$data[ $item['label'] ] = $item['total_earnings_raw'];
|
285 |
+
}
|
286 |
+
|
287 |
+
// Sort High to Low, prior to filter so people can reorder if they please
|
288 |
+
arsort( $data );
|
289 |
+
$data = apply_filters( 'edd_category_earnings_graph_data', $data );
|
290 |
+
|
291 |
+
$options = apply_filters( 'edd_category_earnings_graph_options', array(
|
292 |
+
'legend_formatter' => 'eddLegendFormatterEarnings',
|
293 |
+
), $data );
|
294 |
+
|
295 |
+
$pie_graph = new EDD_Pie_Graph( $data, $options );
|
296 |
+
$pie_graph->display();
|
297 |
+
}
|
298 |
+
|
299 |
+
/**
|
300 |
+
* Setup the final data for the table
|
301 |
+
*
|
302 |
+
* @access public
|
303 |
+
* @since 2.4
|
304 |
+
* @uses EDD_Gateawy_Reports_Table::get_columns()
|
305 |
+
* @uses EDD_Gateawy_Reports_Table::get_sortable_columns()
|
306 |
+
* @uses EDD_Gateawy_Reports_Table::reports_data()
|
307 |
+
* @return void
|
308 |
+
*/
|
309 |
+
public function prepare_items() {
|
310 |
+
$columns = $this->get_columns();
|
311 |
+
$hidden = array(); // No hidden columns
|
312 |
+
$sortable = $this->get_sortable_columns();
|
313 |
+
$this->_column_headers = array( $columns, $hidden, $sortable );
|
314 |
+
$this->items = $this->reports_data();
|
315 |
+
|
316 |
+
}
|
317 |
+
}
|
includes/admin/reporting/class-edd-graph.php
CHANGED
@@ -81,7 +81,7 @@ class EDD_Graph {
|
|
81 |
$this->data = $_data;
|
82 |
|
83 |
// Generate unique ID
|
84 |
-
$this->id = md5( rand() );
|
85 |
|
86 |
// Setup default options;
|
87 |
$this->options = array(
|
@@ -144,6 +144,8 @@ class EDD_Graph {
|
|
144 |
// Use minified libraries if SCRIPT_DEBUG is turned off
|
145 |
$suffix = ( defined( 'SCRIPT_DEBUG' ) && SCRIPT_DEBUG ) ? '' : '.min';
|
146 |
wp_enqueue_script( 'jquery-flot', EDD_PLUGIN_URL . 'assets/js/jquery.flot' . $suffix . '.js' );
|
|
|
|
|
147 |
}
|
148 |
|
149 |
/**
|
81 |
$this->data = $_data;
|
82 |
|
83 |
// Generate unique ID
|
84 |
+
$this->id = 'a' . md5( rand() );
|
85 |
|
86 |
// Setup default options;
|
87 |
$this->options = array(
|
144 |
// Use minified libraries if SCRIPT_DEBUG is turned off
|
145 |
$suffix = ( defined( 'SCRIPT_DEBUG' ) && SCRIPT_DEBUG ) ? '' : '.min';
|
146 |
wp_enqueue_script( 'jquery-flot', EDD_PLUGIN_URL . 'assets/js/jquery.flot' . $suffix . '.js' );
|
147 |
+
|
148 |
+
do_action( 'edd_graph_load_scripts' );
|
149 |
}
|
150 |
|
151 |
/**
|
includes/admin/reporting/class-edd-pie-graph.php
ADDED
@@ -0,0 +1,202 @@
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
1 |
+
<?php
|
2 |
+
/**
|
3 |
+
* Graphs
|
4 |
+
*
|
5 |
+
* This class handles building pretty report graphs
|
6 |
+
*
|
7 |
+
* @package EDD
|
8 |
+
* @subpackage Admin/Reports
|
9 |
+
* @copyright Copyright (c) 2015, Pippin Williamson
|
10 |
+
* @license http://opensource.org/licenses/gpl-2.0.php GNU Public License
|
11 |
+
* @since 2.4
|
12 |
+
*/
|
13 |
+
|
14 |
+
// Exit if accessed directly
|
15 |
+
if ( ! defined( 'ABSPATH' ) ) exit;
|
16 |
+
|
17 |
+
/**
|
18 |
+
* EDD_Graph Class
|
19 |
+
*
|
20 |
+
* @since 2.4
|
21 |
+
*/
|
22 |
+
class EDD_Pie_Graph extends EDD_Graph {
|
23 |
+
|
24 |
+
/*
|
25 |
+
|
26 |
+
Simple example:
|
27 |
+
|
28 |
+
data format for each point: array( location on x, location on y )
|
29 |
+
|
30 |
+
$data = array(
|
31 |
+
array( 'Label' => 'value' ),
|
32 |
+
array( 'Label 2' => 'value 2' ),
|
33 |
+
);
|
34 |
+
|
35 |
+
$graph = new EDD_Pie_Graph( $data );
|
36 |
+
$graph->display();
|
37 |
+
|
38 |
+
*/
|
39 |
+
|
40 |
+
/**
|
41 |
+
* Data to graph
|
42 |
+
*
|
43 |
+
* @var array
|
44 |
+
* @since 2.4
|
45 |
+
*/
|
46 |
+
private $data;
|
47 |
+
|
48 |
+
/**
|
49 |
+
* Unique ID for the graph
|
50 |
+
*
|
51 |
+
* @var string
|
52 |
+
* @since 2.4
|
53 |
+
*/
|
54 |
+
private $id = '';
|
55 |
+
|
56 |
+
/**
|
57 |
+
* Graph options
|
58 |
+
*
|
59 |
+
* @var array
|
60 |
+
* @since 2.4
|
61 |
+
*/
|
62 |
+
private $options = array();
|
63 |
+
|
64 |
+
/**
|
65 |
+
* Get things started
|
66 |
+
*
|
67 |
+
* @since 2.4
|
68 |
+
*/
|
69 |
+
public function __construct( $_data, $options = array() ) {
|
70 |
+
|
71 |
+
$this->data = $_data;
|
72 |
+
// Set this so filters recieving $this can quickly know if it's a graph they want to modify
|
73 |
+
$this->type = 'pie';
|
74 |
+
|
75 |
+
// Generate unique ID, add 'a' since md5 can leave a numerical first character
|
76 |
+
$this->id = 'a' . md5( rand() );
|
77 |
+
|
78 |
+
// Setup default options;
|
79 |
+
$defaults = array(
|
80 |
+
'radius' => 1,
|
81 |
+
'legend' => true,
|
82 |
+
'legend_formatter' => false,
|
83 |
+
'legend_columns' => 3,
|
84 |
+
'legend_position' => 's',
|
85 |
+
'show_labels' => false,
|
86 |
+
'label_threshold' => 0.01,
|
87 |
+
'label_formatter' => 'eddLabelFormatter',
|
88 |
+
'label_bg_opacity' => 0.75,
|
89 |
+
'label_radius' => 1,
|
90 |
+
'height' => '300',
|
91 |
+
'hoverable' => true,
|
92 |
+
'clickable' => false,
|
93 |
+
'threshold' => false,
|
94 |
+
);
|
95 |
+
|
96 |
+
$this->options = wp_parse_args( $options, $defaults );
|
97 |
+
|
98 |
+
add_action( 'edd_graph_load_scripts', array( $this, 'load_additional_scripts' ) );
|
99 |
+
|
100 |
+
}
|
101 |
+
|
102 |
+
/**
|
103 |
+
* Load the graphing library script
|
104 |
+
*
|
105 |
+
* @since 2.4
|
106 |
+
*/
|
107 |
+
public function load_additional_scripts() {
|
108 |
+
// Use minified libraries if SCRIPT_DEBUG is turned off
|
109 |
+
$suffix = ( defined( 'SCRIPT_DEBUG' ) && SCRIPT_DEBUG ) ? '' : '.min';
|
110 |
+
wp_enqueue_script( 'jquery-flot-pie', EDD_PLUGIN_URL . 'assets/js/jquery.flot.pie' . $suffix . '.js' );
|
111 |
+
}
|
112 |
+
|
113 |
+
/**
|
114 |
+
* Build the graph and return it as a string
|
115 |
+
*
|
116 |
+
* @var array
|
117 |
+
* @since 2.4
|
118 |
+
* @return string
|
119 |
+
*/
|
120 |
+
public function build_graph() {
|
121 |
+
|
122 |
+
$this->load_scripts();
|
123 |
+
|
124 |
+
ob_start();
|
125 |
+
?>
|
126 |
+
<script type="text/javascript">
|
127 |
+
var <?php echo $this->id; ?>_data = [
|
128 |
+
<?php foreach ( $this->data as $label => $value ) : ?>
|
129 |
+
<?php echo '{ label: "' . esc_attr( $label ) . '", data: "' . $value . '" },' . "\n"; ?>
|
130 |
+
<?php endforeach; ?>
|
131 |
+
];
|
132 |
+
|
133 |
+
var <?php echo $this->id; ?>_options = {
|
134 |
+
series: {
|
135 |
+
pie: {
|
136 |
+
show: true,
|
137 |
+
radius: <?php echo $this->options['radius']; ?>,
|
138 |
+
label: [],
|
139 |
+
},
|
140 |
+
edd_vars: {
|
141 |
+
id: '<?php echo $this->id; ?>',
|
142 |
+
}
|
143 |
+
},
|
144 |
+
legend: {
|
145 |
+
show: <?php echo $this->options['legend']; ?>,
|
146 |
+
},
|
147 |
+
grid: {},
|
148 |
+
};
|
149 |
+
|
150 |
+
<?php if ( true === $this->options['show_labels'] ) : ?>
|
151 |
+
<?php echo $this->id; ?>_options.series.pie.label.show = true;
|
152 |
+
<?php echo $this->id; ?>_options.series.pie.label.formatter = <?php echo $this->options['label_formatter']; ?>;
|
153 |
+
<?php echo $this->id; ?>_options.series.pie.label.threshold = <?php echo $this->options['label_threshold']; ?>;
|
154 |
+
<?php echo $this->id; ?>_options.series.pie.label.radius = <?php echo $this->options['label_radius']; ?>;
|
155 |
+
<?php echo $this->id; ?>_options.series.pie.label.background = { opacity: <?php echo $this->options['label_bg_opacity']; ?> };
|
156 |
+
<?php endif; ?>
|
157 |
+
|
158 |
+
<?php if ( true === $this->options['legend'] && ! empty( $this->options['legend_formatter'] ) ) : ?>
|
159 |
+
<?php echo $this->id; ?>_options.legend.labelFormatter = <?php echo $this->options['legend_formatter']; ?>;
|
160 |
+
<?php echo $this->id; ?>_options.legend.noColumns = <?php echo $this->options['legend_columns']; ?>;
|
161 |
+
<?php echo $this->id; ?>_options.legend.position = "<?php echo $this->options['legend_position']; ?>";
|
162 |
+
<?php endif; ?>
|
163 |
+
|
164 |
+
<?php if ( true === $this->options['hoverable'] ) : ?>
|
165 |
+
<?php echo $this->id; ?>_options.grid.hoverable = true;
|
166 |
+
<?php endif; ?>
|
167 |
+
|
168 |
+
<?php if ( true === $this->options['clickable'] ) : ?>
|
169 |
+
<?php echo $this->id; ?>_options.grid.clickable = true;
|
170 |
+
<?php endif; ?>
|
171 |
+
|
172 |
+
jQuery( document ).ready( function($) {
|
173 |
+
var <?php echo $this->id; ?>Chart = $('#edd-pie-graph-<?php echo $this->id; ?>');
|
174 |
+
$.plot( <?php echo $this->id; ?>Chart, <?php echo $this->id; ?>_data, <?php echo $this->id; ?>_options );
|
175 |
+
<?php if ( ! wp_is_mobile() ) : ?>
|
176 |
+
$(<?php echo $this->id; ?>Chart).on('plothover', function (event, pos, item) {
|
177 |
+
$('.edd-legend-item-wrapper').css('background-color', 'inherit');
|
178 |
+
if ( item ) {
|
179 |
+
var label = item.series.label;
|
180 |
+
var id = item.series.edd_vars.id;
|
181 |
+
|
182 |
+
var slug = label.toLowerCase().replace(/\s/g, '-');
|
183 |
+
var legendTarget = '#' + id + slug;
|
184 |
+
|
185 |
+
$('.edd-legend-item-wrapper' + legendTarget).css('background-color', '#f0f0f0');
|
186 |
+
}
|
187 |
+
});
|
188 |
+
<?php endif; ?>
|
189 |
+
});
|
190 |
+
|
191 |
+
</script>
|
192 |
+
<div class="edd-pie-graph-wrap">
|
193 |
+
<div id="edd-pie-graph-<?php echo $this->id; ?>" class="edd-pie-graph" style="height: <?php echo $this->options['height']; ?>px;"></div>
|
194 |
+
<div id="edd-pie-legend-<?php echo $this->id; ?>" class="edd-pie-legend"></div>
|
195 |
+
</div>
|
196 |
+
<?php
|
197 |
+
|
198 |
+
return apply_filters( 'edd_pie_graph_output', ob_get_clean(), $this->id, $this->data, $this->options );
|
199 |
+
|
200 |
+
}
|
201 |
+
|
202 |
+
}
|
includes/admin/reporting/class-export-payments.php
CHANGED
@@ -200,4 +200,4 @@ class EDD_Payments_Export extends EDD_Export {
|
|
200 |
|
201 |
return $data;
|
202 |
}
|
203 |
-
}
|
200 |
|
201 |
return $data;
|
202 |
}
|
203 |
+
}
|
includes/admin/reporting/export/class-batch-export-customers.php
ADDED
@@ -0,0 +1,160 @@
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
1 |
+
<?php
|
2 |
+
/**
|
3 |
+
* Batch Customers Export Class
|
4 |
+
*
|
5 |
+
* This class handles customer export
|
6 |
+
*
|
7 |
+
* @package EDD
|
8 |
+
* @subpackage Admin/Reports
|
9 |
+
* @copyright Copyright (c) 2015, Pippin Williamson
|
10 |
+
* @license http://opensource.org/licenses/gpl-2.0.php GNU Public License
|
11 |
+
* @since 2.4
|
12 |
+
*/
|
13 |
+
|
14 |
+
// Exit if accessed directly
|
15 |
+
if ( ! defined( 'ABSPATH' ) ) exit;
|
16 |
+
|
17 |
+
/**
|
18 |
+
* EDD_Batch_Customers_Export Class
|
19 |
+
*
|
20 |
+
* @since 2.4
|
21 |
+
*/
|
22 |
+
class EDD_Batch_Customers_Export extends EDD_Batch_Export {
|
23 |
+
|
24 |
+
/**
|
25 |
+
* Our export type. Used for export-type specific filters/actions
|
26 |
+
*
|
27 |
+
* @var string
|
28 |
+
* @since 2.4
|
29 |
+
*/
|
30 |
+
public $export_type = 'customers';
|
31 |
+
|
32 |
+
/**
|
33 |
+
* Set the CSV columns
|
34 |
+
*
|
35 |
+
* @access public
|
36 |
+
* @since 2.4
|
37 |
+
* @return array $cols All the columns
|
38 |
+
*/
|
39 |
+
public function csv_cols() {
|
40 |
+
|
41 |
+
$cols = array(
|
42 |
+
'id' => __( 'ID', 'edd' ),
|
43 |
+
'name' => __( 'Name', 'edd' ),
|
44 |
+
'email' => __( 'Email', 'edd' ),
|
45 |
+
'purchases' => __( 'Number of Purchases', 'edd' ),
|
46 |
+
'amount' => __( 'Customer Value', 'edd' )
|
47 |
+
);
|
48 |
+
|
49 |
+
return $cols;
|
50 |
+
}
|
51 |
+
|
52 |
+
/**
|
53 |
+
* Get the Export Data
|
54 |
+
*
|
55 |
+
* @access public
|
56 |
+
* @since 2.4
|
57 |
+
* Database API
|
58 |
+
* @global object $edd_logs EDD Logs Object
|
59 |
+
* @return array $data The data for the CSV file
|
60 |
+
*/
|
61 |
+
public function get_data() {
|
62 |
+
|
63 |
+
$data = array();
|
64 |
+
|
65 |
+
if ( ! empty( $this->download ) ) {
|
66 |
+
|
67 |
+
// Export customers of a specific product
|
68 |
+
global $edd_logs;
|
69 |
+
|
70 |
+
$args = array(
|
71 |
+
'post_parent' => absint( $this->download ),
|
72 |
+
'log_type' => 'sale',
|
73 |
+
'posts_per_page' => 30,
|
74 |
+
'paged' => $this->step
|
75 |
+
);
|
76 |
+
|
77 |
+
if( null !== $this->price_id ) {
|
78 |
+
$args['meta_query'] = array(
|
79 |
+
array(
|
80 |
+
'key' => '_edd_log_price_id',
|
81 |
+
'value' => (int) $this->price_id
|
82 |
+
)
|
83 |
+
);
|
84 |
+
}
|
85 |
+
|
86 |
+
$logs = $edd_logs->get_connected_logs( $args );
|
87 |
+
|
88 |
+
if ( $logs ) {
|
89 |
+
foreach ( $logs as $log ) {
|
90 |
+
|
91 |
+
$payment_id = get_post_meta( $log->ID, '_edd_log_payment_id', true );
|
92 |
+
$customer_id = edd_get_payment_customer_id( $payment_id );
|
93 |
+
$customer = new EDD_Customer( $customer_id );
|
94 |
+
|
95 |
+
$data[] = array(
|
96 |
+
'id' => $customer->id,
|
97 |
+
'name' => $customer->name,
|
98 |
+
'email' => $customer->email,
|
99 |
+
'purchases' => $customer->purchase_count,
|
100 |
+
'amount' => edd_format_amount( $customer->purchase_value ),
|
101 |
+
);
|
102 |
+
}
|
103 |
+
}
|
104 |
+
|
105 |
+
} else {
|
106 |
+
|
107 |
+
// Export all customers
|
108 |
+
$offset = 30 * ( $this->step - 1 );
|
109 |
+
$customers = EDD()->customers->get_customers( array( 'number' => 30, 'offset' => $offset ) );
|
110 |
+
|
111 |
+
$i = 0;
|
112 |
+
|
113 |
+
foreach ( $customers as $customer ) {
|
114 |
+
|
115 |
+
$data[$i]['id'] = $customer->id;
|
116 |
+
$data[$i]['name'] = $customer->name;
|
117 |
+
$data[$i]['email'] = $customer->email;
|
118 |
+
$data[$i]['purchases'] = $customer->purchase_count;
|
119 |
+
$data[$i]['amount'] = edd_format_amount( $customer->purchase_value );
|
120 |
+
|
121 |
+
$i++;
|
122 |
+
}
|
123 |
+
}
|
124 |
+
|
125 |
+
$data = apply_filters( 'edd_export_get_data', $data );
|
126 |
+
$data = apply_filters( 'edd_export_get_data_' . $this->export_type, $data );
|
127 |
+
|
128 |
+
return $data;
|
129 |
+
}
|
130 |
+
|
131 |
+
/**
|
132 |
+
* Return the calculated completion percentage
|
133 |
+
*
|
134 |
+
* @since 2.4
|
135 |
+
* @return int
|
136 |
+
*/
|
137 |
+
public function get_percentage_complete() {
|
138 |
+
|
139 |
+
$percentage = 0;
|
140 |
+
|
141 |
+
// We can't count the number when getting them for a specific download
|
142 |
+
if( empty( $this->download ) ) {
|
143 |
+
|
144 |
+
$total = EDD()->customers->count();
|
145 |
+
|
146 |
+
if( $total > 0 ) {
|
147 |
+
|
148 |
+
$percentage = ( ( 30 * $this->step ) / $total ) * 100;
|
149 |
+
|
150 |
+
}
|
151 |
+
|
152 |
+
}
|
153 |
+
|
154 |
+
if( $percentage > 100 ) {
|
155 |
+
$percentage = 100;
|
156 |
+
}
|
157 |
+
|
158 |
+
return $percentage;
|
159 |
+
}
|
160 |
+
}
|
includes/admin/reporting/export/class-batch-export-file-downloads.php
ADDED
@@ -0,0 +1,159 @@
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
1 |
+
<?php
|
2 |
+
/**
|
3 |
+
* Batch File Downloads Export Class
|
4 |
+
*
|
5 |
+
* This class handles file downloads export
|
6 |
+
*
|
7 |
+
* @package EDD
|
8 |
+
* @subpackage Admin/Reports
|
9 |
+
* @copyright Copyright (c) 2015, Pippin Williamson
|
10 |
+
* @license http://opensource.org/licenses/gpl-2.0.php GNU Public License
|
11 |
+
* @since 2.4
|
12 |
+
*/
|
13 |
+
|
14 |
+
// Exit if accessed directly
|
15 |
+
if ( ! defined( 'ABSPATH' ) ) exit;
|
16 |
+
|
17 |
+
/**
|
18 |
+
* EDD_Batch_File_Downloads_Export Class
|
19 |
+
*
|
20 |
+
* @since 2.4
|
21 |
+
*/
|
22 |
+
class EDD_Batch_File_Downloads_Export extends EDD_Batch_Export {
|
23 |
+
|
24 |
+
/**
|
25 |
+
* Our export type. Used for export-type specific filters/actions
|
26 |
+
*
|
27 |
+
* @var string
|
28 |
+
* @since 2.4
|
29 |
+
*/
|
30 |
+
public $export_type = 'file_downloads';
|
31 |
+
|
32 |
+
/**
|
33 |
+
* Set the CSV columns
|
34 |
+
*
|
35 |
+
* @access public
|
36 |
+
* @since 2.4
|
37 |
+
* @return array $cols All the columns
|
38 |
+
*/
|
39 |
+
public function csv_cols() {
|
40 |
+
|
41 |
+
$cols = array(
|
42 |
+
'date' => __( 'Date', 'edd' ),
|
43 |
+
'user' => __( 'Downloaded by', 'edd' ),
|
44 |
+
'ip' => __( 'IP Address', 'edd' ),
|
45 |
+
'download' => __( 'Product', 'edd' ),
|
46 |
+
'file' => __( 'File', 'edd' )
|
47 |
+
);
|
48 |
+
|
49 |
+
return $cols;
|
50 |
+
}
|
51 |
+
|
52 |
+
/**
|
53 |
+
* Get the Export Data
|
54 |
+
*
|
55 |
+
* @access public
|
56 |
+
* @since 2.4
|
57 |
+
* @global object $edd_logs EDD Logs Object
|
58 |
+
* @return array $data The data for the CSV file
|
59 |
+
*/
|
60 |
+
public function get_data() {
|
61 |
+
|
62 |
+
global $edd_logs;
|
63 |
+
|
64 |
+
$data = array();
|
65 |
+
|
66 |
+
$args = array(
|
67 |
+
'log_type' => 'file_download',
|
68 |
+
'posts_per_page' => 30,
|
69 |
+
'paged' => $this->step
|
70 |
+
);
|
71 |
+
|
72 |
+
if( ! empty( $this->start ) || ! empty( $this->end ) ) {
|
73 |
+
|
74 |
+
$args['date_query'] = array(
|
75 |
+
array(
|
76 |
+
'after' => date( 'Y-n-d H:i:s', strtotime( $this->start ) ),
|
77 |
+
'before' => date( 'Y-n-d H:i:s', strtotime( $this->end ) ),
|
78 |
+
'inclusive' => true
|
79 |
+
)
|
80 |
+
);
|
81 |
+
|
82 |
+
}
|
83 |
+
|
84 |
+
$logs = $edd_logs->get_connected_logs( $args );
|
85 |
+
|
86 |
+
if ( $logs ) {
|
87 |
+
foreach ( $logs as $log ) {
|
88 |
+
$user_info = get_post_meta( $log->ID, '_edd_log_user_info', true );
|
89 |
+
$files = edd_get_download_files( $log->post_parent );
|
90 |
+
$file_id = (int) get_post_meta( $log->ID, '_edd_log_file_id', true );
|
91 |
+
$file_name = isset( $files[ $file_id ]['name'] ) ? $files[ $file_id ]['name'] : null;
|
92 |
+
$user = get_userdata( $user_info['id'] );
|
93 |
+
$user = $user ? $user->user_login : $user_info['email'];
|
94 |
+
|
95 |
+
$data[] = array(
|
96 |
+
'date' => $log->post_date,
|
97 |
+
'user' => $user,
|
98 |
+
'ip' => get_post_meta( $log->ID, '_edd_log_ip', true ),
|
99 |
+
'download' => get_the_title( $log->post_parent ),
|
100 |
+
'file' => $file_name
|
101 |
+
);
|
102 |
+
}
|
103 |
+
|
104 |
+
$data = apply_filters( 'edd_export_get_data', $data );
|
105 |
+
$data = apply_filters( 'edd_export_get_data_' . $this->export_type, $data );
|
106 |
+
|
107 |
+
return $data;
|
108 |
+
}
|
109 |
+
|
110 |
+
return false;
|
111 |
+
|
112 |
+
}
|
113 |
+
|
114 |
+
/**
|
115 |
+
* Return the calculated completion percentage
|
116 |
+
*
|
117 |
+
* @since 2.4
|
118 |
+
* @return int
|
119 |
+
*/
|
120 |
+
public function get_percentage_complete() {
|
121 |
+
|
122 |
+
global $edd_logs;
|
123 |
+
|
124 |
+
$args = array(
|
125 |
+
'post_type' => 'edd_log',
|
126 |
+
'posts_per_page' => -1,
|
127 |
+
'post_status' => 'publish',
|
128 |
+
'fields' => 'ids',
|
129 |
+
'tax_query' => array(
|
130 |
+
array(
|
131 |
+
'taxonomy' => 'edd_log_type',
|
132 |
+
'field' => 'slug',
|
133 |
+
'terms' => 'file_download'
|
134 |
+
)
|
135 |
+
),
|
136 |
+
'date_query' => array(
|
137 |
+
array(
|
138 |
+
'after' => date( 'Y-n-d H:i:s', strtotime( $this->start ) ),
|
139 |
+
'before' => date( 'Y-n-d H:i:s', strtotime( $this->end ) ),
|
140 |
+
'inclusive' => true
|
141 |
+
)
|
142 |
+
)
|
143 |
+
);
|
144 |
+
|
145 |
+
$logs = new WP_Query( $args );
|
146 |
+
$total = (int) $logs->post_count;
|
147 |
+
$percentage = 100;
|
148 |
+
|
149 |
+
if( $total > 0 ) {
|
150 |
+
$percentage = ( ( 30 * $this->step ) / $total ) * 100;
|
151 |
+
}
|
152 |
+
|
153 |
+
if( $percentage > 100 ) {
|
154 |
+
$percentage = 100;
|
155 |
+
}
|
156 |
+
|
157 |
+
return $percentage;
|
158 |
+
}
|
159 |
+
}
|
includes/admin/reporting/export/class-batch-export-payments.php
ADDED
@@ -0,0 +1,239 @@
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
1 |
+
<?php
|
2 |
+
/**
|
3 |
+
* Payments Export Class
|
4 |
+
*
|
5 |
+
* This class handles payment export in batches
|
6 |
+
*
|
7 |
+
* @package EDD
|
8 |
+
* @subpackage Admin/Reports
|
9 |
+
* @copyright Copyright (c) 2015, Pippin Williamson
|
10 |
+
* @license http://opensource.org/licenses/gpl-2.0.php GNU Public License
|
11 |
+
* @since 2.4
|
12 |
+
*/
|
13 |
+
|
14 |
+
// Exit if accessed directly
|
15 |
+
if ( ! defined( 'ABSPATH' ) ) exit;
|
16 |
+
|
17 |
+
/**
|
18 |
+
* EDD_Batch_Payments_Export Class
|
19 |
+
*
|
20 |
+
* @since 2.4
|
21 |
+
*/
|
22 |
+
class EDD_Batch_Payments_Export extends EDD_Batch_Export {
|
23 |
+
|
24 |
+
/**
|
25 |
+
* Our export type. Used for export-type specific filters/actions
|
26 |
+
* @var string
|
27 |
+
* @since 2.4
|
28 |
+
*/
|
29 |
+
public $export_type = 'payments';
|
30 |
+
|
31 |
+
/**
|
32 |
+
* Set the CSV columns
|
33 |
+
*
|
34 |
+
* @access public
|
35 |
+
* @since 2.4
|
36 |
+
* @return array $cols All the columns
|
37 |
+
*/
|
38 |
+
public function csv_cols() {
|
39 |
+
$cols = array(
|
40 |
+
'id' => __( 'ID', 'edd' ), // unaltered payment ID (use for querying)
|
41 |
+
'seq_id' => __( 'Payment Number', 'edd' ), // sequential payment ID
|
42 |
+
'email' => __( 'Email', 'edd' ),
|
43 |
+
'first' => __( 'First Name', 'edd' ),
|
44 |
+
'last' => __( 'Last Name', 'edd' ),
|
45 |
+
'address1' => __( 'Address', 'edd' ),
|
46 |
+
'address2' => __( 'Address (Line 2)', 'edd' ),
|
47 |
+
'city' => __( 'City', 'edd' ),
|
48 |
+
'state' => __( 'State', 'edd' ),
|
49 |
+
'country' => __( 'Country', 'edd' ),
|
50 |
+
'zip' => __( 'Zip Code', 'edd' ),
|
51 |
+
'products' => __( 'Products', 'edd' ),
|
52 |
+
'skus' => __( 'SKUs', 'edd' ),
|
53 |
+
'amount' => __( 'Amount', 'edd' ) . ' (' . html_entity_decode( edd_currency_filter( '' ) ) . ')',
|
54 |
+
'tax' => __( 'Tax', 'edd' ) . ' (' . html_entity_decode( edd_currency_filter( '' ) ) . ')',
|
55 |
+
'discount' => __( 'Discount Code', 'edd' ),
|
56 |
+
'gateway' => __( 'Payment Method', 'edd' ),
|
57 |
+
'trans_id' => __( 'Transaction ID', 'edd' ),
|
58 |
+
'key' => __( 'Purchase Key', 'edd' ),
|
59 |
+
'date' => __( 'Date', 'edd' ),
|
60 |
+
'user' => __( 'User', 'edd' ),
|
61 |
+
'status' => __( 'Status', 'edd' )
|
62 |
+
);
|
63 |
+
|
64 |
+
if( ! edd_use_skus() ){
|
65 |
+
unset( $cols['skus'] );
|
66 |
+
}
|
67 |
+
if ( ! edd_get_option( 'enable_sequential' ) ) {
|
68 |
+
unset( $cols['seq_id'] );
|
69 |
+
}
|
70 |
+
|
71 |
+
return $cols;
|
72 |
+
}
|
73 |
+
|
74 |
+
/**
|
75 |
+
* Get the Export Data
|
76 |
+
*
|
77 |
+
* @access public
|
78 |
+
* @since 2.4
|
79 |
+
* @global object $wpdb Used to query the database using the WordPress
|
80 |
+
* Database API
|
81 |
+
* @return array $data The data for the CSV file
|
82 |
+
*/
|
83 |
+
public function get_data() {
|
84 |
+
global $wpdb;
|
85 |
+
|
86 |
+
$data = array();
|
87 |
+
|
88 |
+
$args = array(
|
89 |
+
'number' => 30,
|
90 |
+
'page' => $this->step,
|
91 |
+
'status' => $this->status
|
92 |
+
);
|
93 |
+
|
94 |
+
if( ! empty( $this->start ) || ! empty( $this->end ) ) {
|
95 |
+
|
96 |
+
$args['date_query'] = array(
|
97 |
+
array(
|
98 |
+
'after' => date( 'Y-n-d H:i:s', strtotime( $this->start ) ),
|
99 |
+
'before' => date( 'Y-n-d H:i:s', strtotime( $this->end ) ),
|
100 |
+
'inclusive' => true
|
101 |
+
)
|
102 |
+
);
|
103 |
+
|
104 |
+
}
|
105 |
+
|
106 |
+
//echo json_encode($args ); exit;
|
107 |
+
|
108 |
+
$payments = edd_get_payments( $args );
|
109 |
+
|
110 |
+
if( $payments ) {
|
111 |
+
|
112 |
+
foreach ( $payments as $payment ) {
|
113 |
+
$payment_meta = edd_get_payment_meta( $payment->ID );
|
114 |
+
$user_info = edd_get_payment_meta_user_info( $payment->ID );
|
115 |
+
$downloads = edd_get_payment_meta_cart_details( $payment->ID );
|
116 |
+
$total = edd_get_payment_amount( $payment->ID );
|
117 |
+
$user_id = isset( $user_info['id'] ) && $user_info['id'] != -1 ? $user_info['id'] : $user_info['email'];
|
118 |
+
$products = '';
|
119 |
+
$skus = '';
|
120 |
+
|
121 |
+
if ( $downloads ) {
|
122 |
+
foreach ( $downloads as $key => $download ) {
|
123 |
+
// Download ID
|
124 |
+
$id = isset( $payment_meta['cart_details'] ) ? $download['id'] : $download;
|
125 |
+
|
126 |
+
// If the download has variable prices, override the default price
|
127 |
+
$price_override = isset( $payment_meta['cart_details'] ) ? $download['price'] : null;
|
128 |
+
|
129 |
+
$price = edd_get_download_final_price( $id, $user_info, $price_override );
|
130 |
+
|
131 |
+
// Display the Downoad Name
|
132 |
+
$products .= get_the_title( $id ) . ' - ';
|
133 |
+
|
134 |
+
if ( edd_use_skus() ) {
|
135 |
+
$sku = edd_get_download_sku( $id );
|
136 |
+
|
137 |
+
if ( ! empty( $sku ) )
|
138 |
+
$skus .= $sku;
|
139 |
+
}
|
140 |
+
|
141 |
+
if ( isset( $downloads[ $key ]['item_number'] ) && isset( $downloads[ $key ]['item_number']['options'] ) ) {
|
142 |
+
$price_options = $downloads[ $key ]['item_number']['options'];
|
143 |
+
|
144 |
+
if ( isset( $price_options['price_id'] ) ) {
|
145 |
+
$products .= edd_get_price_option_name( $id, $price_options['price_id'], $payment->ID ) . ' - ';
|
146 |
+
}
|
147 |
+
}
|
148 |
+
$products .= html_entity_decode( edd_currency_filter( $price ) );
|
149 |
+
|
150 |
+
if ( $key != ( count( $downloads ) -1 ) ) {
|
151 |
+
$products .= ' / ';
|
152 |
+
|
153 |
+
if( edd_use_skus() )
|
154 |
+
$skus .= ' / ';
|
155 |
+
}
|
156 |
+
}
|
157 |
+
}
|
158 |
+
|
159 |
+
if ( is_numeric( $user_id ) ) {
|
160 |
+
$user = get_userdata( $user_id );
|
161 |
+
} else {
|
162 |
+
$user = false;
|
163 |
+
}
|
164 |
+
|
165 |
+
$data[] = array(
|
166 |
+
'id' => $payment->ID,
|
167 |
+
'seq_id' => edd_get_payment_number( $payment->ID ),
|
168 |
+
'email' => $payment_meta['email'],
|
169 |
+
'first' => $user_info['first_name'],
|
170 |
+
'last' => $user_info['last_name'],
|
171 |
+
'address1' => isset( $user_info['address']['line1'] ) ? $user_info['address']['line1'] : '',
|
172 |
+
'address2' => isset( $user_info['address']['line2'] ) ? $user_info['address']['line2'] : '',
|
173 |
+
'city' => isset( $user_info['address']['city'] ) ? $user_info['address']['city'] : '',
|
174 |
+
'state' => isset( $user_info['address']['state'] ) ? $user_info['address']['state'] : '',
|
175 |
+
'country' => isset( $user_info['address']['country'] ) ? $user_info['address']['country'] : '',
|
176 |
+
'zip' => isset( $user_info['address']['zip'] ) ? $user_info['address']['zip'] : '',
|
177 |
+
'products' => $products,
|
178 |
+
'skus' => $skus,
|
179 |
+
'amount' => html_entity_decode( edd_format_amount( $total ) ),
|
180 |
+
'tax' => html_entity_decode( edd_format_amount( edd_get_payment_tax( $payment->ID, $payment_meta ) ) ),
|
181 |
+
'discount' => isset( $user_info['discount'] ) && $user_info['discount'] != 'none' ? $user_info['discount'] : __( 'none', 'edd' ),
|
182 |
+
'gateway' => edd_get_gateway_admin_label( get_post_meta( $payment->ID, '_edd_payment_gateway', true ) ),
|
183 |
+
'trans_id' => edd_get_payment_transaction_id( $payment->ID ),
|
184 |
+
'key' => $payment_meta['key'],
|
185 |
+
'date' => $payment->post_date,
|
186 |
+
'user' => $user ? $user->display_name : __( 'guest', 'edd' ),
|
187 |
+
'status' => edd_get_payment_status( $payment, true )
|
188 |
+
);
|
189 |
+
|
190 |
+
}
|
191 |
+
|
192 |
+
$data = apply_filters( 'edd_export_get_data', $data );
|
193 |
+
$data = apply_filters( 'edd_export_get_data_' . $this->export_type, $data );
|
194 |
+
|
195 |
+
return $data;
|
196 |
+
|
197 |
+
}
|
198 |
+
|
199 |
+
return false;
|
200 |
+
|
201 |
+
}
|
202 |
+
|
203 |
+
/**
|
204 |
+
* Return the calculated completion percentage
|
205 |
+
*
|
206 |
+
* @since 2.4
|
207 |
+
* @return int
|
208 |
+
*/
|
209 |
+
public function get_percentage_complete() {
|
210 |
+
|
211 |
+
$status = $this->status;
|
212 |
+
$args = array(
|
213 |
+
'start-date' => date( 'Y-n-d H:i:s', strtotime( $this->start ) ),
|
214 |
+
'end-date' => date( 'Y-n-d H:i:s', strtotime( $this->end ) ),
|
215 |
+
);
|
216 |
+
|
217 |
+
if( 'any' == $status ) {
|
218 |
+
|
219 |
+
$total = array_sum( (array) edd_count_payments( $args ) );
|
220 |
+
|
221 |
+
} else {
|
222 |
+
|
223 |
+
$total = edd_count_payments( $args )->$status;
|
224 |
+
|
225 |
+
}
|
226 |
+
|
227 |
+
$percentage = 100;
|
228 |
+
|
229 |
+
if( $total > 0 ) {
|
230 |
+
$percentage = ( ( 30 * $this->step ) / $total ) * 100;
|
231 |
+
}
|
232 |
+
|
233 |
+
if( $percentage > 100 ) {
|
234 |
+
$percentage = 100;
|
235 |
+
}
|
236 |
+
|
237 |
+
return $percentage;
|
238 |
+
}
|
239 |
+
}
|
includes/admin/reporting/export/class-batch-export.php
ADDED
@@ -0,0 +1,253 @@
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
1 |
+
<?php
|
2 |
+
/**
|
3 |
+
* Batch Export Class
|
4 |
+
*
|
5 |
+
* This is the base class for all batch export methods. Each data export type (customers, payments, etc) extend this class
|
6 |
+
*
|
7 |
+
* @package EDD
|
8 |
+
* @subpackage Admin/Export
|
9 |
+
* @copyright Copyright (c) 2015, Pippin Williamson
|
10 |
+
* @license http://opensource.org/licenses/gpl-2.0.php GNU Public License
|
11 |
+
* @since 2.4
|
12 |
+
*/
|
13 |
+
|
14 |
+
// Exit if accessed directly
|
15 |
+
if ( ! defined( 'ABSPATH' ) ) exit;
|
16 |
+
|
17 |
+
/**
|
18 |
+
* EDD_Export Class
|
19 |
+
*
|
20 |
+
* @since 2.4
|
21 |
+
*/
|
22 |
+
class EDD_Batch_Export extends EDD_Export {
|
23 |
+
|
24 |
+
/**
|
25 |
+
* The file the data is stored in
|
26 |
+
*
|
27 |
+
* @since 2.4
|
28 |
+
*/
|
29 |
+
private $file;
|
30 |
+
|
31 |
+
/**
|
32 |
+
* The name of the file the data is stored in
|
33 |
+
*
|
34 |
+
* @since 2.4
|
35 |
+
*/
|
36 |
+
public $filename;
|
37 |
+
|
38 |
+
/**
|
39 |
+
* The file type, typically .csv
|
40 |
+
*
|
41 |
+
* @since 2.4
|
42 |
+
*/
|
43 |
+
public $filetype;
|
44 |
+
|
45 |
+
/**
|
46 |
+
* The current step being processed
|
47 |
+
*
|
48 |
+
* @since 2.4
|
49 |
+
*/
|
50 |
+
public $step;
|
51 |
+
|
52 |
+
/**
|
53 |
+
* Start date, Y-m-d H:i:s
|
54 |
+
*
|
55 |
+
* @since 2.4
|
56 |
+
*/
|
57 |
+
public $start;
|
58 |
+
|
59 |
+
/**
|
60 |
+
* End date, Y-m-d H:i:s
|
61 |
+
*
|
62 |
+
* @since 2.4
|
63 |
+
*/
|
64 |
+
public $end;
|
65 |
+
|
66 |
+
/**
|
67 |
+
* Status to export
|
68 |
+
*
|
69 |
+
* @since 2.4
|
70 |
+
*/
|
71 |
+
public $status;
|
72 |
+
|
73 |
+
/**
|
74 |
+
* Download to export data for
|
75 |
+
*
|
76 |
+
* @since 2.4
|
77 |
+
*/
|
78 |
+
public $download = null;
|
79 |
+
|
80 |
+
/**
|
81 |
+
* Download Price ID to export data for
|
82 |
+
*
|
83 |
+
* @since 2.4
|
84 |
+
*/
|
85 |
+
public $price_id = null;
|
86 |
+
|
87 |
+
/**
|
88 |
+
* Get things started
|
89 |
+
*
|
90 |
+
* @param $_step int The step to process
|
91 |
+
* @since 2.4
|
92 |
+
*/
|
93 |
+
public function __construct( $_step = 1 ) {
|
94 |
+
|
95 |
+
$upload_dir = wp_upload_dir();
|
96 |
+
$this->filetype = '.csv';
|
97 |
+
$this->filename = 'edd-' . $this->export_type . $this->filetype;
|
98 |
+
$this->file = trailingslashit( $upload_dir['basedir'] ) . $this->filename;
|
99 |
+
$this->step = $_step;
|
100 |
+
$this->done = false;
|
101 |
+
}
|
102 |
+
|
103 |
+
/**
|
104 |
+
* Process a step
|
105 |
+
*
|
106 |
+
* @since 2.4
|
107 |
+
* @return bool
|
108 |
+
*/
|
109 |
+
public function process_step() {
|
110 |
+
|
111 |
+
if ( ! $this->can_export() ) {
|
112 |
+
wp_die( __( 'You do not have permission to export data.', 'edd' ), __( 'Error', 'edd' ), array( 'response' => 403 ) );
|
113 |
+
}
|
114 |
+
|
115 |
+
if( $this->step < 2 ) {
|
116 |
+
|
117 |
+
// Make sure we start with a fresh file on step 1
|
118 |
+
@unlink( $this->file );
|
119 |
+
$this->print_csv_cols();
|
120 |
+
}
|
121 |
+
|
122 |
+
$rows = $this->print_csv_rows();
|
123 |
+
|
124 |
+
if( $rows ) {
|
125 |
+
return true;
|
126 |
+
} else {
|
127 |
+
return false;
|
128 |
+
}
|
129 |
+
}
|
130 |
+
|
131 |
+
/**
|
132 |
+
* Output the CSV columns
|
133 |
+
*
|
134 |
+
* @access public
|
135 |
+
* @since 2.4
|
136 |
+
* @uses EDD_Export::get_csv_cols()
|
137 |
+
* @return string
|
138 |
+
*/
|
139 |
+
public function print_csv_cols() {
|
140 |
+
|
141 |
+
$col_data = '';
|
142 |
+
$cols = $this->get_csv_cols();
|
143 |
+
$i = 1;
|
144 |
+
foreach( $cols as $col_id => $column ) {
|
145 |
+
$col_data .= '"' . addslashes( $column ) . '"';
|
146 |
+
$col_data .= $i == count( $cols ) ? '' : ',';
|
147 |
+
$i++;
|
148 |
+
}
|
149 |
+
$col_data .= "\r\n";
|
150 |
+
|
151 |
+
$this->stash_step_data( $col_data );
|
152 |
+
|
153 |
+
return $col_data;
|
154 |
+
|
155 |
+
}
|
156 |
+
|
157 |
+
/**
|
158 |
+
* Print the CSV rows for the current step
|
159 |
+
*
|
160 |
+
* @access public
|
161 |
+
* @since 2.4
|
162 |
+
* @return string|false
|
163 |
+
*/
|
164 |
+
public function print_csv_rows() {
|
165 |
+
|
166 |
+
$row_data = '';
|
167 |
+
$data = $this->get_data();
|
168 |
+
$cols = $this->get_csv_cols();
|
169 |
+
|
170 |
+
if( $data ) {
|
171 |
+
|
172 |
+
// Output each row
|
173 |
+
foreach ( $data as $row ) {
|
174 |
+
$i = 1;
|
175 |
+
foreach ( $row as $col_id => $column ) {
|
176 |
+
// Make sure the column is valid
|
177 |
+
if ( array_key_exists( $col_id, $cols ) ) {
|
178 |
+
$row_data .= '"' . addslashes( $column ) . '"';
|
179 |
+
$row_data .= $i == count( $cols ) ? '' : ',';
|
180 |
+
$i++;
|
181 |
+
}
|
182 |
+
}
|
183 |
+
$row_data .= "\r\n";
|
184 |
+
}
|
185 |
+
|
186 |
+
$this->stash_step_data( $row_data );
|
187 |
+
|
188 |
+
return $row_data;
|
189 |
+
}
|
190 |
+
|
191 |
+
return false;
|
192 |
+
}
|
193 |
+
|
194 |
+
/**
|
195 |
+
* Return the calculated completion percentage
|
196 |
+
*
|
197 |
+
* @since 2.4
|
198 |
+
* @return int
|
199 |
+
*/
|
200 |
+
public function get_percentage_complete() {
|
201 |
+
return 100;
|
202 |
+
}
|
203 |
+
|
204 |
+
/**
|
205 |
+
* Retrieve the file data is written to
|
206 |
+
*
|
207 |
+
* @since 2.4
|
208 |
+
* @return string
|
209 |
+
*/
|
210 |
+
private function get_file() {
|
211 |
+
$file = @file_get_contents( $this->file );
|
212 |
+
if( ! $file ) {
|
213 |
+
@file_put_contents( $this->file, '' );
|
214 |
+
}
|
215 |
+
return $file;
|
216 |
+
}
|
217 |
+
|
218 |
+
/**
|
219 |
+
* Append data to export file
|
220 |
+
*
|
221 |
+
* @since 2.4
|
222 |
+
* @param $data string The data to add to the file
|
223 |
+
* @return void
|
224 |
+
*/
|
225 |
+
private function stash_step_data( $data = '' ) {
|
226 |
+
|
227 |
+
$file = $this->get_file();
|
228 |
+
$file .= $data;
|
229 |
+
@file_put_contents( $this->file, $file );
|
230 |
+
|
231 |
+
}
|
232 |
+
|
233 |
+
/**
|
234 |
+
* Perform the export
|
235 |
+
*
|
236 |
+
* @access public
|
237 |
+
* @since 2.4
|
238 |
+
* @return void
|
239 |
+
*/
|
240 |
+
public function export() {
|
241 |
+
|
242 |
+
// Set headers
|
243 |
+
$this->headers();
|
244 |
+
|
245 |
+
$file = $this->get_file();
|
246 |
+
|
247 |
+
@unlink( $this->file );
|
248 |
+
|
249 |
+
echo $file;
|
250 |
+
|
251 |
+
edd_die();
|
252 |
+
}
|
253 |
+
}
|
includes/admin/reporting/export/export-functions.php
ADDED
@@ -0,0 +1,150 @@
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
1 |
+
<?php
|
2 |
+
/**
|
3 |
+
* Exports Functions
|
4 |
+
*
|
5 |
+
* These are functions are used for exporting data from Easy Digital Downloads.
|
6 |
+
*
|
7 |
+
* @package EDD
|
8 |
+
* @subpackage Admin/Export
|
9 |
+
* @copyright Copyright (c) 2015, Pippin Williamson
|
10 |
+
* @license http://opensource.org/licenses/gpl-2.0.php GNU Public License
|
11 |
+
*/
|
12 |
+
|
13 |
+
// Exit if accessed directly
|
14 |
+
if ( ! defined( 'ABSPATH' ) ) exit;
|
15 |
+
|
16 |
+
require_once EDD_PLUGIN_DIR . 'includes/admin/reporting/class-export.php';
|
17 |
+
|
18 |
+
/**
|
19 |
+
* Process batch exports via ajax
|
20 |
+
*
|
21 |
+
* @since 2.4
|
22 |
+
* @return void
|
23 |
+
*/
|
24 |
+
function edd_do_ajax_export() {
|
25 |
+
|
26 |
+
require_once EDD_PLUGIN_DIR . 'includes/admin/reporting/export/class-batch-export.php';
|
27 |
+
require_once EDD_PLUGIN_DIR . 'includes/admin/reporting/export/class-batch-export-payments.php';
|
28 |
+
require_once EDD_PLUGIN_DIR . 'includes/admin/reporting/export/class-batch-export-customers.php';
|
29 |
+
require_once EDD_PLUGIN_DIR . 'includes/admin/reporting/export/class-batch-export-file-downloads.php';
|
30 |
+
|
31 |
+
parse_str( $_POST['form'], $form );
|
32 |
+
|
33 |
+
$_REQUEST = $form = (array) $form;
|
34 |
+
|
35 |
+
if( ! wp_verify_nonce( $_REQUEST['edd_ajax_export'], 'edd_ajax_export' ) ) {
|
36 |
+
die( '-2' );
|
37 |
+
}
|
38 |
+
|
39 |
+
$step = absint( $_POST['step'] );
|
40 |
+
$class = $form['edd-export-class'];
|
41 |
+
$export = new $class( $step );
|
42 |
+
|
43 |
+
if( ! $export->can_export() ) {
|
44 |
+
die( '-1' );
|
45 |
+
}
|
46 |
+
|
47 |
+
$export->start = isset( $_REQUEST['start'] ) ? sanitize_text_field( $_REQUEST['start'] ) : '';
|
48 |
+
$export->end = isset( $_REQUEST['end'] ) ? sanitize_text_field( $_REQUEST['end'] ) : '';
|
49 |
+
$export->status = isset( $_REQUEST['status'] ) ? sanitize_text_field( $_REQUEST['status'] ) : 'complete';
|
50 |
+
$export->download = isset( $_REQUEST['download'] ) ? absint( $_REQUEST['download'] ) : null;
|
51 |
+
$export->price_id = isset( $_REQUEST['edd_price_option'] ) ? absint( $_REQUEST['edd_price_option'] ) : null;
|
52 |
+
|
53 |
+
$ret = $export->process_step( $step );
|
54 |
+
|
55 |
+
$percentage = $export->get_percentage_complete();
|
56 |
+
|
57 |
+
if( $ret ) {
|
58 |
+
|
59 |
+
$step += 1;
|
60 |
+
echo json_encode( array( 'step' => $step, 'percentage' => $percentage ) ); exit;
|
61 |
+
|
62 |
+
} else {
|
63 |
+
|
64 |
+
$args = array_merge( $_REQUEST, array(
|
65 |
+
'step' => $step,
|
66 |
+
'class' => $class,
|
67 |
+
'nonce' => wp_create_nonce( 'edd-batch-export' ),
|
68 |
+
'edd_action' => 'download_batch_export',
|
69 |
+
) );
|
70 |
+
|
71 |
+
$download_url = add_query_arg( $args, admin_url() );
|
72 |
+
|
73 |
+
echo json_encode( array( 'step' => 'done', 'url' => $download_url ) ); exit;
|
74 |
+
|
75 |
+
}
|
76 |
+
}
|
77 |
+
add_action( 'wp_ajax_edd_do_ajax_export', 'edd_do_ajax_export' );
|
78 |
+
|
79 |
+
/**
|
80 |
+
* Process the download file generated by a batch export
|
81 |
+
*
|
82 |
+
* @since 2.4
|
83 |
+
* @return void
|
84 |
+
*/
|
85 |
+
function edd_process_batch_export_download() {
|
86 |
+
|
87 |
+
if( ! wp_verify_nonce( $_REQUEST['nonce'], 'edd-batch-export' ) ) {
|
88 |
+
wp_die( __( 'Nonce verification failed', 'edd' ), __( 'Error', 'edd' ), array( 'response' => 403 ) );
|
89 |
+
}
|
90 |
+
|
91 |
+
require_once EDD_PLUGIN_DIR . 'includes/admin/reporting/export/class-batch-export.php';
|
92 |
+
require_once EDD_PLUGIN_DIR . 'includes/admin/reporting/export/class-batch-export-payments.php';
|
93 |
+
require_once EDD_PLUGIN_DIR . 'includes/admin/reporting/export/class-batch-export-customers.php';
|
94 |
+
require_once EDD_PLUGIN_DIR . 'includes/admin/reporting/export/class-batch-export-file-downloads.php';
|
95 |
+
|
96 |
+
$export = new $_REQUEST['class'];
|
97 |
+
$export->export();
|
98 |
+
|
99 |
+
}
|
100 |
+
add_action( 'edd_download_batch_export', 'edd_process_batch_export_download' );
|
101 |
+
|
102 |
+
/**
|
103 |
+
* Exports earnings for a specified time period
|
104 |
+
* EDD_Earnings_Export class.
|
105 |
+
*
|
106 |
+
* @since 2.0
|
107 |
+
* @return void
|
108 |
+
*/
|
109 |
+
function edd_export_earnings() {
|
110 |
+
require_once EDD_PLUGIN_DIR . 'includes/admin/reporting/class-export-earnings.php';
|
111 |
+
|
112 |
+
$earnings_export = new EDD_Earnings_Export();
|
113 |
+
|
114 |
+
$earnings_export->export();
|
115 |
+
}
|
116 |
+
add_action( 'edd_earnings_export', 'edd_export_earnings' );
|
117 |
+
|
118 |
+
|
119 |
+
/**
|
120 |
+
* Export all the customers to a CSV file.
|
121 |
+
*
|
122 |
+
* Note: The WordPress Database API is being used directly for performance
|
123 |
+
* reasons (workaround of calling all posts and fetch data respectively)
|
124 |
+
*
|
125 |
+
* @since 1.4.4
|
126 |
+
* @return void
|
127 |
+
*/
|
128 |
+
function edd_export_all_customers() {
|
129 |
+
require_once EDD_PLUGIN_DIR . 'includes/admin/reporting/class-export-customers.php';
|
130 |
+
|
131 |
+
$customer_export = new EDD_Customers_Export();
|
132 |
+
|
133 |
+
$customer_export->export();
|
134 |
+
}
|
135 |
+
add_action( 'edd_email_export', 'edd_export_all_customers' );
|
136 |
+
|
137 |
+
/**
|
138 |
+
* Exports all the downloads to a CSV file using the EDD_Export class.
|
139 |
+
*
|
140 |
+
* @since 1.4.4
|
141 |
+
* @return void
|
142 |
+
*/
|
143 |
+
function edd_export_all_downloads_history() {
|
144 |
+
require_once EDD_PLUGIN_DIR . 'includes/admin/reporting/class-export-download-history.php';
|
145 |
+
|
146 |
+
$file_download_export = new EDD_Download_History_Export();
|
147 |
+
|
148 |
+
$file_download_export->export();
|
149 |
+
}
|
150 |
+
add_action( 'edd_downloads_history_export', 'edd_export_all_downloads_history' );
|
includes/admin/reporting/graphing.php
CHANGED
@@ -49,6 +49,7 @@ function edd_reports_graph() {
|
|
49 |
$earnings_totals = 0.00; // Total earnings for time period shown
|
50 |
$sales_totals = 0; // Total sales for time period shown
|
51 |
|
|
|
52 |
$earnings_data = array();
|
53 |
$sales_data = array();
|
54 |
|
@@ -59,7 +60,7 @@ function edd_reports_graph() {
|
|
59 |
while ( $hour <= 23 ) :
|
60 |
|
61 |
$sales = edd_get_sales_by_date( $dates['day'], $month, $dates['year'], $hour );
|
62 |
-
$earnings = edd_get_earnings_by_date( $dates['day'], $month, $dates['year'], $hour );
|
63 |
|
64 |
$sales_totals += $sales;
|
65 |
$earnings_totals += $earnings;
|
@@ -81,7 +82,7 @@ function edd_reports_graph() {
|
|
81 |
$sales = edd_get_sales_by_date( $day, $month, $dates['year'] );
|
82 |
$sales_totals += $sales;
|
83 |
|
84 |
-
$earnings = edd_get_earnings_by_date( $day, $month, $dates['year'] );
|
85 |
$earnings_totals += $earnings;
|
86 |
|
87 |
$date = mktime( 0, 0, 0, $month, $day, $dates['year'] ) * 1000;
|
@@ -93,11 +94,15 @@ function edd_reports_graph() {
|
|
93 |
} else {
|
94 |
|
95 |
$y = $dates['year'];
|
|
|
96 |
while( $y <= $dates['year_end'] ) :
|
|
|
|
|
97 |
|
98 |
if( $dates['year'] == $dates['year_end'] ) {
|
99 |
$month_start = $dates['m_start'];
|
100 |
$month_end = $dates['m_end'];
|
|
|
101 |
} elseif( $y == $dates['year'] ) {
|
102 |
$month_start = $dates['m_start'];
|
103 |
$month_end = 12;
|
@@ -131,7 +136,7 @@ function edd_reports_graph() {
|
|
131 |
$sales = edd_get_sales_by_date( $d, $i, $y );
|
132 |
$sales_totals += $sales;
|
133 |
|
134 |
-
$earnings = edd_get_earnings_by_date( $d, $i, $y );
|
135 |
$earnings_totals += $earnings;
|
136 |
|
137 |
$date = mktime( 0, 0, 0, $i, $d, $y ) * 1000;
|
@@ -146,10 +151,10 @@ function edd_reports_graph() {
|
|
146 |
$sales = edd_get_sales_by_date( null, $i, $y );
|
147 |
$sales_totals += $sales;
|
148 |
|
149 |
-
$earnings = edd_get_earnings_by_date( null, $i, $y );
|
150 |
$earnings_totals += $earnings;
|
151 |
|
152 |
-
if( $i == $month_end ) {
|
153 |
|
154 |
$num_of_days = cal_days_in_month( CAL_GREGORIAN, $i, $y );
|
155 |
|
@@ -196,20 +201,46 @@ function edd_reports_graph() {
|
|
196 |
$graph->display();
|
197 |
|
198 |
if( 'this_month' == $dates['range'] ) {
|
199 |
-
$estimated = edd_estimated_monthly_stats();
|
200 |
}
|
201 |
?>
|
202 |
|
203 |
-
<p class="edd_graph_totals"
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
204 |
<p class="edd_graph_totals"><strong><?php _e( 'Total sales for period shown: ', 'edd' ); echo edd_format_amount( $sales_totals, false ); ?></strong></p>
|
205 |
|
206 |
<?php if( 'this_month' == $dates['range'] ) : ?>
|
207 |
-
<p class="edd_graph_totals"
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
208 |
<p class="edd_graph_totals"><strong><?php _e( 'Estimated monthly sales: ', 'edd' ); echo edd_format_amount( $estimated['sales'], false ); ?></strong></p>
|
209 |
<?php endif; ?>
|
210 |
|
211 |
<?php do_action( 'edd_reports_graph_additional_stats' ); ?>
|
212 |
|
|
|
|
|
|
|
|
|
|
|
|
|
213 |
</div>
|
214 |
</div>
|
215 |
</div>
|
@@ -265,6 +296,7 @@ function edd_reports_graph_of_download( $download_id = 0 ) {
|
|
265 |
$earnings_totals = (float) 0.00; // Total earnings for time period shown
|
266 |
$sales_totals = 0; // Total sales for time period shown
|
267 |
|
|
|
268 |
$earnings_data = array();
|
269 |
$sales_data = array();
|
270 |
$stats = new EDD_Payment_Stats;
|
@@ -288,7 +320,7 @@ function edd_reports_graph_of_download( $download_id = 0 ) {
|
|
288 |
$sales = $stats->get_sales( $download_id, $date, $date_end );
|
289 |
$sales_totals += $sales;
|
290 |
|
291 |
-
$earnings = $stats->get_earnings( $download_id, $date, $date_end );
|
292 |
$earnings_totals += $earnings;
|
293 |
|
294 |
$sales_data[] = array( $date * 1000, $sales );
|
@@ -310,7 +342,7 @@ function edd_reports_graph_of_download( $download_id = 0 ) {
|
|
310 |
$sales = $stats->get_sales( $download_id, $date, $date_end );
|
311 |
$sales_totals += $sales;
|
312 |
|
313 |
-
$earnings = $stats->get_earnings( $download_id, $date, $date_end );
|
314 |
$earnings_totals += $earnings;
|
315 |
|
316 |
$sales_data[] = array( $date * 1000, $sales );
|
@@ -322,11 +354,15 @@ function edd_reports_graph_of_download( $download_id = 0 ) {
|
|
322 |
} else {
|
323 |
|
324 |
$y = $dates['year'];
|
|
|
325 |
while( $y <= $dates['year_end'] ) :
|
326 |
|
|
|
|
|
327 |
if( $dates['year'] == $dates['year_end'] ) {
|
328 |
$month_start = $dates['m_start'];
|
329 |
$month_end = $dates['m_end'];
|
|
|
330 |
} elseif( $y == $dates['year'] ) {
|
331 |
$month_start = $dates['m_start'];
|
332 |
$month_end = 12;
|
@@ -340,7 +376,7 @@ function edd_reports_graph_of_download( $download_id = 0 ) {
|
|
340 |
|
341 |
if ( $day_by_day ) :
|
342 |
|
343 |
-
if( $i == $month_end ) {
|
344 |
|
345 |
$num_of_days = $dates['day_end'];
|
346 |
|
@@ -359,7 +395,7 @@ function edd_reports_graph_of_download( $download_id = 0 ) {
|
|
359 |
$sales = $stats->get_sales( $download_id, $date, $end_date );
|
360 |
$sales_totals += $sales;
|
361 |
|
362 |
-
$earnings = $stats->get_earnings( $download_id, $date, $end_date );
|
363 |
$earnings_totals += $earnings;
|
364 |
|
365 |
$sales_data[] = array( $date * 1000, $sales );
|
@@ -378,7 +414,7 @@ function edd_reports_graph_of_download( $download_id = 0 ) {
|
|
378 |
$sales = $stats->get_sales( $download_id, $date, $end_date );
|
379 |
$sales_totals += $sales;
|
380 |
|
381 |
-
$earnings = $stats->get_earnings( $download_id, $date, $end_date );
|
382 |
$earnings_totals += $earnings;
|
383 |
|
384 |
$sales_data[] = array( $date * 1000, $sales );
|
@@ -447,6 +483,7 @@ function edd_reports_graph_controls() {
|
|
447 |
$dates = edd_get_report_dates();
|
448 |
$display = $dates['range'] == 'other' ? '' : 'style="display:none;"';
|
449 |
$view = edd_get_reporting_view();
|
|
|
450 |
|
451 |
if( empty( $dates['day_end'] ) ) {
|
452 |
$dates['day_end'] = cal_days_in_month( CAL_GREGORIAN, date( 'n' ), date( 'Y' ) );
|
@@ -470,6 +507,7 @@ function edd_reports_graph_controls() {
|
|
470 |
<option value="<?php echo esc_attr( $key ); ?>"<?php selected( $key, $dates['range'] ); ?>><?php echo esc_html( $option ); ?></option>
|
471 |
<?php endforeach; ?>
|
472 |
</select>
|
|
|
473 |
<div id="edd-date-range-options" <?php echo $display; ?>>
|
474 |
<span><?php _e( 'From', 'edd' ); ?> </span>
|
475 |
<select id="edd-graphs-month-start" name="m_start">
|
@@ -505,8 +543,15 @@ function edd_reports_graph_controls() {
|
|
505 |
</select>
|
506 |
</div>
|
507 |
|
508 |
-
<
|
509 |
-
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
510 |
</div>
|
511 |
</div>
|
512 |
</form>
|
@@ -716,9 +761,10 @@ function edd_get_report_dates() {
|
|
716 |
function edd_parse_report_dates( $data ) {
|
717 |
$dates = edd_get_report_dates();
|
718 |
|
719 |
-
$view
|
720 |
-
$id
|
|
|
721 |
|
722 |
-
wp_redirect( add_query_arg( $dates, admin_url( 'edit.php?post_type=download&page=edd-reports&view=' . esc_attr( $view ) . '&download-id=' . absint( $id ) ) ) ); edd_die();
|
723 |
}
|
724 |
add_action( 'edd_filter_reports', 'edd_parse_report_dates' );
|
49 |
$earnings_totals = 0.00; // Total earnings for time period shown
|
50 |
$sales_totals = 0; // Total sales for time period shown
|
51 |
|
52 |
+
$include_taxes = empty( $_GET['exclude_taxes'] ) ? true : false;
|
53 |
$earnings_data = array();
|
54 |
$sales_data = array();
|
55 |
|
60 |
while ( $hour <= 23 ) :
|
61 |
|
62 |
$sales = edd_get_sales_by_date( $dates['day'], $month, $dates['year'], $hour );
|
63 |
+
$earnings = edd_get_earnings_by_date( $dates['day'], $month, $dates['year'], $hour, $include_taxes );
|
64 |
|
65 |
$sales_totals += $sales;
|
66 |
$earnings_totals += $earnings;
|
82 |
$sales = edd_get_sales_by_date( $day, $month, $dates['year'] );
|
83 |
$sales_totals += $sales;
|
84 |
|
85 |
+
$earnings = edd_get_earnings_by_date( $day, $month, $dates['year'], null, $include_taxes );
|
86 |
$earnings_totals += $earnings;
|
87 |
|
88 |
$date = mktime( 0, 0, 0, $month, $day, $dates['year'] ) * 1000;
|
94 |
} else {
|
95 |
|
96 |
$y = $dates['year'];
|
97 |
+
|
98 |
while( $y <= $dates['year_end'] ) :
|
99 |
+
|
100 |
+
$last_year = false;
|
101 |
|
102 |
if( $dates['year'] == $dates['year_end'] ) {
|
103 |
$month_start = $dates['m_start'];
|
104 |
$month_end = $dates['m_end'];
|
105 |
+
$last_year = true;
|
106 |
} elseif( $y == $dates['year'] ) {
|
107 |
$month_start = $dates['m_start'];
|
108 |
$month_end = 12;
|
136 |
$sales = edd_get_sales_by_date( $d, $i, $y );
|
137 |
$sales_totals += $sales;
|
138 |
|
139 |
+
$earnings = edd_get_earnings_by_date( $d, $i, $y, null, $include_taxes );
|
140 |
$earnings_totals += $earnings;
|
141 |
|
142 |
$date = mktime( 0, 0, 0, $i, $d, $y ) * 1000;
|
151 |
$sales = edd_get_sales_by_date( null, $i, $y );
|
152 |
$sales_totals += $sales;
|
153 |
|
154 |
+
$earnings = edd_get_earnings_by_date( null, $i, $y, null, $include_taxes );
|
155 |
$earnings_totals += $earnings;
|
156 |
|
157 |
+
if( $i == $month_end && $last_year ) {
|
158 |
|
159 |
$num_of_days = cal_days_in_month( CAL_GREGORIAN, $i, $y );
|
160 |
|
201 |
$graph->display();
|
202 |
|
203 |
if( 'this_month' == $dates['range'] ) {
|
204 |
+
$estimated = edd_estimated_monthly_stats( $include_taxes );
|
205 |
}
|
206 |
?>
|
207 |
|
208 |
+
<p class="edd_graph_totals">
|
209 |
+
<strong>
|
210 |
+
<?php
|
211 |
+
_e( 'Total earnings for period shown: ', 'edd' );
|
212 |
+
echo edd_currency_filter( edd_format_amount( $earnings_totals ) );
|
213 |
+
?>
|
214 |
+
</strong>
|
215 |
+
<?php if ( ! $include_taxes ) : ?>
|
216 |
+
<sup>†</sup>
|
217 |
+
<?php endif; ?>
|
218 |
+
</p>
|
219 |
<p class="edd_graph_totals"><strong><?php _e( 'Total sales for period shown: ', 'edd' ); echo edd_format_amount( $sales_totals, false ); ?></strong></p>
|
220 |
|
221 |
<?php if( 'this_month' == $dates['range'] ) : ?>
|
222 |
+
<p class="edd_graph_totals">
|
223 |
+
<strong>
|
224 |
+
<?php
|
225 |
+
_e( 'Estimated monthly earnings: ', 'edd' );
|
226 |
+
echo edd_currency_filter( edd_format_amount( $estimated['earnings'] ) );
|
227 |
+
?>
|
228 |
+
</strong>
|
229 |
+
<?php if ( ! $include_taxes ) : ?>
|
230 |
+
<sup>†</sup>
|
231 |
+
<?php endif; ?>
|
232 |
+
</p>
|
233 |
<p class="edd_graph_totals"><strong><?php _e( 'Estimated monthly sales: ', 'edd' ); echo edd_format_amount( $estimated['sales'], false ); ?></strong></p>
|
234 |
<?php endif; ?>
|
235 |
|
236 |
<?php do_action( 'edd_reports_graph_additional_stats' ); ?>
|
237 |
|
238 |
+
<p class="edd_graph_notes">
|
239 |
+
<?php if ( false === $include_taxes ) : ?>
|
240 |
+
<em><sup>†</sup> <?php _e( 'Excludes sales tax.', 'edd' ); ?></em>
|
241 |
+
<?php endif; ?>
|
242 |
+
</p>
|
243 |
+
|
244 |
</div>
|
245 |
</div>
|
246 |
</div>
|
296 |
$earnings_totals = (float) 0.00; // Total earnings for time period shown
|
297 |
$sales_totals = 0; // Total sales for time period shown
|
298 |
|
299 |
+
$include_taxes = empty( $_GET['exclude_taxes'] ) ? true : false;
|
300 |
$earnings_data = array();
|
301 |
$sales_data = array();
|
302 |
$stats = new EDD_Payment_Stats;
|
320 |
$sales = $stats->get_sales( $download_id, $date, $date_end );
|
321 |
$sales_totals += $sales;
|
322 |
|
323 |
+
$earnings = $stats->get_earnings( $download_id, $date, $date_end, $include_taxes );
|
324 |
$earnings_totals += $earnings;
|
325 |
|
326 |
$sales_data[] = array( $date * 1000, $sales );
|
342 |
$sales = $stats->get_sales( $download_id, $date, $date_end );
|
343 |
$sales_totals += $sales;
|
344 |
|
345 |
+
$earnings = $stats->get_earnings( $download_id, $date, $date_end, $include_taxes );
|
346 |
$earnings_totals += $earnings;
|
347 |
|
348 |
$sales_data[] = array( $date * 1000, $sales );
|
354 |
} else {
|
355 |
|
356 |
$y = $dates['year'];
|
357 |
+
|
358 |
while( $y <= $dates['year_end'] ) :
|
359 |
|
360 |
+
$last_year = false;
|
361 |
+
|
362 |
if( $dates['year'] == $dates['year_end'] ) {
|
363 |
$month_start = $dates['m_start'];
|
364 |
$month_end = $dates['m_end'];
|
365 |
+
$last_year = true;
|
366 |
} elseif( $y == $dates['year'] ) {
|
367 |
$month_start = $dates['m_start'];
|
368 |
$month_end = 12;
|
376 |
|
377 |
if ( $day_by_day ) :
|
378 |
|
379 |
+
if( $i == $month_end && $last_year ) {
|
380 |
|
381 |
$num_of_days = $dates['day_end'];
|
382 |
|
395 |
$sales = $stats->get_sales( $download_id, $date, $end_date );
|
396 |
$sales_totals += $sales;
|
397 |
|
398 |
+
$earnings = $stats->get_earnings( $download_id, $date, $end_date, $include_taxes );
|
399 |
$earnings_totals += $earnings;
|
400 |
|
401 |
$sales_data[] = array( $date * 1000, $sales );
|
414 |
$sales = $stats->get_sales( $download_id, $date, $end_date );
|
415 |
$sales_totals += $sales;
|
416 |
|
417 |
+
$earnings = $stats->get_earnings( $download_id, $date, $end_date, $include_taxes );
|
418 |
$earnings_totals += $earnings;
|
419 |
|
420 |
$sales_data[] = array( $date * 1000, $sales );
|
483 |
$dates = edd_get_report_dates();
|
484 |
$display = $dates['range'] == 'other' ? '' : 'style="display:none;"';
|
485 |
$view = edd_get_reporting_view();
|
486 |
+
$taxes = ! empty( $_GET['exclude_taxes'] ) ? false : true;
|
487 |
|
488 |
if( empty( $dates['day_end'] ) ) {
|
489 |
$dates['day_end'] = cal_days_in_month( CAL_GREGORIAN, date( 'n' ), date( 'Y' ) );
|
507 |
<option value="<?php echo esc_attr( $key ); ?>"<?php selected( $key, $dates['range'] ); ?>><?php echo esc_html( $option ); ?></option>
|
508 |
<?php endforeach; ?>
|
509 |
</select>
|
510 |
+
|
511 |
<div id="edd-date-range-options" <?php echo $display; ?>>
|
512 |
<span><?php _e( 'From', 'edd' ); ?> </span>
|
513 |
<select id="edd-graphs-month-start" name="m_start">
|
543 |
</select>
|
544 |
</div>
|
545 |
|
546 |
+
<div class="edd-graph-filter-options graph-option-section">
|
547 |
+
<input type="checkbox" id="exclude_taxes" <?php checked( false, $taxes, true ); ?> value="1" name="exclude_taxes" />
|
548 |
+
<label for="exclude_taxes"><?php _e( 'Exclude Taxes', 'edd' ); ?></label>
|
549 |
+
</div>
|
550 |
+
|
551 |
+
<div class="edd-graph-filter-submit graph-option-section">
|
552 |
+
<input type="hidden" name="edd_action" value="filter_reports" />
|
553 |
+
<input type="submit" class="button-secondary" value="<?php _e( 'Filter', 'edd' ); ?>"/>
|
554 |
+
</div>
|
555 |
</div>
|
556 |
</div>
|
557 |
</form>
|
761 |
function edd_parse_report_dates( $data ) {
|
762 |
$dates = edd_get_report_dates();
|
763 |
|
764 |
+
$view = edd_get_reporting_view();
|
765 |
+
$id = isset( $_GET['download-id'] ) ? $_GET['download-id'] : null;
|
766 |
+
$exclude_taxes = isset( $_GET['exclude_taxes'] ) ? $_GET['exclude_taxes'] : null;
|
767 |
|
768 |
+
wp_redirect( add_query_arg( $dates, admin_url( 'edit.php?post_type=download&page=edd-reports&view=' . esc_attr( $view ) . '&download-id=' . absint( $id ) . '&exclude_taxes=' . absint( $exclude_taxes ) ) ) ); edd_die();
|
769 |
}
|
770 |
add_action( 'edd_filter_reports', 'edd_parse_report_dates' );
|
includes/admin/reporting/pdf-reports.php
CHANGED
@@ -67,7 +67,8 @@ function edd_generate_pdf( $data ) {
|
|
67 |
$pdf->SetFillColor( 238, 238, 238 );
|
68 |
$pdf->Cell( 70, 6, utf8_decode( __( 'Product Name', 'edd' ) ), 1, 0, 'L', true );
|
69 |
$pdf->Cell( 30, 6, utf8_decode( __( 'Price', 'edd' ) ), 1, 0, 'L', true );
|
70 |
-
$
|
|
|
71 |
$pdf->Cell( 50, 6, utf8_decode( __( 'Tags', 'edd' ) ), 1, 0, 'L', true );
|
72 |
$pdf->Cell( 45, 6, utf8_decode( __( 'Number of Sales', 'edd' ) ), 1, 0, 'L', true );
|
73 |
$pdf->Cell( 35, 6, utf8_decode( __( 'Earnings to Date', 'edd' ) ), 1, 1, 'L', true );
|
67 |
$pdf->SetFillColor( 238, 238, 238 );
|
68 |
$pdf->Cell( 70, 6, utf8_decode( __( 'Product Name', 'edd' ) ), 1, 0, 'L', true );
|
69 |
$pdf->Cell( 30, 6, utf8_decode( __( 'Price', 'edd' ) ), 1, 0, 'L', true );
|
70 |
+
$category_labels = edd_get_taxonomy_labels( 'download_category' );
|
71 |
+
$pdf->Cell( 50, 6, utf8_decode( $category_labels['name'] ), 1, 0, 'L', true );
|
72 |
$pdf->Cell( 50, 6, utf8_decode( __( 'Tags', 'edd' ) ), 1, 0, 'L', true );
|
73 |
$pdf->Cell( 45, 6, utf8_decode( __( 'Number of Sales', 'edd' ) ), 1, 0, 'L', true );
|
74 |
$pdf->Cell( 35, 6, utf8_decode( __( 'Earnings to Date', 'edd' ) ), 1, 1, 'L', true );
|
includes/admin/reporting/reports.php
CHANGED
@@ -51,10 +51,11 @@ function edd_reports_page() {
|
|
51 |
*/
|
52 |
function edd_reports_default_views() {
|
53 |
$views = array(
|
54 |
-
'earnings'
|
55 |
-
'
|
56 |
-
'
|
57 |
-
'
|
|
|
58 |
);
|
59 |
|
60 |
$views = apply_filters( 'edd_report_views', $views );
|
@@ -237,6 +238,55 @@ function edd_reports_earnings() {
|
|
237 |
}
|
238 |
add_action( 'edd_reports_view_earnings', 'edd_reports_earnings' );
|
239 |
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
240 |
/**
|
241 |
* Renders the Tax Reports
|
242 |
*
|
@@ -317,6 +367,7 @@ function edd_reports_tab_export() {
|
|
317 |
<?php echo _x( 'to', 'Date one to date two', 'edd' ); ?>
|
318 |
<?php echo EDD()->html->year_dropdown( 'end_year' ); ?>
|
319 |
<?php echo EDD()->html->month_dropdown( 'end_month' ); ?>
|
|
|
320 |
<input type="hidden" name="edd-action" value="earnings_export"/>
|
321 |
<input type="submit" value="<?php _e( 'Generate CSV', 'edd' ); ?>" class="button-secondary"/>
|
322 |
</form>
|
@@ -329,11 +380,11 @@ function edd_reports_tab_export() {
|
|
329 |
<div class="inside">
|
330 |
<p><?php _e( 'Download a CSV of all payments recorded.', 'edd' ); ?></p>
|
331 |
<p>
|
332 |
-
<form method="post">
|
333 |
-
<?php echo EDD()->html->
|
334 |
-
<?php echo EDD()->html->
|
335 |
-
<select name="
|
336 |
-
<option value="
|
337 |
<?php
|
338 |
$statuses = edd_get_payment_statuses();
|
339 |
foreach( $statuses as $status => $label ) {
|
@@ -341,8 +392,12 @@ function edd_reports_tab_export() {
|
|
341 |
}
|
342 |
?>
|
343 |
</select>
|
344 |
-
|
345 |
-
<input type="
|
|
|
|
|
|
|
|
|
346 |
</form>
|
347 |
</p>
|
348 |
</div><!-- .inside -->
|
@@ -351,10 +406,10 @@ function edd_reports_tab_export() {
|
|
351 |
<div class="postbox edd-export-customers">
|
352 |
<h3><span><?php _e('Export Customers in CSV', 'edd'); ?></span></h3>
|
353 |
<div class="inside">
|
354 |
-
<p><?php _e( 'Download a CSV of
|
355 |
<p>
|
356 |
-
<form
|
357 |
-
<select name="
|
358 |
<option value="0"><?php printf( __( 'All %s', 'edd' ), edd_get_label_plural() ); ?></option>
|
359 |
<?php
|
360 |
$downloads = get_posts( array( 'post_type' => 'download', 'posts_per_page' => -1 ) );
|
@@ -365,12 +420,8 @@ function edd_reports_tab_export() {
|
|
365 |
}
|
366 |
?>
|
367 |
</select>
|
368 |
-
|
369 |
-
|
370 |
-
<option value="emails_and_names"><?php _e( 'Emails and Names', 'edd' ); ?></option>
|
371 |
-
<option value="full"><?php _e( 'Emails, Names, and Purchase Stats', 'edd' ); ?></option>
|
372 |
-
</select>
|
373 |
-
<input type="hidden" name="edd-action" value="email_export"/>
|
374 |
<input type="submit" value="<?php _e( 'Generate CSV', 'edd' ); ?>" class="button-secondary"/>
|
375 |
</form>
|
376 |
</p>
|
@@ -380,12 +431,13 @@ function edd_reports_tab_export() {
|
|
380 |
<div class="postbox edd-export-download-history">
|
381 |
<h3><span><?php _e('Export Download History in CSV', 'edd'); ?></span></h3>
|
382 |
<div class="inside">
|
383 |
-
<p><?php _e( 'Download a CSV of
|
384 |
<p>
|
385 |
-
<form method="post">
|
386 |
-
<?php echo EDD()->html->
|
387 |
-
<?php echo EDD()->html->
|
388 |
-
|
|
|
389 |
<input type="submit" value="<?php _e( 'Generate CSV', 'edd' ); ?>" class="button-secondary"/>
|
390 |
</form>
|
391 |
</p>
|
@@ -430,11 +482,13 @@ add_action( 'edd_reports_tab_logs', 'edd_reports_tab_logs' );
|
|
430 |
* Retrieves estimated monthly earnings and sales
|
431 |
*
|
432 |
* @since 1.5
|
|
|
|
|
433 |
* @return array
|
434 |
*/
|
435 |
-
function edd_estimated_monthly_stats() {
|
436 |
|
437 |
-
$estimated = get_transient( 'edd_estimated_monthly_stats' );
|
438 |
|
439 |
if ( false === $estimated ) {
|
440 |
|
@@ -445,7 +499,7 @@ function edd_estimated_monthly_stats() {
|
|
445 |
|
446 |
$stats = new EDD_Payment_Stats;
|
447 |
|
448 |
-
$to_date_earnings = $stats->get_earnings( 0, 'this_month' );
|
449 |
$to_date_sales = $stats->get_sales( 0, 'this_month' );
|
450 |
|
451 |
$current_day = date( 'd', current_time( 'timestamp' ) );
|
@@ -457,7 +511,7 @@ function edd_estimated_monthly_stats() {
|
|
457 |
$estimated['sales'] = ( $to_date_sales / $current_day ) * $days_in_month;
|
458 |
|
459 |
// Cache for one day
|
460 |
-
set_transient( 'edd_estimated_monthly_stats', $estimated, 86400 );
|
461 |
}
|
462 |
|
463 |
return maybe_unserialize( $estimated );
|
51 |
*/
|
52 |
function edd_reports_default_views() {
|
53 |
$views = array(
|
54 |
+
'earnings' => __( 'Earnings', 'edd' ),
|
55 |
+
'categories' => __( 'Earnings by Category', 'edd' ),
|
56 |
+
'downloads' => edd_get_label_plural(),
|
57 |
+
'gateways' => __( 'Payment Methods', 'edd' ),
|
58 |
+
'taxes' => __( 'Taxes', 'edd' ),
|
59 |
);
|
60 |
|
61 |
$views = apply_filters( 'edd_report_views', $views );
|
238 |
}
|
239 |
add_action( 'edd_reports_view_earnings', 'edd_reports_earnings' );
|
240 |
|
241 |
+
|
242 |
+
/**
|
243 |
+
* Renders the Reports Earnings By Category Table & Graphs
|
244 |
+
*
|
245 |
+
* @since 2.4
|
246 |
+
*/
|
247 |
+
function edd_reports_categories() {
|
248 |
+
if( ! current_user_can( 'view_shop_reports' ) ) {
|
249 |
+
return;
|
250 |
+
}
|
251 |
+
|
252 |
+
include( dirname( __FILE__ ) . '/class-categories-reports-table.php' );
|
253 |
+
?>
|
254 |
+
<div class="inside">
|
255 |
+
<?php
|
256 |
+
$categories_table = new EDD_Categories_Reports_Table();
|
257 |
+
$categories_table->prepare_items();
|
258 |
+
$categories_table->display();
|
259 |
+
?>
|
260 |
+
|
261 |
+
<?php echo $categories_table->load_scripts(); ?>
|
262 |
+
|
263 |
+
<div class="edd-mix-totals">
|
264 |
+
<div class="edd-mix-chart">
|
265 |
+
<strong><?php _e( 'Category Sales Mix: ', 'edd' ); ?></strong>
|
266 |
+
<?php $categories_table->output_sales_graph(); ?>
|
267 |
+
</div>
|
268 |
+
<div class="edd-mix-chart">
|
269 |
+
<strong><?php _e( 'Category Earnings Mix: ', 'edd' ); ?></strong>
|
270 |
+
<?php $categories_table->output_earnings_graph(); ?>
|
271 |
+
</div>
|
272 |
+
</div>
|
273 |
+
|
274 |
+
<?php do_action( 'edd_reports_graph_additional_stats' ); ?>
|
275 |
+
|
276 |
+
<p class="edd-graph-notes">
|
277 |
+
<span>
|
278 |
+
<em><sup>†</sup> <?php _e( 'All Parent categories include sales and earnings stats from child categories.', 'edd' ); ?></em>
|
279 |
+
</span>
|
280 |
+
<span>
|
281 |
+
<em><?php _e( 'Stats include all sales and earnings for the lifetime of the store.', 'edd' ); ?></em>
|
282 |
+
</span>
|
283 |
+
</p>
|
284 |
+
|
285 |
+
</div>
|
286 |
+
<?php
|
287 |
+
}
|
288 |
+
add_action( 'edd_reports_view_categories', 'edd_reports_categories' );
|
289 |
+
|
290 |
/**
|
291 |
* Renders the Tax Reports
|
292 |
*
|
367 |
<?php echo _x( 'to', 'Date one to date two', 'edd' ); ?>
|
368 |
<?php echo EDD()->html->year_dropdown( 'end_year' ); ?>
|
369 |
<?php echo EDD()->html->month_dropdown( 'end_month' ); ?>
|
370 |
+
<?php wp_nonce_field( 'edd_ajax_export', 'edd_ajax_export' ); ?>
|
371 |
<input type="hidden" name="edd-action" value="earnings_export"/>
|
372 |
<input type="submit" value="<?php _e( 'Generate CSV', 'edd' ); ?>" class="button-secondary"/>
|
373 |
</form>
|
380 |
<div class="inside">
|
381 |
<p><?php _e( 'Download a CSV of all payments recorded.', 'edd' ); ?></p>
|
382 |
<p>
|
383 |
+
<form id="edd-export-payments" class="edd-export-form" method="post">
|
384 |
+
<?php echo EDD()->html->date_field( array( 'id' => 'edd-payment-export-start', 'name' => 'start', 'placeholder' => __( 'Choose start date', 'edd' ) )); ?>
|
385 |
+
<?php echo EDD()->html->date_field( array( 'id' => 'edd-payment-export-end','name' => 'end', 'placeholder' => __( 'Choose end date', 'edd' ) )); ?>
|
386 |
+
<select name="status">
|
387 |
+
<option value="any"><?php _e( 'All Statuses', 'edd' ); ?></option>
|
388 |
<?php
|
389 |
$statuses = edd_get_payment_statuses();
|
390 |
foreach( $statuses as $status => $label ) {
|
392 |
}
|
393 |
?>
|
394 |
</select>
|
395 |
+
<?php wp_nonce_field( 'edd_ajax_export', 'edd_ajax_export' ); ?>
|
396 |
+
<input type="hidden" name="edd-export-class" value="EDD_Batch_Payments_Export"/>
|
397 |
+
<span>
|
398 |
+
<input type="submit" value="<?php _e( 'Generate CSV', 'edd' ); ?>" class="button-secondary"/>
|
399 |
+
<span class="spinner"></span>
|
400 |
+
</span>
|
401 |
</form>
|
402 |
</p>
|
403 |
</div><!-- .inside -->
|
406 |
<div class="postbox edd-export-customers">
|
407 |
<h3><span><?php _e('Export Customers in CSV', 'edd'); ?></span></h3>
|
408 |
<div class="inside">
|
409 |
+
<p><?php _e( 'Download a CSV of customers.', 'edd' ); ?></p>
|
410 |
<p>
|
411 |
+
<form id="edd-export-customers" class="edd-export-form" method="post">
|
412 |
+
<select name="download" id="edd_customer_export_download">
|
413 |
<option value="0"><?php printf( __( 'All %s', 'edd' ), edd_get_label_plural() ); ?></option>
|
414 |
<?php
|
415 |
$downloads = get_posts( array( 'post_type' => 'download', 'posts_per_page' => -1 ) );
|
420 |
}
|
421 |
?>
|
422 |
</select>
|
423 |
+
<?php wp_nonce_field( 'edd_ajax_export', 'edd_ajax_export' ); ?>
|
424 |
+
<input type="hidden" name="edd-export-class" value="EDD_Batch_Customers_Export"/>
|
|
|
|
|
|
|
|
|
425 |
<input type="submit" value="<?php _e( 'Generate CSV', 'edd' ); ?>" class="button-secondary"/>
|
426 |
</form>
|
427 |
</p>
|
431 |
<div class="postbox edd-export-download-history">
|
432 |
<h3><span><?php _e('Export Download History in CSV', 'edd'); ?></span></h3>
|
433 |
<div class="inside">
|
434 |
+
<p><?php _e( 'Download a CSV of file downloads.', 'edd' ); ?></p>
|
435 |
<p>
|
436 |
+
<form id="edd-export-file-downloads" class="edd-export-form" method="post">
|
437 |
+
<?php echo EDD()->html->date_field( array( 'id' => 'edd-file-download-export-start', 'name' => 'start', 'placeholder' => __( 'Choose start date', 'edd' ) )); ?>
|
438 |
+
<?php echo EDD()->html->date_field( array( 'id' => 'edd-file-download-export-end', 'name' => 'end', 'placeholder' => __( 'Choose end date', 'edd' ) )); ?>
|
439 |
+
<?php wp_nonce_field( 'edd_ajax_export', 'edd_ajax_export' ); ?>
|
440 |
+
<input type="hidden" name="edd-export-class" value="EDD_Batch_File_Downloads_Export"/>
|
441 |
<input type="submit" value="<?php _e( 'Generate CSV', 'edd' ); ?>" class="button-secondary"/>
|
442 |
</form>
|
443 |
</p>
|
482 |
* Retrieves estimated monthly earnings and sales
|
483 |
*
|
484 |
* @since 1.5
|
485 |
+
*
|
486 |
+
* @param bool $include_taxes If the estimated earnings should include taxes
|
487 |
* @return array
|
488 |
*/
|
489 |
+
function edd_estimated_monthly_stats( $include_taxes = true ) {
|
490 |
|
491 |
+
$estimated = get_transient( 'edd_estimated_monthly_stats' . $include_taxes );
|
492 |
|
493 |
if ( false === $estimated ) {
|
494 |
|
499 |
|
500 |
$stats = new EDD_Payment_Stats;
|
501 |
|
502 |
+
$to_date_earnings = $stats->get_earnings( 0, 'this_month', null, $include_taxes );
|
503 |
$to_date_sales = $stats->get_sales( 0, 'this_month' );
|
504 |
|
505 |
$current_day = date( 'd', current_time( 'timestamp' ) );
|
511 |
$estimated['sales'] = ( $to_date_sales / $current_day ) * $days_in_month;
|
512 |
|
513 |
// Cache for one day
|
514 |
+
set_transient( 'edd_estimated_monthly_stats' . $include_taxes, $estimated, 86400 );
|
515 |
}
|
516 |
|
517 |
return maybe_unserialize( $estimated );
|
includes/admin/settings/register-settings.php
CHANGED
@@ -125,14 +125,14 @@ function edd_get_settings() {
|
|
125 |
|
126 |
// Update old settings with new single option
|
127 |
|
128 |
-
$general_settings = is_array( get_option( 'edd_settings_general' ) ) ? get_option( 'edd_settings_general' )
|
129 |
-
$gateway_settings = is_array( get_option( 'edd_settings_gateways' ) ) ? get_option( 'edd_settings_gateways' )
|
130 |
-
$email_settings = is_array( get_option( 'edd_settings_emails' ) ) ? get_option( 'edd_settings_emails' )
|
131 |
-
$style_settings = is_array( get_option( 'edd_settings_styles' ) ) ? get_option( 'edd_settings_styles' )
|
132 |
-
$tax_settings = is_array( get_option( 'edd_settings_taxes' ) ) ? get_option( 'edd_settings_taxes' )
|
133 |
-
$ext_settings = is_array( get_option( 'edd_settings_extensions' ) ) ? get_option( 'edd_settings_extensions' )
|
134 |
-
$license_settings = is_array( get_option( 'edd_settings_licenses' ) ) ? get_option( 'edd_settings_licenses' )
|
135 |
-
$misc_settings = is_array( get_option( 'edd_settings_misc' ) ) ? get_option( 'edd_settings_misc' )
|
136 |
|
137 |
$settings = array_merge( $general_settings, $gateway_settings, $email_settings, $style_settings, $tax_settings, $ext_settings, $license_settings, $misc_settings );
|
138 |
|
@@ -175,18 +175,20 @@ function edd_register_settings() {
|
|
175 |
'edd_settings_' . $tab,
|
176 |
array(
|
177 |
'section' => $tab,
|
178 |
-
'id' => isset( $option['id'] ) ? $option['id']
|
179 |
-
'desc' => ! empty( $option['desc'] ) ? $option['desc']
|
180 |
-
'name' => isset( $option['name'] ) ? $option['name']
|
181 |
-
'size' => isset( $option['size'] ) ? $option['size']
|
182 |
-
'options' => isset( $option['options'] ) ? $option['options']
|
183 |
-
'std' => isset( $option['std'] ) ? $option['std']
|
184 |
-
'min' => isset( $option['min'] ) ? $option['min']
|
185 |
-
'max' => isset( $option['max'] ) ? $option['max']
|
186 |
-
|
187 |
-
|
188 |
-
|
189 |
-
|
|
|
|
|
190 |
)
|
191 |
);
|
192 |
}
|
@@ -215,20 +217,14 @@ function edd_get_registered_settings() {
|
|
215 |
/** General Settings */
|
216 |
'general' => apply_filters( 'edd_settings_general',
|
217 |
array(
|
218 |
-
'test_mode' => array(
|
219 |
-
'id' => 'test_mode',
|
220 |
-
'name' => __( 'Test Mode', 'edd' ),
|
221 |
-
'desc' => __( 'While in test mode no live transactions are processed. To fully use test mode, you must have a sandbox (test) account for the payment gateway you are testing.', 'edd' ),
|
222 |
-
'type' => 'checkbox'
|
223 |
-
),
|
224 |
'purchase_page' => array(
|
225 |
'id' => 'purchase_page',
|
226 |
'name' => __( 'Checkout Page', 'edd' ),
|
227 |
'desc' => __( 'This is the checkout page where buyers will complete their purchases. The [download_checkout] short code must be on this page.', 'edd' ),
|
228 |
'type' => 'select',
|
229 |
-
|
230 |
-
|
231 |
-
|
232 |
),
|
233 |
'success_page' => array(
|
234 |
'id' => 'success_page',
|
@@ -236,8 +232,8 @@ function edd_get_registered_settings() {
|
|
236 |
'desc' => __( 'This is the page buyers are sent to after completing their purchases. The [edd_receipt] short code should be on this page.', 'edd' ),
|
237 |
'type' => 'select',
|
238 |
'options' => edd_get_pages(),
|
239 |
-
|
240 |
-
|
241 |
),
|
242 |
'failure_page' => array(
|
243 |
'id' => 'failure_page',
|
@@ -245,8 +241,8 @@ function edd_get_registered_settings() {
|
|
245 |
'desc' => __( 'This is the page buyers are sent to if their transaction is cancelled or fails', 'edd' ),
|
246 |
'type' => 'select',
|
247 |
'options' => edd_get_pages(),
|
248 |
-
|
249 |
-
|
250 |
),
|
251 |
'purchase_history_page' => array(
|
252 |
'id' => 'purchase_history_page',
|
@@ -254,29 +250,29 @@ function edd_get_registered_settings() {
|
|
254 |
'desc' => __( 'This page shows a complete purchase history for the current user, including download links', 'edd' ),
|
255 |
'type' => 'select',
|
256 |
'options' => edd_get_pages(),
|
257 |
-
|
258 |
-
|
259 |
),
|
260 |
'base_country' => array(
|
261 |
'id' => 'base_country',
|
262 |
'name' => __( 'Base Country', 'edd' ),
|
263 |
'desc' => __( 'Where does your store operate from?', 'edd' ),
|
264 |
'type' => 'select',
|
265 |
-
|
266 |
-
|
267 |
-
|
268 |
),
|
269 |
'base_state' => array(
|
270 |
'id' => 'base_state',
|
271 |
'name' => __( 'Base State / Province', 'edd' ),
|
272 |
'desc' => __( 'What state / province does your store operate from?', 'edd' ),
|
273 |
'type' => 'shop_states',
|
274 |
-
|
275 |
-
|
276 |
),
|
277 |
'currency_settings' => array(
|
278 |
'id' => 'currency_settings',
|
279 |
-
'name' => '<
|
280 |
'desc' => __( 'Configure the currency options', 'edd' ),
|
281 |
'type' => 'header'
|
282 |
),
|
@@ -285,61 +281,61 @@ function edd_get_registered_settings() {
|
|
285 |
'name' => __( 'Currency', 'edd' ),
|
286 |
'desc' => __( 'Choose your currency. Note that some payment gateways have currency restrictions.', 'edd' ),
|
287 |
'type' => 'select',
|
288 |
-
|
289 |
-
|
290 |
),
|
291 |
'currency_position' => array(
|
292 |
-
'id'
|
293 |
-
'name'
|
294 |
-
'desc'
|
295 |
-
'type'
|
296 |
'options' => array(
|
297 |
'before' => __( 'Before - $10', 'edd' ),
|
298 |
-
'after'
|
299 |
)
|
300 |
),
|
301 |
'thousands_separator' => array(
|
302 |
-
'id'
|
303 |
'name' => __( 'Thousands Separator', 'edd' ),
|
304 |
'desc' => __( 'The symbol (usually , or .) to separate thousands', 'edd' ),
|
305 |
'type' => 'text',
|
306 |
'size' => 'small',
|
307 |
-
'std'
|
308 |
),
|
309 |
'decimal_separator' => array(
|
310 |
-
'id'
|
311 |
'name' => __( 'Decimal Separator', 'edd' ),
|
312 |
'desc' => __( 'The symbol (usually , or .) to separate decimal points', 'edd' ),
|
313 |
'type' => 'text',
|
314 |
'size' => 'small',
|
315 |
-
'std'
|
316 |
),
|
317 |
'api_settings' => array(
|
318 |
'id' => 'api_settings',
|
319 |
-
'name' => '<
|
320 |
'desc' => '',
|
321 |
'type' => 'header'
|
322 |
),
|
323 |
'api_allow_user_keys' => array(
|
324 |
-
'id'
|
325 |
'name' => __( 'Allow User Keys', 'edd' ),
|
326 |
'desc' => __( 'Check this box to allow all users to generate API keys. Users with the \'manage_shop_settings\' capability are always allowed to generate keys.', 'edd' ),
|
327 |
'type' => 'checkbox'
|
328 |
),
|
329 |
'tracking_settings' => array(
|
330 |
'id' => 'tracking_settings',
|
331 |
-
'name' => '<
|
332 |
'desc' => '',
|
333 |
'type' => 'header'
|
334 |
),
|
335 |
'allow_tracking' => array(
|
336 |
-
'id'
|
337 |
'name' => __( 'Allow Usage Tracking?', 'edd' ),
|
338 |
'desc' => __( 'Allow Easy Digital Downloads to anonymously track how this plugin is used and help us make the plugin better. Opt-in and receive a 20% discount code for any purchase from the <a href="https://easydigitaldownloads.com/extensions" target="_blank">Easy Digital Downloads store</a>. Your discount code will be emailed to you.', 'edd' ),
|
339 |
'type' => 'checkbox'
|
340 |
),
|
341 |
'uninstall_on_delete' => array(
|
342 |
-
'id'
|
343 |
'name' => __( 'Remove Data on Uninstall?', 'edd' ),
|
344 |
'desc' => __( 'Check this box if you would like EDD to completely remove all of its data when the plugin is deleted.', 'edd' ),
|
345 |
'type' => 'checkbox'
|
@@ -349,107 +345,120 @@ function edd_get_registered_settings() {
|
|
349 |
/** Payment Gateways Settings */
|
350 |
'gateways' => apply_filters('edd_settings_gateways',
|
351 |
array(
|
|
|
|
|
|
|
|
|
|
|
|
|
352 |
'gateways' => array(
|
353 |
-
'id'
|
354 |
-
'name'
|
355 |
-
'desc'
|
356 |
-
'type'
|
357 |
'options' => edd_get_payment_gateways()
|
358 |
),
|
359 |
'default_gateway' => array(
|
360 |
-
'id'
|
361 |
-
'name'
|
362 |
-
'desc'
|
363 |
-
'type'
|
364 |
'options' => edd_get_payment_gateways()
|
365 |
),
|
366 |
'accepted_cards' => array(
|
367 |
-
'id'
|
368 |
-
'name'
|
369 |
-
'desc'
|
370 |
-
'type'
|
371 |
'options' => apply_filters('edd_accepted_payment_icons', array(
|
372 |
-
'mastercard'
|
373 |
-
'visa'
|
374 |
'americanexpress' => 'American Express',
|
375 |
-
'discover'
|
376 |
-
'paypal'
|
377 |
)
|
378 |
)
|
379 |
),
|
380 |
'paypal' => array(
|
381 |
'id' => 'paypal',
|
382 |
-
'name' => '<
|
383 |
'desc' => __( 'Configure the PayPal settings', 'edd' ),
|
384 |
'type' => 'header'
|
385 |
),
|
386 |
'paypal_email' => array(
|
387 |
-
'id'
|
388 |
'name' => __( 'PayPal Email', 'edd' ),
|
389 |
'desc' => __( 'Enter your PayPal account\'s email', 'edd' ),
|
390 |
'type' => 'text',
|
391 |
'size' => 'regular'
|
392 |
),
|
393 |
'paypal_page_style' => array(
|
394 |
-
'id'
|
395 |
'name' => __( 'PayPal Page Style', 'edd' ),
|
396 |
'desc' => __( 'Enter the name of the page style to use, or leave blank for default', 'edd' ),
|
397 |
'type' => 'text',
|
398 |
'size' => 'regular'
|
399 |
),
|
400 |
'disable_paypal_verification' => array(
|
401 |
-
'id'
|
402 |
'name' => __( 'Disable PayPal IPN Verification', 'edd' ),
|
403 |
'desc' => __( 'If payments are not getting marked as complete, then check this box. This forces the site to use a slightly less secure method of verifying purchases.', 'edd' ),
|
404 |
'type' => 'checkbox'
|
405 |
-
)
|
406 |
)
|
407 |
),
|
408 |
/** Emails Settings */
|
409 |
'emails' => apply_filters('edd_settings_emails',
|
410 |
array(
|
411 |
'email_template' => array(
|
412 |
-
'id'
|
413 |
-
'name'
|
414 |
-
'desc'
|
415 |
-
'type'
|
416 |
'options' => edd_get_email_templates()
|
417 |
),
|
418 |
'email_logo' => array(
|
419 |
-
'id'
|
420 |
'name' => __( 'Logo', 'edd' ),
|
421 |
'desc' => __( 'Upload or choose a logo to be displayed at the top of the purchase receipt emails. Displayed on HTML emails only.', 'edd' ),
|
422 |
'type' => 'upload'
|
423 |
),
|
424 |
'email_settings' => array(
|
425 |
-
'id'
|
426 |
'name' => '',
|
427 |
'desc' => '',
|
428 |
'type' => 'hook'
|
429 |
),
|
430 |
'from_name' => array(
|
431 |
-
'id'
|
432 |
'name' => __( 'From Name', 'edd' ),
|
433 |
'desc' => __( 'The name purchase receipts are said to come from. This should probably be your site or shop name.', 'edd' ),
|
434 |
'type' => 'text',
|
435 |
'std' => get_bloginfo( 'name' )
|
436 |
),
|
437 |
'from_email' => array(
|
438 |
-
'id'
|
439 |
'name' => __( 'From Email', 'edd' ),
|
440 |
'desc' => __( 'Email to send purchase receipts from. This will act as the "from" and "reply-to" address.', 'edd' ),
|
441 |
'type' => 'text',
|
442 |
'std' => get_bloginfo( 'admin_email' )
|
443 |
),
|
444 |
'purchase_subject' => array(
|
445 |
-
'id'
|
446 |
'name' => __( 'Purchase Email Subject', 'edd' ),
|
447 |
'desc' => __( 'Enter the subject line for the purchase receipt email', 'edd' ),
|
448 |
'type' => 'text',
|
449 |
'std' => __( 'Purchase Receipt', 'edd' )
|
450 |
),
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
451 |
'purchase_receipt' => array(
|
452 |
-
'id'
|
453 |
'name' => __( 'Purchase Receipt', 'edd' ),
|
454 |
'desc' => __('Enter the email that is sent to users after completing a successful purchase. HTML is accepted. Available template tags:', 'edd') . '<br/>' . edd_get_emails_tags_list(),
|
455 |
'type' => 'rich_editor',
|
@@ -457,33 +466,33 @@ function edd_get_registered_settings() {
|
|
457 |
),
|
458 |
'sale_notification_header' => array(
|
459 |
'id' => 'sale_notification_header',
|
460 |
-
'name' => '<
|
461 |
'desc' => __('Configure new sale notification emails', 'edd'),
|
462 |
'type' => 'header'
|
463 |
),
|
464 |
'sale_notification_subject' => array(
|
465 |
-
'id'
|
466 |
'name' => __( 'Sale Notification Subject', 'edd' ),
|
467 |
'desc' => __( 'Enter the subject line for the sale notification email', 'edd' ),
|
468 |
'type' => 'text',
|
469 |
-
'std'
|
470 |
),
|
471 |
'sale_notification' => array(
|
472 |
-
'id'
|
473 |
'name' => __( 'Sale Notification', 'edd' ),
|
474 |
'desc' => __( 'Enter the email that is sent to sale notification emails after completion of a purchase. HTML is accepted. Available template tags:', 'edd' ) . '<br/>' . edd_get_emails_tags_list(),
|
475 |
'type' => 'rich_editor',
|
476 |
-
'std'
|
477 |
),
|
478 |
'admin_notice_emails' => array(
|
479 |
-
'id'
|
480 |
'name' => __( 'Sale Notification Emails', 'edd' ),
|
481 |
'desc' => __( 'Enter the email address(es) that should receive a notification anytime a sale is made, one per line', 'edd' ),
|
482 |
'type' => 'textarea',
|
483 |
'std' => get_bloginfo( 'admin_email' )
|
484 |
),
|
485 |
'disable_admin_notices' => array(
|
486 |
-
'id'
|
487 |
'name' => __( 'Disable Admin Notifications', 'edd' ),
|
488 |
'desc' => __( 'Check this box if you do not want to receive emails when new sales are made.', 'edd' ),
|
489 |
'type' => 'checkbox'
|
@@ -494,29 +503,29 @@ function edd_get_registered_settings() {
|
|
494 |
'styles' => apply_filters('edd_settings_styles',
|
495 |
array(
|
496 |
'disable_styles' => array(
|
497 |
-
'id'
|
498 |
'name' => __( 'Disable Styles', 'edd' ),
|
499 |
'desc' => __( 'Check this to disable all included styling of buttons, checkout fields, and all other elements.', 'edd' ),
|
500 |
'type' => 'checkbox'
|
501 |
),
|
502 |
'button_header' => array(
|
503 |
'id' => 'button_header',
|
504 |
-
'name' => '<
|
505 |
'desc' => __( 'Options for add to cart and purchase buttons', 'edd' ),
|
506 |
'type' => 'header'
|
507 |
),
|
508 |
'button_style' => array(
|
509 |
-
'id'
|
510 |
-
'name'
|
511 |
-
'desc'
|
512 |
-
'type'
|
513 |
'options' => edd_get_button_styles()
|
514 |
),
|
515 |
'checkout_color' => array(
|
516 |
-
'id'
|
517 |
-
'name'
|
518 |
-
'desc'
|
519 |
-
'type'
|
520 |
'options' => edd_get_button_colors()
|
521 |
)
|
522 |
)
|
@@ -525,47 +534,47 @@ function edd_get_registered_settings() {
|
|
525 |
'taxes' => apply_filters('edd_settings_taxes',
|
526 |
array(
|
527 |
'enable_taxes' => array(
|
528 |
-
'id'
|
529 |
'name' => __( 'Enable Taxes', 'edd' ),
|
530 |
'desc' => __( 'Check this to enable taxes on purchases.', 'edd' ),
|
531 |
'type' => 'checkbox',
|
532 |
),
|
533 |
'tax_rates' => array(
|
534 |
'id' => 'tax_rates',
|
535 |
-
'name' => '<
|
536 |
'desc' => __( 'Enter tax rates for specific regions.', 'edd' ),
|
537 |
'type' => 'tax_rates'
|
538 |
),
|
539 |
'tax_rate' => array(
|
540 |
-
'id'
|
541 |
'name' => __( 'Fallback Tax Rate', 'edd' ),
|
542 |
'desc' => __( 'Enter a percentage, such as 6.5. Customers not in a specific rate will be charged this rate.', 'edd' ),
|
543 |
'type' => 'text',
|
544 |
'size' => 'small'
|
545 |
),
|
546 |
'prices_include_tax' => array(
|
547 |
-
'id'
|
548 |
'name' => __( 'Prices entered with tax', 'edd' ),
|
549 |
'desc' => __( 'This option affects how you enter prices.', 'edd' ),
|
550 |
'type' => 'radio',
|
551 |
-
'std'
|
552 |
'options' => array(
|
553 |
'yes' => __( 'Yes, I will enter prices inclusive of tax', 'edd' ),
|
554 |
'no' => __( 'No, I will enter prices exclusive of tax', 'edd' )
|
555 |
)
|
556 |
),
|
557 |
'display_tax_rate' => array(
|
558 |
-
'id'
|
559 |
'name' => __( 'Display Tax Rate on Prices', 'edd' ),
|
560 |
'desc' => __( 'Some countries require a notice when product prices include tax.', 'edd' ),
|
561 |
'type' => 'checkbox',
|
562 |
),
|
563 |
'checkout_include_tax' => array(
|
564 |
-
'id'
|
565 |
'name' => __( 'Display during checkout', 'edd' ),
|
566 |
'desc' => __( 'Should prices on the checkout page be shown with or without tax?', 'edd' ),
|
567 |
'type' => 'select',
|
568 |
-
'std'
|
569 |
'options' => array(
|
570 |
'yes' => __( 'Including tax', 'edd' ),
|
571 |
'no' => __( 'Excluding tax', 'edd' )
|
@@ -584,92 +593,92 @@ function edd_get_registered_settings() {
|
|
584 |
'misc' => apply_filters('edd_settings_misc',
|
585 |
array(
|
586 |
'enable_ajax_cart' => array(
|
587 |
-
'id'
|
588 |
'name' => __( 'Enable Ajax', 'edd' ),
|
589 |
'desc' => __( 'Check this to enable AJAX for the shopping cart.', 'edd' ),
|
590 |
'type' => 'checkbox',
|
591 |
'std' => '1'
|
592 |
),
|
593 |
'redirect_on_add' => array(
|
594 |
-
'id'
|
595 |
'name' => __( 'Redirect to Checkout', 'edd' ),
|
596 |
'desc' => __( 'Immediately redirect to checkout after adding an item to the cart?', 'edd' ),
|
597 |
'type' => 'checkbox'
|
598 |
),
|
599 |
'enforce_ssl' => array(
|
600 |
-
'id'
|
601 |
'name' => __( 'Enforce SSL on Checkout', 'edd' ),
|
602 |
'desc' => __( 'Check this to force users to be redirected to the secure checkout page. You must have an SSL certificate installed to use this option.', 'edd' ),
|
603 |
'type' => 'checkbox'
|
604 |
),
|
605 |
'logged_in_only' => array(
|
606 |
-
'id'
|
607 |
'name' => __( 'Disable Guest Checkout', 'edd' ),
|
608 |
'desc' => __( 'Require that users be logged-in to purchase files.', 'edd' ),
|
609 |
'type' => 'checkbox'
|
610 |
),
|
611 |
'show_register_form' => array(
|
612 |
-
'id'
|
613 |
-
'name'
|
614 |
-
'desc'
|
615 |
-
'type'
|
|
|
616 |
'options' => array(
|
617 |
-
'both'
|
618 |
'registration' => __( 'Registration Form Only', 'edd' ),
|
619 |
-
'login'
|
620 |
-
'none'
|
621 |
),
|
622 |
-
'std' => 'none'
|
623 |
),
|
624 |
'item_quantities' => array(
|
625 |
-
'id'
|
626 |
'name' => __('Item Quantities', 'edd'),
|
627 |
'desc' => __('Allow item quantities to be changed.', 'edd'),
|
628 |
'type' => 'checkbox'
|
629 |
),
|
630 |
'allow_multiple_discounts' => array(
|
631 |
-
'id'
|
632 |
'name' => __('Multiple Discounts', 'edd'),
|
633 |
'desc' => __('Allow customers to use multiple discounts on the same purchase?', 'edd'),
|
634 |
'type' => 'checkbox'
|
635 |
),
|
636 |
'enable_cart_saving' => array(
|
637 |
-
'id'
|
638 |
'name' => __( 'Enable Cart Saving', 'edd' ),
|
639 |
'desc' => __( 'Check this to enable cart saving on the checkout.', 'edd' ),
|
640 |
'type' => 'checkbox'
|
641 |
),
|
642 |
'field_downloads' => array(
|
643 |
'id' => 'field_downloads',
|
644 |
-
'name' => '<
|
645 |
'desc' => '',
|
646 |
'type' => 'header'
|
647 |
),
|
648 |
'download_method' => array(
|
649 |
-
'id'
|
650 |
-
'name'
|
651 |
-
'desc'
|
652 |
-
'type'
|
653 |
'options' => array(
|
654 |
-
'direct'
|
655 |
'redirect' => __( 'Redirect', 'edd' )
|
656 |
)
|
657 |
),
|
658 |
'symlink_file_downloads' => array(
|
659 |
-
'id'
|
660 |
'name' => __( 'Symlink File Downloads?', 'edd' ),
|
661 |
'desc' => __( 'Check this if you are delivering really large files or having problems with file downloads completing.', 'edd' ),
|
662 |
'type' => 'checkbox'
|
663 |
),
|
664 |
'file_download_limit' => array(
|
665 |
-
'id'
|
666 |
'name' => __( 'File Download Limit', 'edd' ),
|
667 |
'desc' => sprintf( __( 'The maximum number of times files can be downloaded for purchases. Can be overwritten for each %s.', 'edd' ), edd_get_label_singular() ),
|
668 |
'type' => 'number',
|
669 |
'size' => 'small'
|
670 |
),
|
671 |
'download_link_expiration' => array(
|
672 |
-
'id'
|
673 |
'name' => __( 'Download Link Expiration', 'edd' ),
|
674 |
'desc' => __( 'How long should download links be valid for? Default is 24 hours from the time they are generated. Enter a time in hours.', 'edd' ),
|
675 |
'type' => 'number',
|
@@ -678,31 +687,31 @@ function edd_get_registered_settings() {
|
|
678 |
'min' => '0'
|
679 |
),
|
680 |
'disable_redownload' => array(
|
681 |
-
'id'
|
682 |
'name' => __( 'Disable Redownload?', 'edd' ),
|
683 |
'desc' => __( 'Check this if you do not want to allow users to redownload items from their purchase history.', 'edd' ),
|
684 |
'type' => 'checkbox'
|
685 |
),
|
686 |
'accounting_settings' => array(
|
687 |
'id' => 'accounting_settings',
|
688 |
-
'name' => '<
|
689 |
'desc' => '',
|
690 |
'type' => 'header'
|
691 |
),
|
692 |
'enable_skus' => array(
|
693 |
-
'id'
|
694 |
'name' => __( 'Enable SKU Entry', 'edd' ),
|
695 |
'desc' => __( 'Check this box to allow entry of product SKUs. SKUs will be shown on purchase receipt and exported purchase histories.', 'edd' ),
|
696 |
'type' => 'checkbox'
|
697 |
),
|
698 |
'enable_sequential' => array(
|
699 |
-
'id'
|
700 |
'name' => __( 'Sequential Order Numbers', 'edd' ),
|
701 |
-
'desc' => __( 'Check this box to sequential order numbers.', 'edd' ),
|
702 |
'type' => 'checkbox'
|
703 |
),
|
704 |
'sequential_start' => array(
|
705 |
-
'id'
|
706 |
'name' => __( 'Sequential Starting Number', 'edd' ),
|
707 |
'desc' => __( 'The number that sequential order numbers should start at.', 'edd' ),
|
708 |
'type' => 'number',
|
@@ -710,55 +719,62 @@ function edd_get_registered_settings() {
|
|
710 |
'std' => '1'
|
711 |
),
|
712 |
'sequential_prefix' => array(
|
713 |
-
'id'
|
714 |
'name' => __( 'Sequential Number Prefix', 'edd' ),
|
715 |
'desc' => __( 'A prefix to prepend to all sequential order numbers.', 'edd' ),
|
716 |
'type' => 'text'
|
717 |
),
|
718 |
'sequential_postfix' => array(
|
719 |
-
'id'
|
720 |
'name' => __( 'Sequential Number Postfix', 'edd' ),
|
721 |
'desc' => __( 'A postfix to append to all sequential order numbers.', 'edd' ),
|
722 |
'type' => 'text',
|
723 |
),
|
724 |
'terms' => array(
|
725 |
'id' => 'terms',
|
726 |
-
'name' => '<
|
727 |
'desc' => '',
|
728 |
'type' => 'header'
|
729 |
),
|
730 |
'show_agree_to_terms' => array(
|
731 |
-
'id'
|
732 |
'name' => __( 'Agree to Terms', 'edd' ),
|
733 |
'desc' => __( 'Check this to show an agree to terms on the checkout that users must agree to before purchasing.', 'edd' ),
|
734 |
'type' => 'checkbox'
|
735 |
),
|
736 |
'agree_label' => array(
|
737 |
-
'id'
|
738 |
'name' => __( 'Agree to Terms Label', 'edd' ),
|
739 |
'desc' => __( 'Label shown next to the agree to terms check box.', 'edd' ),
|
740 |
'type' => 'text',
|
741 |
'size' => 'regular'
|
742 |
),
|
743 |
'agree_text' => array(
|
744 |
-
'id'
|
745 |
'name' => __( 'Agreement Text', 'edd' ),
|
746 |
'desc' => __( 'If Agree to Terms is checked, enter the agreement terms here.', 'edd' ),
|
747 |
'type' => 'rich_editor'
|
748 |
),
|
749 |
'checkout_label' => array(
|
750 |
-
'id'
|
751 |
'name' => __( 'Complete Purchase Text', 'edd' ),
|
752 |
'desc' => __( 'The button label for completing a purchase.', 'edd' ),
|
753 |
'type' => 'text',
|
754 |
-
'std'
|
755 |
),
|
756 |
'add_to_cart_text' => array(
|
757 |
-
'id'
|
758 |
'name' => __( 'Add to Cart Text', 'edd' ),
|
759 |
'desc' => __( 'Text shown on the Add to Cart Buttons.', 'edd' ),
|
760 |
'type' => 'text',
|
761 |
'std' => __( 'Add to Cart', 'edd' )
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
762 |
)
|
763 |
)
|
764 |
)
|
@@ -983,8 +999,14 @@ function edd_header_callback( $args ) {
|
|
983 |
function edd_checkbox_callback( $args ) {
|
984 |
global $edd_options;
|
985 |
|
|
|
|
|
|
|
|
|
|
|
|
|
986 |
$checked = isset( $edd_options[ $args['id'] ] ) ? checked( 1, $edd_options[ $args['id'] ], false ) : '';
|
987 |
-
$html = '<input type="checkbox" id="edd_settings[' . $args['id'] . ']"
|
988 |
$html .= '<label for="edd_settings[' . $args['id'] . ']"> ' . $args['desc'] . '</label>';
|
989 |
|
990 |
echo $html;
|
@@ -1166,14 +1188,24 @@ function edd_gateway_select_callback($args) {
|
|
1166 |
function edd_text_callback( $args ) {
|
1167 |
global $edd_options;
|
1168 |
|
1169 |
-
if ( isset( $edd_options[ $args['id'] ] ) )
|
1170 |
$value = $edd_options[ $args['id'] ];
|
1171 |
-
else
|
1172 |
$value = isset( $args['std'] ) ? $args['std'] : '';
|
|
|
1173 |
|
1174 |
-
|
1175 |
-
|
1176 |
-
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
1177 |
|
1178 |
echo $html;
|
1179 |
}
|
@@ -1191,17 +1223,26 @@ function edd_text_callback( $args ) {
|
|
1191 |
function edd_number_callback( $args ) {
|
1192 |
global $edd_options;
|
1193 |
|
1194 |
-
|
1195 |
$value = $edd_options[ $args['id'] ];
|
1196 |
-
else
|
1197 |
$value = isset( $args['std'] ) ? $args['std'] : '';
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
1198 |
|
1199 |
$max = isset( $args['max'] ) ? $args['max'] : 999999;
|
1200 |
$min = isset( $args['min'] ) ? $args['min'] : 0;
|
1201 |
$step = isset( $args['step'] ) ? $args['step'] : 1;
|
1202 |
|
1203 |
$size = ( isset( $args['size'] ) && ! is_null( $args['size'] ) ) ? $args['size'] : 'regular';
|
1204 |
-
$html = '<input type="number" step="' . esc_attr( $step ) . '" max="' . esc_attr( $max ) . '" min="' . esc_attr( $min ) . '" class="' . $size . '-text" id="edd_settings[' . $args['id'] . ']"
|
1205 |
$html .= '<label for="edd_settings[' . $args['id'] . ']"> ' . $args['desc'] . '</label>';
|
1206 |
|
1207 |
echo $html;
|
@@ -1220,10 +1261,11 @@ function edd_number_callback( $args ) {
|
|
1220 |
function edd_textarea_callback( $args ) {
|
1221 |
global $edd_options;
|
1222 |
|
1223 |
-
if ( isset( $edd_options[ $args['id'] ] ) )
|
1224 |
$value = $edd_options[ $args['id'] ];
|
1225 |
-
else
|
1226 |
$value = isset( $args['std'] ) ? $args['std'] : '';
|
|
|
1227 |
|
1228 |
$html = '<textarea class="large-text" cols="50" rows="5" id="edd_settings[' . $args['id'] . ']" name="edd_settings[' . $args['id'] . ']">' . esc_textarea( stripslashes( $value ) ) . '</textarea>';
|
1229 |
$html .= '<label for="edd_settings[' . $args['id'] . ']"> ' . $args['desc'] . '</label>';
|
@@ -1244,10 +1286,11 @@ function edd_textarea_callback( $args ) {
|
|
1244 |
function edd_password_callback( $args ) {
|
1245 |
global $edd_options;
|
1246 |
|
1247 |
-
if ( isset( $edd_options[ $args['id'] ] ) )
|
1248 |
$value = $edd_options[ $args['id'] ];
|
1249 |
-
else
|
1250 |
$value = isset( $args['std'] ) ? $args['std'] : '';
|
|
|
1251 |
|
1252 |
$size = ( isset( $args['size'] ) && ! is_null( $args['size'] ) ) ? $args['size'] : 'regular';
|
1253 |
$html = '<input type="password" class="' . $size . '-text" id="edd_settings[' . $args['id'] . ']" name="edd_settings[' . $args['id'] . ']" value="' . esc_attr( $value ) . '"/>';
|
@@ -1282,27 +1325,30 @@ function edd_missing_callback($args) {
|
|
1282 |
function edd_select_callback($args) {
|
1283 |
global $edd_options;
|
1284 |
|
1285 |
-
if ( isset( $edd_options[ $args['id'] ] ) )
|
1286 |
$value = $edd_options[ $args['id'] ];
|
1287 |
-
else
|
1288 |
$value = isset( $args['std'] ) ? $args['std'] : '';
|
|
|
1289 |
|
1290 |
-
|
1291 |
-
|
1292 |
-
|
1293 |
$placeholder = '';
|
|
|
1294 |
|
1295 |
-
if ( isset( $args['chosen'] ) )
|
1296 |
$chosen = 'class="edd-chosen"';
|
1297 |
-
else
|
1298 |
$chosen = '';
|
|
|
1299 |
|
1300 |
-
|
1301 |
|
1302 |
-
foreach ( $args['options'] as $option => $name )
|
1303 |
$selected = selected( $option, $value, false );
|
1304 |
$html .= '<option value="' . $option . '" ' . $selected . '>' . $name . '</option>';
|
1305 |
-
|
1306 |
|
1307 |
$html .= '</select>';
|
1308 |
$html .= '<label for="edd_settings[' . $args['id'] . ']"> ' . $args['desc'] . '</label>';
|
@@ -1323,17 +1369,18 @@ function edd_select_callback($args) {
|
|
1323 |
function edd_color_select_callback( $args ) {
|
1324 |
global $edd_options;
|
1325 |
|
1326 |
-
if ( isset( $edd_options[ $args['id'] ] ) )
|
1327 |
$value = $edd_options[ $args['id'] ];
|
1328 |
-
else
|
1329 |
$value = isset( $args['std'] ) ? $args['std'] : '';
|
|
|
1330 |
|
1331 |
$html = '<select id="edd_settings[' . $args['id'] . ']" name="edd_settings[' . $args['id'] . ']"/>';
|
1332 |
|
1333 |
-
foreach ( $args['options'] as $option => $color )
|
1334 |
$selected = selected( $option, $value, false );
|
1335 |
$html .= '<option value="' . $option . '" ' . $selected . '>' . $color['label'] . '</option>';
|
1336 |
-
|
1337 |
|
1338 |
$html .= '</select>';
|
1339 |
$html .= '<label for="edd_settings[' . $args['id'] . ']"> ' . $args['desc'] . '</label>';
|
@@ -1392,10 +1439,11 @@ function edd_rich_editor_callback( $args ) {
|
|
1392 |
function edd_upload_callback( $args ) {
|
1393 |
global $edd_options;
|
1394 |
|
1395 |
-
if ( isset( $edd_options[ $args['id'] ] ) )
|
1396 |
$value = $edd_options[$args['id']];
|
1397 |
-
else
|
1398 |
$value = isset($args['std']) ? $args['std'] : '';
|
|
|
1399 |
|
1400 |
$size = ( isset( $args['size'] ) && ! is_null( $args['size'] ) ) ? $args['size'] : 'regular';
|
1401 |
$html = '<input type="text" class="' . $size . '-text" id="edd_settings[' . $args['id'] . ']" name="edd_settings[' . $args['id'] . ']" value="' . esc_attr( stripslashes( $value ) ) . '"/>';
|
@@ -1419,10 +1467,11 @@ function edd_upload_callback( $args ) {
|
|
1419 |
function edd_color_callback( $args ) {
|
1420 |
global $edd_options;
|
1421 |
|
1422 |
-
if ( isset( $edd_options[ $args['id'] ] ) )
|
1423 |
$value = $edd_options[ $args['id'] ];
|
1424 |
-
else
|
1425 |
$value = isset( $args['std'] ) ? $args['std'] : '';
|
|
|
1426 |
|
1427 |
$default = isset( $args['std'] ) ? $args['std'] : '';
|
1428 |
|
@@ -1446,21 +1495,22 @@ function edd_color_callback( $args ) {
|
|
1446 |
function edd_shop_states_callback($args) {
|
1447 |
global $edd_options;
|
1448 |
|
1449 |
-
|
1450 |
-
|
1451 |
-
|
1452 |
-
|
|
|
1453 |
|
1454 |
$states = edd_get_shop_states();
|
1455 |
|
1456 |
-
|
1457 |
-
|
1458 |
-
|
1459 |
|
1460 |
-
foreach ( $states as $option => $name )
|
1461 |
$selected = isset( $edd_options[ $args['id'] ] ) ? selected( $option, $edd_options[$args['id']], false ) : '';
|
1462 |
$html .= '<option value="' . $option . '" ' . $selected . '>' . $name . '</option>';
|
1463 |
-
|
1464 |
|
1465 |
$html .= '</select>';
|
1466 |
$html .= '<label for="edd_settings[' . $args['id'] . ']"> ' . $args['desc'] . '</label>';
|
@@ -1504,9 +1554,9 @@ function edd_tax_rates_callback($args) {
|
|
1504 |
'selected' => $rate['country'],
|
1505 |
'show_option_all' => false,
|
1506 |
'show_option_none' => false,
|
1507 |
-
|
1508 |
-
|
1509 |
-
|
1510 |
) );
|
1511 |
?>
|
1512 |
</td>
|
@@ -1519,9 +1569,9 @@ function edd_tax_rates_callback($args) {
|
|
1519 |
'name' => 'tax_rates[' . $key . '][state]',
|
1520 |
'selected' => $rate['state'],
|
1521 |
'show_option_all' => false,
|
1522 |
-
|
1523 |
-
|
1524 |
-
|
1525 |
) );
|
1526 |
} else {
|
1527 |
echo EDD()->html->text( array(
|
@@ -1547,9 +1597,9 @@ function edd_tax_rates_callback($args) {
|
|
1547 |
'name' => 'tax_rates[0][country]',
|
1548 |
'show_option_all' => false,
|
1549 |
'show_option_none' => false,
|
1550 |
-
|
1551 |
-
|
1552 |
-
|
1553 |
) ); ?>
|
1554 |
</td>
|
1555 |
<td class="edd_tax_state">
|
@@ -1583,7 +1633,7 @@ function edd_tax_rates_callback($args) {
|
|
1583 |
* @return void
|
1584 |
*/
|
1585 |
function edd_descriptive_text_callback( $args ) {
|
1586 |
-
echo
|
1587 |
}
|
1588 |
|
1589 |
/**
|
@@ -1598,10 +1648,11 @@ if ( ! function_exists( 'edd_license_key_callback' ) ) {
|
|
1598 |
function edd_license_key_callback( $args ) {
|
1599 |
global $edd_options;
|
1600 |
|
1601 |
-
if ( isset( $edd_options[ $args['id'] ] ) )
|
1602 |
$value = $edd_options[ $args['id'] ];
|
1603 |
-
else
|
1604 |
$value = isset( $args['std'] ) ? $args['std'] : '';
|
|
|
1605 |
|
1606 |
$size = ( isset( $args['size'] ) && ! is_null( $args['size'] ) ) ? $args['size'] : 'regular';
|
1607 |
$html = '<input type="text" class="' . $size . '-text" id="edd_settings[' . $args['id'] . ']" name="edd_settings[' . $args['id'] . ']" value="' . esc_attr( $value ) . '"/>';
|
125 |
|
126 |
// Update old settings with new single option
|
127 |
|
128 |
+
$general_settings = is_array( get_option( 'edd_settings_general' ) ) ? get_option( 'edd_settings_general' ) : array();
|
129 |
+
$gateway_settings = is_array( get_option( 'edd_settings_gateways' ) ) ? get_option( 'edd_settings_gateways' ) : array();
|
130 |
+
$email_settings = is_array( get_option( 'edd_settings_emails' ) ) ? get_option( 'edd_settings_emails' ) : array();
|
131 |
+
$style_settings = is_array( get_option( 'edd_settings_styles' ) ) ? get_option( 'edd_settings_styles' ) : array();
|
132 |
+
$tax_settings = is_array( get_option( 'edd_settings_taxes' ) ) ? get_option( 'edd_settings_taxes' ) : array();
|
133 |
+
$ext_settings = is_array( get_option( 'edd_settings_extensions' ) ) ? get_option( 'edd_settings_extensions' ) : array();
|
134 |
+
$license_settings = is_array( get_option( 'edd_settings_licenses' ) ) ? get_option( 'edd_settings_licenses' ) : array();
|
135 |
+
$misc_settings = is_array( get_option( 'edd_settings_misc' ) ) ? get_option( 'edd_settings_misc' ) : array();
|
136 |
|
137 |
$settings = array_merge( $general_settings, $gateway_settings, $email_settings, $style_settings, $tax_settings, $ext_settings, $license_settings, $misc_settings );
|
138 |
|
175 |
'edd_settings_' . $tab,
|
176 |
array(
|
177 |
'section' => $tab,
|
178 |
+
'id' => isset( $option['id'] ) ? $option['id'] : null,
|
179 |
+
'desc' => ! empty( $option['desc'] ) ? $option['desc'] : '',
|
180 |
+
'name' => isset( $option['name'] ) ? $option['name'] : null,
|
181 |
+
'size' => isset( $option['size'] ) ? $option['size'] : null,
|
182 |
+
'options' => isset( $option['options'] ) ? $option['options'] : '',
|
183 |
+
'std' => isset( $option['std'] ) ? $option['std'] : '',
|
184 |
+
'min' => isset( $option['min'] ) ? $option['min'] : null,
|
185 |
+
'max' => isset( $option['max'] ) ? $option['max'] : null,
|
186 |
+
'step' => isset( $option['step'] ) ? $option['step'] : null,
|
187 |
+
'chosen' => isset( $option['chosen'] ) ? $option['chosen'] : null,
|
188 |
+
'placeholder' => isset( $option['placeholder'] ) ? $option['placeholder'] : null,
|
189 |
+
'allow_blank' => isset( $option['allow_blank'] ) ? $option['allow_blank'] : true,
|
190 |
+
'readonly' => isset( $option['readonly'] ) ? $option['readonly'] : false,
|
191 |
+
'faux' => isset( $option['faux'] ) ? $option['faux'] : false,
|
192 |
)
|
193 |
);
|
194 |
}
|
217 |
/** General Settings */
|
218 |
'general' => apply_filters( 'edd_settings_general',
|
219 |
array(
|
|
|
|
|
|
|
|
|
|
|
|
|
220 |
'purchase_page' => array(
|
221 |
'id' => 'purchase_page',
|
222 |
'name' => __( 'Checkout Page', 'edd' ),
|
223 |
'desc' => __( 'This is the checkout page where buyers will complete their purchases. The [download_checkout] short code must be on this page.', 'edd' ),
|
224 |
'type' => 'select',
|
225 |
+
'options' => edd_get_pages(),
|
226 |
+
'chosen' => true,
|
227 |
+
'placeholder' => __( 'Select a page', 'edd' )
|
228 |
),
|
229 |
'success_page' => array(
|
230 |
'id' => 'success_page',
|
232 |
'desc' => __( 'This is the page buyers are sent to after completing their purchases. The [edd_receipt] short code should be on this page.', 'edd' ),
|
233 |
'type' => 'select',
|
234 |
'options' => edd_get_pages(),
|
235 |
+
'chosen' => true,
|
236 |
+
'placeholder' => __( 'Select a page', 'edd' )
|
237 |
),
|
238 |
'failure_page' => array(
|
239 |
'id' => 'failure_page',
|
241 |
'desc' => __( 'This is the page buyers are sent to if their transaction is cancelled or fails', 'edd' ),
|
242 |
'type' => 'select',
|
243 |
'options' => edd_get_pages(),
|
244 |
+
'chosen' => true,
|
245 |
+
'placeholder' => __( 'Select a page', 'edd' )
|
246 |
),
|
247 |
'purchase_history_page' => array(
|
248 |
'id' => 'purchase_history_page',
|
250 |
'desc' => __( 'This page shows a complete purchase history for the current user, including download links', 'edd' ),
|
251 |
'type' => 'select',
|
252 |
'options' => edd_get_pages(),
|
253 |
+
'chosen' => true,
|
254 |
+
'placeholder' => __( 'Select a page', 'edd' )
|
255 |
),
|
256 |
'base_country' => array(
|
257 |
'id' => 'base_country',
|
258 |
'name' => __( 'Base Country', 'edd' ),
|
259 |
'desc' => __( 'Where does your store operate from?', 'edd' ),
|
260 |
'type' => 'select',
|
261 |
+
'options' => edd_get_country_list(),
|
262 |
+
'chosen' => true,
|
263 |
+
'placeholder' => __( 'Select a country', 'edd' )
|
264 |
),
|
265 |
'base_state' => array(
|
266 |
'id' => 'base_state',
|
267 |
'name' => __( 'Base State / Province', 'edd' ),
|
268 |
'desc' => __( 'What state / province does your store operate from?', 'edd' ),
|
269 |
'type' => 'shop_states',
|
270 |
+
'chosen' => true,
|
271 |
+
'placeholder' => __( 'Select a state', 'edd' )
|
272 |
),
|
273 |
'currency_settings' => array(
|
274 |
'id' => 'currency_settings',
|
275 |
+
'name' => '<strong>' . __( 'Currency Settings', 'edd' ) . '</strong>',
|
276 |
'desc' => __( 'Configure the currency options', 'edd' ),
|
277 |
'type' => 'header'
|
278 |
),
|
281 |
'name' => __( 'Currency', 'edd' ),
|
282 |
'desc' => __( 'Choose your currency. Note that some payment gateways have currency restrictions.', 'edd' ),
|
283 |
'type' => 'select',
|
284 |
+
'options' => edd_get_currencies(),
|
285 |
+
'chosen' => true
|
286 |
),
|
287 |
'currency_position' => array(
|
288 |
+
'id' => 'currency_position',
|
289 |
+
'name' => __( 'Currency Position', 'edd' ),
|
290 |
+
'desc' => __( 'Choose the location of the currency sign.', 'edd' ),
|
291 |
+
'type' => 'select',
|
292 |
'options' => array(
|
293 |
'before' => __( 'Before - $10', 'edd' ),
|
294 |
+
'after' => __( 'After - 10$', 'edd' )
|
295 |
)
|
296 |
),
|
297 |
'thousands_separator' => array(
|
298 |
+
'id' => 'thousands_separator',
|
299 |
'name' => __( 'Thousands Separator', 'edd' ),
|
300 |
'desc' => __( 'The symbol (usually , or .) to separate thousands', 'edd' ),
|
301 |
'type' => 'text',
|
302 |
'size' => 'small',
|
303 |
+
'std' => ','
|
304 |
),
|
305 |
'decimal_separator' => array(
|
306 |
+
'id' => 'decimal_separator',
|
307 |
'name' => __( 'Decimal Separator', 'edd' ),
|
308 |
'desc' => __( 'The symbol (usually , or .) to separate decimal points', 'edd' ),
|
309 |
'type' => 'text',
|
310 |
'size' => 'small',
|
311 |
+
'std' => '.'
|
312 |
),
|
313 |
'api_settings' => array(
|
314 |
'id' => 'api_settings',
|
315 |
+
'name' => '<strong>' . __( 'API Settings', 'edd' ) . '</strong>',
|
316 |
'desc' => '',
|
317 |
'type' => 'header'
|
318 |
),
|
319 |
'api_allow_user_keys' => array(
|
320 |
+
'id' => 'api_allow_user_keys',
|
321 |
'name' => __( 'Allow User Keys', 'edd' ),
|
322 |
'desc' => __( 'Check this box to allow all users to generate API keys. Users with the \'manage_shop_settings\' capability are always allowed to generate keys.', 'edd' ),
|
323 |
'type' => 'checkbox'
|
324 |
),
|
325 |
'tracking_settings' => array(
|
326 |
'id' => 'tracking_settings',
|
327 |
+
'name' => '<strong>' . __( 'Tracking Settings', 'edd' ) . '</strong>',
|
328 |
'desc' => '',
|
329 |
'type' => 'header'
|
330 |
),
|
331 |
'allow_tracking' => array(
|
332 |
+
'id' => 'allow_tracking',
|
333 |
'name' => __( 'Allow Usage Tracking?', 'edd' ),
|
334 |
'desc' => __( 'Allow Easy Digital Downloads to anonymously track how this plugin is used and help us make the plugin better. Opt-in and receive a 20% discount code for any purchase from the <a href="https://easydigitaldownloads.com/extensions" target="_blank">Easy Digital Downloads store</a>. Your discount code will be emailed to you.', 'edd' ),
|
335 |
'type' => 'checkbox'
|
336 |
),
|
337 |
'uninstall_on_delete' => array(
|
338 |
+
'id' => 'uninstall_on_delete',
|
339 |
'name' => __( 'Remove Data on Uninstall?', 'edd' ),
|
340 |
'desc' => __( 'Check this box if you would like EDD to completely remove all of its data when the plugin is deleted.', 'edd' ),
|
341 |
'type' => 'checkbox'
|
345 |
/** Payment Gateways Settings */
|
346 |
'gateways' => apply_filters('edd_settings_gateways',
|
347 |
array(
|
348 |
+
'test_mode' => array(
|
349 |
+
'id' => 'test_mode',
|
350 |
+
'name' => __( 'Test Mode', 'edd' ),
|
351 |
+
'desc' => __( 'While in test mode no live transactions are processed. To fully use test mode, you must have a sandbox (test) account for the payment gateway you are testing.', 'edd' ),
|
352 |
+
'type' => 'checkbox'
|
353 |
+
),
|
354 |
'gateways' => array(
|
355 |
+
'id' => 'gateways',
|
356 |
+
'name' => __( 'Payment Gateways', 'edd' ),
|
357 |
+
'desc' => __( 'Choose the payment gateways you want to enable.', 'edd' ),
|
358 |
+
'type' => 'gateways',
|
359 |
'options' => edd_get_payment_gateways()
|
360 |
),
|
361 |
'default_gateway' => array(
|
362 |
+
'id' => 'default_gateway',
|
363 |
+
'name' => __( 'Default Gateway', 'edd' ),
|
364 |
+
'desc' => __( 'This gateway will be loaded automatically with the checkout page.', 'edd' ),
|
365 |
+
'type' => 'gateway_select',
|
366 |
'options' => edd_get_payment_gateways()
|
367 |
),
|
368 |
'accepted_cards' => array(
|
369 |
+
'id' => 'accepted_cards',
|
370 |
+
'name' => __( 'Accepted Payment Method Icons', 'edd' ),
|
371 |
+
'desc' => __( 'Display icons for the selected payment methods', 'edd' ) . '<br/>' . __( 'You will also need to configure your gateway settings if you are accepting credit cards', 'edd' ),
|
372 |
+
'type' => 'payment_icons',
|
373 |
'options' => apply_filters('edd_accepted_payment_icons', array(
|
374 |
+
'mastercard' => 'Mastercard',
|
375 |
+
'visa' => 'Visa',
|
376 |
'americanexpress' => 'American Express',
|
377 |
+
'discover' => 'Discover',
|
378 |
+
'paypal' => 'PayPal',
|
379 |
)
|
380 |
)
|
381 |
),
|
382 |
'paypal' => array(
|
383 |
'id' => 'paypal',
|
384 |
+
'name' => '<strong>' . __( 'PayPal Settings', 'edd' ) . '</strong>',
|
385 |
'desc' => __( 'Configure the PayPal settings', 'edd' ),
|
386 |
'type' => 'header'
|
387 |
),
|
388 |
'paypal_email' => array(
|
389 |
+
'id' => 'paypal_email',
|
390 |
'name' => __( 'PayPal Email', 'edd' ),
|
391 |
'desc' => __( 'Enter your PayPal account\'s email', 'edd' ),
|
392 |
'type' => 'text',
|
393 |
'size' => 'regular'
|
394 |
),
|
395 |
'paypal_page_style' => array(
|
396 |
+
'id' => 'paypal_page_style',
|
397 |
'name' => __( 'PayPal Page Style', 'edd' ),
|
398 |
'desc' => __( 'Enter the name of the page style to use, or leave blank for default', 'edd' ),
|
399 |
'type' => 'text',
|
400 |
'size' => 'regular'
|
401 |
),
|
402 |
'disable_paypal_verification' => array(
|
403 |
+
'id' => 'disable_paypal_verification',
|
404 |
'name' => __( 'Disable PayPal IPN Verification', 'edd' ),
|
405 |
'desc' => __( 'If payments are not getting marked as complete, then check this box. This forces the site to use a slightly less secure method of verifying purchases.', 'edd' ),
|
406 |
'type' => 'checkbox'
|
407 |
+
),
|
408 |
)
|
409 |
),
|
410 |
/** Emails Settings */
|
411 |
'emails' => apply_filters('edd_settings_emails',
|
412 |
array(
|
413 |
'email_template' => array(
|
414 |
+
'id' => 'email_template',
|
415 |
+
'name' => __( 'Email Template', 'edd' ),
|
416 |
+
'desc' => __( 'Choose a template. Click "Save Changes" then "Preview Purchase Receipt" to see the new template.', 'edd' ),
|
417 |
+
'type' => 'select',
|
418 |
'options' => edd_get_email_templates()
|
419 |
),
|
420 |
'email_logo' => array(
|
421 |
+
'id' => 'email_logo',
|
422 |
'name' => __( 'Logo', 'edd' ),
|
423 |
'desc' => __( 'Upload or choose a logo to be displayed at the top of the purchase receipt emails. Displayed on HTML emails only.', 'edd' ),
|
424 |
'type' => 'upload'
|
425 |
),
|
426 |
'email_settings' => array(
|
427 |
+
'id' => 'email_settings',
|
428 |
'name' => '',
|
429 |
'desc' => '',
|
430 |
'type' => 'hook'
|
431 |
),
|
432 |
'from_name' => array(
|
433 |
+
'id' => 'from_name',
|
434 |
'name' => __( 'From Name', 'edd' ),
|
435 |
'desc' => __( 'The name purchase receipts are said to come from. This should probably be your site or shop name.', 'edd' ),
|
436 |
'type' => 'text',
|
437 |
'std' => get_bloginfo( 'name' )
|
438 |
),
|
439 |
'from_email' => array(
|
440 |
+
'id' => 'from_email',
|
441 |
'name' => __( 'From Email', 'edd' ),
|
442 |
'desc' => __( 'Email to send purchase receipts from. This will act as the "from" and "reply-to" address.', 'edd' ),
|
443 |
'type' => 'text',
|
444 |
'std' => get_bloginfo( 'admin_email' )
|
445 |
),
|
446 |
'purchase_subject' => array(
|
447 |
+
'id' => 'purchase_subject',
|
448 |
'name' => __( 'Purchase Email Subject', 'edd' ),
|
449 |
'desc' => __( 'Enter the subject line for the purchase receipt email', 'edd' ),
|
450 |
'type' => 'text',
|
451 |
'std' => __( 'Purchase Receipt', 'edd' )
|
452 |
),
|
453 |
+
'purchase_heading' => array(
|
454 |
+
'id' => 'purchase_heading',
|
455 |
+
'name' => __( 'Purchase Email Heading', 'edd' ),
|
456 |
+
'desc' => __( 'Enter the heading for the purchase receipt email', 'edd' ),
|
457 |
+
'type' => 'text',
|
458 |
+
'std' => __( 'Purchase Receipt', 'edd' )
|
459 |
+
),
|
460 |
'purchase_receipt' => array(
|
461 |
+
'id' => 'purchase_receipt',
|
462 |
'name' => __( 'Purchase Receipt', 'edd' ),
|
463 |
'desc' => __('Enter the email that is sent to users after completing a successful purchase. HTML is accepted. Available template tags:', 'edd') . '<br/>' . edd_get_emails_tags_list(),
|
464 |
'type' => 'rich_editor',
|
466 |
),
|
467 |
'sale_notification_header' => array(
|
468 |
'id' => 'sale_notification_header',
|
469 |
+
'name' => '<strong>' . __('New Sale Notifications', 'edd') . '</strong>',
|
470 |
'desc' => __('Configure new sale notification emails', 'edd'),
|
471 |
'type' => 'header'
|
472 |
),
|
473 |
'sale_notification_subject' => array(
|
474 |
+
'id' => 'sale_notification_subject',
|
475 |
'name' => __( 'Sale Notification Subject', 'edd' ),
|
476 |
'desc' => __( 'Enter the subject line for the sale notification email', 'edd' ),
|
477 |
'type' => 'text',
|
478 |
+
'std' => 'New download purchase - Order #{payment_id}'
|
479 |
),
|
480 |
'sale_notification' => array(
|
481 |
+
'id' => 'sale_notification',
|
482 |
'name' => __( 'Sale Notification', 'edd' ),
|
483 |
'desc' => __( 'Enter the email that is sent to sale notification emails after completion of a purchase. HTML is accepted. Available template tags:', 'edd' ) . '<br/>' . edd_get_emails_tags_list(),
|
484 |
'type' => 'rich_editor',
|
485 |
+
'std' => edd_get_default_sale_notification_email()
|
486 |
),
|
487 |
'admin_notice_emails' => array(
|
488 |
+
'id' => 'admin_notice_emails',
|
489 |
'name' => __( 'Sale Notification Emails', 'edd' ),
|
490 |
'desc' => __( 'Enter the email address(es) that should receive a notification anytime a sale is made, one per line', 'edd' ),
|
491 |
'type' => 'textarea',
|
492 |
'std' => get_bloginfo( 'admin_email' )
|
493 |
),
|
494 |
'disable_admin_notices' => array(
|
495 |
+
'id' => 'disable_admin_notices',
|
496 |
'name' => __( 'Disable Admin Notifications', 'edd' ),
|
497 |
'desc' => __( 'Check this box if you do not want to receive emails when new sales are made.', 'edd' ),
|
498 |
'type' => 'checkbox'
|
503 |
'styles' => apply_filters('edd_settings_styles',
|
504 |
array(
|
505 |
'disable_styles' => array(
|
506 |
+
'id' => 'disable_styles',
|
507 |
'name' => __( 'Disable Styles', 'edd' ),
|
508 |
'desc' => __( 'Check this to disable all included styling of buttons, checkout fields, and all other elements.', 'edd' ),
|
509 |
'type' => 'checkbox'
|
510 |
),
|
511 |
'button_header' => array(
|
512 |
'id' => 'button_header',
|
513 |
+
'name' => '<strong>' . __( 'Buttons', 'edd' ) . '</strong>',
|
514 |
'desc' => __( 'Options for add to cart and purchase buttons', 'edd' ),
|
515 |
'type' => 'header'
|
516 |
),
|
517 |
'button_style' => array(
|
518 |
+
'id' => 'button_style',
|
519 |
+
'name' => __( 'Default Button Style', 'edd' ),
|
520 |
+
'desc' => __( 'Choose the style you want to use for the buttons.', 'edd' ),
|
521 |
+
'type' => 'select',
|
522 |
'options' => edd_get_button_styles()
|
523 |
),
|
524 |
'checkout_color' => array(
|
525 |
+
'id' => 'checkout_color',
|
526 |
+
'name' => __( 'Default Button Color', 'edd' ),
|
527 |
+
'desc' => __( 'Choose the color you want to use for the buttons.', 'edd' ),
|
528 |
+
'type' => 'color_select',
|
529 |
'options' => edd_get_button_colors()
|
530 |
)
|
531 |
)
|
534 |
'taxes' => apply_filters('edd_settings_taxes',
|
535 |
array(
|
536 |
'enable_taxes' => array(
|
537 |
+
'id' => 'enable_taxes',
|
538 |
'name' => __( 'Enable Taxes', 'edd' ),
|
539 |
'desc' => __( 'Check this to enable taxes on purchases.', 'edd' ),
|
540 |
'type' => 'checkbox',
|
541 |
),
|
542 |
'tax_rates' => array(
|
543 |
'id' => 'tax_rates',
|
544 |
+
'name' => '<strong>' . __( 'Tax Rates', 'edd' ) . '</strong>',
|
545 |
'desc' => __( 'Enter tax rates for specific regions.', 'edd' ),
|
546 |
'type' => 'tax_rates'
|
547 |
),
|
548 |
'tax_rate' => array(
|
549 |
+
'id' => 'tax_rate',
|
550 |
'name' => __( 'Fallback Tax Rate', 'edd' ),
|
551 |
'desc' => __( 'Enter a percentage, such as 6.5. Customers not in a specific rate will be charged this rate.', 'edd' ),
|
552 |
'type' => 'text',
|
553 |
'size' => 'small'
|
554 |
),
|
555 |
'prices_include_tax' => array(
|
556 |
+
'id' => 'prices_include_tax',
|
557 |
'name' => __( 'Prices entered with tax', 'edd' ),
|
558 |
'desc' => __( 'This option affects how you enter prices.', 'edd' ),
|
559 |
'type' => 'radio',
|
560 |
+
'std' => 'no',
|
561 |
'options' => array(
|
562 |
'yes' => __( 'Yes, I will enter prices inclusive of tax', 'edd' ),
|
563 |
'no' => __( 'No, I will enter prices exclusive of tax', 'edd' )
|
564 |
)
|
565 |
),
|
566 |
'display_tax_rate' => array(
|
567 |
+
'id' => 'display_tax_rate',
|
568 |
'name' => __( 'Display Tax Rate on Prices', 'edd' ),
|
569 |
'desc' => __( 'Some countries require a notice when product prices include tax.', 'edd' ),
|
570 |
'type' => 'checkbox',
|
571 |
),
|
572 |
'checkout_include_tax' => array(
|
573 |
+
'id' => 'checkout_include_tax',
|
574 |
'name' => __( 'Display during checkout', 'edd' ),
|
575 |
'desc' => __( 'Should prices on the checkout page be shown with or without tax?', 'edd' ),
|
576 |
'type' => 'select',
|
577 |
+
'std' => 'no',
|
578 |
'options' => array(
|
579 |
'yes' => __( 'Including tax', 'edd' ),
|
580 |
'no' => __( 'Excluding tax', 'edd' )
|
593 |
'misc' => apply_filters('edd_settings_misc',
|
594 |
array(
|
595 |
'enable_ajax_cart' => array(
|
596 |
+
'id' => 'enable_ajax_cart',
|
597 |
'name' => __( 'Enable Ajax', 'edd' ),
|
598 |
'desc' => __( 'Check this to enable AJAX for the shopping cart.', 'edd' ),
|
599 |
'type' => 'checkbox',
|
600 |
'std' => '1'
|
601 |
),
|
602 |
'redirect_on_add' => array(
|
603 |
+
'id' => 'redirect_on_add',
|
604 |
'name' => __( 'Redirect to Checkout', 'edd' ),
|
605 |
'desc' => __( 'Immediately redirect to checkout after adding an item to the cart?', 'edd' ),
|
606 |
'type' => 'checkbox'
|
607 |
),
|
608 |
'enforce_ssl' => array(
|
609 |
+
'id' => 'enforce_ssl',
|
610 |
'name' => __( 'Enforce SSL on Checkout', 'edd' ),
|
611 |
'desc' => __( 'Check this to force users to be redirected to the secure checkout page. You must have an SSL certificate installed to use this option.', 'edd' ),
|
612 |
'type' => 'checkbox'
|
613 |
),
|
614 |
'logged_in_only' => array(
|
615 |
+
'id' => 'logged_in_only',
|
616 |
'name' => __( 'Disable Guest Checkout', 'edd' ),
|
617 |
'desc' => __( 'Require that users be logged-in to purchase files.', 'edd' ),
|
618 |
'type' => 'checkbox'
|
619 |
),
|
620 |
'show_register_form' => array(
|
621 |
+
'id' => 'show_register_form',
|
622 |
+
'name' => __( 'Show Register / Login Form?', 'edd' ),
|
623 |
+
'desc' => __( 'Display the registration and login forms on the checkout page for non-logged-in users.', 'edd' ),
|
624 |
+
'type' => 'select',
|
625 |
+
'std' => 'none',
|
626 |
'options' => array(
|
627 |
+
'both' => __( 'Registration and Login Forms', 'edd' ),
|
628 |
'registration' => __( 'Registration Form Only', 'edd' ),
|
629 |
+
'login' => __( 'Login Form Only', 'edd' ),
|
630 |
+
'none' => __( 'None', 'edd' )
|
631 |
),
|
|
|
632 |
),
|
633 |
'item_quantities' => array(
|
634 |
+
'id' => 'item_quantities',
|
635 |
'name' => __('Item Quantities', 'edd'),
|
636 |
'desc' => __('Allow item quantities to be changed.', 'edd'),
|
637 |
'type' => 'checkbox'
|
638 |
),
|
639 |
'allow_multiple_discounts' => array(
|
640 |
+
'id' => 'allow_multiple_discounts',
|
641 |
'name' => __('Multiple Discounts', 'edd'),
|
642 |
'desc' => __('Allow customers to use multiple discounts on the same purchase?', 'edd'),
|
643 |
'type' => 'checkbox'
|
644 |
),
|
645 |
'enable_cart_saving' => array(
|
646 |
+
'id' => 'enable_cart_saving',
|
647 |
'name' => __( 'Enable Cart Saving', 'edd' ),
|
648 |
'desc' => __( 'Check this to enable cart saving on the checkout.', 'edd' ),
|
649 |
'type' => 'checkbox'
|
650 |
),
|
651 |
'field_downloads' => array(
|
652 |
'id' => 'field_downloads',
|
653 |
+
'name' => '<strong>' . __( 'File Downloads', 'edd' ) . '</strong>',
|
654 |
'desc' => '',
|
655 |
'type' => 'header'
|
656 |
),
|
657 |
'download_method' => array(
|
658 |
+
'id' => 'download_method',
|
659 |
+
'name' => __( 'Download Method', 'edd' ),
|
660 |
+
'desc' => sprintf( __( 'Select the file download method. Note, not all methods work on all servers.', 'edd' ), edd_get_label_singular() ),
|
661 |
+
'type' => 'select',
|
662 |
'options' => array(
|
663 |
+
'direct' => __( 'Forced', 'edd' ),
|
664 |
'redirect' => __( 'Redirect', 'edd' )
|
665 |
)
|
666 |
),
|
667 |
'symlink_file_downloads' => array(
|
668 |
+
'id' => 'symlink_file_downloads',
|
669 |
'name' => __( 'Symlink File Downloads?', 'edd' ),
|
670 |
'desc' => __( 'Check this if you are delivering really large files or having problems with file downloads completing.', 'edd' ),
|
671 |
'type' => 'checkbox'
|
672 |
),
|
673 |
'file_download_limit' => array(
|
674 |
+
'id' => 'file_download_limit',
|
675 |
'name' => __( 'File Download Limit', 'edd' ),
|
676 |
'desc' => sprintf( __( 'The maximum number of times files can be downloaded for purchases. Can be overwritten for each %s.', 'edd' ), edd_get_label_singular() ),
|
677 |
'type' => 'number',
|
678 |
'size' => 'small'
|
679 |
),
|
680 |
'download_link_expiration' => array(
|
681 |
+
'id' => 'download_link_expiration',
|
682 |
'name' => __( 'Download Link Expiration', 'edd' ),
|
683 |
'desc' => __( 'How long should download links be valid for? Default is 24 hours from the time they are generated. Enter a time in hours.', 'edd' ),
|
684 |
'type' => 'number',
|
687 |
'min' => '0'
|
688 |
),
|
689 |
'disable_redownload' => array(
|
690 |
+
'id' => 'disable_redownload',
|
691 |
'name' => __( 'Disable Redownload?', 'edd' ),
|
692 |
'desc' => __( 'Check this if you do not want to allow users to redownload items from their purchase history.', 'edd' ),
|
693 |
'type' => 'checkbox'
|
694 |
),
|
695 |
'accounting_settings' => array(
|
696 |
'id' => 'accounting_settings',
|
697 |
+
'name' => '<strong>' . __( 'Accounting Settings', 'edd' ) . '</strong>',
|
698 |
'desc' => '',
|
699 |
'type' => 'header'
|
700 |
),
|
701 |
'enable_skus' => array(
|
702 |
+
'id' => 'enable_skus',
|
703 |
'name' => __( 'Enable SKU Entry', 'edd' ),
|
704 |
'desc' => __( 'Check this box to allow entry of product SKUs. SKUs will be shown on purchase receipt and exported purchase histories.', 'edd' ),
|
705 |
'type' => 'checkbox'
|
706 |
),
|
707 |
'enable_sequential' => array(
|
708 |
+
'id' => 'enable_sequential',
|
709 |
'name' => __( 'Sequential Order Numbers', 'edd' ),
|
710 |
+
'desc' => __( 'Check this box to enable sequential order numbers.', 'edd' ),
|
711 |
'type' => 'checkbox'
|
712 |
),
|
713 |
'sequential_start' => array(
|
714 |
+
'id' => 'sequential_start',
|
715 |
'name' => __( 'Sequential Starting Number', 'edd' ),
|
716 |
'desc' => __( 'The number that sequential order numbers should start at.', 'edd' ),
|
717 |
'type' => 'number',
|
719 |
'std' => '1'
|
720 |
),
|
721 |
'sequential_prefix' => array(
|
722 |
+
'id' => 'sequential_prefix',
|
723 |
'name' => __( 'Sequential Number Prefix', 'edd' ),
|
724 |
'desc' => __( 'A prefix to prepend to all sequential order numbers.', 'edd' ),
|
725 |
'type' => 'text'
|
726 |
),
|
727 |
'sequential_postfix' => array(
|
728 |
+
'id' => 'sequential_postfix',
|
729 |
'name' => __( 'Sequential Number Postfix', 'edd' ),
|
730 |
'desc' => __( 'A postfix to append to all sequential order numbers.', 'edd' ),
|
731 |
'type' => 'text',
|
732 |
),
|
733 |
'terms' => array(
|
734 |
'id' => 'terms',
|
735 |
+
'name' => '<strong>' . __( 'Terms of Agreement', 'edd' ) . '</strong>',
|
736 |
'desc' => '',
|
737 |
'type' => 'header'
|
738 |
),
|
739 |
'show_agree_to_terms' => array(
|
740 |
+
'id' => 'show_agree_to_terms',
|
741 |
'name' => __( 'Agree to Terms', 'edd' ),
|
742 |
'desc' => __( 'Check this to show an agree to terms on the checkout that users must agree to before purchasing.', 'edd' ),
|
743 |
'type' => 'checkbox'
|
744 |
),
|
745 |
'agree_label' => array(
|
746 |
+
'id' => 'agree_label',
|
747 |
'name' => __( 'Agree to Terms Label', 'edd' ),
|
748 |
'desc' => __( 'Label shown next to the agree to terms check box.', 'edd' ),
|
749 |
'type' => 'text',
|
750 |
'size' => 'regular'
|
751 |
),
|
752 |
'agree_text' => array(
|
753 |
+
'id' => 'agree_text',
|
754 |
'name' => __( 'Agreement Text', 'edd' ),
|
755 |
'desc' => __( 'If Agree to Terms is checked, enter the agreement terms here.', 'edd' ),
|
756 |
'type' => 'rich_editor'
|
757 |
),
|
758 |
'checkout_label' => array(
|
759 |
+
'id' => 'checkout_label',
|
760 |
'name' => __( 'Complete Purchase Text', 'edd' ),
|
761 |
'desc' => __( 'The button label for completing a purchase.', 'edd' ),
|
762 |
'type' => 'text',
|
763 |
+
'std' => __( 'Purchase', 'edd' )
|
764 |
),
|
765 |
'add_to_cart_text' => array(
|
766 |
+
'id' => 'add_to_cart_text',
|
767 |
'name' => __( 'Add to Cart Text', 'edd' ),
|
768 |
'desc' => __( 'Text shown on the Add to Cart Buttons.', 'edd' ),
|
769 |
'type' => 'text',
|
770 |
'std' => __( 'Add to Cart', 'edd' )
|
771 |
+
),
|
772 |
+
'buy_now_text' => array(
|
773 |
+
'id' => 'buy_now_text',
|
774 |
+
'name' => __( 'Buy Now Text', 'edd' ),
|
775 |
+
'desc' => __( 'Text shown on the Buy Now Buttons.', 'edd' ),
|
776 |
+
'type' => 'text',
|
777 |
+
'std' => __( 'Buy Now', 'edd' )
|
778 |
)
|
779 |
)
|
780 |
)
|
999 |
function edd_checkbox_callback( $args ) {
|
1000 |
global $edd_options;
|
1001 |
|
1002 |
+
if ( isset( $args['faux'] ) && true === $args['faux'] ) {
|
1003 |
+
$name = '';
|
1004 |
+
} else {
|
1005 |
+
$name = 'name="edd_settings[' . $args['id'] . ']"';
|
1006 |
+
}
|
1007 |
+
|
1008 |
$checked = isset( $edd_options[ $args['id'] ] ) ? checked( 1, $edd_options[ $args['id'] ], false ) : '';
|
1009 |
+
$html = '<input type="checkbox" id="edd_settings[' . $args['id'] . ']"' . $name . ' value="1" ' . $checked . '/>';
|
1010 |
$html .= '<label for="edd_settings[' . $args['id'] . ']"> ' . $args['desc'] . '</label>';
|
1011 |
|
1012 |
echo $html;
|
1188 |
function edd_text_callback( $args ) {
|
1189 |
global $edd_options;
|
1190 |
|
1191 |
+
if ( isset( $edd_options[ $args['id'] ] ) ) {
|
1192 |
$value = $edd_options[ $args['id'] ];
|
1193 |
+
} else {
|
1194 |
$value = isset( $args['std'] ) ? $args['std'] : '';
|
1195 |
+
}
|
1196 |
|
1197 |
+
if ( isset( $args['faux'] ) && true === $args['faux'] ) {
|
1198 |
+
$args['readonly'] = true;
|
1199 |
+
$value = isset( $args['std'] ) ? $args['std'] : '';
|
1200 |
+
$name = '';
|
1201 |
+
} else {
|
1202 |
+
$name = 'name="edd_settings[' . $args['id'] . ']"';
|
1203 |
+
}
|
1204 |
+
|
1205 |
+
$readonly = $args['readonly'] === true ? ' readonly="readonly"' : '';
|
1206 |
+
$size = ( isset( $args['size'] ) && ! is_null( $args['size'] ) ) ? $args['size'] : 'regular';
|
1207 |
+
$html = '<input type="text" class="' . $size . '-text" id="edd_settings[' . $args['id'] . ']"' . $name . ' value="' . esc_attr( stripslashes( $value ) ) . '"' . $readonly . '/>';
|
1208 |
+
$html .= '<label for="edd_settings[' . $args['id'] . ']"> ' . $args['desc'] . '</label>';
|
1209 |
|
1210 |
echo $html;
|
1211 |
}
|
1223 |
function edd_number_callback( $args ) {
|
1224 |
global $edd_options;
|
1225 |
|
1226 |
+
if ( isset( $edd_options[ $args['id'] ] ) ) {
|
1227 |
$value = $edd_options[ $args['id'] ];
|
1228 |
+
} else {
|
1229 |
$value = isset( $args['std'] ) ? $args['std'] : '';
|
1230 |
+
}
|
1231 |
+
|
1232 |
+
if ( isset( $args['faux'] ) && true === $args['faux'] ) {
|
1233 |
+
$args['readonly'] = true;
|
1234 |
+
$value = isset( $args['std'] ) ? $args['std'] : '';
|
1235 |
+
$name = '';
|
1236 |
+
} else {
|
1237 |
+
$name = 'name="edd_settings[' . $args['id'] . ']"';
|
1238 |
+
}
|
1239 |
|
1240 |
$max = isset( $args['max'] ) ? $args['max'] : 999999;
|
1241 |
$min = isset( $args['min'] ) ? $args['min'] : 0;
|
1242 |
$step = isset( $args['step'] ) ? $args['step'] : 1;
|
1243 |
|
1244 |
$size = ( isset( $args['size'] ) && ! is_null( $args['size'] ) ) ? $args['size'] : 'regular';
|
1245 |
+
$html = '<input type="number" step="' . esc_attr( $step ) . '" max="' . esc_attr( $max ) . '" min="' . esc_attr( $min ) . '" class="' . $size . '-text" id="edd_settings[' . $args['id'] . ']" ' . $name . ' value="' . esc_attr( stripslashes( $value ) ) . '"/>';
|
1246 |
$html .= '<label for="edd_settings[' . $args['id'] . ']"> ' . $args['desc'] . '</label>';
|
1247 |
|
1248 |
echo $html;
|
1261 |
function edd_textarea_callback( $args ) {
|
1262 |
global $edd_options;
|
1263 |
|
1264 |
+
if ( isset( $edd_options[ $args['id'] ] ) ) {
|
1265 |
$value = $edd_options[ $args['id'] ];
|
1266 |
+
} else {
|
1267 |
$value = isset( $args['std'] ) ? $args['std'] : '';
|
1268 |
+
}
|
1269 |
|
1270 |
$html = '<textarea class="large-text" cols="50" rows="5" id="edd_settings[' . $args['id'] . ']" name="edd_settings[' . $args['id'] . ']">' . esc_textarea( stripslashes( $value ) ) . '</textarea>';
|
1271 |
$html .= '<label for="edd_settings[' . $args['id'] . ']"> ' . $args['desc'] . '</label>';
|
1286 |
function edd_password_callback( $args ) {
|
1287 |
global $edd_options;
|
1288 |
|
1289 |
+
if ( isset( $edd_options[ $args['id'] ] ) ) {
|
1290 |
$value = $edd_options[ $args['id'] ];
|
1291 |
+
} else {
|
1292 |
$value = isset( $args['std'] ) ? $args['std'] : '';
|
1293 |
+
}
|
1294 |
|
1295 |
$size = ( isset( $args['size'] ) && ! is_null( $args['size'] ) ) ? $args['size'] : 'regular';
|
1296 |
$html = '<input type="password" class="' . $size . '-text" id="edd_settings[' . $args['id'] . ']" name="edd_settings[' . $args['id'] . ']" value="' . esc_attr( $value ) . '"/>';
|
1325 |
function edd_select_callback($args) {
|
1326 |
global $edd_options;
|
1327 |
|
1328 |
+
if ( isset( $edd_options[ $args['id'] ] ) ) {
|
1329 |
$value = $edd_options[ $args['id'] ];
|
1330 |
+
} else {
|
1331 |
$value = isset( $args['std'] ) ? $args['std'] : '';
|
1332 |
+
}
|
1333 |
|
1334 |
+
if ( isset( $args['placeholder'] ) ) {
|
1335 |
+
$placeholder = $args['placeholder'];
|
1336 |
+
} else {
|
1337 |
$placeholder = '';
|
1338 |
+
}
|
1339 |
|
1340 |
+
if ( isset( $args['chosen'] ) ) {
|
1341 |
$chosen = 'class="edd-chosen"';
|
1342 |
+
} else {
|
1343 |
$chosen = '';
|
1344 |
+
}
|
1345 |
|
1346 |
+
$html = '<select id="edd_settings[' . $args['id'] . ']" name="edd_settings[' . $args['id'] . ']" ' . $chosen . 'data-placeholder="' . $placeholder . '" />';
|
1347 |
|
1348 |
+
foreach ( $args['options'] as $option => $name ) {
|
1349 |
$selected = selected( $option, $value, false );
|
1350 |
$html .= '<option value="' . $option . '" ' . $selected . '>' . $name . '</option>';
|
1351 |
+
}
|
1352 |
|
1353 |
$html .= '</select>';
|
1354 |
$html .= '<label for="edd_settings[' . $args['id'] . ']"> ' . $args['desc'] . '</label>';
|
1369 |
function edd_color_select_callback( $args ) {
|
1370 |
global $edd_options;
|
1371 |
|
1372 |
+
if ( isset( $edd_options[ $args['id'] ] ) ) {
|
1373 |
$value = $edd_options[ $args['id'] ];
|
1374 |
+
} else {
|
1375 |
$value = isset( $args['std'] ) ? $args['std'] : '';
|
1376 |
+
}
|
1377 |
|
1378 |
$html = '<select id="edd_settings[' . $args['id'] . ']" name="edd_settings[' . $args['id'] . ']"/>';
|
1379 |
|
1380 |
+
foreach ( $args['options'] as $option => $color ) {
|
1381 |
$selected = selected( $option, $value, false );
|
1382 |
$html .= '<option value="' . $option . '" ' . $selected . '>' . $color['label'] . '</option>';
|
1383 |
+
}
|
1384 |
|
1385 |
$html .= '</select>';
|
1386 |
$html .= '<label for="edd_settings[' . $args['id'] . ']"> ' . $args['desc'] . '</label>';
|
1439 |
function edd_upload_callback( $args ) {
|
1440 |
global $edd_options;
|
1441 |
|
1442 |
+
if ( isset( $edd_options[ $args['id'] ] ) ) {
|
1443 |
$value = $edd_options[$args['id']];
|
1444 |
+
} else {
|
1445 |
$value = isset($args['std']) ? $args['std'] : '';
|
1446 |
+
}
|
1447 |
|
1448 |
$size = ( isset( $args['size'] ) && ! is_null( $args['size'] ) ) ? $args['size'] : 'regular';
|
1449 |
$html = '<input type="text" class="' . $size . '-text" id="edd_settings[' . $args['id'] . ']" name="edd_settings[' . $args['id'] . ']" value="' . esc_attr( stripslashes( $value ) ) . '"/>';
|
1467 |
function edd_color_callback( $args ) {
|
1468 |
global $edd_options;
|
1469 |
|
1470 |
+
if ( isset( $edd_options[ $args['id'] ] ) ) {
|
1471 |
$value = $edd_options[ $args['id'] ];
|
1472 |
+
} else {
|
1473 |
$value = isset( $args['std'] ) ? $args['std'] : '';
|
1474 |
+
}
|
1475 |
|
1476 |
$default = isset( $args['std'] ) ? $args['std'] : '';
|
1477 |
|
1495 |
function edd_shop_states_callback($args) {
|
1496 |
global $edd_options;
|
1497 |
|
1498 |
+
if ( isset( $args['placeholder'] ) ) {
|
1499 |
+
$placeholder = $args['placeholder'];
|
1500 |
+
} else {
|
1501 |
+
$placeholder = '';
|
1502 |
+
}
|
1503 |
|
1504 |
$states = edd_get_shop_states();
|
1505 |
|
1506 |
+
$chosen = ( $args['chosen'] ? ' edd-chosen' : '' );
|
1507 |
+
$class = empty( $states ) ? ' class="edd-no-states' . $chosen . '"' : 'class="' . $chosen . '"';
|
1508 |
+
$html = '<select id="edd_settings[' . $args['id'] . ']" name="edd_settings[' . $args['id'] . ']"' . $class . 'data-placeholder="' . $placeholder . '"/>';
|
1509 |
|
1510 |
+
foreach ( $states as $option => $name ) {
|
1511 |
$selected = isset( $edd_options[ $args['id'] ] ) ? selected( $option, $edd_options[$args['id']], false ) : '';
|
1512 |
$html .= '<option value="' . $option . '" ' . $selected . '>' . $name . '</option>';
|
1513 |
+
}
|
1514 |
|
1515 |
$html .= '</select>';
|
1516 |
$html .= '<label for="edd_settings[' . $args['id'] . ']"> ' . $args['desc'] . '</label>';
|
1554 |
'selected' => $rate['country'],
|
1555 |
'show_option_all' => false,
|
1556 |
'show_option_none' => false,
|
1557 |
+
'class' => 'edd-select edd-tax-country',
|
1558 |
+
'chosen' => false,
|
1559 |
+
'placeholder' => __( 'Choose a country', 'edd' )
|
1560 |
) );
|
1561 |
?>
|
1562 |
</td>
|
1569 |
'name' => 'tax_rates[' . $key . '][state]',
|
1570 |
'selected' => $rate['state'],
|
1571 |
'show_option_all' => false,
|
1572 |
+
'show_option_none' => false,
|
1573 |
+
'chosen' => false,
|
1574 |
+
'placeholder' => __( 'Choose a state', 'edd' )
|
1575 |
) );
|
1576 |
} else {
|
1577 |
echo EDD()->html->text( array(
|
1597 |
'name' => 'tax_rates[0][country]',
|
1598 |
'show_option_all' => false,
|
1599 |
'show_option_none' => false,
|
1600 |
+
'class' => 'edd-select edd-tax-country',
|
1601 |
+
'chosen' => false,
|
1602 |
+
'placeholder' => __( 'Choose a country', 'edd' )
|
1603 |
) ); ?>
|
1604 |
</td>
|
1605 |
<td class="edd_tax_state">
|
1633 |
* @return void
|
1634 |
*/
|
1635 |
function edd_descriptive_text_callback( $args ) {
|
1636 |
+
echo wp_kses_post( $args['desc'] );
|
1637 |
}
|
1638 |
|
1639 |
/**
|
1648 |
function edd_license_key_callback( $args ) {
|
1649 |
global $edd_options;
|
1650 |
|
1651 |
+
if ( isset( $edd_options[ $args['id'] ] ) ) {
|
1652 |
$value = $edd_options[ $args['id'] ];
|
1653 |
+
} else {
|
1654 |
$value = isset( $args['std'] ) ? $args['std'] : '';
|
1655 |
+
}
|
1656 |
|
1657 |
$size = ( isset( $args['size'] ) && ! is_null( $args['size'] ) ) ? $args['size'] : 'regular';
|
1658 |
$html = '<input type="text" class="' . $size . '-text" id="edd_settings[' . $args['id'] . ']" name="edd_settings[' . $args['id'] . ']" value="' . esc_attr( $value ) . '"/>';
|
includes/admin/tools.php
CHANGED
@@ -196,18 +196,22 @@ function edd_tools_banned_emails_save() {
|
|
196 |
return;
|
197 |
}
|
198 |
|
199 |
-
|
200 |
-
|
201 |
-
|
202 |
-
|
203 |
-
|
204 |
-
|
205 |
-
|
206 |
-
|
207 |
-
if( $email
|
208 |
-
|
|
|
|
|
209 |
}
|
210 |
}
|
|
|
|
|
211 |
}
|
212 |
|
213 |
$edd_options['banned_emails'] = $emails;
|
@@ -474,7 +478,8 @@ function edd_tools_sysinfo_get() {
|
|
474 |
|
475 |
$return .= 'Remote Post: ' . $WP_REMOTE_POST . "\n";
|
476 |
$return .= 'Table Prefix: ' . 'Length: ' . strlen( $wpdb->prefix ) . ' Status: ' . ( strlen( $wpdb->prefix ) > 16 ? 'ERROR: Too long' : 'Acceptable' ) . "\n";
|
477 |
-
|
|
|
478 |
$return .= 'WP_DEBUG: ' . ( defined( 'WP_DEBUG' ) ? WP_DEBUG ? 'Enabled' : 'Disabled' : 'Not set' ) . "\n";
|
479 |
$return .= 'Memory Limit: ' . WP_MEMORY_LIMIT . "\n";
|
480 |
$return .= 'Registered Post Stati: ' . implode( ', ', get_post_stati() ) . "\n";
|
196 |
return;
|
197 |
}
|
198 |
|
199 |
+
if( ! empty( $_POST['banned_emails'] ) ) {
|
200 |
+
|
201 |
+
// Sanitize the input
|
202 |
+
$emails = array_map( 'trim', explode( "\n", $_POST['banned_emails'] ) );
|
203 |
+
$emails = array_unique( $emails );
|
204 |
+
$emails = array_map( 'sanitize_text_field', $emails );
|
205 |
+
|
206 |
+
foreach( $emails as $id => $email ) {
|
207 |
+
if( ! is_email( $email ) ) {
|
208 |
+
if( $email[0] != '@' ) {
|
209 |
+
unset( $emails[$id] );
|
210 |
+
}
|
211 |
}
|
212 |
}
|
213 |
+
} else {
|
214 |
+
$emails = '';
|
215 |
}
|
216 |
|
217 |
$edd_options['banned_emails'] = $emails;
|
478 |
|
479 |
$return .= 'Remote Post: ' . $WP_REMOTE_POST . "\n";
|
480 |
$return .= 'Table Prefix: ' . 'Length: ' . strlen( $wpdb->prefix ) . ' Status: ' . ( strlen( $wpdb->prefix ) > 16 ? 'ERROR: Too long' : 'Acceptable' ) . "\n";
|
481 |
+
// Commented out per https://github.com/easydigitaldownloads/Easy-Digital-Downloads/issues/3475
|
482 |
+
//$return .= 'Admin AJAX: ' . ( edd_test_ajax_works() ? 'Accessible' : 'Inaccessible' ) . "\n";
|
483 |
$return .= 'WP_DEBUG: ' . ( defined( 'WP_DEBUG' ) ? WP_DEBUG ? 'Enabled' : 'Disabled' : 'Not set' ) . "\n";
|
484 |
$return .= 'Memory Limit: ' . WP_MEMORY_LIMIT . "\n";
|
485 |
$return .= 'Registered Post Stati: ' . implode( ', ', get_post_stati() ) . "\n";
|
includes/admin/tracking.php
CHANGED
@@ -53,8 +53,7 @@ class EDD_Tracking {
|
|
53 |
*/
|
54 |
private function tracking_allowed() {
|
55 |
$allow_tracking = edd_get_option( 'allow_tracking', false );
|
56 |
-
|
57 |
-
return isset( $allow_tracking );
|
58 |
}
|
59 |
|
60 |
/**
|
53 |
*/
|
54 |
private function tracking_allowed() {
|
55 |
$allow_tracking = edd_get_option( 'allow_tracking', false );
|
56 |
+
return $allow_tracking;
|
|
|
57 |
}
|
58 |
|
59 |
/**
|
includes/admin/upgrades/upgrade-functions.php
CHANGED
@@ -124,6 +124,13 @@ function edd_show_upgrade_notices() {
|
|
124 |
);
|
125 |
}
|
126 |
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
127 |
/*
|
128 |
* NOTICE:
|
129 |
*
|
@@ -984,3 +991,88 @@ function edd_v23_upgrade_customer_purchases() {
|
|
984 |
}
|
985 |
}
|
986 |
add_action( 'edd_upgrade_customer_payments_association', 'edd_v23_upgrade_customer_purchases' );
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
124 |
);
|
125 |
}
|
126 |
|
127 |
+
if ( version_compare( $edd_version, '2.4', '<' ) || ! edd_has_upgrade_completed( 'upgrade_user_api_keys' ) ) {
|
128 |
+
printf(
|
129 |
+
'<div class="updated"><p>' . __( 'Easy Digital Downloads needs to upgrade the API Key database, click <a href="%s">here</a> to start the upgrade.', 'edd' ) . '</p></div>',
|
130 |
+
esc_url( admin_url( 'index.php?page=edd-upgrades&edd-upgrade=upgrade_user_api_keys' ) )
|
131 |
+
);
|
132 |
+
}
|
133 |
+
|
134 |
/*
|
135 |
* NOTICE:
|
136 |
*
|
991 |
}
|
992 |
}
|
993 |
add_action( 'edd_upgrade_customer_payments_association', 'edd_v23_upgrade_customer_purchases' );
|
994 |
+
|
995 |
+
/**
|
996 |
+
* Upgrade the Usermeta API Key storage to swap keys/values for performance
|
997 |
+
*
|
998 |
+
* @since 2.4
|
999 |
+
* @return void
|
1000 |
+
*/
|
1001 |
+
function edd_upgrade_user_api_keys() {
|
1002 |
+
global $wpdb;
|
1003 |
+
|
1004 |
+
if( ! current_user_can( 'manage_shop_settings' ) ) {
|
1005 |
+
wp_die( __( 'You do not have permission to do shop upgrades', 'edd' ), __( 'Error', 'edd' ), array( 'response' => 403 ) );
|
1006 |
+
}
|
1007 |
+
|
1008 |
+
ignore_user_abort( true );
|
1009 |
+
|
1010 |
+
if ( ! edd_is_func_disabled( 'set_time_limit' ) && ! ini_get( 'safe_mode' ) ) {
|
1011 |
+
@set_time_limit(0);
|
1012 |
+
}
|
1013 |
+
|
1014 |
+
$step = isset( $_GET['step'] ) ? absint( $_GET['step'] ) : 1;
|
1015 |
+
$number = 10;
|
1016 |
+
$offset = $step == 1 ? 0 : ( $step - 1 ) * $number;
|
1017 |
+
|
1018 |
+
if ( $step < 2 ) {
|
1019 |
+
// Check if we have any users with API Keys before moving on
|
1020 |
+
$sql = "SELECT user_id FROM $wpdb->usermeta WHERE meta_key = 'edd_user_public_key' LIMIT 1";
|
1021 |
+
$has_key = $wpdb->get_col( $sql );
|
1022 |
+
|
1023 |
+
if( empty( $has_key ) ) {
|
1024 |
+
// We had no key, just complete
|
1025 |
+
update_option( 'edd_version', preg_replace( '/[^0-9.].*/', '', EDD_VERSION ) );
|
1026 |
+
edd_set_upgrade_complete( 'upgrade_user_api_keys' );
|
1027 |
+
delete_option( 'edd_doing_upgrade' );
|
1028 |
+
wp_redirect( admin_url() ); exit;
|
1029 |
+
}
|
1030 |
+
}
|
1031 |
+
|
1032 |
+
$total = isset( $_GET['total'] ) ? absint( $_GET['total'] ) : false;
|
1033 |
+
|
1034 |
+
if ( empty( $total ) || $total <= 1 ) {
|
1035 |
+
$total = $wpdb->get_var( "SELECT count(user_id) FROM $wpdb->usermeta WHERE meta_key = 'edd_user_public_key'" );
|
1036 |
+
}
|
1037 |
+
|
1038 |
+
$keys_sql = $wpdb->prepare( "SELECT user_id, meta_key, meta_value FROM $wpdb->usermeta WHERE meta_key = 'edd_user_public_key' OR meta_key = 'edd_user_secret_key' ORDER BY user_id ASC LIMIT %d,%d;", $offset, $number );
|
1039 |
+
$found_keys = $wpdb->get_results( $keys_sql );
|
1040 |
+
|
1041 |
+
if( ! empty( $found_keys ) ) {
|
1042 |
+
|
1043 |
+
|
1044 |
+
foreach( $found_keys as $key ) {
|
1045 |
+
$user_id = $key->user_id;
|
1046 |
+
$meta_key = $key->meta_key;
|
1047 |
+
$meta_value = $key->meta_value;
|
1048 |
+
|
1049 |
+
// Generate a new entry
|
1050 |
+
update_user_meta( $user_id, $meta_value, $meta_key );
|
1051 |
+
|
1052 |
+
// Delete the old one
|
1053 |
+
delete_user_meta( $user_id, $meta_key );
|
1054 |
+
|
1055 |
+
}
|
1056 |
+
|
1057 |
+
// More Payments found so upgrade them
|
1058 |
+
$step++;
|
1059 |
+
$redirect = add_query_arg( array(
|
1060 |
+
'page' => 'edd-upgrades',
|
1061 |
+
'edd-upgrade' => 'upgrade_user_api_keys',
|
1062 |
+
'step' => $step,
|
1063 |
+
'number' => $number,
|
1064 |
+
'total' => $total
|
1065 |
+
), admin_url( 'index.php' ) );
|
1066 |
+
wp_redirect( $redirect ); exit;
|
1067 |
+
} else {
|
1068 |
+
|
1069 |
+
// No more customers found, finish up
|
1070 |
+
|
1071 |
+
update_option( 'edd_version', preg_replace( '/[^0-9.].*/', '', EDD_VERSION ) );
|
1072 |
+
edd_set_upgrade_complete( 'upgrade_user_api_keys' );
|
1073 |
+
delete_option( 'edd_doing_upgrade' );
|
1074 |
+
|
1075 |
+
wp_redirect( admin_url() ); exit;
|
1076 |
+
}
|
1077 |
+
}
|
1078 |
+
add_action( 'edd_upgrade_user_api_keys', 'edd_upgrade_user_api_keys' );
|
includes/admin/welcome.php
CHANGED
@@ -176,49 +176,56 @@ class EDD_Welcome {
|
|
176 |
<?php $this->tabs(); ?>
|
177 |
|
178 |
<div class="changelog">
|
179 |
-
<h3><?php _e( '
|
180 |
|
181 |
<div class="feature-section">
|
182 |
|
183 |
-
<p><?php _e( '
|
184 |
|
185 |
-
<img src="<?php echo EDD_PLUGIN_URL . 'assets/images/screenshots/
|
186 |
|
187 |
-
<h4><?php _e( '
|
188 |
-
<p><?php _e( '
|
189 |
|
190 |
-
<h4><?php _e( '
|
191 |
-
<p><?php _e( '
|
192 |
|
193 |
-
<h4><?php _e( '
|
194 |
-
<p><?php _e( '
|
195 |
|
196 |
</div>
|
197 |
</div>
|
198 |
|
199 |
<div class="changelog">
|
200 |
-
<h3><?php _e( '
|
201 |
|
202 |
<div class="feature-section">
|
203 |
|
204 |
-
<p><?php _e( '
|
205 |
-
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
206 |
|
207 |
</div>
|
208 |
</div>
|
209 |
|
210 |
<div class="changelog">
|
211 |
-
<h3><?php _e( 'Improved
|
212 |
|
213 |
<div class="feature-section">
|
214 |
|
215 |
-
<img src="<?php echo EDD_PLUGIN_URL . 'assets/images/screenshots/
|
216 |
|
217 |
-
<h4><?php _e( '
|
218 |
-
<p><?php _e( '
|
219 |
|
220 |
-
<h4><?php _e( '
|
221 |
-
<p><?php _e( '
|
222 |
|
223 |
</div>
|
224 |
</div>
|
@@ -229,28 +236,31 @@ class EDD_Welcome {
|
|
229 |
<div class="feature-section col three-col">
|
230 |
<div>
|
231 |
|
232 |
-
<h4><?php _e( '
|
233 |
-
<p><?php _e( '
|
234 |
|
235 |
-
<h4><?php _e( '
|
236 |
-
<p><?php _e( '
|
237 |
|
238 |
</div>
|
239 |
|
240 |
<div>
|
241 |
|
242 |
-
<h4><?php _e( '
|
243 |
-
<p><?php _e( '
|
244 |
|
245 |
-
<h4><?php _e( '
|
246 |
-
<p><?php _e( '
|
247 |
|
248 |
</div>
|
249 |
|
250 |
<div class="last-feature">
|
251 |
|
252 |
-
<h4><?php _e( '
|
253 |
-
<p><?php _e( '
|
|
|
|
|
|
|
254 |
|
255 |
</div>
|
256 |
|
176 |
<?php $this->tabs(); ?>
|
177 |
|
178 |
<div class="changelog">
|
179 |
+
<h3><?php _e( 'Amazon Payments', 'edd' );?></h3>
|
180 |
|
181 |
<div class="feature-section">
|
182 |
|
183 |
+
<p><?php _e( 'With Easy Digital Downloads version 2.4, you can now accept payments through Amazon\'s Login and Pay with the new built-in payment gateway.', 'edd' );?></p>
|
184 |
|
185 |
+
<img src="<?php echo EDD_PLUGIN_URL . 'assets/images/screenshots/24-checkout.png'; ?>" class="edd-welcome-screenshots"/>
|
186 |
|
187 |
+
<h4><?php _e( 'Secure Checkout', 'edd' );?></h4>
|
188 |
+
<p><?php _e( 'When using Amazon Payments, credit / debit card details are entered on Amazon\'s secure servers and never pass through your own server, making the entire process dramatically more secure and reliable.', 'edd' );?></p>
|
189 |
|
190 |
+
<h4><?php _e( 'Accept Credit and Debit Card Payments', 'edd' );?></h4>
|
191 |
+
<p><?php _e( 'Amazon Payments allows your customers to easily pay with their debit or credit cards. During checkout, customers will be provided an option to use a stored card or enter a new one.', 'edd' );?></p>
|
192 |
|
193 |
+
<h4><?php _e( 'Simple Customer Authentication', 'edd' );?></h4>
|
194 |
+
<p><?php _e( 'Customers can log into their Amazon account from your checkout screen and have all of their billing details retrieved automatically from Amazon. With just a few clicks, customers can effortlessly complete their purchase.', 'edd' );?></p>
|
195 |
|
196 |
</div>
|
197 |
</div>
|
198 |
|
199 |
<div class="changelog">
|
200 |
+
<h3><?php _e( 'Earnings / Sales By Category', 'edd' );?></h3>
|
201 |
|
202 |
<div class="feature-section">
|
203 |
|
204 |
+
<p><?php _e( 'Easy Digital Downloads version 2.4 introduces a new Report that displays earnings and sales for your product categories.', 'edd' );?></p>
|
205 |
+
|
206 |
+
<img src="<?php echo EDD_PLUGIN_URL . 'assets/images/screenshots/24-category-earnings.png'; ?>" class="edd-welcome-screenshots"/>
|
207 |
+
|
208 |
+
<h4><?php _e( 'Earnings and Sales Overview', 'edd' );?></h4>
|
209 |
+
<p><?php _e( 'Quickly see how each of your categories has performed over the lifetime of your store. The total sales and earnings are displayed, as well as the average monthly sales and earnings for each category.', 'edd' );?></p>
|
210 |
+
|
211 |
+
<h4><?php _e( 'Category Sales / Earnings Mix', 'edd' );?></h4>
|
212 |
+
<p><?php _e( 'The report includes a visual break down of the sales / earnings mix for your categories. Quickly see which categories account for the highest (or lowest) percentage of your sales and earnings.', 'edd' );?></p>
|
213 |
|
214 |
</div>
|
215 |
</div>
|
216 |
|
217 |
<div class="changelog">
|
218 |
+
<h3><?php _e( 'Improved Data Export', 'edd' );?></h3>
|
219 |
|
220 |
<div class="feature-section">
|
221 |
|
222 |
+
<img src="<?php echo EDD_PLUGIN_URL . 'assets/images/screenshots/24-export.png'; ?>" class="edd-welcome-screenshots"/>
|
223 |
|
224 |
+
<h4><?php _e( 'Big Data Support', 'edd' );?></h4>
|
225 |
+
<p><?php _e( 'With the new export processing in Easy Digital Downloads 2.4, you can easily export massive amounts of data. Need to export 20,000 payment records? No problem.', 'edd' );?></p>
|
226 |
|
227 |
+
<h4><?php _e( 'Standardized Customer Export', 'edd' );?></h4>
|
228 |
+
<p><?php _e( 'The Customer export has been standarized so it now produces the same data during export for all export options. It can also easily handle 20,000 or even 50,000 customer records in a single export.', 'edd' );?></p>
|
229 |
|
230 |
</div>
|
231 |
</div>
|
236 |
<div class="feature-section col three-col">
|
237 |
<div>
|
238 |
|
239 |
+
<h4><?php _e( 'REST API Versioning', 'edd' );?></h4>
|
240 |
+
<p><?php _e( 'The REST API now supports a version parameter that allows you to specify which version of the API you wish to use.', 'edd' );?></p>
|
241 |
|
242 |
+
<h4><?php _e( 'Better Cart Tax Display', 'edd' );?></h4>
|
243 |
+
<p><?php _e( 'Cart widgets now display estimated taxes for customers before reaching the checkout page.', 'edd' );?></p>
|
244 |
|
245 |
</div>
|
246 |
|
247 |
<div>
|
248 |
|
249 |
+
<h4><?php _e( 'Customer > User Synchronization', 'edd' );?></h4>
|
250 |
+
<p><?php _e( 'Customer email addresses are now updated when the associated user account\'s email is changed.' ,'edd' );?></p>
|
251 |
|
252 |
+
<h4><?php _e( 'Better Test Mode Settings', 'edd' );?></h4>
|
253 |
+
<p><?php _e( 'Test Mode has been improved by moving the option to the Payment Gateways screen. Sales / earnings stats are now incremented in test mode.', 'edd' );?></p>
|
254 |
|
255 |
</div>
|
256 |
|
257 |
<div class="last-feature">
|
258 |
|
259 |
+
<h4><?php _e( 'Exclude Taxes from Reports', 'edd' );?></h4>
|
260 |
+
<p><?php _e( 'Earnings and sales reports can now be shown exclusive of tax, allowing you to easily see how your store is performing after taxes.', 'edd' );?></p>
|
261 |
+
|
262 |
+
<h4><?php _e( 'Default Gateway First', 'edd' );?></h4>
|
263 |
+
<p><?php _e( 'The gateway selected as the default option will always be displayed first on checkout.' ,'edd' );?></p>
|
264 |
|
265 |
</div>
|
266 |
|
includes/ajax-functions.php
CHANGED
@@ -151,6 +151,11 @@ function edd_ajax_remove_from_cart() {
|
|
151 |
'cart_quantity' => html_entity_decode( edd_get_cart_quantity() ),
|
152 |
);
|
153 |
|
|
|
|
|
|
|
|
|
|
|
154 |
echo json_encode( $return );
|
155 |
|
156 |
}
|
@@ -214,6 +219,11 @@ function edd_ajax_add_to_cart() {
|
|
214 |
'cart_quantity' => html_entity_decode( edd_get_cart_quantity() )
|
215 |
);
|
216 |
|
|
|
|
|
|
|
|
|
|
|
217 |
echo json_encode( $return );
|
218 |
}
|
219 |
edd_die();
|
@@ -253,7 +263,18 @@ function edd_ajax_apply_discount() {
|
|
253 |
'code' => $discount_code
|
254 |
);
|
255 |
|
256 |
-
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
257 |
$discount = edd_get_discount_by_code( $discount_code );
|
258 |
$amount = edd_format_discount_rate( edd_get_discount_type( $discount->ID ), edd_get_discount_amount( $discount->ID ) );
|
259 |
$discounts = edd_set_cart_discount( $discount_code );
|
@@ -405,10 +426,15 @@ function edd_ajax_recalculate_taxes() {
|
|
405 |
|
406 |
ob_start();
|
407 |
edd_checkout_cart();
|
408 |
-
$cart
|
409 |
$response = array(
|
410 |
-
'html'
|
411 |
-
'
|
|
|
|
|
|
|
|
|
|
|
412 |
);
|
413 |
|
414 |
echo json_encode( $response );
|
151 |
'cart_quantity' => html_entity_decode( edd_get_cart_quantity() ),
|
152 |
);
|
153 |
|
154 |
+
if ( edd_use_taxes() ) {
|
155 |
+
$cart_tax = (float) edd_get_cart_tax();
|
156 |
+
$return['tax'] = html_entity_decode( edd_currency_filter( edd_format_amount( $cart_tax ) ), ENT_COMPAT, 'UTF-8' );
|
157 |
+
}
|
158 |
+
|
159 |
echo json_encode( $return );
|
160 |
|
161 |
}
|
219 |
'cart_quantity' => html_entity_decode( edd_get_cart_quantity() )
|
220 |
);
|
221 |
|
222 |
+
if ( edd_use_taxes() ) {
|
223 |
+
$cart_tax = (float) edd_get_cart_tax();
|
224 |
+
$return['tax'] = html_entity_decode( edd_currency_filter( edd_format_amount( $cart_tax ) ), ENT_COMPAT, 'UTF-8' );
|
225 |
+
}
|
226 |
+
|
227 |
echo json_encode( $return );
|
228 |
}
|
229 |
edd_die();
|
263 |
'code' => $discount_code
|
264 |
);
|
265 |
|
266 |
+
$user = '';
|
267 |
+
|
268 |
+
if ( is_user_logged_in() ) {
|
269 |
+
$user = get_current_user_id();
|
270 |
+
} else {
|
271 |
+
$form = maybe_unserialize( $_POST['form'] );
|
272 |
+
if ( ! empty( $form['edd_email'] ) ) {
|
273 |
+
$user = urldecode( $form['edd_email'] );
|
274 |
+
}
|
275 |
+
}
|
276 |
+
|
277 |
+
if ( edd_is_discount_valid( $discount_code, $user ) ) {
|
278 |
$discount = edd_get_discount_by_code( $discount_code );
|
279 |
$amount = edd_format_discount_rate( edd_get_discount_type( $discount->ID ), edd_get_discount_amount( $discount->ID ) );
|
280 |
$discounts = edd_set_cart_discount( $discount_code );
|
426 |
|
427 |
ob_start();
|
428 |
edd_checkout_cart();
|
429 |
+
$cart = ob_get_clean();
|
430 |
$response = array(
|
431 |
+
'html' => $cart,
|
432 |
+
'tax_raw' => edd_get_cart_tax(),
|
433 |
+
'tax' => html_entity_decode( edd_cart_tax( false ), ENT_COMPAT, 'UTF-8' ),
|
434 |
+
'tax_rate_raw' => edd_get_tax_rate(),
|
435 |
+
'tax_rate' => html_entity_decode( edd_get_formatted_tax_rate(), ENT_COMPAT, 'UTF-8' ),
|
436 |
+
'total' => html_entity_decode( edd_cart_total( false ), ENT_COMPAT, 'UTF-8' ),
|
437 |
+
'total_raw' => edd_get_cart_total(),
|
438 |
);
|
439 |
|
440 |
echo json_encode( $response );
|
includes/api/class-edd-api-v1.php
ADDED
@@ -0,0 +1,24 @@
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
1 |
+
<?php
|
2 |
+
/**
|
3 |
+
* Easy Digital Downloads API V1
|
4 |
+
*
|
5 |
+
* @package EDD
|
6 |
+
* @subpackage Classes/API
|
7 |
+
* @copyright Copyright (c) 2015, Pippin Williamson
|
8 |
+
* @license http://opensource.org/licenses/gpl-2.0.php GNU Public License
|
9 |
+
* @since 2.4
|
10 |
+
*/
|
11 |
+
|
12 |
+
// Exit if accessed directly
|
13 |
+
if ( ! defined( 'ABSPATH' ) ) exit;
|
14 |
+
|
15 |
+
/**
|
16 |
+
* EDD_API_V1 Class
|
17 |
+
*
|
18 |
+
* The base version API class
|
19 |
+
*
|
20 |
+
* @since 2.4
|
21 |
+
*/
|
22 |
+
class EDD_API_V1 extends EDD_API {
|
23 |
+
|
24 |
+
}
|
includes/api/class-edd-api.php
ADDED
@@ -0,0 +1,1948 @@
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
1 |
+
<?php
|
2 |
+
/**
|
3 |
+
* Easy Digital Downloads API
|
4 |
+
*
|
5 |
+
* This class provides a front-facing JSON/XML API that makes it possible to
|
6 |
+
* query data from the shop.
|
7 |
+
*
|
8 |
+
* The primary purpose of this class is for external sales / earnings tracking
|
9 |
+
* systems, such as mobile. This class is also used in the EDD iOS App.
|
10 |
+
*
|
11 |
+
* @package EDD
|
12 |
+
* @subpackage Classes/API
|
13 |
+
* @copyright Copyright (c) 2015, Pippin Williamson
|
14 |
+
* @license http://opensource.org/licenses/gpl-2.0.php GNU Public License
|
15 |
+
* @since 1.5
|
16 |
+
*/
|
17 |
+
|
18 |
+
// Exit if accessed directly
|
19 |
+
if ( ! defined( 'ABSPATH' ) ) exit;
|
20 |
+
|
21 |
+
/**
|
22 |
+
* EDD_API Class
|
23 |
+
*
|
24 |
+
* Renders API returns as a JSON/XML array
|
25 |
+
*
|
26 |
+
* @since 1.5
|
27 |
+
*/
|
28 |
+
class EDD_API {
|
29 |
+
|
30 |
+
/**
|
31 |
+
* Latest API Version
|
32 |
+
*/
|
33 |
+
const VERSION = 1;
|
34 |
+
|
35 |
+
/**
|
36 |
+
* Pretty Print?
|
37 |
+
*
|
38 |
+
* @var bool
|
39 |
+
* @access private
|
40 |
+
* @since 1.5
|
41 |
+
*/
|
42 |
+
private $pretty_print = false;
|
43 |
+
|
44 |
+
/**
|
45 |
+
* Log API requests?
|
46 |
+
*
|
47 |
+
* @var bool
|
48 |
+
* @access private
|
49 |
+
* @since 1.5
|
50 |
+
*/
|
51 |
+
public $log_requests = true;
|
52 |
+
|
53 |
+
/**
|
54 |
+
* Is this a valid request?
|
55 |
+
*
|
56 |
+
* @var bool
|
57 |
+
* @access private
|
58 |
+
* @since 1.5
|
59 |
+
*/
|
60 |
+
private $is_valid_request = false;
|
61 |
+
|
62 |
+
/**
|
63 |
+
* User ID Performing the API Request
|
64 |
+
*
|
65 |
+
* @var int
|
66 |
+
* @access private
|
67 |
+
* @since 1.5.1
|
68 |
+
*/
|
69 |
+
public $user_id = 0;
|
70 |
+
|
71 |
+
/**
|
72 |
+
* Instance of EDD Stats class
|
73 |
+
*
|
74 |
+
* @var object
|
75 |
+
* @access private
|
76 |
+
* @since 1.7
|
77 |
+
*/
|
78 |
+
private $stats;
|
79 |
+
|
80 |
+
/**
|
81 |
+
* Response data to return
|
82 |
+
*
|
83 |
+
* @var array
|
84 |
+
* @access private
|
85 |
+
* @since 1.5.2
|
86 |
+
*/
|
87 |
+
private $data = array();
|
88 |
+
|
89 |
+
/**
|
90 |
+
*
|
91 |
+
* @var bool
|
92 |
+
* @access private
|
93 |
+
* @since 1.7
|
94 |
+
*/
|
95 |
+
public $override = true;
|
96 |
+
|
97 |
+
/**
|
98 |
+
* Version of the API queried
|
99 |
+
*
|
100 |
+
* @var string
|
101 |
+
* @access public
|
102 |
+
* @since 2.4
|
103 |
+
*/
|
104 |
+
private $queried_version;
|
105 |
+
|
106 |
+
/**
|
107 |
+
* All versions of the API
|
108 |
+
*
|
109 |
+
* @var string
|
110 |
+
* @access public
|
111 |
+
* @since 2.4
|
112 |
+
*/
|
113 |
+
protected $versions = array();
|
114 |
+
|
115 |
+
/**
|
116 |
+
* Queried endpoint
|
117 |
+
*
|
118 |
+
* @var string
|
119 |
+
* @access public
|
120 |
+
* @since 2.4
|
121 |
+
*/
|
122 |
+
private $endpoint;
|
123 |
+
|
124 |
+
/**
|
125 |
+
* Endpoints routes
|
126 |
+
*
|
127 |
+
* @var object
|
128 |
+
* @access public
|
129 |
+
* @since 2.4
|
130 |
+
*/
|
131 |
+
private $routes;
|
132 |
+
|
133 |
+
/**
|
134 |
+
* Setup the EDD API
|
135 |
+
*
|
136 |
+
* @author Daniel J Griffiths
|
137 |
+
* @since 1.5
|
138 |
+
*/
|
139 |
+
public function __construct() {
|
140 |
+
|
141 |
+
$this->versions = array(
|
142 |
+
'v1' => 'EDD_API_V1',
|
143 |
+
);
|
144 |
+
|
145 |
+
foreach( $this->get_versions() as $version => $class ) {
|
146 |
+
require_once EDD_PLUGIN_DIR . 'includes/api/class-edd-api-' . $version . '.php';
|
147 |
+
}
|
148 |
+
|
149 |
+
add_action( 'init', array( $this, 'add_endpoint' ) );
|
150 |
+
add_action( 'template_redirect', array( $this, 'process_query' ), -1 );
|
151 |
+
add_filter( 'query_vars', array( $this, 'query_vars' ) );
|
152 |
+
add_action( 'show_user_profile', array( $this, 'user_key_field' ) );
|
153 |
+
add_action( 'edit_user_profile', array( $this, 'user_key_field' ) );
|
154 |
+
add_action( 'personal_options_update', array( $this, 'update_key' ) );
|
155 |
+
add_action( 'edit_user_profile_update', array( $this, 'update_key' ) );
|
156 |
+
add_action( 'edd_process_api_key', array( $this, 'process_api_key' ) );
|
157 |
+
|
158 |
+
// Setup a backwards compatibilty check for user API Keys
|
159 |
+
add_filter( 'get_user_metadata', array( $this, 'api_key_backwards_copmat' ), 10, 4 );
|
160 |
+
|
161 |
+
// Determine if JSON_PRETTY_PRINT is available
|
162 |
+
$this->pretty_print = defined( 'JSON_PRETTY_PRINT' ) ? JSON_PRETTY_PRINT : null;
|
163 |
+
|
164 |
+
// Allow API request logging to be turned off
|
165 |
+
$this->log_requests = apply_filters( 'edd_api_log_requests', $this->log_requests );
|
166 |
+
|
167 |
+
// Setup EDD_Stats instance
|
168 |
+
$this->stats = new EDD_Payment_Stats;
|
169 |
+
|
170 |
+
}
|
171 |
+
|
172 |
+
/**
|
173 |
+
* Registers a new rewrite endpoint for accessing the API
|
174 |
+
*
|
175 |
+
* @access public
|
176 |
+
* @author Daniel J Griffiths
|
177 |
+
* @param array $rewrite_rules WordPress Rewrite Rules
|
178 |
+
* @since 1.5
|
179 |
+
*/
|
180 |
+
public function add_endpoint( $rewrite_rules ) {
|
181 |
+
add_rewrite_endpoint( 'edd-api', EP_ALL );
|
182 |
+
}
|
183 |
+
|
184 |
+
/**
|
185 |
+
* Registers query vars for API access
|
186 |
+
*
|
187 |
+
* @access public
|
188 |
+
* @since 1.5
|
189 |
+
* @author Daniel J Griffiths
|
190 |
+
* @param array $vars Query vars
|
191 |
+
* @return string[] $vars New query vars
|
192 |
+
*/
|
193 |
+
public function query_vars( $vars ) {
|
194 |
+
|
195 |
+
$vars[] = 'token';
|
196 |
+
$vars[] = 'key';
|
197 |
+
$vars[] = 'query';
|
198 |
+
$vars[] = 'type';
|
199 |
+
$vars[] = 'product';
|
200 |
+
$vars[] = 'number';
|
201 |
+
$vars[] = 'date';
|
202 |
+
$vars[] = 'startdate';
|
203 |
+
$vars[] = 'enddate';
|
204 |
+
$vars[] = 'customer';
|
205 |
+
$vars[] = 'discount';
|
206 |
+
$vars[] = 'format';
|
207 |
+
$vars[] = 'id';
|
208 |
+
$vars[] = 'purchasekey';
|
209 |
+
$vars[] = 'email';
|
210 |
+
|
211 |
+
return $vars;
|
212 |
+
}
|
213 |
+
|
214 |
+
/**
|
215 |
+
* Retrieve the API versions
|
216 |
+
*
|
217 |
+
* @access public
|
218 |
+
* @since 2.4
|
219 |
+
* @return array
|
220 |
+
*/
|
221 |
+
public function get_versions() {
|
222 |
+
return $this->versions;
|
223 |
+
}
|
224 |
+
|
225 |
+
/**
|
226 |
+
* Retrieve the API version that was queried
|
227 |
+
*
|
228 |
+
* @access public
|
229 |
+
* @since 2.4
|
230 |
+
* @return string
|
231 |
+
*/
|
232 |
+
public function get_queried_version() {
|
233 |
+
return $this->queried_version;
|
234 |
+
}
|
235 |
+
|
236 |
+
/**
|
237 |
+
* Retrieves the default version of the API to use
|
238 |
+
*
|
239 |
+
* @access private
|
240 |
+
* @since 2.4
|
241 |
+
* @return string
|
242 |
+
*/
|
243 |
+
public function get_default_version() {
|
244 |
+
|
245 |
+
$version = get_option( 'edd_default_api_version' );
|
246 |
+
|
247 |
+
if( defined( 'EDD_API_VERSION' ) ) {
|
248 |
+
$version = EDD_API_VERSION;
|
249 |
+
} elseif( ! $version ) {
|
250 |
+
$version = 'v1';
|
251 |
+
}
|
252 |
+
|
253 |
+
return $version;
|
254 |
+
}
|
255 |
+
|
256 |
+
/**
|
257 |
+
* Sets the version of the API that was queried.
|
258 |
+
*
|
259 |
+
* Falls back to the default version if no version is specified
|
260 |
+
*
|
261 |
+
* @access private
|
262 |
+
* @since 2.4
|
263 |
+
*/
|
264 |
+
private function set_queried_version() {
|
265 |
+
|
266 |
+
global $wp_query;
|
267 |
+
|
268 |
+
$version = $wp_query->query_vars['edd-api'];
|
269 |
+
|
270 |
+
if( strpos( $version, '/' ) ) {
|
271 |
+
|
272 |
+
$version = explode( '/', $version );
|
273 |
+
$version = strtolower( $version[0] );
|
274 |
+
|
275 |
+
$wp_query->query_vars['edd-api'] = str_replace( $version . '/', '', $wp_query->query_vars['edd-api'] );
|
276 |
+
|
277 |
+
if( array_key_exists( $version, $this->versions ) ) {
|
278 |
+
|
279 |
+
$this->queried_version = $version;
|
280 |
+
|
281 |
+
} else {
|
282 |
+
|
283 |
+
$this->is_valid_request = false;
|
284 |
+
$this->invalid_version();
|
285 |
+
}
|
286 |
+
|
287 |
+
} else {
|
288 |
+
|
289 |
+
$this->queried_version = $this->get_default_version();
|
290 |
+
|
291 |
+
}
|
292 |
+
|
293 |
+
}
|
294 |
+
|
295 |
+
/**
|
296 |
+
* Validate the API request
|
297 |
+
*
|
298 |
+
* Checks for the user's public key and token against the secret key
|
299 |
+
*
|
300 |
+
* @access private
|
301 |
+
* @global object $wp_query WordPress Query
|
302 |
+
* @uses EDD_API::get_user()
|
303 |
+
* @uses EDD_API::invalid_key()
|
304 |
+
* @uses EDD_API::invalid_auth()
|
305 |
+
* @since 1.5
|
306 |
+
* @return void
|
307 |
+
*/
|
308 |
+
private function validate_request() {
|
309 |
+
global $wp_query;
|
310 |
+
|
311 |
+
$this->override = false;
|
312 |
+
|
313 |
+
// Make sure we have both user and api key
|
314 |
+
if ( ! empty( $wp_query->query_vars['edd-api'] ) && ( $wp_query->query_vars['edd-api'] != 'products' || ! empty( $wp_query->query_vars['token'] ) ) ) {
|
315 |
+
|
316 |
+
if ( empty( $wp_query->query_vars['token'] ) || empty( $wp_query->query_vars['key'] ) ) {
|
317 |
+
$this->missing_auth();
|
318 |
+
}
|
319 |
+
|
320 |
+
// Auth was provided, include the upgrade routine so we can use the fallback api checks
|
321 |
+
require EDD_PLUGIN_DIR . 'includes/admin/upgrades/upgrade-functions.php';
|
322 |
+
|
323 |
+
// Retrieve the user by public API key and ensure they exist
|
324 |
+
if ( ! ( $user = $this->get_user( $wp_query->query_vars['key'] ) ) ) {
|
325 |
+
|
326 |
+
$this->invalid_key();
|
327 |
+
|
328 |
+
} else {
|
329 |
+
|
330 |
+
$token = urldecode( $wp_query->query_vars['token'] );
|
331 |
+
$secret = $this->get_user_secret_key( $user );
|
332 |
+
$public = urldecode( $wp_query->query_vars['key'] );
|
333 |
+
|
334 |
+
if ( hash_equals( md5( $secret . $public ), $token ) ) {
|
335 |
+
$this->is_valid_request = true;
|
336 |
+
} else {
|
337 |
+
$this->invalid_auth();
|
338 |
+
}
|
339 |
+
}
|
340 |
+
} elseif ( ! empty( $wp_query->query_vars['edd-api'] ) && $wp_query->query_vars['edd-api'] == 'products' ) {
|
341 |
+
$this->is_valid_request = true;
|
342 |
+
$wp_query->set( 'key', 'public' );
|
343 |
+
}
|
344 |
+
}
|
345 |
+
|
346 |
+
/**
|
347 |
+
* Retrieve the user ID based on the public key provided
|
348 |
+
*
|
349 |
+
* @access public
|
350 |
+
* @since 1.5.1
|
351 |
+
* @global object $wpdb Used to query the database using the WordPress
|
352 |
+
* Database API
|
353 |
+
*
|
354 |
+
* @param string $key Public Key
|
355 |
+
*
|
356 |
+
* @return bool if user ID is found, false otherwise
|
357 |
+
*/
|
358 |
+
public function get_user( $key = '' ) {
|
359 |
+
global $wpdb, $wp_query;
|
360 |
+
|
361 |
+
if( empty( $key ) ) {
|
362 |
+
$key = urldecode( $wp_query->query_vars['key'] );
|
363 |
+
}
|
364 |
+
|
365 |
+
if ( empty( $key ) ) {
|
366 |
+
return false;
|
367 |
+
}
|
368 |
+
|
369 |
+
$user = get_transient( md5( 'edd_api_user_' . $key ) );
|
370 |
+
|
371 |
+
if ( false === $user ) {
|
372 |
+
if ( edd_has_upgrade_completed( 'upgrade_user_api_keys' ) ) {
|
373 |
+
$user = $wpdb->get_var( $wpdb->prepare( "SELECT user_id FROM $wpdb->usermeta WHERE meta_key = %s LIMIT 1", $key ) );
|
374 |
+
} else {
|
375 |
+
$user = $wpdb->get_var( $wpdb->prepare( "SELECT user_id FROM $wpdb->usermeta WHERE meta_key = 'edd_user_public_key' AND meta_value = %s LIMIT 1", $key ) );
|
376 |
+
}
|
377 |
+
set_transient( md5( 'edd_api_user_' . $key ) , $user, DAY_IN_SECONDS );
|
378 |
+
}
|
379 |
+
|
380 |
+
if ( $user != NULL ) {
|
381 |
+
$this->user_id = $user;
|
382 |
+
return $user;
|
383 |
+
}
|
384 |
+
|
385 |
+
return false;
|
386 |
+
}
|
387 |
+
|
388 |
+
public function get_user_public_key( $user_id = 0 ) {
|
389 |
+
global $wpdb;
|
390 |
+
|
391 |
+
if ( empty( $user_id ) ) {
|
392 |
+
return '';
|
393 |
+
}
|
394 |
+
|
395 |
+
$cache_key = md5( 'edd_api_user_public_key' . $user_id );
|
396 |
+
$user_public_key = get_transient( $cache_key );
|
397 |
+
|
398 |
+
if ( empty( $user_public_key ) ) {
|
399 |
+
if ( edd_has_upgrade_completed( 'upgrade_user_api_keys' ) ) {
|
400 |
+
$user_public_key = $wpdb->get_var( $wpdb->prepare( "SELECT meta_key FROM $wpdb->usermeta WHERE meta_value = 'edd_user_public_key' AND user_id = %d", $user_id ) );
|
401 |
+
} else {
|
402 |
+
$user_public_key = $wpdb->get_var( $wpdb->prepare( "SELECT meta_value FROM $wpdb->usermeta WHERE meta_key = 'edd_user_public_key' AND user_id = %d", $user_id ) );
|
403 |
+
}
|
404 |
+
set_transient( $cache_key, $user_public_key, HOUR_IN_SECONDS );
|
405 |
+
}
|
406 |
+
|
407 |
+
return $user_public_key;
|
408 |
+
}
|
409 |
+
|
410 |
+
public function get_user_secret_key( $user_id = 0 ) {
|
411 |
+
global $wpdb;
|
412 |
+
|
413 |
+
if ( empty( $user_id ) ) {
|
414 |
+
return '';
|
415 |
+
}
|
416 |
+
|
417 |
+
$cache_key = md5( 'edd_api_user_secret_key' . $user_id );
|
418 |
+
$user_secret_key = get_transient( $cache_key );
|
419 |
+
|
420 |
+
if ( empty( $user_secret_key ) ) {
|
421 |
+
if ( edd_has_upgrade_completed( 'upgrade_user_api_keys' ) ) {
|
422 |
+
$user_secret_key = $wpdb->get_var( $wpdb->prepare( "SELECT meta_key FROM $wpdb->usermeta WHERE meta_value = 'edd_user_secret_key' AND user_id = %d", $user_id ) );
|
423 |
+
} else {
|
424 |
+
$user_secret_key = $wpdb->get_var( $wpdb->prepare( "SELECT meta_value FROM $wpdb->usermeta WHERE meta_key = 'edd_user_secret_key' AND user_id = %d", $user_id ) );
|
425 |
+
}
|
426 |
+
set_transient( $cache_key, $user_secret_key, HOUR_IN_SECONDS );
|
427 |
+
}
|
428 |
+
|
429 |
+
return $user_secret_key;
|
430 |
+
}
|
431 |
+
|
432 |
+
/**
|
433 |
+
* Displays a missing authentication error if all the parameters aren't
|
434 |
+
* provided
|
435 |
+
*
|
436 |
+
* @access private
|
437 |
+
* @author Daniel J Griffiths
|
438 |
+
* @uses EDD_API::output()
|
439 |
+
* @since 1.5
|
440 |
+
*/
|
441 |
+
private function missing_auth() {
|
442 |
+
$error = array();
|
443 |
+
$error['error'] = __( 'You must specify both a token and API key!', 'edd' );
|
444 |
+
|
445 |
+
$this->data = $error;
|
446 |
+
$this->output( 401 );
|
447 |
+
}
|
448 |
+
|
449 |
+
/**
|
450 |
+
* Displays an authentication failed error if the user failed to provide valid
|
451 |
+
* credentials
|
452 |
+
*
|
453 |
+
* @access private
|
454 |
+
* @since 1.5
|
455 |
+
* @uses EDD_API::output()
|
456 |
+
* @return void
|
457 |
+
*/
|
458 |
+
private function invalid_auth() {
|
459 |
+
$error = array();
|
460 |
+
$error['error'] = __( 'Your request could not be authenticated!', 'edd' );
|
461 |
+
|
462 |
+
$this->data = $error;
|
463 |
+
$this->output( 401 );
|
464 |
+
}
|
465 |
+
|
466 |
+
/**
|
467 |
+
* Displays an invalid API key error if the API key provided couldn't be
|
468 |
+
* validated
|
469 |
+
*
|
470 |
+
* @access private
|
471 |
+
* @author Daniel J Griffiths
|
472 |
+
* @since 1.5
|
473 |
+
* @uses EDD_API::output()
|
474 |
+
* @return void
|
475 |
+
*/
|
476 |
+
private function invalid_key() {
|
477 |
+
$error = array();
|
478 |
+
$error['error'] = __( 'Invalid API key!', 'edd' );
|
479 |
+
|
480 |
+
$this->data = $error;
|
481 |
+
$this->output( 401 );
|
482 |
+
}
|
483 |
+
|
484 |
+
/**
|
485 |
+
* Displays an invalid version error if the version number passed isn't valid
|
486 |
+
*
|
487 |
+
* @access private
|
488 |
+
* @since 2.4
|
489 |
+
* @uses EDD_API::output()
|
490 |
+
* @return void
|
491 |
+
*/
|
492 |
+
private function invalid_version() {
|
493 |
+
$error = array();
|
494 |
+
$error['error'] = __( 'Invalid API version!', 'edd' );
|
495 |
+
|
496 |
+
$this->data = $error;
|
497 |
+
$this->output( 404 );
|
498 |
+
}
|
499 |
+
|
500 |
+
/**
|
501 |
+
* Listens for the API and then processes the API requests
|
502 |
+
*
|
503 |
+
* @access public
|
504 |
+
* @author Daniel J Griffiths
|
505 |
+
* @global $wp_query
|
506 |
+
* @since 1.5
|
507 |
+
* @return void
|
508 |
+
*/
|
509 |
+
public function process_query() {
|
510 |
+
|
511 |
+
global $wp_query;
|
512 |
+
|
513 |
+
// Start logging how long the request takes for logging
|
514 |
+
$before = microtime( true );
|
515 |
+
|
516 |
+
// Check for edd-api var. Get out if not present
|
517 |
+
if ( empty( $wp_query->query_vars['edd-api'] ) ) {
|
518 |
+
return;
|
519 |
+
}
|
520 |
+
|
521 |
+
// Determine which version was queried
|
522 |
+
$this->set_queried_version();
|
523 |
+
|
524 |
+
// Determine the kind of query
|
525 |
+
$this->set_query_mode();
|
526 |
+
|
527 |
+
// Check for a valid user and set errors if necessary
|
528 |
+
$this->validate_request();
|
529 |
+
|
530 |
+
// Only proceed if no errors have been noted
|
531 |
+
if( ! $this->is_valid_request ) {
|
532 |
+
return;
|
533 |
+
}
|
534 |
+
|
535 |
+
if( ! defined( 'EDD_DOING_API' ) ) {
|
536 |
+
define( 'EDD_DOING_API', true );
|
537 |
+
}
|
538 |
+
|
539 |
+
$data = array();
|
540 |
+
$this->routes = new $this->versions[ $this->get_queried_version() ];
|
541 |
+
|
542 |
+
switch( $this->endpoint ) :
|
543 |
+
|
544 |
+
case 'stats' :
|
545 |
+
|
546 |
+
$data = $this->routes->get_stats( array(
|
547 |
+
'type' => isset( $wp_query->query_vars['type'] ) ? $wp_query->query_vars['type'] : null,
|
548 |
+
'product' => isset( $wp_query->query_vars['product'] ) ? $wp_query->query_vars['product'] : null,
|
549 |
+
'date' => isset( $wp_query->query_vars['date'] ) ? $wp_query->query_vars['date'] : null,
|
550 |
+
'startdate' => isset( $wp_query->query_vars['startdate'] ) ? $wp_query->query_vars['startdate'] : null,
|
551 |
+
'enddate' => isset( $wp_query->query_vars['enddate'] ) ? $wp_query->query_vars['enddate'] : null
|
552 |
+
) );
|
553 |
+
|
554 |
+
break;
|
555 |
+
|
556 |
+
case 'products' :
|
557 |
+
|
558 |
+
$product = isset( $wp_query->query_vars['product'] ) ? $wp_query->query_vars['product'] : null;
|
559 |
+
|
560 |
+
$data = $this->routes->get_products( $product );
|
561 |
+
|
562 |
+
break;
|
563 |
+
|
564 |
+
case 'customers' :
|
565 |
+
|
566 |
+
$customer = isset( $wp_query->query_vars['customer'] ) ? $wp_query->query_vars['customer'] : null;
|
567 |
+
|
568 |
+
$data = $this->routes->get_customers( $customer );
|
569 |
+
|
570 |
+
break;
|
571 |
+
|
572 |
+
case 'sales' :
|
573 |
+
|
574 |
+
$data = $this->routes->get_recent_sales();
|
575 |
+
|
576 |
+
break;
|
577 |
+
|
578 |
+
case 'discounts' :
|
579 |
+
|
580 |
+
$discount = isset( $wp_query->query_vars['discount'] ) ? $wp_query->query_vars['discount'] : null;
|
581 |
+
|
582 |
+
$data = $this->routes->get_discounts( $discount );
|
583 |
+
|
584 |
+
break;
|
585 |
+
|
586 |
+
endswitch;
|
587 |
+
|
588 |
+
// Allow extensions to setup their own return data
|
589 |
+
$this->data = apply_filters( 'edd_api_output_data', $data, $this->endpoint, $this );
|
590 |
+
|
591 |
+
$after = microtime( true );
|
592 |
+
$request_time = ( $after - $before );
|
593 |
+
$this->data['request_speed'] = $request_time;
|
594 |
+
|
595 |
+
// Log this API request, if enabled. We log it here because we have access to errors.
|
596 |
+
$this->log_request( $this->data );
|
597 |
+
|
598 |
+
// Send out data to the output function
|
599 |
+
$this->output();
|
600 |
+
}
|
601 |
+
|
602 |
+
/**
|
603 |
+
* Returns the API endpoint requested
|
604 |
+
*
|
605 |
+
* @access private
|
606 |
+
* @since 1.5
|
607 |
+
* @return string $query Query mode
|
608 |
+
*/
|
609 |
+
public function get_query_mode() {
|
610 |
+
|
611 |
+
return $this->endpoint;
|
612 |
+
}
|
613 |
+
|
614 |
+
/**
|
615 |
+
* Determines the kind of query requested and also ensure it is a valid query
|
616 |
+
*
|
617 |
+
* @access private
|
618 |
+
* @since 2.4
|
619 |
+
* @global $wp_query
|
620 |
+
*/
|
621 |
+
public function set_query_mode() {
|
622 |
+
|
623 |
+
global $wp_query;
|
624 |
+
|
625 |
+
// Whitelist our query options
|
626 |
+
$accepted = apply_filters( 'edd_api_valid_query_modes', array(
|
627 |
+
'stats',
|
628 |
+
'products',
|
629 |
+
'customers',
|
630 |
+
'sales',
|
631 |
+
'discounts'
|
632 |
+
) );
|
633 |
+
|
634 |
+
$query = isset( $wp_query->query_vars['edd-api'] ) ? $wp_query->query_vars['edd-api'] : null;
|
635 |
+
$query = str_replace( $this->queried_version . '/', '', $query );
|
636 |
+
|
637 |
+
$error = array();
|
638 |
+
|
639 |
+
// Make sure our query is valid
|
640 |
+
if ( ! in_array( $query, $accepted ) ) {
|
641 |
+
$error['error'] = __( 'Invalid query!', 'edd' );
|
642 |
+
|
643 |
+
$this->data = $error;
|
644 |
+
$this->output();
|
645 |
+
}
|
646 |
+
|
647 |
+
$this->endpoint = $query;
|
648 |
+
}
|
649 |
+
|
650 |
+
/**
|
651 |
+
* Get page number
|
652 |
+
*
|
653 |
+
* @access private
|
654 |
+
* @since 1.5
|
655 |
+
* @global $wp_query
|
656 |
+
* @return int $wp_query->query_vars['page'] if page number returned (default: 1)
|
657 |
+
*/
|
658 |
+
public function get_paged() {
|
659 |
+
global $wp_query;
|
660 |
+
|
661 |
+
return isset( $wp_query->query_vars['page'] ) ? $wp_query->query_vars['page'] : 1;
|
662 |
+
}
|
663 |
+
|
664 |
+
|
665 |
+
/**
|
666 |
+
* Number of results to display per page
|
667 |
+
*
|
668 |
+
* @access private
|
669 |
+
* @since 1.5
|
670 |
+
* @global $wp_query
|
671 |
+
* @return int $per_page Results to display per page (default: 10)
|
672 |
+
*/
|
673 |
+
public function per_page() {
|
674 |
+
global $wp_query;
|
675 |
+
|
676 |
+
$per_page = isset( $wp_query->query_vars['number'] ) ? $wp_query->query_vars['number'] : 10;
|
677 |
+
|
678 |
+
if( $per_page < 0 && $this->get_query_mode() == 'customers' )
|
679 |
+
$per_page = 99999999; // Customers query doesn't support -1
|
680 |
+
|
681 |
+
return apply_filters( 'edd_api_results_per_page', $per_page );
|
682 |
+
}
|
683 |
+
|
684 |
+
/**
|
685 |
+
* Sets up the dates used to retrieve earnings/sales
|
686 |
+
*
|
687 |
+
* @access public
|
688 |
+
* @since 1.5.1
|
689 |
+
* @param array $args Arguments to override defaults
|
690 |
+
* @return array $dates
|
691 |
+
*/
|
692 |
+
public function get_dates( $args = array() ) {
|
693 |
+
$dates = array();
|
694 |
+
|
695 |
+
$defaults = array(
|
696 |
+
'type' => '',
|
697 |
+
'product' => null,
|
698 |
+
'date' => null,
|
699 |
+
'startdate' => null,
|
700 |
+
'enddate' => null
|
701 |
+
);
|
702 |
+
|
703 |
+
$args = wp_parse_args( $args, $defaults );
|
704 |
+
|
705 |
+
$current_time = current_time( 'timestamp' );
|
706 |
+
|
707 |
+
if ( 'range' === $args['date'] ) {
|
708 |
+
$startdate = strtotime( $args['startdate'] );
|
709 |
+
$enddate = strtotime( $args['enddate'] );
|
710 |
+
$dates['day_start'] = date( 'd', $startdate );
|
711 |
+
$dates['day_end'] = date( 'd', $enddate );
|
712 |
+
$dates['m_start'] = date( 'n', $startdate );
|
713 |
+
$dates['m_end'] = date( 'n', $enddate );
|
714 |
+
$dates['year'] = date( 'Y', $startdate );
|
715 |
+
$dates['year_end'] = date( 'Y', $enddate );
|
716 |
+
} else {
|
717 |
+
// Modify dates based on predefined ranges
|
718 |
+
switch ( $args['date'] ) :
|
719 |
+
|
720 |
+
case 'this_month' :
|
721 |
+
$dates['day'] = null;
|
722 |
+
$dates['m_start'] = date( 'n', $current_time );
|
723 |
+
$dates['m_end'] = date( 'n', $current_time );
|
724 |
+
$dates['year'] = date( 'Y', $current_time );
|
725 |
+
break;
|
726 |
+
|
727 |
+
case 'last_month' :
|
728 |
+
$dates['day'] = null;
|
729 |
+
$dates['m_start'] = date( 'n', $current_time ) == 1 ? 12 : date( 'n', $current_time ) - 1;
|
730 |
+
$dates['m_end'] = $dates['m_start'];
|
731 |
+
$dates['year'] = date( 'n', $current_time ) == 1 ? date( 'Y', $current_time ) - 1 : date( 'Y', $current_time );
|
732 |
+
break;
|
733 |
+
|
734 |
+
case 'today' :
|
735 |
+
$dates['day'] = date( 'd', $current_time );
|
736 |
+
$dates['m_start'] = date( 'n', $current_time );
|
737 |
+
$dates['m_end'] = date( 'n', $current_time );
|
738 |
+
$dates['year'] = date( 'Y', $current_time );
|
739 |
+
break;
|
740 |
+
|
741 |
+
case 'yesterday' :
|
742 |
+
|
743 |
+
$year = date( 'Y', $current_time );
|
744 |
+
$month = date( 'n', $current_time );
|
745 |
+
$day = date( 'd', $current_time );
|
746 |
+
|
747 |
+
if ( $month == 1 && $day == 1 ) {
|
748 |
+
|
749 |
+
$year -= 1;
|
750 |
+
$month = 12;
|
751 |
+
$day = cal_days_in_month( CAL_GREGORIAN, $month, $year );
|
752 |
+
|
753 |
+
} elseif ( $month > 1 && $day == 1 ) {
|
754 |
+
|
755 |
+
$month -= 1;
|
756 |
+
$day = cal_days_in_month( CAL_GREGORIAN, $month, $year );
|
757 |
+
|
758 |
+
} else {
|
759 |
+
|
760 |
+
$day -= 1;
|
761 |
+
|
762 |
+
}
|
763 |
+
|
764 |
+
$dates['day'] = $day;
|
765 |
+
$dates['m_start'] = $month;
|
766 |
+
$dates['m_end'] = $month;
|
767 |
+
$dates['year'] = $year;
|
768 |
+
|
769 |
+
break;
|
770 |
+
|
771 |
+
case 'this_quarter' :
|
772 |
+
$month_now = date( 'n', $current_time );
|
773 |
+
|
774 |
+
$dates['day'] = null;
|
775 |
+
|
776 |
+
if ( $month_now <= 3 ) {
|
777 |
+
|
778 |
+
$dates['m_start'] = 1;
|
779 |
+
$dates['m_end'] = 3;
|
780 |
+
$dates['year'] = date( 'Y', $current_time );
|
781 |
+
|
782 |
+
} else if ( $month_now <= 6 ) {
|
783 |
+
|
784 |
+
$dates['m_start'] = 4;
|
785 |
+
$dates['m_end'] = 6;
|
786 |
+
$dates['year'] = date( 'Y', $current_time );
|
787 |
+
|
788 |
+
} else if ( $month_now <= 9 ) {
|
789 |
+
|
790 |
+
$dates['m_start'] = 7;
|
791 |
+
$dates['m_end'] = 9;
|
792 |
+
$dates['year'] = date( 'Y', $current_time );
|
793 |
+
|
794 |
+
} else {
|
795 |
+
|
796 |
+
$dates['m_start'] = 10;
|
797 |
+
$dates['m_end'] = 12;
|
798 |
+
$dates['year'] = date( 'Y', $current_time );
|
799 |
+
|
800 |
+
}
|
801 |
+
break;
|
802 |
+
|
803 |
+
case 'last_quarter' :
|
804 |
+
$month_now = date( 'n', $current_time );
|
805 |
+
|
806 |
+
$dates['day'] = null;
|
807 |
+
|
808 |
+
if ( $month_now <= 3 ) {
|
809 |
+
|
810 |
+
$dates['m_start'] = 10;
|
811 |
+
$dates['m_end'] = 12;
|
812 |
+
$dates['year'] = date( 'Y', $current_time ) - 1; // Previous year
|
813 |
+
|
814 |
+
} else if ( $month_now <= 6 ) {
|
815 |
+
|
816 |
+
$dates['m_start'] = 1;
|
817 |
+
$dates['m_end'] = 3;
|
818 |
+
$dates['year'] = date( 'Y', $current_time );
|
819 |
+
|
820 |
+
} else if ( $month_now <= 9 ) {
|
821 |
+
|
822 |
+
$dates['m_start'] = 4;
|
823 |
+
$dates['m_end'] = 6;
|
824 |
+
$dates['year'] = date( 'Y', $current_time );
|
825 |
+
|
826 |
+
} else {
|
827 |
+
|
828 |
+
$dates['m_start'] = 7;
|
829 |
+
$dates['m_end'] = 9;
|
830 |
+
$dates['year'] = date( 'Y', $current_time );
|
831 |
+
|
832 |
+
}
|
833 |
+
break;
|
834 |
+
|
835 |
+
case 'this_year' :
|
836 |
+
$dates['day'] = null;
|
837 |
+
$dates['m_start'] = null;
|
838 |
+
$dates['m_end'] = null;
|
839 |
+
$dates['year'] = date( 'Y', $current_time );
|
840 |
+
break;
|
841 |
+
|
842 |
+
case 'last_year' :
|
843 |
+
$dates['day'] = null;
|
844 |
+
$dates['m_start'] = null;
|
845 |
+
$dates['m_end'] = null;
|
846 |
+
$dates['year'] = date( 'Y', $current_time ) - 1;
|
847 |
+
break;
|
848 |
+
|
849 |
+
endswitch;
|
850 |
+
}
|
851 |
+
|
852 |
+
/**
|
853 |
+
* Returns the filters for the dates used to retreive earnings/sales
|
854 |
+
*
|
855 |
+
* @since 1.5.1
|
856 |
+
* @param object $dates The dates used for retreiving earnings/sales
|
857 |
+
*/
|
858 |
+
|
859 |
+
return apply_filters( 'edd_api_stat_dates', $dates );
|
860 |
+
}
|
861 |
+
|
862 |
+
/**
|
863 |
+
* Process Get Customers API Request
|
864 |
+
*
|
865 |
+
* @access public
|
866 |
+
* @since 1.5
|
867 |
+
* @author Daniel J Griffiths
|
868 |
+
* @global object $wpdb Used to query the database using the WordPress
|
869 |
+
* Database API
|
870 |
+
* @param int $customer Customer ID
|
871 |
+
* @return array $customers Multidimensional array of the customers
|
872 |
+
*/
|
873 |
+
public function get_customers( $customer = null ) {
|
874 |
+
|
875 |
+
$customers = array();
|
876 |
+
$error = array();
|
877 |
+
if( ! user_can( $this->user_id, 'view_shop_sensitive_data' ) && ! $this->override ) {
|
878 |
+
return $customers;
|
879 |
+
}
|
880 |
+
|
881 |
+
global $wpdb;
|
882 |
+
|
883 |
+
$paged = $this->get_paged();
|
884 |
+
$per_page = $this->per_page();
|
885 |
+
$offset = $per_page * ( $paged - 1 );
|
886 |
+
|
887 |
+
if( is_numeric( $customer ) ) {
|
888 |
+
$field = 'id';
|
889 |
+
} else {
|
890 |
+
$field = 'email';
|
891 |
+
}
|
892 |
+
|
893 |
+
$customer_query = EDD()->customers->get_customers( array( 'number' => $per_page, 'offset' => $offset, $field => $customer ) );
|
894 |
+
$customer_count = 0;
|
895 |
+
|
896 |
+
if( $customer_query ) {
|
897 |
+
|
898 |
+
foreach ( $customer_query as $customer_obj ) {
|
899 |
+
|
900 |
+
$names = explode( ' ', $customer_obj->name );
|
901 |
+
$first_name = ! empty( $names[0] ) ? $names[0] : '';
|
902 |
+
$last_name = '';
|
903 |
+
if( ! empty( $names[1] ) ) {
|
904 |
+
unset( $names[0] );
|
905 |
+
$last_name = implode( ' ', $names );
|
906 |
+
}
|
907 |
+
|
908 |
+
$customers['customers'][$customer_count]['info']['id'] = '';
|
909 |
+
$customers['customers'][$customer_count]['info']['user_id'] = '';
|
910 |
+
$customers['customers'][$customer_count]['info']['username'] = '';
|
911 |
+
$customers['customers'][$customer_count]['info']['display_name'] = '';
|
912 |
+
$customers['customers'][$customer_count]['info']['customer_id'] = $customer_obj->id;
|
913 |
+
$customers['customers'][$customer_count]['info']['first_name'] = $first_name;
|
914 |
+
$customers['customers'][$customer_count]['info']['last_name'] = $last_name;
|
915 |
+
$customers['customers'][$customer_count]['info']['email'] = $customer_obj->email;
|
916 |
+
|
917 |
+
if ( ! empty( $customer_obj->user_id ) ) {
|
918 |
+
|
919 |
+
$user_data = get_userdata( $customer_obj->user_id );
|
920 |
+
|
921 |
+
// Customer with registered account
|
922 |
+
|
923 |
+
// id is going to get deprecated in the future, user user_id or customer_id instead
|
924 |
+
$customers['customers'][$customer_count]['info']['id'] = $customer_obj->user_id;
|
925 |
+
$customers['customers'][$customer_count]['info']['user_id'] = $customer_obj->user_id;
|
926 |
+
$customers['customers'][$customer_count]['info']['username'] = $user_data->user_login;
|
927 |
+
$customers['customers'][$customer_count]['info']['display_name'] = $user_data->display_name;
|
928 |
+
|
929 |
+
}
|
930 |
+
|
931 |
+
$customers['customers'][$customer_count]['stats']['total_purchases'] = $customer_obj->purchase_count;
|
932 |
+
$customers['customers'][$customer_count]['stats']['total_spent'] = $customer_obj->purchase_value;
|
933 |
+
$customers['customers'][$customer_count]['stats']['total_downloads'] = edd_count_file_downloads_of_user( $customer_obj->email );
|
934 |
+
|
935 |
+
$customer_count++;
|
936 |
+
|
937 |
+
}
|
938 |
+
|
939 |
+
} elseif( $customer ) {
|
940 |
+
|
941 |
+
$error['error'] = sprintf( __( 'Customer %s not found!', 'edd' ), $customer );
|
942 |
+
return $error;
|
943 |
+
|
944 |
+
} else {
|
945 |
+
|
946 |
+
$error['error'] = __( 'No customers found!', 'edd' );
|
947 |
+
return $error;
|
948 |
+
|
949 |
+
}
|
950 |
+
|
951 |
+
return $customers;
|
952 |
+
}
|
953 |
+
|
954 |
+
/**
|
955 |
+
* Process Get Products API Request
|
956 |
+
*
|
957 |
+
* @access public
|
958 |
+
* @author Daniel J Griffiths
|
959 |
+
* @since 1.5
|
960 |
+
* @param int $product Product (Download) ID
|
961 |
+
* @return array $customers Multidimensional array of the products
|
962 |
+
*/
|
963 |
+
public function get_products( $product = null ) {
|
964 |
+
|
965 |
+
$products = array();
|
966 |
+
$error = array();
|
967 |
+
|
968 |
+
if ( $product == null ) {
|
969 |
+
$products['products'] = array();
|
970 |
+
|
971 |
+
$product_list = get_posts( array(
|
972 |
+
'post_type' => 'download',
|
973 |
+
'posts_per_page' => $this->per_page(),
|
974 |
+
'suppress_filters' => true,
|
975 |
+
'paged' => $this->get_paged()
|
976 |
+
) );
|
977 |
+
|
978 |
+
if ( $product_list ) {
|
979 |
+
$i = 0;
|
980 |
+
foreach ( $product_list as $product_info ) {
|
981 |
+
$products['products'][$i] = $this->get_product_data( $product_info );
|
982 |
+
$i++;
|
983 |
+
}
|
984 |
+
}
|
985 |
+
} else {
|
986 |
+
if ( get_post_type( $product ) == 'download' ) {
|
987 |
+
$product_info = get_post( $product );
|
988 |
+
|
989 |
+
$products['products'][0] = $this->get_product_data( $product_info );
|
990 |
+
|
991 |
+
} else {
|
992 |
+
$error['error'] = sprintf( __( 'Product %s not found!', 'edd' ), $product );
|
993 |
+
return $error;
|
994 |
+
}
|
995 |
+
}
|
996 |
+
|
997 |
+
return $products;
|
998 |
+
}
|
999 |
+
|
1000 |
+
/**
|
1001 |
+
* Given a download post object, generate the data for the API output
|
1002 |
+
*
|
1003 |
+
* @since 2.3.9
|
1004 |
+
* @param object $product_info The Download Post Object
|
1005 |
+
* @return array Array of post data to return back in the API
|
1006 |
+
*/
|
1007 |
+
private function get_product_data( $product_info ) {
|
1008 |
+
|
1009 |
+
$product = array();
|
1010 |
+
|
1011 |
+
$product['info']['id'] = $product_info->ID;
|
1012 |
+
$product['info']['slug'] = $product_info->post_name;
|
1013 |
+
$product['info']['title'] = $product_info->post_title;
|
1014 |
+
$product['info']['create_date'] = $product_info->post_date;
|
1015 |
+
$product['info']['modified_date'] = $product_info->post_modified;
|
1016 |
+
$product['info']['status'] = $product_info->post_status;
|
1017 |
+
$product['info']['link'] = html_entity_decode( $product_info->guid );
|
1018 |
+
$product['info']['content'] = $product_info->post_content;
|
1019 |
+
$product['info']['thumbnail'] = wp_get_attachment_url( get_post_thumbnail_id( $product_info->ID ) );
|
1020 |
+
$product['info']['category'] = get_the_terms( $product_info, 'download_category' );
|
1021 |
+
$product['info']['tags'] = get_the_terms( $product_info, 'download_tag' );
|
1022 |
+
|
1023 |
+
if( user_can( $this->user_id, 'view_shop_reports' ) || $this->override ) {
|
1024 |
+
$product['stats']['total']['sales'] = edd_get_download_sales_stats( $product_info->ID );
|
1025 |
+
$product['stats']['total']['earnings'] = edd_get_download_earnings_stats( $product_info->ID );
|
1026 |
+
$product['stats']['monthly_average']['sales'] = edd_get_average_monthly_download_sales( $product_info->ID );
|
1027 |
+
$product['stats']['monthly_average']['earnings'] = edd_get_average_monthly_download_earnings( $product_info->ID );
|
1028 |
+
}
|
1029 |
+
|
1030 |
+
if ( edd_has_variable_prices( $product_info->ID ) ) {
|
1031 |
+
foreach ( edd_get_variable_prices( $product_info->ID ) as $price ) {
|
1032 |
+
$product['pricing'][ sanitize_key( $price['name'] ) ] = $price['amount'];
|
1033 |
+
}
|
1034 |
+
} else {
|
1035 |
+
$product['pricing']['amount'] = edd_get_download_price( $product_info->ID );
|
1036 |
+
}
|
1037 |
+
|
1038 |
+
if( user_can( $this->user_id, 'view_shop_sensitive_data' ) || $this->override ) {
|
1039 |
+
foreach ( edd_get_download_files( $product_info->ID ) as $file ) {
|
1040 |
+
$product['files'][] = $file;
|
1041 |
+
}
|
1042 |
+
$product['notes'] = edd_get_product_notes( $product_info->ID );
|
1043 |
+
}
|
1044 |
+
|
1045 |
+
return apply_filters( 'edd_api_products_product', $product );
|
1046 |
+
|
1047 |
+
}
|
1048 |
+
|
1049 |
+
/**
|
1050 |
+
* Process Get Stats API Request
|
1051 |
+
*
|
1052 |
+
* @author Daniel J Griffiths
|
1053 |
+
* @since 1.5
|
1054 |
+
*
|
1055 |
+
* @global object $wpdb Used to query the database using the WordPress
|
1056 |
+
*
|
1057 |
+
* @param array $args Arguments provided by API Request
|
1058 |
+
*
|
1059 |
+
* @return array
|
1060 |
+
*/
|
1061 |
+
public function get_stats( $args = array() ) {
|
1062 |
+
$defaults = array(
|
1063 |
+
'type' => null,
|
1064 |
+
'product' => null,
|
1065 |
+
'date' => null,
|
1066 |
+
'startdate' => null,
|
1067 |
+
'enddate' => null
|
1068 |
+
);
|
1069 |
+
|
1070 |
+
$args = wp_parse_args( $args, $defaults );
|
1071 |
+
|
1072 |
+
$dates = $this->get_dates( $args );
|
1073 |
+
|
1074 |
+
$stats = array();
|
1075 |
+
$earnings = array(
|
1076 |
+
'earnings' => array()
|
1077 |
+
);
|
1078 |
+
$sales = array(
|
1079 |
+
'sales' => array()
|
1080 |
+
);
|
1081 |
+
$error = array();
|
1082 |
+
|
1083 |
+
if( ! user_can( $this->user_id, 'view_shop_reports' ) && ! $this->override ) {
|
1084 |
+
return $stats;
|
1085 |
+
}
|
1086 |
+
|
1087 |
+
if ( $args['type'] == 'sales' ) {
|
1088 |
+
if ( $args['product'] == null ) {
|
1089 |
+
if ( $args['date'] == null ) {
|
1090 |
+
$sales = $this->get_default_sales_stats();
|
1091 |
+
} elseif( $args['date'] === 'range' ) {
|
1092 |
+
// Return sales for a date range
|
1093 |
+
|
1094 |
+
// Ensure the end date is later than the start date
|
1095 |
+
if( $args['enddate'] < $args['startdate'] ) {
|
1096 |
+
$error['error'] = __( 'The end date must be later than the start date!', 'edd' );
|
1097 |
+
}
|
1098 |
+
|
1099 |
+
// Ensure both the start and end date are specified
|
1100 |
+
if ( empty( $args['startdate'] ) || empty( $args['enddate'] ) ) {
|
1101 |
+
$error['error'] = __( 'Invalid or no date range specified!', 'edd' );
|
1102 |
+
}
|
1103 |
+
|
1104 |
+
$total = 0;
|
1105 |
+
|
1106 |
+
// Loop through the years
|
1107 |
+
$y = $dates['year'];
|
1108 |
+
while( $y <= $dates['year_end'] ) :
|
1109 |
+
|
1110 |
+
if( $dates['year'] == $dates['year_end'] ) {
|
1111 |
+
$month_start = $dates['m_start'];
|
1112 |
+
$month_end = $dates['m_end'];
|
1113 |
+
} elseif( $y == $dates['year'] && $dates['year_end'] > $dates['year'] ) {
|
1114 |
+
$month_start = $dates['m_start'];
|
1115 |
+
$month_end = 12;
|
1116 |
+
} elseif( $y == $dates['year_end'] ) {
|
1117 |
+
$month_start = 1;
|
1118 |
+
$month_end = $dates['m_end'];
|
1119 |
+
} else {
|
1120 |
+
$month_start = 1;
|
1121 |
+
$month_end = 12;
|
1122 |
+
}
|
1123 |
+
|
1124 |
+
$i = $month_start;
|
1125 |
+
while ( $i <= $month_end ) :
|
1126 |
+
|
1127 |
+
if( $i == $dates['m_start'] ) {
|
1128 |
+
$d = $dates['day_start'];
|
1129 |
+
} else {
|
1130 |
+
$d = 1;
|
1131 |
+
}
|
1132 |
+
|
1133 |
+
if( $i == $dates['m_end'] ) {
|
1134 |
+
$num_of_days = $dates['day_end'];
|
1135 |
+
} else {
|
1136 |
+
$num_of_days = cal_days_in_month( CAL_GREGORIAN, $i, $y );
|
1137 |
+
}
|
1138 |
+
|
1139 |
+
while ( $d <= $num_of_days ) :
|
1140 |
+
$sale_count = edd_get_sales_by_date( $d, $i, $y );
|
1141 |
+
$date_key = date( 'Ymd', strtotime( $y . '/' . $i . '/' . $d ) );
|
1142 |
+
if ( ! isset( $sales['sales'][ $date_key ] ) ) {
|
1143 |
+
$sales['sales'][ $date_key ] = 0;
|
1144 |
+
}
|
1145 |
+
$sales['sales'][ $date_key ] += $sale_count;
|
1146 |
+
$total += $sale_count;
|
1147 |
+
$d++;
|
1148 |
+
endwhile;
|
1149 |
+
$i++;
|
1150 |
+
endwhile;
|
1151 |
+
|
1152 |
+
$y++;
|
1153 |
+
endwhile;
|
1154 |
+
|
1155 |
+
$sales['totals'] = $total;
|
1156 |
+
} else {
|
1157 |
+
if( $args['date'] == 'this_quarter' || $args['date'] == 'last_quarter' ) {
|
1158 |
+
$sales_count = 0;
|
1159 |
+
|
1160 |
+
// Loop through the months
|
1161 |
+
$month = $dates['m_start'];
|
1162 |
+
|
1163 |
+
while( $month <= $dates['m_end'] ) :
|
1164 |
+
$sales_count += edd_get_sales_by_date( null, $month, $dates['year'] );
|
1165 |
+
$month++;
|
1166 |
+
endwhile;
|
1167 |
+
|
1168 |
+
$sales['sales'][ $args['date'] ] = $sales_count;
|
1169 |
+
} else {
|
1170 |
+
$sales['sales'][ $args['date'] ] = edd_get_sales_by_date( $dates['day'], $dates['m_start'], $dates['year'] );
|
1171 |
+
}
|
1172 |
+
}
|
1173 |
+
} elseif ( $args['product'] == 'all' ) {
|
1174 |
+
$products = get_posts( array( 'post_type' => 'download', 'nopaging' => true ) );
|
1175 |
+
$i = 0;
|
1176 |
+
foreach ( $products as $product_info ) {
|
1177 |
+
$sales['sales'][$i] = array( $product_info->post_name => edd_get_download_sales_stats( $product_info->ID ) );
|
1178 |
+
$i++;
|
1179 |
+
}
|
1180 |
+
} else {
|
1181 |
+
if ( get_post_type( $args['product'] ) == 'download' ) {
|
1182 |
+
$product_info = get_post( $args['product'] );
|
1183 |
+
$sales['sales'][0] = array( $product_info->post_name => edd_get_download_sales_stats( $args['product'] ) );
|
1184 |
+
} else {
|
1185 |
+
$error['error'] = sprintf( __( 'Product %s not found!', 'edd' ), $args['product'] );
|
1186 |
+
}
|
1187 |
+
}
|
1188 |
+
|
1189 |
+
if ( ! empty( $error ) )
|
1190 |
+
return $error;
|
1191 |
+
|
1192 |
+
return $sales;
|
1193 |
+
} elseif ( $args['type'] == 'earnings' ) {
|
1194 |
+
if ( $args['product'] == null ) {
|
1195 |
+
if ( $args['date'] == null ) {
|
1196 |
+
$earnings = $this->get_default_earnings_stats();
|
1197 |
+
} elseif ( $args['date'] === 'range' ) {
|
1198 |
+
// Return sales for a date range
|
1199 |
+
|
1200 |
+
// Ensure the end date is later than the start date
|
1201 |
+
if ( $args['enddate'] < $args['startdate'] ) {
|
1202 |
+
$error['error'] = __( 'The end date must be later than the start date!', 'edd' );
|
1203 |
+
}
|
1204 |
+
|
1205 |
+
// Ensure both the start and end date are specified
|
1206 |
+
if ( empty( $args['startdate'] ) || empty( $args['enddate'] ) ) {
|
1207 |
+
$error['error'] = __( 'Invalid or no date range specified!', 'edd' );
|
1208 |
+
}
|
1209 |
+
|
1210 |
+
$total = (float) 0.00;
|
1211 |
+
|
1212 |
+
// Loop through the years
|
1213 |
+
$y = $dates['year'];
|
1214 |
+
if ( ! isset( $earnings['earnings'] ) ) {
|
1215 |
+
$earnings['earnings'] = array();
|
1216 |
+
}
|
1217 |
+
while( $y <= $dates['year_end'] ) :
|
1218 |
+
|
1219 |
+
if( $dates['year'] == $dates['year_end'] ) {
|
1220 |
+
$month_start = $dates['m_start'];
|
1221 |
+
$month_end = $dates['m_end'];
|
1222 |
+
} elseif( $y == $dates['year'] && $dates['year_end'] > $dates['year'] ) {
|
1223 |
+
$month_start = $dates['m_start'];
|
1224 |
+
$month_end = 12;
|
1225 |
+
} elseif( $y == $dates['year_end'] ) {
|
1226 |
+
$month_start = 1;
|
1227 |
+
$month_end = $dates['m_end'];
|
1228 |
+
} else {
|
1229 |
+
$month_start = 1;
|
1230 |
+
$month_end = 12;
|
1231 |
+
}
|
1232 |
+
|
1233 |
+
$i = $month_start;
|
1234 |
+
while ( $i <= $month_end ) :
|
1235 |
+
|
1236 |
+
if( $i == $dates['m_start'] )
|
1237 |
+
$d = $dates['day_start'];
|
1238 |
+
else
|
1239 |
+
$d = 1;
|
1240 |
+
|
1241 |
+
if( $i == $dates['m_end'] ) {
|
1242 |
+
$num_of_days = $dates['day_end'];
|
1243 |
+
} else {
|
1244 |
+
$num_of_days = cal_days_in_month( CAL_GREGORIAN, $i, $y );
|
1245 |
+
}
|
1246 |
+
|
1247 |
+
while ( $d <= $num_of_days ) :
|
1248 |
+
$earnings_stat = edd_get_earnings_by_date( $d, $i, $y );
|
1249 |
+
$date_key = date( 'Ymd', strtotime( $y . '/' . $i . '/' . $d ) );
|
1250 |
+
if ( ! isset( $earnings['earnings'][ $date_key ] ) ) {
|
1251 |
+
$earnings['earnings'][ $date_key ] = 0;
|
1252 |
+
}
|
1253 |
+
$earnings['earnings'][ $date_key ] += $earnings_stat;
|
1254 |
+
$total += $earnings_stat;
|
1255 |
+
$d++;
|
1256 |
+
endwhile;
|
1257 |
+
|
1258 |
+
$i++;
|
1259 |
+
endwhile;
|
1260 |
+
|
1261 |
+
$y++;
|
1262 |
+
endwhile;
|
1263 |
+
|
1264 |
+
$earnings['totals'] = $total;
|
1265 |
+
} else {
|
1266 |
+
if ( $args['date'] == 'this_quarter' || $args['date'] == 'last_quarter' ) {
|
1267 |
+
$earnings_count = (float) 0.00;
|
1268 |
+
|
1269 |
+
// Loop through the months
|
1270 |
+
$month = $dates['m_start'];
|
1271 |
+
|
1272 |
+
while ( $month <= $dates['m_end'] ) :
|
1273 |
+
$earnings_count += edd_get_earnings_by_date( null, $month, $dates['year'] );
|
1274 |
+
$month++;
|
1275 |
+
endwhile;
|
1276 |
+
|
1277 |
+
$earnings['earnings'][ $args['date'] ] = $earnings_count;
|
1278 |
+
} else {
|
1279 |
+
$earnings['earnings'][ $args['date'] ] = edd_get_earnings_by_date( $dates['day'], $dates['m_start'], $dates['year'] );
|
1280 |
+
}
|
1281 |
+
}
|
1282 |
+
} elseif ( $args['product'] == 'all' ) {
|
1283 |
+
$products = get_posts( array( 'post_type' => 'download', 'nopaging' => true ) );
|
1284 |
+
|
1285 |
+
$i = 0;
|
1286 |
+
foreach ( $products as $product_info ) {
|
1287 |
+
$earnings['earnings'][ $i ] = array( $product_info->post_name => edd_get_download_earnings_stats( $product_info->ID ) );
|
1288 |
+
$i++;
|
1289 |
+
}
|
1290 |
+
} else {
|
1291 |
+
if ( get_post_type( $args['product'] ) == 'download' ) {
|
1292 |
+
$product_info = get_post( $args['product'] );
|
1293 |
+
$earnings['earnings'][0] = array( $product_info->post_name => edd_get_download_earnings_stats( $args['product'] ) );
|
1294 |
+
} else {
|
1295 |
+
$error['error'] = sprintf( __( 'Product %s not found!', 'edd' ), $args['product'] );
|
1296 |
+
}
|
1297 |
+
}
|
1298 |
+
|
1299 |
+
if ( ! empty( $error ) )
|
1300 |
+
return $error;
|
1301 |
+
|
1302 |
+
return $earnings;
|
1303 |
+
} elseif ( $args['type'] == 'customers' ) {
|
1304 |
+
if ( version_compare( $edd_version, '2.3', '<' ) || ! edd_has_upgrade_completed( 'upgrade_customer_payments_association' ) ) {
|
1305 |
+
global $wpdb;
|
1306 |
+
$stats = array();
|
1307 |
+
$count = $wpdb->get_col( "SELECT COUNT(DISTINCT meta_value) FROM $wpdb->postmeta WHERE meta_key = '_edd_payment_user_email'" );
|
1308 |
+
$stats['customers']['total_customers'] = $count[0];
|
1309 |
+
return $stats;
|
1310 |
+
} else {
|
1311 |
+
$customers = new EDD_DB_Customers();
|
1312 |
+
$stats['customers']['total_customers'] = $customers->count();
|
1313 |
+
return $stats;
|
1314 |
+
}
|
1315 |
+
} elseif ( empty( $args['type'] ) ) {
|
1316 |
+
$stats = array_merge( $stats, $this->get_default_sales_stats() );
|
1317 |
+
$stats = array_merge ( $stats, $this->get_default_earnings_stats() );
|
1318 |
+
|
1319 |
+
return array( 'stats' => $stats );
|
1320 |
+
}
|
1321 |
+
}
|
1322 |
+
|
1323 |
+
/**
|
1324 |
+
* Retrieves Recent Sales
|
1325 |
+
*
|
1326 |
+
* @access public
|
1327 |
+
* @since 1.5
|
1328 |
+
* @return array
|
1329 |
+
*/
|
1330 |
+
public function get_recent_sales() {
|
1331 |
+
global $wp_query;
|
1332 |
+
|
1333 |
+
$sales = array();
|
1334 |
+
|
1335 |
+
if( ! user_can( $this->user_id, 'view_shop_reports' ) && ! $this->override ) {
|
1336 |
+
return $sales;
|
1337 |
+
}
|
1338 |
+
|
1339 |
+
if( isset( $wp_query->query_vars['id'] ) ) {
|
1340 |
+
$query = array();
|
1341 |
+
$query[] = edd_get_payment_by( 'id', $wp_query->query_vars['id'] );
|
1342 |
+
} elseif( isset( $wp_query->query_vars['purchasekey'] ) ) {
|
1343 |
+
$query = array();
|
1344 |
+
$query[] = edd_get_payment_by( 'key', $wp_query->query_vars['purchasekey'] );
|
1345 |
+
} elseif( isset( $wp_query->query_vars['email'] ) ) {
|
1346 |
+
$query = edd_get_payments( array( 'meta_key' => '_edd_payment_user_email', 'meta_value' => $wp_query->query_vars['email'], 'number' => $this->per_page(), 'page' => $this->get_paged(), 'status' => 'publish' ) );
|
1347 |
+
} else {
|
1348 |
+
$query = edd_get_payments( array( 'number' => $this->per_page(), 'page' => $this->get_paged(), 'status' => 'publish' ) );
|
1349 |
+
}
|
1350 |
+
|
1351 |
+
if ( $query ) {
|
1352 |
+
$i = 0;
|
1353 |
+
foreach ( $query as $payment ) {
|
1354 |
+
$payment_meta = edd_get_payment_meta( $payment->ID );
|
1355 |
+
$user_info = edd_get_payment_meta_user_info( $payment->ID );
|
1356 |
+
$cart_items = edd_get_payment_meta_cart_details( $payment->ID );
|
1357 |
+
|
1358 |
+
$sales['sales'][ $i ]['ID'] = edd_get_payment_number( $payment->ID );
|
1359 |
+
$sales['sales'][ $i ]['transaction_id'] = edd_get_payment_transaction_id( $payment->ID );
|
1360 |
+
$sales['sales'][ $i ]['key'] = edd_get_payment_key( $payment->ID );
|
1361 |
+
$sales['sales'][ $i ]['discount'] = isset( $user_info['discount'] ) && $user_info['discount'] != 'none' ? explode( ',', $user_info['discount'] ) : array();
|
1362 |
+
$sales['sales'][ $i ]['subtotal'] = edd_get_payment_subtotal( $payment->ID );
|
1363 |
+
$sales['sales'][ $i ]['tax'] = edd_get_payment_tax( $payment->ID );
|
1364 |
+
$sales['sales'][ $i ]['fees'] = edd_get_payment_fees( $payment->ID );
|
1365 |
+
$sales['sales'][ $i ]['total'] = edd_get_payment_amount( $payment->ID );
|
1366 |
+
$sales['sales'][ $i ]['gateway'] = edd_get_payment_gateway( $payment->ID );
|
1367 |
+
$sales['sales'][ $i ]['email'] = edd_get_payment_user_email( $payment->ID );
|
1368 |
+
$sales['sales'][ $i ]['date'] = $payment->post_date;
|
1369 |
+
$sales['sales'][ $i ]['products'] = array();
|
1370 |
+
|
1371 |
+
$c = 0;
|
1372 |
+
|
1373 |
+
foreach ( $cart_items as $key => $item ) {
|
1374 |
+
|
1375 |
+
$item_id = isset( $item['id'] ) ? $item['id'] : $item;
|
1376 |
+
$price = isset( $item['price'] ) ? $item['price'] : false;
|
1377 |
+
$price_id = isset( $item['item_number']['options']['price_id'] ) ? $item['item_number']['options']['price_id'] : null;
|
1378 |
+
$quantity = isset( $item['quantity'] ) && $item['quantity'] > 0 ? $item['quantity'] : 1;
|
1379 |
+
|
1380 |
+
if( ! $price ) {
|
1381 |
+
// This function is only used on payments with near 1.0 cart data structure
|
1382 |
+
$price = edd_get_download_final_price( $item_id, $user_info, null );
|
1383 |
+
}
|
1384 |
+
|
1385 |
+
$price_name = '';
|
1386 |
+
if ( isset( $item['item_number'] ) && isset( $item['item_number']['options'] ) ) {
|
1387 |
+
$price_options = $item['item_number']['options'];
|
1388 |
+
if ( isset( $price_options['price_id'] ) ) {
|
1389 |
+
$price_name = edd_get_price_option_name( $item['id'], $price_options['price_id'], $payment->ID );
|
1390 |
+
}
|
1391 |
+
}
|
1392 |
+
|
1393 |
+
$sales['sales'][ $i ]['products'][ $c ]['quantity'] = $quantity;
|
1394 |
+
$sales['sales'][ $i ]['products'][ $c ]['name'] = get_the_title( $item['id'] );
|
1395 |
+
$sales['sales'][ $i ]['products'][ $c ]['price'] = $price;
|
1396 |
+
$sales['sales'][ $i ]['products'][ $c ]['price_name'] = $price_name;
|
1397 |
+
$c++;
|
1398 |
+
}
|
1399 |
+
|
1400 |
+
$i++;
|
1401 |
+
}
|
1402 |
+
}
|
1403 |
+
return $sales;
|
1404 |
+
}
|
1405 |
+
|
1406 |
+
/**
|
1407 |
+
* Process Get Discounts API Request
|
1408 |
+
*
|
1409 |
+
* @access public
|
1410 |
+
* @since 1.6
|
1411 |
+
* @global object $wpdb Used to query the database using the WordPress
|
1412 |
+
* Database API
|
1413 |
+
* @param int $discount Discount ID
|
1414 |
+
* @return array $discounts Multidimensional array of the discounts
|
1415 |
+
*/
|
1416 |
+
public function get_discounts( $discount = null ) {
|
1417 |
+
|
1418 |
+
$discount_list = array();
|
1419 |
+
|
1420 |
+
if( ! user_can( $this->user_id, 'manage_shop_discounts' ) && ! $this->override ) {
|
1421 |
+
return $discount_list;
|
1422 |
+
}
|
1423 |
+
$error = array();
|
1424 |
+
|
1425 |
+
if ( empty( $discount ) ) {
|
1426 |
+
|
1427 |
+
global $wpdb;
|
1428 |
+
|
1429 |
+
$paged = $this->get_paged();
|
1430 |
+
$per_page = $this->per_page();
|
1431 |
+
$discounts = edd_get_discounts( array( 'posts_per_page' => $per_page, 'paged' => $paged ) );
|
1432 |
+
$count = 0;
|
1433 |
+
|
1434 |
+
if ( empty( $discounts ) ) {
|
1435 |
+
$error['error'] = __( 'No discounts found!', 'edd' );
|
1436 |
+
return $error;
|
1437 |
+
}
|
1438 |
+
|
1439 |
+
foreach ( $discounts as $discount ) {
|
1440 |
+
|
1441 |
+
$discount_list['discounts'][$count]['ID'] = $discount->ID;
|
1442 |
+
$discount_list['discounts'][$count]['name'] = $discount->post_title;
|
1443 |
+
$discount_list['discounts'][$count]['code'] = edd_get_discount_code( $discount->ID );
|
1444 |
+
$discount_list['discounts'][$count]['amount'] = edd_get_discount_amount( $discount->ID );
|
1445 |
+
$discount_list['discounts'][$count]['min_price'] = edd_get_discount_min_price( $discount->ID );
|
1446 |
+
$discount_list['discounts'][$count]['type'] = edd_get_discount_type( $discount->ID );
|
1447 |
+
$discount_list['discounts'][$count]['uses'] = edd_get_discount_uses( $discount->ID );
|
1448 |
+
$discount_list['discounts'][$count]['max_uses'] = edd_get_discount_max_uses( $discount->ID );
|
1449 |
+
$discount_list['discounts'][$count]['start_date'] = edd_get_discount_start_date( $discount->ID );
|
1450 |
+
$discount_list['discounts'][$count]['exp_date'] = edd_get_discount_expiration( $discount->ID );
|
1451 |
+
$discount_list['discounts'][$count]['status'] = $discount->post_status;
|
1452 |
+
$discount_list['discounts'][$count]['product_requirements'] = edd_get_discount_product_reqs( $discount->ID );
|
1453 |
+
$discount_list['discounts'][$count]['requirement_condition'] = edd_get_discount_product_condition( $discount->ID );
|
1454 |
+
$discount_list['discounts'][$count]['global_discount'] = edd_is_discount_not_global( $discount->ID );
|
1455 |
+
$discount_list['discounts'][$count]['single_use'] = edd_discount_is_single_use( $discount->ID );
|
1456 |
+
|
1457 |
+
$count++;
|
1458 |
+
}
|
1459 |
+
|
1460 |
+
} else {
|
1461 |
+
|
1462 |
+
if ( is_numeric( $discount ) && get_post( $discount ) ) {
|
1463 |
+
|
1464 |
+
$discount_list['discounts'][0]['ID'] = $discount;
|
1465 |
+
$discount_list['discounts'][0]['name'] = get_post_field( 'post_title', $discount );
|
1466 |
+
$discount_list['discounts'][0]['code'] = edd_get_discount_code( $discount );
|
1467 |
+
$discount_list['discounts'][0]['amount'] = edd_get_discount_amount( $discount );
|
1468 |
+
$discount_list['discounts'][0]['min_price'] = edd_get_discount_min_price( $discount );
|
1469 |
+
$discount_list['discounts'][0]['type'] = edd_get_discount_type( $discount );
|
1470 |
+
$discount_list['discounts'][0]['uses'] = edd_get_discount_uses( $discount );
|
1471 |
+
$discount_list['discounts'][0]['max_uses'] = edd_get_discount_max_uses( $discount );
|
1472 |
+
$discount_list['discounts'][0]['start_date'] = edd_get_discount_start_date( $discount );
|
1473 |
+
$discount_list['discounts'][0]['exp_date'] = edd_get_discount_expiration( $discount );
|
1474 |
+
$discount_list['discounts'][0]['status'] = get_post_field( 'post_status', $discount );
|
1475 |
+
$discount_list['discounts'][0]['product_requirements'] = edd_get_discount_product_reqs( $discount );
|
1476 |
+
$discount_list['discounts'][0]['requirement_condition'] = edd_get_discount_product_condition( $discount );
|
1477 |
+
$discount_list['discounts'][0]['global_discount'] = edd_is_discount_not_global( $discount );
|
1478 |
+
$discount_list['discounts'][0]['single_use'] = edd_discount_is_single_use( $discount );
|
1479 |
+
|
1480 |
+
} else {
|
1481 |
+
|
1482 |
+
$error['error'] = sprintf( __( 'Discount %s not found!', 'edd' ), $discount );
|
1483 |
+
return $error;
|
1484 |
+
|
1485 |
+
}
|
1486 |
+
|
1487 |
+
}
|
1488 |
+
|
1489 |
+
return $discount_list;
|
1490 |
+
}
|
1491 |
+
|
1492 |
+
/**
|
1493 |
+
* Retrieve the output format
|
1494 |
+
*
|
1495 |
+
* Determines whether results should be displayed in XML or JSON
|
1496 |
+
*
|
1497 |
+
* @since 1.5
|
1498 |
+
*
|
1499 |
+
* @return mixed|void
|
1500 |
+
*/
|
1501 |
+
public function get_output_format() {
|
1502 |
+
global $wp_query;
|
1503 |
+
|
1504 |
+
$format = isset( $wp_query->query_vars['format'] ) ? $wp_query->query_vars['format'] : 'json';
|
1505 |
+
|
1506 |
+
return apply_filters( 'edd_api_output_format', $format );
|
1507 |
+
}
|
1508 |
+
|
1509 |
+
|
1510 |
+
/**
|
1511 |
+
* Log each API request, if enabled
|
1512 |
+
*
|
1513 |
+
* @access private
|
1514 |
+
* @since 1.5
|
1515 |
+
* @global $edd_logs
|
1516 |
+
* @global $wp_query
|
1517 |
+
* @param array $data
|
1518 |
+
* @return void
|
1519 |
+
*/
|
1520 |
+
private function log_request( $data = array() ) {
|
1521 |
+
if ( ! $this->log_requests )
|
1522 |
+
return;
|
1523 |
+
|
1524 |
+
global $edd_logs, $wp_query;
|
1525 |
+
|
1526 |
+
$query = array(
|
1527 |
+
'edd-api' => $wp_query->query_vars['edd-api'],
|
1528 |
+
'key' => isset( $wp_query->query_vars['key'] ) ? $wp_query->query_vars['key'] : null,
|
1529 |
+
'token' => isset( $wp_query->query_vars['token'] ) ? $wp_query->query_vars['token'] : null,
|
1530 |
+
'query' => isset( $wp_query->query_vars['query'] ) ? $wp_query->query_vars['query'] : null,
|
1531 |
+
'type' => isset( $wp_query->query_vars['type'] ) ? $wp_query->query_vars['type'] : null,
|
1532 |
+
'product' => isset( $wp_query->query_vars['product'] ) ? $wp_query->query_vars['product'] : null,
|
1533 |
+
'customer' => isset( $wp_query->query_vars['customer'] ) ? $wp_query->query_vars['customer'] : null,
|
1534 |
+
'date' => isset( $wp_query->query_vars['date'] ) ? $wp_query->query_vars['date'] : null,
|
1535 |
+
'startdate' => isset( $wp_query->query_vars['startdate'] ) ? $wp_query->query_vars['startdate'] : null,
|
1536 |
+
'enddate' => isset( $wp_query->query_vars['enddate'] ) ? $wp_query->query_vars['enddate'] : null,
|
1537 |
+
'id' => isset( $wp_query->query_vars['id'] ) ? $wp_query->query_vars['id'] : null,
|
1538 |
+
'purchasekey' => isset( $wp_query->query_vars['purchasekey'] ) ? $wp_query->query_vars['purchasekey'] : null,
|
1539 |
+
'email' => isset( $wp_query->query_vars['email'] ) ? $wp_query->query_vars['email'] : null,
|
1540 |
+
);
|
1541 |
+
|
1542 |
+
$log_data = array(
|
1543 |
+
'log_type' => 'api_request',
|
1544 |
+
'post_excerpt' => http_build_query( $query ),
|
1545 |
+
'post_content' => ! empty( $data['error'] ) ? $data['error'] : '',
|
1546 |
+
);
|
1547 |
+
|
1548 |
+
$log_meta = array(
|
1549 |
+
'request_ip' => edd_get_ip(),
|
1550 |
+
'user' => $this->user_id,
|
1551 |
+
'key' => isset( $wp_query->query_vars['key'] ) ? $wp_query->query_vars['key'] : null,
|
1552 |
+
'token' => isset( $wp_query->query_vars['token'] ) ? $wp_query->query_vars['token'] : null,
|
1553 |
+
'time' => $data['request_speed'],
|
1554 |
+
'version' => $this->get_queried_version()
|
1555 |
+
);
|
1556 |
+
|
1557 |
+
$edd_logs->insert_log( $log_data, $log_meta );
|
1558 |
+
}
|
1559 |
+
|
1560 |
+
|
1561 |
+
/**
|
1562 |
+
* Retrieve the output data
|
1563 |
+
*
|
1564 |
+
* @access public
|
1565 |
+
* @since 1.5.2
|
1566 |
+
* @return array
|
1567 |
+
*/
|
1568 |
+
public function get_output() {
|
1569 |
+
return $this->data;
|
1570 |
+
}
|
1571 |
+
|
1572 |
+
/**
|
1573 |
+
* Output Query in either JSON/XML. The query data is outputted as JSON
|
1574 |
+
* by default
|
1575 |
+
*
|
1576 |
+
* @author Daniel J Griffiths
|
1577 |
+
* @since 1.5
|
1578 |
+
* @global $wp_query
|
1579 |
+
*
|
1580 |
+
* @param int $status_code
|
1581 |
+
*/
|
1582 |
+
public function output( $status_code = 200 ) {
|
1583 |
+
global $wp_query;
|
1584 |
+
|
1585 |
+
$format = $this->get_output_format();
|
1586 |
+
|
1587 |
+
status_header( $status_code );
|
1588 |
+
|
1589 |
+
do_action( 'edd_api_output_before', $this->data, $this, $format );
|
1590 |
+
|
1591 |
+
switch ( $format ) :
|
1592 |
+
|
1593 |
+
case 'xml' :
|
1594 |
+
|
1595 |
+
require_once EDD_PLUGIN_DIR . 'includes/libraries/array2xml.php';
|
1596 |
+
$xml = Array2XML::createXML( 'edd', $this->data );
|
1597 |
+
echo $xml->saveXML();
|
1598 |
+
|
1599 |
+
break;
|
1600 |
+
|
1601 |
+
case 'json' :
|
1602 |
+
|
1603 |
+
header( 'Content-Type: application/json' );
|
1604 |
+
if ( ! empty( $this->pretty_print ) )
|
1605 |
+
echo json_encode( $this->data, $this->pretty_print );
|
1606 |
+
else
|
1607 |
+
echo json_encode( $this->data );
|
1608 |
+
|
1609 |
+
break;
|
1610 |
+
|
1611 |
+
|
1612 |
+
default :
|
1613 |
+
|
1614 |
+
// Allow other formats to be added via extensions
|
1615 |
+
do_action( 'edd_api_output_' . $format, $this->data, $this );
|
1616 |
+
|
1617 |
+
break;
|
1618 |
+
|
1619 |
+
endswitch;
|
1620 |
+
|
1621 |
+
do_action( 'edd_api_output_after', $this->data, $this, $format );
|
1622 |
+
|
1623 |
+
edd_die();
|
1624 |
+
}
|
1625 |
+
|
1626 |
+
/**
|
1627 |
+
* Modify User Profile
|
1628 |
+
*
|
1629 |
+
* Modifies the output of profile.php to add key generation/revocation
|
1630 |
+
*
|
1631 |
+
* @access public
|
1632 |
+
* @author Daniel J Griffiths
|
1633 |
+
* @since 1.5
|
1634 |
+
* @param object $user Current user info
|
1635 |
+
* @return void
|
1636 |
+
*/
|
1637 |
+
function user_key_field( $user ) {
|
1638 |
+
if ( ( edd_get_option( 'api_allow_user_keys', false ) || current_user_can( 'manage_shop_settings' ) ) && current_user_can( 'edit_user', $user->ID ) ) {
|
1639 |
+
$user = get_userdata( $user->ID );
|
1640 |
+
?>
|
1641 |
+
<table class="form-table">
|
1642 |
+
<tbody>
|
1643 |
+
<tr>
|
1644 |
+
<th>
|
1645 |
+
<?php _e( 'Easy Digital Downloads API Keys', 'edd' ); ?>
|
1646 |
+
</th>
|
1647 |
+
<td>
|
1648 |
+
<?php
|
1649 |
+
$public_key = $this->get_user_public_key( $user->ID );
|
1650 |
+
$secret_key = $this->get_user_secret_key( $user->ID );
|
1651 |
+
?>
|
1652 |
+
<?php if ( empty( $user->edd_user_public_key ) ) { ?>
|
1653 |
+
<input name="edd_set_api_key" type="checkbox" id="edd_set_api_key" value="0" />
|
1654 |
+
<span class="description"><?php _e( 'Generate API Key', 'edd' ); ?></span>
|
1655 |
+
<?php } else { ?>
|
1656 |
+
<strong style="display:inline-block; width: 125px;"><?php _e( 'Public key:', 'edd' ); ?> </strong><input type="text" disabled="disabled" class="regular-text" id="publickey" value="<?php echo esc_attr( $public_key ); ?>"/><br/>
|
1657 |
+
<strong style="display:inline-block; width: 125px;"><?php _e( 'Secret key:', 'edd' ); ?> </strong><input type="text" disabled="disabled" class="regular-text" id="privatekey" value="<?php echo esc_attr( $secret_key ); ?>"/><br/>
|
1658 |
+
<strong style="display:inline-block; width: 125px;"><?php _e( 'Token:', 'edd' ); ?> </strong><input type="text" disabled="disabled" class="regular-text" id="token" value="<?php echo esc_attr( $this->get_token( $user->ID ) ); ?>"/><br/>
|
1659 |
+
<input name="edd_set_api_key" type="checkbox" id="edd_set_api_key" value="0" />
|
1660 |
+
<span class="description"><label for="edd_set_api_key"><?php _e( 'Revoke API Keys', 'edd' ); ?></label></span>
|
1661 |
+
<?php } ?>
|
1662 |
+
</td>
|
1663 |
+
</tr>
|
1664 |
+
</tbody>
|
1665 |
+
</table>
|
1666 |
+
<?php }
|
1667 |
+
}
|
1668 |
+
|
1669 |
+
/**
|
1670 |
+
* Process an API key generation/revocation
|
1671 |
+
*
|
1672 |
+
* @access public
|
1673 |
+
* @since 2.0.0
|
1674 |
+
* @param array $args
|
1675 |
+
* @return void
|
1676 |
+
*/
|
1677 |
+
public function process_api_key( $args ) {
|
1678 |
+
|
1679 |
+
if( ! wp_verify_nonce( $_REQUEST['_wpnonce'], 'edd-api-nonce' ) ) {
|
1680 |
+
|
1681 |
+
wp_die( __( 'Nonce verification failed', 'edd' ), __( 'Error', 'edd' ), array( 'response' => 403 ) );
|
1682 |
+
|
1683 |
+
}
|
1684 |
+
|
1685 |
+
if( is_numeric( $args['user_id'] ) ) {
|
1686 |
+
$user_id = isset( $args['user_id'] ) ? absint( $args['user_id'] ) : get_current_user_id();
|
1687 |
+
} else {
|
1688 |
+
$userdata = get_user_by( 'login', $args['user_id'] );
|
1689 |
+
$user_id = $userdata->ID;
|
1690 |
+
}
|
1691 |
+
$process = isset( $args['edd_api_process'] ) ? strtolower( $args['edd_api_process'] ) : false;
|
1692 |
+
|
1693 |
+
if( $user_id == get_current_user_id() && ! edd_get_option( 'allow_user_api_keys' ) && ! current_user_can( 'manage_shop_settings' ) ) {
|
1694 |
+
wp_die( sprintf( __( 'You do not have permission to %s API keys for this user', 'edd' ), $process ), __( 'Error', 'edd' ), array( 'response' => 403 ) );
|
1695 |
+
} elseif( ! current_user_can( 'manage_shop_settings' ) ) {
|
1696 |
+
wp_die( sprintf( __( 'You do not have permission to %s API keys for this user', 'edd' ), $process ), __( 'Error', 'edd' ), array( 'response' => 403 ) );
|
1697 |
+
}
|
1698 |
+
|
1699 |
+
switch( $process ) {
|
1700 |
+
case 'generate':
|
1701 |
+
if( $this->generate_api_key( $user_id ) ) {
|
1702 |
+
delete_transient( 'edd-total-api-keys' );
|
1703 |
+
wp_redirect( add_query_arg( 'edd-message', 'api-key-generated', 'edit.php?post_type=download&page=edd-tools&tab=api_keys' ) ); exit();
|
1704 |
+
} else {
|
1705 |
+
wp_redirect( add_query_arg( 'edd-message', 'api-key-failed', 'edit.php?post_type=download&page=edd-tools&tab=api_keys' ) ); exit();
|
1706 |
+
}
|
1707 |
+
break;
|
1708 |
+
case 'regenerate':
|
1709 |
+
$this->generate_api_key( $user_id, true );
|
1710 |
+
delete_transient( 'edd-total-api-keys' );
|
1711 |
+
wp_redirect( add_query_arg( 'edd-message', 'api-key-regenerated', 'edit.php?post_type=download&page=edd-tools&tab=api_keys' ) ); exit();
|
1712 |
+
break;
|
1713 |
+
case 'revoke':
|
1714 |
+
$this->revoke_api_key( $user_id );
|
1715 |
+
delete_transient( 'edd-total-api-keys' );
|
1716 |
+
wp_redirect( add_query_arg( 'edd-message', 'api-key-revoked', 'edit.php?post_type=download&page=edd-tools&tab=api_keys' ) ); exit();
|
1717 |
+
break;
|
1718 |
+
default;
|
1719 |
+
break;
|
1720 |
+
}
|
1721 |
+
}
|
1722 |
+
|
1723 |
+
/**
|
1724 |
+
* Generate new API keys for a user
|
1725 |
+
*
|
1726 |
+
* @access public
|
1727 |
+
* @since 2.0.0
|
1728 |
+
* @param int $user_id User ID the key is being generated for
|
1729 |
+
* @param boolean $regenerate Regenerate the key for the user
|
1730 |
+
* @return boolean True if (re)generated succesfully, false otherwise.
|
1731 |
+
*/
|
1732 |
+
public function generate_api_key( $user_id = 0, $regenerate = false ) {
|
1733 |
+
|
1734 |
+
if( empty( $user_id ) ) {
|
1735 |
+
return false;
|
1736 |
+
}
|
1737 |
+
|
1738 |
+
$user = get_userdata( $user_id );
|
1739 |
+
|
1740 |
+
if( ! $user ) {
|
1741 |
+
return false;
|
1742 |
+
}
|
1743 |
+
|
1744 |
+
$public_key = $this->get_user_public_key( $user_id );
|
1745 |
+
$secret_key = $this->get_user_secret_key( $user_id );
|
1746 |
+
|
1747 |
+
if ( empty( $public_key ) || $regenerate == true ) {
|
1748 |
+
$new_public_key = $this->generate_public_key( $user->user_email );
|
1749 |
+
$new_secret_key = $this->generate_private_key( $user->ID );
|
1750 |
+
} else {
|
1751 |
+
return false;
|
1752 |
+
}
|
1753 |
+
|
1754 |
+
if ( $regenerate == true ) {
|
1755 |
+
$this->revoke_api_key( $user->ID );
|
1756 |
+
}
|
1757 |
+
|
1758 |
+
update_user_meta( $user_id, $new_public_key, 'edd_user_public_key' );
|
1759 |
+
update_user_meta( $user_id, $new_secret_key, 'edd_user_secret_key' );
|
1760 |
+
|
1761 |
+
return true;
|
1762 |
+
}
|
1763 |
+
|
1764 |
+
/**
|
1765 |
+
* Revoke a users API keys
|
1766 |
+
*
|
1767 |
+
* @access public
|
1768 |
+
* @since 2.0.0
|
1769 |
+
* @param int $user_id User ID of user to revoke key for
|
1770 |
+
* @return string
|
1771 |
+
*/
|
1772 |
+
public function revoke_api_key( $user_id = 0 ) {
|
1773 |
+
|
1774 |
+
if( empty( $user_id ) ) {
|
1775 |
+
return false;
|
1776 |
+
}
|
1777 |
+
|
1778 |
+
$user = get_userdata( $user_id );
|
1779 |
+
|
1780 |
+
if( ! $user ) {
|
1781 |
+
return false;
|
1782 |
+
}
|
1783 |
+
|
1784 |
+
$public_key = $this->get_user_public_key( $user_id );
|
1785 |
+
$secret_key = $this->get_user_secret_key( $user_id );
|
1786 |
+
if ( ! empty( $public_key ) ) {
|
1787 |
+
delete_transient( md5( 'edd_api_user_' . $public_key ) );
|
1788 |
+
delete_transient( md5('edd_api_user_public_key' . $user_id ) );
|
1789 |
+
delete_transient( md5('edd_api_user_secret_key' . $user_id ) );
|
1790 |
+
delete_user_meta( $user_id, $public_key );
|
1791 |
+
delete_user_meta( $user_id, $secret_key );
|
1792 |
+
} else {
|
1793 |
+
return false;
|
1794 |
+
}
|
1795 |
+
|
1796 |
+
return true;
|
1797 |
+
}
|
1798 |
+
|
1799 |
+
public function get_version() {
|
1800 |
+
return self::VERSION;
|
1801 |
+
}
|
1802 |
+
|
1803 |
+
|
1804 |
+
/**
|
1805 |
+
* Generate and Save API key
|
1806 |
+
*
|
1807 |
+
* Generates the key requested by user_key_field and stores it in the database
|
1808 |
+
*
|
1809 |
+
* @access public
|
1810 |
+
* @author Daniel J Griffiths
|
1811 |
+
* @since 1.5
|
1812 |
+
* @param int $user_id
|
1813 |
+
* @return void
|
1814 |
+
*/
|
1815 |
+
public function update_key( $user_id ) {
|
1816 |
+
if ( current_user_can( 'edit_user', $user_id ) && isset( $_POST['edd_set_api_key'] ) ) {
|
1817 |
+
|
1818 |
+
$user = get_userdata( $user_id );
|
1819 |
+
|
1820 |
+
$public_key = $this->get_user_public_key( $user_id );
|
1821 |
+
$secret_key = $this->get_user_secret_key( $user_id );
|
1822 |
+
|
1823 |
+
if ( empty( $public_key ) ) {
|
1824 |
+
$new_public_key = $this->generate_public_key( $user->user_email );
|
1825 |
+
$new_secret_key = $this->generate_private_key( $user->ID );
|
1826 |
+
|
1827 |
+
update_user_meta( $user_id, $new_public_key, 'edd_user_public_key' );
|
1828 |
+
update_user_meta( $user_id, $new_secret_key, 'edd_user_secret_key' );
|
1829 |
+
} else {
|
1830 |
+
$this->revoke_api_key( $user_id );
|
1831 |
+
}
|
1832 |
+
}
|
1833 |
+
}
|
1834 |
+
|
1835 |
+
/**
|
1836 |
+
* Generate the public key for a user
|
1837 |
+
*
|
1838 |
+
* @access private
|
1839 |
+
* @since 1.9.9
|
1840 |
+
* @param string $user_email
|
1841 |
+
* @return string
|
1842 |
+
*/
|
1843 |
+
private function generate_public_key( $user_email = '' ) {
|
1844 |
+
$auth_key = defined( 'AUTH_KEY' ) ? AUTH_KEY : '';
|
1845 |
+
$public = hash( 'md5', $user_email . $auth_key . date( 'U' ) );
|
1846 |
+
return $public;
|
1847 |
+
}
|
1848 |
+
|
1849 |
+
/**
|
1850 |
+
* Generate the secret key for a user
|
1851 |
+
*
|
1852 |
+
* @access private
|
1853 |
+
* @since 1.9.9
|
1854 |
+
* @param int $user_id
|
1855 |
+
* @return string
|
1856 |
+
*/
|
1857 |
+
private function generate_private_key( $user_id = 0 ) {
|
1858 |
+
$auth_key = defined( 'AUTH_KEY' ) ? AUTH_KEY : '';
|
1859 |
+
$secret = hash( 'md5', $user_id . $auth_key . date( 'U' ) );
|
1860 |
+
return $secret;
|
1861 |
+
}
|
1862 |
+
|
1863 |
+
/**
|
1864 |
+
* Retrieve the user's token
|
1865 |
+
*
|
1866 |
+
* @access private
|
1867 |
+
* @since 1.9.9
|
1868 |
+
* @param int $user_id
|
1869 |
+
* @return string
|
1870 |
+
*/
|
1871 |
+
public function get_token( $user_id = 0 ) {
|
1872 |
+
return hash( 'md5', $this->get_user_secret_key( $user_id ) . $this->get_user_public_key( $user_id ) );
|
1873 |
+
}
|
1874 |
+
|
1875 |
+
/**
|
1876 |
+
* Generate the default sales stats returned by the 'stats' endpoint
|
1877 |
+
*
|
1878 |
+
* @access private
|
1879 |
+
* @since 1.5.3
|
1880 |
+
* @return array default sales statistics
|
1881 |
+
*/
|
1882 |
+
private function get_default_sales_stats() {
|
1883 |
+
|
1884 |
+
// Default sales return
|
1885 |
+
$sales = array();
|
1886 |
+
$sales['sales']['today'] = $this->stats->get_sales( 0, 'today' );
|
1887 |
+
$sales['sales']['current_month'] = $this->stats->get_sales( 0, 'this_month' );
|
1888 |
+
$sales['sales']['last_month'] = $this->stats->get_sales( 0, 'last_month' );
|
1889 |
+
$sales['sales']['totals'] = edd_get_total_sales();
|
1890 |
+
|
1891 |
+
return $sales;
|
1892 |
+
}
|
1893 |
+
|
1894 |
+
/**
|
1895 |
+
* Generate the default earnings stats returned by the 'stats' endpoint
|
1896 |
+
*
|
1897 |
+
* @access private
|
1898 |
+
* @since 1.5.3
|
1899 |
+
* @return array default earnings statistics
|
1900 |
+
*/
|
1901 |
+
private function get_default_earnings_stats() {
|
1902 |
+
|
1903 |
+
// Default earnings return
|
1904 |
+
$earnings = array();
|
1905 |
+
$earnings['earnings']['today'] = $this->stats->get_earnings( 0, 'today' );
|
1906 |
+
$earnings['earnings']['current_month'] = $this->stats->get_earnings( 0, 'this_month' );
|
1907 |
+
$earnings['earnings']['last_month'] = $this->stats->get_earnings( 0, 'last_month' );
|
1908 |
+
$earnings['earnings']['totals'] = edd_get_total_earnings();
|
1909 |
+
|
1910 |
+
return $earnings;
|
1911 |
+
}
|
1912 |
+
|
1913 |
+
/**
|
1914 |
+
* A Backwards Compatibility call for the change of meta_key/value for users API Keys
|
1915 |
+
*
|
1916 |
+
* @since 2.4
|
1917 |
+
* @param string $check Wether to check the cache or not
|
1918 |
+
* @param int $object_id The User ID being passed
|
1919 |
+
* @param string $meta_key The user meta key
|
1920 |
+
* @param bool $single If it should return a single value or array
|
1921 |
+
* @return string The API key/secret for the user supplied
|
1922 |
+
*/
|
1923 |
+
public function api_key_backwards_copmat( $check, $object_id, $meta_key, $single ) {
|
1924 |
+
|
1925 |
+
if ( $meta_key !== 'edd_user_public_key' && $meta_key !== 'edd_user_secret_key' ) {
|
1926 |
+
return $check;
|
1927 |
+
}
|
1928 |
+
|
1929 |
+
$return = $check;
|
1930 |
+
|
1931 |
+
switch( $meta_key ) {
|
1932 |
+
case 'edd_user_public_key':
|
1933 |
+
$return = EDD()->api->get_user_public_key( $object_id );
|
1934 |
+
break;
|
1935 |
+
case 'edd_user_secret_key':
|
1936 |
+
$return = EDD()->api->get_user_secret_key( $object_id );
|
1937 |
+
break;
|
1938 |
+
}
|
1939 |
+
|
1940 |
+
if ( ! $single ) {
|
1941 |
+
$return = array( $return );
|
1942 |
+
}
|
1943 |
+
|
1944 |
+
return $return;
|
1945 |
+
|
1946 |
+
}
|
1947 |
+
|
1948 |
+
}
|
includes/cart/template.php
CHANGED
@@ -208,15 +208,27 @@ function edd_display_cart_messages() {
|
|
208 |
$messages = EDD()->session->get( 'edd_cart_messages' );
|
209 |
|
210 |
if ( $messages ) {
|
211 |
-
$
|
212 |
-
|
213 |
-
|
214 |
-
|
215 |
-
|
216 |
-
|
217 |
-
|
218 |
-
|
219 |
-
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
220 |
|
221 |
// Remove all of the cart saving messages
|
222 |
EDD()->session->set( 'edd_cart_messages', null );
|
208 |
$messages = EDD()->session->get( 'edd_cart_messages' );
|
209 |
|
210 |
if ( $messages ) {
|
211 |
+
foreach ( $messages as $message_id => $message ) {
|
212 |
+
|
213 |
+
// Try and detect what type of message this is
|
214 |
+
if ( strpos( strtolower( $message ), 'error' ) ) {
|
215 |
+
$type = 'error';
|
216 |
+
} elseif ( strpos( strtolower( $message ), 'success' ) ) {
|
217 |
+
$type = 'success';
|
218 |
+
} else {
|
219 |
+
$type = 'info';
|
220 |
+
}
|
221 |
+
|
222 |
+
$classes = apply_filters( 'edd_' . $type . '_class', array(
|
223 |
+
'edd_errors', 'edd-alert', 'edd-alert-' . $type
|
224 |
+
) );
|
225 |
+
|
226 |
+
echo '<div class="' . implode( ' ', $classes ) . '">';
|
227 |
+
// Loop message codes and display messages
|
228 |
+
echo '<p class="edd_error" id="edd_msg_' . $message_id . '">' . $message . '</p>';
|
229 |
+
echo '</div>';
|
230 |
+
|
231 |
+
}
|
232 |
|
233 |
// Remove all of the cart saving messages
|
234 |
EDD()->session->set( 'edd_cart_messages', null );
|
includes/checkout/functions.php
CHANGED
@@ -195,7 +195,7 @@ function edd_get_success_page_url( $query_string = null ) {
|
|
195 |
function edd_get_failed_transaction_uri( $extras = false ) {
|
196 |
$uri = edd_get_option( 'failure_page', '' );
|
197 |
$uri = ! empty( $uri ) ? trailingslashit( get_permalink( $uri ) ) : home_url();
|
198 |
-
|
199 |
if ( $extras )
|
200 |
$uri .= $extras;
|
201 |
|
@@ -281,6 +281,10 @@ function edd_is_email_banned( $email = '' ) {
|
|
281 |
|
282 |
$banned_emails = edd_get_banned_emails();
|
283 |
|
|
|
|
|
|
|
|
|
284 |
foreach( $banned_emails as $banned_email ) {
|
285 |
if( is_email( $banned_email ) ) {
|
286 |
$ret = ( $banned_email == trim( $email ) ? true : false );
|
@@ -292,7 +296,7 @@ function edd_is_email_banned( $email = '' ) {
|
|
292 |
break;
|
293 |
}
|
294 |
}
|
295 |
-
|
296 |
return apply_filters( 'edd_is_email_banned', $ret, $email );
|
297 |
}
|
298 |
|
@@ -410,3 +414,183 @@ function edd_enforced_ssl_asset_filter( $content ) {
|
|
410 |
|
411 |
return $content;
|
412 |
}
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
195 |
function edd_get_failed_transaction_uri( $extras = false ) {
|
196 |
$uri = edd_get_option( 'failure_page', '' );
|
197 |
$uri = ! empty( $uri ) ? trailingslashit( get_permalink( $uri ) ) : home_url();
|
198 |
+
|
199 |
if ( $extras )
|
200 |
$uri .= $extras;
|
201 |
|
281 |
|
282 |
$banned_emails = edd_get_banned_emails();
|
283 |
|
284 |
+
if( ! is_array( $banned_emails ) || empty( $banned_emails ) ) {
|
285 |
+
return false;
|
286 |
+
}
|
287 |
+
|
288 |
foreach( $banned_emails as $banned_email ) {
|
289 |
if( is_email( $banned_email ) ) {
|
290 |
$ret = ( $banned_email == trim( $email ) ? true : false );
|
296 |
break;
|
297 |
}
|
298 |
}
|
299 |
+
|
300 |
return apply_filters( 'edd_is_email_banned', $ret, $email );
|
301 |
}
|
302 |
|
414 |
|
415 |
return $content;
|
416 |
}
|
417 |
+
|
418 |
+
/**
|
419 |
+
* Given a number and algorithem, determine if we have a valid credit card format
|
420 |
+
*
|
421 |
+
* @since 2.4
|
422 |
+
* @param integer $number The Credit Card Number to validate
|
423 |
+
* @return bool If the card number provided matches a specific format of a valid card
|
424 |
+
*/
|
425 |
+
function edd_validate_card_number_format( $number = 0 ) {
|
426 |
+
|
427 |
+
$number = trim( $number );
|
428 |
+
if ( empty( $number ) ) {
|
429 |
+
return false;
|
430 |
+
}
|
431 |
+
|
432 |
+
if ( ! is_numeric( $number ) ) {
|
433 |
+
return false;
|
434 |
+
}
|
435 |
+
|
436 |
+
$is_valid_format = false;
|
437 |
+
|
438 |
+
// First check if it passes with the passed method, Luhn by default
|
439 |
+
$is_valid_format = edd_validate_card_number_format_luhn( $number );
|
440 |
+
|
441 |
+
// Run additional checks before we start the regexing and looping by type
|
442 |
+
$is_valid_format = apply_filters( 'edd_valiate_card_format_pre_type', $is_valid_format, $number );
|
443 |
+
|
444 |
+
if ( true === $is_valid_format ) {
|
445 |
+
// We've passed our method check, onto card specific checks
|
446 |
+
$card_type = edd_detect_cc_type( $number );
|
447 |
+
$is_valid_format = ! empty( $card_type ) ? true : false;
|
448 |
+
}
|
449 |
+
|
450 |
+
return apply_filters( 'edd_cc_is_valid_format', $is_valid_format, $number );
|
451 |
+
}
|
452 |
+
|
453 |
+
/**
|
454 |
+
* Validate credit card number based on the luhn algorithm
|
455 |
+
*
|
456 |
+
* @since 2.4
|
457 |
+
* @param string $number
|
458 |
+
* @return bool
|
459 |
+
*/
|
460 |
+
function edd_validate_card_number_format_luhn( $number ) {
|
461 |
+
|
462 |
+
// Strip any non-digits (useful for credit card numbers with spaces and hyphens)
|
463 |
+
$number = preg_replace( '/\D/', '', $number );
|
464 |
+
|
465 |
+
// Set the string length and parity
|
466 |
+
$length = strlen( $number );
|
467 |
+
$parity = $length % 2;
|
468 |
+
|
469 |
+
// Loop through each digit and do the math
|
470 |
+
$total = 0;
|
471 |
+
for ( $i = 0; $i < $length; $i++ ) {
|
472 |
+
$digit = $number[ $i ];
|
473 |
+
|
474 |
+
// Multiply alternate digits by two
|
475 |
+
if ( $i % 2 == $parity ) {
|
476 |
+
$digit *= 2;
|
477 |
+
|
478 |
+
// If the sum is two digits, add them together (in effect)
|
479 |
+
if ( $digit > 9 ) {
|
480 |
+
$digit -= 9;
|
481 |
+
}
|
482 |
+
}
|
483 |
+
|
484 |
+
// Total up the digits
|
485 |
+
$total += $digit;
|
486 |
+
}
|
487 |
+
|
488 |
+
// If the total mod 10 equals 0, the number is valid
|
489 |
+
return ( $total % 10 == 0 ) ? true : false;
|
490 |
+
|
491 |
+
}
|
492 |
+
|
493 |
+
/**
|
494 |
+
* Detect credit card type based on the number and return an
|
495 |
+
* array of data to validate the credit card number
|
496 |
+
*
|
497 |
+
* @since 2.4
|
498 |
+
* @param string $number
|
499 |
+
* @return string|bool
|
500 |
+
*/
|
501 |
+
function edd_detect_cc_type( $number ) {
|
502 |
+
|
503 |
+
$return = false;
|
504 |
+
|
505 |
+
$card_types = array(
|
506 |
+
array(
|
507 |
+
'name' => 'amex',
|
508 |
+
'pattern' => '/^3[4|7]/',
|
509 |
+
'valid_length' => array( 15 ),
|
510 |
+
),
|
511 |
+
array(
|
512 |
+
'name' => 'diners_club_carte_blanche',
|
513 |
+
'pattern' => '/^30[0-5]/',
|
514 |
+
'valid_length' => array( 14 ),
|
515 |
+
),
|
516 |
+
array(
|
517 |
+
'name' => 'diners_club_international',
|
518 |
+
'pattern' => '/^36/',
|
519 |
+
'valid_length' => array( 14 ),
|
520 |
+
),
|
521 |
+
array(
|
522 |
+
'name' => 'jcb',
|
523 |
+
'pattern' => '/^35(2[89]|[3-8][0-9])/',
|
524 |
+
'valid_length' => array( 16 ),
|
525 |
+
),
|
526 |
+
array(
|
527 |
+
'name' => 'laser',
|
528 |
+
'pattern' => '/^(6304|670[69]|6771)/',
|
529 |
+
'valid_length' => array( 16, 17, 18, 19 ),
|
530 |
+
),
|
531 |
+
array(
|
532 |
+
'name' => 'visa_electron',
|
533 |
+
'pattern' => '/^(4026|417500|4508|4844|491(3|7))/',
|
534 |
+
'valid_length' => array( 16 ),
|
535 |
+
),
|
536 |
+
array(
|
537 |
+
'name' => 'visa',
|
538 |
+
'pattern' => '/^4/',
|
539 |
+
'valid_length' => array( 16 ),
|
540 |
+
),
|
541 |
+
array(
|
542 |
+
'name' => 'mastercard',
|
543 |
+
'pattern' => '/^5[1-5]/',
|
544 |
+
'valid_length' => array( 16 ),
|
545 |
+
),
|
546 |
+
array(
|
547 |
+
'name' => 'maestro',
|
548 |
+
'pattern' => '/^(5018|5020|5038|6304|6759|676[1-3])/',
|
549 |
+
'valid_length' => array( 12, 13, 14, 15, 16, 17, 18, 19 ),
|
550 |
+
),
|
551 |
+
array(
|
552 |
+
'name' => 'discover',
|
553 |
+
'pattern' => '/^(6011|622(12[6-9]|1[3-9][0-9]|[2-8][0-9]{2}|9[0-1][0-9]|92[0-5]|64[4-9])|65)/',
|
554 |
+
'valid_length' => array( 16 ),
|
555 |
+
),
|
556 |
+
);
|
557 |
+
|
558 |
+
$card_types = apply_filters( 'edd_cc_card_types', $card_types );
|
559 |
+
|
560 |
+
if ( ! is_array( $card_types ) ) {
|
561 |
+
return false;
|
562 |
+
}
|
563 |
+
|
564 |
+
foreach ( $card_types as $card_type ){
|
565 |
+
|
566 |
+
if ( preg_match( $card_type['pattern'], $number ) ) {
|
567 |
+
|
568 |
+
$number_length = strlen( $number );
|
569 |
+
if ( in_array( $number_length, $card_type['valid_length'] ) ) {
|
570 |
+
$return = $card_type['name'];
|
571 |
+
break;
|
572 |
+
}
|
573 |
+
|
574 |
+
}
|
575 |
+
|
576 |
+
}
|
577 |
+
|
578 |
+
return apply_filters( 'edd_cc_found_card_type', $return, $number, $card_types );
|
579 |
+
}
|
580 |
+
|
581 |
+
/**
|
582 |
+
* Validate credit card expiration date
|
583 |
+
*
|
584 |
+
* @since 2.4
|
585 |
+
* @param string $exp_month
|
586 |
+
* @param string $exp_year
|
587 |
+
* @return bool
|
588 |
+
*/
|
589 |
+
function edd_purchase_form_validate_cc_exp_date( $exp_month, $exp_year ) {
|
590 |
+
|
591 |
+
$month_name = date( 'M', mktime( 0, 0, 0, $exp_month, 10 ) );
|
592 |
+
$expiration = strtotime( date( 't', strtotime( $month_name . ' ' . $exp_year ) ) . ' ' . $month_name . ' ' . $exp_year . ' 11:59:59PM' );
|
593 |
+
|
594 |
+
return $expiration >= time();
|
595 |
+
|
596 |
+
}
|
includes/checkout/template.php
CHANGED
@@ -153,9 +153,24 @@ add_action( 'edd_purchase_form', 'edd_show_purchase_form' );
|
|
153 |
* @return void
|
154 |
*/
|
155 |
function edd_user_info_fields() {
|
156 |
-
|
|
|
|
|
|
|
|
|
157 |
$user_data = get_userdata( get_current_user_id() );
|
158 |
-
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
159 |
?>
|
160 |
<fieldset id="edd_checkout_user_info">
|
161 |
<span><legend><?php echo apply_filters( 'edd_checkout_personal_info_text', __( 'Personal Info', 'edd' ) ); ?></legend></span>
|
@@ -168,7 +183,7 @@ function edd_user_info_fields() {
|
|
168 |
<?php } ?>
|
169 |
</label>
|
170 |
<span class="edd-description"><?php _e( 'We will send the purchase receipt to this address.', 'edd' ); ?></span>
|
171 |
-
<input class="edd-input required" type="email" name="edd_email" placeholder="<?php _e( 'Email address', 'edd' ); ?>" id="edd-email" value="<?php echo
|
172 |
</p>
|
173 |
<?php do_action( 'edd_purchase_form_after_email' ); ?>
|
174 |
<p id="edd-first-name-wrap">
|
@@ -179,7 +194,7 @@ function edd_user_info_fields() {
|
|
179 |
<?php } ?>
|
180 |
</label>
|
181 |
<span class="edd-description"><?php _e( 'We will use this to personalize your account experience.', 'edd' ); ?></span>
|
182 |
-
<input class="edd-input required" type="text" name="edd_first" placeholder="<?php _e( 'First name', 'edd' ); ?>" id="edd-first" value="<?php echo
|
183 |
</p>
|
184 |
<p id="edd-last-name-wrap">
|
185 |
<label class="edd-label" for="edd-last">
|
@@ -189,7 +204,7 @@ function edd_user_info_fields() {
|
|
189 |
<?php } ?>
|
190 |
</label>
|
191 |
<span class="edd-description"><?php _e( 'We will use this as well to personalize your account experience.', 'edd' ); ?></span>
|
192 |
-
<input class="edd-input<?php if( edd_field_is_required( 'edd_last' ) ) { echo ' required'; } ?>" type="text" name="edd_last" id="edd-last" placeholder="<?php _e( 'Last name', 'edd' ); ?>" value="<?php echo
|
193 |
</p>
|
194 |
<?php do_action( 'edd_purchase_form_user_info' ); ?>
|
195 |
<?php do_action( 'edd_purchase_form_user_info_fields' ); ?>
|
@@ -277,14 +292,34 @@ add_action( 'edd_cc_form', 'edd_get_cc_form' );
|
|
277 |
function edd_default_cc_address_fields() {
|
278 |
|
279 |
$logged_in = is_user_logged_in();
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
280 |
|
281 |
if( $logged_in ) {
|
|
|
282 |
$user_address = get_user_meta( get_current_user_id(), '_edd_user_address', true );
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
283 |
}
|
284 |
-
|
285 |
-
$line2 = $logged_in && ! empty( $user_address['line2'] ) ? $user_address['line2'] : '';
|
286 |
-
$city = $logged_in && ! empty( $user_address['city'] ) ? $user_address['city'] : '';
|
287 |
-
$zip = $logged_in && ! empty( $user_address['zip'] ) ? $user_address['zip'] : '';
|
288 |
ob_start(); ?>
|
289 |
<fieldset id="edd_cc_address" class="cc-address">
|
290 |
<span><legend><?php _e( 'Billing Details', 'edd' ); ?></legend></span>
|
@@ -297,7 +332,7 @@ function edd_default_cc_address_fields() {
|
|
297 |
<?php } ?>
|
298 |
</label>
|
299 |
<span class="edd-description"><?php _e( 'The primary billing address for your credit card.', 'edd' ); ?></span>
|
300 |
-
<input type="text" id="card_address" name="card_address" class="card-address edd-input<?php if( edd_field_is_required( 'card_address' ) ) { echo ' required'; } ?>" placeholder="<?php _e( 'Address line 1', 'edd' ); ?>" value="<?php echo $line1; ?>"/>
|
301 |
</p>
|
302 |
<p id="edd-card-address-2-wrap">
|
303 |
<label for="card_address_2" class="edd-label">
|
@@ -307,7 +342,7 @@ function edd_default_cc_address_fields() {
|
|
307 |
<?php } ?>
|
308 |
</label>
|
309 |
<span class="edd-description"><?php _e( 'The suite, apt no, PO box, etc, associated with your billing address.', 'edd' ); ?></span>
|
310 |
-
<input type="text" id="card_address_2" name="card_address_2" class="card-address-2 edd-input<?php if( edd_field_is_required( 'card_address_2' ) ) { echo ' required'; } ?>" placeholder="<?php _e( 'Address line 2', 'edd' ); ?>" value="<?php echo $line2; ?>"/>
|
311 |
</p>
|
312 |
<p id="edd-card-city-wrap">
|
313 |
<label for="card_city" class="edd-label">
|
@@ -317,7 +352,7 @@ function edd_default_cc_address_fields() {
|
|
317 |
<?php } ?>
|
318 |
</label>
|
319 |
<span class="edd-description"><?php _e( 'The city for your billing address.', 'edd' ); ?></span>
|
320 |
-
<input type="text" id="card_city" name="card_city" class="card-city edd-input<?php if( edd_field_is_required( 'card_city' ) ) { echo ' required'; } ?>" placeholder="<?php _e( 'City', 'edd' ); ?>" value="<?php echo $city; ?>"/>
|
321 |
</p>
|
322 |
<p id="edd-card-zip-wrap">
|
323 |
<label for="card_zip" class="edd-label">
|
@@ -327,7 +362,7 @@ function edd_default_cc_address_fields() {
|
|
327 |
<?php } ?>
|
328 |
</label>
|
329 |
<span class="edd-description"><?php _e( 'The zip or postal code for your billing address.', 'edd' ); ?></span>
|
330 |
-
<input type="text" size="4" name="card_zip" class="card-zip edd-input<?php if( edd_field_is_required( 'card_zip' ) ) { echo ' required'; } ?>" placeholder="<?php _e( 'Zip / Postal code', 'edd' ); ?>" value="<?php echo $zip; ?>"/>
|
331 |
</p>
|
332 |
<p id="edd-card-country-wrap">
|
333 |
<label for="billing_country" class="edd-label">
|
@@ -342,8 +377,8 @@ function edd_default_cc_address_fields() {
|
|
342 |
|
343 |
$selected_country = edd_get_shop_country();
|
344 |
|
345 |
-
if(
|
346 |
-
$selected_country = $
|
347 |
}
|
348 |
|
349 |
$countries = edd_get_country_list();
|
@@ -365,8 +400,8 @@ function edd_default_cc_address_fields() {
|
|
365 |
$selected_state = edd_get_shop_state();
|
366 |
$states = edd_get_shop_states( $selected_country );
|
367 |
|
368 |
-
if(
|
369 |
-
$selected_state = $
|
370 |
}
|
371 |
|
372 |
if( ! empty( $states ) ) : ?>
|
@@ -436,7 +471,7 @@ function edd_get_register_fields() {
|
|
436 |
<input name="edd_user_login" id="edd_user_login" class="<?php if(edd_no_guest_checkout()) { echo 'required '; } ?>edd-input" type="text" placeholder="<?php _e( 'Username', 'edd' ); ?>" title="<?php _e( 'Username', 'edd' ); ?>"/>
|
437 |
</p>
|
438 |
<p id="edd-user-pass-wrap">
|
439 |
-
<label for="
|
440 |
<?php _e( 'Password', 'edd' ); ?>
|
441 |
<?php if( edd_no_guest_checkout() ) { ?>
|
442 |
<span class="edd-required-indicator">*</span>
|
@@ -446,7 +481,7 @@ function edd_get_register_fields() {
|
|
446 |
<input name="edd_user_pass" id="edd_user_pass" class="<?php if(edd_no_guest_checkout()) { echo 'required '; } ?>edd-input" placeholder="<?php _e( 'Password', 'edd' ); ?>" type="password"/>
|
447 |
</p>
|
448 |
<p id="edd-user-pass-confirm-wrap" class="edd_register_password">
|
449 |
-
<label for="
|
450 |
<?php _e( 'Password Again', 'edd' ); ?>
|
451 |
<?php if( edd_no_guest_checkout() ) { ?>
|
452 |
<span class="edd-required-indicator">*</span>
|
@@ -526,7 +561,7 @@ add_action( 'edd_purchase_form_login_fields', 'edd_get_login_fields' );
|
|
526 |
* @return void
|
527 |
*/
|
528 |
function edd_payment_mode_select() {
|
529 |
-
$gateways = edd_get_enabled_payment_gateways();
|
530 |
$page_URL = edd_get_current_page_url();
|
531 |
do_action('edd_payment_mode_top'); ?>
|
532 |
<?php if( edd_is_ajax_disabled() ) { ?>
|
@@ -673,7 +708,7 @@ function edd_discount_field() {
|
|
673 |
<span class="edd-description"><?php _e( 'Enter a coupon code if you have one.', 'edd' ); ?></span>
|
674 |
<input class="edd-input" type="text" id="edd-discount" name="edd-discount" placeholder="<?php _e( 'Enter discount', 'edd' ); ?>"/>
|
675 |
<input type="submit" class="edd-apply-discount edd-submit button <?php echo $color . ' ' . $style; ?>" value="<?php echo _x( 'Apply', 'Apply discount at checkout', 'edd' ); ?>"/>
|
676 |
-
<span id="edd-discount-error-wrap" class="
|
677 |
</p>
|
678 |
</fieldset>
|
679 |
<?php
|
@@ -858,7 +893,7 @@ function edd_filter_success_page_content( $content ) {
|
|
858 |
$content = apply_filters( 'edd_payment_confirm_' . $_GET['payment-confirmation'], $content );
|
859 |
}
|
860 |
}
|
861 |
-
|
862 |
return $content;
|
863 |
}
|
864 |
add_filter( 'the_content', 'edd_filter_success_page_content' );
|
153 |
* @return void
|
154 |
*/
|
155 |
function edd_user_info_fields() {
|
156 |
+
|
157 |
+
$customer = EDD()->session->get( 'customer' );
|
158 |
+
$customer = wp_parse_args( $customer, array( 'first_name' => '', 'last_name' => '', 'email' => '' ) );
|
159 |
+
|
160 |
+
if( is_user_logged_in() ) {
|
161 |
$user_data = get_userdata( get_current_user_id() );
|
162 |
+
foreach( $customer as $key => $field ) {
|
163 |
+
|
164 |
+
if ( 'email' == $key && empty( $field ) ) {
|
165 |
+
$customer[ $key ] = $user_data->user_email;
|
166 |
+
} elseif ( empty( $field ) ) {
|
167 |
+
$customer[ $key ] = $user_data->$key;
|
168 |
+
}
|
169 |
+
|
170 |
+
}
|
171 |
+
}
|
172 |
+
|
173 |
+
$customer = array_map( 'sanitize_text_field', $customer );
|
174 |
?>
|
175 |
<fieldset id="edd_checkout_user_info">
|
176 |
<span><legend><?php echo apply_filters( 'edd_checkout_personal_info_text', __( 'Personal Info', 'edd' ) ); ?></legend></span>
|
183 |
<?php } ?>
|
184 |
</label>
|
185 |
<span class="edd-description"><?php _e( 'We will send the purchase receipt to this address.', 'edd' ); ?></span>
|
186 |
+
<input class="edd-input required" type="email" name="edd_email" placeholder="<?php _e( 'Email address', 'edd' ); ?>" id="edd-email" value="<?php echo esc_attr( $customer['email'] ); ?>"/>
|
187 |
</p>
|
188 |
<?php do_action( 'edd_purchase_form_after_email' ); ?>
|
189 |
<p id="edd-first-name-wrap">
|
194 |
<?php } ?>
|
195 |
</label>
|
196 |
<span class="edd-description"><?php _e( 'We will use this to personalize your account experience.', 'edd' ); ?></span>
|
197 |
+
<input class="edd-input required" type="text" name="edd_first" placeholder="<?php _e( 'First name', 'edd' ); ?>" id="edd-first" value="<?php echo esc_attr( $customer['first_name'] ); ?>"/>
|
198 |
</p>
|
199 |
<p id="edd-last-name-wrap">
|
200 |
<label class="edd-label" for="edd-last">
|
204 |
<?php } ?>
|
205 |
</label>
|
206 |
<span class="edd-description"><?php _e( 'We will use this as well to personalize your account experience.', 'edd' ); ?></span>
|
207 |
+
<input class="edd-input<?php if( edd_field_is_required( 'edd_last' ) ) { echo ' required'; } ?>" type="text" name="edd_last" id="edd-last" placeholder="<?php _e( 'Last name', 'edd' ); ?>" value="<?php echo esc_attr( $customer['last_name'] ); ?>"/>
|
208 |
</p>
|
209 |
<?php do_action( 'edd_purchase_form_user_info' ); ?>
|
210 |
<?php do_action( 'edd_purchase_form_user_info_fields' ); ?>
|
292 |
function edd_default_cc_address_fields() {
|
293 |
|
294 |
$logged_in = is_user_logged_in();
|
295 |
+
$customer = EDD()->session->get( 'customer' );
|
296 |
+
$customer = wp_parse_args( $customer, array( 'address' => array(
|
297 |
+
'line1' => '',
|
298 |
+
'line2' => '',
|
299 |
+
'city' => '',
|
300 |
+
'zip' => '',
|
301 |
+
'state' => '',
|
302 |
+
'country' => ''
|
303 |
+
) ) );
|
304 |
+
|
305 |
+
$customer['address'] = array_map( 'sanitize_text_field', $customer['address'] );
|
306 |
|
307 |
if( $logged_in ) {
|
308 |
+
|
309 |
$user_address = get_user_meta( get_current_user_id(), '_edd_user_address', true );
|
310 |
+
|
311 |
+
foreach( $customer['address'] as $key => $field ) {
|
312 |
+
|
313 |
+
if ( empty( $field ) && ! empty( $user_address[ $key ] ) ) {
|
314 |
+
$customer['address'][ $key ] = $user_address[ $key ];
|
315 |
+
} else {
|
316 |
+
$customer['address'][ $key ] = '';
|
317 |
+
}
|
318 |
+
|
319 |
+
}
|
320 |
+
|
321 |
}
|
322 |
+
|
|
|
|
|
|
|
323 |
ob_start(); ?>
|
324 |
<fieldset id="edd_cc_address" class="cc-address">
|
325 |
<span><legend><?php _e( 'Billing Details', 'edd' ); ?></legend></span>
|
332 |
<?php } ?>
|
333 |
</label>
|
334 |
<span class="edd-description"><?php _e( 'The primary billing address for your credit card.', 'edd' ); ?></span>
|
335 |
+
<input type="text" id="card_address" name="card_address" class="card-address edd-input<?php if( edd_field_is_required( 'card_address' ) ) { echo ' required'; } ?>" placeholder="<?php _e( 'Address line 1', 'edd' ); ?>" value="<?php echo $customer['address']['line1']; ?>"/>
|
336 |
</p>
|
337 |
<p id="edd-card-address-2-wrap">
|
338 |
<label for="card_address_2" class="edd-label">
|
342 |
<?php } ?>
|
343 |
</label>
|
344 |
<span class="edd-description"><?php _e( 'The suite, apt no, PO box, etc, associated with your billing address.', 'edd' ); ?></span>
|
345 |
+
<input type="text" id="card_address_2" name="card_address_2" class="card-address-2 edd-input<?php if( edd_field_is_required( 'card_address_2' ) ) { echo ' required'; } ?>" placeholder="<?php _e( 'Address line 2', 'edd' ); ?>" value="<?php echo $customer['address']['line2']; ?>"/>
|
346 |
</p>
|
347 |
<p id="edd-card-city-wrap">
|
348 |
<label for="card_city" class="edd-label">
|
352 |
<?php } ?>
|
353 |
</label>
|
354 |
<span class="edd-description"><?php _e( 'The city for your billing address.', 'edd' ); ?></span>
|
355 |
+
<input type="text" id="card_city" name="card_city" class="card-city edd-input<?php if( edd_field_is_required( 'card_city' ) ) { echo ' required'; } ?>" placeholder="<?php _e( 'City', 'edd' ); ?>" value="<?php echo $customer['address']['city']; ?>"/>
|
356 |
</p>
|
357 |
<p id="edd-card-zip-wrap">
|
358 |
<label for="card_zip" class="edd-label">
|
362 |
<?php } ?>
|
363 |
</label>
|
364 |
<span class="edd-description"><?php _e( 'The zip or postal code for your billing address.', 'edd' ); ?></span>
|
365 |
+
<input type="text" size="4" name="card_zip" class="card-zip edd-input<?php if( edd_field_is_required( 'card_zip' ) ) { echo ' required'; } ?>" placeholder="<?php _e( 'Zip / Postal code', 'edd' ); ?>" value="<?php echo $customer['address']['zip']; ?>"/>
|
366 |
</p>
|
367 |
<p id="edd-card-country-wrap">
|
368 |
<label for="billing_country" class="edd-label">
|
377 |
|
378 |
$selected_country = edd_get_shop_country();
|
379 |
|
380 |
+
if( ! empty( $customer['address']['country'] ) && '*' !== $customer['address']['country'] ) {
|
381 |
+
$selected_country = $customer['address']['country'];
|
382 |
}
|
383 |
|
384 |
$countries = edd_get_country_list();
|
400 |
$selected_state = edd_get_shop_state();
|
401 |
$states = edd_get_shop_states( $selected_country );
|
402 |
|
403 |
+
if( ! empty( $customer['address']['state'] ) ) {
|
404 |
+
$selected_state = $customer['address']['state'];
|
405 |
}
|
406 |
|
407 |
if( ! empty( $states ) ) : ?>
|
471 |
<input name="edd_user_login" id="edd_user_login" class="<?php if(edd_no_guest_checkout()) { echo 'required '; } ?>edd-input" type="text" placeholder="<?php _e( 'Username', 'edd' ); ?>" title="<?php _e( 'Username', 'edd' ); ?>"/>
|
472 |
</p>
|
473 |
<p id="edd-user-pass-wrap">
|
474 |
+
<label for="edd_user_pass">
|
475 |
<?php _e( 'Password', 'edd' ); ?>
|
476 |
<?php if( edd_no_guest_checkout() ) { ?>
|
477 |
<span class="edd-required-indicator">*</span>
|
481 |
<input name="edd_user_pass" id="edd_user_pass" class="<?php if(edd_no_guest_checkout()) { echo 'required '; } ?>edd-input" placeholder="<?php _e( 'Password', 'edd' ); ?>" type="password"/>
|
482 |
</p>
|
483 |
<p id="edd-user-pass-confirm-wrap" class="edd_register_password">
|
484 |
+
<label for="edd_user_pass_confirm">
|
485 |
<?php _e( 'Password Again', 'edd' ); ?>
|
486 |
<?php if( edd_no_guest_checkout() ) { ?>
|
487 |
<span class="edd-required-indicator">*</span>
|
561 |
* @return void
|
562 |
*/
|
563 |
function edd_payment_mode_select() {
|
564 |
+
$gateways = edd_get_enabled_payment_gateways( true );
|
565 |
$page_URL = edd_get_current_page_url();
|
566 |
do_action('edd_payment_mode_top'); ?>
|
567 |
<?php if( edd_is_ajax_disabled() ) { ?>
|
708 |
<span class="edd-description"><?php _e( 'Enter a coupon code if you have one.', 'edd' ); ?></span>
|
709 |
<input class="edd-input" type="text" id="edd-discount" name="edd-discount" placeholder="<?php _e( 'Enter discount', 'edd' ); ?>"/>
|
710 |
<input type="submit" class="edd-apply-discount edd-submit button <?php echo $color . ' ' . $style; ?>" value="<?php echo _x( 'Apply', 'Apply discount at checkout', 'edd' ); ?>"/>
|
711 |
+
<span id="edd-discount-error-wrap" class="edd_error edd-alert edd-alert-error" style="display:none;"></span>
|
712 |
</p>
|
713 |
</fieldset>
|
714 |
<?php
|
893 |
$content = apply_filters( 'edd_payment_confirm_' . $_GET['payment-confirmation'], $content );
|
894 |
}
|
895 |
}
|
896 |
+
|
897 |
return $content;
|
898 |
}
|
899 |
add_filter( 'the_content', 'edd_filter_success_page_content' );
|
includes/class-edd-cli.php
CHANGED
@@ -372,7 +372,7 @@ class EDD_CLI extends WP_CLI_Command {
|
|
372 |
WP_CLI::line( __( 'Fees:', 'edd' ) );
|
373 |
|
374 |
foreach( $sale['fees'] as $fee ) {
|
375 |
-
WP_CLI::line( sprintf( __( ' Fee: %s - %s', 'edd' ), edd_format_amount( $fee['amount'] )
|
376 |
}
|
377 |
}
|
378 |
|
372 |
WP_CLI::line( __( 'Fees:', 'edd' ) );
|
373 |
|
374 |
foreach( $sale['fees'] as $fee ) {
|
375 |
+
WP_CLI::line( sprintf( __( ' Fee: %s - %s', 'edd' ), edd_format_amount( $fee['amount'] ), edd_get_currency() ) );
|
376 |
}
|
377 |
}
|
378 |
|
includes/class-edd-db-customers.php
CHANGED
@@ -35,6 +35,8 @@ class EDD_DB_Customers extends EDD_DB {
|
|
35 |
$this->primary_key = 'id';
|
36 |
$this->version = '1.0';
|
37 |
|
|
|
|
|
38 |
}
|
39 |
|
40 |
/**
|
@@ -256,6 +258,52 @@ class EDD_DB_Customers extends EDD_DB {
|
|
256 |
|
257 |
}
|
258 |
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
259 |
/**
|
260 |
* Retrieves a single customer from the database
|
261 |
*
|
@@ -344,18 +392,18 @@ class EDD_DB_Customers extends EDD_DB {
|
|
344 |
$args['number'] = 999999999999;
|
345 |
}
|
346 |
|
347 |
-
$where = '';
|
348 |
|
349 |
// specific customers
|
350 |
if( ! empty( $args['id'] ) ) {
|
351 |
|
352 |
if( is_array( $args['id'] ) ) {
|
353 |
-
$ids = implode( ',', $args['id'] );
|
354 |
} else {
|
355 |
$ids = intval( $args['id'] );
|
356 |
}
|
357 |
|
358 |
-
$where .= "
|
359 |
|
360 |
}
|
361 |
|
@@ -363,17 +411,12 @@ class EDD_DB_Customers extends EDD_DB {
|
|
363 |
if( ! empty( $args['user_id'] ) ) {
|
364 |
|
365 |
if( is_array( $args['user_id'] ) ) {
|
366 |
-
$user_ids = implode( ',', $args['user_id'] );
|
367 |
} else {
|
368 |
$user_ids = intval( $args['user_id'] );
|
369 |
}
|
370 |
|
371 |
-
|
372 |
-
$where .= " AND `user_id` IN( {$user_ids} ) ";
|
373 |
-
} else {
|
374 |
-
$where .= "WHERE `user_id` IN( {$user_ids} ) ";
|
375 |
-
}
|
376 |
-
|
377 |
|
378 |
}
|
379 |
|
@@ -386,22 +429,13 @@ class EDD_DB_Customers extends EDD_DB {
|
|
386 |
$emails = "'" . $args['email'] . "'";
|
387 |
}
|
388 |
|
389 |
-
|
390 |
-
$where .= " AND `email` IN( {$emails} ) ";
|
391 |
-
} else {
|
392 |
-
$where .= "WHERE `email` IN( {$emails} ) ";
|
393 |
-
}
|
394 |
|
395 |
}
|
396 |
|
397 |
// specific customers by name
|
398 |
if( ! empty( $args['name'] ) ) {
|
399 |
-
|
400 |
-
if( ! empty( $where ) ) {
|
401 |
-
$where .= " AND `name` LIKE '" . $args['name'] . "' ";
|
402 |
-
} else {
|
403 |
-
$where .= "WHERE `name` LIKE '%%" . $args['name'] . "%%' ";
|
404 |
-
}
|
405 |
}
|
406 |
|
407 |
// Customers created for a specific date or in a date range
|
@@ -413,15 +447,7 @@ class EDD_DB_Customers extends EDD_DB {
|
|
413 |
|
414 |
$start = date( 'Y-m-d H:i:s', strtotime( $args['date']['start'] ) );
|
415 |
|
416 |
-
|
417 |
-
|
418 |
-
$where .= " AND `date_created` >= '{$start}'";
|
419 |
-
|
420 |
-
} else {
|
421 |
-
|
422 |
-
$where .= " WHERE `date_created` >= '{$start}'";
|
423 |
-
|
424 |
-
}
|
425 |
|
426 |
}
|
427 |
|
@@ -429,15 +455,7 @@ class EDD_DB_Customers extends EDD_DB {
|
|
429 |
|
430 |
$end = date( 'Y-m-d H:i:s', strtotime( $args['date']['end'] ) );
|
431 |
|
432 |
-
|
433 |
-
|
434 |
-
$where .= " AND `date_created` <= '{$end}'";
|
435 |
-
|
436 |
-
} else {
|
437 |
-
|
438 |
-
$where .= " WHERE `date_created` <= '{$end}'";
|
439 |
-
|
440 |
-
}
|
441 |
|
442 |
}
|
443 |
|
@@ -447,13 +465,7 @@ class EDD_DB_Customers extends EDD_DB {
|
|
447 |
$month = date( 'm', strtotime( $args['date'] ) );
|
448 |
$day = date( 'd', strtotime( $args['date'] ) );
|
449 |
|
450 |
-
|
451 |
-
$where .= " WHERE";
|
452 |
-
} else {
|
453 |
-
$where .= " AND";
|
454 |
-
}
|
455 |
-
|
456 |
-
$where .= " $year = YEAR ( date_created ) AND $month = MONTH ( date_created ) AND $day = DAY ( date_created )";
|
457 |
}
|
458 |
|
459 |
}
|
@@ -468,6 +480,9 @@ class EDD_DB_Customers extends EDD_DB {
|
|
468 |
|
469 |
$customers = wp_cache_get( $cache_key, 'customers' );
|
470 |
|
|
|
|
|
|
|
471 |
if( $customers === false ) {
|
472 |
$customers = $wpdb->get_results( $wpdb->prepare( "SELECT * FROM $this->table_name $where ORDER BY {$args['orderby']} {$args['order']} LIMIT %d,%d;", absint( $args['offset'] ), absint( $args['number'] ) ) );
|
473 |
wp_cache_set( $cache_key, $customers, 'customers', 3600 );
|
@@ -488,7 +503,7 @@ class EDD_DB_Customers extends EDD_DB {
|
|
488 |
|
489 |
global $wpdb;
|
490 |
|
491 |
-
$where = '';
|
492 |
|
493 |
if( ! empty( $args['date'] ) ) {
|
494 |
|
@@ -497,15 +512,7 @@ class EDD_DB_Customers extends EDD_DB {
|
|
497 |
$start = date( 'Y-m-d H:i:s', strtotime( $args['date']['start'] ) );
|
498 |
$end = date( 'Y-m-d H:i:s', strtotime( $args['date']['end'] ) );
|
499 |
|
500 |
-
|
501 |
-
|
502 |
-
$where .= " WHERE `date_created` >= '{$start}' AND `date_created` <= '{$end}'";
|
503 |
-
|
504 |
-
} else {
|
505 |
-
|
506 |
-
$where .= " AND `date_created` >= '{$start}' AND `date_created` <= '{$end}'";
|
507 |
-
|
508 |
-
}
|
509 |
|
510 |
} else {
|
511 |
|
@@ -513,13 +520,7 @@ class EDD_DB_Customers extends EDD_DB {
|
|
513 |
$month = date( 'm', strtotime( $args['date'] ) );
|
514 |
$day = date( 'd', strtotime( $args['date'] ) );
|
515 |
|
516 |
-
|
517 |
-
$where .= " WHERE";
|
518 |
-
} else {
|
519 |
-
$where .= " AND";
|
520 |
-
}
|
521 |
-
|
522 |
-
$where .= " $year = YEAR ( date_created ) AND $month = MONTH ( date_created ) AND $day = DAY ( date_created )";
|
523 |
}
|
524 |
|
525 |
}
|
@@ -569,4 +570,14 @@ class EDD_DB_Customers extends EDD_DB {
|
|
569 |
|
570 |
update_option( $this->table_name . '_db_version', $this->version );
|
571 |
}
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
572 |
}
|
35 |
$this->primary_key = 'id';
|
36 |
$this->version = '1.0';
|
37 |
|
38 |
+
add_action( 'profile_update', array( $this, 'update_customer_email_on_user_update' ), 10, 2 );
|
39 |
+
|
40 |
}
|
41 |
|
42 |
/**
|
258 |
|
259 |
}
|
260 |
|
261 |
+
/**
|
262 |
+
* Updates the email address of a customer record when the email on a user is updated
|
263 |
+
*
|
264 |
+
* @access public
|
265 |
+
* @since 2.4
|
266 |
+
*/
|
267 |
+
public function update_customer_email_on_user_update( $user_id = 0, $old_user_data ) {
|
268 |
+
|
269 |
+
$customer = new EDD_Customer( $user_id, true );
|
270 |
+
|
271 |
+
if( ! $customer ) {
|
272 |
+
return false;
|
273 |
+
}
|
274 |
+
|
275 |
+
$user = get_userdata( $user_id );
|
276 |
+
|
277 |
+
if( ! empty( $user ) && $user->user_email !== $customer->email ) {
|
278 |
+
|
279 |
+
if( ! $this->get_customer_by( 'email', $user->user_email ) ) {
|
280 |
+
|
281 |
+
$success = $this->update( $customer->id, array( 'email' => $user->user_email ) );
|
282 |
+
|
283 |
+
if( $success ) {
|
284 |
+
// Update some payment meta if we need to
|
285 |
+
$payments_array = explode( ',', $customer->payment_ids );
|
286 |
+
|
287 |
+
if( ! empty( $payments_array ) ) {
|
288 |
+
|
289 |
+
foreach ( $payments_array as $payment_id ) {
|
290 |
+
|
291 |
+
edd_update_payment_meta( $payment_id, 'email', $user->user_email );
|
292 |
+
|
293 |
+
}
|
294 |
+
|
295 |
+
}
|
296 |
+
|
297 |
+
do_action( 'edd_update_customer_email_on_user_update', $user, $customer );
|
298 |
+
|
299 |
+
}
|
300 |
+
|
301 |
+
}
|
302 |
+
|
303 |
+
}
|
304 |
+
|
305 |
+
}
|
306 |
+
|
307 |
/**
|
308 |
* Retrieves a single customer from the database
|
309 |
*
|
392 |
$args['number'] = 999999999999;
|
393 |
}
|
394 |
|
395 |
+
$where = ' WHERE 1=1 ';
|
396 |
|
397 |
// specific customers
|
398 |
if( ! empty( $args['id'] ) ) {
|
399 |
|
400 |
if( is_array( $args['id'] ) ) {
|
401 |
+
$ids = implode( ',', array_map('intval', $args['id'] ) );
|
402 |
} else {
|
403 |
$ids = intval( $args['id'] );
|
404 |
}
|
405 |
|
406 |
+
$where .= " AND `id` IN( {$ids} ) ";
|
407 |
|
408 |
}
|
409 |
|
411 |
if( ! empty( $args['user_id'] ) ) {
|
412 |
|
413 |
if( is_array( $args['user_id'] ) ) {
|
414 |
+
$user_ids = implode( ',', array_map('intval', $args['user_id'] ) );
|
415 |
} else {
|
416 |
$user_ids = intval( $args['user_id'] );
|
417 |
}
|
418 |
|
419 |
+
$where .= " AND `user_id` IN( {$user_ids} ) ";
|
|
|
|
|
|
|
|
|
|
|
420 |
|
421 |
}
|
422 |
|
429 |
$emails = "'" . $args['email'] . "'";
|
430 |
}
|
431 |
|
432 |
+
$where .= $wpdb->prepare( " AND `email` IN( {%s} ) ", $emails );
|
|
|
|
|
|
|
|
|
433 |
|
434 |
}
|
435 |
|
436 |
// specific customers by name
|
437 |
if( ! empty( $args['name'] ) ) {
|
438 |
+
$where .= $wpdb->prepare( " AND `name` LIKE '%%" . '%s' . "%%' ", $args['name'] );
|
|
|
|
|
|
|
|
|
|
|
439 |
}
|
440 |
|
441 |
// Customers created for a specific date or in a date range
|
447 |
|
448 |
$start = date( 'Y-m-d H:i:s', strtotime( $args['date']['start'] ) );
|
449 |
|
450 |
+
$where .= " AND `date_created` >= '{$start}'";
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
451 |
|
452 |
}
|
453 |
|
455 |
|
456 |
$end = date( 'Y-m-d H:i:s', strtotime( $args['date']['end'] ) );
|
457 |
|
458 |
+
$where .= " AND `date_created` <= '{$end}'";
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
459 |
|
460 |
}
|
461 |
|
465 |
$month = date( 'm', strtotime( $args['date'] ) );
|
466 |
$day = date( 'd', strtotime( $args['date'] ) );
|
467 |
|
468 |
+
$where .= " AND $year = YEAR ( date_created ) AND $month = MONTH ( date_created ) AND $day = DAY ( date_created )";
|
|
|
|
|
|
|
|
|
|
|
|
|
469 |
}
|
470 |
|
471 |
}
|
480 |
|
481 |
$customers = wp_cache_get( $cache_key, 'customers' );
|
482 |
|
483 |
+
$args['orderby'] = esc_sql( $args['orderby'] );
|
484 |
+
$args['order'] = esc_sql( $args['order'] );
|
485 |
+
|
486 |
if( $customers === false ) {
|
487 |
$customers = $wpdb->get_results( $wpdb->prepare( "SELECT * FROM $this->table_name $where ORDER BY {$args['orderby']} {$args['order']} LIMIT %d,%d;", absint( $args['offset'] ), absint( $args['number'] ) ) );
|
488 |
wp_cache_set( $cache_key, $customers, 'customers', 3600 );
|
503 |
|
504 |
global $wpdb;
|
505 |
|
506 |
+
$where = ' WHERE 1=1 ';
|
507 |
|
508 |
if( ! empty( $args['date'] ) ) {
|
509 |
|
512 |
$start = date( 'Y-m-d H:i:s', strtotime( $args['date']['start'] ) );
|
513 |
$end = date( 'Y-m-d H:i:s', strtotime( $args['date']['end'] ) );
|
514 |
|
515 |
+
$where .= " AND `date_created` >= '{$start}' AND `date_created` <= '{$end}'";
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
516 |
|
517 |
} else {
|
518 |
|
520 |
$month = date( 'm', strtotime( $args['date'] ) );
|
521 |
$day = date( 'd', strtotime( $args['date'] ) );
|
522 |
|
523 |
+
$where .= " AND $year = YEAR ( date_created ) AND $month = MONTH ( date_created ) AND $day = DAY ( date_created )";
|
|
|
|
|
|
|
|
|
|
|
|
|
524 |
}
|
525 |
|
526 |
}
|
570 |
|
571 |
update_option( $this->table_name . '_db_version', $this->version );
|
572 |
}
|
573 |
+
|
574 |
+
/**
|
575 |
+
* Check if the Customers table was ever installed
|
576 |
+
*
|
577 |
+
* @since 2.4
|
578 |
+
* @return bool Returns if the customers table was installed and upgrade routine run
|
579 |
+
*/
|
580 |
+
public function installed() {
|
581 |
+
return $this->table_exists( $this->table_name );
|
582 |
+
}
|
583 |
}
|
includes/class-edd-db.php
CHANGED
@@ -77,7 +77,7 @@ abstract class EDD_DB {
|
|
77 |
*/
|
78 |
public function get( $row_id ) {
|
79 |
global $wpdb;
|
80 |
-
return $wpdb->get_row( "SELECT * FROM $this->table_name WHERE $this->primary_key =
|
81 |
}
|
82 |
|
83 |
/**
|
@@ -89,7 +89,8 @@ abstract class EDD_DB {
|
|
89 |
*/
|
90 |
public function get_by( $column, $row_id ) {
|
91 |
global $wpdb;
|
92 |
-
|
|
|
93 |
}
|
94 |
|
95 |
/**
|
@@ -101,7 +102,8 @@ abstract class EDD_DB {
|
|
101 |
*/
|
102 |
public function get_column( $column, $row_id ) {
|
103 |
global $wpdb;
|
104 |
-
|
|
|
105 |
}
|
106 |
|
107 |
/**
|
@@ -113,7 +115,9 @@ abstract class EDD_DB {
|
|
113 |
*/
|
114 |
public function get_column_by( $column, $column_where, $column_value ) {
|
115 |
global $wpdb;
|
116 |
-
|
|
|
|
|
117 |
}
|
118 |
|
119 |
/**
|
@@ -218,4 +222,18 @@ abstract class EDD_DB {
|
|
218 |
return true;
|
219 |
}
|
220 |
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
221 |
}
|
77 |
*/
|
78 |
public function get( $row_id ) {
|
79 |
global $wpdb;
|
80 |
+
return $wpdb->get_row( $wpdb->prepare( "SELECT * FROM $this->table_name WHERE $this->primary_key = %s LIMIT 1;", $row_id ) );
|
81 |
}
|
82 |
|
83 |
/**
|
89 |
*/
|
90 |
public function get_by( $column, $row_id ) {
|
91 |
global $wpdb;
|
92 |
+
$column = esc_sql( $column );
|
93 |
+
return $wpdb->get_row( $wpdb->prepare( "SELECT * FROM $this->table_name WHERE $column = %s LIMIT 1;", $row_id ) );
|
94 |
}
|
95 |
|
96 |
/**
|
102 |
*/
|
103 |
public function get_column( $column, $row_id ) {
|
104 |
global $wpdb;
|
105 |
+
$column = esc_sql( $column );
|
106 |
+
return $wpdb->get_var( $wpdb->prepare( "SELECT $column FROM $this->table_name WHERE $this->primary_key = %s LIMIT 1;", $row_id ) );
|
107 |
}
|
108 |
|
109 |
/**
|
115 |
*/
|
116 |
public function get_column_by( $column, $column_where, $column_value ) {
|
117 |
global $wpdb;
|
118 |
+
$column_where = esc_sql( $column_where );
|
119 |
+
$column = esc_sql( $column );
|
120 |
+
return $wpdb->get_var( $wpdb->prepare( "SELECT $column FROM $this->table_name WHERE $column_where = %s LIMIT 1;", $column_value ) );
|
121 |
}
|
122 |
|
123 |
/**
|
222 |
return true;
|
223 |
}
|
224 |
|
225 |
+
/**
|
226 |
+
* Check if the given table exists
|
227 |
+
*
|
228 |
+
* @since 2.4
|
229 |
+
* @param string $table The table name
|
230 |
+
* @return bool If the table name exists
|
231 |
+
*/
|
232 |
+
public function table_exists( $table ) {
|
233 |
+
global $wpdb;
|
234 |
+
$table = sanitize_text_field( $table );
|
235 |
+
|
236 |
+
return $wpdb->get_var( $wpdb->prepare( "SHOW TABLES LIKE '%s'", $table ) ) === $table;
|
237 |
+
}
|
238 |
+
|
239 |
}
|
includes/class-edd-html-elements.php
CHANGED
@@ -69,6 +69,7 @@ class EDD_HTML_Elements {
|
|
69 |
$options = array();
|
70 |
|
71 |
if ( $products ) {
|
|
|
72 |
foreach ( $products as $product ) {
|
73 |
$options[ absint( $product->ID ) ] = esc_html( $product->post_title );
|
74 |
}
|
@@ -231,11 +232,12 @@ class EDD_HTML_Elements {
|
|
231 |
$options[ absint( $category->term_id ) ] = esc_html( $category->name );
|
232 |
}
|
233 |
|
|
|
234 |
$output = $this->select( array(
|
235 |
'name' => $name,
|
236 |
'selected' => $selected,
|
237 |
'options' => $options,
|
238 |
-
'show_option_all' =>
|
239 |
'show_option_none' => false
|
240 |
) );
|
241 |
|
@@ -441,6 +443,7 @@ class EDD_HTML_Elements {
|
|
441 |
}
|
442 |
|
443 |
$defaults = array(
|
|
|
444 |
'name' => isset( $name ) ? $name : 'text',
|
445 |
'value' => isset( $value ) ? $value : null,
|
446 |
'label' => isset( $label ) ? $label : null,
|
@@ -474,12 +477,30 @@ class EDD_HTML_Elements {
|
|
474 |
$output .= '<span class="edd-description">' . esc_html( $args['desc'] ) . '</span>';
|
475 |
}
|
476 |
|
477 |
-
$output .= '<input type="text" name="' . esc_attr( $args['name'] ) . '" id="' . esc_attr( $args['
|
478 |
|
479 |
$output .= '</span>';
|
480 |
|
481 |
return $output;
|
482 |
}
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
483 |
|
484 |
/**
|
485 |
* Renders an HTML textarea
|
69 |
$options = array();
|
70 |
|
71 |
if ( $products ) {
|
72 |
+
$options[0] = sprintf( __( 'Select a %s', 'edd' ), edd_get_label_singular() );
|
73 |
foreach ( $products as $product ) {
|
74 |
$options[ absint( $product->ID ) ] = esc_html( $product->post_title );
|
75 |
}
|
232 |
$options[ absint( $category->term_id ) ] = esc_html( $category->name );
|
233 |
}
|
234 |
|
235 |
+
$category_labels = edd_get_taxonomy_labels( 'download_category' );
|
236 |
$output = $this->select( array(
|
237 |
'name' => $name,
|
238 |
'selected' => $selected,
|
239 |
'options' => $options,
|
240 |
+
'show_option_all' => sprintf( _x( 'All %s', 'plural: Example: "All Categories"', 'edd' ), $category_labels['name'] ),
|
241 |
'show_option_none' => false
|
242 |
) );
|
243 |
|
443 |
}
|
444 |
|
445 |
$defaults = array(
|
446 |
+
'id' => '',
|
447 |
'name' => isset( $name ) ? $name : 'text',
|
448 |
'value' => isset( $value ) ? $value : null,
|
449 |
'label' => isset( $label ) ? $label : null,
|
477 |
$output .= '<span class="edd-description">' . esc_html( $args['desc'] ) . '</span>';
|
478 |
}
|
479 |
|
480 |
+
$output .= '<input type="text" name="' . esc_attr( $args['name'] ) . '" id="' . esc_attr( $args['id'] ) . '" autocomplete="' . esc_attr( $args['autocomplete'] ) . '" value="' . esc_attr( $args['value'] ) . '" placeholder="' . esc_attr( $args['placeholder'] ) . '" class="' . $args['class'] . '" ' . $data . '' . $disabled . '/>';
|
481 |
|
482 |
$output .= '</span>';
|
483 |
|
484 |
return $output;
|
485 |
}
|
486 |
+
/**
|
487 |
+
* Renders a date picker
|
488 |
+
*
|
489 |
+
* @since 2.4
|
490 |
+
*
|
491 |
+
* @param array $args Arguments for the text field
|
492 |
+
* @return string Datepicker field
|
493 |
+
*/
|
494 |
+
public function date_field( $args = array() ) {
|
495 |
+
|
496 |
+
if( empty( $args['class'] ) ) {
|
497 |
+
$args['class'] = 'edd_datepicker';
|
498 |
+
} elseif( ! strpos( $args['class'], 'edd_datepicker' ) ) {
|
499 |
+
$args['class'] .= ' edd_datepicker';
|
500 |
+
}
|
501 |
+
|
502 |
+
return $this->text( $args );
|
503 |
+
}
|
504 |
|
505 |
/**
|
506 |
* Renders an HTML textarea
|
includes/class-edd-license-handler.php
CHANGED
@@ -20,6 +20,7 @@ class EDD_License {
|
|
20 |
private $file;
|
21 |
private $license;
|
22 |
private $item_name;
|
|
|
23 |
private $item_shortname;
|
24 |
private $version;
|
25 |
private $author;
|
@@ -35,9 +36,16 @@ class EDD_License {
|
|
35 |
* @param string $_optname
|
36 |
* @param string $_api_url
|
37 |
*/
|
38 |
-
function __construct( $_file, $
|
|
|
39 |
$this->file = $_file;
|
40 |
-
|
|
|
|
|
|
|
|
|
|
|
|
|
41 |
$this->item_shortname = 'edd_' . preg_replace( '/[^a-zA-Z0-9_\s]/', '', str_replace( ' ', '_', strtolower( $this->item_name ) ) );
|
42 |
$this->version = $_version;
|
43 |
$this->license = trim( edd_get_option( $this->item_shortname . '_license_key', '' ) );
|
@@ -108,16 +116,23 @@ class EDD_License {
|
|
108 |
if ( 'valid' !== get_option( $this->item_shortname . '_license_active' ) )
|
109 |
return;
|
110 |
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
111 |
// Setup the updater
|
112 |
$edd_updater = new EDD_SL_Plugin_Updater(
|
113 |
$this->api_url,
|
114 |
$this->file,
|
115 |
-
|
116 |
-
'version' => $this->version,
|
117 |
-
'license' => $this->license,
|
118 |
-
'item_name' => $this->item_name,
|
119 |
-
'author' => $this->author
|
120 |
-
)
|
121 |
);
|
122 |
}
|
123 |
|
20 |
private $file;
|
21 |
private $license;
|
22 |
private $item_name;
|
23 |
+
private $item_id;
|
24 |
private $item_shortname;
|
25 |
private $version;
|
26 |
private $author;
|
36 |
* @param string $_optname
|
37 |
* @param string $_api_url
|
38 |
*/
|
39 |
+
function __construct( $_file, $_item, $_version, $_author, $_optname = null, $_api_url = null ) {
|
40 |
+
|
41 |
$this->file = $_file;
|
42 |
+
|
43 |
+
if( is_numeric( $_item ) ) {
|
44 |
+
$this->item_id = absint( $_item );
|
45 |
+
} else {
|
46 |
+
$this->item_name = $_item;
|
47 |
+
}
|
48 |
+
|
49 |
$this->item_shortname = 'edd_' . preg_replace( '/[^a-zA-Z0-9_\s]/', '', str_replace( ' ', '_', strtolower( $this->item_name ) ) );
|
50 |
$this->version = $_version;
|
51 |
$this->license = trim( edd_get_option( $this->item_shortname . '_license_key', '' ) );
|
116 |
if ( 'valid' !== get_option( $this->item_shortname . '_license_active' ) )
|
117 |
return;
|
118 |
|
119 |
+
$args = array(
|
120 |
+
'version' => $this->version,
|
121 |
+
'license' => $this->license,
|
122 |
+
'author' => $this->author
|
123 |
+
);
|
124 |
+
|
125 |
+
if( ! empty( $this->item_id ) ) {
|
126 |
+
$args['item_id'] = $this->item_id;
|
127 |
+
} else {
|
128 |
+
$args['item_name'] = $this->item_name;
|
129 |
+
}
|
130 |
+
|
131 |
// Setup the updater
|
132 |
$edd_updater = new EDD_SL_Plugin_Updater(
|
133 |
$this->api_url,
|
134 |
$this->file,
|
135 |
+
$args
|
|
|
|
|
|
|
|
|
|
|
136 |
);
|
137 |
}
|
138 |
|
includes/class-edd-session.php
CHANGED
@@ -198,7 +198,9 @@ class EDD_Session {
|
|
198 |
if( $set ) {
|
199 |
@setcookie( 'edd_items_in_cart', '1', time() + 30 * 60, COOKIEPATH, COOKIE_DOMAIN, false );
|
200 |
} else {
|
201 |
-
|
|
|
|
|
202 |
}
|
203 |
}
|
204 |
}
|
198 |
if( $set ) {
|
199 |
@setcookie( 'edd_items_in_cart', '1', time() + 30 * 60, COOKIEPATH, COOKIE_DOMAIN, false );
|
200 |
} else {
|
201 |
+
if ( isset($_COOKIE['edd_items_in_cart']) ) {
|
202 |
+
@setcookie( 'edd_items_in_cart', '', time() - 3600, COOKIEPATH, COOKIE_DOMAIN, false );
|
203 |
+
}
|
204 |
}
|
205 |
}
|
206 |
}
|
includes/discount-functions.php
CHANGED
@@ -236,6 +236,22 @@ function edd_store_discount( $details, $discount_id = null ) {
|
|
236 |
|
237 |
}
|
238 |
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
239 |
if ( edd_discount_exists( $discount_id ) && ! empty( $discount_id ) ) {
|
240 |
|
241 |
// Update an existing discount
|
@@ -770,7 +786,6 @@ function edd_discount_product_reqs_met( $code_id = null ) {
|
|
770 |
function edd_is_discount_used( $code = null, $user = '', $code_id = 0 ) {
|
771 |
|
772 |
$return = false;
|
773 |
-
$user_found = false;
|
774 |
|
775 |
if ( empty( $code_id ) ) {
|
776 |
$code_id = edd_get_discount_id_by_code( $code );
|
@@ -780,44 +795,65 @@ function edd_is_discount_used( $code = null, $user = '', $code_id = 0 ) {
|
|
780 |
}
|
781 |
|
782 |
if ( edd_discount_is_single_use( $code_id ) ) {
|
783 |
-
|
784 |
-
|
785 |
-
|
786 |
-
|
|
|
|
|
|
|
|
|
|
|
|
|
787 |
} else {
|
788 |
-
$user_data = get_user_by( 'login', $user );
|
789 |
|
790 |
-
|
791 |
-
|
792 |
-
|
793 |
-
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
794 |
}
|
795 |
-
}
|
796 |
|
797 |
-
|
798 |
-
|
799 |
'post_type' => 'edd_payment',
|
800 |
-
|
801 |
-
|
802 |
-
|
803 |
-
|
804 |
-
|
805 |
-
|
806 |
-
|
807 |
-
|
808 |
-
|
809 |
-
|
810 |
-
|
811 |
-
|
812 |
-
|
813 |
-
|
814 |
-
|
815 |
-
|
816 |
-
|
817 |
-
|
818 |
-
|
819 |
-
|
820 |
-
|
|
|
|
|
821 |
}
|
822 |
}
|
823 |
}
|
@@ -1089,6 +1125,20 @@ function edd_get_cart_item_discount_amount( $item = array() ) {
|
|
1089 |
|
1090 |
global $edd_is_last_cart_item, $edd_flat_discount_total;
|
1091 |
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
1092 |
$amount = 0;
|
1093 |
$price = edd_get_cart_item_price( $item['id'], $item['options'] );
|
1094 |
$discounted_price = $price;
|
@@ -1103,9 +1153,9 @@ function edd_get_cart_item_discount_amount( $item = array() ) {
|
|
1103 |
$code_id = edd_get_discount_id_by_code( $discount );
|
1104 |
|
1105 |
// Check discount exists
|
1106 |
-
|
1107 |
-
|
1108 |
-
|
1109 |
|
1110 |
$reqs = edd_get_discount_product_reqs( $code_id );
|
1111 |
$excluded_products = edd_get_discount_excluded_products( $code_id );
|
@@ -1327,7 +1377,7 @@ function edd_listen_for_cart_discount() {
|
|
1327 |
return;
|
1328 |
}
|
1329 |
|
1330 |
-
$code =
|
1331 |
|
1332 |
EDD()->session->set( 'preset_discount', $code );
|
1333 |
}
|
236 |
|
237 |
}
|
238 |
|
239 |
+
if( ! empty( $meta['product_reqs'] ) ) {
|
240 |
+
foreach( $meta['product_reqs'] as $key => $product ) {
|
241 |
+
if( 0 === intval( $product ) ) {
|
242 |
+
unset( $meta['product_reqs'][ $key ] );
|
243 |
+
}
|
244 |
+
}
|
245 |
+
}
|
246 |
+
|
247 |
+
if( ! empty( $meta['excluded_products'] ) ) {
|
248 |
+
foreach( $meta['excluded_products'] as $key => $product ) {
|
249 |
+
if( 0 === intval( $product ) ) {
|
250 |
+
unset( $meta['excluded_products'][ $key ] );
|
251 |
+
}
|
252 |
+
}
|
253 |
+
}
|
254 |
+
|
255 |
if ( edd_discount_exists( $discount_id ) && ! empty( $discount_id ) ) {
|
256 |
|
257 |
// Update an existing discount
|
786 |
function edd_is_discount_used( $code = null, $user = '', $code_id = 0 ) {
|
787 |
|
788 |
$return = false;
|
|
|
789 |
|
790 |
if ( empty( $code_id ) ) {
|
791 |
$code_id = edd_get_discount_id_by_code( $code );
|
795 |
}
|
796 |
|
797 |
if ( edd_discount_is_single_use( $code_id ) ) {
|
798 |
+
|
799 |
+
$payments = array();
|
800 |
+
|
801 |
+
if ( EDD()->customers->installed() ) {
|
802 |
+
|
803 |
+
$by_user_id = is_email( $user ) ? false : true;
|
804 |
+
$customer = new EDD_Customer( $user, $by_user_id );
|
805 |
+
|
806 |
+
$payments = explode( ',', $customer->payment_ids );
|
807 |
+
|
808 |
} else {
|
|
|
809 |
|
810 |
+
$user_found = false;
|
811 |
+
|
812 |
+
if ( is_email( $user ) ) {
|
813 |
+
|
814 |
+
$user_found = true; // All we need is the email
|
815 |
+
$key = '_edd_payment_user_email';
|
816 |
+
$value = $user;
|
817 |
+
|
818 |
+
} else {
|
819 |
+
|
820 |
+
$user_data = get_user_by( 'login', $user );
|
821 |
+
|
822 |
+
if ( $user_data ) {
|
823 |
+
|
824 |
+
$user_found = true;
|
825 |
+
$key = '_edd_payment_user_id';
|
826 |
+
$value = $user_data->ID;
|
827 |
+
|
828 |
+
}
|
829 |
}
|
|
|
830 |
|
831 |
+
if ( $user_found ) {
|
832 |
+
$query_args = array(
|
833 |
'post_type' => 'edd_payment',
|
834 |
+
'meta_query' => array(
|
835 |
+
array(
|
836 |
+
'key' => $key,
|
837 |
+
'value' => $value,
|
838 |
+
'compare' => '='
|
839 |
+
)
|
840 |
+
),
|
841 |
+
'fields' => 'ids'
|
842 |
+
);
|
843 |
+
|
844 |
+
$payments = get_posts( $query_args ); // Get all payments with matching email
|
845 |
+
|
846 |
+
}
|
847 |
+
}
|
848 |
+
|
849 |
+
if ( $payments ) {
|
850 |
+
foreach ( $payments as $payment ) {
|
851 |
+
// Check all matching payments for discount code.
|
852 |
+
$payment_meta = edd_get_payment_meta( $payment );
|
853 |
+
$user_info = maybe_unserialize( $payment_meta['user_info'] );
|
854 |
+
if ( $user_info['discount'] == $code ) {
|
855 |
+
edd_set_error( 'edd-discount-error', __( 'This discount has already been redeemed.', 'edd' ) );
|
856 |
+
$return = true;
|
857 |
}
|
858 |
}
|
859 |
}
|
1125 |
|
1126 |
global $edd_is_last_cart_item, $edd_flat_discount_total;
|
1127 |
|
1128 |
+
// If we're not meeting the requirements of the $item array, return or set them
|
1129 |
+
if ( empty( $item ) || empty( $item['id'] ) ) {
|
1130 |
+
return 0;
|
1131 |
+
}
|
1132 |
+
|
1133 |
+
// Quantity is a requirement of the cart options array to determine the discounted price
|
1134 |
+
if ( empty( $item['quantity'] ) ) {
|
1135 |
+
return 0;
|
1136 |
+
}
|
1137 |
+
|
1138 |
+
if ( ! isset( $item['options'] ) ) {
|
1139 |
+
$item['options'] = array();
|
1140 |
+
}
|
1141 |
+
|
1142 |
$amount = 0;
|
1143 |
$price = edd_get_cart_item_price( $item['id'], $item['options'] );
|
1144 |
$discounted_price = $price;
|
1153 |
$code_id = edd_get_discount_id_by_code( $discount );
|
1154 |
|
1155 |
// Check discount exists
|
1156 |
+
if( ! $code_id ) {
|
1157 |
+
continue;
|
1158 |
+
}
|
1159 |
|
1160 |
$reqs = edd_get_discount_product_reqs( $code_id );
|
1161 |
$excluded_products = edd_get_discount_excluded_products( $code_id );
|
1377 |
return;
|
1378 |
}
|
1379 |
|
1380 |
+
$code = preg_replace('/[^a-zA-Z0-9-_]+/', '', $_REQUEST['discount'] );
|
1381 |
|
1382 |
EDD()->session->set( 'preset_discount', $code );
|
1383 |
}
|
includes/emails/functions.php
CHANGED
@@ -37,6 +37,9 @@ function edd_email_purchase_receipt( $payment_id, $admin_notice = true ) {
|
|
37 |
$subject = apply_filters( 'edd_purchase_subject', wp_strip_all_tags( $subject ), $payment_id );
|
38 |
$subject = edd_do_email_tags( $subject, $payment_id );
|
39 |
|
|
|
|
|
|
|
40 |
$attachments = apply_filters( 'edd_receipt_attachments', array(), $payment_id, $payment_data );
|
41 |
$message = edd_do_email_tags( edd_get_email_body_content( $payment_id, $payment_data ), $payment_id );
|
42 |
|
@@ -44,7 +47,7 @@ function edd_email_purchase_receipt( $payment_id, $admin_notice = true ) {
|
|
44 |
|
45 |
$emails->__set( 'from_name', $from_name );
|
46 |
$emails->__set( 'from_email', $from_email );
|
47 |
-
$emails->__set( 'heading',
|
48 |
|
49 |
|
50 |
$headers = apply_filters( 'edd_receipt_headers', $emails->get_headers(), $payment_id, $payment_data );
|
@@ -69,12 +72,15 @@ function edd_email_test_purchase_receipt() {
|
|
69 |
$from_name = apply_filters( 'edd_purchase_from_name', $from_name, 0, array() );
|
70 |
|
71 |
$from_email = edd_get_option( 'from_email', get_bloginfo( 'admin_email' ) );
|
72 |
-
$from_email = apply_filters( '
|
73 |
|
74 |
$subject = edd_get_option( 'purchase_subject', __( 'Purchase Receipt', 'edd' ) );
|
75 |
$subject = apply_filters( 'edd_purchase_subject', wp_strip_all_tags( $subject ), 0 );
|
76 |
$subject = edd_do_email_tags( $subject, 0 );
|
77 |
|
|
|
|
|
|
|
78 |
$attachments = apply_filters( 'edd_receipt_attachments', array(), 0, array() );
|
79 |
|
80 |
$message = edd_do_email_tags( edd_get_email_body_content( 0, array() ), 0 );
|
@@ -82,7 +88,7 @@ function edd_email_test_purchase_receipt() {
|
|
82 |
$emails = EDD()->emails;
|
83 |
$emails->__set( 'from_name', $from_name );
|
84 |
$emails->__set( 'from_email', $from_email );
|
85 |
-
$emails->__set( 'heading',
|
86 |
|
87 |
$headers = apply_filters( 'edd_receipt_headers', $emails->get_headers(), 0, array() );
|
88 |
$emails->__set( 'headers', $headers );
|
@@ -115,7 +121,7 @@ function edd_admin_email_notice( $payment_id = 0, $payment_data = array() ) {
|
|
115 |
$from_name = apply_filters( 'edd_purchase_from_name', $from_name, $payment_id, $payment_data );
|
116 |
|
117 |
$from_email = edd_get_option( 'from_email', get_bloginfo( 'admin_email' ) );
|
118 |
-
$from_email = apply_filters( '
|
119 |
|
120 |
$subject = edd_get_option( 'sale_notification_subject', sprintf( __( 'New download purchase - Order #%1$s', 'edd' ), $payment_id ) );
|
121 |
$subject = apply_filters( 'edd_admin_sale_notification_subject', wp_strip_all_tags( $subject ), $payment_id );
|
@@ -166,7 +172,7 @@ function edd_get_admin_notice_emails() {
|
|
166 |
* @return mixed
|
167 |
*/
|
168 |
function edd_admin_notices_disabled( $payment_id = 0 ) {
|
169 |
-
$ret = edd_get_option( 'disable_admin_notices', false );
|
170 |
return (bool) apply_filters( 'edd_admin_notices_disabled', $ret, $payment_id );
|
171 |
}
|
172 |
|
37 |
$subject = apply_filters( 'edd_purchase_subject', wp_strip_all_tags( $subject ), $payment_id );
|
38 |
$subject = edd_do_email_tags( $subject, $payment_id );
|
39 |
|
40 |
+
$heading = edd_get_option( 'purchase_heading', __( 'Purchase Receipt', 'edd' ) );
|
41 |
+
$heading = apply_filters( 'edd_purchase_heading', $heading, $payment_id, $payment_data );
|
42 |
+
|
43 |
$attachments = apply_filters( 'edd_receipt_attachments', array(), $payment_id, $payment_data );
|
44 |
$message = edd_do_email_tags( edd_get_email_body_content( $payment_id, $payment_data ), $payment_id );
|
45 |
|
47 |
|
48 |
$emails->__set( 'from_name', $from_name );
|
49 |
$emails->__set( 'from_email', $from_email );
|
50 |
+
$emails->__set( 'heading', $heading );
|
51 |
|
52 |
|
53 |
$headers = apply_filters( 'edd_receipt_headers', $emails->get_headers(), $payment_id, $payment_data );
|
72 |
$from_name = apply_filters( 'edd_purchase_from_name', $from_name, 0, array() );
|
73 |
|
74 |
$from_email = edd_get_option( 'from_email', get_bloginfo( 'admin_email' ) );
|
75 |
+
$from_email = apply_filters( 'edd_test_purchase_from_address', $from_email, 0, array() );
|
76 |
|
77 |
$subject = edd_get_option( 'purchase_subject', __( 'Purchase Receipt', 'edd' ) );
|
78 |
$subject = apply_filters( 'edd_purchase_subject', wp_strip_all_tags( $subject ), 0 );
|
79 |
$subject = edd_do_email_tags( $subject, 0 );
|
80 |
|
81 |
+
$heading = edd_get_option( 'purchase_heading', __( 'Purchase Receipt', 'edd' ) );
|
82 |
+
$heading = apply_filters( 'edd_purchase_heading', $heading, $payment_id, $payment_data );
|
83 |
+
|
84 |
$attachments = apply_filters( 'edd_receipt_attachments', array(), 0, array() );
|
85 |
|
86 |
$message = edd_do_email_tags( edd_get_email_body_content( 0, array() ), 0 );
|
88 |
$emails = EDD()->emails;
|
89 |
$emails->__set( 'from_name', $from_name );
|
90 |
$emails->__set( 'from_email', $from_email );
|
91 |
+
$emails->__set( 'heading', $heading );
|
92 |
|
93 |
$headers = apply_filters( 'edd_receipt_headers', $emails->get_headers(), 0, array() );
|
94 |
$emails->__set( 'headers', $headers );
|
121 |
$from_name = apply_filters( 'edd_purchase_from_name', $from_name, $payment_id, $payment_data );
|
122 |
|
123 |
$from_email = edd_get_option( 'from_email', get_bloginfo( 'admin_email' ) );
|
124 |
+
$from_email = apply_filters( 'edd_admin_sale_from_address', $from_email, $payment_id, $payment_data );
|
125 |
|
126 |
$subject = edd_get_option( 'sale_notification_subject', sprintf( __( 'New download purchase - Order #%1$s', 'edd' ), $payment_id ) );
|
127 |
$subject = apply_filters( 'edd_admin_sale_notification_subject', wp_strip_all_tags( $subject ), $payment_id );
|
172 |
* @return mixed
|
173 |
*/
|
174 |
function edd_admin_notices_disabled( $payment_id = 0 ) {
|
175 |
+
$ret = edd_get_option( 'disable_admin_notices', false );
|
176 |
return (bool) apply_filters( 'edd_admin_notices_disabled', $ret, $payment_id );
|
177 |
}
|
178 |
|
includes/error-tracking.php
CHANGED
@@ -28,7 +28,7 @@ function edd_print_errors() {
|
|
28 |
$errors = edd_get_errors();
|
29 |
if ( $errors ) {
|
30 |
$classes = apply_filters( 'edd_error_class', array(
|
31 |
-
'edd_errors'
|
32 |
) );
|
33 |
echo '<div class="' . implode( ' ', $classes ) . '">';
|
34 |
// Loop error codes and display errors
|
28 |
$errors = edd_get_errors();
|
29 |
if ( $errors ) {
|
30 |
$classes = apply_filters( 'edd_error_class', array(
|
31 |
+
'edd_errors', 'edd-alert', 'edd-alert-error'
|
32 |
) );
|
33 |
echo '<div class="' . implode( ' ', $classes ) . '">';
|
34 |
// Loop error codes and display errors
|
includes/gateways/amazon-payments.php
ADDED
@@ -0,0 +1,1147 @@
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
1 |
+
<?php
|
2 |
+
namespace PayWithAmazon;
|
3 |
+
|
4 |
+
/**
|
5 |
+
* Amazon Payments Gateway
|
6 |
+
*
|
7 |
+
* @package EDD
|
8 |
+
* @subpackage Gateways
|
9 |
+
* @copyright Copyright (c) 2015, Pippin's Pages, LLC
|
10 |
+
* @license http://opensource.org/licenses/gpl-2.0.php GNU Public License
|
11 |
+
* @since 2.4
|
12 |
+
*/
|
13 |
+
|
14 |
+
// Exit if accessed directly
|
15 |
+
if ( ! defined( 'ABSPATH' ) ) exit;
|
16 |
+
|
17 |
+
final class EDD_Amazon_Payments {
|
18 |
+
|
19 |
+
private static $instance;
|
20 |
+
private $gateway_id = 'amazon';
|
21 |
+
private $client = null;
|
22 |
+
private $redirect_uri = null;
|
23 |
+
private $checkout_uri = null;
|
24 |
+
private $signin_redirect = null;
|
25 |
+
private $reference_id = null;
|
26 |
+
private $doing_ipn = false;
|
27 |
+
|
28 |
+
/**
|
29 |
+
* Get things going
|
30 |
+
*
|
31 |
+
* @access private
|
32 |
+
* @since 2.4
|
33 |
+
* @return void
|
34 |
+
*/
|
35 |
+
private function __construct() {
|
36 |
+
|
37 |
+
if ( version_compare( phpversion(), 5.3, '<' ) ) {
|
38 |
+
// The Amazon Login & Pay libraries require PHP 5.3
|
39 |
+
return;
|
40 |
+
}
|
41 |
+
|
42 |
+
$this->reference_id = ! empty( $_REQUEST['amazon_reference_id'] ) ? sanitize_text_field( $_REQUEST['amazon_reference_id'] ) : '';
|
43 |
+
|
44 |
+
// Run this separate so we can ditch as early as possible
|
45 |
+
$this->register();
|
46 |
+
|
47 |
+
if ( ! edd_is_gateway_active( $this->gateway_id ) ) {
|
48 |
+
return;
|
49 |
+
}
|
50 |
+
|
51 |
+
$this->config();
|
52 |
+
$this->includes();
|
53 |
+
$this->setup_client();
|
54 |
+
$this->filters();
|
55 |
+
$this->actions();
|
56 |
+
|
57 |
+
|
58 |
+
}
|
59 |
+
|
60 |
+
/**
|
61 |
+
* Retrieve current instance
|
62 |
+
*
|
63 |
+
* @access private
|
64 |
+
* @since 2.4
|
65 |
+
* @return EDD_Amazon_Payments instance
|
66 |
+
*/
|
67 |
+
public static function getInstance() {
|
68 |
+
|
69 |
+
if ( ! isset( self::$instance ) && ! ( self::$instance instanceof EDD_Amazon_Payments ) ) {
|
70 |
+
self::$instance = new EDD_Amazon_Payments;
|
71 |
+
}
|
72 |
+
|
73 |
+
return self::$instance;
|
74 |
+
|
75 |
+
}
|
76 |
+
|
77 |
+
/**
|
78 |
+
* Register the payment gateway
|
79 |
+
*
|
80 |
+
* @access private
|
81 |
+
* @since 2.4
|
82 |
+
* @return void
|
83 |
+
*/
|
84 |
+
private function register() {
|
85 |
+
|
86 |
+
add_filter( 'edd_payment_gateways', array( $this, 'register_gateway' ), 1, 1 );
|
87 |
+
|
88 |
+
}
|
89 |
+
|
90 |
+
/**
|
91 |
+
* Setup constant configuration for file paths
|
92 |
+
*
|
93 |
+
* @access private
|
94 |
+
* @since 2.4
|
95 |
+
* @return void
|
96 |
+
*/
|
97 |
+
private function config() {
|
98 |
+
|
99 |
+
if ( ! defined( 'EDD_AMAZON_CLASS_DIR' ) ) {
|
100 |
+
$path = trailingslashit( plugin_dir_path( EDD_PLUGIN_FILE ) ) . 'includes/gateways/libs/amazon';
|
101 |
+
define( 'EDD_AMAZON_CLASS_DIR', trailingslashit( $path ) );
|
102 |
+
}
|
103 |
+
|
104 |
+
}
|
105 |
+
|
106 |
+
/**
|
107 |
+
* Load additional files
|
108 |
+
*
|
109 |
+
* @access private
|
110 |
+
* @since 2.4
|
111 |
+
* @return void
|
112 |
+
*/
|
113 |
+
private function includes() {
|
114 |
+
|
115 |
+
// Include the Amazon Library
|
116 |
+
require_once EDD_AMAZON_CLASS_DIR . 'Client.php'; // Requires the other files itself
|
117 |
+
require_once EDD_AMAZON_CLASS_DIR . 'IpnHandler.php';
|
118 |
+
|
119 |
+
}
|
120 |
+
|
121 |
+
/**
|
122 |
+
* Add filters
|
123 |
+
*
|
124 |
+
* @since 2.4
|
125 |
+
* @return void
|
126 |
+
*/
|
127 |
+
private function filters() {
|
128 |
+
|
129 |
+
add_filter( 'edd_accepted_payment_icons', array( $this, 'register_payment_icon' ), 10, 1 );
|
130 |
+
|
131 |
+
if ( is_admin() ) {
|
132 |
+
add_filter( 'edd_settings_gateways', array( $this, 'register_gateway_settings' ), 1, 1 );
|
133 |
+
add_filter( 'edd_payment_details_transaction_id-' . $this->gateway_id, array( $this, 'link_transaction_id' ), 10, 2 );
|
134 |
+
}
|
135 |
+
|
136 |
+
}
|
137 |
+
|
138 |
+
/**
|
139 |
+
* Add actions
|
140 |
+
*
|
141 |
+
* @access private
|
142 |
+
* @since 2.4
|
143 |
+
* @return void
|
144 |
+
*/
|
145 |
+
private function actions() {
|
146 |
+
|
147 |
+
add_action( 'wp_enqueue_scripts', array( $this, 'print_client' ), 10 );
|
148 |
+
add_action( 'wp_enqueue_scripts', array( $this, 'load_scripts' ), 11 );
|
149 |
+
add_action( 'init', array( $this, 'capture_oauth' ), 9 );
|
150 |
+
add_action( 'init', array( $this, 'signin_redirect' ) );
|
151 |
+
add_action( 'edd_purchase_form_before_register_login', array( $this, 'login_form' ) );
|
152 |
+
add_action( 'edd_checkout_error_check', array( $this, 'checkout_errors' ), 10, 2 );
|
153 |
+
add_action( 'edd_gateway_amazon', array( $this, 'process_purchase' ) );
|
154 |
+
add_action( 'wp_ajax_edd_amazon_get_address', array( $this, 'ajax_get_address' ) );
|
155 |
+
add_action( 'wp_ajax_nopriv_edd_amazon_get_address', array( $this, 'ajax_get_address' ) );
|
156 |
+
add_action( 'edd_pre_process_purchase', array( $this, 'disable_address_requirement' ), 99999 );
|
157 |
+
add_action( 'init', array( $this, 'process_ipn' ) );
|
158 |
+
add_action( 'edd_update_payment_status', array( $this, 'process_refund' ), 200, 3 );
|
159 |
+
|
160 |
+
if ( empty( $this->reference_id ) ) {
|
161 |
+
return;
|
162 |
+
}
|
163 |
+
|
164 |
+
add_action( 'edd_amazon_cc_form', array( $this, 'wallet_form' ) );
|
165 |
+
|
166 |
+
}
|
167 |
+
|
168 |
+
/**
|
169 |
+
* Retrieve the client object
|
170 |
+
*
|
171 |
+
* @access private
|
172 |
+
* @since 2.4
|
173 |
+
* @return PayWithAmazon\Client
|
174 |
+
*/
|
175 |
+
private function get_client() {
|
176 |
+
|
177 |
+
if ( ! is_null( $this->client ) ) {
|
178 |
+
return $this->client;
|
179 |
+
}
|
180 |
+
|
181 |
+
$this->setup_client();
|
182 |
+
|
183 |
+
return $this->client;
|
184 |
+
}
|
185 |
+
|
186 |
+
/**
|
187 |
+
* Setup the client object
|
188 |
+
*
|
189 |
+
* @access private
|
190 |
+
* @since 2.4
|
191 |
+
* @return void
|
192 |
+
*/
|
193 |
+
private function setup_client() {
|
194 |
+
|
195 |
+
$region = edd_get_shop_country();
|
196 |
+
|
197 |
+
if( 'GB' === $region ) {
|
198 |
+
$region = 'UK';
|
199 |
+
}
|
200 |
+
|
201 |
+
$config = array(
|
202 |
+
'merchant_id' => edd_get_option( 'amazon_seller_id', '' ),
|
203 |
+
'client_id' => edd_get_option( 'amazon_client_id', '' ),
|
204 |
+
'access_key' => edd_get_option( 'amazon_mws_access_key', '' ),
|
205 |
+
'secret_key' => edd_get_option( 'amazon_mws_secret_key', '' ),
|
206 |
+
'region' => $region,
|
207 |
+
'sandbox' => edd_is_test_mode(),
|
208 |
+
);
|
209 |
+
|
210 |
+
$config = apply_filters( 'edd_amazon_client_config', $config );
|
211 |
+
|
212 |
+
$this->client = new Client( $config );
|
213 |
+
|
214 |
+
}
|
215 |
+
|
216 |
+
/**
|
217 |
+
* Register the gateway
|
218 |
+
*
|
219 |
+
* @access public
|
220 |
+
* @since 2.4
|
221 |
+
* @param $gateways array
|
222 |
+
* @return array
|
223 |
+
*/
|
224 |
+
public function register_gateway( $gateways ) {
|
225 |
+
|
226 |
+
$default_amazon_info = array(
|
227 |
+
$this->gateway_id => array(
|
228 |
+
'admin_label' => __( 'Amazon', 'edd' ),
|
229 |
+
'checkout_label' => __( 'Amazon', 'edd' ),
|
230 |
+
'supports' => array(),
|
231 |
+
),
|
232 |
+
);
|
233 |
+
|
234 |
+
$default_amazon_info = apply_filters( 'edd_register_amazon_gateway', $default_amazon_info );
|
235 |
+
$gateways = array_merge( $gateways, $default_amazon_info );
|
236 |
+
|
237 |
+
return $gateways;
|
238 |
+
|
239 |
+
}
|
240 |
+
|
241 |
+
/**
|
242 |
+
* Register the payment icon
|
243 |
+
*
|
244 |
+
* @access public
|
245 |
+
* @since 2.4
|
246 |
+
* @param array $payment_icons Array of payment icons
|
247 |
+
* @return array The array of icons with Amazon Added
|
248 |
+
*/
|
249 |
+
public function register_payment_icon( $payment_icons ) {
|
250 |
+
$payment_icons['amazon'] = 'Amazon';
|
251 |
+
|
252 |
+
return $payment_icons;
|
253 |
+
}
|
254 |
+
|
255 |
+
/**
|
256 |
+
* Register the gateway settings
|
257 |
+
*
|
258 |
+
* @access public
|
259 |
+
* @since 2.4
|
260 |
+
* @param $gateway_settings array
|
261 |
+
* @return array
|
262 |
+
*/
|
263 |
+
public function register_gateway_settings( $gateway_settings ) {
|
264 |
+
|
265 |
+
$default_amazon_settings = array(
|
266 |
+
'amazon' => array(
|
267 |
+
'id' => 'amazon',
|
268 |
+
'name' => '<span class="field-section-title">' . __( 'Login & Pay with Amazon Settings', 'edd' ) . '</span>',
|
269 |
+
'desc' => __( 'Configure the Amazon settings', 'edd' ),
|
270 |
+
'type' => 'header',
|
271 |
+
),
|
272 |
+
'amazon_register' => array(
|
273 |
+
'id' => 'amazon_register',
|
274 |
+
'name' => __( 'Register with Amazon', 'edd' ),
|
275 |
+
'desc' => sprintf( __( '<p><a href="%s" class="button" target="_blank">Connect Easy Digital Downloads to Amazon</a></p><p class="description">Once registration is complete, enter your API credentials below.</p>', 'edd' ), $this->get_registration_url() ),
|
276 |
+
'type' => 'descriptive_text',
|
277 |
+
),
|
278 |
+
'amazon_seller_id' => array(
|
279 |
+
'id' => 'amazon_seller_id',
|
280 |
+
'name' => __( 'Seller ID', 'edd' ),
|
281 |
+
'desc' => __( 'Found in the Integration settings. Also called a Merchant ID', 'edd' ),
|
282 |
+
'type' => 'text',
|
283 |
+
'size' => 'regular',
|
284 |
+
),
|
285 |
+
'amazon_mws_access_key' => array(
|
286 |
+
'id' => 'amazon_mws_access_key',
|
287 |
+
'name' => __( 'MWS Access Key', 'edd' ),
|
288 |
+
'desc' => __( 'Found on Seller Central in the MWS Keys section', 'edd' ),
|
289 |
+
'type' => 'text',
|
290 |
+
'size' => 'regular',
|
291 |
+
),
|
292 |
+
'amazon_mws_secret_key' => array(
|
293 |
+
'id' => 'amazon_mws_secret_key',
|
294 |
+
'name' => __( 'MWS Secret Key', 'edd' ),
|
295 |
+
'desc' => __( 'Found on Seller Central in the MWS Keys section', 'edd' ),
|
296 |
+
'type' => 'text',
|
297 |
+
'size' => 'regular',
|
298 |
+
),
|
299 |
+
'amazon_client_id' => array(
|
300 |
+
'id' => 'amazon_client_id',
|
301 |
+
'name' => __( 'Client ID', 'edd' ),
|
302 |
+
'desc' => __( 'The Amazon Client ID. Should look like `amzn1.application-oa2...`', 'edd' ),
|
303 |
+
'type' => 'text',
|
304 |
+
'size' => 'regular',
|
305 |
+
),
|
306 |
+
'amazon_mws_callback_url' => array(
|
307 |
+
'id' => 'amazon_callback_url',
|
308 |
+
'name' => __( 'Amazon MWS Callback URL', 'edd' ),
|
309 |
+
'desc' => __( 'The Return URL to provide in your MWS Application. Enter this under your Login and Pay → Web Settings', 'edd' ),
|
310 |
+
'type' => 'text',
|
311 |
+
'size' => 'large',
|
312 |
+
'std' => $this->get_amazon_authenticate_redirect(),
|
313 |
+
'faux' => true,
|
314 |
+
),
|
315 |
+
'amazon_mws_ipn_url' => array(
|
316 |
+
'id' => 'amazon_ipn_url',
|
317 |
+
'name' => __( 'Amazon Merchant IPN URL', 'edd' ),
|
318 |
+
'desc' => sprintf( __( 'The IPN URL to provide in your MWS account. Enter this under your <a href="%s">Integration Settings</a>', 'edd' ), 'https://sellercentral.amazon.com/gp/pyop/seller/account/settings/user-settings-edit.html' ),
|
319 |
+
'type' => 'text',
|
320 |
+
'size' => 'large',
|
321 |
+
'std' => $this->get_amazon_ipn_url(),
|
322 |
+
'faux' => true,
|
323 |
+
),
|
324 |
+
);
|
325 |
+
|
326 |
+
$default_amazon_settings = apply_filters( 'edd_default_amazon_settings', $default_amazon_settings );
|
327 |
+
$gateway_settings = array_merge( $gateway_settings, $default_amazon_settings );
|
328 |
+
|
329 |
+
return $gateway_settings;
|
330 |
+
|
331 |
+
}
|
332 |
+
|
333 |
+
/**
|
334 |
+
* Load javascript files and localized variables
|
335 |
+
*
|
336 |
+
* @access public
|
337 |
+
* @since 2.4
|
338 |
+
* @return void
|
339 |
+
*/
|
340 |
+
public function load_scripts() {
|
341 |
+
|
342 |
+
if ( ! edd_is_checkout() ) {
|
343 |
+
return;
|
344 |
+
}
|
345 |
+
|
346 |
+
$test_mode = edd_is_test_mode();
|
347 |
+
$seller_id = edd_get_option( 'amazon_seller_id', '' );
|
348 |
+
$client_id = edd_get_option( 'amazon_client_id', '' );
|
349 |
+
|
350 |
+
$default_amazon_scope = array(
|
351 |
+
'profile',
|
352 |
+
'postal_code',
|
353 |
+
'payments:widget',
|
354 |
+
);
|
355 |
+
|
356 |
+
if ( edd_use_taxes() ) {
|
357 |
+
$default_amazon_scope[] = 'payments:shipping_address';
|
358 |
+
}
|
359 |
+
|
360 |
+
$default_amazon_button_settings = array(
|
361 |
+
'type' => 'PwA',
|
362 |
+
'color' => 'Gold',
|
363 |
+
'size' => 'medium',
|
364 |
+
'scope' => implode( ' ', $default_amazon_scope ),
|
365 |
+
'popup' => true,
|
366 |
+
);
|
367 |
+
|
368 |
+
$amazon_button_settings = apply_filters( 'edd_amazon_button_settings', $default_amazon_button_settings );
|
369 |
+
$base_url = '';
|
370 |
+
$sandbox = $test_mode ? 'sandbox/' : '';
|
371 |
+
|
372 |
+
switch ( edd_get_shop_country() ) {
|
373 |
+
case 'GB':
|
374 |
+
$base_url = 'https://static-eu.payments-amazon.com/OffAmazonPayments/uk/' . $sandbox . 'lpa/';
|
375 |
+
break;
|
376 |
+
case 'DE':
|
377 |
+
$base_url = 'https://static-eu.payments-amazon.com/OffAmazonPayments/de/' . $sandbox. 'lpa/';
|
378 |
+
break;
|
379 |
+
default:
|
380 |
+
$base_url = 'https://static-na.payments-amazon.com/OffAmazonPayments/us/' . $sandbox;
|
381 |
+
break;
|
382 |
+
}
|
383 |
+
|
384 |
+
if ( ! empty( $base_url ) ) {
|
385 |
+
|
386 |
+
$url = $base_url . 'js/Widgets.js?sellerId=' . $seller_id;
|
387 |
+
|
388 |
+
wp_enqueue_script( 'edd-amazon-widgets', $url, array( 'jquery' ), null, false );
|
389 |
+
wp_localize_script( 'edd-amazon-widgets', 'edd_amazon', apply_filters( 'edd_amazon_checkout_vars', array(
|
390 |
+
'sellerId' => $seller_id,
|
391 |
+
'clientId' => $client_id,
|
392 |
+
'referenceID' => $this->reference_id,
|
393 |
+
'buttonType' => $amazon_button_settings['type'],
|
394 |
+
'buttonColor' => $amazon_button_settings['color'],
|
395 |
+
'buttonSize' => $amazon_button_settings['size'],
|
396 |
+
'scope' => $amazon_button_settings['scope'],
|
397 |
+
'popup' => $amazon_button_settings['popup'],
|
398 |
+
'checkoutUri' => $this->get_amazon_checkout_uri(),
|
399 |
+
'redirectUri' => $this->get_amazon_authenticate_redirect(),
|
400 |
+
'signinUri' => $this->get_amazon_signin_redirect(),
|
401 |
+
) ) );
|
402 |
+
|
403 |
+
}
|
404 |
+
|
405 |
+
}
|
406 |
+
|
407 |
+
/**
|
408 |
+
* Print client ID in header
|
409 |
+
*
|
410 |
+
* @access public
|
411 |
+
* @since 2.4
|
412 |
+
* @return void
|
413 |
+
*/
|
414 |
+
public function print_client() {
|
415 |
+
|
416 |
+
if ( ! edd_is_checkout() ) {
|
417 |
+
return;
|
418 |
+
}
|
419 |
+
?>
|
420 |
+
<script>
|
421 |
+
window.onAmazonLoginReady = function() {
|
422 |
+
amazon.Login.setClientId(<?php echo json_encode( edd_get_option( 'amazon_client_id', '' ) ); ?>);
|
423 |
+
};
|
424 |
+
</script>
|
425 |
+
<?php
|
426 |
+
|
427 |
+
}
|
428 |
+
|
429 |
+
/**
|
430 |
+
* Capture authentication after returning from Amazon
|
431 |
+
*
|
432 |
+
* @access public
|
433 |
+
* @since 2.4
|
434 |
+
* @return void
|
435 |
+
*/
|
436 |
+
public function capture_oauth() {
|
437 |
+
|
438 |
+
if ( ! isset( $_GET['edd-listener'] ) || $_GET['edd-listener'] !== 'amazon' ) {
|
439 |
+
return;
|
440 |
+
}
|
441 |
+
|
442 |
+
if ( ! isset( $_GET['state'] ) || $_GET['state'] !== 'return_auth' ) {
|
443 |
+
return;
|
444 |
+
}
|
445 |
+
|
446 |
+
if( empty( $_GET['access_token'] ) || false === strpos( $_GET['access_token'], 'Atza' ) ) {
|
447 |
+
return;
|
448 |
+
}
|
449 |
+
|
450 |
+
try {
|
451 |
+
|
452 |
+
$profile = $this->client->getUserInfo( $_GET['access_token'] );
|
453 |
+
|
454 |
+
EDD()->session->set( 'amazon_access_token', $_GET['access_token'] );
|
455 |
+
EDD()->session->set( 'amazon_profile', $profile );
|
456 |
+
|
457 |
+
} catch( Exception $e ) {
|
458 |
+
|
459 |
+
wp_die( print_r( $e, true ) );
|
460 |
+
|
461 |
+
}
|
462 |
+
|
463 |
+
}
|
464 |
+
|
465 |
+
/**
|
466 |
+
* Set customer details after authentication
|
467 |
+
*
|
468 |
+
* @access public
|
469 |
+
* @since 2.4
|
470 |
+
* @return void
|
471 |
+
*/
|
472 |
+
public function signin_redirect() {
|
473 |
+
|
474 |
+
if ( ! isset( $_GET['edd-listener'] ) || $_GET['edd-listener'] !== 'amazon' ) {
|
475 |
+
return;
|
476 |
+
}
|
477 |
+
|
478 |
+
if ( ! isset( $_GET['state'] ) || $_GET['state'] !== 'signed-in' ) {
|
479 |
+
return;
|
480 |
+
}
|
481 |
+
|
482 |
+
$profile = EDD()->session->get( 'amazon_profile' );
|
483 |
+
$reference = $_GET['amazon_reference_id'];
|
484 |
+
|
485 |
+
if( ! is_user_logged_in() ) {
|
486 |
+
|
487 |
+
$user = get_user_by( 'email', $profile['email'] );
|
488 |
+
|
489 |
+
if( $user ) {
|
490 |
+
|
491 |
+
edd_log_user_in( $user->ID, $user->user_login, '' );
|
492 |
+
|
493 |
+
$customer = array(
|
494 |
+
'first_name' => $user->first_name,
|
495 |
+
'last_name' => $user->last_name,
|
496 |
+
'email' => $user->user_email
|
497 |
+
);
|
498 |
+
|
499 |
+
} else {
|
500 |
+
|
501 |
+
$names = explode( ' ', $profile['name'] );
|
502 |
+
|
503 |
+
$customer = array(
|
504 |
+
'first_name' => $names[0],
|
505 |
+
'last_name' => isset( $names[1] ) ? $names[1] : '',
|
506 |
+
'email' => $profile['email']
|
507 |
+
);
|
508 |
+
|
509 |
+
if( 'none' !== edd_get_option( 'show_register_form' ) ) {
|
510 |
+
|
511 |
+
// Create a customer account if registration is not disabled
|
512 |
+
|
513 |
+
$args = array(
|
514 |
+
'user_email' => $profile['email'],
|
515 |
+
'user_login' => $profile['email'],
|
516 |
+
'display_name' => $profile['name'],
|
517 |
+
'first_name' => $customer['first_name'],
|
518 |
+
'last_name' => $customer['last_name'],
|
519 |
+
'user_pass' => wp_generate_password( 20 ),
|
520 |
+
);
|
521 |
+
|
522 |
+
$user_id = wp_insert_user( $args );
|
523 |
+
|
524 |
+
edd_log_user_in( $user_id, $args['user_login'], $args['user_pass'] );
|
525 |
+
|
526 |
+
}
|
527 |
+
|
528 |
+
}
|
529 |
+
|
530 |
+
EDD()->session->set( 'customer', $customer );
|
531 |
+
|
532 |
+
}
|
533 |
+
|
534 |
+
|
535 |
+
wp_redirect( edd_get_checkout_uri( array( 'payment-mode' => 'amazon', 'state' => 'authorized', 'amazon_reference_id' => $reference ) ) ); exit;
|
536 |
+
|
537 |
+
}
|
538 |
+
|
539 |
+
|
540 |
+
/**
|
541 |
+
* Display the log in button
|
542 |
+
*
|
543 |
+
* @access public
|
544 |
+
* @since 2.4
|
545 |
+
* @return void
|
546 |
+
*/
|
547 |
+
public function login_form() {
|
548 |
+
|
549 |
+
if ( empty( $this->reference_id ) && 'amazon' == edd_get_chosen_gateway() ) :
|
550 |
+
|
551 |
+
remove_all_actions( 'edd_purchase_form_after_cc_form' );
|
552 |
+
remove_all_actions( 'edd_purchase_form_after_user_info' );
|
553 |
+
remove_all_actions( 'edd_purchase_form_register_fields' );
|
554 |
+
remove_all_actions( 'edd_purchase_form_login_fields' );
|
555 |
+
remove_all_actions( 'edd_register_fields_before' );
|
556 |
+
remove_all_actions( 'edd_cc_form' );
|
557 |
+
remove_all_actions( 'edd_checkout_form_top' );
|
558 |
+
|
559 |
+
ob_start(); ?>
|
560 |
+
<fieldset id="edd-amazon-login-fields" class="edd-amazon-fields">
|
561 |
+
|
562 |
+
<div id="edd-amazon-pay-button"></div>
|
563 |
+
<script type="text/javascript">
|
564 |
+
var authRequest;
|
565 |
+
OffAmazonPayments.Button('edd-amazon-pay-button', edd_amazon.sellerId, {
|
566 |
+
type: edd_amazon.buttonType,
|
567 |
+
color: edd_amazon.buttonColor,
|
568 |
+
size: edd_amazon.buttonSize,
|
569 |
+
|
570 |
+
authorization: function() {
|
571 |
+
|
572 |
+
loginOptions = {
|
573 |
+
scope: edd_amazon.scope,
|
574 |
+
popup: edd_amazon.popup
|
575 |
+
};
|
576 |
+
|
577 |
+
authRequest = amazon.Login.authorize( loginOptions, edd_amazon.redirectUri );
|
578 |
+
|
579 |
+
},
|
580 |
+
onSignIn: function( orderReference ) {
|
581 |
+
amazonOrderReferenceId = orderReference.getAmazonOrderReferenceId();
|
582 |
+
window.location = edd_amazon.signinUri + '&amazon_reference_id=' + amazonOrderReferenceId;
|
583 |
+
}, onError: function(error) {
|
584 |
+
jQuery('#edd_purchase_submit').prepend( '<div class="edd_errors"><p class="edd_error" id="edd_error_"' + error.getErrorCode() + '>' + error.getErrorMessage() + '</p></div>' );
|
585 |
+
}
|
586 |
+
});
|
587 |
+
</script>
|
588 |
+
|
589 |
+
</fieldset>
|
590 |
+
|
591 |
+
<?php
|
592 |
+
|
593 |
+
echo ob_get_clean();
|
594 |
+
|
595 |
+
endif;
|
596 |
+
}
|
597 |
+
|
598 |
+
/**
|
599 |
+
* Display the wallet and address forms
|
600 |
+
*
|
601 |
+
* @access public
|
602 |
+
* @since 2.4
|
603 |
+
* @return void
|
604 |
+
*/
|
605 |
+
public function wallet_form() {
|
606 |
+
$profile = EDD()->session->get( 'amazon_profile' );
|
607 |
+
remove_action( 'edd_purchase_form_after_cc_form', 'edd_checkout_tax_fields', 999 );
|
608 |
+
ob_start(); ?>
|
609 |
+
<fieldset id="edd_cc_fields" class="edd-amazon-fields">
|
610 |
+
<p class="edd-amazon-profile-wrapper">
|
611 |
+
<?php _e( 'Currently logged into Amazon as', 'edd' ); ?>: <span class="edd-amazon-profile-name"><?php echo $profile['name']; ?></span>
|
612 |
+
<span class="edd-amazon-logout">(<a id="Logout"><?php _e( 'Logout', 'edd' ); ?></a>)</span>
|
613 |
+
</p>
|
614 |
+
|
615 |
+
<div id="edd-amazon-address-box"></div>
|
616 |
+
<div id="edd-amazon-wallet-box"></div>
|
617 |
+
<script>
|
618 |
+
var edd_scripts;
|
619 |
+
new OffAmazonPayments.Widgets.AddressBook({
|
620 |
+
sellerId: edd_amazon.sellerId,
|
621 |
+
amazonOrderReferenceId: edd_amazon.referenceID,
|
622 |
+
onOrderReferenceCreate: function(orderReference) {
|
623 |
+
orderReference.getAmazonOrderReferenceId();
|
624 |
+
},
|
625 |
+
onAddressSelect: function(orderReference) {
|
626 |
+
jQuery.ajax({
|
627 |
+
type: "POST",
|
628 |
+
data: {
|
629 |
+
action : 'edd_amazon_get_address',
|
630 |
+
reference_id : edd_amazon.referenceID
|
631 |
+
},
|
632 |
+
dataType: "json",
|
633 |
+
url: edd_scripts.ajaxurl,
|
634 |
+
xhrFields: {
|
635 |
+
withCredentials: true
|
636 |
+
},
|
637 |
+
success: function (response) {
|
638 |
+
jQuery('#card_city').val( response.City );
|
639 |
+
jQuery('#card_zip').val( response.PostalCode );
|
640 |
+
jQuery('#billing_country').val( response.CountryCode );
|
641 |
+
jQuery('#card_state').val( response.StateOrRegion ).trigger( 'change' );
|
642 |
+
}
|
643 |
+
}).fail(function (response) {
|
644 |
+
if ( window.console && window.console.log ) {
|
645 |
+
console.log( response );
|
646 |
+
}
|
647 |
+
}).done(function (response) {
|
648 |
+
|
649 |
+
});
|
650 |
+
},
|
651 |
+
design: {
|
652 |
+
designMode: 'responsive'
|
653 |
+
},
|
654 |
+
onError: function(error) {
|
655 |
+
jQuery('#edd_purchase_submit').prepend( '<div class="edd_errors"><p class="edd_error" id="edd_error_"' + error.getErrorCode() + '>' + error.getErrorMessage() + '</p></div>' );
|
656 |
+
}
|
657 |
+
}).bind("edd-amazon-address-box");
|
658 |
+
|
659 |
+
new OffAmazonPayments.Widgets.Wallet({
|
660 |
+
sellerId: edd_amazon.sellerId,
|
661 |
+
amazonOrderReferenceId: edd_amazon.referenceID,
|
662 |
+
design: {
|
663 |
+
designMode: 'responsive'
|
664 |
+
},
|
665 |
+
onPaymentSelect: function(orderReference) {
|
666 |
+
// Display your custom complete purchase button
|
667 |
+
},
|
668 |
+
onError: function(error) {
|
669 |
+
jQuery('#edd_purchase_submit').prepend( '<div class="edd_errors"><p class="edd_error" id="edd_error_"' + error.getErrorCode() + '>' + error.getErrorMessage() + '</p></div>' );
|
670 |
+
}
|
671 |
+
}).bind("edd-amazon-wallet-box");
|
672 |
+
</script>
|
673 |
+
|
674 |
+
<div id="edd_cc_address">
|
675 |
+
<input type="hidden" name="edd_amazon_reference_id" value="<?php echo esc_attr( $this->reference_id ); ?>"/>
|
676 |
+
<input type="hidden" name="card_city" class="card_city" id="card_city" value=""/>
|
677 |
+
<input type="hidden" name="card_zip" class="card_zip" id="card_zip" value=""/>
|
678 |
+
<input type="hidden" name="card_state" class="card_state" id="card_state" value=""/>
|
679 |
+
<input type="hidden" name="billing_country" class="billing_country" id="billing_country" value=""/>
|
680 |
+
</div>
|
681 |
+
|
682 |
+
</fieldset>
|
683 |
+
|
684 |
+
<?php
|
685 |
+
$form = ob_get_clean();
|
686 |
+
echo $form;
|
687 |
+
|
688 |
+
}
|
689 |
+
|
690 |
+
/**
|
691 |
+
* Retrieve the billing address via ajax
|
692 |
+
*
|
693 |
+
* @access public
|
694 |
+
* @since 2.4
|
695 |
+
* @return void
|
696 |
+
*/
|
697 |
+
public function ajax_get_address() {
|
698 |
+
|
699 |
+
if( empty( $_POST['reference_id'] ) ) {
|
700 |
+
die( '-2' );
|
701 |
+
}
|
702 |
+
|
703 |
+
$request = $this->client->getOrderReferenceDetails( array(
|
704 |
+
'merchant_id' => edd_get_option( 'amazon_seller_id', '' ),
|
705 |
+
'amazon_order_reference_id' => $_POST['reference_id'],
|
706 |
+
) );
|
707 |
+
|
708 |
+
|
709 |
+
$address = array();
|
710 |
+
$data = new ResponseParser( $request->response );
|
711 |
+
$data = $data->toArray();
|
712 |
+
|
713 |
+
if( isset( $data['GetOrderReferenceDetailsResult']['OrderReferenceDetails']['Destination']['PhysicalDestination'] ) ) {
|
714 |
+
|
715 |
+
$address = $data['GetOrderReferenceDetailsResult']['OrderReferenceDetails']['Destination']['PhysicalDestination'];
|
716 |
+
$address = wp_parse_args( $address, array( 'City', 'CountryCode', 'StateOrRegion', 'PostalCode' ) );
|
717 |
+
|
718 |
+
}
|
719 |
+
|
720 |
+
echo json_encode( $address ); exit;
|
721 |
+
|
722 |
+
}
|
723 |
+
|
724 |
+
/**
|
725 |
+
* Check for errors during checkout
|
726 |
+
*
|
727 |
+
* @access public
|
728 |
+
* @since 2.4
|
729 |
+
* @param $valid_data Customer / product data from checkout
|
730 |
+
* @param $post_data $_POST
|
731 |
+
* @return void
|
732 |
+
*/
|
733 |
+
public function checkout_errors( $valid_data, $post_data ) {
|
734 |
+
|
735 |
+
// should validate that we have a reference ID here, perhaps even fire the API call here
|
736 |
+
if( empty( $post_data['edd_amazon_reference_id'] ) ) {
|
737 |
+
edd_set_error( 'missing_reference_id', __( 'Missing Reference ID, please try again', 'edd' ) );
|
738 |
+
}
|
739 |
+
}
|
740 |
+
|
741 |
+
/**
|
742 |
+
* Process the purchase and create the charge in Amazon
|
743 |
+
*
|
744 |
+
* @access public
|
745 |
+
* @since 2.4
|
746 |
+
* @param $purchase_data array Cart details
|
747 |
+
* @return void
|
748 |
+
*/
|
749 |
+
public function process_purchase( $purchase_data ) {
|
750 |
+
|
751 |
+
if( empty( $purchase_data['post_data']['edd_amazon_reference_id'] ) ) {
|
752 |
+
edd_set_error( 'missing_reference_id', __( 'Missing Reference ID, please try again', 'edd' ) );
|
753 |
+
}
|
754 |
+
|
755 |
+
$errors = edd_get_errors();
|
756 |
+
if ( $errors ) {
|
757 |
+
|
758 |
+
edd_send_back_to_checkout( '?payment-mode=amazon' );
|
759 |
+
|
760 |
+
}
|
761 |
+
|
762 |
+
$args = apply_filters( 'edd_amazon_charge_args', array(
|
763 |
+
'merchant_id' => edd_get_option( 'amazon_seller_id', '' ),
|
764 |
+
'amazon_reference_id' => $purchase_data['post_data']['edd_amazon_reference_id'],
|
765 |
+
'authorization_reference_id' => $purchase_data['purchase_key'],
|
766 |
+
'charge_amount' => $purchase_data['price'],
|
767 |
+
'currency_code' => edd_get_currency(),
|
768 |
+
'charge_note' => html_entity_decode( edd_get_purchase_summary( $purchase_data, false ) ),
|
769 |
+
'charge_order_id' => $purchase_data['purchase_key'],
|
770 |
+
'store_name' => remove_accents( wp_specialchars_decode( get_bloginfo( 'name' ), ENT_QUOTES ) ),
|
771 |
+
'transaction_timeout' => 0
|
772 |
+
), $purchase_data );
|
773 |
+
|
774 |
+
$args['platform_id'] = 'A3JST9YM1SX7LB';
|
775 |
+
|
776 |
+
$charge = $this->client->charge( $args );
|
777 |
+
|
778 |
+
if( 200 == $charge->response['Status'] ) {
|
779 |
+
|
780 |
+
$charge = new ResponseParser( $charge->response );
|
781 |
+
$charge = $charge->toArray();
|
782 |
+
|
783 |
+
$status = $charge['AuthorizeResult']['AuthorizationDetails']['AuthorizationStatus']['State'];
|
784 |
+
|
785 |
+
if( 'Declined' === $status ) {
|
786 |
+
|
787 |
+
$reason = $charge['AuthorizeResult']['AuthorizationDetails']['AuthorizationStatus']['ReasonCode'];
|
788 |
+
edd_set_error( 'payment_declined', sprintf( __( 'Your payment could not be authorized, please try a different payment method. Reason: %s', 'edd' ), $reason ) );
|
789 |
+
edd_send_back_to_checkout( '?payment-mode=amazon&amazon_reference_id=' . $purchase_data['post_data']['edd_amazon_reference_id'] );
|
790 |
+
}
|
791 |
+
|
792 |
+
// Setup payment data to be recorded
|
793 |
+
$payment_data = array(
|
794 |
+
'price' => $purchase_data['price'],
|
795 |
+
'date' => $purchase_data['date'],
|
796 |
+
'user_email' => $purchase_data['user_email'],
|
797 |
+
'purchase_key' => $purchase_data['purchase_key'],
|
798 |
+
'currency' => edd_get_currency(),
|
799 |
+
'downloads' => $purchase_data['downloads'],
|
800 |
+
'user_info' => $purchase_data['user_info'],
|
801 |
+
'cart_details' => $purchase_data['cart_details'],
|
802 |
+
'gateway' => $this->gateway_id,
|
803 |
+
'status' => 'pending',
|
804 |
+
);
|
805 |
+
|
806 |
+
$payment_id = edd_insert_payment( $payment_data );
|
807 |
+
|
808 |
+
$authorization_id = $charge['AuthorizeResult']['AuthorizationDetails']['AmazonAuthorizationId'];
|
809 |
+
$capture_id = str_replace( '-A', '-C', $authorization_id );
|
810 |
+
$reference_id = sanitize_text_field( $_POST['edd_amazon_reference_id'] );
|
811 |
+
|
812 |
+
// Confirm the capture was completed
|
813 |
+
$capture = $this->client->getCaptureDetails( array(
|
814 |
+
'merchant_id' => edd_get_option( 'amazon_seller_id', '' ),
|
815 |
+
'amazon_capture_id' => $capture_id
|
816 |
+
) );
|
817 |
+
|
818 |
+
$capture = new ResponseParser( $capture->response );
|
819 |
+
$capture = $capture->toArray();
|
820 |
+
|
821 |
+
// Check capture status
|
822 |
+
|
823 |
+
edd_update_payment_meta( $payment_id, '_edd_amazon_authorization_id', $authorization_id );
|
824 |
+
edd_update_payment_meta( $payment_id, '_edd_amazon_capture_id', $capture_id );
|
825 |
+
|
826 |
+
edd_set_payment_transaction_id( $payment_id, $reference_id );
|
827 |
+
|
828 |
+
edd_update_payment_status( $payment_id, 'publish' );
|
829 |
+
|
830 |
+
// Empty the shopping cart
|
831 |
+
edd_empty_cart();
|
832 |
+
edd_send_to_success_page();
|
833 |
+
|
834 |
+
} else {
|
835 |
+
|
836 |
+
// Set an error
|
837 |
+
edd_set_error( 'amazon_error',sprintf( __( 'There was an issue processing your payment. Amazon error: %s', 'edd' ), print_r( $charge, true ) ) );
|
838 |
+
edd_send_back_to_checkout( '?payment-mode=amazon&amazon_reference_id=' . $purchase_data['post_data']['edd_amazon_reference_id'] );
|
839 |
+
|
840 |
+
}
|
841 |
+
|
842 |
+
|
843 |
+
}
|
844 |
+
|
845 |
+
/**
|
846 |
+
* Retrieve the checkout URL for Amazon after authentication is complete
|
847 |
+
*
|
848 |
+
* @access public
|
849 |
+
* @since 2.4
|
850 |
+
* @return string
|
851 |
+
*/
|
852 |
+
private function get_amazon_checkout_uri() {
|
853 |
+
|
854 |
+
if ( is_null( $this->checkout_uri ) ) {
|
855 |
+
$this->checkout_uri = esc_url_raw( add_query_arg( array( 'payment-mode' => 'amazon' ), edd_get_checkout_uri() ) );
|
856 |
+
}
|
857 |
+
|
858 |
+
return $this->checkout_uri;
|
859 |
+
|
860 |
+
}
|
861 |
+
|
862 |
+
/**
|
863 |
+
* Retrieve the return URL for Amazon after authentication on Amazon is complete
|
864 |
+
*
|
865 |
+
* @access public
|
866 |
+
* @since 2.4
|
867 |
+
* @return string
|
868 |
+
*/
|
869 |
+
private function get_amazon_authenticate_redirect() {
|
870 |
+
|
871 |
+
if ( is_null( $this->redirect_uri ) ) {
|
872 |
+
$this->redirect_uri = esc_url_raw( add_query_arg( array( 'edd-listener' => 'amazon', 'state' => 'return_auth' ), edd_get_checkout_uri() ) );
|
873 |
+
}
|
874 |
+
|
875 |
+
return $this->redirect_uri;
|
876 |
+
|
877 |
+
}
|
878 |
+
|
879 |
+
/**
|
880 |
+
* Retrieve the URL to send customers too once sign-in is complete
|
881 |
+
*
|
882 |
+
* @access public
|
883 |
+
* @since 2.4
|
884 |
+
* @return string
|
885 |
+
*/
|
886 |
+
private function get_amazon_signin_redirect() {
|
887 |
+
|
888 |
+
if ( is_null( $this->signin_redirect ) ) {
|
889 |
+
$this->signin_redirect = esc_url_raw( add_query_arg( array( 'edd-listener' => 'amazon', 'state' => 'signed-in' ), home_url() ) );
|
890 |
+
}
|
891 |
+
|
892 |
+
return $this->signin_redirect;
|
893 |
+
|
894 |
+
}
|
895 |
+
|
896 |
+
/**
|
897 |
+
* Retrieve the IPN URL for Amazon
|
898 |
+
*
|
899 |
+
* @access public
|
900 |
+
* @since 2.4
|
901 |
+
* @return string
|
902 |
+
*/
|
903 |
+
private function get_amazon_ipn_url() {
|
904 |
+
|
905 |
+
return esc_url_raw( add_query_arg( array( 'edd-listener' => 'amazon' ), home_url( 'index.php' ) ) );
|
906 |
+
|
907 |
+
}
|
908 |
+
|
909 |
+
/**
|
910 |
+
* Removes the requirement for entering the billing address
|
911 |
+
*
|
912 |
+
* Address is pulled directly from Amazon
|
913 |
+
*
|
914 |
+
* @access public
|
915 |
+
* @since 2.4
|
916 |
+
* @return void
|
917 |
+
*/
|
918 |
+
public function disable_address_requirement() {
|
919 |
+
|
920 |
+
if( ! empty( $_POST['edd-gateway'] ) && $this->gateway_id == $_REQUEST['edd-gateway'] ) {
|
921 |
+
add_filter( 'edd_require_billing_address', '__return_false', 9999 );
|
922 |
+
}
|
923 |
+
|
924 |
+
}
|
925 |
+
|
926 |
+
/**
|
927 |
+
* Given a transaction ID, generate a link to the Amazon transaction ID details
|
928 |
+
*
|
929 |
+
* @since 2.4
|
930 |
+
* @param string $transaction_id The Transaction ID
|
931 |
+
* @param int $payment_id The payment ID for this transaction
|
932 |
+
* @return string A link to the PayPal transaction details
|
933 |
+
*/
|
934 |
+
public function link_transaction_id( $transaction_id, $payment_id ) {
|
935 |
+
|
936 |
+
$base_url = 'https://sellercentral.amazon.com/hz/me/pmd/payment-details?orderReferenceId=';
|
937 |
+
$transaction_url = '<a href="' . esc_url( $base_url . $transaction_id ) . '" target="_blank">' . $transaction_id . '</a>';
|
938 |
+
|
939 |
+
return apply_filters( 'edd_' . $this->gateway_id . '_link_payment_details_transaction_id', $transaction_url );
|
940 |
+
|
941 |
+
}
|
942 |
+
|
943 |
+
/**
|
944 |
+
* Process IPN messages from Amazon
|
945 |
+
*
|
946 |
+
* @access public
|
947 |
+
* @since 2.4
|
948 |
+
* @return void
|
949 |
+
*/
|
950 |
+
public function process_ipn() {
|
951 |
+
|
952 |
+
if ( ! isset( $_GET['edd-listener'] ) || $_GET['edd-listener'] !== 'amazon' ) {
|
953 |
+
return;
|
954 |
+
}
|
955 |
+
|
956 |
+
if ( isset( $_GET['state'] ) ) {
|
957 |
+
return;
|
958 |
+
}
|
959 |
+
|
960 |
+
// Get the IPN headers and Message body
|
961 |
+
$headers = getallheaders();
|
962 |
+
$body = file_get_contents( 'php://input' );
|
963 |
+
|
964 |
+
$this->doing_ipn = true;
|
965 |
+
|
966 |
+
try {
|
967 |
+
|
968 |
+
$ipn = new IpnHandler( $headers, $body );
|
969 |
+
$data = $ipn->toArray();
|
970 |
+
$seller_id = $data['SellerId'];
|
971 |
+
|
972 |
+
if( $seller_id != edd_get_option( 'amazon_seller_id', '' ) ) {
|
973 |
+
wp_die( __( 'Invalid Amazon seller ID', 'edd' ), __( 'IPN Error', 'edd' ), array( 'response' => 401 ) );
|
974 |
+
}
|
975 |
+
|
976 |
+
switch( $data['NotificationType'] ) {
|
977 |
+
|
978 |
+
case 'OrderReferenceNotification' :
|
979 |
+
|
980 |
+
break;
|
981 |
+
|
982 |
+
case 'PaymentAuthorize' :
|
983 |
+
|
984 |
+
break;
|
985 |
+
|
986 |
+
case 'PaymentCapture' :
|
987 |
+
|
988 |
+
$key = $data['CaptureDetails']['CaptureReferenceId'];
|
989 |
+
$status = $data['CaptureDetails']['CaptureStatus']['State'];
|
990 |
+
|
991 |
+
if( 'Declined' === $status ) {
|
992 |
+
|
993 |
+
$payment_id = edd_get_purchase_id_by_key( $key );
|
994 |
+
|
995 |
+
edd_update_payment_status( $payment_id, 'failed' );
|
996 |
+
|
997 |
+
edd_insert_payment_note( $payment_id, __( 'Capture declined in Amazon', 'edd' ) );
|
998 |
+
|
999 |
+
}
|
1000 |
+
|
1001 |
+
break;
|
1002 |
+
|
1003 |
+
|
1004 |
+
case 'PaymentRefund' :
|
1005 |
+
|
1006 |
+
$trans_id = substr( $data['RefundDetails']['AmazonRefundId'], 0, 19 );
|
1007 |
+
$status = $data['RefundDetails']['RefundStatus']['State'];
|
1008 |
+
|
1009 |
+
if( 'Completed' === $status ) {
|
1010 |
+
|
1011 |
+
$payment_id = edd_get_purchase_id_by_transaction_id( $trans_id );
|
1012 |
+
|
1013 |
+
edd_update_payment_status( $payment_id, 'refunded' );
|
1014 |
+
|
1015 |
+
edd_insert_payment_note( $payment_id, sprintf( __( 'Refund completed in Amazon. Refund ID: %s', 'edd' ), $data['RefundDetails']['AmazonRefundId'] ) );
|
1016 |
+
|
1017 |
+
}
|
1018 |
+
|
1019 |
+
break;
|
1020 |
+
|
1021 |
+
}
|
1022 |
+
|
1023 |
+
|
1024 |
+
|
1025 |
+
} catch( Exception $e ) {
|
1026 |
+
|
1027 |
+
wp_die( $e->getErrorMessage(), __( 'IPN Error', 'edd' ), array( 'response' => 401 ) );
|
1028 |
+
|
1029 |
+
}
|
1030 |
+
|
1031 |
+
}
|
1032 |
+
|
1033 |
+
/**
|
1034 |
+
* Detect a refund action from EDD
|
1035 |
+
*
|
1036 |
+
* @access public
|
1037 |
+
* @since 2.4
|
1038 |
+
* @param $payment_id int The ID number of the payment being refunded
|
1039 |
+
* @param $new_status string The new status assigned to the payment
|
1040 |
+
* @param $old_status string The previous status of the payment
|
1041 |
+
* @return void
|
1042 |
+
*/
|
1043 |
+
public function process_refund( $payment_id, $new_status, $old_status ) {
|
1044 |
+
|
1045 |
+
if( 'publish' != $old_status && 'revoked' != $old_status ) {
|
1046 |
+
return;
|
1047 |
+
}
|
1048 |
+
|
1049 |
+
if( 'refunded' != $new_status ) {
|
1050 |
+
return;
|
1051 |
+
}
|
1052 |
+
|
1053 |
+
if( $this->doing_ipn ) {
|
1054 |
+
return;
|
1055 |
+
}
|
1056 |
+
|
1057 |
+
if( 'amazon' !== edd_get_payment_gateway( $payment_id ) ) {
|
1058 |
+
return;
|
1059 |
+
}
|
1060 |
+
|
1061 |
+
$this->refund( $payment_id );
|
1062 |
+
|
1063 |
+
}
|
1064 |
+
|
1065 |
+
/**
|
1066 |
+
* Refund a charge in Amazon
|
1067 |
+
*
|
1068 |
+
* @access public
|
1069 |
+
* @since 2.4
|
1070 |
+
* @param $payment_id int The ID number of the payment being refunded
|
1071 |
+
* @return string
|
1072 |
+
*/
|
1073 |
+
private function refund( $payment_id = 0 ) {
|
1074 |
+
|
1075 |
+
$refund = $this->client->refund( array(
|
1076 |
+
'merchant_id' => edd_get_option( 'amazon_seller_id', '' ),
|
1077 |
+
'amazon_capture_id' => edd_get_payment_meta( $payment_id, '_edd_amazon_capture_id', true ),
|
1078 |
+
'refund_reference_id' => md5( edd_get_payment_key( $payment_id ) . '-refund' ),
|
1079 |
+
'refund_amount' => edd_get_payment_amount( $payment_id ),
|
1080 |
+
'currency_code' => edd_get_payment_currency_code( $payment_id ),
|
1081 |
+
) );
|
1082 |
+
|
1083 |
+
if( 200 == $refund->response['Status'] ) {
|
1084 |
+
|
1085 |
+
$refund = new ResponseParser( $refund->response );
|
1086 |
+
$refund = $refund->toArray();
|
1087 |
+
|
1088 |
+
$reference_id = $refund['RefundResult']['RefundDetails']['RefundReferenceId'];
|
1089 |
+
$status = $refund['RefundResult']['RefundDetails']['RefundStatus']['State'];
|
1090 |
+
|
1091 |
+
switch( $status ) {
|
1092 |
+
|
1093 |
+
case 'Declined' :
|
1094 |
+
|
1095 |
+
$code = $refund['RefundResult']['RefundDetails']['RefundStatus']['ReasonCode'];
|
1096 |
+
$note = __( 'Refund declined in Amazon. Refeund ID: %s', 'edd' );
|
1097 |
+
|
1098 |
+
break;
|
1099 |
+
|
1100 |
+
case 'Completed' :
|
1101 |
+
|
1102 |
+
$refund_id = $refund['RefundResult']['RefundDetails']['AmazonRefundId'];
|
1103 |
+
$note = sprintf( __( 'Refund completed in Amazon. Refeund ID: %s', 'edd' ), $refund_id );
|
1104 |
+
|
1105 |
+
break;
|
1106 |
+
|
1107 |
+
case 'Pending' :
|
1108 |
+
|
1109 |
+
$note = sprintf( __( 'Refund initiated in Amazon. Reference ID: %s', 'edd' ), $reference_id );
|
1110 |
+
|
1111 |
+
break;
|
1112 |
+
}
|
1113 |
+
|
1114 |
+
edd_insert_payment_note( $payment_id, $note );
|
1115 |
+
|
1116 |
+
} else {
|
1117 |
+
|
1118 |
+
edd_insert_payment_note( $payment_id, __( 'Refund request failed in Amazon.', 'edd' ) );
|
1119 |
+
|
1120 |
+
}
|
1121 |
+
|
1122 |
+
}
|
1123 |
+
|
1124 |
+
/**
|
1125 |
+
* Retrieve the URL for connecting Amazon account to EDD
|
1126 |
+
*
|
1127 |
+
* @access public
|
1128 |
+
* @since 2.4
|
1129 |
+
* @return string
|
1130 |
+
*/
|
1131 |
+
private function get_registration_url() {
|
1132 |
+
return 'https://sellercentral.amazon.com/hz/me/sp/signup?solutionProviderId=A3JST9YM1SX7LB&marketplaceId=AGWSWK15IEJJ7&solutionProviderToken=AAAAAQAAAAEAAAAQnngerc8vYweGDt8byl2smgAAAHBgMm923quugHaGmPi%2B3sqo93TSL1aKwU85v71Zh7EXVK8De%2FuahjCFHft3cxN3rwAF4Iwg03sDW0jnkLULmFk7M1Fr69IV2XF477m0kU1EM0Z%2FbQssHdLai%2Fzoce1jZVmw8So3F2jhiDyfTHUK2AYP&solutionProviderOptions=lwa%3Bmws-acc%3B';
|
1133 |
+
}
|
1134 |
+
|
1135 |
+
}
|
1136 |
+
|
1137 |
+
/**
|
1138 |
+
* Load EDD_Amazon_Payments
|
1139 |
+
*
|
1140 |
+
* @access public
|
1141 |
+
* @since 2.4
|
1142 |
+
* @return object EDD_Amazon_Payments
|
1143 |
+
*/
|
1144 |
+
function EDD_Amazon() {
|
1145 |
+
return EDD_Amazon_Payments::getInstance();
|
1146 |
+
}
|
1147 |
+
EDD_Amazon();
|
includes/gateways/functions.php
CHANGED
@@ -39,9 +39,10 @@ function edd_get_payment_gateways() {
|
|
39 |
* Returns a list of all enabled gateways.
|
40 |
*
|
41 |
* @since 1.0
|
|
|
42 |
* @return array $gateway_list All the available gateways
|
43 |
*/
|
44 |
-
function edd_get_enabled_payment_gateways() {
|
45 |
$gateways = edd_get_payment_gateways();
|
46 |
$enabled = edd_get_option( 'gateways', false );
|
47 |
|
@@ -53,6 +54,15 @@ function edd_get_enabled_payment_gateways() {
|
|
53 |
}
|
54 |
}
|
55 |
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
56 |
return apply_filters( 'edd_enabled_payment_gateways', $gateway_list );
|
57 |
}
|
58 |
|
@@ -177,9 +187,10 @@ function edd_shop_supports_buy_now() {
|
|
177 |
*
|
178 |
* @param int $download_id
|
179 |
* @param array $options
|
|
|
180 |
* @return mixed|void
|
181 |
*/
|
182 |
-
function edd_build_straight_to_gateway_data( $download_id = 0, $options = array() ) {
|
183 |
|
184 |
$price_options = array();
|
185 |
|
@@ -227,9 +238,9 @@ function edd_build_straight_to_gateway_data( $download_id = 0, $options = array(
|
|
227 |
'tax' => 0,
|
228 |
'discount' => 0,
|
229 |
'item_price' => $price,
|
230 |
-
'subtotal' => $price,
|
231 |
-
'price' => $price,
|
232 |
-
'quantity' =>
|
233 |
)
|
234 |
);
|
235 |
|
@@ -253,10 +264,10 @@ function edd_build_straight_to_gateway_data( $download_id = 0, $options = array(
|
|
253 |
$purchase_data = array(
|
254 |
'downloads' => $downloads,
|
255 |
'fees' => edd_get_cart_fees(),
|
256 |
-
'subtotal' => $price,
|
257 |
'discount' => 0,
|
258 |
'tax' => 0,
|
259 |
-
'price' => $price,
|
260 |
'purchase_key' => strtolower( md5( uniqid() ) ),
|
261 |
'user_email' => $user_info['email'],
|
262 |
'date' => date( 'Y-m-d H:i:s' ),
|
@@ -301,7 +312,18 @@ function edd_show_gateways() {
|
|
301 |
$gateways = edd_get_enabled_payment_gateways();
|
302 |
$show_gateways = false;
|
303 |
|
304 |
-
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
305 |
$show_gateways = true;
|
306 |
if ( edd_get_cart_total() <= 0 ) {
|
307 |
$show_gateways = false;
|
@@ -325,7 +347,11 @@ function edd_get_chosen_gateway() {
|
|
325 |
$gateways = edd_get_enabled_payment_gateways();
|
326 |
$chosen = isset( $_REQUEST['payment-mode'] ) ? $_REQUEST['payment-mode'] : false;
|
327 |
|
328 |
-
if ( $chosen ) {
|
|
|
|
|
|
|
|
|
329 |
$enabled_gateway = urldecode( $chosen );
|
330 |
} else if( count( $gateways ) >= 1 && ! $chosen ) {
|
331 |
foreach ( $gateways as $gateway_id => $gateway ):
|
39 |
* Returns a list of all enabled gateways.
|
40 |
*
|
41 |
* @since 1.0
|
42 |
+
* @param bool $sort If true, the default gateway will be first
|
43 |
* @return array $gateway_list All the available gateways
|
44 |
*/
|
45 |
+
function edd_get_enabled_payment_gateways( $sort = false ) {
|
46 |
$gateways = edd_get_payment_gateways();
|
47 |
$enabled = edd_get_option( 'gateways', false );
|
48 |
|
54 |
}
|
55 |
}
|
56 |
|
57 |
+
if ( true === $sort ) {
|
58 |
+
// Reorder our gateways so the default is first
|
59 |
+
$default_gateway_id = edd_get_default_gateway();
|
60 |
+
$default_gateway = array( $default_gateway_id => $gateway_list[ $default_gateway_id ] );
|
61 |
+
unset( $gateway_list[ $default_gateway_id ] );
|
62 |
+
|
63 |
+
$gateway_list = array_merge( $default_gateway, $gateway_list );
|
64 |
+
}
|
65 |
+
|
66 |
return apply_filters( 'edd_enabled_payment_gateways', $gateway_list );
|
67 |
}
|
68 |
|
187 |
*
|
188 |
* @param int $download_id
|
189 |
* @param array $options
|
190 |
+
* @param int $quantity
|
191 |
* @return mixed|void
|
192 |
*/
|
193 |
+
function edd_build_straight_to_gateway_data( $download_id = 0, $options = array(), $quantity = 1 ) {
|
194 |
|
195 |
$price_options = array();
|
196 |
|
238 |
'tax' => 0,
|
239 |
'discount' => 0,
|
240 |
'item_price' => $price,
|
241 |
+
'subtotal' => ( $price * $quantity ),
|
242 |
+
'price' => ( $price * $quantity ),
|
243 |
+
'quantity' => $quantity,
|
244 |
)
|
245 |
);
|
246 |
|
264 |
$purchase_data = array(
|
265 |
'downloads' => $downloads,
|
266 |
'fees' => edd_get_cart_fees(),
|
267 |
+
'subtotal' => $price * $quantity,
|
268 |
'discount' => 0,
|
269 |
'tax' => 0,
|
270 |
+
'price' => $price * $quantity,
|
271 |
'purchase_key' => strtolower( md5( uniqid() ) ),
|
272 |
'user_email' => $user_info['email'],
|
273 |
'date' => date( 'Y-m-d H:i:s' ),
|
312 |
$gateways = edd_get_enabled_payment_gateways();
|
313 |
$show_gateways = false;
|
314 |
|
315 |
+
$gateways = edd_get_payment_gateways();
|
316 |
+
$active_gateways = array();
|
317 |
+
|
318 |
+
foreach ( $gateways as $gateway => $data ) {
|
319 |
+
if ( edd_is_gateway_active( $gateway ) ) {
|
320 |
+
$active_gateways[] = $gateway;
|
321 |
+
}
|
322 |
+
}
|
323 |
+
|
324 |
+
$chosen_gateway = isset( $_GET['payment-mode'] ) ? preg_replace('/[^a-zA-Z0-9-_]+/', '', $_GET['payment-mode'] ) : false;
|
325 |
+
|
326 |
+
if ( count( $gateways ) > 1 && empty( $chosen_gateway ) ) {
|
327 |
$show_gateways = true;
|
328 |
if ( edd_get_cart_total() <= 0 ) {
|
329 |
$show_gateways = false;
|
347 |
$gateways = edd_get_enabled_payment_gateways();
|
348 |
$chosen = isset( $_REQUEST['payment-mode'] ) ? $_REQUEST['payment-mode'] : false;
|
349 |
|
350 |
+
if ( false !== $chosen ) {
|
351 |
+
$chosen = preg_replace('/[^a-zA-Z0-9-_]+/', '', $chosen );
|
352 |
+
}
|
353 |
+
|
354 |
+
if ( ! empty ( $chosen ) ) {
|
355 |
$enabled_gateway = urldecode( $chosen );
|
356 |
} else if( count( $gateways ) >= 1 && ! $chosen ) {
|
357 |
foreach ( $gateways as $gateway_id => $gateway ):
|
includes/gateways/libs/amazon/Client.php
ADDED
@@ -0,0 +1,1579 @@
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
1 |
+
<?php
|
2 |
+
namespace PayWithAmazon;
|
3 |
+
|
4 |
+
/* Class Client
|
5 |
+
* Takes configuration information
|
6 |
+
* Makes API calls to MWS for Pay With Amazon
|
7 |
+
* returns Response Object
|
8 |
+
*/
|
9 |
+
|
10 |
+
require_once 'ResponseParser.php';
|
11 |
+
require_once 'HttpCurl.php';
|
12 |
+
require_once 'Interface.php';
|
13 |
+
|
14 |
+
class Client implements ClientInterface
|
15 |
+
{
|
16 |
+
const MWS_CLIENT_VERSION = '1.0.0';
|
17 |
+
const SERVICE_VERSION = '2013-01-01';
|
18 |
+
const MAX_ERROR_RETRY = 3;
|
19 |
+
|
20 |
+
// Construct User agent string based off of the application_name, application_version, PHP platform
|
21 |
+
private $userAgent = null;
|
22 |
+
private $parameters = null;
|
23 |
+
private $mwsEndpointPath = null;
|
24 |
+
private $mwsEndpointUrl = null;
|
25 |
+
private $profileEndpoint = null;
|
26 |
+
private $config = array('merchant_id' => null,
|
27 |
+
'secret_key' => null,
|
28 |
+
'access_key' => null,
|
29 |
+
'region' => null,
|
30 |
+
'currency_code' => null,
|
31 |
+
'sandbox' => false,
|
32 |
+
'platform_id' => null,
|
33 |
+
'cabundle_file' => null,
|
34 |
+
'application_name' => null,
|
35 |
+
'application_version' => null,
|
36 |
+
'proxy_host' => null,
|
37 |
+
'proxy_port' => -1,
|
38 |
+
'proxy_username' => null,
|
39 |
+
'proxy_password' => null,
|
40 |
+
'client_id' => null,
|
41 |
+
'handle_throttle' => true
|
42 |
+
);
|
43 |
+
|
44 |
+
private $modePath = null;
|
45 |
+
|
46 |
+
// Final URL to where the API parameters POST done, based off the config['region'] and respective $mwsServiceUrls
|
47 |
+
private $mwsServiceUrl = null;
|
48 |
+
|
49 |
+
private $mwsServiceUrls = array('eu' => 'mws-eu.amazonservices.com',
|
50 |
+
'na' => 'mws.amazonservices.com',
|
51 |
+
'jp' => 'mws.amazonservices.jp');
|
52 |
+
|
53 |
+
// Production profile end points to get the user information
|
54 |
+
private $liveProfileEndpoint = array('uk' => 'https://api.amazon.co.uk',
|
55 |
+
'us' => 'https://api.amazon.com',
|
56 |
+
'de' => 'https://api.amazon.de',
|
57 |
+
'jp' => 'https://api.amazon.co.jp');
|
58 |
+
|
59 |
+
// Sandbox profile end points to get the user information
|
60 |
+
private $sandboxProfileEndpoint = array('uk' => 'https://api.sandbox.amazon.co.uk',
|
61 |
+
'us' => 'https://api.sandbox.amazon.com',
|
62 |
+
'de' => 'https://api.sandbox.amazon.de',
|
63 |
+
'jp' => 'https://api.sandbox.amazon.co.jp');
|
64 |
+
|
65 |
+
private $regionMappings = array('de' => 'eu',
|
66 |
+
'uk' => 'eu',
|
67 |
+
'us' => 'na',
|
68 |
+
'jp' => 'jp');
|
69 |
+
|
70 |
+
// Boolean variable to check if the API call was a success
|
71 |
+
public $success = false;
|
72 |
+
|
73 |
+
/* Takes user configuration array from the user as input
|
74 |
+
* Takes JSON file path with configuration information as input
|
75 |
+
* Validates the user configuration array against existing config array
|
76 |
+
*/
|
77 |
+
|
78 |
+
public function __construct($config = null)
|
79 |
+
{
|
80 |
+
if (!is_null($config)) {
|
81 |
+
|
82 |
+
if (is_array($config)) {
|
83 |
+
$configArray = $config;
|
84 |
+
} elseif (!is_array($config)) {
|
85 |
+
$configArray = $this->checkIfFileExists($config);
|
86 |
+
}
|
87 |
+
|
88 |
+
if (is_array($configArray)) {
|
89 |
+
$this->checkConfigKeys($configArray);
|
90 |
+
} else {
|
91 |
+
throw new \Exception('$config is of the incorrect type ' . gettype($configArray) . ' and should be of the type array');
|
92 |
+
}
|
93 |
+
} else {
|
94 |
+
throw new \Exception('$config cannot be null.');
|
95 |
+
}
|
96 |
+
}
|
97 |
+
|
98 |
+
/* checkIfFileExists - check if the JSON file exists in the path provided */
|
99 |
+
|
100 |
+
private function checkIfFileExists($config)
|
101 |
+
{
|
102 |
+
if(file_exists($config))
|
103 |
+
{
|
104 |
+
$jsonString = file_get_contents($config);
|
105 |
+
$configArray = json_decode($jsonString, true);
|
106 |
+
|
107 |
+
$jsonError = json_last_error();
|
108 |
+
|
109 |
+
if ($jsonError != 0) {
|
110 |
+
$errorMsg = "Error with message - content is not in json format" . $this->getErrorMessageForJsonError($jsonError) . " " . $configArray;
|
111 |
+
throw new \Exception($errorMsg);
|
112 |
+
}
|
113 |
+
} else {
|
114 |
+
$errorMsg ='$config is not a Json File path or the Json File was not found in the path provided';
|
115 |
+
throw new \Exception($errorMsg);
|
116 |
+
}
|
117 |
+
return $configArray;
|
118 |
+
}
|
119 |
+
|
120 |
+
/* Checks if the keys of the input configuration matches the keys in the config array
|
121 |
+
* if they match the values are taken else throws exception
|
122 |
+
* strict case match is not performed
|
123 |
+
*/
|
124 |
+
|
125 |
+
private function checkConfigKeys($config)
|
126 |
+
{
|
127 |
+
$config = array_change_key_case($config, CASE_LOWER);
|
128 |
+
$config = $this->trimArray($config);
|
129 |
+
|
130 |
+
foreach ($config as $key => $value) {
|
131 |
+
if (array_key_exists($key, $this->config)) {
|
132 |
+
$this->config[$key] = $value;
|
133 |
+
} else {
|
134 |
+
throw new \Exception('Key ' . $key . ' is either not part of the configuration or has incorrect Key name.
|
135 |
+
check the config array key names to match your key names of your config array', 1);
|
136 |
+
}
|
137 |
+
}
|
138 |
+
}
|
139 |
+
|
140 |
+
/* Convert a json error code to a descriptive error message
|
141 |
+
*
|
142 |
+
* @param int $jsonError message code
|
143 |
+
*
|
144 |
+
* @return string error message
|
145 |
+
*/
|
146 |
+
|
147 |
+
private function getErrorMessageForJsonError($jsonError)
|
148 |
+
{
|
149 |
+
switch ($jsonError) {
|
150 |
+
case JSON_ERROR_DEPTH:
|
151 |
+
return " - maximum stack depth exceeded.";
|
152 |
+
break;
|
153 |
+
case JSON_ERROR_STATE_MISMATCH:
|
154 |
+
return " - invalid or malformed JSON.";
|
155 |
+
break;
|
156 |
+
case JSON_ERROR_CTRL_CHAR:
|
157 |
+
return " - control character error.";
|
158 |
+
break;
|
159 |
+
case JSON_ERROR_SYNTAX:
|
160 |
+
return " - syntax error.";
|
161 |
+
break;
|
162 |
+
default:
|
163 |
+
return ".";
|
164 |
+
break;
|
165 |
+
}
|
166 |
+
}
|
167 |
+
|
168 |
+
/* Setter for sandbox
|
169 |
+
* Sets the Boolean value for config['sandbox'] variable
|
170 |
+
*/
|
171 |
+
|
172 |
+
public function setSandbox($value)
|
173 |
+
{
|
174 |
+
if (is_bool($value)) {
|
175 |
+
$this->config['sandbox'] = $value;
|
176 |
+
} else {
|
177 |
+
throw new \Exception($value . ' is of type ' . gettype($value) . ' and should be a boolean value');
|
178 |
+
}
|
179 |
+
}
|
180 |
+
|
181 |
+
/* Setter for config['client_id']
|
182 |
+
* Sets the value for config['client_id'] variable
|
183 |
+
*/
|
184 |
+
|
185 |
+
public function setClientId($value)
|
186 |
+
{
|
187 |
+
if (!empty($value)) {
|
188 |
+
$this->config['client_id'] = $value;
|
189 |
+
} else {
|
190 |
+
throw new \Exception('setter value for client ID provided is empty');
|
191 |
+
}
|
192 |
+
}
|
193 |
+
|
194 |
+
/* Setter for Proxy
|
195 |
+
* input $proxy [array]
|
196 |
+
* @param $proxy['proxy_user_host'] - hostname for the proxy
|
197 |
+
* @param $proxy['proxy_user_port'] - hostname for the proxy
|
198 |
+
* @param $proxy['proxy_user_name'] - if your proxy required a username
|
199 |
+
* @param $proxy['proxy_user_password'] - if your proxy required a password
|
200 |
+
*/
|
201 |
+
|
202 |
+
public function setProxy($proxy)
|
203 |
+
{
|
204 |
+
$proxy = $this->trimArray($proxy);
|
205 |
+
|
206 |
+
if (!empty($proxy['proxy_user_host']))
|
207 |
+
$this->config['proxy_user_host'] = $proxy['proxy_user_host'];
|
208 |
+
|
209 |
+
if (!empty($proxy['proxy_user_port']))
|
210 |
+
$this->config['proxy_user_port'] = $proxy['proxy_user_port'];
|
211 |
+
|
212 |
+
if (!empty($proxy['proxy_user_name']))
|
213 |
+
$this->config['proxy_user_name'] = $proxy['proxy_user_name'];
|
214 |
+
|
215 |
+
if (!empty($proxy['proxy_user_password']))
|
216 |
+
$this->config['proxy_user_password'] = $proxy['proxy_user_password'];
|
217 |
+
}
|
218 |
+
|
219 |
+
/* Setter for $mwsServiceUrl
|
220 |
+
* Set the URL to which the post request has to be made for unit testing
|
221 |
+
*/
|
222 |
+
|
223 |
+
public function setMwsServiceUrl($url)
|
224 |
+
{
|
225 |
+
$this->mwsServiceUrl = $url;
|
226 |
+
}
|
227 |
+
|
228 |
+
/* Getter
|
229 |
+
* Gets the value for the key if the key exists in config
|
230 |
+
*/
|
231 |
+
|
232 |
+
public function __get($name)
|
233 |
+
{
|
234 |
+
if (array_key_exists(strtolower($name), $this->config)) {
|
235 |
+
return $this->config[strtolower($name)];
|
236 |
+
} else {
|
237 |
+
throw new \Exception('Key ' . $name . ' is either not a part of the configuration array config or the' . $name . 'does not match the key name in the config array', 1);
|
238 |
+
}
|
239 |
+
}
|
240 |
+
|
241 |
+
/* Getter for parameters string
|
242 |
+
* Gets the value for the parameters string for unit testing
|
243 |
+
*/
|
244 |
+
|
245 |
+
public function getParameters()
|
246 |
+
{
|
247 |
+
return trim($this->parameters);
|
248 |
+
}
|
249 |
+
|
250 |
+
/* Trim the input Array key values */
|
251 |
+
|
252 |
+
private function trimArray($array)
|
253 |
+
{
|
254 |
+
foreach ($array as $key => $value)
|
255 |
+
{
|
256 |
+
$array[$key] = trim($value);
|
257 |
+
}
|
258 |
+
return $array;
|
259 |
+
}
|
260 |
+
|
261 |
+
/* GetUserInfo convenience function - Returns user's profile information from Amazon using the access token returned by the Button widget.
|
262 |
+
*
|
263 |
+
* @see http://login.amazon.com/website Step 4
|
264 |
+
* @param $accessToken [String]
|
265 |
+
*/
|
266 |
+
|
267 |
+
public function getUserInfo($accessToken)
|
268 |
+
{
|
269 |
+
// Get the correct Profile Endpoint URL based off the country/region provided in the config['region']
|
270 |
+
$this->profileEndpointUrl();
|
271 |
+
|
272 |
+
if (empty($accessToken)) {
|
273 |
+
throw new \InvalidArgumentException('Access Token is a required parameter and is not set');
|
274 |
+
}
|
275 |
+
|
276 |
+
// To make sure double encoding doesn't occur decode first and encode again.
|
277 |
+
$accessToken = urldecode($accessToken);
|
278 |
+
$url = $this->profileEndpoint . '/auth/o2/tokeninfo?access_token=' . urlEncode($accessToken);
|
279 |
+
|
280 |
+
$httpCurlRequest = new HttpCurl();
|
281 |
+
|
282 |
+
$response = $httpCurlRequest->httpGet($url);
|
283 |
+
$data = json_decode($response);
|
284 |
+
|
285 |
+
if ($data->aud != $this->config['client_id']) {
|
286 |
+
// The access token does not belong to us
|
287 |
+
throw new \Exception('The Access token entered is incorrect');
|
288 |
+
}
|
289 |
+
|
290 |
+
// Exchange the access token for user profile
|
291 |
+
$url = $this->profileEndpoint . '/user/profile';
|
292 |
+
$httpCurlRequest = new HttpCurl();
|
293 |
+
|
294 |
+
$httpCurlRequest->setAccessToken($accessToken);
|
295 |
+
$httpCurlRequest->setHttpHeader(true);
|
296 |
+
$response = $httpCurlRequest->httpGet($url);
|
297 |
+
|
298 |
+
$userInfo = json_decode($response, true);
|
299 |
+
return $userInfo;
|
300 |
+
}
|
301 |
+
|
302 |
+
/* setParametersAndPost - sets the parameters array with non empty values from the requestParameters array sent to API calls.
|
303 |
+
* If Provider Credit Details is present, values are set by setProviderCreditDetails
|
304 |
+
* If Provider Credit Reversal Details is present, values are set by setProviderCreditDetails
|
305 |
+
*/
|
306 |
+
|
307 |
+
private function setParametersAndPost($parameters, $fieldMappings, $requestParameters)
|
308 |
+
{
|
309 |
+
/* For loop to take all the non empty parameters in the $requestParameters and add it into the $parameters array,
|
310 |
+
* if the keys are matched from $requestParameters array with the $fieldMappings array
|
311 |
+
*/
|
312 |
+
foreach ($requestParameters as $param => $value) {
|
313 |
+
|
314 |
+
if(!is_array($value)) {
|
315 |
+
$value = trim($value);
|
316 |
+
}
|
317 |
+
|
318 |
+
if (array_key_exists($param, $fieldMappings) && $value!='') {
|
319 |
+
|
320 |
+
if(is_array($value)) {
|
321 |
+
// If the parameter is a provider_credit_details or provider_credit_reversal_details, call the respective functions to set the values
|
322 |
+
if($param === 'provider_credit_details') {
|
323 |
+
$parameters = $this->setProviderCreditDetails($parameters,$value);
|
324 |
+
} elseif ($param === 'provider_credit_reversal_details') {
|
325 |
+
$parameters = $this->setProviderCreditReversalDetails($parameters,$value);
|
326 |
+
}
|
327 |
+
|
328 |
+
} else{
|
329 |
+
// For variables that are boolean values, strtolower them
|
330 |
+
if($this->checkIfBool($value))
|
331 |
+
{
|
332 |
+
$value = strtolower($value);
|
333 |
+
}
|
334 |
+
|
335 |
+
$parameters[$fieldMappings[$param]] = $value;
|
336 |
+
}
|
337 |
+
}
|
338 |
+
}
|
339 |
+
|
340 |
+
$parameters = $this->setDefaultValues($parameters, $fieldMappings, $requestParameters);
|
341 |
+
$responseObject = $this->calculateSignatureAndPost($parameters);
|
342 |
+
|
343 |
+
return $responseObject;
|
344 |
+
}
|
345 |
+
|
346 |
+
/* checkIfBool - checks if the input is a boolean */
|
347 |
+
|
348 |
+
private function checkIfBool($string)
|
349 |
+
{
|
350 |
+
$string = strtolower($string);
|
351 |
+
return in_array($string, array('true', 'false'));
|
352 |
+
}
|
353 |
+
|
354 |
+
/* calculateSignatureAndPost - convert the Parameters array to string and curl POST the parameters to MWS */
|
355 |
+
|
356 |
+
private function calculateSignatureAndPost($parameters)
|
357 |
+
{
|
358 |
+
// Call the signature and Post function to perform the actions. Returns XML in array format
|
359 |
+
$parametersString = $this->calculateSignatureAndParametersToString($parameters);
|
360 |
+
|
361 |
+
// POST using curl the String converted Parameters
|
362 |
+
$response = $this->invokePost($parametersString);
|
363 |
+
|
364 |
+
// Send this response as args to ResponseParser class which will return the object of the class.
|
365 |
+
$responseObject = new ResponseParser($response);
|
366 |
+
return $responseObject;
|
367 |
+
}
|
368 |
+
|
369 |
+
/* If merchant_id is not set via the requestParameters array then it's taken from the config array
|
370 |
+
*
|
371 |
+
* Set the platform_id if set in the config['platform_id'] array
|
372 |
+
*
|
373 |
+
* If currency_code is set in the $requestParameters and it exists in the $fieldMappings array, strtoupper it
|
374 |
+
* else take the value from config array if set
|
375 |
+
*/
|
376 |
+
|
377 |
+
private function setDefaultValues($parameters, $fieldMappings, $requestParameters)
|
378 |
+
{
|
379 |
+
if (empty($requestParameters['merchant_id']))
|
380 |
+
$parameters['SellerId'] = $this->config['merchant_id'];
|
381 |
+
|
382 |
+
if (array_key_exists('platform_id', $fieldMappings)) {
|
383 |
+
if (empty($requestParameters['platform_id']) && !empty($this->config['platform_id']))
|
384 |
+
$parameters[$fieldMappings['platform_id']] = $this->config['platform_id'];
|
385 |
+
}
|
386 |
+
|
387 |
+
if (array_key_exists('currency_code', $fieldMappings)) {
|
388 |
+
if (!empty($requestParameters['currency_code'])) {
|
389 |
+
$parameters[$fieldMappings['currency_code']] = strtoupper($requestParameters['currency_code']);
|
390 |
+
} else {
|
391 |
+
$parameters[$fieldMappings['currency_code']] = strtoupper($this->config['currency_code']);
|
392 |
+
}
|
393 |
+
}
|
394 |
+
|
395 |
+
return $parameters;
|
396 |
+
}
|
397 |
+
|
398 |
+
/* setProviderCreditDetails - sets the provider credit details sent via the Capture or Authorize API calls
|
399 |
+
* @param provider_id - [String]
|
400 |
+
* @param credit_amount - [String]
|
401 |
+
* @optional currency_code - [String]
|
402 |
+
*/
|
403 |
+
|
404 |
+
private function setProviderCreditDetails($parameters, $providerCreditInfo)
|
405 |
+
{
|
406 |
+
$providerIndex = 0;
|
407 |
+
$providerString = 'ProviderCreditList.member.';
|
408 |
+
|
409 |
+
$fieldMappings = array(
|
410 |
+
'provider_id' => 'ProviderId',
|
411 |
+
'credit_amount' => 'CreditAmount.Amount',
|
412 |
+
'currency_code' => 'CreditAmount.CurrencyCode'
|
413 |
+
);
|
414 |
+
|
415 |
+
foreach ($providerCreditInfo as $key => $value)
|
416 |
+
{
|
417 |
+
$value = array_change_key_case($value, CASE_LOWER);
|
418 |
+
$providerIndex = $providerIndex + 1;
|
419 |
+
|
420 |
+
foreach ($value as $param => $val)
|
421 |
+
{
|
422 |
+
if (array_key_exists($param, $fieldMappings) && trim($val)!='') {
|
423 |
+
$parameters[$providerString.$providerIndex. '.' .$fieldMappings[$param]] = $val;
|
424 |
+
}
|
425 |
+
}
|
426 |
+
|
427 |
+
// If currency code is not entered take it from the config array
|
428 |
+
if(empty($parameters[$providerString.$providerIndex. '.' .$fieldMappings['currency_code']]))
|
429 |
+
{
|
430 |
+
$parameters[$providerString.$providerIndex. '.' .$fieldMappings['currency_code']] = strtoupper($this->config['currency_code']);
|
431 |
+
}
|
432 |
+
}
|
433 |
+
|
434 |
+
return $parameters;
|
435 |
+
}
|
436 |
+
|
437 |
+
/* setProviderCreditReversalDetails - sets the reverse provider credit details sent via the Refund API call.
|
438 |
+
* @param provider_id - [String]
|
439 |
+
* @param credit_amount - [String]
|
440 |
+
* @optional currency_code - [String]
|
441 |
+
*/
|
442 |
+
|
443 |
+
private function setProviderCreditReversalDetails($parameters, $providerCreditInfo)
|
444 |
+
{
|
445 |
+
$providerIndex = 0;
|
446 |
+
$providerString = 'ProviderCreditReversalList.member.';
|
447 |
+
|
448 |
+
$fieldMappings = array(
|
449 |
+
'provider_id' => 'ProviderId',
|
450 |
+
'credit_reversal_amount' => 'CreditReversalAmount.Amount',
|
451 |
+
'currency_code' => 'CreditReversalAmount.CurrencyCode'
|
452 |
+
);
|
453 |
+
|
454 |
+
foreach ($providerCreditInfo as $key => $value)
|
455 |
+
{
|
456 |
+
$value = array_change_key_case($value, CASE_LOWER);
|
457 |
+
$providerIndex = $providerIndex + 1;
|
458 |
+
|
459 |
+
foreach ($value as $param => $val)
|
460 |
+
{
|
461 |
+
if (array_key_exists($param, $fieldMappings) && trim($val)!='') {
|
462 |
+
$parameters[$providerString.$providerIndex. '.' .$fieldMappings[$param]] = $val;
|
463 |
+
}
|
464 |
+
}
|
465 |
+
|
466 |
+
// If currency code is not entered take it from the config array
|
467 |
+
if(empty($parameters[$providerString.$providerIndex. '.' .$fieldMappings['currency_code']]))
|
468 |
+
{
|
469 |
+
$parameters[$providerString.$providerIndex. '.' .$fieldMappings['currency_code']] = strtoupper($this->config['currency_code']);
|
470 |
+
}
|
471 |
+
}
|
472 |
+
|
473 |
+
return $parameters;
|
474 |
+
}
|
475 |
+
|
476 |
+
/* GetOrderReferenceDetails API call - Returns details about the Order Reference object and its current state.
|
477 |
+
* @see http://docs.developer.amazonservices.com/en_US/off_amazon_payments/OffAmazonPayments_GetOrderReferenceDetails.html
|
478 |
+
*
|
479 |
+
* @param requestParameters['merchant_id'] - [String]
|
480 |
+
* @param requestParameters['amazon_order_reference_id'] - [String]
|
481 |
+
* @optional requestParameters['address_consent_token'] - [String]
|
482 |
+
* @optional requestParameters['mws_auth_token'] - [String]
|
483 |
+
*/
|
484 |
+
|
485 |
+
public function getOrderReferenceDetails($requestParameters = array())
|
486 |
+
{
|
487 |
+
|
488 |
+
$parameters['Action'] = 'GetOrderReferenceDetails';
|
489 |
+
$requestParameters = array_change_key_case($requestParameters, CASE_LOWER);
|
490 |
+
|
491 |
+
$fieldMappings = array(
|
492 |
+
'merchant_id' => 'SellerId',
|
493 |
+
'amazon_order_reference_id' => 'AmazonOrderReferenceId',
|
494 |
+
'address_consent_token' => 'AddressConsentToken',
|
495 |
+
'mws_auth_token' => 'MWSAuthToken'
|
496 |
+
);
|
497 |
+
|
498 |
+
$responseObject = $this->setParametersAndPost($parameters, $fieldMappings, $requestParameters);
|
499 |
+
return ($responseObject);
|
500 |
+
}
|
501 |
+
|
502 |
+
/* SetOrderReferenceDetails API call - Sets order reference details such as the order total and a description for the order.
|
503 |
+
* @see http://docs.developer.amazonservices.com/en_US/off_amazon_payments/OffAmazonPayments_SetOrderReferenceDetails.html
|
504 |
+
*
|
505 |
+
* @param requestParameters['merchant_id'] - [String]
|
506 |
+
* @param requestParameters['amazon_order_reference_id'] - [String]
|
507 |
+
* @param requestParameters['amount'] - [String]
|
508 |
+
* @param requestParameters['currency_code'] - [String]
|
509 |
+
* @optional requestParameters['platform_id'] - [String]
|
510 |
+
* @optional requestParameters['seller_note'] - [String]
|
511 |
+
* @optional requestParameters['seller_order_id'] - [String]
|
512 |
+
* @optional requestParameters['store_name'] - [String]
|
513 |
+
* @optional requestParameters['custom_information'] - [String]
|
514 |
+
* @optional requestParameters['mws_auth_token'] - [String]
|
515 |
+
*/
|
516 |
+
|
517 |
+
public function setOrderReferenceDetails($requestParameters = array())
|
518 |
+
{
|
519 |
+
$parameters = array();
|
520 |
+
$parameters['Action'] = 'SetOrderReferenceDetails';
|
521 |
+
$requestParameters = array_change_key_case($requestParameters, CASE_LOWER);
|
522 |
+
|
523 |
+
$fieldMappings = array(
|
524 |
+
'merchant_id' => 'SellerId',
|
525 |
+
'amazon_order_reference_id' => 'AmazonOrderReferenceId',
|
526 |
+
'amount' => 'OrderReferenceAttributes.OrderTotal.Amount',
|
527 |
+
'currency_code' => 'OrderReferenceAttributes.OrderTotal.CurrencyCode',
|
528 |
+
'platform_id' => 'OrderReferenceAttributes.PlatformId',
|
529 |
+
'seller_note' => 'OrderReferenceAttributes.SellerNote',
|
530 |
+
'seller_order_id' => 'OrderReferenceAttributes.SellerOrderAttributes.SellerOrderId',
|
531 |
+
'store_name' => 'OrderReferenceAttributes.SellerOrderAttributes.StoreName',
|
532 |
+
'custom_information' => 'OrderReferenceAttributes.SellerOrderAttributes.CustomInformation',
|
533 |
+
'mws_auth_token' => 'MWSAuthToken'
|
534 |
+
);
|
535 |
+
|
536 |
+
$responseObject = $this->setParametersAndPost($parameters, $fieldMappings, $requestParameters);
|
537 |
+
|
538 |
+
return ($responseObject);
|
539 |
+
}
|
540 |
+
|
541 |
+
/* ConfirmOrderReferenceDetails API call - Confirms that the order reference is free of constraints and all required information has been set on the order reference.
|
542 |
+
* @see http://docs.developer.amazonservices.com/en_US/off_amazon_payments/OffAmazonPayments_ConfirmOrderReference.html
|
543 |
+
|
544 |
+
* @param requestParameters['merchant_id'] - [String]
|
545 |
+
* @param requestParameters['amazon_order_reference_id'] - [String]
|
546 |
+
* @optional requestParameters['mws_auth_token'] - [String]
|
547 |
+
*/
|
548 |
+
|
549 |
+
public function confirmOrderReference($requestParameters = array())
|
550 |
+
{
|
551 |
+
$parameters = array();
|
552 |
+
$parameters['Action'] = 'ConfirmOrderReference';
|
553 |
+
$requestParameters = array_change_key_case($requestParameters, CASE_LOWER);
|
554 |
+
|
555 |
+
$fieldMappings = array(
|
556 |
+
'merchant_id' => 'SellerId',
|
557 |
+
'amazon_order_reference_id' => 'AmazonOrderReferenceId',
|
558 |
+
'mws_auth_token' => 'MWSAuthToken'
|
559 |
+
);
|
560 |
+
|
561 |
+
$responseObject = $this->setParametersAndPost($parameters, $fieldMappings, $requestParameters);
|
562 |
+
|
563 |
+
return ($responseObject);
|
564 |
+
}
|
565 |
+
|
566 |
+
/* CancelOrderReferenceDetails API call - Cancels a previously confirmed order reference.
|
567 |
+
* @see http://docs.developer.amazonservices.com/en_US/off_amazon_payments/OffAmazonPayments_CancelOrderReference.html
|
568 |
+
*
|
569 |
+
* @param requestParameters['merchant_id'] - [String]
|
570 |
+
* @param requestParameters['amazon_order_reference_id'] - [String]
|
571 |
+
* @optional requestParameters['cancelation_reason'] [String]
|
572 |
+
* @optional requestParameters['mws_auth_token'] - [String]
|
573 |
+
*/
|
574 |
+
|
575 |
+
public function cancelOrderReference($requestParameters = array())
|
576 |
+
{
|
577 |
+
$parameters = array();
|
578 |
+
$parameters['Action'] = 'CancelOrderReference';
|
579 |
+
$requestParameters = array_change_key_case($requestParameters, CASE_LOWER);
|
580 |
+
|
581 |
+
$fieldMappings = array(
|
582 |
+
'merchant_id' => 'SellerId',
|
583 |
+
'amazon_order_reference_id' => 'AmazonOrderReferenceId',
|
584 |
+
'cancelation_reason' => 'CancelationReason',
|
585 |
+
'mws_auth_token' => 'MWSAuthToken'
|
586 |
+
);
|
587 |
+
|
588 |
+
$responseObject = $this->setParametersAndPost($parameters, $fieldMappings, $requestParameters);
|
589 |
+
|
590 |
+
return ($responseObject);
|
591 |
+
}
|
592 |
+
|
593 |
+
/* CloseOrderReferenceDetails API call - Confirms that an order reference has been fulfilled (fully or partially)
|
594 |
+
* and that you do not expect to create any new authorizations on this order reference.
|
595 |
+
* @see http://docs.developer.amazonservices.com/en_US/off_amazon_payments/OffAmazonPayments_CloseOrderReference.html
|
596 |
+
*
|
597 |
+
* @param requestParameters['merchant_id'] - [String]
|
598 |
+
* @param requestParameters['amazon_order_reference_id'] - [String]
|
599 |
+
* @optional requestParameters['closure_reason'] [String]
|
600 |
+
* @optional requestParameters['mws_auth_token'] - [String]
|
601 |
+
*/
|
602 |
+
|
603 |
+
public function closeOrderReference($requestParameters = array())
|
604 |
+
{
|
605 |
+
$parameters = array();
|
606 |
+
$parameters['Action'] = 'CloseOrderReference';
|
607 |
+
$requestParameters = array_change_key_case($requestParameters, CASE_LOWER);
|
608 |
+
|
609 |
+
$fieldMappings = array(
|
610 |
+
'merchant_id' => 'SellerId',
|
611 |
+
'amazon_order_reference_id' => 'AmazonOrderReferenceId',
|
612 |
+
'closure_reason' => 'ClosureReason',
|
613 |
+
'mws_auth_token' => 'MWSAuthToken'
|
614 |
+
);
|
615 |
+
|
616 |
+
$responseObject = $this->setParametersAndPost($parameters, $fieldMappings, $requestParameters);
|
617 |
+
|
618 |
+
return ($responseObject);
|
619 |
+
}
|
620 |
+
|
621 |
+
/* CloseAuthorization API call - Closes an authorization.
|
622 |
+
* @see http://docs.developer.amazonservices.com/en_US/off_amazon_payments/OffAmazonPayments_CloseOrderReference.html
|
623 |
+
*
|
624 |
+
* @param requestParameters['merchant_id'] - [String]
|
625 |
+
* @param requestParameters['amazon_authorization_id'] - [String]
|
626 |
+
* @optional requestParameters['closure_reason'] [String]
|
627 |
+
* @optional requestParameters['mws_auth_token'] - [String]
|
628 |
+
*/
|
629 |
+
|
630 |
+
public function closeAuthorization($requestParameters = array())
|
631 |
+
{
|
632 |
+
$parameters = array();
|
633 |
+
$parameters['Action'] = 'CloseAuthorization';
|
634 |
+
$requestParameters = array_change_key_case($requestParameters, CASE_LOWER);
|
635 |
+
|
636 |
+
$fieldMappings = array(
|
637 |
+
'merchant_id' => 'SellerId',
|
638 |
+
'amazon_authorization_id' => 'AmazonAuthorizationId',
|
639 |
+
'closure_reason' => 'ClosureReason',
|
640 |
+
'mws_auth_token' => 'MWSAuthToken'
|
641 |
+
);
|
642 |
+
|
643 |
+
$responseObject = $this->setParametersAndPost($parameters, $fieldMappings, $requestParameters);
|
644 |
+
|
645 |
+
return ($responseObject);
|
646 |
+
}
|
647 |
+
|
648 |
+
/* Authorize API call - Reserves a specified amount against the payment method(s) stored in the order reference.
|
649 |
+
* @see http://docs.developer.amazonservices.com/en_US/off_amazon_payments/OffAmazonPayments_Authorize.html
|
650 |
+
*
|
651 |
+
* @param requestParameters['merchant_id'] - [String]
|
652 |
+
* @param requestParameters['amazon_order_reference_id'] - [String]
|
653 |
+
* @param requestParameters['authorization_amount'] [String]
|
654 |
+
* @param requestParameters['currency_code'] - [String]
|
655 |
+
* @param requestParameters['authorization_reference_id'] [String]
|
656 |
+
* @optional requestParameters['capture_now'] [String]
|
657 |
+
* @optional requestParameters['provider_credit_details'] - [array (array())]
|
658 |
+
* @optional requestParameters['seller_authorization_note'] [String]
|
659 |
+
* @optional requestParameters['transaction_timeout'] [String] - Defaults to 1440 minutes
|
660 |
+
* @optional requestParameters['soft_descriptor'] - [String]
|
661 |
+
* @optional requestParameters['mws_auth_token'] - [String]
|
662 |
+
*/
|
663 |
+
|
664 |
+
public function authorize($requestParameters = array())
|
665 |
+
{
|
666 |
+
$parameters = array();
|
667 |
+
$parameters['Action'] = 'Authorize';
|
668 |
+
$requestParameters = array_change_key_case($requestParameters, CASE_LOWER);
|
669 |
+
|
670 |
+
$fieldMappings = array(
|
671 |
+
'merchant_id' => 'SellerId',
|
672 |
+
'amazon_order_reference_id' => 'AmazonOrderReferenceId',
|
673 |
+
'authorization_amount' => 'AuthorizationAmount.Amount',
|
674 |
+
'currency_code' => 'AuthorizationAmount.CurrencyCode',
|
675 |
+
'authorization_reference_id' => 'AuthorizationReferenceId',
|
676 |
+
'capture_now' => 'CaptureNow',
|
677 |
+
'provider_credit_details' => array(),
|
678 |
+
'seller_authorization_note' => 'SellerAuthorizationNote',
|
679 |
+
'transaction_timeout' => 'TransactionTimeout',
|
680 |
+
'soft_descriptor' => 'SoftDescriptor',
|
681 |
+
'mws_auth_token' => 'MWSAuthToken'
|
682 |
+
);
|
683 |
+
|
684 |
+
$responseObject = $this->setParametersAndPost($parameters, $fieldMappings, $requestParameters);
|
685 |
+
|
686 |
+
return ($responseObject);
|
687 |
+
}
|
688 |
+
|
689 |
+
/* GetAuthorizationDetails API call - Returns the status of a particular authorization and the total amount captured on the authorization.
|
690 |
+
* @see http://docs.developer.amazonservices.com/en_US/off_amazon_payments/OffAmazonPayments_GetAuthorizationDetails.html
|
691 |
+
*
|
692 |
+
* @param requestParameters['merchant_id'] - [String]
|
693 |
+
* @param requestParameters['amazon_authorization_id'] [String]
|
694 |
+
* @optional requestParameters['mws_auth_token'] - [String]
|
695 |
+
*/
|
696 |
+
|
697 |
+
public function getAuthorizationDetails($requestParameters = array())
|
698 |
+
{
|
699 |
+
$parameters = array();
|
700 |
+
$parameters['Action'] = 'GetAuthorizationDetails';
|
701 |
+
$requestParameters = array_change_key_case($requestParameters, CASE_LOWER);
|
702 |
+
|
703 |
+
$fieldMappings = array(
|
704 |
+
'merchant_id' => 'SellerId',
|
705 |
+
'amazon_authorization_id' => 'AmazonAuthorizationId',
|
706 |
+
'mws_auth_token' => 'MWSAuthToken'
|
707 |
+
);
|
708 |
+
|
709 |
+
$responseObject = $this->setParametersAndPost($parameters, $fieldMappings, $requestParameters);
|
710 |
+
|
711 |
+
return ($responseObject);
|
712 |
+
}
|
713 |
+
|
714 |
+
/* Capture API call - Captures funds from an authorized payment instrument.
|
715 |
+
* @see http://docs.developer.amazonservices.com/en_US/off_amazon_payments/OffAmazonPayments_Capture.html
|
716 |
+
*
|
717 |
+
* @param requestParameters['merchant_id'] - [String]
|
718 |
+
* @param requestParameters['amazon_authorization_id'] - [String]
|
719 |
+
* @param requestParameters['capture_amount'] - [String]
|
720 |
+
* @param requestParameters['currency_code'] - [String]
|
721 |
+
* @param requestParameters['capture_reference_id'] - [String]
|
722 |
+
* @optional requestParameters['provider_credit_details'] - [array (array())]
|
723 |
+
* @optional requestParameters['seller_capture_note'] - [String]
|
724 |
+
* @optional requestParameters['soft_descriptor'] - [String]
|
725 |
+
* @optional requestParameters['mws_auth_token'] - [String]
|
726 |
+
*/
|
727 |
+
|
728 |
+
public function capture($requestParameters = array())
|
729 |
+
{
|
730 |
+
$parameters = array();
|
731 |
+
$parameters['Action'] = 'Capture';
|
732 |
+
$requestParameters = array_change_key_case($requestParameters, CASE_LOWER);
|
733 |
+
|
734 |
+
$fieldMappings = array(
|
735 |
+
'merchant_id' => 'SellerId',
|
736 |
+
'amazon_authorization_id' => 'AmazonAuthorizationId',
|
737 |
+
'capture_amount' => 'CaptureAmount.Amount',
|
738 |
+
'currency_code' => 'CaptureAmount.CurrencyCode',
|
739 |
+
'capture_reference_id' => 'CaptureReferenceId',
|
740 |
+
'provider_credit_details' => array(),
|
741 |
+
'seller_capture_note' => 'SellerCaptureNote',
|
742 |
+
'soft_descriptor' => 'SoftDescriptor',
|
743 |
+
'mws_auth_token' => 'MWSAuthToken'
|
744 |
+
);
|
745 |
+
|
746 |
+
$responseObject = $this->setParametersAndPost($parameters, $fieldMappings, $requestParameters);
|
747 |
+
|
748 |
+
return ($responseObject);
|
749 |
+
}
|
750 |
+
|
751 |
+
/* GetCaptureDetails API call - Returns the status of a particular capture and the total amount refunded on the capture.
|
752 |
+
* @see http://docs.developer.amazonservices.com/en_US/off_amazon_payments/OffAmazonPayments_GetCaptureDetails.html
|
753 |
+
*
|
754 |
+
* @param requestParameters['merchant_id'] - [String]
|
755 |
+
* @param requestParameters['amazon_capture_id'] - [String]
|
756 |
+
* @optional requestParameters['mws_auth_token'] - [String]
|
757 |
+
*/
|
758 |
+
|
759 |
+
public function getCaptureDetails($requestParameters = array())
|
760 |
+
{
|
761 |
+
$parameters = array();
|
762 |
+
$parameters['Action'] = 'GetCaptureDetails';
|
763 |
+
$requestParameters = array_change_key_case($requestParameters, CASE_LOWER);
|
764 |
+
|
765 |
+
$fieldMappings = array(
|
766 |
+
'merchant_id' => 'SellerId',
|
767 |
+
'amazon_capture_id' => 'AmazonCaptureId',
|
768 |
+
'mws_auth_token' => 'MWSAuthToken'
|
769 |
+
);
|
770 |
+
|
771 |
+
$responseObject = $this->setParametersAndPost($parameters, $fieldMappings, $requestParameters);
|
772 |
+
|
773 |
+
return ($responseObject);
|
774 |
+
}
|
775 |
+
|
776 |
+
/* Refund API call - Refunds a previously captured amount.
|
777 |
+
* @see http://docs.developer.amazonservices.com/en_US/off_amazon_payments/OffAmazonPayments_Refund.html
|
778 |
+
*
|
779 |
+
* @param requestParameters['merchant_id'] - [String]
|
780 |
+
* @param requestParameters['amazon_capture_id'] - [String]
|
781 |
+
* @param requestParameters['refund_reference_id'] - [String]
|
782 |
+
* @param requestParameters['refund_amount'] - [String]
|
783 |
+
* @param requestParameters['currency_code'] - [String]
|
784 |
+
* @optional requestParameters['provider_credit_reversal_details'] - [array(array())]
|
785 |
+
* @optional requestParameters['seller_refund_note'] [String]
|
786 |
+
* @optional requestParameters['soft_descriptor'] - [String]
|
787 |
+
* @optional requestParameters['mws_auth_token'] - [String]
|
788 |
+
*/
|
789 |
+
|
790 |
+
public function refund($requestParameters = array())
|
791 |
+
{
|
792 |
+
$parameters = array();
|
793 |
+
$parameters['Action'] = 'Refund';
|
794 |
+
$requestParameters = array_change_key_case($requestParameters, CASE_LOWER);
|
795 |
+
|
796 |
+
$fieldMappings = array(
|
797 |
+
'merchant_id' => 'SellerId',
|
798 |
+
'amazon_capture_id' => 'AmazonCaptureId',
|
799 |
+
'refund_reference_id' => 'RefundReferenceId',
|
800 |
+
'refund_amount' => 'RefundAmount.Amount',
|
801 |
+
'currency_code' => 'RefundAmount.CurrencyCode',
|
802 |
+
'provider_credit_reversal_details' => array(),
|
803 |
+
'seller_refund_note' => 'SellerRefundNote',
|
804 |
+
'soft_descriptor' => 'SoftDescriptor',
|
805 |
+
'mws_auth_token' => 'MWSAuthToken'
|
806 |
+
);
|
807 |
+
|
808 |
+
$responseObject = $this->setParametersAndPost($parameters, $fieldMappings, $requestParameters);
|
809 |
+
|
810 |
+
return ($responseObject);
|
811 |
+
}
|
812 |
+
|
813 |
+
/* GetRefundDetails API call - Returns the status of a particular refund.
|
814 |
+
* @see http://docs.developer.amazonservices.com/en_US/off_amazon_payments/OffAmazonPayments_GetRefundDetails.html
|
815 |
+
*
|
816 |
+
* @param requestParameters['merchant_id'] - [String]
|
817 |
+
* @param requestParameters['amazon_refund_id'] - [String]
|
818 |
+
* @optional requestParameters['mws_auth_token'] - [String]
|
819 |
+
*/
|
820 |
+
|
821 |
+
public function getRefundDetails($requestParameters = array())
|
822 |
+
{
|
823 |
+
$parameters = array();
|
824 |
+
$parameters['Action'] = 'GetRefundDetails';
|
825 |
+
$requestParameters = array_change_key_case($requestParameters, CASE_LOWER);
|
826 |
+
|
827 |
+
$fieldMappings = array(
|
828 |
+
'merchant_id' => 'SellerId',
|
829 |
+
'amazon_refund_id' => 'AmazonRefundId',
|
830 |
+
'mws_auth_token' => 'MWSAuthToken'
|
831 |
+
);
|
832 |
+
|
833 |
+
$responseObject = $this->setParametersAndPost($parameters, $fieldMappings, $requestParameters);
|
834 |
+
|
835 |
+
return ($responseObject);
|
836 |
+
}
|
837 |
+
|
838 |
+
/* GetServiceStatus API Call - Returns the operational status of the Off-Amazon Payments API section
|
839 |
+
* @see http://docs.developer.amazonservices.com/en_US/off_amazon_payments/OffAmazonPayments_GetServiceStatus.html
|
840 |
+
*
|
841 |
+
* The GetServiceStatus operation returns the operational status of the Off-Amazon Payments API
|
842 |
+
* section of Amazon Marketplace Web Service (Amazon MWS).
|
843 |
+
* Status values are GREEN, GREEN_I, YELLOW, and RED.
|
844 |
+
*
|
845 |
+
* @param requestParameters['merchant_id'] - [String]
|
846 |
+
* @optional requestParameters['mws_auth_token'] - [String]
|
847 |
+
*/
|
848 |
+
|
849 |
+
public function getServiceStatus($requestParameters = array())
|
850 |
+
{
|
851 |
+
$parameters = array();
|
852 |
+
$parameters['Action'] = 'GetServiceStatus';
|
853 |
+
$requestParameters = array_change_key_case($requestParameters, CASE_LOWER);
|
854 |
+
|
855 |
+
$fieldMappings = array(
|
856 |
+
'merchant_id' => 'SellerId',
|
857 |
+
'mws_auth_token' => 'MWSAuthToken'
|
858 |
+
);
|
859 |
+
|
860 |
+
$responseObject = $this->setParametersAndPost($parameters, $fieldMappings, $requestParameters);
|
861 |
+
|
862 |
+
return ($responseObject);
|
863 |
+
}
|
864 |
+
|
865 |
+
/* CreateOrderReferenceForId API Call - Creates an order reference for the given object
|
866 |
+
* @see http://docs.developer.amazonservices.com/en_US/off_amazon_payments/OffAmazonPayments_CreateOrderReferenceForId.html
|
867 |
+
*
|
868 |
+
* @param requestParameters['merchant_id'] - [String]
|
869 |
+
* @param requestParameters['Id'] - [String]
|
870 |
+
* @optional requestParameters['inherit_shipping_address'] [Boolean]
|
871 |
+
* @optional requestParameters['ConfirmNow'] - [Boolean]
|
872 |
+
* @optional Amount (required when confirm_now is set to true) [String]
|
873 |
+
* @optional requestParameters['currency_code'] - [String]
|
874 |
+
* @optional requestParameters['seller_note'] - [String]
|
875 |
+
* @optional requestParameters['seller_order_id'] - [String]
|
876 |
+
* @optional requestParameters['store_name'] - [String]
|
877 |
+
* @optional requestParameters['custom_information'] - [String]
|
878 |
+
* @optional requestParameters['mws_auth_token'] - [String]
|
879 |
+
*/
|
880 |
+
|
881 |
+
public function createOrderReferenceForId($requestParameters = array())
|
882 |
+
{
|
883 |
+
$parameters = array();
|
884 |
+
$parameters['Action'] = 'CreateOrderReferenceForId';
|
885 |
+
$requestParameters = array_change_key_case($requestParameters, CASE_LOWER);
|
886 |
+
|
887 |
+
$fieldMappings = array(
|
888 |
+
'merchant_id' => 'SellerId',
|
889 |
+
'id' => 'Id',
|
890 |
+
'id_type' => 'IdType',
|
891 |
+
'inherit_shipping_address' => 'InheritShippingAddress',
|
892 |
+
'confirm_now' => 'ConfirmNow',
|
893 |
+
'amount' => 'OrderReferenceAttributes.OrderTotal.Amount',
|
894 |
+
'currency_code' => 'OrderReferenceAttributes.OrderTotal.CurrencyCode',
|
895 |
+
'platform_id' => 'OrderReferenceAttributes.PlatformId',
|
896 |
+
'seller_note' => 'OrderReferenceAttributes.SellerNote',
|
897 |
+
'seller_order_id' => 'OrderReferenceAttributes.SellerOrderAttributes.SellerOrderId',
|
898 |
+
'store_name' => 'OrderReferenceAttributes.SellerOrderAttributes.StoreName',
|
899 |
+
'custom_information' => 'OrderReferenceAttributes.SellerOrderAttributes.CustomInformation',
|
900 |
+
'mws_auth_token' => 'MWSAuthToken'
|
901 |
+
);
|
902 |
+
|
903 |
+
$responseObject = $this->setParametersAndPost($parameters, $fieldMappings, $requestParameters);
|
904 |
+
|
905 |
+
return ($responseObject);
|
906 |
+
}
|
907 |
+
|
908 |
+
/* GetBillingAgreementDetails API Call - Returns details about the Billing Agreement object and its current state.
|
909 |
+
* @see http://docs.developer.amazonservices.com/en_US/off_amazon_payments/OffAmazonPayments_GetBillingAgreementDetails.html
|
910 |
+
*
|
911 |
+
* @param requestParameters['merchant_id'] - [String]
|
912 |
+
* @param requestParameters['amazon_billing_agreement_id'] - [String]
|
913 |
+
* @optional requestParameters['mws_auth_token'] - [String]
|
914 |
+
*/
|
915 |
+
|
916 |
+
public function getBillingAgreementDetails($requestParameters = array())
|
917 |
+
{
|
918 |
+
$parameters = array();
|
919 |
+
$parameters['Action'] = 'GetBillingAgreementDetails';
|
920 |
+
$requestParameters = array_change_key_case($requestParameters, CASE_LOWER);
|
921 |
+
|
922 |
+
$fieldMappings = array(
|
923 |
+
'merchant_id' => 'SellerId',
|
924 |
+
'amazon_billing_agreement_id' => 'AmazonBillingAgreementId',
|
925 |
+
'address_consent_token' => 'AddressConsentToken',
|
926 |
+
'mws_auth_token' => 'MWSAuthToken'
|
927 |
+
);
|
928 |
+
|
929 |
+
$responseObject = $this->setParametersAndPost($parameters, $fieldMappings, $requestParameters);
|
930 |
+
|
931 |
+
return ($responseObject);
|
932 |
+
}
|
933 |
+
|
934 |
+
/* SetBillingAgreementDetails API call - Sets Billing Agreement details such as a description of the agreement and other information about the seller.
|
935 |
+
* @see http://docs.developer.amazonservices.com/en_US/off_amazon_payments/OffAmazonPayments_SetBillingAgreementDetails.html
|
936 |
+
*
|
937 |
+
* @param requestParameters['merchant_id'] - [String]
|
938 |
+
* @param requestParameters['amazon_billing_agreement_id'] - [String]
|
939 |
+
* @param requestParameters['amount'] - [String]
|
940 |
+
* @param requestParameters['currency_code'] - [String]
|
941 |
+
* @optional requestParameters['platform_id'] - [String]
|
942 |
+
* @optional requestParameters['seller_note'] - [String]
|
943 |
+
* @optional requestParameters['seller_billing_agreement_id'] - [String]
|
944 |
+
* @optional requestParameters['store_name'] - [String]
|
945 |
+
* @optional requestParameters['custom_information'] - [String]
|
946 |
+
* @optional requestParameters['mws_auth_token'] - [String]
|
947 |
+
*/
|
948 |
+
|
949 |
+
public function setBillingAgreementDetails($requestParameters = array())
|
950 |
+
{
|
951 |
+
$parameters = array();
|
952 |
+
$parameters['Action'] = 'SetBillingAgreementDetails';
|
953 |
+
$requestParameters = array_change_key_case($requestParameters, CASE_LOWER);
|
954 |
+
|
955 |
+
$fieldMappings = array(
|
956 |
+
'merchant_id' => 'SellerId',
|
957 |
+
'amazon_billing_agreement_id' => 'AmazonBillingAgreementId',
|
958 |
+
'platform_id' => 'BillingAgreementAttributes.PlatformId',
|
959 |
+
'seller_note' => 'BillingAgreementAttributes.SellerNote',
|
960 |
+
'seller_billing_agreement_id' => 'BillingAgreementAttributes.SellerBillingAgreementAttributes.SellerBillingAgreementId',
|
961 |
+
'custom_information' => 'BillingAgreementAttributes.SellerBillingAgreementAttributes.CustomInformation',
|
962 |
+
'store_name' => 'BillingAgreementAttributes.SellerBillingAgreementAttributes.StoreName',
|
963 |
+
'mws_auth_token' => 'MWSAuthToken'
|
964 |
+
);
|
965 |
+
|
966 |
+
$responseObject = $this->setParametersAndPost($parameters, $fieldMappings, $requestParameters);
|
967 |
+
|
968 |
+
return ($responseObject);
|
969 |
+
}
|
970 |
+
|
971 |
+
/* ConfirmBillingAgreement API Call - Confirms that the Billing Agreement is free of constraints and all required information has been set on the Billing Agreement.
|
972 |
+
* @see http://docs.developer.amazonservices.com/en_US/off_amazon_payments/OffAmazonPayments_ConfirmBillingAgreement.html
|
973 |
+
*
|
974 |
+
* @param requestParameters['merchant_id'] - [String]
|
975 |
+
* @param requestParameters['amazon_billing_agreement_id'] - [String]
|
976 |
+
* @optional requestParameters['mws_auth_token'] - [String]
|
977 |
+
*/
|
978 |
+
|
979 |
+
public function confirmBillingAgreement($requestParameters = array())
|
980 |
+
{
|
981 |
+
$parameters = array();
|
982 |
+
$parameters['Action'] = 'ConfirmBillingAgreement';
|
983 |
+
$requestParameters = array_change_key_case($requestParameters, CASE_LOWER);
|
984 |
+
|
985 |
+
$fieldMappings = array(
|
986 |
+
'merchant_id' => 'SellerId',
|
987 |
+
'amazon_billing_agreement_id' => 'AmazonBillingAgreementId',
|
988 |
+
'mws_auth_token' => 'MWSAuthToken'
|
989 |
+
);
|
990 |
+
|
991 |
+
$responseObject = $this->setParametersAndPost($parameters, $fieldMappings, $requestParameters);
|
992 |
+
|
993 |
+
return ($responseObject);
|
994 |
+
}
|
995 |
+
|
996 |
+
/* ValidateBillignAgreement API Call - Validates the status of the Billing Agreement object and the payment method associated with it.
|
997 |
+
* @see http://docs.developer.amazonservices.com/en_US/off_amazon_payments/OffAmazonPayments_ValidateBillingAgreement.html
|
998 |
+
*
|
999 |
+
* @param requestParameters['merchant_id'] - [String]
|
1000 |
+
* @param requestParameters['amazon_billing_agreement_id'] - [String]
|
1001 |
+
* @optional requestParameters['mws_auth_token'] - [String]
|
1002 |
+
*/
|
1003 |
+
|
1004 |
+
public function validateBillingAgreement($requestParameters = array())
|
1005 |
+
{
|
1006 |
+
$parameters = array();
|
1007 |
+
$parameters['Action'] = 'ValidateBillingAgreement';
|
1008 |
+
$requestParameters = array_change_key_case($requestParameters, CASE_LOWER);
|
1009 |
+
|
1010 |
+
$fieldMappings = array(
|
1011 |
+
'merchant_id' => 'SellerId',
|
1012 |
+
'amazon_billing_agreement_id' => 'AmazonBillingAgreementId',
|
1013 |
+
'mws_auth_token' => 'MWSAuthToken'
|
1014 |
+
);
|
1015 |
+
|
1016 |
+
$responseObject = $this->setParametersAndPost($parameters, $fieldMappings, $requestParameters);
|
1017 |
+
|
1018 |
+
return ($responseObject);
|
1019 |
+
}
|
1020 |
+
|
1021 |
+
/* AuthorizeOnBillingAgreement API call - Reserves a specified amount against the payment method(s) stored in the Billing Agreement.
|
1022 |
+
* @see http://docs.developer.amazonservices.com/en_US/off_amazon_payments/OffAmazonPayments_AuthorizeOnBillingAgreement.html
|
1023 |
+
*
|
1024 |
+
* @param requestParameters['merchant_id'] - [String]
|
1025 |
+
* @param requestParameters['amazon_billing_agreement_id'] - [String]
|
1026 |
+
* @param requestParameters['authorization_reference_id'] [String]
|
1027 |
+
* @param requestParameters['authorization_amount'] [String]
|
1028 |
+
* @param requestParameters['currency_code'] - [String]
|
1029 |
+
* @optional requestParameters['seller_authorization_note'] [String]
|
1030 |
+
* @optional requestParameters['transaction_timeout'] - Defaults to 1440 minutes
|
1031 |
+
* @optional requestParameters['capture_now'] [String]
|
1032 |
+
* @optional requestParameters['soft_descriptor'] - - [String]
|
1033 |
+
* @optional requestParameters['seller_note'] - [String]
|
1034 |
+
* @optional requestParameters['platform_id'] - [String]
|
1035 |
+
* @optional requestParameters['custom_information'] - [String]
|
1036 |
+
* @optional requestParameters['seller_order_id'] - [String]
|
1037 |
+
* @optional requestParameters['store_name'] - [String]
|
1038 |
+
* @optional requestParameters['inherit_shipping_address'] [Boolean] - Defaults to true
|
1039 |
+
* @optional requestParameters['mws_auth_token'] - [String]
|
1040 |
+
*/
|
1041 |
+
|
1042 |
+
public function authorizeOnBillingAgreement($requestParameters = array())
|
1043 |
+
{
|
1044 |
+
$parameters = array();
|
1045 |
+
$parameters['Action'] = 'AuthorizeOnBillingAgreement';
|
1046 |
+
$requestParameters = array_change_key_case($requestParameters, CASE_LOWER);
|
1047 |
+
|
1048 |
+
$fieldMappings = array(
|
1049 |
+
'merchant_id' => 'SellerId',
|
1050 |
+
'amazon_billing_agreement_id' => 'AmazonBillingAgreementId',
|
1051 |
+
'authorization_reference_id' => 'AuthorizationReferenceId',
|
1052 |
+
'authorization_amount' => 'AuthorizationAmount.Amount',
|
1053 |
+
'currency_code' => 'AuthorizationAmount.CurrencyCode',
|
1054 |
+
'seller_authorization_note' => 'SellerAuthorizationNote',
|
1055 |
+
'transaction_timeout' => 'TransactionTimeout',
|
1056 |
+
'capture_now' => 'CaptureNow',
|
1057 |
+
'soft_descriptor' => 'SoftDescriptor',
|
1058 |
+
'seller_note' => 'SellerNote',
|
1059 |
+
'platform_id' => 'PlatformId',
|
1060 |
+
'custom_information' => 'SellerOrderAttributes.CustomInformation',
|
1061 |
+
'seller_order_id' => 'SellerOrderAttributes.SellerOrderId',
|
1062 |
+
'store_name' => 'SellerOrderAttributes.StoreName',
|
1063 |
+
'inherit_shipping_address' => 'InheritShippingAddress',
|
1064 |
+
'mws_auth_token' => 'MWSAuthToken'
|
1065 |
+
);
|
1066 |
+
|
1067 |
+
$responseObject = $this->setParametersAndPost($parameters, $fieldMappings, $requestParameters);
|
1068 |
+
|
1069 |
+
return ($responseObject);
|
1070 |
+
}
|
1071 |
+
|
1072 |
+
/* CloseBillingAgreement API Call - Returns details about the Billing Agreement object and its current state.
|
1073 |
+
* @see http://docs.developer.amazonservices.com/en_US/off_amazon_payments/OffAmazonPayments_CloseBillingAgreement.html
|
1074 |
+
*
|
1075 |
+
* @param requestParameters['merchant_id'] - [String]
|
1076 |
+
* @param requestParameters['amazon_billing_agreement_id'] - [String]
|
1077 |
+
* @optional requestParameters['closure_reason'] [String]
|
1078 |
+
* @optional requestParameters['mws_auth_token'] - [String]
|
1079 |
+
*/
|
1080 |
+
|
1081 |
+
public function closeBillingAgreement($requestParameters = array())
|
1082 |
+
{
|
1083 |
+
$parameters = array();
|
1084 |
+
$parameters['Action'] = 'CloseBillingAgreement';
|
1085 |
+
$requestParameters = array_change_key_case($requestParameters, CASE_LOWER);
|
1086 |
+
|
1087 |
+
$fieldMappings = array(
|
1088 |
+
'merchant_id' => 'SellerId',
|
1089 |
+
'amazon_billing_agreement_id' => 'AmazonBillingAgreementId',
|
1090 |
+
'closure_reason' => 'ClosureReason',
|
1091 |
+
'mws_auth_token' => 'MWSAuthToken'
|
1092 |
+
);
|
1093 |
+
|
1094 |
+
$responseObject = $this->setParametersAndPost($parameters, $fieldMappings, $requestParameters);
|
1095 |
+
|
1096 |
+
return ($responseObject);
|
1097 |
+
}
|
1098 |
+
|
1099 |
+
/* charge convenience method
|
1100 |
+
* Performs the API calls
|
1101 |
+
* 1. SetOrderReferenceDetails / SetBillingAgreementDetails
|
1102 |
+
* 2. ConfirmOrderReference / ConfirmBillingAgreement
|
1103 |
+
* 3. Authorize (with Capture) / AuthorizeOnBillingAgreeemnt (with Capture)
|
1104 |
+
*
|
1105 |
+
* @param requestParameters['merchant_id'] - [String]
|
1106 |
+
*
|
1107 |
+
* @param requestParameters['amazon_reference_id'] - [String] : Order Reference ID /Billing Agreement ID
|
1108 |
+
* If requestParameters['amazon_reference_id'] is empty then the following is required,
|
1109 |
+
* @param requestParameters['amazon_order_reference_id'] - [String] : Order Reference ID
|
1110 |
+
* or,
|
1111 |
+
* @param requestParameters['amazon_billing_agreement_id'] - [String] : Billing Agreement ID
|
1112 |
+
*
|
1113 |
+
* @param $requestParameters['charge_amount'] - [String] : Amount value to be captured
|
1114 |
+
* @param requestParameters['currency_code'] - [String] : Currency Code for the Amount
|
1115 |
+
* @param requestParameters['authorization_reference_id'] - [String]- Any unique string that needs to be passed
|
1116 |
+
* @optional requestParameters['charge_note'] - [String] : Seller Note sent to the buyer
|
1117 |
+
* @optional requestParameters['transaction_timeout'] - [String] : Defaults to 1440 minutes
|
1118 |
+
* @optional requestParameters['charge_order_id'] - [String] : Custom Order ID provided
|
1119 |
+
* @optional requestParameters['mws_auth_token'] - [String]
|
1120 |
+
*/
|
1121 |
+
|
1122 |
+
public function charge($requestParameters = array()) {
|
1123 |
+
|
1124 |
+
$requestParameters = array_change_key_case($requestParameters, CASE_LOWER);
|
1125 |
+
$requestParameters= $this->trimArray($requestParameters);
|
1126 |
+
|
1127 |
+
$setParameters = $authorizeParameters = $confirmParameters = $requestParameters;
|
1128 |
+
|
1129 |
+
$chargeType = '';
|
1130 |
+
|
1131 |
+
if (!empty($requestParameters['amazon_order_reference_id']))
|
1132 |
+
{
|
1133 |
+
$chargeType = 'OrderReference';
|
1134 |
+
|
1135 |
+
} elseif(!empty($requestParameters['amazon_billing_agreement_id'])) {
|
1136 |
+
$chargeType = 'BillingAgreement';
|
1137 |
+
|
1138 |
+
} elseif (!empty($requestParameters['amazon_reference_id'])) {
|
1139 |
+
switch (substr(strtoupper($requestParameters['amazon_reference_id']), 0, 1)) {
|
1140 |
+
case 'P':
|
1141 |
+
case 'S':
|
1142 |
+
$chargeType = 'OrderReference';
|
1143 |
+
$setParameters['amazon_order_reference_id'] = $requestParameters['amazon_reference_id'];
|
1144 |
+
$authorizeParameters['amazon_order_reference_id'] = $requestParameters['amazon_reference_id'];
|
1145 |
+
$confirmParameters['amazon_order_reference_id'] = $requestParameters['amazon_reference_id'];
|
1146 |
+
break;
|
1147 |
+
case 'B':
|
1148 |
+
case 'C':
|
1149 |
+
$chargeType = 'BillingAgreement';
|
1150 |
+
$setParameters['amazon_billing_agreement_id'] = $requestParameters['amazon_reference_id'];
|
1151 |
+
$authorizeParameters['amazon_billing_agreement_id'] = $requestParameters['amazon_reference_id'];
|
1152 |
+
$confirmParameters['amazon_billing_agreement_id'] = $requestParameters['amazon_reference_id'];
|
1153 |
+
break;
|
1154 |
+
default:
|
1155 |
+
throw new \Exception('Invalid Amazon Reference ID');
|
1156 |
+
}
|
1157 |
+
} else {
|
1158 |
+
throw new \Exception('key amazon_order_reference_id or amazon_billing_agreement_id is null and is a required parameter');
|
1159 |
+
}
|
1160 |
+
|
1161 |
+
// Set the other parameters if the values are present
|
1162 |
+
$setParameters['amount'] = !empty($requestParameters['charge_amount']) ? $requestParameters['charge_amount'] : '';
|
1163 |
+
$authorizeParameters['authorization_amount'] = !empty($requestParameters['charge_amount']) ? $requestParameters['charge_amount'] : '';
|
1164 |
+
|
1165 |
+
$setParameters['seller_note'] = !empty($requestParameters['charge_note']) ? $requestParameters['charge_note'] : '';
|
1166 |
+
$authorizeParameters['seller_authorization_note'] = !empty($requestParameters['charge_note']) ? $requestParameters['charge_note'] : '';
|
1167 |
+
$authorizeParameters['seller_note'] = !empty($requestParameters['charge_note']) ? $requestParameters['charge_note'] : '';
|
1168 |
+
|
1169 |
+
$setParameters['seller_order_id'] = !empty($requestParameters['charge_order_id']) ? $requestParameters['charge_order_id'] : '';
|
1170 |
+
$setParameters['seller_billing_agreement_id'] = !empty($requestParameters['charge_order_id']) ? $requestParameters['charge_order_id'] : '';
|
1171 |
+
$authorizeParameters['seller_order_id'] = !empty($requestParameters['charge_order_id']) ? $requestParameters['charge_order_id'] : '';
|
1172 |
+
|
1173 |
+
$authorizeParameters['capture_now'] = 'true';
|
1174 |
+
|
1175 |
+
$response = $this->makeChargeCalls($chargeType, $setParameters, $confirmParameters, $authorizeParameters);
|
1176 |
+
return $response;
|
1177 |
+
}
|
1178 |
+
|
1179 |
+
/* makeChargeCalls - makes API calls based off the charge type (OrderReference or BillingAgreement) */
|
1180 |
+
|
1181 |
+
private function makeChargeCalls($chargeType, $setParameters, $confirmParameters, $authorizeParameters)
|
1182 |
+
{
|
1183 |
+
switch ($chargeType) {
|
1184 |
+
case 'OrderReference':
|
1185 |
+
$response = $this->setOrderReferenceDetails($setParameters);
|
1186 |
+
if ($this->success) {
|
1187 |
+
$this->confirmOrderReference($confirmParameters);
|
1188 |
+
}
|
1189 |
+
if ($this->success) {
|
1190 |
+
$response = $this->Authorize($authorizeParameters);
|
1191 |
+
}
|
1192 |
+
return $response;
|
1193 |
+
case 'BillingAgreement':
|
1194 |
+
// Get the Billing Agreement details and feed the response object to the ResponseParser
|
1195 |
+
$responseObj = $this->getBillingAgreementDetails($setParameters);
|
1196 |
+
// Call the function GetBillingAgreementDetailsStatus in ResponseParser.php providing it the XML response
|
1197 |
+
// $baStatus is an aray containing the State of the Billing Agreement
|
1198 |
+
$baStatus = $responseObj->getBillingAgreementDetailsStatus($responseObj->toXml());
|
1199 |
+
if ($baStatus['State'] != 'Open') {
|
1200 |
+
$response = $this->SetBillingAgreementDetails($setParameters);
|
1201 |
+
if ($this->success) {
|
1202 |
+
$response = $this->ConfirmBillingAgreement($confirmParameters);
|
1203 |
+
}
|
1204 |
+
}
|
1205 |
+
// Check the Billing Agreement status again before making the Authorization.
|
1206 |
+
$responseObj = $this->getBillingAgreementDetails($setParameters);
|
1207 |
+
$baStatus = $responseObj->GetBillingAgreementDetailsStatus($responseObj->toXml());
|
1208 |
+
if ($this->success && $baStatus['State'] === 'Open') {
|
1209 |
+
$response = $this->AuthorizeOnBillingAgreement($authorizeParameters);
|
1210 |
+
}
|
1211 |
+
return $response;
|
1212 |
+
}
|
1213 |
+
}
|
1214 |
+
|
1215 |
+
/* GetProviderCreditDetails API Call - Get the details of the Provider Credit.
|
1216 |
+
*
|
1217 |
+
* @param requestParameters['merchant_id'] - [String]
|
1218 |
+
* @param requestParameters['amazon_provider_credit_id'] - [String]
|
1219 |
+
* @optional requestParameters['mws_auth_token'] - [String]
|
1220 |
+
*/
|
1221 |
+
|
1222 |
+
public function getProviderCreditDetails($requestParameters = array())
|
1223 |
+
{
|
1224 |
+
$parameters = array();
|
1225 |
+
$parameters['Action'] = 'GetProviderCreditDetails';
|
1226 |
+
$requestParameters = array_change_key_case($requestParameters, CASE_LOWER);
|
1227 |
+
|
1228 |
+
$fieldMappings = array(
|
1229 |
+
'merchant_id' => 'SellerId',
|
1230 |
+
'amazon_provider_credit_id' => 'AmazonProviderCreditId',
|
1231 |
+
'mws_auth_token' => 'MWSAuthToken'
|
1232 |
+
);
|
1233 |
+
|
1234 |
+
$responseObject = $this->setParametersAndPost($parameters, $fieldMappings, $requestParameters);
|
1235 |
+
|
1236 |
+
return ($responseObject);
|
1237 |
+
}
|
1238 |
+
|
1239 |
+
/* GetProviderCreditReversalDetails API Call - Get details of the Provider Credit Reversal.
|
1240 |
+
*
|
1241 |
+
* @param requestParameters['merchant_id'] - [String]
|
1242 |
+
* @param requestParameters['amazon_provider_credit_reversal_id'] - [String]
|
1243 |
+
* @optional requestParameters['mws_auth_token'] - [String]
|
1244 |
+
*/
|
1245 |
+
|
1246 |
+
public function getProviderCreditReversalDetails($requestParameters = array())
|
1247 |
+
{
|
1248 |
+
$parameters = array();
|
1249 |
+
$parameters['Action'] = 'GetProviderCreditReversalDetails';
|
1250 |
+
$requestParameters = array_change_key_case($requestParameters, CASE_LOWER);
|
1251 |
+
|
1252 |
+
$fieldMappings = array(
|
1253 |
+
'merchant_id' => 'SellerId',
|
1254 |
+
'amazon_provider_credit_reversal_id' => 'AmazonProviderCreditReversalId',
|
1255 |
+
'mws_auth_token' => 'MWSAuthToken'
|
1256 |
+
);
|
1257 |
+
|
1258 |
+
$responseObject = $this->setParametersAndPost($parameters, $fieldMappings, $requestParameters);
|
1259 |
+
|
1260 |
+
return ($responseObject);
|
1261 |
+
}
|
1262 |
+
|
1263 |
+
/* ReverseProviderCredit API Call - Reverse the Provider Credit.
|
1264 |
+
*
|
1265 |
+
* @param requestParameters['merchant_id'] - [String]
|
1266 |
+
* @param requestParameters['amazon_provider_credit_id'] - [String]
|
1267 |
+
* @optional requestParameters['credit_reversal_reference_id'] - [String]
|
1268 |
+
* @param requestParameters['credit_reversal_amount'] - [String]
|
1269 |
+
* @optional requestParameters['currency_code'] - [String]
|
1270 |
+
* @optional requestParameters['credit_reversal_note'] - [String]
|
1271 |
+
* @optional requestParameters['mws_auth_token'] - [String]
|
1272 |
+
*/
|
1273 |
+
|
1274 |
+
public function reverseProviderCredit($requestParameters = array())
|
1275 |
+
{
|
1276 |
+
$parameters = array();
|
1277 |
+
$parameters['Action'] = 'ReverseProviderCredit';
|
1278 |
+
$requestParameters = array_change_key_case($requestParameters, CASE_LOWER);
|
1279 |
+
|
1280 |
+
$fieldMappings = array(
|
1281 |
+
'merchant_id' => 'SellerId',
|
1282 |
+
'amazon_provider_credit_id' => 'AmazonProviderCreditId',
|
1283 |
+
'credit_reversal_reference_id' => 'CreditReversalReferenceId',
|
1284 |
+
'credit_reversal_amount' => 'CreditReversalAmount.Amount',
|
1285 |
+
'currency_code' => 'CreditReversalAmount.CurrencyCode',
|
1286 |
+
'credit_reversal_note' => 'CreditReversalNote',
|
1287 |
+
'mws_auth_token' => 'MWSAuthToken'
|
1288 |
+
);
|
1289 |
+
|
1290 |
+
$responseObject = $this->setParametersAndPost($parameters, $fieldMappings, $requestParameters);
|
1291 |
+
|
1292 |
+
return ($responseObject);
|
1293 |
+
}
|
1294 |
+
|
1295 |
+
/* Create an Array of required parameters, sort them
|
1296 |
+
* Calculate signature and invoke the POST to the MWS Service URL
|
1297 |
+
*
|
1298 |
+
* @param AWSAccessKeyId [String]
|
1299 |
+
* @param Version [String]
|
1300 |
+
* @param SignatureMethod [String]
|
1301 |
+
* @param Timestamp [String]
|
1302 |
+
* @param Signature [String]
|
1303 |
+
*/
|
1304 |
+
|
1305 |
+
private function calculateSignatureAndParametersToString($parameters = array())
|
1306 |
+
{
|
1307 |
+
$parameters['AWSAccessKeyId'] = $this->config['access_key'];
|
1308 |
+
$parameters['Version'] = self::SERVICE_VERSION;
|
1309 |
+
$parameters['SignatureMethod'] = 'HmacSHA256';
|
1310 |
+
$parameters['SignatureVersion'] = 2;
|
1311 |
+
$parameters['Timestamp'] = $this->getFormattedTimestamp();
|
1312 |
+
uksort($parameters, 'strcmp');
|
1313 |
+
|
1314 |
+
$this->createServiceUrl();
|
1315 |
+
|
1316 |
+
$parameters['Signature'] = $this->signParameters($parameters);
|
1317 |
+
$parameters = $this->getParametersAsString($parameters);
|
1318 |
+
|
1319 |
+
// Save these parameters in the parameters variable so that it can be returned for unit testing.
|
1320 |
+
$this->parameters = $parameters;
|
1321 |
+
return $parameters;
|
1322 |
+
}
|
1323 |
+
|
1324 |
+
/* Computes RFC 2104-compliant HMAC signature for request parameters
|
1325 |
+
* Implements AWS Signature, as per following spec:
|
1326 |
+
*
|
1327 |
+
* If Signature Version is 0, it signs concatenated Action and Timestamp
|
1328 |
+
*
|
1329 |
+
* If Signature Version is 1, it performs the following:
|
1330 |
+
*
|
1331 |
+
* Sorts all parameters (including SignatureVersion and excluding Signature,
|
1332 |
+
* the value of which is being created), ignoring case.
|
1333 |
+
*
|
1334 |
+
* Iterate over the sorted list and append the parameter name (in original case)
|
1335 |
+
* and then its value. It will not URL-encode the parameter values before
|
1336 |
+
* constructing this string. There are no separators.
|
1337 |
+
*
|
1338 |
+
* If Signature Version is 2, string to sign is based on following:
|
1339 |
+
*
|
1340 |
+
* 1. The HTTP Request Method followed by an ASCII newline (%0A)
|
1341 |
+
* 2. The HTTP Host header in the form of lowercase host, followed by an ASCII newline.
|
1342 |
+
* 3. The URL encoded HTTP absolute path component of the URI
|
1343 |
+
* (up to but not including the query string parameters);
|
1344 |
+
* if this is empty use a forward '/'. This parameter is followed by an ASCII newline.
|
1345 |
+
* 4. The concatenation of all query string components (names and values)
|
1346 |
+
* as UTF-8 characters which are URL encoded as per RFC 3986
|
1347 |
+
* (hex characters MUST be uppercase), sorted using lexicographic byte ordering.
|
1348 |
+
* Parameter names are separated from their values by the '=' character
|
1349 |
+
* (ASCII character 61), even if the value is empty.
|
1350 |
+
* Pairs of parameter and values are separated by the '&' character (ASCII code 38).
|
1351 |
+
*
|
1352 |
+
*/
|
1353 |
+
|
1354 |
+
private function signParameters(array $parameters)
|
1355 |
+
{
|
1356 |
+
$signatureVersion = $parameters['SignatureVersion'];
|
1357 |
+
$algorithm = "HmacSHA1";
|
1358 |
+
$stringToSign = null;
|
1359 |
+
if (2 === $signatureVersion) {
|
1360 |
+
$algorithm = "HmacSHA256";
|
1361 |
+
$parameters['SignatureMethod'] = $algorithm;
|
1362 |
+
$stringToSign = $this->calculateStringToSignV2($parameters);
|
1363 |
+
} else {
|
1364 |
+
throw new \Exception("Invalid Signature Version specified");
|
1365 |
+
}
|
1366 |
+
|
1367 |
+
return $this->sign($stringToSign, $algorithm);
|
1368 |
+
}
|
1369 |
+
|
1370 |
+
/* Calculate String to Sign for SignatureVersion 2
|
1371 |
+
* @param array $parameters request parameters
|
1372 |
+
* @return String to Sign
|
1373 |
+
*/
|
1374 |
+
|
1375 |
+
private function calculateStringToSignV2(array $parameters)
|
1376 |
+
{
|
1377 |
+
$data = 'POST';
|
1378 |
+
$data .= "\n";
|
1379 |
+
$data .= $this->mwsEndpointUrl;
|
1380 |
+
$data .= "\n";
|
1381 |
+
$data .= $this->mwsEndpointPath;
|
1382 |
+
$data .= "\n";
|
1383 |
+
$data .= $this->getParametersAsString($parameters);
|
1384 |
+
return $data;
|
1385 |
+
}
|
1386 |
+
|
1387 |
+
/* Convert paremeters to Url encoded query string */
|
1388 |
+
|
1389 |
+
private function getParametersAsString(array $parameters)
|
1390 |
+
{
|
1391 |
+
$queryParameters = array();
|
1392 |
+
foreach ($parameters as $key => $value) {
|
1393 |
+
$queryParameters[] = $key . '=' . $this->urlEncode($value);
|
1394 |
+
}
|
1395 |
+
|
1396 |
+
return implode('&', $queryParameters);
|
1397 |
+
}
|
1398 |
+
|
1399 |
+
private function urlEncode($value)
|
1400 |
+
{
|
1401 |
+
return str_replace('%7E', '~', rawurlencode($value));
|
1402 |
+
}
|
1403 |
+
|
1404 |
+
/* Computes RFC 2104-compliant HMAC signature */
|
1405 |
+
|
1406 |
+
private function sign($data, $algorithm)
|
1407 |
+
{
|
1408 |
+
if ($algorithm === 'HmacSHA1') {
|
1409 |
+
$hash = 'sha1';
|
1410 |
+
} else if ($algorithm === 'HmacSHA256') {
|
1411 |
+
$hash = 'sha256';
|
1412 |
+
} else {
|
1413 |
+
throw new \Exception("Non-supported signing method specified");
|
1414 |
+
}
|
1415 |
+
|
1416 |
+
return base64_encode(hash_hmac($hash, $data, $this->config['secret_key'], true));
|
1417 |
+
}
|
1418 |
+
|
1419 |
+
/* Formats date as ISO 8601 timestamp */
|
1420 |
+
|
1421 |
+
private function getFormattedTimestamp()
|
1422 |
+
{
|
1423 |
+
return gmdate("Y-m-d\TH:i:s.\\0\\0\\0\\Z", time());
|
1424 |
+
}
|
1425 |
+
|
1426 |
+
/* invokePost takes the parameters and invokes the httpPost function to POST the parameters
|
1427 |
+
* Exponential retries on error 500 and 503
|
1428 |
+
* The response from the POST is an XML which is converted to Array
|
1429 |
+
*/
|
1430 |
+
|
1431 |
+
private function invokePost($parameters)
|
1432 |
+
{
|
1433 |
+
$response = array();
|
1434 |
+
$statusCode = 200;
|
1435 |
+
$this->success = false;
|
1436 |
+
|
1437 |
+
// Submit the request and read response body
|
1438 |
+
try {
|
1439 |
+
$shouldRetry = true;
|
1440 |
+
$retries = 0;
|
1441 |
+
do {
|
1442 |
+
try {
|
1443 |
+
$this->constructUserAgentHeader();
|
1444 |
+
|
1445 |
+
$httpCurlRequest = new HttpCurl($this->config);
|
1446 |
+
$response = $httpCurlRequest->httpPost($this->mwsServiceUrl, $this->userAgent, $parameters);
|
1447 |
+
|
1448 |
+
// Split the API response into Response Body and the other parts of the response into other
|
1449 |
+
list($other, $responseBody) = explode("\r\n\r\n", $response, 2);
|
1450 |
+
$other = preg_split("/\r\n|\n|\r/", $other);
|
1451 |
+
|
1452 |
+
list($protocol, $code, $text) = explode(' ', trim(array_shift($other)), 3);
|
1453 |
+
$response = array(
|
1454 |
+
'Status' => (int) $code,
|
1455 |
+
'ResponseBody' => $responseBody
|
1456 |
+
);
|
1457 |
+
|
1458 |
+
$statusCode = $response['Status'];
|
1459 |
+
|
1460 |
+
if ($statusCode == 200) {
|
1461 |
+
$shouldRetry = false;
|
1462 |
+
$this->success = true;
|
1463 |
+
} elseif ($statusCode == 500 || $statusCode == 503) {
|
1464 |
+
|
1465 |
+
$shouldRetry = true;
|
1466 |
+
if ($shouldRetry && strtolower($this->config['handle_throttle'])) {
|
1467 |
+
$this->pauseOnRetry(++$retries, $statusCode);
|
1468 |
+
}
|
1469 |
+
} else {
|
1470 |
+
$shouldRetry = false;
|
1471 |
+
}
|
1472 |
+
} catch (\Exception $e) {
|
1473 |
+
throw $e;
|
1474 |
+
}
|
1475 |
+
} while ($shouldRetry);
|
1476 |
+
} catch (\Exception $se) {
|
1477 |
+
throw $se;
|
1478 |
+
}
|
1479 |
+
|
1480 |
+
return $response;
|
1481 |
+
}
|
1482 |
+
|
1483 |
+
/* Exponential sleep on failed request
|
1484 |
+
* @param retries current retry
|
1485 |
+
* @throws Exception if maximum number of retries has been reached
|
1486 |
+
*/
|
1487 |
+
|
1488 |
+
private function pauseOnRetry($retries, $status)
|
1489 |
+
{
|
1490 |
+
if ($retries <= self::MAX_ERROR_RETRY) {
|
1491 |
+
$delay = (int) (pow(4, $retries) * 100000);
|
1492 |
+
usleep($delay);
|
1493 |
+
} else {
|
1494 |
+
throw new \Exception('Error Code: '. $status.PHP_EOL.'Maximum number of retry attempts - '. $retries .' reached');
|
1495 |
+
}
|
1496 |
+
}
|
1497 |
+
|
1498 |
+
/* Create MWS service URL and the Endpoint path */
|
1499 |
+
|
1500 |
+
private function createServiceUrl()
|
1501 |
+
{
|
1502 |
+
$this->modePath = strtolower($this->config['sandbox']) ? 'OffAmazonPayments_Sandbox' : 'OffAmazonPayments';
|
1503 |
+
|
1504 |
+
if (!empty($this->config['region'])) {
|
1505 |
+
$region = strtolower($this->config['region']);
|
1506 |
+
if (array_key_exists($region, $this->regionMappings)) {
|
1507 |
+
$this->mwsEndpointUrl = $this->mwsServiceUrls[$this->regionMappings[$region]];
|
1508 |
+
$this->mwsServiceUrl = 'https://' . $this->mwsEndpointUrl . '/' . $this->modePath . '/' . self::SERVICE_VERSION;
|
1509 |
+
$this->mwsEndpointPath = '/' . $this->modePath . '/' . self::SERVICE_VERSION;
|
1510 |
+
} else {
|
1511 |
+
throw new \Exception($region . ' is not a valid region');
|
1512 |
+
}
|
1513 |
+
} else {
|
1514 |
+
throw new \Exception("config['region'] is a required parameter and is not set");
|
1515 |
+
}
|
1516 |
+
}
|
1517 |
+
|
1518 |
+
/* Based on the config['region'] and config['sandbox'] values get the user profile URL */
|
1519 |
+
|
1520 |
+
private function profileEndpointUrl()
|
1521 |
+
{
|
1522 |
+
if (!empty($this->config['region'])) {
|
1523 |
+
$region = strtolower($this->config['region']);
|
1524 |
+
|
1525 |
+
if (array_key_exists($region, $this->sandboxProfileEndpoint) && $this->config['sandbox'] ) {
|
1526 |
+
$this->profileEndpoint = $this->sandboxProfileEndpoint[$region];
|
1527 |
+
} elseif (array_key_exists($region, $this->liveProfileEndpoint)) {
|
1528 |
+
$this->profileEndpoint = $this->liveProfileEndpoint[$region];
|
1529 |
+
} else{
|
1530 |
+
throw new \Exception($region . ' is not a valid region');
|
1531 |
+
}
|
1532 |
+
} else {
|
1533 |
+
throw new \Exception("config['region'] is a required parameter and is not set");
|
1534 |
+
}
|
1535 |
+
}
|
1536 |
+
|
1537 |
+
/* Create the User Agent Header sent with the POST request */
|
1538 |
+
|
1539 |
+
private function constructUserAgentHeader()
|
1540 |
+
{
|
1541 |
+
$this->userAgent = $this->quoteApplicationName($this->config['application_name']) . '/' . $this->quoteApplicationVersion($this->config['application_version']);
|
1542 |
+
$this->userAgent .= ' (';
|
1543 |
+
$this->userAgent .= 'Language=PHP/' . phpversion();
|
1544 |
+
$this->userAgent .= '; ';
|
1545 |
+
$this->userAgent .= 'Platform=' . php_uname('s') . '/' . php_uname('m') . '/' . php_uname('r');
|
1546 |
+
$this->userAgent .= '; ';
|
1547 |
+
$this->userAgent .= 'MWSClientVersion=' . self::MWS_CLIENT_VERSION;
|
1548 |
+
$this->userAgent .= ')';
|
1549 |
+
}
|
1550 |
+
|
1551 |
+
/* Collapse multiple whitespace characters into a single ' ' and backslash escape '\',
|
1552 |
+
* and '/' characters from a string.
|
1553 |
+
* @param $s
|
1554 |
+
* @return string
|
1555 |
+
*/
|
1556 |
+
|
1557 |
+
private function quoteApplicationName($s)
|
1558 |
+
{
|
1559 |
+
$quotedString = preg_replace('/ {2,}|\s/', ' ', $s);
|
1560 |
+
$quotedString = preg_replace('/\\\\/', '\\\\\\\\', $quotedString);
|
1561 |
+
$quotedString = preg_replace('/\//', '\\/', $quotedString);
|
1562 |
+
return $quotedString;
|
1563 |
+
}
|
1564 |
+
|
1565 |
+
/* Collapse multiple whitespace characters into a single ' ' and backslash escape '\',
|
1566 |
+
* and '(' characters from a string.
|
1567 |
+
*
|
1568 |
+
* @param $s
|
1569 |
+
* @return string
|
1570 |
+
*/
|
1571 |
+
|
1572 |
+
private function quoteApplicationVersion($s)
|
1573 |
+
{
|
1574 |
+
$quotedString = preg_replace('/ {2,}|\s/', ' ', $s);
|
1575 |
+
$quotedString = preg_replace('/\\\\/', '\\\\\\\\', $quotedString);
|
1576 |
+
$quotedString = preg_replace('/\\(/', '\\(', $quotedString);
|
1577 |
+
return $quotedString;
|
1578 |
+
}
|
1579 |
+
}
|
includes/gateways/libs/amazon/HttpCurl.php
ADDED
@@ -0,0 +1,126 @@
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
1 |
+
<?php
|
2 |
+
namespace PayWithAmazon;
|
3 |
+
|
4 |
+
/* Class HttpCurl
|
5 |
+
* Handles Curl POST function for all requests
|
6 |
+
*/
|
7 |
+
|
8 |
+
require_once 'Interface.php';
|
9 |
+
|
10 |
+
class HttpCurl implements HttpCurlInterface
|
11 |
+
{
|
12 |
+
private $config = array();
|
13 |
+
private $header = false;
|
14 |
+
private $accessToken = null;
|
15 |
+
|
16 |
+
/* Takes user configuration array as input
|
17 |
+
* Takes configuration for API call or IPN config
|
18 |
+
*/
|
19 |
+
|
20 |
+
public function __construct($config = null)
|
21 |
+
{
|
22 |
+
$this->config = $config;
|
23 |
+
}
|
24 |
+
|
25 |
+
/* Setter for boolean header to get the user info */
|
26 |
+
|
27 |
+
public function setHttpHeader()
|
28 |
+
{
|
29 |
+
$this->header = true;
|
30 |
+
}
|
31 |
+
|
32 |
+
/* Setter for Access token to get the user info */
|
33 |
+
|
34 |
+
public function setAccessToken($accesstoken)
|
35 |
+
{
|
36 |
+
$this->accessToken = $accesstoken;
|
37 |
+
}
|
38 |
+
|
39 |
+
/* Add the common Curl Parameters to the curl handler $ch
|
40 |
+
* Also checks for optional parameters if provided in the config
|
41 |
+
* config['cabundle_file']
|
42 |
+
* config['proxy_port']
|
43 |
+
* config['proxy_host']
|
44 |
+
* config['proxy_username']
|
45 |
+
* config['proxy_password']
|
46 |
+
*/
|
47 |
+
|
48 |
+
private function commonCurlParams($url,$userAgent)
|
49 |
+
{
|
50 |
+
$ch = curl_init();
|
51 |
+
curl_setopt($ch, CURLOPT_URL, $url);
|
52 |
+
curl_setopt($ch, CURLOPT_PORT, 443);
|
53 |
+
curl_setopt($ch, CURLOPT_SSL_VERIFYPEER, true);
|
54 |
+
curl_setopt($ch, CURLOPT_SSL_VERIFYHOST, 2);
|
55 |
+
curl_setopt($ch, CURLOPT_RETURNTRANSFER, true);
|
56 |
+
|
57 |
+
if (!is_null($this->config['cabundle_file'])) {
|
58 |
+
curl_setopt($ch, CURLOPT_CAINFO, $this->config['cabundle_file']);
|
59 |
+
}
|
60 |
+
|
61 |
+
if (!empty($userAgent))
|
62 |
+
curl_setopt($ch, CURLOPT_USERAGENT, $userAgent);
|
63 |
+
|
64 |
+
if ($this->config['proxy_host'] != null && $this->config['proxy_port'] != -1) {
|
65 |
+
curl_setopt($ch, CURLOPT_PROXY, $this->config['proxy_host'] . ':' . $this->config['proxy_port']);
|
66 |
+
}
|
67 |
+
|
68 |
+
if ($this->config['proxy_username'] != null && $this->config['proxy_password'] != null) {
|
69 |
+
curl_setopt($ch, CURLOPT_PROXYUSERPWD, $this->config['proxy_username'] . ':' . $this->config['proxy_password']);
|
70 |
+
}
|
71 |
+
|
72 |
+
return $ch;
|
73 |
+
}
|
74 |
+
|
75 |
+
/* POST using curl for the following situations
|
76 |
+
* 1. API calls
|
77 |
+
* 2. IPN certificate retrieval
|
78 |
+
* 3. Get User Info
|
79 |
+
*/
|
80 |
+
|
81 |
+
public function httpPost($url, $userAgent = null, $parameters = null)
|
82 |
+
{
|
83 |
+
$ch = $this->commonCurlParams($url,$userAgent);
|
84 |
+
|
85 |
+
curl_setopt($ch, CURLOPT_POST, true);
|
86 |
+
curl_setopt($ch, CURLOPT_POSTFIELDS, $parameters);
|
87 |
+
curl_setopt($ch, CURLOPT_HEADER, true);
|
88 |
+
|
89 |
+
$response = $this->execute($ch);
|
90 |
+
return $response;
|
91 |
+
}
|
92 |
+
|
93 |
+
/* GET using curl for the following situations
|
94 |
+
* 1. IPN certificate retrieval
|
95 |
+
* 2. Get User Info
|
96 |
+
*/
|
97 |
+
|
98 |
+
public function httpGet($url, $userAgent = null)
|
99 |
+
{
|
100 |
+
$ch = $this->commonCurlParams($url,$userAgent);
|
101 |
+
|
102 |
+
// Setting the HTTP header with the Access Token only for Getting user info
|
103 |
+
if ($this->header) {
|
104 |
+
curl_setopt($ch, CURLOPT_HTTPHEADER, array(
|
105 |
+
'Authorization: bearer ' . $this->accessToken
|
106 |
+
));
|
107 |
+
}
|
108 |
+
|
109 |
+
$response = $this->execute($ch);
|
110 |
+
return $response;
|
111 |
+
}
|
112 |
+
|
113 |
+
/* Execute Curl request */
|
114 |
+
|
115 |
+
private function execute($ch)
|
116 |
+
{
|
117 |
+
$response = '';
|
118 |
+
if (!$response = curl_exec($ch)) {
|
119 |
+
$error_msg = "Unable to post request, underlying exception of " . curl_error($ch);
|
120 |
+
curl_close($ch);
|
121 |
+
throw new \Exception($error_msg);
|
122 |
+
}
|
123 |
+
curl_close($ch);
|
124 |
+
return $response;
|
125 |
+
}
|
126 |
+
}
|
includes/gateways/libs/amazon/Interface.php
ADDED
@@ -0,0 +1,479 @@
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
1 |
+
<?php
|
2 |
+
namespace PayWithAmazon;
|
3 |
+
|
4 |
+
/* Interface class to showcase the public API methods for Pay With Amazon */
|
5 |
+
|
6 |
+
interface ClientInterface
|
7 |
+
{
|
8 |
+
/* Takes user configuration array from the user as input
|
9 |
+
* Takes JSON file path with configuration information as input
|
10 |
+
* Validates the user configuation array against existing config array
|
11 |
+
*/
|
12 |
+
|
13 |
+
public function __construct($config = null);
|
14 |
+
|
15 |
+
/* Setter for sandbox
|
16 |
+
* Sets the boolean value for config['sandbox'] variable
|
17 |
+
*/
|
18 |
+
|
19 |
+
public function setSandbox($value);
|
20 |
+
|
21 |
+
/* Setter for config['client_id']
|
22 |
+
* Sets the value for config['client_id'] variable
|
23 |
+
*/
|
24 |
+
|
25 |
+
public function setClientId($value);
|
26 |
+
|
27 |
+
/* Setter for Proxy
|
28 |
+
* input $proxy [array]
|
29 |
+
* @param $proxy['proxy_user_host'] - hostname for the proxy
|
30 |
+
* @param $proxy['proxy_user_port'] - hostname for the proxy
|
31 |
+
* @param $proxy['proxy_user_name'] - if your proxy required a username
|
32 |
+
* @param $proxy['proxy_user_password'] - if your proxy required a passowrd
|
33 |
+
*/
|
34 |
+
|
35 |
+
public function setProxy($proxy);
|
36 |
+
|
37 |
+
/* Setter for $_mwsServiceUrl
|
38 |
+
* Set the URL to which the post request has to be made for unit testing
|
39 |
+
*/
|
40 |
+
|
41 |
+
public function setMwsServiceUrl($url);
|
42 |
+
|
43 |
+
/* Getter
|
44 |
+
* Gets the value for the key if the key exists in config
|
45 |
+
*/
|
46 |
+
|
47 |
+
public function __get($name);
|
48 |
+
|
49 |
+
/* Getter for parameters string
|
50 |
+
* Gets the value for the parameters string for unit testing
|
51 |
+
*/
|
52 |
+
|
53 |
+
public function getParameters();
|
54 |
+
|
55 |
+
/* GetUserInfo convenience funtion - Returns user's profile information from Amazon using the access token returned by the Button widget.
|
56 |
+
*
|
57 |
+
* @see http://docs.developer.amazonservices.com/en_US/apa_guide/APAGuide_ObtainProfile.html
|
58 |
+
* @param $access_token [String]
|
59 |
+
*/
|
60 |
+
|
61 |
+
public function getUserInfo($access_token);
|
62 |
+
|
63 |
+
/* GetOrderReferenceDetails API call - Returns details about the Order Reference object and its current state.
|
64 |
+
* @see http://docs.developer.amazonservices.com/en_US/off_amazon_payments/OffAmazonPayments_GetOrderReferenceDetails.html
|
65 |
+
*
|
66 |
+
* @param requestParameters['merchant_id'] - [String]
|
67 |
+
* @param requestParameters['amazon_order_reference_id'] - [String]
|
68 |
+
* @optional requestParameters['address_consent_token'] - [String]
|
69 |
+
* @optional requestParameters['mws_auth_token'] - [String]
|
70 |
+
*/
|
71 |
+
|
72 |
+
public function getOrderReferenceDetails($requestParameters = array());
|
73 |
+
|
74 |
+
/* SetOrderReferenceDetails API call - Sets order reference details such as the order total and a description for the order.
|
75 |
+
* @see http://docs.developer.amazonservices.com/en_US/off_amazon_payments/OffAmazonPayments_SetOrderReferenceDetails.html
|
76 |
+
*
|
77 |
+
* @param requestParameters['merchant_id'] - [String]
|
78 |
+
* @param requestParameters['amazon_order_reference_id'] - [String]
|
79 |
+
* @param requestParameters['amount'] - [String]
|
80 |
+
* @param requestParameters['currency_code'] - [String]
|
81 |
+
* @optional requestParameters['platform_id'] - [String]
|
82 |
+
* @optional requestParameters['seller_note'] - [String]
|
83 |
+
* @optional requestParameters['seller_order_id'] - [String]
|
84 |
+
* @optional requestParameters['store_name'] - [String]
|
85 |
+
* @optional requestParameters['custom_information'] - [String]
|
86 |
+
* @optional requestParameters['mws_auth_token'] - [String]
|
87 |
+
*/
|
88 |
+
|
89 |
+
public function setOrderReferenceDetails($requestParameters = array());
|
90 |
+
|
91 |
+
/* ConfirmOrderReferenceDetails API call - Confirms that the order reference is free of constraints and all required information has been set on the order reference.
|
92 |
+
* @see http://docs.developer.amazonservices.com/en_US/off_amazon_payments/OffAmazonPayments_ConfirmOrderReference.html
|
93 |
+
|
94 |
+
* @param requestParameters['merchant_id'] - [String]
|
95 |
+
* @param requestParameters['amazon_order_reference_id'] - [String]
|
96 |
+
* @optional requestParameters['mws_auth_token'] - [String]
|
97 |
+
*/
|
98 |
+
|
99 |
+
public function confirmOrderReference($requestParameters = array());
|
100 |
+
|
101 |
+
/* CancelOrderReferenceDetails API call - Cancels a previously confirmed order reference.
|
102 |
+
* @see http://docs.developer.amazonservices.com/en_US/off_amazon_payments/OffAmazonPayments_CancelOrderReference.html
|
103 |
+
*
|
104 |
+
* @param requestParameters['merchant_id'] - [String]
|
105 |
+
* @param requestParameters['amazon_order_reference_id'] - [String]
|
106 |
+
* @optional requestParameters['cancelation_reason'] [String]
|
107 |
+
* @optional requestParameters['mws_auth_token'] - [String]
|
108 |
+
*/
|
109 |
+
|
110 |
+
public function cancelOrderReference($requestParameters = array());
|
111 |
+
|
112 |
+
/* CloseOrderReferenceDetails API call - Confirms that an order reference has been fulfilled (fully or partially)
|
113 |
+
* and that you do not expect to create any new authorizations on this order reference.
|
114 |
+
* @see http://docs.developer.amazonservices.com/en_US/off_amazon_payments/OffAmazonPayments_CloseOrderReference.html
|
115 |
+
*
|
116 |
+
* @param requestParameters['merchant_id'] - [String]
|
117 |
+
* @param requestParameters['amazon_order_reference_id'] - [String]
|
118 |
+
* @optional requestParameters['closure_reason'] [String]
|
119 |
+
* @optional requestParameters['mws_auth_token'] - [String]
|
120 |
+
*/
|
121 |
+
|
122 |
+
public function closeOrderReference($requestParameters = array());
|
123 |
+
|
124 |
+
/* CloseAuthorization API call - Closes an authorization.
|
125 |
+
* @see http://docs.developer.amazonservices.com/en_US/off_amazon_payments/OffAmazonPayments_CloseOrderReference.html
|
126 |
+
*
|
127 |
+
* @param requestParameters['merchant_id'] - [String]
|
128 |
+
* @param requestParameters['amazon_authorization_id'] - [String]
|
129 |
+
* @optional requestParameters['closure_reason'] [String]
|
130 |
+
* @optional requestParameters['mws_auth_token'] - [String]
|
131 |
+
*/
|
132 |
+
|
133 |
+
public function closeAuthorization($requestParameters = array());
|
134 |
+
|
135 |
+
/* Authorize API call - Reserves a specified amount against the payment method(s) stored in the order reference.
|
136 |
+
* @see http://docs.developer.amazonservices.com/en_US/off_amazon_payments/OffAmazonPayments_Authorize.html
|
137 |
+
*
|
138 |
+
* @param requestParameters['merchant_id'] - [String]
|
139 |
+
* @param requestParameters['amazon_order_reference_id'] - [String]
|
140 |
+
* @param requestParameters['authorization_amount'] [String]
|
141 |
+
* @param requestParameters['currency_code'] - [String]
|
142 |
+
* @param requestParameters['authorization_reference_id'] [String]
|
143 |
+
* @optional requestParameters['capture_now'] [String]
|
144 |
+
* @optional requestParameters['provider_credit_details'] - [array (array())]
|
145 |
+
* @optional requestParameters['seller_authorization_note'] [String]
|
146 |
+
* @optional requestParameters['transaction_timeout'] [String] - Defaults to 1440 minutes
|
147 |
+
* @optional requestParameters['soft_descriptor'] - [String]
|
148 |
+
* @optional requestParameters['mws_auth_token'] - [String]
|
149 |
+
*/
|
150 |
+
|
151 |
+
public function authorize($requestParameters = array());
|
152 |
+
|
153 |
+
/* GetAuthorizationDetails API call - Returns the status of a particular authorization and the total amount captured on the authorization.
|
154 |
+
* @see http://docs.developer.amazonservices.com/en_US/off_amazon_payments/OffAmazonPayments_GetAuthorizationDetails.html
|
155 |
+
*
|
156 |
+
* @param requestParameters['merchant_id'] - [String]
|
157 |
+
* @param requestParameters['amazon_authorization_id'] [String]
|
158 |
+
* @optional requestParameters['mws_auth_token'] - [String]
|
159 |
+
*/
|
160 |
+
|
161 |
+
public function getAuthorizationDetails($requestParameters = array());
|
162 |
+
|
163 |
+
/* Capture API call - Captures funds from an authorized payment instrument.
|
164 |
+
* @see http://docs.developer.amazonservices.com/en_US/off_amazon_payments/OffAmazonPayments_Capture.html
|
165 |
+
*
|
166 |
+
* @param requestParameters['merchant_id'] - [String]
|
167 |
+
* @param requestParameters['amazon_authorization_id'] - [String]
|
168 |
+
* @param requestParameters['capture_amount'] - [String]
|
169 |
+
* @param requestParameters['currency_code'] - [String]
|
170 |
+
* @param requestParameters['capture_reference_id'] - [String]
|
171 |
+
* @optional requestParameters['provider_credit_details'] - [array (array())]
|
172 |
+
* @optional requestParameters['seller_capture_note'] - [String]
|
173 |
+
* @optional requestParameters['soft_descriptor'] - [String]
|
174 |
+
* @optional requestParameters['mws_auth_token'] - [String]
|
175 |
+
*/
|
176 |
+
|
177 |
+
public function capture($requestParameters = array());
|
178 |
+
|
179 |
+
/* GetCaptureDetails API call - Returns the status of a particular capture and the total amount refunded on the capture.
|
180 |
+
* @see http://docs.developer.amazonservices.com/en_US/off_amazon_payments/OffAmazonPayments_GetCaptureDetails.html
|
181 |
+
*
|
182 |
+
* @param requestParameters['merchant_id'] - [String]
|
183 |
+
* @param requestParameters['amazon_capture_id'] - [String]
|
184 |
+
* @optional requestParameters['mws_auth_token'] - [String]
|
185 |
+
*/
|
186 |
+
|
187 |
+
public function getCaptureDetails($requestParameters = array());
|
188 |
+
|
189 |
+
/* Refund API call - Refunds a previously captured amount.
|
190 |
+
* @see http://docs.developer.amazonservices.com/en_US/off_amazon_payments/OffAmazonPayments_Refund.html
|
191 |
+
*
|
192 |
+
* @param requestParameters['merchant_id'] - [String]
|
193 |
+
* @param requestParameters['amazon_capture_id'] - [String]
|
194 |
+
* @param requestParameters['refund_reference_id'] - [String]
|
195 |
+
* @param requestParameters['refund_amount'] - [String]
|
196 |
+
* @param requestParameters['currency_code'] - [String]
|
197 |
+
* @optional requestParameters['provider_credit_reversal_details'] - [array(array())]
|
198 |
+
* @optional requestParameters['seller_refund_note'] [String]
|
199 |
+
* @optional requestParameters['soft_descriptor'] - [String]
|
200 |
+
* @optional requestParameters['mws_auth_token'] - [String]
|
201 |
+
*/
|
202 |
+
|
203 |
+
public function refund($requestParameters = array());
|
204 |
+
|
205 |
+
/* GetRefundDetails API call - Returns the status of a particular refund.
|
206 |
+
* @see http://docs.developer.amazonservices.com/en_US/off_amazon_payments/OffAmazonPayments_GetRefundDetails.html
|
207 |
+
*
|
208 |
+
* @param requestParameters['merchant_id'] - [String]
|
209 |
+
* @param requestParameters['amazon_refund_id'] - [String]
|
210 |
+
* @optional requestParameters['mws_auth_token'] - [String]
|
211 |
+
*/
|
212 |
+
|
213 |
+
public function getRefundDetails($requestParameters = array());
|
214 |
+
|
215 |
+
/* GetServiceStatus API Call - Returns the operational status of the Off-Amazon Payments API section
|
216 |
+
* @see http://docs.developer.amazonservices.com/en_US/off_amazon_payments/OffAmazonPayments_GetServiceStatus.html
|
217 |
+
*
|
218 |
+
* The GetServiceStatus operation returns the operational status of the Off-Amazon Payments API
|
219 |
+
* section of Amazon Marketplace Web Service (Amazon MWS).
|
220 |
+
* Status values are GREEN, GREEN_I, YELLOW, and RED.
|
221 |
+
*
|
222 |
+
* @param requestParameters['merchant_id'] - [String]
|
223 |
+
* @optional requestParameters['mws_auth_token'] - [String]
|
224 |
+
*/
|
225 |
+
|
226 |
+
public function getServiceStatus($requestParameters = array());
|
227 |
+
|
228 |
+
/* CreateOrderReferenceForId API Call - Creates an order reference for the given object
|
229 |
+
* @see http://docs.developer.amazonservices.com/en_US/off_amazon_payments/OffAmazonPayments_CreateOrderReferenceForId.html
|
230 |
+
*
|
231 |
+
* @param requestParameters['merchant_id'] - [String]
|
232 |
+
* @param requestParameters['Id'] - [String]
|
233 |
+
* @optional requestParameters['inherit_shipping_address'] [Boolean]
|
234 |
+
* @optional requestParameters['ConfirmNow'] - [Boolean]
|
235 |
+
* @optional Amount (required when confirm_now is set to true) [String]
|
236 |
+
* @optional requestParameters['currency_code'] - [String]
|
237 |
+
* @optional requestParameters['seller_note'] - [String]
|
238 |
+
* @optional requestParameters['seller_order_id'] - [String]
|
239 |
+
* @optional requestParameters['store_name'] - [String]
|
240 |
+
* @optional requestParameters['custom_information'] - [String]
|
241 |
+
* @optional requestParameters['mws_auth_token'] - [String]
|
242 |
+
*/
|
243 |
+
|
244 |
+
public function createOrderReferenceForId($requestParameters = array());
|
245 |
+
|
246 |
+
/* GetBillingAgreementDetails API Call - Returns details about the Billing Agreement object and its current state.
|
247 |
+
* @see http://docs.developer.amazonservices.com/en_US/off_amazon_payments/OffAmazonPayments_GetBillingAgreementDetails.html
|
248 |
+
*
|
249 |
+
* @param requestParameters['merchant_id'] - [String]
|
250 |
+
* @param requestParameters['amazon_billing_agreement_id'] - [String]
|
251 |
+
* @optional requestParameters['mws_auth_token'] - [String]
|
252 |
+
*/
|
253 |
+
|
254 |
+
public function getBillingAgreementDetails($requestParameters = array());
|
255 |
+
|
256 |
+
/* SetBillingAgreementDetails API call - Sets Billing Agreement details such as a description of the agreement and other information about the seller.
|
257 |
+
* @see http://docs.developer.amazonservices.com/en_US/off_amazon_payments/OffAmazonPayments_SetBillingAgreementDetails.html
|
258 |
+
*
|
259 |
+
* @param requestParameters['merchant_id'] - [String]
|
260 |
+
* @param requestParameters['amazon_billing_agreement_id'] - [String]
|
261 |
+
* @param requestParameters['amount'] - [String]
|
262 |
+
* @param requestParameters['currency_code'] - [String]
|
263 |
+
* @optional requestParameters['platform_id'] - [String]
|
264 |
+
* @optional requestParameters['seller_note'] - [String]
|
265 |
+
* @optional requestParameters['seller_billing_agreement_id'] - [String]
|
266 |
+
* @optional requestParameters['store_name'] - [String]
|
267 |
+
* @optional requestParameters['custom_information'] - [String]
|
268 |
+
* @optional requestParameters['mws_auth_token'] - [String]
|
269 |
+
*/
|
270 |
+
|
271 |
+
public function setBillingAgreementDetails($requestParameters = array());
|
272 |
+
|
273 |
+
/* ConfirmBillingAgreement API Call - Confirms that the Billing Agreement is free of constraints and all required information has been set on the Billing Agreement.
|
274 |
+
* @see http://docs.developer.amazonservices.com/en_US/off_amazon_payments/OffAmazonPayments_ConfirmBillingAgreement.html
|
275 |
+
*
|
276 |
+
* @param requestParameters['merchant_id'] - [String]
|
277 |
+
* @param requestParameters['amazon_billing_agreement_id'] - [String]
|
278 |
+
* @optional requestParameters['mws_auth_token'] - [String]
|
279 |
+
*/
|
280 |
+
|
281 |
+
public function confirmBillingAgreement($requestParameters = array());
|
282 |
+
|
283 |
+
/* ValidateBillingAgreement API Call - Validates the status of the Billing Agreement object and the payment method associated with it.
|
284 |
+
* @see http://docs.developer.amazonservices.com/en_US/off_amazon_payments/OffAmazonPayments_ValidateBillignAgreement.html
|
285 |
+
*
|
286 |
+
* @param requestParameters['merchant_id'] - [String]
|
287 |
+
* @param requestParameters['amazon_billing_agreement_id'] - [String]
|
288 |
+
* @optional requestParameters['mws_auth_token'] - [String]
|
289 |
+
*/
|
290 |
+
|
291 |
+
public function validateBillingAgreement($requestParameters = array());
|
292 |
+
|
293 |
+
/* AuthorizeOnBillingAgreement API call - Reserves a specified amount against the payment method(s) stored in the Billing Agreement.
|
294 |
+
* @see http://docs.developer.amazonservices.com/en_US/off_amazon_payments/OffAmazonPayments_AuthorizeOnBillingAgreement.html
|
295 |
+
*
|
296 |
+
* @param requestParameters['merchant_id'] - [String]
|
297 |
+
* @param requestParameters['amazon_billing_agreement_id'] - [String]
|
298 |
+
* @param requestParameters['authorization_reference_id'] [String]
|
299 |
+
* @param requestParameters['authorization_amount'] [String]
|
300 |
+
* @param requestParameters['currency_code'] - [String]
|
301 |
+
* @optional requestParameters['seller_authorization_note'] [String]
|
302 |
+
* @optional requestParameters['transaction_timeout'] - Defaults to 1440 minutes
|
303 |
+
* @optional requestParameters['capture_now'] [String]
|
304 |
+
* @optional requestParameters['soft_descriptor'] - - [String]
|
305 |
+
* @optional requestParameters['seller_note'] - [String]
|
306 |
+
* @optional requestParameters['platform_id'] - [String]
|
307 |
+
* @optional requestParameters['custom_information'] - [String]
|
308 |
+
* @optional requestParameters['seller_order_id'] - [String]
|
309 |
+
* @optional requestParameters['store_name'] - [String]
|
310 |
+
* @optional requestParameters['inherit_shipping_address'] [Boolean] - Defaults to true
|
311 |
+
* @optional requestParameters['mws_auth_token'] - [String]
|
312 |
+
*/
|
313 |
+
|
314 |
+
public function authorizeOnBillingAgreement($requestParameters = array());
|
315 |
+
|
316 |
+
/* CloseBillingAgreement API Call - Returns details about the Billing Agreement object and its current state.
|
317 |
+
* @see http://docs.developer.amazonservices.com/en_US/off_amazon_payments/OffAmazonPayments_CloseBillingAgreement.html
|
318 |
+
*
|
319 |
+
* @param requestParameters['merchant_id'] - [String]
|
320 |
+
* @param requestParameters['amazon_billing_agreement_id'] - [String]
|
321 |
+
* @optional requestParameters['closure_reason'] [String]
|
322 |
+
* @optional requestParameters['mws_auth_token'] - [String]
|
323 |
+
*/
|
324 |
+
|
325 |
+
public function closeBillingAgreement($requestParameters = array());
|
326 |
+
|
327 |
+
/* charge convenience method
|
328 |
+
* Performs the API calls
|
329 |
+
* 1. SetOrderReferenceDetails / SetBillingAgreementDetails
|
330 |
+
* 2. ConfirmOrderReference / ConfirmBillingAgreement
|
331 |
+
* 3. Authorize (with Capture) / AuthorizeOnBillingAgreeemnt (with Capture)
|
332 |
+
*
|
333 |
+
* @param requestParameters['merchant_id'] - [String]
|
334 |
+
*
|
335 |
+
* @param requestParameters['amazon_reference_id'] - [String] : Order Reference ID /Billing Agreement ID
|
336 |
+
* If requestParameters['amazon_reference_id'] is empty then the following is required,
|
337 |
+
* @param requestParameters['amazon_order_reference_id'] - [String] : Order Reference ID
|
338 |
+
* or,
|
339 |
+
* @param requestParameters['amazon_billing_agreement_id'] - [String] : Billing Agreement ID
|
340 |
+
*
|
341 |
+
* @param $requestParameters['charge_amount'] - [String] : Amount value to be captured
|
342 |
+
* @param requestParameters['currency_code'] - [String] : Currency Code for the Amount
|
343 |
+
* @param requestParameters['authorization_reference_id'] - [String]- Any unique string that needs to be passed
|
344 |
+
* @optional requestParameters['charge_note'] - [String] : Seller Note sent to the buyer
|
345 |
+
* @optional requestParameters['transaction_timeout'] - [String] : Defaults to 1440 minutes
|
346 |
+
* @optional requestParameters['charge_order_id'] - [String] : Custom Order ID provided
|
347 |
+
* @optional requestParameters['mws_auth_token'] - [String]
|
348 |
+
*/
|
349 |
+
|
350 |
+
public function charge($requestParameters = array());
|
351 |
+
|
352 |
+
/* GetProviderCreditDetails API Call - Get the details of the Provider Credit.
|
353 |
+
*
|
354 |
+
* @param requestParameters['merchant_id'] - [String]
|
355 |
+
* @param requestParameters['amazon_provider_credit_id'] - [String]
|
356 |
+
* @optional requestParameters['mws_auth_token'] - [String]
|
357 |
+
*/
|
358 |
+
|
359 |
+
public function getProviderCreditDetails($requestParameters = array());
|
360 |
+
|
361 |
+
/* GetProviderCreditReversalDetails API Call - Get details of the Provider Credit Reversal.
|
362 |
+
*
|
363 |
+
* @param requestParameters['merchant_id'] - [String]
|
364 |
+
* @param requestParameters['amazon_provider_credit_reversal_id'] - [String]
|
365 |
+
* @optional requestParameters['mws_auth_token'] - [String]
|
366 |
+
*/
|
367 |
+
|
368 |
+
public function getProviderCreditReversalDetails($requestParameters = array());
|
369 |
+
|
370 |
+
/* ReverseProviderCredit API Call - Reverse the Provider Credit.
|
371 |
+
*
|
372 |
+
* @param requestParameters['merchant_id'] - [String]
|
373 |
+
* @param requestParameters['amazon_provider_credit_id'] - [String]
|
374 |
+
* @optional requestParameters['credit_reversal_reference_id'] - [String]
|
375 |
+
* @param requestParameters['credit_reversal_amount'] - [String]
|
376 |
+
* @optional requestParameters['currency_code'] - [String]
|
377 |
+
* @optional requestParameters['credit_reversal_note'] - [String]
|
378 |
+
* @optional requestParameters['mws_auth_token'] - [String]
|
379 |
+
*/
|
380 |
+
|
381 |
+
public function reverseProviderCredit($requestParameters = array());
|
382 |
+
}
|
383 |
+
|
384 |
+
/* Interface for IpnHandler.php */
|
385 |
+
|
386 |
+
interface IpnHandlerInterface
|
387 |
+
{
|
388 |
+
/* Takes headers and body of the IPN message as input in the constructor
|
389 |
+
* verifies that the IPN is from the right resource and has the valid data
|
390 |
+
*/
|
391 |
+
|
392 |
+
public function __construct($headers, $body, $ipnConfig = null);
|
393 |
+
|
394 |
+
/* returnMessage() - JSON decode the raw [Message] portion of the IPN */
|
395 |
+
|
396 |
+
public function returnMessage();
|
397 |
+
|
398 |
+
/* toJson() - Converts IPN [Message] field to JSON
|
399 |
+
*
|
400 |
+
* Has child elements
|
401 |
+
* ['NotificationData'] [XML] - API call XML notification data
|
402 |
+
* @param remainingFields - consists of remaining IPN array fields that are merged
|
403 |
+
* Type - Notification
|
404 |
+
* MessageId - ID of the Notification
|
405 |
+
* Topic ARN - Topic of the IPN
|
406 |
+
* @return response in JSON format
|
407 |
+
*/
|
408 |
+
|
409 |
+
public function toJson();
|
410 |
+
|
411 |
+
/* toArray() - Converts IPN [Message] field to associative array
|
412 |
+
* @return response in array format
|
413 |
+
*/
|
414 |
+
|
415 |
+
public function toArray();
|
416 |
+
}
|
417 |
+
|
418 |
+
/* Interface for HttpCurl.php */
|
419 |
+
|
420 |
+
interface HttpCurlInterface
|
421 |
+
{
|
422 |
+
/* Takes user configuration array as input
|
423 |
+
* Takes configuration for API call or IPN config
|
424 |
+
*/
|
425 |
+
|
426 |
+
public function __construct($config = null);
|
427 |
+
|
428 |
+
/* Set Http header for Access token for the GetUserInfo call */
|
429 |
+
|
430 |
+
public function setHttpHeader();
|
431 |
+
|
432 |
+
/* Setter for Access token to get the user info */
|
433 |
+
|
434 |
+
public function setAccessToken($accesstoken);
|
435 |
+
|
436 |
+
/* POST using curl for the following situations
|
437 |
+
* 1. API calls
|
438 |
+
* 2. IPN certificate retrieval
|
439 |
+
* 3. Get User Info
|
440 |
+
*/
|
441 |
+
|
442 |
+
public function httpPost($url, $userAgent = null, $parameters = null);
|
443 |
+
|
444 |
+
/* GET using curl for the following situations
|
445 |
+
* 1. IPN certificate retrieval
|
446 |
+
* 3. Get User Info
|
447 |
+
*/
|
448 |
+
|
449 |
+
public function httpGet($url, $userAgent = null);
|
450 |
+
}
|
451 |
+
|
452 |
+
/* Interface for ResponseParser.php */
|
453 |
+
|
454 |
+
interface ResponseInterface
|
455 |
+
{
|
456 |
+
/* Takes response from the API call */
|
457 |
+
|
458 |
+
public function __construct($response = null);
|
459 |
+
|
460 |
+
/* Returns the XML portion of the response */
|
461 |
+
|
462 |
+
public function toXml();
|
463 |
+
|
464 |
+
/* toJson - converts XML into Json
|
465 |
+
* @param $response [XML]
|
466 |
+
*/
|
467 |
+
|
468 |
+
public function toJson();
|
469 |
+
|
470 |
+
/* toArray - converts XML into associative array
|
471 |
+
* @param $this->_response [XML]
|
472 |
+
*/
|
473 |
+
|
474 |
+
public function toArray();
|
475 |
+
|
476 |
+
/* Get the status of the BillingAgreement */
|
477 |
+
|
478 |
+
public function getBillingAgreementDetailsStatus($response);
|
479 |
+
}
|
includes/gateways/libs/amazon/IpnHandler.php
ADDED
@@ -0,0 +1,418 @@
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
1 |
+
<?php
|
2 |
+
namespace PayWithAmazon;
|
3 |
+
|
4 |
+
/* Class IPN_Handler
|
5 |
+
* Takes headers and body of the IPN message as input in the constructor
|
6 |
+
* verifies that the IPN is from the right resource and has the valid data
|
7 |
+
*/
|
8 |
+
|
9 |
+
require_once 'HttpCurl.php';
|
10 |
+
require_once 'Interface.php';
|
11 |
+
class IpnHandler implements IpnHandlerInterface
|
12 |
+
{
|
13 |
+
|
14 |
+
private $headers = null;
|
15 |
+
private $body = null;
|
16 |
+
private $snsMessage = null;
|
17 |
+
private $fields = array();
|
18 |
+
private $signatureFields = array();
|
19 |
+
private $certificate = null;
|
20 |
+
private $expectedCnName = 'sns.amazonaws.com';
|
21 |
+
|
22 |
+
private $ipnConfig = array('cabundle_file' => null,
|
23 |
+
'proxy_host' => null,
|
24 |
+
'proxy_port' => -1,
|
25 |
+
'proxy_username' => null,
|
26 |
+
'proxy_password' => null);
|
27 |
+
|
28 |
+
|
29 |
+
public function __construct($headers, $body, $ipnConfig = null)
|
30 |
+
{
|
31 |
+
$this->headers = array_change_key_case($headers, CASE_LOWER);
|
32 |
+
$this->body = $body;
|
33 |
+
|
34 |
+
if ($ipnConfig != null) {
|
35 |
+
$this->checkConfigKeys($ipnConfig);
|
36 |
+
}
|
37 |
+
|
38 |
+
// Get the list of fields that we are interested in
|
39 |
+
$this->fields = array(
|
40 |
+
"Timestamp" => true,
|
41 |
+
"Message" => true,
|
42 |
+
"MessageId" => true,
|
43 |
+
"Subject" => false,
|
44 |
+
"TopicArn" => true,
|
45 |
+
"Type" => true
|
46 |
+
);
|
47 |
+
|
48 |
+
// Validate the IPN message header [x-amz-sns-message-type]
|
49 |
+
$this->validateHeaders();
|
50 |
+
|
51 |
+
// Converts the IPN [Message] to Notification object
|
52 |
+
$this->getMessage();
|
53 |
+
|
54 |
+
// Checks if the notification [Type] is Notification and constructs the signature fields
|
55 |
+
$this->checkForCorrectMessageType();
|
56 |
+
|
57 |
+
// Verifies the signature against the provided pem file in the IPN
|
58 |
+
$this->constructAndVerifySignature();
|
59 |
+
}
|
60 |
+
|
61 |
+
private function checkConfigKeys($ipnConfig)
|
62 |
+
{
|
63 |
+
$ipnConfig = array_change_key_case($ipnConfig, CASE_LOWER);
|
64 |
+
$ipnConfig = trimArray($ipnConfig);
|
65 |
+
|
66 |
+
foreach ($ipnConfig as $key => $value) {
|
67 |
+
if (array_key_exists($key, $this->ipnConfig)) {
|
68 |
+
$this->ipnConfig[$key] = $value;
|
69 |
+
} else {
|
70 |
+
throw new \Exception('Key ' . $key . ' is either not part of the configuration or has incorrect Key name.
|
71 |
+
check the ipnConfig array key names to match your key names of your config array ', 1);
|
72 |
+
}
|
73 |
+
}
|
74 |
+
}
|
75 |
+
|
76 |
+
/* Setter function
|
77 |
+
* Sets the value for the key if the key exists in ipnConfig
|
78 |
+
*/
|
79 |
+
|
80 |
+
public function __set($name, $value)
|
81 |
+
{
|
82 |
+
if (array_key_exists(strtolower($name), $this->ipnConfig)) {
|
83 |
+
$this->ipnConfig[$name] = $value;
|
84 |
+
} else {
|
85 |
+
throw new \Exception("Key " . $name . " is not part of the configuration", 1);
|
86 |
+
}
|
87 |
+
}
|
88 |
+
|
89 |
+
/* Getter function
|
90 |
+
* Returns the value for the key if the key exists in ipnConfig
|
91 |
+
*/
|
92 |
+
|
93 |
+
public function __get($name)
|
94 |
+
{
|
95 |
+
if (array_key_exists(strtolower($name), $this->ipnConfig)) {
|
96 |
+
return $this->ipnConfig[$name];
|
97 |
+
} else {
|
98 |
+
throw new \Exception("Key " . $name . " was not found in the configuration", 1);
|
99 |
+
}
|
100 |
+
}
|
101 |
+
|
102 |
+
/* Trim the input Array key values */
|
103 |
+
|
104 |
+
private function trimArray($array)
|
105 |
+
{
|
106 |
+
foreach ($array as $key => $value)
|
107 |
+
{
|
108 |
+
$array[$key] = trim($value);
|
109 |
+
}
|
110 |
+
return $array;
|
111 |
+
}
|
112 |
+
|
113 |
+
private function validateHeaders()
|
114 |
+
{
|
115 |
+
// Quickly check that this is a sns message
|
116 |
+
if (!array_key_exists('x-amz-sns-message-type', $this->headers)) {
|
117 |
+
throw new \Exception("Error with message - header " . "does not contain x-amz-sns-message-type header");
|
118 |
+
}
|
119 |
+
|
120 |
+
if ($this->headers['x-amz-sns-message-type'] !== 'Notification') {
|
121 |
+
throw new \Exception("Error with message - header x-amz-sns-message-type is not " . "Notification, is " . $this->headers['x-amz-sns-message-type']);
|
122 |
+
}
|
123 |
+
}
|
124 |
+
|
125 |
+
private function getMessage()
|
126 |
+
{
|
127 |
+
$this->snsMessage = json_decode($this->body, true);
|
128 |
+
|
129 |
+
$json_error = json_last_error();
|
130 |
+
|
131 |
+
if ($json_error != 0) {
|
132 |
+
$errorMsg = "Error with message - content is not in json format" . $this->getErrorMessageForJsonError($json_error) . " " . $this->snsMessage;
|
133 |
+
throw new \Exception($errorMsg);
|
134 |
+
}
|
135 |
+
}
|
136 |
+
|
137 |
+
/* Convert a json error code to a descriptive error message
|
138 |
+
*
|
139 |
+
* @param int $json_error message code
|
140 |
+
*
|
141 |
+
* @return string error message
|
142 |
+
*/
|
143 |
+
|
144 |
+
private function getErrorMessageForJsonError($json_error)
|
145 |
+
{
|
146 |
+
switch ($json_error) {
|
147 |
+
case JSON_ERROR_DEPTH:
|
148 |
+
return " - maximum stack depth exceeded.";
|
149 |
+
break;
|
150 |
+
case JSON_ERROR_STATE_MISMATCH:
|
151 |
+
return " - invalid or malformed JSON.";
|
152 |
+
break;
|
153 |
+
case JSON_ERROR_CTRL_CHAR:
|
154 |
+
return " - control character error.";
|
155 |
+
break;
|
156 |
+
case JSON_ERROR_SYNTAX:
|
157 |
+
return " - syntax error.";
|
158 |
+
break;
|
159 |
+
default:
|
160 |
+
return ".";
|
161 |
+
break;
|
162 |
+
}
|
163 |
+
}
|
164 |
+
|
165 |
+
/* checkForCorrectMessageType()
|
166 |
+
*
|
167 |
+
* Checks if the Field [Type] is set to ['Notification']
|
168 |
+
* Gets the value for the fields marked true in the fields array
|
169 |
+
* Constructs the signature string
|
170 |
+
*/
|
171 |
+
|
172 |
+
private function checkForCorrectMessageType()
|
173 |
+
{
|
174 |
+
$type = $this->getMandatoryField("Type");
|
175 |
+
if (strcasecmp($type, "Notification") != 0) {
|
176 |
+
throw new \Exception("Error with SNS Notification - unexpected message with Type of " . $type);
|
177 |
+
}
|
178 |
+
|
179 |
+
if (strcmp($this->getMandatoryField("Type"), "Notification") != 0) {
|
180 |
+
throw new \Exception("Error with signature verification - unable to verify " . $this->getMandatoryField("Type") . " message");
|
181 |
+
} else {
|
182 |
+
|
183 |
+
// Sort the fields into byte order based on the key name(A-Za-z)
|
184 |
+
ksort($this->fields);
|
185 |
+
|
186 |
+
// Extract the key value pairs and sort in byte order
|
187 |
+
$signatureFields = array();
|
188 |
+
foreach ($this->fields as $fieldName => $mandatoryField) {
|
189 |
+
if ($mandatoryField) {
|
190 |
+
$value = $this->getMandatoryField($fieldName);
|
191 |
+
} else {
|
192 |
+
$value = $this->getField($fieldName);
|
193 |
+
}
|
194 |
+
|
195 |
+
if (!is_null($value)) {
|
196 |
+
array_push($signatureFields, $fieldName);
|
197 |
+
array_push($signatureFields, $value);
|
198 |
+
}
|
199 |
+
}
|
200 |
+
|
201 |
+
/* Create the signature string - key / value in byte order
|
202 |
+
* delimited by newline character + ending with a new line character
|
203 |
+
*/
|
204 |
+
$this->signatureFields = implode("\n", $signatureFields) . "\n";
|
205 |
+
|
206 |
+
}
|
207 |
+
}
|
208 |
+
|
209 |
+
/* Verify that the signature is correct for the given data and
|
210 |
+
* public key
|
211 |
+
*
|
212 |
+
* @param string $data data to validate
|
213 |
+
* @param string $signature decoded signature to compare against
|
214 |
+
* @param string $certificatePath path to certificate, can be file or url
|
215 |
+
*
|
216 |
+
* @throws Exception if there is an error with the call
|
217 |
+
*
|
218 |
+
* @return bool true if valid
|
219 |
+
*/
|
220 |
+
|
221 |
+
private function constructAndVerifySignature()
|
222 |
+
{
|
223 |
+
$signature = base64_decode($this->getMandatoryField("Signature"));
|
224 |
+
$certificatePath = $this->getMandatoryField("SigningCertURL");
|
225 |
+
|
226 |
+
$this->certificate = $this->getCertificate($certificatePath);
|
227 |
+
|
228 |
+
$result = $this->verifySignatureIsCorrectFromCertificate($signature);
|
229 |
+
if (!$result) {
|
230 |
+
throw new \Exception("Unable to match signature from remote server: signature of " . $this->getCertificate($certificatePath) . " , SigningCertURL of " . $this->getMandatoryField("SigningCertURL") . " , SignatureOf " . $this->getMandatoryField("Signature"));
|
231 |
+
}
|
232 |
+
}
|
233 |
+
|
234 |
+
/* getCertificate($certificatePath)
|
235 |
+
*
|
236 |
+
* gets the certificate from the $certificatePath using Curl
|
237 |
+
*/
|
238 |
+
|
239 |
+
private function getCertificate($certificatePath)
|
240 |
+
{
|
241 |
+
$httpCurlRequest = new HttpCurl($this->ipnConfig);
|
242 |
+
|
243 |
+
$response = $httpCurlRequest->httpGet($certificatePath);
|
244 |
+
|
245 |
+
return $response;
|
246 |
+
}
|
247 |
+
|
248 |
+
/* Verify that the signature is correct for the given data and public key
|
249 |
+
*
|
250 |
+
* @param string $data data to validate
|
251 |
+
* @param string $signature decoded signature to compare against
|
252 |
+
* @param string $certificate certificate object defined in Certificate.php
|
253 |
+
*/
|
254 |
+
|
255 |
+
public function verifySignatureIsCorrectFromCertificate($signature)
|
256 |
+
{
|
257 |
+
$certKey = openssl_get_publickey($this->certificate);
|
258 |
+
|
259 |
+
if ($certKey === False) {
|
260 |
+
throw new \Exception("Unable to extract public key from cert");
|
261 |
+
}
|
262 |
+
|
263 |
+
try {
|
264 |
+
$certInfo = openssl_x509_parse($this->certificate, true);
|
265 |
+
$certSubject = $certInfo["subject"];
|
266 |
+
|
267 |
+
if (is_null($certSubject)) {
|
268 |
+
throw new \Exception("Error with certificate - subject cannot be found");
|
269 |
+
}
|
270 |
+
} catch (\Exception $ex) {
|
271 |
+
throw new \Exception("Unable to verify certificate - error with the certificate subject", null, $ex);
|
272 |
+
}
|
273 |
+
|
274 |
+
if (strcmp($certSubject["CN"], $this->expectedCnName)) {
|
275 |
+
throw new \Exception("Unable to verify certificate issued by Amazon - error with certificate subject");
|
276 |
+
}
|
277 |
+
|
278 |
+
$result = -1;
|
279 |
+
try {
|
280 |
+
$result = openssl_verify($this->signatureFields, $signature, $certKey, OPENSSL_ALGO_SHA1);
|
281 |
+
} catch (\Exception $ex) {
|
282 |
+
throw new \Exception("Unable to verify signature - error with the verification algorithm", null, $ex);
|
283 |
+
}
|
284 |
+
|
285 |
+
return ($result > 0);
|
286 |
+
}
|
287 |
+
|
288 |
+
|
289 |
+
/* Extract the mandatory field from the message and return the contents
|
290 |
+
*
|
291 |
+
* @param string $fieldName name of the field to extract
|
292 |
+
*
|
293 |
+
* @throws Exception if not found
|
294 |
+
*
|
295 |
+
* @return string field contents if found
|
296 |
+
*/
|
297 |
+
|
298 |
+
private function getMandatoryField($fieldName)
|
299 |
+
{
|
300 |
+
$value = $this->getField($fieldName);
|
301 |
+
if (is_null($value)) {
|
302 |
+
throw new \Exception("Error with json message - mandatory field " . $fieldName . " cannot be found");
|
303 |
+
}
|
304 |
+
return $value;
|
305 |
+
}
|
306 |
+
|
307 |
+
/* Extract the field if present, return null if not defined
|
308 |
+
*
|
309 |
+
* @param string $fieldName name of the field to extract
|
310 |
+
*
|
311 |
+
* @return string field contents if found, null otherwise
|
312 |
+
*/
|
313 |
+
|
314 |
+
private function getField($fieldName)
|
315 |
+
{
|
316 |
+
if (array_key_exists($fieldName, $this->snsMessage)) {
|
317 |
+
return $this->snsMessage[$fieldName];
|
318 |
+
} else {
|
319 |
+
return null;
|
320 |
+
}
|
321 |
+
}
|
322 |
+
|
323 |
+
/* returnMessage() - JSON decode the raw [Message] portion of the IPN */
|
324 |
+
|
325 |
+
public function returnMessage()
|
326 |
+
{
|
327 |
+
return json_decode($this->snsMessage['Message'], true);
|
328 |
+
}
|
329 |
+
|
330 |
+
/* toJson() - Converts IPN [Message] field to JSON
|
331 |
+
*
|
332 |
+
* Has child elements
|
333 |
+
* ['NotificationData'] [XML] - API call XML notification data
|
334 |
+
* @param remainingFields - consists of remaining IPN array fields that are merged
|
335 |
+
* Type - Notification
|
336 |
+
* MessageId - ID of the Notification
|
337 |
+
* Topic ARN - Topic of the IPN
|
338 |
+
* @return response in JSON format
|
339 |
+
*/
|
340 |
+
|
341 |
+
public function toJson()
|
342 |
+
{
|
343 |
+
$response = $this->simpleXmlObject();
|
344 |
+
|
345 |
+
// Merging the remaining fields with the response
|
346 |
+
$remainingFields = $this->getRemainingIpnFields();
|
347 |
+
$responseArray = array_merge($remainingFields,(array)$response);
|
348 |
+
|
349 |
+
// Converting to JSON format
|
350 |
+
$response = json_encode($responseArray);
|
351 |
+
|
352 |
+
return $response;
|
353 |
+
}
|
354 |
+
|
355 |
+
/* toArray() - Converts IPN [Message] field to associative array
|
356 |
+
* @return response in array format
|
357 |
+
*/
|
358 |
+
|
359 |
+
public function toArray()
|
360 |
+
{
|
361 |
+
$response = $this->simpleXmlObject();
|
362 |
+
|
363 |
+
// Converting the SimpleXMLElement Object to array()
|
364 |
+
$response = json_encode($response);
|
365 |
+
$response = json_decode($response, true);
|
366 |
+
|
367 |
+
// Merging the remaining fields with the response array
|
368 |
+
$remainingFields = $this->getRemainingIpnFields();
|
369 |
+
$response = array_merge($remainingFields,$response);
|
370 |
+
|
371 |
+
return $response;
|
372 |
+
}
|
373 |
+
|
374 |
+
/* addRemainingFields() - Add remaining fields to the datatype
|
375 |
+
*
|
376 |
+
* Has child elements
|
377 |
+
* ['NotificationData'] [XML] - API call XML response data
|
378 |
+
* Convert to SimpleXML element object
|
379 |
+
* Type - Notification
|
380 |
+
* MessageId - ID of the Notification
|
381 |
+
* Topic ARN - Topic of the IPN
|
382 |
+
* @return response in array format
|
383 |
+
*/
|
384 |
+
|
385 |
+
private function simpleXmlObject()
|
386 |
+
{
|
387 |
+
$ipnMessage = $this->returnMessage();
|
388 |
+
|
389 |
+
// Getting the Simple XML element object of the IPN XML Response Body
|
390 |
+
$response = simplexml_load_string((string) $ipnMessage['NotificationData']);
|
391 |
+
|
392 |
+
// Adding the Type, MessageId, TopicArn details of the IPN to the Simple XML element Object
|
393 |
+
$response->addChild('Type', $this->snsMessage['Type']);
|
394 |
+
$response->addChild('MessageId', $this->snsMessage['MessageId']);
|
395 |
+
$response->addChild('TopicArn', $this->snsMessage['TopicArn']);
|
396 |
+
|
397 |
+
return $response;
|
398 |
+
}
|
399 |
+
|
400 |
+
/* getRemainingIpnFields()
|
401 |
+
* Gets the remaining fields of the IPN to be later appended to the return message
|
402 |
+
*/
|
403 |
+
|
404 |
+
private function getRemainingIpnFields()
|
405 |
+
{
|
406 |
+
$ipnMessage = $this->returnMessage();
|
407 |
+
|
408 |
+
$remainingFields = array(
|
409 |
+
'NotificationReferenceId' =>$ipnMessage['NotificationReferenceId'],
|
410 |
+
'NotificationType' =>$ipnMessage['NotificationType'],
|
411 |
+
'IsSample' =>$ipnMessage['IsSample'],
|
412 |
+
'SellerId' =>$ipnMessage['SellerId'],
|
413 |
+
'ReleaseEnvironment' =>$ipnMessage['ReleaseEnvironment'],
|
414 |
+
'Version' =>$ipnMessage['Version']);
|
415 |
+
|
416 |
+
return $remainingFields;
|
417 |
+
}
|
418 |
+
}
|
includes/gateways/libs/amazon/ResponseParser.php
ADDED
@@ -0,0 +1,83 @@
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
1 |
+
<?php
|
2 |
+
namespace PayWithAmazon;
|
3 |
+
|
4 |
+
/* ResponseParser
|
5 |
+
* Methods provided to convert the Response from the POST to XML, Array or JSON
|
6 |
+
*/
|
7 |
+
|
8 |
+
require_once 'Interface.php';
|
9 |
+
|
10 |
+
class ResponseParser implements ResponseInterface
|
11 |
+
{
|
12 |
+
public $response = null;
|
13 |
+
|
14 |
+
public function __construct($response=null)
|
15 |
+
{
|
16 |
+
$this->response = $response;
|
17 |
+
}
|
18 |
+
|
19 |
+
/* Returns the XML portion of the response */
|
20 |
+
|
21 |
+
public function toXml()
|
22 |
+
{
|
23 |
+
return $this->response['ResponseBody'];
|
24 |
+
}
|
25 |
+
|
26 |
+
/* toJson - converts XML into Json
|
27 |
+
* @param $response [XML]
|
28 |
+
*/
|
29 |
+
|
30 |
+
public function toJson()
|
31 |
+
{
|
32 |
+
$response = $this->simpleXmlObject();
|
33 |
+
|
34 |
+
return (json_encode($response));
|
35 |
+
}
|
36 |
+
|
37 |
+
/* toArray - converts XML into associative array
|
38 |
+
* @param $this->response [XML]
|
39 |
+
*/
|
40 |
+
|
41 |
+
public function toArray()
|
42 |
+
{
|
43 |
+
$response = $this->simpleXmlObject();
|
44 |
+
|
45 |
+
// Converting the SimpleXMLElement Object to array()
|
46 |
+
$response = json_encode($response);
|
47 |
+
|
48 |
+
return (json_decode($response, true));
|
49 |
+
}
|
50 |
+
|
51 |
+
private function simpleXmlObject()
|
52 |
+
{
|
53 |
+
$response = $this->response;
|
54 |
+
|
55 |
+
// Getting the HttpResponse Status code to the output as a string
|
56 |
+
$status = strval($response['Status']);
|
57 |
+
|
58 |
+
// Getting the Simple XML element object of the XML Response Body
|
59 |
+
$response = simplexml_load_string((string) $response['ResponseBody']);
|
60 |
+
|
61 |
+
// Adding the HttpResponse Status code to the output as a string
|
62 |
+
$response->addChild('ResponseStatus', $status);
|
63 |
+
|
64 |
+
return $response;
|
65 |
+
}
|
66 |
+
|
67 |
+
/* Get the status of the BillingAgreement */
|
68 |
+
|
69 |
+
public function getBillingAgreementDetailsStatus($response)
|
70 |
+
{
|
71 |
+
$data= new \SimpleXMLElement($response);
|
72 |
+
$namespaces = $data->getNamespaces(true);
|
73 |
+
foreach($namespaces as $key=>$value){
|
74 |
+
$namespace = $value;
|
75 |
+
}
|
76 |
+
$data->registerXPathNamespace('GetBA', $namespace);
|
77 |
+
foreach ($data->xpath('//GetBA:BillingAgreementStatus') as $value) {
|
78 |
+
$baStatus = json_decode(json_encode((array)$value), TRUE);
|
79 |
+
}
|
80 |
+
|
81 |
+
return $baStatus ;
|
82 |
+
}
|
83 |
+
}
|
includes/gateways/paypal-standard.php
CHANGED
@@ -98,8 +98,8 @@ function edd_process_paypal_purchase( $purchase_data ) {
|
|
98 |
}
|
99 |
|
100 |
$paypal_extra_args = array(
|
101 |
-
'cmd'
|
102 |
-
'upload'
|
103 |
);
|
104 |
|
105 |
$paypal_args = array_merge( $paypal_extra_args, $paypal_args );
|
@@ -119,9 +119,9 @@ function edd_process_paypal_purchase( $purchase_data ) {
|
|
119 |
$item['name'] .= ' - ' . edd_get_cart_item_price_name( $item );
|
120 |
}
|
121 |
|
122 |
-
$paypal_args['item_name_' . $i ]
|
123 |
-
$paypal_args['quantity_' . $i ]
|
124 |
-
$paypal_args['amount_' . $i ]
|
125 |
|
126 |
if ( edd_use_skus() ) {
|
127 |
$paypal_args['item_number_' . $i ] = edd_get_download_sku( $item['id'] );
|
98 |
}
|
99 |
|
100 |
$paypal_extra_args = array(
|
101 |
+
'cmd' => '_cart',
|
102 |
+
'upload' => '1'
|
103 |
);
|
104 |
|
105 |
$paypal_args = array_merge( $paypal_extra_args, $paypal_args );
|
119 |
$item['name'] .= ' - ' . edd_get_cart_item_price_name( $item );
|
120 |
}
|
121 |
|
122 |
+
$paypal_args['item_name_' . $i ] = stripslashes_deep( html_entity_decode( wp_strip_all_tags( $item['name'] ), ENT_COMPAT, 'UTF-8' ) );
|
123 |
+
$paypal_args['quantity_' . $i ] = $item['quantity'];
|
124 |
+
$paypal_args['amount_' . $i ] = $item_amount;
|
125 |
|
126 |
if ( edd_use_skus() ) {
|
127 |
$paypal_args['item_number_' . $i ] = edd_get_download_sku( $item['id'] );
|
includes/install.php
CHANGED
@@ -137,6 +137,9 @@ function edd_install() {
|
|
137 |
$roles->add_roles();
|
138 |
$roles->add_caps();
|
139 |
|
|
|
|
|
|
|
140 |
// Create the customers database
|
141 |
@EDD()->customers->create_table();
|
142 |
|
@@ -157,7 +160,8 @@ function edd_install() {
|
|
157 |
// When new upgrade routines are added, mark them as complete on fresh install
|
158 |
$upgrade_routines = array(
|
159 |
'upgrade_payment_taxes',
|
160 |
-
'upgrade_customer_payments_association'
|
|
|
161 |
);
|
162 |
|
163 |
foreach ( $upgrade_routines as $upgrade ) {
|
137 |
$roles->add_roles();
|
138 |
$roles->add_caps();
|
139 |
|
140 |
+
$api = new EDD_API;
|
141 |
+
update_option( 'edd_default_api_version', 'v' . $api->get_version() );
|
142 |
+
|
143 |
// Create the customers database
|
144 |
@EDD()->customers->create_table();
|
145 |
|
160 |
// When new upgrade routines are added, mark them as complete on fresh install
|
161 |
$upgrade_routines = array(
|
162 |
'upgrade_payment_taxes',
|
163 |
+
'upgrade_customer_payments_association',
|
164 |
+
'upgrade_user_api_keys',
|
165 |
);
|
166 |
|
167 |
foreach ( $upgrade_routines as $upgrade ) {
|
includes/misc-functions.php
CHANGED
@@ -734,3 +734,26 @@ function hash_equals( $a, $b ) {
|
|
734 |
return $result === 0;
|
735 |
}
|
736 |
endif;
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
734 |
return $result === 0;
|
735 |
}
|
736 |
endif;
|
737 |
+
|
738 |
+
if ( ! function_exists( 'getallheaders' ) ) :
|
739 |
+
|
740 |
+
/**
|
741 |
+
* Retrieve all headers
|
742 |
+
*
|
743 |
+
* Ensure getallheaders function exists in the case we're using nginx
|
744 |
+
*
|
745 |
+
* @access public
|
746 |
+
* @since 2.4
|
747 |
+
* @return array
|
748 |
+
*/
|
749 |
+
function getallheaders() {
|
750 |
+
$headers = '';
|
751 |
+
foreach ( $_SERVER as $name => $value ) {
|
752 |
+
if ( substr( $name, 0, 5 ) == 'HTTP_' ) {
|
753 |
+
$headers[ str_replace( ' ', '-', ucwords( strtolower( str_replace( '_', ' ', substr( $name, 5 ) ) ) ) ) ] = $value;
|
754 |
+
}
|
755 |
+
}
|
756 |
+
return $headers;
|
757 |
+
}
|
758 |
+
|
759 |
+
endif;
|
includes/payments/actions.php
CHANGED
@@ -38,7 +38,6 @@ function edd_complete_purchase( $payment_id, $new_status, $old_status ) {
|
|
38 |
$customer_id = edd_get_payment_customer_id( $payment_id );
|
39 |
$amount = edd_get_payment_amount( $payment_id );
|
40 |
$cart_details = edd_get_payment_meta_cart_details( $payment_id );
|
41 |
-
$increase_stats = ! edd_is_test_mode() || apply_filters( 'edd_log_test_payment_stats', false );
|
42 |
|
43 |
do_action( 'edd_pre_complete_purchase', $payment_id );
|
44 |
|
@@ -56,25 +55,16 @@ function edd_complete_purchase( $payment_id, $new_status, $old_status ) {
|
|
56 |
// Ensure these actions only run once, ever
|
57 |
if( empty( $completed_date ) ) {
|
58 |
|
59 |
-
|
60 |
-
|
61 |
-
edd_record_sale_in_log( $download['id'], $payment_id, $price_id, $creation_date );
|
62 |
-
|
63 |
-
}
|
64 |
-
|
65 |
do_action( 'edd_complete_download_purchase', $download['id'], $payment_id, $download_type, $download, $cart_index );
|
66 |
|
67 |
}
|
68 |
|
69 |
}
|
70 |
|
71 |
-
|
72 |
-
|
73 |
-
|
74 |
-
edd_increase_earnings( $download['id'], $download['price'] );
|
75 |
-
edd_increase_purchase_count( $download['id'], $download['quantity'] );
|
76 |
-
|
77 |
-
}
|
78 |
|
79 |
}
|
80 |
|
@@ -85,16 +75,14 @@ function edd_complete_purchase( $payment_id, $new_status, $old_status ) {
|
|
85 |
delete_transient( md5( 'edd_earnings_todaytoday' ) );
|
86 |
}
|
87 |
|
88 |
-
if( $increase_stats ) {
|
89 |
|
90 |
-
|
91 |
-
|
92 |
-
|
93 |
-
|
94 |
|
95 |
-
|
96 |
|
97 |
-
}
|
98 |
|
99 |
// Check for discount codes and increment their use counts
|
100 |
if ( ! empty( $user_info['discount'] ) && $user_info['discount'] !== 'none' ) {
|
@@ -295,11 +283,11 @@ function edd_update_payment_backwards_compat( $meta_id, $object_id, $meta_key, $
|
|
295 |
|
296 |
case '_edd_payment_meta':
|
297 |
$meta_value = maybe_unserialize( $meta_value );
|
298 |
-
|
299 |
if( !isset( $meta_value['tax'] ) ){
|
300 |
return;
|
301 |
}
|
302 |
-
|
303 |
$tax_value = $meta_value['tax'];
|
304 |
|
305 |
$data = array( 'meta_value' => $tax_value );
|
38 |
$customer_id = edd_get_payment_customer_id( $payment_id );
|
39 |
$amount = edd_get_payment_amount( $payment_id );
|
40 |
$cart_details = edd_get_payment_meta_cart_details( $payment_id );
|
|
|
41 |
|
42 |
do_action( 'edd_pre_complete_purchase', $payment_id );
|
43 |
|
55 |
// Ensure these actions only run once, ever
|
56 |
if( empty( $completed_date ) ) {
|
57 |
|
58 |
+
edd_record_sale_in_log( $download['id'], $payment_id, $price_id, $creation_date );
|
|
|
|
|
|
|
|
|
|
|
59 |
do_action( 'edd_complete_download_purchase', $download['id'], $payment_id, $download_type, $download, $cart_index );
|
60 |
|
61 |
}
|
62 |
|
63 |
}
|
64 |
|
65 |
+
// Increase the earnings for this download ID
|
66 |
+
edd_increase_earnings( $download['id'], $download['price'] );
|
67 |
+
edd_increase_purchase_count( $download['id'], $download['quantity'] );
|
|
|
|
|
|
|
|
|
68 |
|
69 |
}
|
70 |
|
75 |
delete_transient( md5( 'edd_earnings_todaytoday' ) );
|
76 |
}
|
77 |
|
|
|
78 |
|
79 |
+
// Increase the customer's purchase stats
|
80 |
+
$customer = new EDD_Customer( $customer_id );
|
81 |
+
$customer->increase_purchase_count();
|
82 |
+
$customer->increase_value( $amount );
|
83 |
|
84 |
+
edd_increase_total_earnings( $amount );
|
85 |
|
|
|
86 |
|
87 |
// Check for discount codes and increment their use counts
|
88 |
if ( ! empty( $user_info['discount'] ) && $user_info['discount'] !== 'none' ) {
|
283 |
|
284 |
case '_edd_payment_meta':
|
285 |
$meta_value = maybe_unserialize( $meta_value );
|
286 |
+
|
287 |
if( !isset( $meta_value['tax'] ) ){
|
288 |
return;
|
289 |
}
|
290 |
+
|
291 |
$tax_value = $meta_value['tax'];
|
292 |
|
293 |
$data = array( 'meta_value' => $tax_value );
|
includes/payments/class-payment-stats.php
CHANGED
@@ -89,9 +89,10 @@ class EDD_Payment_Stats extends EDD_Stats {
|
|
89 |
* @param $download_id INT The download product to retrieve stats for. If false, gets stats for all products
|
90 |
* @param $start_date string|bool The starting date for which we'd like to filter our sale stats. If false, we'll use the default start date of `this_month`
|
91 |
* @param $end_date string|bool The end date for which we'd like to filter our sale stats. If false, we'll use the default end date of `this_month`
|
|
|
92 |
* @return float|int
|
93 |
*/
|
94 |
-
public function get_earnings( $download_id = 0, $start_date = false, $end_date = false ) {
|
95 |
|
96 |
global $wpdb;
|
97 |
|
@@ -105,7 +106,7 @@ class EDD_Payment_Stats extends EDD_Stats {
|
|
105 |
if( is_wp_error( $this->end_date ) )
|
106 |
return $this->end_date;
|
107 |
|
108 |
-
$earnings =
|
109 |
|
110 |
add_filter( 'posts_where', array( $this, 'payments_where' ) );
|
111 |
|
@@ -123,6 +124,7 @@ class EDD_Payment_Stats extends EDD_Stats {
|
|
123 |
'start_date' => $this->start_date, // These dates are not valid query args, but they are used for cache keys
|
124 |
'end_date' => $this->end_date,
|
125 |
'edd_transient_type' => 'edd_earnings', // This is not a valid query arg, but is used for cache keying
|
|
|
126 |
);
|
127 |
|
128 |
$args = apply_filters( 'edd_stats_earnings_args', $args );
|
@@ -133,8 +135,16 @@ class EDD_Payment_Stats extends EDD_Stats {
|
|
133 |
$sales = get_posts( $args );
|
134 |
$earnings = 0;
|
135 |
if ( $sales ) {
|
136 |
-
$sales = implode( ',', $sales );
|
137 |
-
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
138 |
}
|
139 |
// Cache the results for one hour
|
140 |
set_transient( $key, $earnings, 60*60 );
|
@@ -155,6 +165,7 @@ class EDD_Payment_Stats extends EDD_Stats {
|
|
155 |
'start_date' => $this->start_date, // These dates are not valid query args, but they are used for cache keys
|
156 |
'end_date' => $this->end_date,
|
157 |
'edd_transient_type' => 'edd_earnings', // This is not a valid query arg, but is used for cache keying
|
|
|
158 |
);
|
159 |
|
160 |
$args = apply_filters( 'edd_stats_earnings_args', $args );
|
@@ -167,8 +178,8 @@ class EDD_Payment_Stats extends EDD_Stats {
|
|
167 |
$earnings = 0;
|
168 |
|
169 |
if( $log_ids ) {
|
170 |
-
$log_ids = implode( ',', $log_ids );
|
171 |
-
$payment_ids = $wpdb->get_col( "SELECT meta_value FROM $wpdb->postmeta WHERE meta_key='_edd_log_payment_id' AND post_id IN ($log_ids);" );
|
172 |
|
173 |
foreach( $payment_ids as $payment_id ) {
|
174 |
$items = edd_get_payment_meta_cart_details( $payment_id );
|
@@ -178,6 +189,10 @@ class EDD_Payment_Stats extends EDD_Stats {
|
|
178 |
|
179 |
$earnings += $item['price'];
|
180 |
}
|
|
|
|
|
|
|
|
|
181 |
}
|
182 |
}
|
183 |
|
@@ -214,4 +229,4 @@ class EDD_Payment_Stats extends EDD_Stats {
|
|
214 |
return $downloads;
|
215 |
}
|
216 |
|
217 |
-
}
|
89 |
* @param $download_id INT The download product to retrieve stats for. If false, gets stats for all products
|
90 |
* @param $start_date string|bool The starting date for which we'd like to filter our sale stats. If false, we'll use the default start date of `this_month`
|
91 |
* @param $end_date string|bool The end date for which we'd like to filter our sale stats. If false, we'll use the default end date of `this_month`
|
92 |
+
* @param $include_taxes bool If taxes should be included in the earnings graphs
|
93 |
* @return float|int
|
94 |
*/
|
95 |
+
public function get_earnings( $download_id = 0, $start_date = false, $end_date = false, $include_taxes = true ) {
|
96 |
|
97 |
global $wpdb;
|
98 |
|
106 |
if( is_wp_error( $this->end_date ) )
|
107 |
return $this->end_date;
|
108 |
|
109 |
+
$earnings = false;
|
110 |
|
111 |
add_filter( 'posts_where', array( $this, 'payments_where' ) );
|
112 |
|
124 |
'start_date' => $this->start_date, // These dates are not valid query args, but they are used for cache keys
|
125 |
'end_date' => $this->end_date,
|
126 |
'edd_transient_type' => 'edd_earnings', // This is not a valid query arg, but is used for cache keying
|
127 |
+
'include_taxes' => $include_taxes,
|
128 |
);
|
129 |
|
130 |
$args = apply_filters( 'edd_stats_earnings_args', $args );
|
135 |
$sales = get_posts( $args );
|
136 |
$earnings = 0;
|
137 |
if ( $sales ) {
|
138 |
+
$sales = implode( ',', array_map('intval', $sales ) );
|
139 |
+
|
140 |
+
if ( $include_taxes ) {
|
141 |
+
$earnings += $wpdb->get_var( "SELECT SUM(meta_value) FROM $wpdb->postmeta WHERE meta_key = '_edd_payment_total' AND post_id IN ({$sales})" );
|
142 |
+
} else {
|
143 |
+
$earnings_with_tax = $wpdb->get_var( "SELECT SUM(meta_value) FROM $wpdb->postmeta WHERE meta_key = '_edd_payment_total' AND post_id IN ({$sales})" );
|
144 |
+
$total_tax = $wpdb->get_var( "SELECT SUM(meta_value) FROM $wpdb->postmeta WHERE meta_key = '_edd_payment_tax' AND post_id IN ({$sales})" );
|
145 |
+
|
146 |
+
$earnings += ( $earnings_with_tax - $total_tax );
|
147 |
+
}
|
148 |
}
|
149 |
// Cache the results for one hour
|
150 |
set_transient( $key, $earnings, 60*60 );
|
165 |
'start_date' => $this->start_date, // These dates are not valid query args, but they are used for cache keys
|
166 |
'end_date' => $this->end_date,
|
167 |
'edd_transient_type' => 'edd_earnings', // This is not a valid query arg, but is used for cache keying
|
168 |
+
'include_taxes' => $include_taxes,
|
169 |
);
|
170 |
|
171 |
$args = apply_filters( 'edd_stats_earnings_args', $args );
|
178 |
$earnings = 0;
|
179 |
|
180 |
if( $log_ids ) {
|
181 |
+
$log_ids = implode( ',', array_map('intval', $log_ids ) );
|
182 |
+
$payment_ids = $wpdb->get_col( "SELECT meta_value FROM $wpdb->postmeta WHERE meta_key = '_edd_log_payment_id' AND post_id IN ($log_ids);" );
|
183 |
|
184 |
foreach( $payment_ids as $payment_id ) {
|
185 |
$items = edd_get_payment_meta_cart_details( $payment_id );
|
189 |
|
190 |
$earnings += $item['price'];
|
191 |
}
|
192 |
+
|
193 |
+
if ( ! $include_taxes ) {
|
194 |
+
$earnings -= edd_get_payment_tax( $payment_id );
|
195 |
+
}
|
196 |
}
|
197 |
}
|
198 |
|
229 |
return $downloads;
|
230 |
}
|
231 |
|
232 |
+
}
|
includes/payments/functions.php
CHANGED
@@ -212,7 +212,8 @@ function edd_insert_payment( $payment_data = array() ) {
|
|
212 |
}
|
213 |
|
214 |
if( edd_get_option( 'enable_sequential' ) ) {
|
215 |
-
edd_update_payment_meta( $payment, '_edd_payment_number', $number );
|
|
|
216 |
}
|
217 |
|
218 |
// Clear the user's purchased cache
|
@@ -375,9 +376,6 @@ function edd_delete_purchase( $payment_id = 0, $update_customer = true, $delete_
|
|
375 |
* @return void
|
376 |
*/
|
377 |
function edd_undo_purchase( $download_id, $payment_id ) {
|
378 |
-
if ( edd_is_test_mode() ) {
|
379 |
-
return;
|
380 |
-
}
|
381 |
|
382 |
$cart_details = edd_get_payment_meta_cart_details( $payment_id );
|
383 |
$user_info = edd_get_payment_meta_user_info( $payment_id );
|
@@ -635,7 +633,7 @@ function edd_get_payment_status_keys() {
|
|
635 |
* @param int $hour Hour
|
636 |
* @return int $earnings Earnings
|
637 |
*/
|
638 |
-
function edd_get_earnings_by_date( $day = null, $month_num, $year = null, $hour = null ) {
|
639 |
|
640 |
// This is getting deprecated soon. Use EDD_Payment_Stats with the get_earnings() method instead
|
641 |
|
@@ -648,7 +646,8 @@ function edd_get_earnings_by_date( $day = null, $month_num, $year = null, $hour
|
|
648 |
'monthnum' => $month_num,
|
649 |
'post_status' => array( 'publish', 'revoked' ),
|
650 |
'fields' => 'ids',
|
651 |
-
'update_post_term_cache' => false
|
|
|
652 |
);
|
653 |
if ( ! empty( $day ) )
|
654 |
$args['day'] = $day;
|
@@ -665,7 +664,15 @@ function edd_get_earnings_by_date( $day = null, $month_num, $year = null, $hour
|
|
665 |
$earnings = 0;
|
666 |
if ( $sales ) {
|
667 |
$sales = implode( ',', $sales );
|
668 |
-
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
669 |
|
670 |
}
|
671 |
// Cache the results for one hour
|
@@ -1168,6 +1175,32 @@ function edd_get_payment_number( $payment_id = 0 ) {
|
|
1168 |
return apply_filters( 'edd_payment_number', $number, $payment_id );
|
1169 |
}
|
1170 |
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
1171 |
/**
|
1172 |
* Gets the next available order number
|
1173 |
*
|
@@ -1182,48 +1215,81 @@ function edd_get_next_payment_number() {
|
|
1182 |
return false;
|
1183 |
}
|
1184 |
|
1185 |
-
$
|
1186 |
-
$
|
1187 |
-
$
|
1188 |
|
1189 |
-
|
1190 |
|
1191 |
-
|
1192 |
|
1193 |
-
|
|
|
1194 |
|
1195 |
-
|
1196 |
|
1197 |
-
|
1198 |
|
1199 |
-
|
|
|
|
|
1200 |
|
1201 |
-
|
1202 |
|
1203 |
-
|
1204 |
-
$number = str_replace( $prefix, '', $number );
|
1205 |
-
$number = str_replace( $postfix, '', $number );
|
1206 |
|
1207 |
-
|
1208 |
-
$number = intval( $number );
|
1209 |
|
1210 |
-
|
1211 |
-
$number++;
|
1212 |
|
1213 |
-
|
1214 |
-
$number = $prefix . $number . $postfix;
|
1215 |
|
|
|
|
|
|
|
|
|
1216 |
}
|
1217 |
|
1218 |
-
}
|
1219 |
|
1220 |
-
|
1221 |
|
|
|
|
|
1222 |
}
|
1223 |
|
1224 |
return apply_filters( 'edd_get_next_payment_number', $number );
|
1225 |
}
|
1226 |
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
1227 |
/**
|
1228 |
* Get the fully formatted payment amount. The payment amount is retrieved using
|
1229 |
* edd_get_payment_amount() and is then sent through edd_currency_filter() and
|
@@ -1456,6 +1522,26 @@ function edd_get_purchase_id_by_key( $key ) {
|
|
1456 |
return 0;
|
1457 |
}
|
1458 |
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
1459 |
/**
|
1460 |
* Retrieve all notes attached to a purchase
|
1461 |
*
|
@@ -1586,7 +1672,7 @@ function edd_get_payment_note_html( $note, $payment_id = 0 ) {
|
|
1586 |
* @return void
|
1587 |
*/
|
1588 |
function edd_hide_payment_notes( $query ) {
|
1589 |
-
|
1590 |
|
1591 |
if( version_compare( floatval( $wp_version ), '4.1', '>=' ) ) {
|
1592 |
$types = isset( $query->query_vars['type__not_in'] ) ? $query->query_vars['type__not_in'] : array();
|
@@ -1609,12 +1695,12 @@ add_action( 'pre_get_comments', 'edd_hide_payment_notes', 10 );
|
|
1609 |
* @return array $clauses Updated comment clauses
|
1610 |
*/
|
1611 |
function edd_hide_payment_notes_pre_41( $clauses, $wp_comment_query ) {
|
1612 |
-
|
1613 |
|
1614 |
if( version_compare( floatval( $wp_version ), '4.1', '<' ) ) {
|
1615 |
$clauses['where'] .= ' AND comment_type != "edd_payment_note"';
|
1616 |
}
|
1617 |
-
|
1618 |
}
|
1619 |
add_filter( 'comments_clauses', 'edd_hide_payment_notes_pre_41', 10, 2 );
|
1620 |
|
212 |
}
|
213 |
|
214 |
if( edd_get_option( 'enable_sequential' ) ) {
|
215 |
+
edd_update_payment_meta( $payment, '_edd_payment_number', edd_format_payment_number( $number ) );
|
216 |
+
update_option( 'edd_last_payment_number', $number );
|
217 |
}
|
218 |
|
219 |
// Clear the user's purchased cache
|
376 |
* @return void
|
377 |
*/
|
378 |
function edd_undo_purchase( $download_id, $payment_id ) {
|
|
|
|
|
|
|
379 |
|
380 |
$cart_details = edd_get_payment_meta_cart_details( $payment_id );
|
381 |
$user_info = edd_get_payment_meta_user_info( $payment_id );
|
633 |
* @param int $hour Hour
|
634 |
* @return int $earnings Earnings
|
635 |
*/
|
636 |
+
function edd_get_earnings_by_date( $day = null, $month_num, $year = null, $hour = null, $include_taxes = true ) {
|
637 |
|
638 |
// This is getting deprecated soon. Use EDD_Payment_Stats with the get_earnings() method instead
|
639 |
|
646 |
'monthnum' => $month_num,
|
647 |
'post_status' => array( 'publish', 'revoked' ),
|
648 |
'fields' => 'ids',
|
649 |
+
'update_post_term_cache' => false,
|
650 |
+
'include_taxes' => $include_taxes,
|
651 |
);
|
652 |
if ( ! empty( $day ) )
|
653 |
$args['day'] = $day;
|
664 |
$earnings = 0;
|
665 |
if ( $sales ) {
|
666 |
$sales = implode( ',', $sales );
|
667 |
+
|
668 |
+
if ( $include_taxes ) {
|
669 |
+
$earnings += $wpdb->get_var( "SELECT SUM(meta_value) FROM $wpdb->postmeta WHERE meta_key = '_edd_payment_total' AND post_id IN ({$sales})" );
|
670 |
+
} else {
|
671 |
+
$earnings_with_tax = $wpdb->get_var( "SELECT SUM(meta_value) FROM $wpdb->postmeta WHERE meta_key = '_edd_payment_total' AND post_id IN ({$sales})" );
|
672 |
+
$total_tax = $wpdb->get_var( "SELECT SUM(meta_value) FROM $wpdb->postmeta WHERE meta_key = '_edd_payment_tax' AND post_id IN ({$sales})" );
|
673 |
+
|
674 |
+
$earnings += ( $earnings_with_tax - $total_tax );
|
675 |
+
}
|
676 |
|
677 |
}
|
678 |
// Cache the results for one hour
|
1175 |
return apply_filters( 'edd_payment_number', $number, $payment_id );
|
1176 |
}
|
1177 |
|
1178 |
+
/**
|
1179 |
+
* Formats the payment number with the prefix and postfix
|
1180 |
+
*
|
1181 |
+
* @since 2.4
|
1182 |
+
* @param int $number The payment number to format
|
1183 |
+
* @return string The formatted payment number
|
1184 |
+
*/
|
1185 |
+
function edd_format_payment_number( $number ) {
|
1186 |
+
|
1187 |
+
if( ! edd_get_option( 'enable_sequential' ) ) {
|
1188 |
+
return $number;
|
1189 |
+
}
|
1190 |
+
|
1191 |
+
if ( ! is_numeric( $number ) ) {
|
1192 |
+
return $number;
|
1193 |
+
}
|
1194 |
+
|
1195 |
+
$prefix = edd_get_option( 'sequential_prefix' );
|
1196 |
+
$number = absint( $number );
|
1197 |
+
$postfix = edd_get_option( 'sequential_postfix' );
|
1198 |
+
|
1199 |
+
$formatted_number = $prefix . $number . $postfix;
|
1200 |
+
|
1201 |
+
return apply_filters( 'edd_format_payment_number', $formatted_number, $prefix, $number, $postfix );
|
1202 |
+
}
|
1203 |
+
|
1204 |
/**
|
1205 |
* Gets the next available order number
|
1206 |
*
|
1215 |
return false;
|
1216 |
}
|
1217 |
|
1218 |
+
$number = get_option( 'edd_last_payment_number' );
|
1219 |
+
$start = edd_get_option( 'sequential_start', 1 );
|
1220 |
+
$increment_number = true;
|
1221 |
|
1222 |
+
if ( false !== $number ) {
|
1223 |
|
1224 |
+
if ( empty( $number ) ) {
|
1225 |
|
1226 |
+
$number = $start;
|
1227 |
+
$increment_number = false;
|
1228 |
|
1229 |
+
}
|
1230 |
|
1231 |
+
} else {
|
1232 |
|
1233 |
+
// This case handles the first addition of the new option, as well as if it get's deleted for any reason
|
1234 |
+
$payments = new EDD_Payments_Query( array( 'number' => 1, 'order' => 'DESC', 'orderby' => 'ID', 'output' => 'posts', 'fields' => 'ids' ) );
|
1235 |
+
$last_payment = $payments->get_payments();
|
1236 |
|
1237 |
+
if ( $last_payment ) {
|
1238 |
|
1239 |
+
$number = edd_get_payment_number( $last_payment[0] );
|
|
|
|
|
1240 |
|
1241 |
+
}
|
|
|
1242 |
|
1243 |
+
if( ! empty( $number ) && $number !== $last_payment[0] ) {
|
|
|
1244 |
|
1245 |
+
$number = edd_remove_payment_prefix_postfix( $number );
|
|
|
1246 |
|
1247 |
+
} else {
|
1248 |
+
|
1249 |
+
$number = $start;
|
1250 |
+
$increment_number = false;
|
1251 |
}
|
1252 |
|
1253 |
+
}
|
1254 |
|
1255 |
+
$increment_number = apply_filters( 'edd_increment_payment_number', $increment_number, $number );
|
1256 |
|
1257 |
+
if ( $increment_number ) {
|
1258 |
+
$number++;
|
1259 |
}
|
1260 |
|
1261 |
return apply_filters( 'edd_get_next_payment_number', $number );
|
1262 |
}
|
1263 |
|
1264 |
+
/**
|
1265 |
+
* Given a given a number, remove the pre/postfix
|
1266 |
+
*
|
1267 |
+
* @since 2.4
|
1268 |
+
* @param string $number The formatted Current Number to increment
|
1269 |
+
* @return string The new Payment number without prefix and postfix
|
1270 |
+
*/
|
1271 |
+
function edd_remove_payment_prefix_postfix( $number ) {
|
1272 |
+
|
1273 |
+
$prefix = edd_get_option( 'sequential_prefix' );
|
1274 |
+
$postfix = edd_get_option( 'sequential_postfix' );
|
1275 |
+
|
1276 |
+
// Remove prefix
|
1277 |
+
$number = preg_replace( '/' . $prefix . '/', '', $number, 1 );
|
1278 |
+
|
1279 |
+
// Remove the postfix
|
1280 |
+
$length = strlen( $number );
|
1281 |
+
$postfix_pos = strrpos( $number, $postfix );
|
1282 |
+
if ( false !== $postfix_pos ) {
|
1283 |
+
$number = substr_replace( $number, '', $postfix_pos, $length );
|
1284 |
+
}
|
1285 |
+
|
1286 |
+
// Ensure it's a whole number
|
1287 |
+
$number = intval( $number );
|
1288 |
+
|
1289 |
+
return apply_filters( 'edd_remove_payment_prefix_postfix', $number, $prefix, $postfix );
|
1290 |
+
|
1291 |
+
}
|
1292 |
+
|
1293 |
/**
|
1294 |
* Get the fully formatted payment amount. The payment amount is retrieved using
|
1295 |
* edd_get_payment_amount() and is then sent through edd_currency_filter() and
|
1522 |
return 0;
|
1523 |
}
|
1524 |
|
1525 |
+
/**
|
1526 |
+
* Retrieve the purchase ID based on the transaction ID
|
1527 |
+
*
|
1528 |
+
* @since 2.4
|
1529 |
+
* @global object $wpdb Used to query the database using the WordPress
|
1530 |
+
* Database API
|
1531 |
+
* @param string $key the transaction ID to search for
|
1532 |
+
* @return int $purchase Purchase ID
|
1533 |
+
*/
|
1534 |
+
function edd_get_purchase_id_by_transaction_id( $key ) {
|
1535 |
+
global $wpdb;
|
1536 |
+
|
1537 |
+
$purchase = $wpdb->get_var( $wpdb->prepare( "SELECT post_id FROM $wpdb->postmeta WHERE meta_key = '_edd_payment_transaction_id' AND meta_value = %s LIMIT 1", $key ) );
|
1538 |
+
|
1539 |
+
if ( $purchase != NULL )
|
1540 |
+
return $purchase;
|
1541 |
+
|
1542 |
+
return 0;
|
1543 |
+
}
|
1544 |
+
|
1545 |
/**
|
1546 |
* Retrieve all notes attached to a purchase
|
1547 |
*
|
1672 |
* @return void
|
1673 |
*/
|
1674 |
function edd_hide_payment_notes( $query ) {
|
1675 |
+
global $wp_version;
|
1676 |
|
1677 |
if( version_compare( floatval( $wp_version ), '4.1', '>=' ) ) {
|
1678 |
$types = isset( $query->query_vars['type__not_in'] ) ? $query->query_vars['type__not_in'] : array();
|
1695 |
* @return array $clauses Updated comment clauses
|
1696 |
*/
|
1697 |
function edd_hide_payment_notes_pre_41( $clauses, $wp_comment_query ) {
|
1698 |
+
global $wpdb, $wp_version;
|
1699 |
|
1700 |
if( version_compare( floatval( $wp_version ), '4.1', '<' ) ) {
|
1701 |
$clauses['where'] .= ' AND comment_type != "edd_payment_note"';
|
1702 |
}
|
1703 |
+
return $clauses;
|
1704 |
}
|
1705 |
add_filter( 'comments_clauses', 'edd_hide_payment_notes_pre_41', 10, 2 );
|
1706 |
|
includes/post-types.php
CHANGED
@@ -25,19 +25,19 @@ function edd_setup_edd_post_types() {
|
|
25 |
$rewrite = defined( 'EDD_DISABLE_REWRITE' ) && EDD_DISABLE_REWRITE ? false : array('slug' => $slug, 'with_front' => false);
|
26 |
|
27 |
$download_labels = apply_filters( 'edd_download_labels', array(
|
28 |
-
'name'
|
29 |
-
'singular_name'
|
30 |
-
'add_new'
|
31 |
-
'add_new_item'
|
32 |
-
'edit_item'
|
33 |
-
'new_item'
|
34 |
-
'all_items'
|
35 |
-
'view_item'
|
36 |
-
'search_items'
|
37 |
-
'not_found'
|
38 |
-
'not_found_in_trash'=> __( 'No %2$s found in Trash', 'edd' ),
|
39 |
-
'parent_item_colon'
|
40 |
-
'menu_name'
|
41 |
) );
|
42 |
|
43 |
foreach ( $download_labels as $key => $value ) {
|
@@ -45,79 +45,79 @@ function edd_setup_edd_post_types() {
|
|
45 |
}
|
46 |
|
47 |
$download_args = array(
|
48 |
-
'labels'
|
49 |
-
'public'
|
50 |
-
'publicly_queryable'=> true,
|
51 |
-
'show_ui'
|
52 |
-
'show_in_menu'
|
53 |
-
'query_var'
|
54 |
-
'rewrite'
|
55 |
-
'capability_type'
|
56 |
-
'map_meta_cap'
|
57 |
-
'has_archive'
|
58 |
-
'hierarchical'
|
59 |
-
'supports'
|
60 |
);
|
61 |
register_post_type( 'download', apply_filters( 'edd_download_post_type_args', $download_args ) );
|
62 |
|
63 |
|
64 |
/** Payment Post Type */
|
65 |
$payment_labels = array(
|
66 |
-
'name'
|
67 |
-
'singular_name'
|
68 |
-
'add_new'
|
69 |
-
'add_new_item'
|
70 |
-
'edit_item'
|
71 |
-
'new_item'
|
72 |
-
'all_items'
|
73 |
-
'view_item'
|
74 |
-
'search_items'
|
75 |
-
'not_found'
|
76 |
-
'not_found_in_trash'=> __( 'No Payments found in Trash', 'edd' ),
|
77 |
-
'parent_item_colon'
|
78 |
-
'menu_name'
|
79 |
);
|
80 |
|
81 |
$payment_args = array(
|
82 |
-
'labels'
|
83 |
-
'public'
|
84 |
-
'query_var'
|
85 |
-
'rewrite'
|
86 |
-
'capability_type'
|
87 |
-
'map_meta_cap'
|
88 |
-
'supports'
|
89 |
-
'can_export'
|
90 |
);
|
91 |
register_post_type( 'edd_payment', $payment_args );
|
92 |
|
93 |
|
94 |
/** Discounts Post Type */
|
95 |
$discount_labels = array(
|
96 |
-
'name'
|
97 |
-
'singular_name'
|
98 |
-
'add_new'
|
99 |
-
'add_new_item'
|
100 |
-
'edit_item'
|
101 |
-
'new_item'
|
102 |
-
'all_items'
|
103 |
-
'view_item'
|
104 |
-
'search_items'
|
105 |
-
'not_found'
|
106 |
-
'not_found_in_trash'=> __( 'No Discounts found in Trash', 'edd' ),
|
107 |
-
'parent_item_colon'
|
108 |
-
'menu_name'
|
109 |
);
|
110 |
|
111 |
$discount_args = array(
|
112 |
-
'labels'
|
113 |
-
'public'
|
114 |
-
'query_var'
|
115 |
-
'rewrite'
|
116 |
-
'show_ui'
|
117 |
-
'capability_type'
|
118 |
-
'map_meta_cap'
|
119 |
-
'supports'
|
120 |
-
'can_export'
|
121 |
);
|
122 |
register_post_type( 'edd_discount', $discount_args );
|
123 |
}
|
@@ -169,21 +169,21 @@ function edd_get_label_plural( $lowercase = false ) {
|
|
169 |
* @return string $title New placeholder text
|
170 |
*/
|
171 |
function edd_change_default_title( $title ) {
|
172 |
-
|
173 |
-
|
174 |
-
|
175 |
-
|
176 |
-
|
177 |
-
|
178 |
-
|
179 |
-
|
180 |
-
|
181 |
-
|
182 |
-
|
183 |
-
|
184 |
-
|
185 |
-
|
186 |
-
|
187 |
}
|
188 |
add_filter( 'enter_title_here', 'edd_change_default_title' );
|
189 |
|
@@ -199,26 +199,26 @@ function edd_setup_download_taxonomies() {
|
|
199 |
|
200 |
/** Categories */
|
201 |
$category_labels = array(
|
202 |
-
'name'
|
203 |
-
'singular_name'
|
204 |
-
'search_items'
|
205 |
-
'all_items'
|
206 |
-
'parent_item'
|
207 |
'parent_item_colon' => __( 'Parent Category:', 'edd' ),
|
208 |
-
'edit_item'
|
209 |
-
'update_item'
|
210 |
-
'add_new_item'
|
211 |
-
'new_item_name'
|
212 |
-
'menu_name'
|
213 |
);
|
214 |
|
215 |
$category_args = apply_filters( 'edd_download_category_args', array(
|
216 |
-
'hierarchical'
|
217 |
-
'labels'
|
218 |
-
'show_ui'
|
219 |
-
'query_var'
|
220 |
-
'rewrite'
|
221 |
-
'capabilities'
|
222 |
)
|
223 |
);
|
224 |
register_taxonomy( 'download_category', array('download'), $category_args );
|
@@ -226,28 +226,27 @@ function edd_setup_download_taxonomies() {
|
|
226 |
|
227 |
/** Tags */
|
228 |
$tag_labels = array(
|
229 |
-
'name'
|
230 |
-
'singular_name'
|
231 |
-
'search_items'
|
232 |
-
'all_items'
|
233 |
-
'parent_item'
|
234 |
-
'parent_item_colon'
|
235 |
-
'edit_item'
|
236 |
-
'update_item'
|
237 |
-
'add_new_item'
|
238 |
-
'new_item_name'
|
239 |
-
'menu_name'
|
240 |
'choose_from_most_used' => sprintf( __( 'Choose from most used %s tags', 'edd' ), edd_get_label_singular() ),
|
241 |
);
|
242 |
|
243 |
$tag_args = apply_filters( 'edd_download_tag_args', array(
|
244 |
-
'hierarchical'
|
245 |
-
'labels'
|
246 |
-
'show_ui'
|
247 |
-
'query_var'
|
248 |
-
'rewrite'
|
249 |
-
'capabilities'
|
250 |
-
|
251 |
)
|
252 |
);
|
253 |
register_taxonomy( 'download_tag', array( 'download' ), $tag_args );
|
@@ -255,6 +254,38 @@ function edd_setup_download_taxonomies() {
|
|
255 |
}
|
256 |
add_action( 'init', 'edd_setup_download_taxonomies', 0 );
|
257 |
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
258 |
/**
|
259 |
* Registers Custom Post Statuses which are used by the Payments and Discount
|
260 |
* Codes
|
25 |
$rewrite = defined( 'EDD_DISABLE_REWRITE' ) && EDD_DISABLE_REWRITE ? false : array('slug' => $slug, 'with_front' => false);
|
26 |
|
27 |
$download_labels = apply_filters( 'edd_download_labels', array(
|
28 |
+
'name' => _x( '%2$s', 'download post type name', 'edd' ),
|
29 |
+
'singular_name' => _x( '%1$s', 'singular download post type name', 'edd' ),
|
30 |
+
'add_new' => __( 'Add New', 'edd' ),
|
31 |
+
'add_new_item' => __( 'Add New %1$s', 'edd' ),
|
32 |
+
'edit_item' => __( 'Edit %1$s', 'edd' ),
|
33 |
+
'new_item' => __( 'New %1$s', 'edd' ),
|
34 |
+
'all_items' => __( 'All %2$s', 'edd' ),
|
35 |
+
'view_item' => __( 'View %1$s', 'edd' ),
|
36 |
+
'search_items' => __( 'Search %2$s', 'edd' ),
|
37 |
+
'not_found' => __( 'No %2$s found', 'edd' ),
|
38 |
+
'not_found_in_trash' => __( 'No %2$s found in Trash', 'edd' ),
|
39 |
+
'parent_item_colon' => '',
|
40 |
+
'menu_name' => _x( '%2$s', 'download post type menu name', 'edd' )
|
41 |
) );
|
42 |
|
43 |
foreach ( $download_labels as $key => $value ) {
|
45 |
}
|
46 |
|
47 |
$download_args = array(
|
48 |
+
'labels' => $download_labels,
|
49 |
+
'public' => true,
|
50 |
+
'publicly_queryable' => true,
|
51 |
+
'show_ui' => true,
|
52 |
+
'show_in_menu' => true,
|
53 |
+
'query_var' => true,
|
54 |
+
'rewrite' => $rewrite,
|
55 |
+
'capability_type' => 'product',
|
56 |
+
'map_meta_cap' => true,
|
57 |
+
'has_archive' => $archives,
|
58 |
+
'hierarchical' => false,
|
59 |
+
'supports' => apply_filters( 'edd_download_supports', array( 'title', 'editor', 'thumbnail', 'excerpt', 'revisions', 'author' ) ),
|
60 |
);
|
61 |
register_post_type( 'download', apply_filters( 'edd_download_post_type_args', $download_args ) );
|
62 |
|
63 |
|
64 |
/** Payment Post Type */
|
65 |
$payment_labels = array(
|
66 |
+
'name' => _x( 'Payments', 'post type general name', 'edd' ),
|
67 |
+
'singular_name' => _x( 'Payment', 'post type singular name', 'edd' ),
|
68 |
+
'add_new' => __( 'Add New', 'edd' ),
|
69 |
+
'add_new_item' => __( 'Add New Payment', 'edd' ),
|
70 |
+
'edit_item' => __( 'Edit Payment', 'edd' ),
|
71 |
+
'new_item' => __( 'New Payment', 'edd' ),
|
72 |
+
'all_items' => __( 'All Payments', 'edd' ),
|
73 |
+
'view_item' => __( 'View Payment', 'edd' ),
|
74 |
+
'search_items' => __( 'Search Payments', 'edd' ),
|
75 |
+
'not_found' => __( 'No Payments found', 'edd' ),
|
76 |
+
'not_found_in_trash' => __( 'No Payments found in Trash', 'edd' ),
|
77 |
+
'parent_item_colon' => '',
|
78 |
+
'menu_name' => __( 'Payment History', 'edd' )
|
79 |
);
|
80 |
|
81 |
$payment_args = array(
|
82 |
+
'labels' => apply_filters( 'edd_payment_labels', $payment_labels ),
|
83 |
+
'public' => false,
|
84 |
+
'query_var' => false,
|
85 |
+
'rewrite' => false,
|
86 |
+
'capability_type' => 'shop_payment',
|
87 |
+
'map_meta_cap' => true,
|
88 |
+
'supports' => array( 'title' ),
|
89 |
+
'can_export' => true
|
90 |
);
|
91 |
register_post_type( 'edd_payment', $payment_args );
|
92 |
|
93 |
|
94 |
/** Discounts Post Type */
|
95 |
$discount_labels = array(
|
96 |
+
'name' => _x( 'Discounts', 'post type general name', 'edd' ),
|
97 |
+
'singular_name' => _x( 'Discount', 'post type singular name', 'edd' ),
|
98 |
+
'add_new' => __( 'Add New', 'edd' ),
|
99 |
+
'add_new_item' => __( 'Add New Discount', 'edd' ),
|
100 |
+
'edit_item' => __( 'Edit Discount', 'edd' ),
|
101 |
+
'new_item' => __( 'New Discount', 'edd' ),
|
102 |
+
'all_items' => __( 'All Discounts', 'edd' ),
|
103 |
+
'view_item' => __( 'View Discount', 'edd' ),
|
104 |
+
'search_items' => __( 'Search Discounts', 'edd' ),
|
105 |
+
'not_found' => __( 'No Discounts found', 'edd' ),
|
106 |
+
'not_found_in_trash' => __( 'No Discounts found in Trash', 'edd' ),
|
107 |
+
'parent_item_colon' => '',
|
108 |
+
'menu_name' => __( 'Discounts', 'edd' )
|
109 |
);
|
110 |
|
111 |
$discount_args = array(
|
112 |
+
'labels' => apply_filters( 'edd_discount_labels', $discount_labels ),
|
113 |
+
'public' => false,
|
114 |
+
'query_var' => false,
|
115 |
+
'rewrite' => false,
|
116 |
+
'show_ui' => false,
|
117 |
+
'capability_type' => 'shop_discount',
|
118 |
+
'map_meta_cap' => true,
|
119 |
+
'supports' => array( 'title' ),
|
120 |
+
'can_export' => true
|
121 |
);
|
122 |
register_post_type( 'edd_discount', $discount_args );
|
123 |
}
|
169 |
* @return string $title New placeholder text
|
170 |
*/
|
171 |
function edd_change_default_title( $title ) {
|
172 |
+
// If a frontend plugin uses this filter (check extensions before changing this function)
|
173 |
+
if ( !is_admin() ) {
|
174 |
+
$label = edd_get_label_singular();
|
175 |
+
$title = sprintf( __( 'Enter %s name here', 'edd' ), $label );
|
176 |
+
return $title;
|
177 |
+
}
|
178 |
+
|
179 |
+
$screen = get_current_screen();
|
180 |
+
|
181 |
+
if ( 'download' == $screen->post_type ) {
|
182 |
+
$label = edd_get_label_singular();
|
183 |
+
$title = sprintf( __( 'Enter %s name here', 'edd' ), $label );
|
184 |
+
}
|
185 |
+
|
186 |
+
return $title;
|
187 |
}
|
188 |
add_filter( 'enter_title_here', 'edd_change_default_title' );
|
189 |
|
199 |
|
200 |
/** Categories */
|
201 |
$category_labels = array(
|
202 |
+
'name' => _x( 'Categories', 'taxonomy general name', 'edd' ),
|
203 |
+
'singular_name' => _x( 'Category', 'taxonomy singular name', 'edd' ),
|
204 |
+
'search_items' => __( 'Search Categories', 'edd' ),
|
205 |
+
'all_items' => __( 'All Categories', 'edd' ),
|
206 |
+
'parent_item' => __( 'Parent Category', 'edd' ),
|
207 |
'parent_item_colon' => __( 'Parent Category:', 'edd' ),
|
208 |
+
'edit_item' => __( 'Edit Category', 'edd' ),
|
209 |
+
'update_item' => __( 'Update Category', 'edd' ),
|
210 |
+
'add_new_item' => sprintf( __( 'Add New %s Category', 'edd' ), edd_get_label_singular() ),
|
211 |
+
'new_item_name' => __( 'New Category Name', 'edd' ),
|
212 |
+
'menu_name' => __( 'Categories', 'edd' ),
|
213 |
);
|
214 |
|
215 |
$category_args = apply_filters( 'edd_download_category_args', array(
|
216 |
+
'hierarchical' => true,
|
217 |
+
'labels' => apply_filters('edd_download_category_labels', $category_labels),
|
218 |
+
'show_ui' => true,
|
219 |
+
'query_var' => 'download_category',
|
220 |
+
'rewrite' => array('slug' => $slug . '/category', 'with_front' => false, 'hierarchical' => true ),
|
221 |
+
'capabilities' => array( 'manage_terms' => 'manage_product_terms','edit_terms' => 'edit_product_terms','assign_terms' => 'assign_product_terms','delete_terms' => 'delete_product_terms' )
|
222 |
)
|
223 |
);
|
224 |
register_taxonomy( 'download_category', array('download'), $category_args );
|
226 |
|
227 |
/** Tags */
|
228 |
$tag_labels = array(
|
229 |
+
'name' => _x( 'Tags', 'taxonomy general name', 'edd' ),
|
230 |
+
'singular_name' => _x( 'Tag', 'taxonomy singular name', 'edd' ),
|
231 |
+
'search_items' => __( 'Search Tags', 'edd' ),
|
232 |
+
'all_items' => __( 'All Tags', 'edd' ),
|
233 |
+
'parent_item' => __( 'Parent Tag', 'edd' ),
|
234 |
+
'parent_item_colon' => __( 'Parent Tag:', 'edd' ),
|
235 |
+
'edit_item' => __( 'Edit Tag', 'edd' ),
|
236 |
+
'update_item' => __( 'Update Tag', 'edd' ),
|
237 |
+
'add_new_item' => __( 'Add New Tag', 'edd' ),
|
238 |
+
'new_item_name' => __( 'New Tag Name', 'edd' ),
|
239 |
+
'menu_name' => __( 'Tags', 'edd' ),
|
240 |
'choose_from_most_used' => sprintf( __( 'Choose from most used %s tags', 'edd' ), edd_get_label_singular() ),
|
241 |
);
|
242 |
|
243 |
$tag_args = apply_filters( 'edd_download_tag_args', array(
|
244 |
+
'hierarchical' => false,
|
245 |
+
'labels' => apply_filters( 'edd_download_tag_labels', $tag_labels ),
|
246 |
+
'show_ui' => true,
|
247 |
+
'query_var' => 'download_tag',
|
248 |
+
'rewrite' => array( 'slug' => $slug . '/tag', 'with_front' => false, 'hierarchical' => true ),
|
249 |
+
'capabilities' => array( 'manage_terms' => 'manage_product_terms','edit_terms' => 'edit_product_terms','assign_terms' => 'assign_product_terms','delete_terms' => 'delete_product_terms' )
|
|
|
250 |
)
|
251 |
);
|
252 |
register_taxonomy( 'download_tag', array( 'download' ), $tag_args );
|
254 |
}
|
255 |
add_action( 'init', 'edd_setup_download_taxonomies', 0 );
|
256 |
|
257 |
+
/**
|
258 |
+
* Get the singular and plural labels for a download taxonomy
|
259 |
+
*
|
260 |
+
* @since 2.4
|
261 |
+
* @param string $taxonomy The Taxonomy to get labels for
|
262 |
+
* @return array Associative array of labels (name = plural)
|
263 |
+
*/
|
264 |
+
function edd_get_taxonomy_labels( $taxonomy = 'download_category' ) {
|
265 |
+
|
266 |
+
$allowed_taxonomies = apply_filters( 'edd_allowed_download_taxonomies', array( 'download_category', 'download_tag' ) );
|
267 |
+
|
268 |
+
if ( ! in_array( $taxonomy, $allowed_taxonomies ) ) {
|
269 |
+
return false;
|
270 |
+
}
|
271 |
+
|
272 |
+
$labels = array();
|
273 |
+
$taxonomy = get_taxonomy( $taxonomy );
|
274 |
+
|
275 |
+
if ( false !== $taxonomy ) {
|
276 |
+
$singular = $taxonomy->labels->singular_name;
|
277 |
+
$name = $taxonomy->labels->name;
|
278 |
+
|
279 |
+
$labels = array(
|
280 |
+
'name' => $name,
|
281 |
+
'singular_name' => $singular,
|
282 |
+
);
|
283 |
+
}
|
284 |
+
|
285 |
+
return apply_filters( 'edd_get_taxonomy_labels', $labels, $taxonomy );
|
286 |
+
|
287 |
+
}
|
288 |
+
|
289 |
/**
|
290 |
* Registers Custom Post Statuses which are used by the Payments and Discount
|
291 |
* Codes
|
includes/process-purchase.php
CHANGED
@@ -23,9 +23,11 @@ if ( ! defined( 'ABSPATH' ) ) exit;
|
|
23 |
*/
|
24 |
function edd_process_purchase_form() {
|
25 |
|
|
|
|
|
26 |
// Make sure the cart isn't empty
|
27 |
if ( ! edd_get_cart_contents() && ! edd_cart_has_fees() ) {
|
28 |
-
$valid_data =
|
29 |
edd_set_error( 'empty_cart', __( 'Your cart is empty', 'edd' ) );
|
30 |
} else {
|
31 |
// Validate the form $_POST data
|
@@ -45,7 +47,7 @@ function edd_process_purchase_form() {
|
|
45 |
// Validate the user
|
46 |
$user = edd_get_purchase_form_user( $valid_data );
|
47 |
|
48 |
-
if ( edd_get_errors() || ! $user ) {
|
49 |
if ( $is_ajax ) {
|
50 |
do_action( 'edd_ajax_checkout_errors' );
|
51 |
edd_die();
|
@@ -689,34 +691,33 @@ function edd_get_purchase_form_user( $valid_data = array() ) {
|
|
689 |
// Do not create or login the user during the ajax submission (check for errors only)
|
690 |
return true;
|
691 |
} else if ( is_user_logged_in() ) {
|
692 |
-
|
693 |
-
|
694 |
-
|
695 |
-
|
696 |
-
|
697 |
-
|
698 |
-
|
699 |
-
|
700 |
-
|
701 |
-
|
702 |
-
|
703 |
-
|
704 |
-
|
705 |
-
|
706 |
-
|
707 |
-
|
708 |
-
|
709 |
-
|
710 |
-
|
711 |
-
|
712 |
-
|
713 |
-
|
714 |
-
|
715 |
-
|
716 |
-
|
717 |
-
edd_log_user_in( $user['user_id'], $user['user_login'], $user['user_pass'] );
|
718 |
-
}
|
719 |
}
|
|
|
720 |
|
721 |
// Check guest checkout
|
722 |
if ( false === $user && false === edd_no_guest_checkout() ) {
|
@@ -1049,14 +1050,16 @@ add_action( 'edd_checkout_error_checks', 'edd_check_purchase_email', 10, 2 );
|
|
1049 |
* @return void
|
1050 |
*/
|
1051 |
function edd_process_straight_to_gateway( $data ) {
|
1052 |
-
|
1053 |
-
$
|
|
|
|
|
1054 |
|
1055 |
if( empty( $download_id ) || ! edd_get_download( $download_id ) ) {
|
1056 |
return;
|
1057 |
}
|
1058 |
|
1059 |
-
$purchase_data = edd_build_straight_to_gateway_data( $download_id, $options );
|
1060 |
edd_set_purchase_session( $purchase_data );
|
1061 |
edd_send_to_gateway( $purchase_data['gateway'], $purchase_data );
|
1062 |
}
|
23 |
*/
|
24 |
function edd_process_purchase_form() {
|
25 |
|
26 |
+
do_action( 'edd_pre_process_purchase' );
|
27 |
+
|
28 |
// Make sure the cart isn't empty
|
29 |
if ( ! edd_get_cart_contents() && ! edd_cart_has_fees() ) {
|
30 |
+
$valid_data = false;
|
31 |
edd_set_error( 'empty_cart', __( 'Your cart is empty', 'edd' ) );
|
32 |
} else {
|
33 |
// Validate the form $_POST data
|
47 |
// Validate the user
|
48 |
$user = edd_get_purchase_form_user( $valid_data );
|
49 |
|
50 |
+
if ( false === $valid_data || edd_get_errors() || ! $user ) {
|
51 |
if ( $is_ajax ) {
|
52 |
do_action( 'edd_ajax_checkout_errors' );
|
53 |
edd_die();
|
691 |
// Do not create or login the user during the ajax submission (check for errors only)
|
692 |
return true;
|
693 |
} else if ( is_user_logged_in() ) {
|
694 |
+
// Set the valid user as the logged in collected data
|
695 |
+
$user = $valid_data['logged_in_user'];
|
696 |
+
} else if ( $valid_data['need_new_user'] === true || $valid_data['need_user_login'] === true ) {
|
697 |
+
// New user registration
|
698 |
+
if ( $valid_data['need_new_user'] === true ) {
|
699 |
+
// Set user
|
700 |
+
$user = $valid_data['new_user_data'];
|
701 |
+
// Register and login new user
|
702 |
+
$user['user_id'] = edd_register_and_login_new_user( $user );
|
703 |
+
// User login
|
704 |
+
} else if ( $valid_data['need_user_login'] === true && ! $is_ajax ) {
|
705 |
+
/*
|
706 |
+
* The login form is now processed in the edd_process_purchase_login() function.
|
707 |
+
* This is still here for backwards compatibility.
|
708 |
+
* This also allows the old login process to still work if a user removes the
|
709 |
+
* checkout login submit button.
|
710 |
+
*
|
711 |
+
* This also ensures that the customer is logged in correctly if they click "Purchase"
|
712 |
+
* instead of submitting the login form, meaning the customer is logged in during the purchase process.
|
713 |
+
*/
|
714 |
+
|
715 |
+
// Set user
|
716 |
+
$user = $valid_data['login_user_data'];
|
717 |
+
// Login user
|
718 |
+
edd_log_user_in( $user['user_id'], $user['user_login'], $user['user_pass'] );
|
|
|
|
|
719 |
}
|
720 |
+
}
|
721 |
|
722 |
// Check guest checkout
|
723 |
if ( false === $user && false === edd_no_guest_checkout() ) {
|
1050 |
* @return void
|
1051 |
*/
|
1052 |
function edd_process_straight_to_gateway( $data ) {
|
1053 |
+
|
1054 |
+
$download_id = $data['download_id'];
|
1055 |
+
$options = isset( $data['edd_options'] ) ? $data['edd_options'] : array();
|
1056 |
+
$quantity = isset( $data['edd_download_quantity'] ) ? $data['edd_download_quantity'] : 1;
|
1057 |
|
1058 |
if( empty( $download_id ) || ! edd_get_download( $download_id ) ) {
|
1059 |
return;
|
1060 |
}
|
1061 |
|
1062 |
+
$purchase_data = edd_build_straight_to_gateway_data( $download_id, $options, $quantity );
|
1063 |
edd_set_purchase_session( $purchase_data );
|
1064 |
edd_send_to_gateway( $purchase_data['gateway'], $purchase_data );
|
1065 |
}
|
includes/scripts.php
CHANGED
@@ -36,9 +36,13 @@ function edd_load_scripts() {
|
|
36 |
|
37 |
if ( edd_is_checkout() ) {
|
38 |
if ( edd_is_cc_verify_enabled() ) {
|
39 |
-
|
|
|
40 |
}
|
41 |
-
|
|
|
|
|
|
|
42 |
wp_localize_script( 'edd-checkout-global', 'edd_global_vars', apply_filters( 'edd_global_checkout_script_vars', array(
|
43 |
'ajaxurl' => edd_get_ajax_url(),
|
44 |
'checkout_nonce' => wp_create_nonce( 'edd_checkout_nonce' ),
|
@@ -59,7 +63,9 @@ function edd_load_scripts() {
|
|
59 |
|
60 |
// Load AJAX scripts, if enabled
|
61 |
if ( ! edd_is_ajax_disabled() ) {
|
62 |
-
|
|
|
|
|
63 |
wp_localize_script( 'edd-ajax', 'edd_scripts', apply_filters( 'edd_ajax_script_vars', array(
|
64 |
'ajaxurl' => edd_get_ajax_url(),
|
65 |
'position_in_cart' => isset( $position ) ? $position : -1,
|
@@ -73,7 +79,8 @@ function edd_load_scripts() {
|
|
73 |
'redirect_to_checkout' => ( edd_straight_to_checkout() || edd_is_checkout() ) ? '1' : '0',
|
74 |
'checkout_page' => edd_get_checkout_uri(),
|
75 |
'permalinks' => get_option( 'permalink_structure' ) ? '1' : '0',
|
76 |
-
'quantities_enabled' => edd_item_quantities_enabled()
|
|
|
77 |
) ) );
|
78 |
}
|
79 |
}
|
@@ -123,7 +130,8 @@ function edd_register_styles() {
|
|
123 |
$url = trailingslashit( edd_get_templates_url() ) . $file;
|
124 |
}
|
125 |
|
126 |
-
|
|
|
127 |
|
128 |
if( edd_is_checkout() && is_ssl() ) {
|
129 |
// Dashicons are used to show the padlock icon on the credit card form
|
@@ -157,14 +165,20 @@ function edd_load_admin_scripts( $hook ) {
|
|
157 |
$suffix = ( defined( 'SCRIPT_DEBUG' ) && SCRIPT_DEBUG ) ? '' : '.min';
|
158 |
|
159 |
// These have to be global
|
160 |
-
|
161 |
-
|
162 |
-
|
|
|
|
|
|
|
|
|
|
|
|
|
163 |
wp_localize_script( 'edd-admin-scripts', 'edd_vars', array(
|
164 |
'post_id' => isset( $post->ID ) ? $post->ID : null,
|
165 |
'edd_version' => EDD_VERSION,
|
166 |
-
'add_new_download' => __( 'Add New Download', 'edd' ),
|
167 |
-
'use_this_file' => __( 'Use This File','edd' ),
|
168 |
'quick_edit_warning' => __( 'Sorry, not available for variable priced products.', 'edd' ),
|
169 |
'delete_payment' => __( 'Are you sure you wish to delete this payment?', 'edd' ),
|
170 |
'delete_payment_note' => __( 'Are you sure you wish to delete this note?', 'edd' ),
|
@@ -176,10 +190,12 @@ function edd_load_admin_scripts( $hook ) {
|
|
176 |
'delete_payment_download' => sprintf( __( 'Are you sure you wish to delete this %s?', 'edd' ), edd_get_label_singular() ),
|
177 |
'one_price_min' => __( 'You must have at least one price', 'edd' ),
|
178 |
'one_field_min' => __( 'You must have at least one field', 'edd' ),
|
|
|
179 |
'one_option' => sprintf( __( 'Choose a %s', 'edd' ), edd_get_label_singular() ),
|
180 |
'one_or_more_option' => sprintf( __( 'Choose one or more %s', 'edd' ), edd_get_label_plural() ),
|
181 |
'numeric_item_price' => __( 'Item price must be numeric', 'edd' ),
|
182 |
'numeric_quantity' => __( 'Quantity must be numeric', 'edd' ),
|
|
|
183 |
'currency_sign' => edd_currency_filter(''),
|
184 |
'currency_pos' => edd_get_option( 'currency_position', 'before' ),
|
185 |
'currency_decimals' => edd_currency_decimal_filter(),
|
@@ -191,21 +207,34 @@ function edd_load_admin_scripts( $hook ) {
|
|
191 |
|
192 |
wp_enqueue_style( 'wp-color-picker' );
|
193 |
wp_enqueue_script( 'wp-color-picker' );
|
194 |
-
|
195 |
-
|
|
|
|
|
|
|
|
|
|
|
196 |
if( function_exists( 'wp_enqueue_media' ) && version_compare( $wp_version, '3.5', '>=' ) ) {
|
197 |
//call for new media manager
|
198 |
wp_enqueue_media();
|
199 |
}
|
200 |
-
|
|
|
|
|
|
|
201 |
wp_enqueue_script( 'jquery-ui-datepicker' );
|
202 |
wp_enqueue_script( 'jquery-ui-dialog' );
|
|
|
203 |
$ui_style = ( 'classic' == get_user_option( 'admin_color' ) ) ? 'classic' : 'fresh';
|
204 |
-
|
|
|
|
|
205 |
wp_enqueue_script( 'media-upload' );
|
206 |
wp_enqueue_script( 'thickbox' );
|
207 |
wp_enqueue_style( 'thickbox' );
|
208 |
-
|
|
|
|
|
209 |
}
|
210 |
add_action( 'admin_enqueue_scripts', 'edd_load_admin_scripts', 100 );
|
211 |
|
@@ -222,29 +251,29 @@ add_action( 'admin_enqueue_scripts', 'edd_load_admin_scripts', 100 );
|
|
222 |
function edd_admin_downloads_icon() {
|
223 |
global $post_type, $wp_version;
|
224 |
|
225 |
-
|
226 |
-
|
227 |
$icon_url = $images_url . 'edd-icon.png';
|
228 |
$icon_cpt_url = $images_url . 'edd-cpt.png';
|
229 |
$icon_2x_url = $images_url . 'edd-icon-2x.png';
|
230 |
$icon_cpt_2x_url = $images_url . 'edd-cpt-2x.png';
|
231 |
?>
|
232 |
-
|
233 |
-
|
234 |
-
|
235 |
-
|
236 |
-
|
237 |
-
|
238 |
-
|
239 |
-
|
240 |
-
|
241 |
-
|
242 |
-
|
243 |
-
|
244 |
-
|
245 |
-
|
246 |
-
|
247 |
-
|
248 |
#icon-edit.icon32-posts-download {
|
249 |
background: url(<?php echo $icon_cpt_url; ?>) -7px -5px no-repeat;
|
250 |
}
|
@@ -258,17 +287,17 @@ function edd_admin_downloads_icon() {
|
|
258 |
only screen and ( -o-min-device-pixel-ratio: 3/2),
|
259 |
only screen and ( min-device-pixel-ratio: 1.5),
|
260 |
only screen and ( min-resolution: 1.5dppx) {
|
261 |
-
|
262 |
-
|
263 |
-
|
264 |
-
|
265 |
-
|
266 |
-
|
267 |
-
|
268 |
-
|
269 |
-
|
270 |
-
|
271 |
-
|
272 |
#icon-edit.icon32-posts-download {
|
273 |
background: url(<?php echo $icon_cpt_2x_url; ?>) no-repeat -7px -5px !important;
|
274 |
background-size: 55px 45px !important;
|
36 |
|
37 |
if ( edd_is_checkout() ) {
|
38 |
if ( edd_is_cc_verify_enabled() ) {
|
39 |
+
wp_register_script( 'creditCardValidator', $js_dir . 'jquery.creditCardValidator' . $suffix . '.js', array( 'jquery' ), EDD_VERSION );
|
40 |
+
wp_enqueue_script( 'creditCardValidator' );
|
41 |
}
|
42 |
+
|
43 |
+
wp_register_script( 'edd-checkout-global', $js_dir . 'edd-checkout-global' . $suffix . '.js', array( 'jquery' ), EDD_VERSION );
|
44 |
+
wp_enqueue_script( 'edd-checkout-global' );
|
45 |
+
|
46 |
wp_localize_script( 'edd-checkout-global', 'edd_global_vars', apply_filters( 'edd_global_checkout_script_vars', array(
|
47 |
'ajaxurl' => edd_get_ajax_url(),
|
48 |
'checkout_nonce' => wp_create_nonce( 'edd_checkout_nonce' ),
|
63 |
|
64 |
// Load AJAX scripts, if enabled
|
65 |
if ( ! edd_is_ajax_disabled() ) {
|
66 |
+
wp_register_script( 'edd-ajax', $js_dir . 'edd-ajax' . $suffix . '.js', array( 'jquery' ), EDD_VERSION );
|
67 |
+
wp_enqueue_script( 'edd-ajax' );
|
68 |
+
|
69 |
wp_localize_script( 'edd-ajax', 'edd_scripts', apply_filters( 'edd_ajax_script_vars', array(
|
70 |
'ajaxurl' => edd_get_ajax_url(),
|
71 |
'position_in_cart' => isset( $position ) ? $position : -1,
|
79 |
'redirect_to_checkout' => ( edd_straight_to_checkout() || edd_is_checkout() ) ? '1' : '0',
|
80 |
'checkout_page' => edd_get_checkout_uri(),
|
81 |
'permalinks' => get_option( 'permalink_structure' ) ? '1' : '0',
|
82 |
+
'quantities_enabled' => edd_item_quantities_enabled(),
|
83 |
+
'taxes_enabled' => edd_use_taxes() ? '1' : '0', // Adding here for widget, but leaving in checkout vars for backcompat
|
84 |
) ) );
|
85 |
}
|
86 |
}
|
130 |
$url = trailingslashit( edd_get_templates_url() ) . $file;
|
131 |
}
|
132 |
|
133 |
+
wp_register_style( 'edd-styles', $url, array(), EDD_VERSION, 'all' );
|
134 |
+
wp_enqueue_style( 'edd-styles' );
|
135 |
|
136 |
if( edd_is_checkout() && is_ssl() ) {
|
137 |
// Dashicons are used to show the padlock icon on the credit card form
|
165 |
$suffix = ( defined( 'SCRIPT_DEBUG' ) && SCRIPT_DEBUG ) ? '' : '.min';
|
166 |
|
167 |
// These have to be global
|
168 |
+
wp_register_style( 'jquery-chosen', $css_dir . 'chosen' . $suffix . '.css', array(), EDD_VERSION );
|
169 |
+
wp_enqueue_style( 'jquery-chosen' );
|
170 |
+
|
171 |
+
wp_register_script( 'jquery-chosen', $js_dir . 'chosen.jquery' . $suffix . '.js', array( 'jquery' ), EDD_VERSION );
|
172 |
+
wp_enqueue_script( 'jquery-chosen' );
|
173 |
+
|
174 |
+
wp_register_script( 'edd-admin-scripts', $js_dir . 'admin-scripts' . $suffix . '.js', array( 'jquery' ), EDD_VERSION, false );
|
175 |
+
wp_enqueue_script( 'edd-admin-scripts' );
|
176 |
+
|
177 |
wp_localize_script( 'edd-admin-scripts', 'edd_vars', array(
|
178 |
'post_id' => isset( $post->ID ) ? $post->ID : null,
|
179 |
'edd_version' => EDD_VERSION,
|
180 |
+
'add_new_download' => __( 'Add New Download', 'edd' ),
|
181 |
+
'use_this_file' => __( 'Use This File','edd' ),
|
182 |
'quick_edit_warning' => __( 'Sorry, not available for variable priced products.', 'edd' ),
|
183 |
'delete_payment' => __( 'Are you sure you wish to delete this payment?', 'edd' ),
|
184 |
'delete_payment_note' => __( 'Are you sure you wish to delete this note?', 'edd' ),
|
190 |
'delete_payment_download' => sprintf( __( 'Are you sure you wish to delete this %s?', 'edd' ), edd_get_label_singular() ),
|
191 |
'one_price_min' => __( 'You must have at least one price', 'edd' ),
|
192 |
'one_field_min' => __( 'You must have at least one field', 'edd' ),
|
193 |
+
'one_download_min' => __( 'Payments must contain at least one item', 'edd' ),
|
194 |
'one_option' => sprintf( __( 'Choose a %s', 'edd' ), edd_get_label_singular() ),
|
195 |
'one_or_more_option' => sprintf( __( 'Choose one or more %s', 'edd' ), edd_get_label_plural() ),
|
196 |
'numeric_item_price' => __( 'Item price must be numeric', 'edd' ),
|
197 |
'numeric_quantity' => __( 'Quantity must be numeric', 'edd' ),
|
198 |
+
'currency' => edd_get_currency(),
|
199 |
'currency_sign' => edd_currency_filter(''),
|
200 |
'currency_pos' => edd_get_option( 'currency_position', 'before' ),
|
201 |
'currency_decimals' => edd_currency_decimal_filter(),
|
207 |
|
208 |
wp_enqueue_style( 'wp-color-picker' );
|
209 |
wp_enqueue_script( 'wp-color-picker' );
|
210 |
+
|
211 |
+
wp_register_style( 'colorbox', $css_dir . 'colorbox' . $suffix . '.css', array(), '1.3.20' );
|
212 |
+
wp_enqueue_style( 'colorbox' );
|
213 |
+
|
214 |
+
wp_register_script( 'colorbox', $js_dir . 'jquery.colorbox-min.js', array( 'jquery' ), '1.3.20' );
|
215 |
+
wp_enqueue_script( 'colorbox' );
|
216 |
+
|
217 |
if( function_exists( 'wp_enqueue_media' ) && version_compare( $wp_version, '3.5', '>=' ) ) {
|
218 |
//call for new media manager
|
219 |
wp_enqueue_media();
|
220 |
}
|
221 |
+
|
222 |
+
wp_register_script( 'jquery-flot', $js_dir . 'jquery.flot' . $suffix . '.js' );
|
223 |
+
wp_enqueue_script( 'jquery-flot' );
|
224 |
+
|
225 |
wp_enqueue_script( 'jquery-ui-datepicker' );
|
226 |
wp_enqueue_script( 'jquery-ui-dialog' );
|
227 |
+
|
228 |
$ui_style = ( 'classic' == get_user_option( 'admin_color' ) ) ? 'classic' : 'fresh';
|
229 |
+
wp_register_style( 'jquery-ui-css', $css_dir . 'jquery-ui-' . $ui_style . $suffix . '.css' );
|
230 |
+
wp_enqueue_style( 'jquery-ui-css' );
|
231 |
+
|
232 |
wp_enqueue_script( 'media-upload' );
|
233 |
wp_enqueue_script( 'thickbox' );
|
234 |
wp_enqueue_style( 'thickbox' );
|
235 |
+
|
236 |
+
wp_register_style( 'edd-admin', $css_dir . 'edd-admin' . $suffix . '.css', EDD_VERSION );
|
237 |
+
wp_enqueue_style( 'edd-admin' );
|
238 |
}
|
239 |
add_action( 'admin_enqueue_scripts', 'edd_load_admin_scripts', 100 );
|
240 |
|
251 |
function edd_admin_downloads_icon() {
|
252 |
global $post_type, $wp_version;
|
253 |
|
254 |
+
$images_url = EDD_PLUGIN_URL . 'assets/images/';
|
255 |
+
$menu_icon = '\f316';
|
256 |
$icon_url = $images_url . 'edd-icon.png';
|
257 |
$icon_cpt_url = $images_url . 'edd-cpt.png';
|
258 |
$icon_2x_url = $images_url . 'edd-icon-2x.png';
|
259 |
$icon_cpt_2x_url = $images_url . 'edd-cpt-2x.png';
|
260 |
?>
|
261 |
+
<style type="text/css" media="screen">
|
262 |
+
<?php if( version_compare( $wp_version, '3.8-RC', '>=' ) || version_compare( $wp_version, '3.8', '>=' ) ) { ?>
|
263 |
+
#adminmenu #menu-posts-download .wp-menu-image:before,
|
264 |
+
#dashboard_right_now .download-count:before {
|
265 |
+
content: '<?php echo $menu_icon; ?>';
|
266 |
+
}
|
267 |
+
<?php } else { ?>
|
268 |
+
/** Fallback for outdated WP installations */
|
269 |
+
#adminmenu #menu-posts-download div.wp-menu-image {
|
270 |
+
background: url(<?php echo $icon_url; ?>) no-repeat 7px -17px;
|
271 |
+
}
|
272 |
+
#adminmenu #menu-posts-download:hover div.wp-menu-image,
|
273 |
+
#adminmenu #menu-posts-download.wp-has-current-submenu div.wp-menu-image {
|
274 |
+
background-position: 7px 6px;
|
275 |
+
}
|
276 |
+
<?php } ?>
|
277 |
#icon-edit.icon32-posts-download {
|
278 |
background: url(<?php echo $icon_cpt_url; ?>) -7px -5px no-repeat;
|
279 |
}
|
287 |
only screen and ( -o-min-device-pixel-ratio: 3/2),
|
288 |
only screen and ( min-device-pixel-ratio: 1.5),
|
289 |
only screen and ( min-resolution: 1.5dppx) {
|
290 |
+
<?php if( version_compare( $wp_version, '3.7', '<=' ) ) { ?>
|
291 |
+
#adminmenu #menu-posts-download div.wp-menu-image {
|
292 |
+
background-image: url(<?php echo $icon_2x_url; ?>);
|
293 |
+
background-position: 7px -18px;
|
294 |
+
background-size: 16px 40px;
|
295 |
+
}
|
296 |
+
#adminmenu #menu-posts-download:hover div.wp-menu-image,
|
297 |
+
#adminmenu #menu-posts-download.wp-has-current-submenu div.wp-menu-image {
|
298 |
+
background-position: 7px 6px;
|
299 |
+
}
|
300 |
+
<?php } ?>
|
301 |
#icon-edit.icon32-posts-download {
|
302 |
background: url(<?php echo $icon_cpt_2x_url; ?>) no-repeat -7px -5px !important;
|
303 |
background-size: 55px 45px !important;
|
includes/shortcodes.php
CHANGED
@@ -41,6 +41,11 @@ function edd_download_shortcode( $atts, $content = null ) {
|
|
41 |
),
|
42 |
$atts, 'purchase_link' );
|
43 |
|
|
|
|
|
|
|
|
|
|
|
44 |
// Override color if color == inherit
|
45 |
if( isset( $atts['color'] ) ) {
|
46 |
$atts['color'] = ( $atts['color'] == 'inherit' ) ? '' : $atts['color'];
|
41 |
),
|
42 |
$atts, 'purchase_link' );
|
43 |
|
44 |
+
// Override text if direct == 1
|
45 |
+
if( $atts['direct'] == '1' ) {
|
46 |
+
$atts['text'] = edd_get_option( 'buy_now_text', __( 'Buy Now', 'edd' ) );
|
47 |
+
}
|
48 |
+
|
49 |
// Override color if color == inherit
|
50 |
if( isset( $atts['color'] ) ) {
|
51 |
$atts['color'] = ( $atts['color'] == 'inherit' ) ? '' : $atts['color'];
|
includes/template-functions.php
CHANGED
@@ -57,13 +57,14 @@ function edd_get_purchase_link( $args = array() ) {
|
|
57 |
}
|
58 |
|
59 |
$post_id = is_object( $post ) ? $post->ID : 0;
|
60 |
-
|
|
|
61 |
$defaults = apply_filters( 'edd_purchase_link_defaults', array(
|
62 |
'download_id' => $post_id,
|
63 |
'price' => (bool) true,
|
64 |
'price_id' => isset( $args['price_id'] ) ? $args['price_id'] : false,
|
65 |
-
'direct' =>
|
66 |
-
'text' => edd_get_option( 'add_to_cart_text', __( 'Purchase', 'edd' ) ),
|
67 |
'style' => edd_get_option( 'button_style', 'button' ),
|
68 |
'color' => edd_get_option( 'checkout_color', 'blue' ),
|
69 |
'class' => 'edd-submit'
|
@@ -209,6 +210,10 @@ function edd_get_purchase_link( $args = array() ) {
|
|
209 |
<input type="hidden" name="edd_action" class="edd_action_input" value="add_to_cart">
|
210 |
<?php } ?>
|
211 |
|
|
|
|
|
|
|
|
|
212 |
<?php do_action( 'edd_purchase_link_end', $download->ID, $args ); ?>
|
213 |
|
214 |
</form><!--end #<?php echo esc_attr( $form_id ); ?>-->
|
@@ -312,10 +317,15 @@ function edd_download_purchase_form_quantity_field( $download_id = 0, $args = ar
|
|
312 |
return;
|
313 |
}
|
314 |
|
315 |
-
|
316 |
-
|
317 |
-
|
|
|
|
|
|
|
|
|
318 |
|
|
|
319 |
}
|
320 |
add_action( 'edd_purchase_link_top', 'edd_download_purchase_form_quantity_field', 10, 2 );
|
321 |
|
@@ -338,10 +348,16 @@ function edd_variable_price_quantity_field( $key, $price, $download_id ) {
|
|
338 |
return;
|
339 |
}
|
340 |
|
341 |
-
|
342 |
-
|
343 |
-
|
344 |
-
|
|
|
|
|
|
|
|
|
|
|
|
|
345 |
}
|
346 |
add_action( 'edd_after_price_option', 'edd_variable_price_quantity_field', 10, 3 );
|
347 |
|
57 |
}
|
58 |
|
59 |
$post_id = is_object( $post ) ? $post->ID : 0;
|
60 |
+
$button_behavior = edd_get_download_button_behavior( $post_id );
|
61 |
+
|
62 |
$defaults = apply_filters( 'edd_purchase_link_defaults', array(
|
63 |
'download_id' => $post_id,
|
64 |
'price' => (bool) true,
|
65 |
'price_id' => isset( $args['price_id'] ) ? $args['price_id'] : false,
|
66 |
+
'direct' => $button_behavior == 'direct' ? true : false,
|
67 |
+
'text' => $button_behavior == 'direct' ? edd_get_option( 'buy_now_text', __( 'Buy Now', 'edd' ) ) : edd_get_option( 'add_to_cart_text', __( 'Purchase', 'edd' ) ),
|
68 |
'style' => edd_get_option( 'button_style', 'button' ),
|
69 |
'color' => edd_get_option( 'checkout_color', 'blue' ),
|
70 |
'class' => 'edd-submit'
|
210 |
<input type="hidden" name="edd_action" class="edd_action_input" value="add_to_cart">
|
211 |
<?php } ?>
|
212 |
|
213 |
+
<?php if( apply_filters( 'edd_download_redirect_to_checkout', edd_straight_to_checkout(), $download->ID, $args ) ) : ?>
|
214 |
+
<input type="hidden" name="edd_redirect_to_checkout" id="edd_redirect_to_checkout" value="1">
|
215 |
+
<?php endif; ?>
|
216 |
+
|
217 |
<?php do_action( 'edd_purchase_link_end', $download->ID, $args ); ?>
|
218 |
|
219 |
</form><!--end #<?php echo esc_attr( $form_id ); ?>-->
|
317 |
return;
|
318 |
}
|
319 |
|
320 |
+
ob_start();
|
321 |
+
?>
|
322 |
+
<div class="edd_download_quantity_wrapper">
|
323 |
+
<input type="number" min="1" step="1" name="edd_download_quantity" class="edd-input edd-item-quantity" value="1" />
|
324 |
+
</div>
|
325 |
+
<?php
|
326 |
+
$quantity_input = ob_get_clean();
|
327 |
|
328 |
+
echo apply_filters( 'edd_purchase_form_quantity_input', $quantity_input, $download_id, $args );
|
329 |
}
|
330 |
add_action( 'edd_purchase_link_top', 'edd_download_purchase_form_quantity_field', 10, 2 );
|
331 |
|
348 |
return;
|
349 |
}
|
350 |
|
351 |
+
ob_start();
|
352 |
+
?>
|
353 |
+
<div class="edd_download_quantity_wrapper edd_download_quantity_price_option_<?php echo sanitize_key( $price['name'] ) ?>">
|
354 |
+
<span class="edd_price_option_sep"> x </span>
|
355 |
+
<input type="number" min="1" step="1" name="edd_download_quantity_<?php echo esc_attr( $key ) ?>" class="edd-input edd-item-quantity" value="1" />
|
356 |
+
</div>
|
357 |
+
<?php
|
358 |
+
$quantity_input = ob_get_clean();
|
359 |
+
|
360 |
+
echo apply_filters( 'edd_purchase_form_variation_quantity_input', $quantity_input, $download_id, $key, $price );
|
361 |
}
|
362 |
add_action( 'edd_after_price_option', 'edd_variable_price_quantity_field', 10, 3 );
|
363 |
|
includes/widgets.php
CHANGED
@@ -124,7 +124,7 @@ class edd_categories_tags_widget extends WP_Widget {
|
|
124 |
$hide_empty = isset( $instance['hide_empty'] ) && $instance['hide_empty'] == 'on' ? 1 : 0;
|
125 |
|
126 |
echo $args['before_widget'];
|
127 |
-
|
128 |
if ( $title ) {
|
129 |
echo $args['before_title'] . $title . $args['after_title'];
|
130 |
}
|
@@ -136,7 +136,7 @@ class edd_categories_tags_widget extends WP_Widget {
|
|
136 |
echo "</ul>\n";
|
137 |
|
138 |
do_action( 'edd_after_taxonomy_widget' );
|
139 |
-
|
140 |
echo $args['after_widget'];
|
141 |
}
|
142 |
|
@@ -168,8 +168,12 @@ class edd_categories_tags_widget extends WP_Widget {
|
|
168 |
<p>
|
169 |
<label for="<?php echo esc_attr( $this->get_field_id( 'taxonomy' ) ); ?>"><?php _e( 'Taxonomy:', 'edd' ); ?></label>
|
170 |
<select name="<?php echo esc_attr( $this->get_field_name( 'taxonomy' ) ); ?>" id="<?php echo esc_attr( $this->get_field_id( 'taxonomy' ) ); ?>">
|
171 |
-
|
172 |
-
|
|
|
|
|
|
|
|
|
173 |
</select>
|
174 |
</p>
|
175 |
<p>
|
@@ -187,7 +191,7 @@ class edd_categories_tags_widget extends WP_Widget {
|
|
187 |
|
188 |
/**
|
189 |
* Product Details Widget
|
190 |
-
*
|
191 |
* Displays a product's details in a widget
|
192 |
*
|
193 |
* @since 1.9
|
@@ -195,165 +199,177 @@ class edd_categories_tags_widget extends WP_Widget {
|
|
195 |
*/
|
196 |
class EDD_Product_Details_Widget extends WP_Widget {
|
197 |
|
198 |
-
|
199 |
public function __construct() {
|
200 |
parent::__construct(
|
201 |
'edd_product_details',
|
202 |
sprintf( __( '%s Details', 'edd' ), edd_get_label_singular() ),
|
203 |
-
array(
|
204 |
'description' => sprintf( __( 'Display the details of a specific %s', 'edd' ), edd_get_label_singular() ),
|
205 |
)
|
206 |
);
|
207 |
}
|
208 |
|
209 |
-
|
210 |
-
|
211 |
$args['id'] = ( isset( $args['id'] ) ) ? $args['id'] : 'edd_download_details_widget';
|
212 |
|
213 |
-
|
214 |
-
|
215 |
-
|
216 |
|
217 |
-
|
218 |
-
|
219 |
-
|
220 |
-
|
221 |
-
|
222 |
-
|
223 |
|
224 |
-
|
225 |
$title = apply_filters( 'widget_title', $instance['title'], $instance, $args['id'] );
|
226 |
-
|
227 |
-
|
228 |
-
|
229 |
-
|
230 |
-
|
231 |
-
|
232 |
-
|
233 |
-
|
234 |
-
|
235 |
-
|
236 |
-
|
237 |
}
|
238 |
|
239 |
-
|
|
|
|
|
|
|
240 |
|
241 |
-
|
242 |
-
|
|
|
243 |
|
244 |
-
|
245 |
-
|
246 |
-
|
|
|
|
|
247 |
|
248 |
-
|
249 |
-
|
250 |
-
|
|
|
251 |
|
252 |
-
|
253 |
|
254 |
-
|
255 |
-
|
256 |
|
257 |
-
|
258 |
-
$text .= '<span class="categories">' . __( 'Categories: %1$s', 'edd' ). '</span><br/>';
|
259 |
|
260 |
-
|
261 |
-
|
262 |
|
263 |
-
|
264 |
-
|
265 |
-
|
266 |
-
do_action( 'edd_product_details_widget_before_categories_and_tags', $instance, $download_id );
|
267 |
|
268 |
-
|
269 |
-
|
270 |
-
|
|
|
271 |
|
272 |
-
|
273 |
-
echo $args['after_widget'];
|
274 |
-
}
|
275 |
|
276 |
-
|
277 |
-
public function form( $instance ) {
|
278 |
-
// Set up some default widget settings.
|
279 |
-
$defaults = array(
|
280 |
-
'title' => sprintf( __( '%s Details', 'edd' ), edd_get_label_singular() ),
|
281 |
-
'download_id' => 'current',
|
282 |
-
'download_title' => 'on',
|
283 |
-
'purchase_button' => 'on',
|
284 |
-
'categories' => 'on',
|
285 |
-
'tags' => 'on'
|
286 |
-
);
|
287 |
|
288 |
-
|
289 |
-
|
290 |
-
|
291 |
-
|
292 |
-
|
293 |
-
|
294 |
-
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
295 |
|
296 |
<!-- Download -->
|
297 |
-
|
298 |
-
|
299 |
-
|
300 |
-
|
301 |
-
|
302 |
-
|
303 |
-
|
304 |
-
|
305 |
-
|
306 |
-
|
307 |
-
|
308 |
-
|
309 |
-
|
310 |
-
|
311 |
-
|
312 |
-
|
313 |
-
|
314 |
-
|
315 |
-
|
316 |
-
|
317 |
-
|
318 |
-
|
319 |
-
|
320 |
-
|
321 |
-
|
322 |
-
|
323 |
-
|
324 |
-
|
325 |
-
|
326 |
-
|
327 |
-
|
328 |
-
|
329 |
-
|
330 |
-
|
331 |
-
|
332 |
-
|
333 |
-
|
334 |
-
|
335 |
-
|
336 |
-
|
337 |
-
|
338 |
-
|
339 |
-
|
340 |
-
|
341 |
-
|
342 |
-
|
343 |
-
|
344 |
-
|
345 |
-
|
346 |
-
|
347 |
-
|
348 |
-
|
349 |
-
|
350 |
-
|
351 |
-
|
352 |
-
|
353 |
-
|
354 |
-
|
355 |
-
|
356 |
-
|
|
|
|
|
357 |
|
358 |
}
|
359 |
|
124 |
$hide_empty = isset( $instance['hide_empty'] ) && $instance['hide_empty'] == 'on' ? 1 : 0;
|
125 |
|
126 |
echo $args['before_widget'];
|
127 |
+
|
128 |
if ( $title ) {
|
129 |
echo $args['before_title'] . $title . $args['after_title'];
|
130 |
}
|
136 |
echo "</ul>\n";
|
137 |
|
138 |
do_action( 'edd_after_taxonomy_widget' );
|
139 |
+
|
140 |
echo $args['after_widget'];
|
141 |
}
|
142 |
|
168 |
<p>
|
169 |
<label for="<?php echo esc_attr( $this->get_field_id( 'taxonomy' ) ); ?>"><?php _e( 'Taxonomy:', 'edd' ); ?></label>
|
170 |
<select name="<?php echo esc_attr( $this->get_field_name( 'taxonomy' ) ); ?>" id="<?php echo esc_attr( $this->get_field_id( 'taxonomy' ) ); ?>">
|
171 |
+
<?php
|
172 |
+
$category_labels = edd_get_taxonomy_labels( 'download_category' );
|
173 |
+
$tag_labels = edd_get_taxonomy_labels( 'download_tag' );
|
174 |
+
?>
|
175 |
+
<option value="download_category" <?php selected( 'download_category', $instance['taxonomy'] ); ?>><?php echo $category_labels['name']; ?></option>
|
176 |
+
<option value="download_tag" <?php selected( 'download_tag', $instance['taxonomy'] ); ?>><?php echo $tag_labels['name']; ?></option>
|
177 |
</select>
|
178 |
</p>
|
179 |
<p>
|
191 |
|
192 |
/**
|
193 |
* Product Details Widget
|
194 |
+
*
|
195 |
* Displays a product's details in a widget
|
196 |
*
|
197 |
* @since 1.9
|
199 |
*/
|
200 |
class EDD_Product_Details_Widget extends WP_Widget {
|
201 |
|
202 |
+
/** Constructor */
|
203 |
public function __construct() {
|
204 |
parent::__construct(
|
205 |
'edd_product_details',
|
206 |
sprintf( __( '%s Details', 'edd' ), edd_get_label_singular() ),
|
207 |
+
array(
|
208 |
'description' => sprintf( __( 'Display the details of a specific %s', 'edd' ), edd_get_label_singular() ),
|
209 |
)
|
210 |
);
|
211 |
}
|
212 |
|
213 |
+
/** @see WP_Widget::widget */
|
214 |
+
public function widget( $args, $instance ) {
|
215 |
$args['id'] = ( isset( $args['id'] ) ) ? $args['id'] : 'edd_download_details_widget';
|
216 |
|
217 |
+
if ( ! isset( $instance['download_id'] ) || ( 'current' == $instance['download_id'] && ! is_singular( 'download' ) ) ) {
|
218 |
+
return;
|
219 |
+
}
|
220 |
|
221 |
+
// set correct download ID
|
222 |
+
if ( 'current' == $instance['download_id'] && is_singular( 'download' ) ) {
|
223 |
+
$download_id = get_the_ID();
|
224 |
+
} else {
|
225 |
+
$download_id = absint( $instance['download_id'] );
|
226 |
+
}
|
227 |
|
228 |
+
// Variables from widget settings
|
229 |
$title = apply_filters( 'widget_title', $instance['title'], $instance, $args['id'] );
|
230 |
+
$download_title = $instance['download_title'] ? apply_filters( 'edd_product_details_widget_download_title', '<h3>' . get_the_title( $download_id ) . '</h3>', $download_id ) : '';
|
231 |
+
$purchase_button = $instance['purchase_button'] ? apply_filters( 'edd_product_details_widget_purchase_button', edd_get_purchase_link( array( 'download_id' => $download_id ) ), $download_id ) : '';
|
232 |
+
$categories = $instance['categories'] ? $instance['categories'] : '';
|
233 |
+
$tags = $instance['tags'] ? $instance['tags'] : '';
|
234 |
+
|
235 |
+
// Used by themes. Opens the widget
|
236 |
+
echo $args['before_widget'];
|
237 |
+
|
238 |
+
// Display the widget title
|
239 |
+
if( $title ) {
|
240 |
+
echo $args['before_title'] . $title . $args['after_title'];
|
241 |
}
|
242 |
|
243 |
+
do_action( 'edd_product_details_widget_before_title' , $instance , $download_id );
|
244 |
+
|
245 |
+
// download title
|
246 |
+
echo $download_title;
|
247 |
|
248 |
+
do_action( 'edd_product_details_widget_before_purchase_button' , $instance , $download_id );
|
249 |
+
// purchase button
|
250 |
+
echo $purchase_button;
|
251 |
|
252 |
+
// categories and tags
|
253 |
+
$category_list = $categories ? get_the_term_list( $download_id, 'download_category', '', ', ' ) : '';
|
254 |
+
$category_count = count( get_the_terms( $download_id, 'download_category' ) );
|
255 |
+
$category_labels = edd_get_taxonomy_labels( 'download_category' );
|
256 |
+
$category_label = $category_count > 1 ? $category_labels['name'] : $category_labels['singular_name'];
|
257 |
|
258 |
+
$tag_list = $tags ? get_the_term_list( $download_id, 'download_tag', '', ', ' ) : '';
|
259 |
+
$tag_count = count( get_the_terms( $download_id, 'download_tag' ) );
|
260 |
+
$tag_taxonomy = edd_get_taxonomy_labels( 'download_tag' );
|
261 |
+
$tag_label = $tag_count > 1 ? $tag_taxonomy['name'] : $tag_taxonomy['singular_name'];
|
262 |
|
263 |
+
$text = '';
|
264 |
|
265 |
+
if( $category_list || $tag_list ) {
|
266 |
+
$text .= '<p class="edd-meta">';
|
267 |
|
268 |
+
if( $category_list ) {
|
|
|
269 |
|
270 |
+
$text .= '<span class="categories">%1$s: %2$s</span><br/>';
|
271 |
+
}
|
272 |
|
273 |
+
if ( $tag_list ) {
|
274 |
+
$text .= '<span class="tags">%3$s: %4$s</span>';
|
275 |
+
}
|
|
|
276 |
|
277 |
+
$text .= '</p>';
|
278 |
+
}
|
279 |
+
|
280 |
+
do_action( 'edd_product_details_widget_before_categories_and_tags', $instance, $download_id );
|
281 |
|
282 |
+
printf( $text, $category_label, $category_list, $tag_label, $tag_list );
|
|
|
|
|
283 |
|
284 |
+
do_action( 'edd_product_details_widget_before_end', $instance, $download_id );
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
285 |
|
286 |
+
// Used by themes. Closes the widget
|
287 |
+
echo $args['after_widget'];
|
288 |
+
}
|
289 |
+
|
290 |
+
/** @see WP_Widget::form */
|
291 |
+
public function form( $instance ) {
|
292 |
+
// Set up some default widget settings.
|
293 |
+
$defaults = array(
|
294 |
+
'title' => sprintf( __( '%s Details', 'edd' ), edd_get_label_singular() ),
|
295 |
+
'download_id' => 'current',
|
296 |
+
'download_title' => 'on',
|
297 |
+
'purchase_button' => 'on',
|
298 |
+
'categories' => 'on',
|
299 |
+
'tags' => 'on'
|
300 |
+
);
|
301 |
+
|
302 |
+
$instance = wp_parse_args( (array) $instance, $defaults ); ?>
|
303 |
+
|
304 |
+
<!-- Title -->
|
305 |
+
<p>
|
306 |
+
<label for="<?php echo esc_attr( $this->get_field_id( 'title' ) ); ?>"><?php _e( 'Title:', 'edd' ) ?></label>
|
307 |
+
<input class="widefat" id="<?php echo esc_attr( $this->get_field_id( 'title' ) ); ?>" name="<?php echo esc_attr( $this->get_field_name( 'title' ) ); ?>" type="text" value="<?php echo $instance['title']; ?>" />
|
308 |
+
</p>
|
309 |
|
310 |
<!-- Download -->
|
311 |
+
<?php
|
312 |
+
$args = array(
|
313 |
+
'post_type' => 'download',
|
314 |
+
'posts_per_page' => -1,
|
315 |
+
'post_status' => 'publish',
|
316 |
+
);
|
317 |
+
$downloads = get_posts( $args );
|
318 |
+
?>
|
319 |
+
<p>
|
320 |
+
<label for="<?php echo esc_attr( $this->get_field_id( 'download_id' ) ); ?>"><?php printf( __( '%s', 'edd' ), edd_get_label_singular() ); ?></label>
|
321 |
+
<select class="widefat" name="<?php echo esc_attr( $this->get_field_name( 'download_id' ) ); ?>" id="<?php echo esc_attr( $this->get_field_id( 'download_id' ) ); ?>">
|
322 |
+
<option value="current"><?php _e( 'Use current', 'edd' ); ?></option>
|
323 |
+
<?php foreach ( $downloads as $download ) { ?>
|
324 |
+
<option <?php selected( absint( $instance['download_id'] ), $download->ID ); ?> value="<?php echo esc_attr( $download->ID ); ?>"><?php echo $download->post_title; ?></option>
|
325 |
+
<?php } ?>
|
326 |
+
</select>
|
327 |
+
</p>
|
328 |
+
|
329 |
+
<!-- Download title -->
|
330 |
+
<p>
|
331 |
+
<input <?php checked( $instance['download_title'], 'on' ); ?> id="<?php echo esc_attr( $this->get_field_id( 'download_title' ) ); ?>" name="<?php echo esc_attr( $this->get_field_name( 'download_title' ) ); ?>" type="checkbox" />
|
332 |
+
<label for="<?php echo esc_attr( $this->get_field_id( 'download_title' ) ); ?>"><?php _e( 'Show Title', 'edd' ); ?></label>
|
333 |
+
</p>
|
334 |
+
|
335 |
+
<!-- Show purchase button -->
|
336 |
+
<p>
|
337 |
+
<input <?php checked( $instance['purchase_button'], 'on' ); ?> id="<?php echo esc_attr( $this->get_field_id( 'purchase_button' ) ); ?>" name="<?php echo esc_attr( $this->get_field_name( 'purchase_button' ) ); ?>" type="checkbox" />
|
338 |
+
<label for="<?php echo esc_attr( $this->get_field_id( 'purchase_button' ) ); ?>"><?php _e( 'Show Purchase Button', 'edd' ); ?></label>
|
339 |
+
</p>
|
340 |
+
|
341 |
+
<!-- Show download categories -->
|
342 |
+
<p>
|
343 |
+
<?php $category_labels = edd_get_taxonomy_labels( 'download_category' ); ?>
|
344 |
+
<input <?php checked( $instance['categories'], 'on' ); ?> id="<?php echo esc_attr( $this->get_field_id( 'categories' ) ); ?>" name="<?php echo esc_attr( $this->get_field_name( 'categories' ) ); ?>" type="checkbox" />
|
345 |
+
<label for="<?php echo esc_attr( $this->get_field_id( 'categories' ) ); ?>"><?php printf( __( 'Show %s', 'edd' ), $category_labels['name'] ); ?></label>
|
346 |
+
</p>
|
347 |
+
|
348 |
+
<!-- Show download tags -->
|
349 |
+
<p>
|
350 |
+
<?php $tag_labels = edd_get_taxonomy_labels( 'download_tag' ); ?>
|
351 |
+
<input <?php checked( $instance['tags'], 'on' ); ?> id="<?php echo esc_attr( $this->get_field_id( 'tags' ) ); ?>" name="<?php echo esc_attr( $this->get_field_name( 'tags' ) ); ?>" type="checkbox" />
|
352 |
+
<label for="<?php echo esc_attr( $this->get_field_id( 'tags' ) ); ?>"><?php printf( __( 'Show %s', 'edd' ), $tag_labels['name'] ); ?></label>
|
353 |
+
</p>
|
354 |
+
|
355 |
+
<?php do_action( 'edd_product_details_widget_form' , $instance ); ?>
|
356 |
+
<?php }
|
357 |
+
|
358 |
+
/** @see WP_Widget::update */
|
359 |
+
public function update( $new_instance, $old_instance ) {
|
360 |
+
$instance = $old_instance;
|
361 |
+
|
362 |
+
$instance['title'] = strip_tags( $new_instance['title'] );
|
363 |
+
$instance['download_id'] = strip_tags( $new_instance['download_id'] );
|
364 |
+
$instance['download_title'] = isset( $new_instance['download_title'] ) ? $new_instance['download_title'] : '';
|
365 |
+
$instance['purchase_button'] = isset( $new_instance['purchase_button'] ) ? $new_instance['purchase_button'] : '';
|
366 |
+
$instance['categories'] = isset( $new_instance['categories'] ) ? $new_instance['categories'] : '';
|
367 |
+
$instance['tags'] = isset( $new_instance['tags'] ) ? $new_instance['tags'] : '';
|
368 |
+
|
369 |
+
do_action( 'edd_product_details_widget_update', $instance );
|
370 |
+
|
371 |
+
return $instance;
|
372 |
+
}
|
373 |
|
374 |
}
|
375 |
|
languages/edd.pot
CHANGED
@@ -2,16 +2,16 @@
|
|
2 |
# This file is distributed under the same license as the Easy Digital Downloads package.
|
3 |
msgid ""
|
4 |
msgstr ""
|
5 |
-
"Project-Id-Version: Easy Digital Downloads 2.3.
|
6 |
"Report-Msgid-Bugs-To: https://easydigitaldownloads.com/\n"
|
7 |
-
"POT-Creation-Date: 2015-
|
8 |
"MIME-Version: 1.0\n"
|
9 |
"Content-Type: text/plain; charset=utf-8\n"
|
10 |
"Content-Transfer-Encoding: 8bit\n"
|
11 |
"PO-Revision-Date: 2015-MO-DA HO:MI+ZONE\n"
|
12 |
"Last-Translator: WP-Translations (http://wp-translations.org/)\n"
|
13 |
"Language-Team: WP-Translations <wpt@wp-translations.org>\n"
|
14 |
-
"X-Generator: grunt-wp-i18n 0.5.
|
15 |
"X-Poedit-KeywordsList: "
|
16 |
"__;_e;_x:1,2c;_ex:1,2c;_n:1,2;_nx:1,2,4c;_n_noop:1,2;_nx_noop:1,2,3c;esc_"
|
17 |
"attr__;esc_html__;esc_attr_e;esc_html_e;esc_attr_x:1,2c;esc_html_x:1,2c;\n"
|
@@ -54,7 +54,7 @@ msgstr ""
|
|
54 |
#: includes/admin/discounts/discount-actions.php:173
|
55 |
#: includes/admin/discounts/discount-actions.php:194
|
56 |
#: includes/admin/discounts/edit-discount.php:16
|
57 |
-
#: includes/admin/downloads/dashboard-columns.php:
|
58 |
#: includes/admin/payments/actions.php:25
|
59 |
#: includes/admin/payments/actions.php:189
|
60 |
#: includes/admin/payments/actions.php:338
|
@@ -63,27 +63,30 @@ msgstr ""
|
|
63 |
#: includes/admin/payments/actions.php:401
|
64 |
#: includes/admin/payments/view-order-details.php:22
|
65 |
#: includes/admin/payments/view-order-details.php:32
|
66 |
-
#: includes/admin/reporting/class-api-requests-logs-list-table.php:
|
67 |
#: includes/admin/reporting/class-export.php:172
|
68 |
#: includes/admin/reporting/class-gateway-error-logs-list-table.php:119
|
|
|
|
|
69 |
#: includes/admin/reporting/pdf-reports.php:29
|
70 |
#: includes/admin/reporting/pdf-reports.php:33
|
71 |
-
#: includes/admin/reporting/reports.php:
|
72 |
-
#: includes/admin/tools.php:
|
73 |
-
#: includes/admin/upgrades/upgrade-functions.php:
|
74 |
-
#: includes/admin/upgrades/upgrade-functions.php:
|
75 |
-
#: includes/admin/upgrades/upgrade-functions.php:
|
76 |
-
#: includes/admin/upgrades/upgrade-functions.php:
|
77 |
-
#: includes/admin/upgrades/upgrade-functions.php:
|
78 |
-
#: includes/admin/upgrades/upgrade-functions.php:
|
79 |
-
#: includes/
|
80 |
-
#: includes/class-edd-api.php:
|
81 |
-
#: includes/class-edd-api.php:
|
82 |
-
#: includes/class-edd-license-handler.php:
|
|
|
83 |
#: includes/deprecated-functions.php:517 includes/deprecated-functions.php:532
|
84 |
#: includes/deprecated-functions.php:542 includes/download-functions.php:1152
|
85 |
#: includes/emails/actions.php:48 includes/emails/template.php:241
|
86 |
-
#: includes/error-tracking.php:36 includes/gateways/functions.php:
|
87 |
#: includes/gateways/manual.php:33 includes/gateways/paypal-standard.php:34
|
88 |
#: includes/process-download.php:231 includes/process-download.php:698
|
89 |
#: includes/query-filters.php:48
|
@@ -160,7 +163,7 @@ msgstr ""
|
|
160 |
|
161 |
#: includes/admin/admin-pages.php:41 includes/admin/plugins.php:59
|
162 |
#: includes/admin/settings/contextual-help.php:87
|
163 |
-
#: includes/admin/settings/register-settings.php:
|
164 |
msgid "Extensions"
|
165 |
msgstr ""
|
166 |
|
@@ -176,39 +179,39 @@ msgstr ""
|
|
176 |
msgid "API Keys"
|
177 |
msgstr ""
|
178 |
|
179 |
-
#: includes/admin/class-api-keys-table.php:
|
180 |
msgid "View API Log"
|
181 |
msgstr ""
|
182 |
|
183 |
-
#: includes/admin/class-api-keys-table.php:
|
184 |
msgid "Reissue"
|
185 |
msgstr ""
|
186 |
|
187 |
-
#: includes/admin/class-api-keys-table.php:
|
188 |
msgid "Revoke"
|
189 |
msgstr ""
|
190 |
|
191 |
-
#: includes/admin/class-api-keys-table.php:
|
192 |
-
#: includes/checkout/template.php:
|
193 |
-
#: includes/checkout/template.php:
|
194 |
#: templates/shortcode-login.php:16 templates/shortcode-register.php:18
|
195 |
#: templates/shortcode-register.php:19
|
196 |
msgid "Username"
|
197 |
msgstr ""
|
198 |
|
199 |
-
#: includes/admin/class-api-keys-table.php:
|
200 |
msgid "Public Key"
|
201 |
msgstr ""
|
202 |
|
203 |
-
#: includes/admin/class-api-keys-table.php:
|
204 |
-
msgid "
|
205 |
msgstr ""
|
206 |
|
207 |
-
#: includes/admin/class-api-keys-table.php:
|
208 |
-
msgid "
|
209 |
msgstr ""
|
210 |
|
211 |
-
#: includes/admin/class-api-keys-table.php:
|
212 |
msgid "Generate New API Keys"
|
213 |
msgstr ""
|
214 |
|
@@ -221,7 +224,6 @@ msgstr ""
|
|
221 |
#: includes/admin/class-edd-notices.php:47
|
222 |
#: includes/admin/class-edd-notices.php:61
|
223 |
#: includes/admin/class-edd-notices.php:74
|
224 |
-
#: includes/admin/class-edd-notices.php:82
|
225 |
msgid "Dismiss Notice"
|
226 |
msgstr ""
|
227 |
|
@@ -240,7 +242,7 @@ msgstr ""
|
|
240 |
#: includes/admin/class-edd-notices.php:59
|
241 |
msgid ""
|
242 |
"To protect them, you must add a redirect rule as explained in <a "
|
243 |
-
"href=\"
|
244 |
"files-on-nginx\">this guide</a>."
|
245 |
msgstr ""
|
246 |
|
@@ -263,79 +265,67 @@ msgid ""
|
|
263 |
"<strong>%s</strong> directory, and copy the following into it:"
|
264 |
msgstr ""
|
265 |
|
266 |
-
#: includes/admin/class-edd-notices.php:
|
267 |
-
msgid ""
|
268 |
-
"Your site appears to be blocking the WordPress ajax interface. This may "
|
269 |
-
"causes issues with your store."
|
270 |
-
msgstr ""
|
271 |
-
|
272 |
-
#: includes/admin/class-edd-notices.php:81
|
273 |
-
msgid ""
|
274 |
-
"Please see <a href=\"%s\" target=\"_blank\">this reference</a> for possible "
|
275 |
-
"solutions."
|
276 |
-
msgstr ""
|
277 |
-
|
278 |
-
#: includes/admin/class-edd-notices.php:91
|
279 |
msgid "Discount code added."
|
280 |
msgstr ""
|
281 |
|
282 |
-
#: includes/admin/class-edd-notices.php:
|
283 |
msgid "There was a problem adding your discount code, please try again."
|
284 |
msgstr ""
|
285 |
|
286 |
-
#: includes/admin/class-edd-notices.php:
|
287 |
msgid "A discount with that code already exists, please use a different code."
|
288 |
msgstr ""
|
289 |
|
290 |
-
#: includes/admin/class-edd-notices.php:
|
291 |
msgid "Discount code updated."
|
292 |
msgstr ""
|
293 |
|
294 |
-
#: includes/admin/class-edd-notices.php:
|
295 |
msgid "There was a problem updating your discount code, please try again."
|
296 |
msgstr ""
|
297 |
|
298 |
-
#: includes/admin/class-edd-notices.php:
|
299 |
msgid "The payment has been deleted."
|
300 |
msgstr ""
|
301 |
|
302 |
-
#: includes/admin/class-edd-notices.php:
|
303 |
msgid "The purchase receipt has been resent."
|
304 |
msgstr ""
|
305 |
|
306 |
-
#: includes/admin/class-edd-notices.php:
|
307 |
msgid "The payment note has been deleted."
|
308 |
msgstr ""
|
309 |
|
310 |
-
#: includes/admin/class-edd-notices.php:
|
311 |
msgid "The settings have been imported."
|
312 |
msgstr ""
|
313 |
|
314 |
-
#: includes/admin/class-edd-notices.php:
|
315 |
msgid "API keys successfully generated."
|
316 |
msgstr ""
|
317 |
|
318 |
-
#: includes/admin/class-edd-notices.php:
|
319 |
msgid "The specified user already has API keys."
|
320 |
msgstr ""
|
321 |
|
322 |
-
#: includes/admin/class-edd-notices.php:
|
323 |
msgid "API keys successfully regenerated."
|
324 |
msgstr ""
|
325 |
|
326 |
-
#: includes/admin/class-edd-notices.php:
|
327 |
msgid "API keys successfully revoked."
|
328 |
msgstr ""
|
329 |
|
330 |
-
#: includes/admin/class-edd-notices.php:
|
331 |
msgid "The payment note has been added successfully."
|
332 |
msgstr ""
|
333 |
|
334 |
-
#: includes/admin/class-edd-notices.php:
|
335 |
msgid "The payment has been successfully updated."
|
336 |
msgstr ""
|
337 |
|
338 |
-
#: includes/admin/class-edd-notices.php:
|
339 |
msgid "Customer successfully deleted"
|
340 |
msgstr ""
|
341 |
|
@@ -363,8 +353,9 @@ msgstr ""
|
|
363 |
#: includes/admin/discounts/add-discount.php:24
|
364 |
#: includes/admin/discounts/class-discount-codes-table.php:145
|
365 |
#: includes/admin/discounts/edit-discount.php:37
|
366 |
-
#: includes/admin/downloads/dashboard-columns.php:
|
367 |
#: includes/admin/reporting/class-export-customers.php:76
|
|
|
368 |
#: templates/shortcode-receipt.php:123
|
369 |
msgid "Name"
|
370 |
msgstr ""
|
@@ -374,6 +365,8 @@ msgstr ""
|
|
374 |
#: includes/admin/reporting/class-export-customers.php:68
|
375 |
#: includes/admin/reporting/class-export-customers.php:79
|
376 |
#: includes/admin/reporting/class-export-payments.php:63
|
|
|
|
|
377 |
#: templates/shortcode-register.php:23
|
378 |
msgid "Email"
|
379 |
msgstr ""
|
@@ -488,13 +481,14 @@ msgstr ""
|
|
488 |
|
489 |
#: includes/admin/customers/customers.php:219
|
490 |
#: includes/admin/reporting/class-export-payments.php:68
|
491 |
-
#: includes/
|
|
|
492 |
msgid "City"
|
493 |
msgstr ""
|
494 |
|
495 |
#: includes/admin/customers/customers.php:246
|
496 |
-
#: includes/admin/settings/register-settings.php:
|
497 |
-
#: includes/checkout/template.php:
|
498 |
msgid "State / Province"
|
499 |
msgstr ""
|
500 |
|
@@ -520,6 +514,7 @@ msgstr ""
|
|
520 |
|
521 |
#: includes/admin/customers/customers.php:289
|
522 |
#: includes/admin/reporting/class-export-payments.php:187
|
|
|
523 |
msgid "none"
|
524 |
msgstr ""
|
525 |
|
@@ -538,7 +533,7 @@ msgstr ""
|
|
538 |
#: includes/admin/customers/customers.php:305
|
539 |
#: includes/admin/customers/customers.php:520
|
540 |
#: includes/admin/payments/view-order-details.php:423
|
541 |
-
#: includes/admin/thickbox.php:135 includes/class-edd-html-elements.php:
|
542 |
msgid "Cancel"
|
543 |
msgstr ""
|
544 |
|
@@ -565,6 +560,8 @@ msgstr ""
|
|
565 |
#: includes/admin/payments/class-payments-table.php:221
|
566 |
#: includes/admin/reporting/class-export-payments.php:61
|
567 |
#: includes/admin/reporting/class-export.php:69
|
|
|
|
|
568 |
#: templates/history-purchases.php:13
|
569 |
msgid "ID"
|
570 |
msgstr ""
|
@@ -575,14 +572,15 @@ msgstr ""
|
|
575 |
#: includes/admin/discounts/edit-discount.php:70
|
576 |
#: includes/admin/payments/class-payments-table.php:224
|
577 |
#: includes/admin/reporting/class-export-payments.php:74
|
|
|
578 |
#: templates/history-purchases.php:15
|
579 |
msgid "Amount"
|
580 |
msgstr ""
|
581 |
|
582 |
#: includes/admin/customers/customers.php:346
|
583 |
-
#: includes/admin/downloads/dashboard-columns.php:
|
584 |
#: includes/admin/payments/class-payments-table.php:225
|
585 |
-
#: includes/admin/reporting/class-api-requests-logs-list-table.php:
|
586 |
#: includes/admin/reporting/class-export-download-history.php:64
|
587 |
#: includes/admin/reporting/class-export-earnings.php:62
|
588 |
#: includes/admin/reporting/class-export-payments.php:80
|
@@ -590,6 +588,8 @@ msgstr ""
|
|
590 |
#: includes/admin/reporting/class-file-downloads-logs-list-table.php:138
|
591 |
#: includes/admin/reporting/class-gateway-error-logs-list-table.php:122
|
592 |
#: includes/admin/reporting/class-sales-logs-list-table.php:100
|
|
|
|
|
593 |
#: templates/history-purchases.php:14 templates/shortcode-receipt.php:59
|
594 |
msgid "Date"
|
595 |
msgstr ""
|
@@ -599,6 +599,7 @@ msgstr ""
|
|
599 |
#: includes/admin/discounts/edit-discount.php:175
|
600 |
#: includes/admin/payments/class-payments-table.php:227
|
601 |
#: includes/admin/reporting/class-export-payments.php:82
|
|
|
602 |
msgid "Status"
|
603 |
msgstr ""
|
604 |
|
@@ -660,12 +661,12 @@ msgstr ""
|
|
660 |
#: includes/admin/dashboard-widgets.php:67
|
661 |
#: includes/admin/dashboard-widgets.php:85
|
662 |
#: includes/admin/dashboard-widgets.php:111
|
663 |
-
#: includes/admin/downloads/dashboard-columns.php:
|
664 |
#: includes/admin/reporting/class-download-reports-table.php:100
|
665 |
#: includes/admin/reporting/class-export-earnings.php:64
|
666 |
-
#: includes/admin/reporting/graphing.php:
|
667 |
-
#: includes/admin/reporting/graphing.php:
|
668 |
-
#: includes/admin/reporting/pdf-reports.php:
|
669 |
#: includes/admin/reporting/reports.php:54
|
670 |
msgid "Earnings"
|
671 |
msgstr ""
|
@@ -678,23 +679,23 @@ msgstr[0] ""
|
|
678 |
msgstr[1] ""
|
679 |
|
680 |
#: includes/admin/dashboard-widgets.php:80
|
681 |
-
#: includes/admin/reporting/graphing.php:
|
682 |
msgid "Last Month"
|
683 |
msgstr ""
|
684 |
|
685 |
#: includes/admin/dashboard-widgets.php:105
|
686 |
-
#: includes/admin/reporting/graphing.php:
|
687 |
msgid "Today"
|
688 |
msgstr ""
|
689 |
|
690 |
#: includes/admin/dashboard-widgets.php:119
|
691 |
-
#: includes/admin/downloads/dashboard-columns.php:
|
692 |
#: includes/admin/reporting/class-download-reports-table.php:99
|
693 |
#: includes/admin/reporting/class-export-earnings.php:63
|
694 |
-
#: includes/admin/reporting/graphing.php:
|
695 |
-
#: includes/admin/reporting/graphing.php:
|
696 |
#: includes/admin/reporting/logs.php:145
|
697 |
-
#: includes/admin/reporting/pdf-reports.php:
|
698 |
msgid "Sales"
|
699 |
msgstr ""
|
700 |
|
@@ -703,10 +704,12 @@ msgid "Totals"
|
|
703 |
msgstr ""
|
704 |
|
705 |
#: includes/admin/dashboard-widgets.php:138
|
|
|
706 |
msgid "Total Earnings"
|
707 |
msgstr ""
|
708 |
|
709 |
#: includes/admin/dashboard-widgets.php:142
|
|
|
710 |
#: includes/admin/reporting/class-gateways-reports-table.php:81
|
711 |
msgid "Total Sales"
|
712 |
msgstr ""
|
@@ -730,7 +733,7 @@ msgstr ""
|
|
730 |
|
731 |
#: includes/admin/discounts/add-discount.php:16
|
732 |
#: includes/admin/discounts/edit-discount.php:29
|
733 |
-
#: includes/admin/reporting/reports.php:
|
734 |
msgid "Go Back"
|
735 |
msgstr ""
|
736 |
|
@@ -940,7 +943,7 @@ msgstr ""
|
|
940 |
#: includes/admin/discounts/class-discount-codes-table.php:274
|
941 |
#: includes/admin/payments/class-payments-table.php:302
|
942 |
#: includes/admin/payments/class-payments-table.php:375
|
943 |
-
#: includes/payments/functions.php:
|
944 |
msgid "Delete"
|
945 |
msgstr ""
|
946 |
|
@@ -999,7 +1002,7 @@ msgstr ""
|
|
999 |
|
1000 |
#: includes/admin/discounts/contextual-help.php:38
|
1001 |
#: includes/admin/settings/contextual-help.php:42
|
1002 |
-
#: includes/admin/settings/register-settings.php:
|
1003 |
#: includes/admin/tools.php:68
|
1004 |
msgid "General"
|
1005 |
msgstr ""
|
@@ -1261,51 +1264,24 @@ msgid ""
|
|
1261 |
"Documentation</a>"
|
1262 |
msgstr ""
|
1263 |
|
1264 |
-
#: includes/admin/downloads/dashboard-columns.php:
|
1265 |
-
#: includes/admin/
|
1266 |
-
#: includes/widgets.php:171
|
1267 |
-
msgid "Categories"
|
1268 |
-
msgstr ""
|
1269 |
-
|
1270 |
-
#: includes/admin/downloads/dashboard-columns.php:30
|
1271 |
-
#: includes/admin/reporting/pdf-reports.php:71 includes/post-types.php:239
|
1272 |
-
#: includes/widgets.php:172
|
1273 |
-
msgid "Tags"
|
1274 |
-
msgstr ""
|
1275 |
-
|
1276 |
-
#: includes/admin/downloads/dashboard-columns.php:31
|
1277 |
-
#: includes/admin/downloads/dashboard-columns.php:290
|
1278 |
#: includes/admin/downloads/metabox.php:417
|
1279 |
#: includes/admin/reporting/pdf-reports.php:69
|
1280 |
#: templates/shortcode-receipt.php:130
|
1281 |
msgid "Price"
|
1282 |
msgstr ""
|
1283 |
|
1284 |
-
#: includes/admin/downloads/dashboard-columns.php:
|
1285 |
-
msgid "Purchase Short Code"
|
1286 |
-
msgstr ""
|
1287 |
-
|
1288 |
-
#: includes/admin/downloads/dashboard-columns.php:55
|
1289 |
-
#: includes/admin/settings/register-settings.php:754
|
1290 |
-
#: includes/admin/thickbox.php:62 includes/checkout/template.php:793
|
1291 |
-
#: includes/scripts.php:54 includes/shortcodes.php:36
|
1292 |
-
#: includes/template-functions.php:66
|
1293 |
-
msgid "Purchase"
|
1294 |
-
msgstr ""
|
1295 |
-
|
1296 |
-
#: includes/admin/downloads/dashboard-columns.php:177
|
1297 |
msgid "You do not have permission to view this data."
|
1298 |
msgstr ""
|
1299 |
|
1300 |
-
#: includes/admin/downloads/dashboard-columns.php:
|
1301 |
-
|
|
|
1302 |
msgstr ""
|
1303 |
|
1304 |
-
#: includes/admin/downloads/dashboard-columns.php:
|
1305 |
-
msgid "Show all tags"
|
1306 |
-
msgstr ""
|
1307 |
-
|
1308 |
-
#: includes/admin/downloads/dashboard-columns.php:288
|
1309 |
msgid "%s Configuration"
|
1310 |
msgstr ""
|
1311 |
|
@@ -1426,58 +1402,72 @@ msgid "Mark this product as exclusive of tax"
|
|
1426 |
msgstr ""
|
1427 |
|
1428 |
#: includes/admin/downloads/metabox.php:865
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
1429 |
msgid "Accounting Options:"
|
1430 |
msgstr ""
|
1431 |
|
1432 |
-
#: includes/admin/downloads/metabox.php:
|
1433 |
msgid "Enter an SKU for this %s."
|
1434 |
msgstr ""
|
1435 |
|
1436 |
-
#: includes/admin/downloads/metabox.php:
|
1437 |
msgid "Button Options:"
|
1438 |
msgstr ""
|
1439 |
|
1440 |
-
#: includes/admin/downloads/metabox.php:
|
1441 |
msgid "Disable the automatic output of the purchase button"
|
1442 |
msgstr ""
|
1443 |
|
1444 |
-
#: includes/admin/downloads/metabox.php:
|
1445 |
-
#: includes/admin/settings/register-settings.php:
|
1446 |
#: includes/admin/thickbox.php:100
|
1447 |
msgid "Add to Cart"
|
1448 |
msgstr ""
|
1449 |
|
1450 |
-
#: includes/admin/downloads/metabox.php:
|
|
|
|
|
1451 |
msgid "Buy Now"
|
1452 |
msgstr ""
|
1453 |
|
1454 |
-
#: includes/admin/downloads/metabox.php:
|
1455 |
msgid "Purchase button behavior"
|
1456 |
msgstr ""
|
1457 |
|
1458 |
-
#: includes/admin/downloads/metabox.php:
|
1459 |
msgid ""
|
1460 |
"Special notes or instructions for this product. These notes will be added "
|
1461 |
"to the purchase receipt."
|
1462 |
msgstr ""
|
1463 |
|
1464 |
-
#: includes/admin/downloads/metabox.php:
|
1465 |
msgid "Sales:"
|
1466 |
msgstr ""
|
1467 |
|
1468 |
-
#: includes/admin/downloads/metabox.php:
|
1469 |
msgid "View Sales Log"
|
1470 |
msgstr ""
|
1471 |
|
1472 |
-
#: includes/admin/downloads/metabox.php:
|
1473 |
msgid "Earnings:"
|
1474 |
msgstr ""
|
1475 |
|
1476 |
-
#: includes/admin/downloads/metabox.php:
|
1477 |
msgid "View File Download Log"
|
1478 |
msgstr ""
|
1479 |
|
1480 |
-
#: includes/admin/downloads/metabox.php:
|
1481 |
msgid "View Detailed Earnings Report"
|
1482 |
msgstr ""
|
1483 |
|
@@ -1523,27 +1513,27 @@ msgid "Completed"
|
|
1523 |
msgstr ""
|
1524 |
|
1525 |
#: includes/admin/payments/class-payments-table.php:201
|
1526 |
-
#: includes/payments/functions.php:
|
1527 |
msgid "Pending"
|
1528 |
msgstr ""
|
1529 |
|
1530 |
#: includes/admin/payments/class-payments-table.php:202
|
1531 |
-
#: includes/payments/functions.php:
|
1532 |
msgid "Refunded"
|
1533 |
msgstr ""
|
1534 |
|
1535 |
#: includes/admin/payments/class-payments-table.php:203
|
1536 |
-
#: includes/payments/functions.php:
|
1537 |
msgid "Revoked"
|
1538 |
msgstr ""
|
1539 |
|
1540 |
#: includes/admin/payments/class-payments-table.php:204
|
1541 |
-
#: includes/payments/functions.php:
|
1542 |
msgid "Failed"
|
1543 |
msgstr ""
|
1544 |
|
1545 |
#: includes/admin/payments/class-payments-table.php:205
|
1546 |
-
#: includes/payments/functions.php:
|
1547 |
msgid "Abandoned"
|
1548 |
msgstr ""
|
1549 |
|
@@ -1556,6 +1546,7 @@ msgstr ""
|
|
1556 |
#: includes/admin/reporting/class-export-payments.php:81
|
1557 |
#: includes/admin/reporting/class-file-downloads-logs-list-table.php:134
|
1558 |
#: includes/admin/reporting/class-sales-logs-list-table.php:96
|
|
|
1559 |
msgid "User"
|
1560 |
msgstr ""
|
1561 |
|
@@ -1575,6 +1566,7 @@ msgstr ""
|
|
1575 |
#: includes/admin/payments/class-payments-table.php:357
|
1576 |
#: includes/admin/payments/class-payments-table.php:359
|
1577 |
#: includes/admin/reporting/class-export-payments.php:192
|
|
|
1578 |
msgid "guest"
|
1579 |
msgstr ""
|
1580 |
|
@@ -1746,11 +1738,12 @@ msgstr ""
|
|
1746 |
|
1747 |
#: includes/admin/payments/view-order-details.php:101
|
1748 |
#: includes/admin/reporting/class-export-payments.php:76
|
|
|
1749 |
msgid "Discount Code"
|
1750 |
msgstr ""
|
1751 |
|
1752 |
#: includes/admin/payments/view-order-details.php:102
|
1753 |
-
#: includes/admin/settings/register-settings.php:
|
1754 |
msgid "None"
|
1755 |
msgstr ""
|
1756 |
|
@@ -1761,7 +1754,8 @@ msgstr ""
|
|
1761 |
|
1762 |
#: includes/admin/payments/view-order-details.php:122
|
1763 |
#: includes/admin/reporting/class-export-payments.php:75
|
1764 |
-
#:
|
|
|
1765 |
msgid "Tax"
|
1766 |
msgstr ""
|
1767 |
|
@@ -1834,6 +1828,7 @@ msgid "View all purchases of customer"
|
|
1834 |
msgstr ""
|
1835 |
|
1836 |
#: includes/admin/payments/view-order-details.php:323
|
|
|
1837 |
msgid "Total:"
|
1838 |
msgstr ""
|
1839 |
|
@@ -1843,8 +1838,8 @@ msgid "Copy Download Link(s)"
|
|
1843 |
msgstr ""
|
1844 |
|
1845 |
#: includes/admin/payments/view-order-details.php:333
|
1846 |
-
#: includes/admin/settings/register-settings.php:
|
1847 |
-
#: templates/checkout_cart.php:
|
1848 |
msgid "Remove"
|
1849 |
msgstr ""
|
1850 |
|
@@ -1888,7 +1883,7 @@ msgid "Click \"Save Payment\" to create new customer"
|
|
1888 |
msgstr ""
|
1889 |
|
1890 |
#: includes/admin/payments/view-order-details.php:441
|
1891 |
-
#: includes/checkout/template.php:
|
1892 |
msgid "Billing Address"
|
1893 |
msgstr ""
|
1894 |
|
@@ -1901,12 +1896,12 @@ msgid "Street Address Line 2:"
|
|
1901 |
msgstr ""
|
1902 |
|
1903 |
#: includes/admin/payments/view-order-details.php:483
|
1904 |
-
#: includes/admin/settings/register-settings.php:
|
1905 |
msgid "Select a country"
|
1906 |
msgstr ""
|
1907 |
|
1908 |
#: includes/admin/payments/view-order-details.php:499
|
1909 |
-
#: includes/admin/settings/register-settings.php:
|
1910 |
msgid "Select a state"
|
1911 |
msgstr ""
|
1912 |
|
@@ -1942,33 +1937,53 @@ msgid "Request Details"
|
|
1942 |
msgstr ""
|
1943 |
|
1944 |
#: includes/admin/reporting/class-api-requests-logs-list-table.php:91
|
|
|
|
|
|
|
|
|
1945 |
msgid "Request IP"
|
1946 |
msgstr ""
|
1947 |
|
1948 |
-
#: includes/admin/reporting/class-api-requests-logs-list-table.php:
|
|
|
|
|
|
|
|
|
1949 |
msgid "View Request Details"
|
1950 |
msgstr ""
|
1951 |
|
1952 |
-
#: includes/admin/reporting/class-api-requests-logs-list-table.php:
|
1953 |
msgid "View Request"
|
1954 |
msgstr ""
|
1955 |
|
1956 |
-
#: includes/admin/reporting/class-api-requests-logs-list-table.php:
|
1957 |
msgid "API Request:"
|
1958 |
msgstr ""
|
1959 |
|
1960 |
-
#: includes/admin/reporting/class-api-requests-logs-list-table.php:
|
1961 |
msgid "API User:"
|
1962 |
msgstr ""
|
1963 |
|
1964 |
-
#: includes/admin/reporting/class-api-requests-logs-list-table.php:
|
1965 |
msgid "API Key:"
|
1966 |
msgstr ""
|
1967 |
|
1968 |
-
#: includes/admin/reporting/class-api-requests-logs-list-table.php:
|
1969 |
msgid "Request Date:"
|
1970 |
msgstr ""
|
1971 |
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
1972 |
#: includes/admin/reporting/class-download-reports-table.php:83
|
1973 |
msgid "View Detailed Report"
|
1974 |
msgstr ""
|
@@ -1987,13 +2002,15 @@ msgstr ""
|
|
1987 |
|
1988 |
#: includes/admin/reporting/class-export-customers.php:66
|
1989 |
#: includes/admin/reporting/class-export-payments.php:64
|
1990 |
-
#: includes/
|
|
|
1991 |
msgid "First Name"
|
1992 |
msgstr ""
|
1993 |
|
1994 |
#: includes/admin/reporting/class-export-customers.php:67
|
1995 |
#: includes/admin/reporting/class-export-payments.php:65
|
1996 |
-
#: includes/
|
|
|
1997 |
msgid "Last Name"
|
1998 |
msgstr ""
|
1999 |
|
@@ -2010,72 +2027,88 @@ msgid "Total Purchased"
|
|
2010 |
msgstr ""
|
2011 |
|
2012 |
#: includes/admin/reporting/class-export-download-history.php:65
|
|
|
2013 |
msgid "Downloaded by"
|
2014 |
msgstr ""
|
2015 |
|
2016 |
#: includes/admin/reporting/class-export-download-history.php:66
|
2017 |
#: includes/admin/reporting/class-file-downloads-logs-list-table.php:137
|
|
|
2018 |
msgid "IP Address"
|
2019 |
msgstr ""
|
2020 |
|
2021 |
#: includes/admin/reporting/class-export-download-history.php:67
|
|
|
2022 |
msgid "Product"
|
2023 |
msgstr ""
|
2024 |
|
2025 |
#: includes/admin/reporting/class-export-download-history.php:68
|
2026 |
#: includes/admin/reporting/class-file-downloads-logs-list-table.php:136
|
|
|
2027 |
msgid "File"
|
2028 |
msgstr ""
|
2029 |
|
2030 |
#: includes/admin/reporting/class-export-payments.php:62
|
|
|
2031 |
msgid "Payment Number"
|
2032 |
msgstr ""
|
2033 |
|
2034 |
#: includes/admin/reporting/class-export-payments.php:66
|
|
|
2035 |
msgid "Address"
|
2036 |
msgstr ""
|
2037 |
|
2038 |
#: includes/admin/reporting/class-export-payments.php:67
|
|
|
2039 |
msgid "Address (Line 2)"
|
2040 |
msgstr ""
|
2041 |
|
2042 |
#: includes/admin/reporting/class-export-payments.php:69
|
|
|
2043 |
msgid "State"
|
2044 |
msgstr ""
|
2045 |
|
2046 |
#: includes/admin/reporting/class-export-payments.php:70
|
2047 |
-
#: includes/admin/
|
|
|
2048 |
#: templates/shortcode-profile-editor.php:75
|
2049 |
msgid "Country"
|
2050 |
msgstr ""
|
2051 |
|
2052 |
#: includes/admin/reporting/class-export-payments.php:71
|
|
|
2053 |
msgid "Zip Code"
|
2054 |
msgstr ""
|
2055 |
|
2056 |
#: includes/admin/reporting/class-export-payments.php:72
|
|
|
2057 |
#: templates/shortcode-receipt.php:119
|
2058 |
msgid "Products"
|
2059 |
msgstr ""
|
2060 |
|
2061 |
#: includes/admin/reporting/class-export-payments.php:73
|
|
|
2062 |
msgid "SKUs"
|
2063 |
msgstr ""
|
2064 |
|
2065 |
#: includes/admin/reporting/class-export-payments.php:77
|
|
|
2066 |
#: templates/shortcode-receipt.php:53
|
2067 |
msgid "Payment Method"
|
2068 |
msgstr ""
|
2069 |
|
2070 |
#: includes/admin/reporting/class-export-payments.php:78
|
|
|
2071 |
msgid "Transaction ID"
|
2072 |
msgstr ""
|
2073 |
|
2074 |
#: includes/admin/reporting/class-export-payments.php:79
|
|
|
2075 |
msgid "Purchase Key"
|
2076 |
msgstr ""
|
2077 |
|
2078 |
#: includes/admin/reporting/class-export.php:172
|
|
|
2079 |
msgid "You do not have permission to export data."
|
2080 |
msgstr ""
|
2081 |
|
@@ -2126,7 +2159,7 @@ msgid ""
|
|
2126 |
msgstr ""
|
2127 |
|
2128 |
#: includes/admin/reporting/contextual-help.php:48
|
2129 |
-
#: includes/admin/reporting/reports.php:31 includes/admin/tools.php:
|
2130 |
msgid "Export"
|
2131 |
msgstr ""
|
2132 |
|
@@ -2182,90 +2215,114 @@ msgstr ""
|
|
2182 |
msgid "You can enter the download file's name"
|
2183 |
msgstr ""
|
2184 |
|
2185 |
-
#: includes/admin/reporting/
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
2186 |
msgid "Earnings Over Time"
|
2187 |
msgstr ""
|
2188 |
|
2189 |
-
#: includes/admin/reporting/graphing.php:
|
2190 |
-
#: includes/admin/reporting/graphing.php:
|
2191 |
msgid "Total earnings for period shown: "
|
2192 |
msgstr ""
|
2193 |
|
2194 |
-
#: includes/admin/reporting/graphing.php:
|
2195 |
-
#: includes/admin/reporting/graphing.php:
|
2196 |
msgid "Total sales for period shown: "
|
2197 |
msgstr ""
|
2198 |
|
2199 |
-
#: includes/admin/reporting/graphing.php:
|
2200 |
msgid "Estimated monthly earnings: "
|
2201 |
msgstr ""
|
2202 |
|
2203 |
-
#: includes/admin/reporting/graphing.php:
|
2204 |
msgid "Estimated monthly sales: "
|
2205 |
msgstr ""
|
2206 |
|
2207 |
-
#: includes/admin/reporting/graphing.php:
|
|
|
|
|
|
|
|
|
2208 |
msgid "Earnings Over Time for %s"
|
2209 |
msgstr ""
|
2210 |
|
2211 |
-
#: includes/admin/reporting/graphing.php:
|
2212 |
msgid "Average monthly earnings: %s"
|
2213 |
msgstr ""
|
2214 |
|
2215 |
-
#: includes/admin/reporting/graphing.php:
|
2216 |
msgid "Average monthly sales: %s"
|
2217 |
msgstr ""
|
2218 |
|
2219 |
-
#: includes/admin/reporting/graphing.php:
|
2220 |
msgid "Yesterday"
|
2221 |
msgstr ""
|
2222 |
|
2223 |
-
#: includes/admin/reporting/graphing.php:
|
2224 |
msgid "This Week"
|
2225 |
msgstr ""
|
2226 |
|
2227 |
-
#: includes/admin/reporting/graphing.php:
|
2228 |
msgid "Last Week"
|
2229 |
msgstr ""
|
2230 |
|
2231 |
-
#: includes/admin/reporting/graphing.php:
|
2232 |
msgid "This Month"
|
2233 |
msgstr ""
|
2234 |
|
2235 |
-
#: includes/admin/reporting/graphing.php:
|
2236 |
msgid "This Quarter"
|
2237 |
msgstr ""
|
2238 |
|
2239 |
-
#: includes/admin/reporting/graphing.php:
|
2240 |
msgid "Last Quarter"
|
2241 |
msgstr ""
|
2242 |
|
2243 |
-
#: includes/admin/reporting/graphing.php:
|
2244 |
msgid "This Year"
|
2245 |
msgstr ""
|
2246 |
|
2247 |
-
#: includes/admin/reporting/graphing.php:
|
2248 |
msgid "Last Year"
|
2249 |
msgstr ""
|
2250 |
|
2251 |
-
#: includes/admin/reporting/graphing.php:
|
2252 |
msgid "Custom"
|
2253 |
msgstr ""
|
2254 |
|
2255 |
-
#: includes/admin/reporting/graphing.php:
|
2256 |
msgid "From"
|
2257 |
msgstr ""
|
2258 |
|
2259 |
-
#: includes/admin/reporting/graphing.php:
|
2260 |
msgid "To"
|
2261 |
msgstr ""
|
2262 |
|
2263 |
-
#: includes/admin/reporting/graphing.php:
|
|
|
|
|
|
|
|
|
2264 |
msgid "Filter"
|
2265 |
msgstr ""
|
2266 |
|
2267 |
#: includes/admin/reporting/logs.php:144
|
2268 |
-
#: includes/admin/settings/register-settings.php:
|
2269 |
msgid "File Downloads"
|
2270 |
msgstr ""
|
2271 |
|
@@ -2285,12 +2342,6 @@ msgstr ""
|
|
2285 |
msgid "You do not have permission to generate PDF sales reports"
|
2286 |
msgstr ""
|
2287 |
|
2288 |
-
#: includes/admin/reporting/pdf-reports.php:33 includes/class-edd-api.php:1458
|
2289 |
-
#: includes/class-edd-license-handler.php:173
|
2290 |
-
#: includes/class-edd-license-handler.php:246
|
2291 |
-
msgid "Nonce verification failed"
|
2292 |
-
msgstr ""
|
2293 |
-
|
2294 |
#: includes/admin/reporting/pdf-reports.php:39
|
2295 |
msgid "to"
|
2296 |
msgstr ""
|
@@ -2312,190 +2363,209 @@ msgstr ""
|
|
2312 |
msgid "Product Name"
|
2313 |
msgstr ""
|
2314 |
|
2315 |
-
#: includes/admin/reporting/pdf-reports.php:72
|
2316 |
-
msgid "
|
2317 |
msgstr ""
|
2318 |
|
2319 |
#: includes/admin/reporting/pdf-reports.php:73
|
|
|
|
|
|
|
|
|
2320 |
msgid "Earnings to Date"
|
2321 |
msgstr ""
|
2322 |
|
2323 |
-
#: includes/admin/reporting/pdf-reports.php:
|
2324 |
msgid "No %s found."
|
2325 |
msgstr ""
|
2326 |
|
2327 |
-
#: includes/admin/reporting/pdf-reports.php:
|
2328 |
msgid "Graph View"
|
2329 |
msgstr ""
|
2330 |
|
2331 |
-
#: includes/admin/reporting/pdf-reports.php:
|
2332 |
msgid "Sales and Earnings by Month for all Products"
|
2333 |
msgstr ""
|
2334 |
|
2335 |
-
#: includes/admin/reporting/pdf-reports.php:
|
2336 |
msgid "Jan"
|
2337 |
msgstr ""
|
2338 |
|
2339 |
-
#: includes/admin/reporting/pdf-reports.php:
|
2340 |
msgid "Feb"
|
2341 |
msgstr ""
|
2342 |
|
2343 |
-
#: includes/admin/reporting/pdf-reports.php:
|
2344 |
msgid "Mar"
|
2345 |
msgstr ""
|
2346 |
|
2347 |
-
#: includes/admin/reporting/pdf-reports.php:
|
2348 |
msgid "Apr"
|
2349 |
msgstr ""
|
2350 |
|
2351 |
-
#: includes/admin/reporting/pdf-reports.php:
|
2352 |
msgid "May"
|
2353 |
msgstr ""
|
2354 |
|
2355 |
-
#: includes/admin/reporting/pdf-reports.php:
|
2356 |
msgid "June"
|
2357 |
msgstr ""
|
2358 |
|
2359 |
-
#: includes/admin/reporting/pdf-reports.php:
|
2360 |
msgid "July"
|
2361 |
msgstr ""
|
2362 |
|
2363 |
-
#: includes/admin/reporting/pdf-reports.php:
|
2364 |
msgid "Aug"
|
2365 |
msgstr ""
|
2366 |
|
2367 |
-
#: includes/admin/reporting/pdf-reports.php:
|
2368 |
msgid "Sept"
|
2369 |
msgstr ""
|
2370 |
|
2371 |
-
#: includes/admin/reporting/pdf-reports.php:
|
2372 |
msgid "Oct"
|
2373 |
msgstr ""
|
2374 |
|
2375 |
-
#: includes/admin/reporting/pdf-reports.php:
|
2376 |
msgid "Nov"
|
2377 |
msgstr ""
|
2378 |
|
2379 |
-
#: includes/admin/reporting/pdf-reports.php:
|
2380 |
msgid "Dec"
|
2381 |
msgstr ""
|
2382 |
|
2383 |
-
#: includes/admin/reporting/reports.php:
|
2384 |
-
msgid "
|
2385 |
msgstr ""
|
2386 |
|
2387 |
#: includes/admin/reporting/reports.php:57
|
|
|
|
|
|
|
|
|
2388 |
#: includes/admin/settings/contextual-help.php:71
|
2389 |
-
#: includes/admin/settings/register-settings.php:
|
2390 |
msgid "Taxes"
|
2391 |
msgstr ""
|
2392 |
|
2393 |
-
#: includes/admin/reporting/reports.php:
|
2394 |
msgid "You do not have permission to access this report"
|
2395 |
msgstr ""
|
2396 |
|
2397 |
-
#: includes/admin/reporting/reports.php:
|
2398 |
msgid "Report Type"
|
2399 |
msgstr ""
|
2400 |
|
2401 |
-
#: includes/admin/reporting/reports.php:
|
2402 |
msgid "Show"
|
2403 |
msgstr ""
|
2404 |
|
2405 |
-
#: includes/admin/reporting/reports.php:
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
2406 |
msgid "Tax Report"
|
2407 |
msgstr ""
|
2408 |
|
2409 |
-
#: includes/admin/reporting/reports.php:
|
2410 |
msgid ""
|
2411 |
"This report shows the total amount collected in sales tax for the given "
|
2412 |
"year."
|
2413 |
msgstr ""
|
2414 |
|
2415 |
-
#: includes/admin/reporting/reports.php:
|
2416 |
msgid "Submit"
|
2417 |
msgstr ""
|
2418 |
|
2419 |
-
#: includes/admin/reporting/reports.php:
|
2420 |
msgid "Export PDF of Sales and Earnings"
|
2421 |
msgstr ""
|
2422 |
|
2423 |
-
#: includes/admin/reporting/reports.php:
|
2424 |
msgid ""
|
2425 |
"Download a PDF of Sales and Earnings reports for all products for the "
|
2426 |
"current year."
|
2427 |
msgstr ""
|
2428 |
|
2429 |
-
#: includes/admin/reporting/reports.php:
|
2430 |
msgid "Date range reports will be coming soon."
|
2431 |
msgstr ""
|
2432 |
|
2433 |
-
#: includes/admin/reporting/reports.php:
|
2434 |
msgid "Generate PDF"
|
2435 |
msgstr ""
|
2436 |
|
2437 |
-
#: includes/admin/reporting/reports.php:
|
2438 |
msgid "Export Earnings and Sales Stats"
|
2439 |
msgstr ""
|
2440 |
|
2441 |
-
#: includes/admin/reporting/reports.php:
|
2442 |
msgid "Download a CSV of earnings and sales over time."
|
2443 |
msgstr ""
|
2444 |
|
2445 |
-
#: includes/admin/reporting/reports.php:
|
2446 |
-
#: includes/admin/reporting/reports.php:
|
2447 |
-
#: includes/admin/reporting/reports.php:
|
2448 |
-
#: includes/admin/reporting/reports.php:
|
2449 |
msgid "Generate CSV"
|
2450 |
msgstr ""
|
2451 |
|
2452 |
-
#: includes/admin/reporting/reports.php:
|
2453 |
msgid "Export Payment History"
|
2454 |
msgstr ""
|
2455 |
|
2456 |
-
#: includes/admin/reporting/reports.php:
|
2457 |
msgid "Download a CSV of all payments recorded."
|
2458 |
msgstr ""
|
2459 |
|
2460 |
-
#: includes/admin/reporting/reports.php:
|
2461 |
-
|
|
|
2462 |
msgstr ""
|
2463 |
|
2464 |
-
#: includes/admin/reporting/reports.php:
|
2465 |
-
|
|
|
2466 |
msgstr ""
|
2467 |
|
2468 |
-
#: includes/admin/reporting/reports.php:
|
2469 |
-
msgid ""
|
2470 |
-
"Download a CSV of all customer emails. Optionally export only customers "
|
2471 |
-
"that have purchased a particular product. Note, if you have a large number "
|
2472 |
-
"of customers, exporting the purchase stats may fail."
|
2473 |
-
msgstr ""
|
2474 |
-
|
2475 |
-
#: includes/admin/reporting/reports.php:358
|
2476 |
-
msgid "All %s"
|
2477 |
msgstr ""
|
2478 |
|
2479 |
-
#: includes/admin/reporting/reports.php:
|
2480 |
-
|
2481 |
-
#: includes/admin/settings/register-settings.php:917
|
2482 |
-
msgid "Emails"
|
2483 |
msgstr ""
|
2484 |
|
2485 |
-
#: includes/admin/reporting/reports.php:
|
2486 |
-
msgid "
|
2487 |
msgstr ""
|
2488 |
|
2489 |
-
#: includes/admin/reporting/reports.php:
|
2490 |
-
msgid "
|
2491 |
msgstr ""
|
2492 |
|
2493 |
-
#: includes/admin/reporting/reports.php:
|
2494 |
msgid "Export Download History in CSV"
|
2495 |
msgstr ""
|
2496 |
|
2497 |
-
#: includes/admin/reporting/reports.php:
|
2498 |
-
msgid "Download a CSV of
|
2499 |
msgstr ""
|
2500 |
|
2501 |
#: includes/admin/settings/contextual-help.php:43
|
@@ -2506,8 +2576,8 @@ msgid ""
|
|
2506 |
msgstr ""
|
2507 |
|
2508 |
#: includes/admin/settings/contextual-help.php:48
|
2509 |
-
#: includes/admin/settings/register-settings.php:
|
2510 |
-
#: includes/admin/settings/register-settings.php:
|
2511 |
msgid "Payment Gateways"
|
2512 |
msgstr ""
|
2513 |
|
@@ -2535,6 +2605,11 @@ msgid ""
|
|
2535 |
"address in order for payments to get processed."
|
2536 |
msgstr ""
|
2537 |
|
|
|
|
|
|
|
|
|
|
|
2538 |
#: includes/admin/settings/contextual-help.php:59
|
2539 |
msgid ""
|
2540 |
"This screen allows you to customize how emails act throughout your store. "
|
@@ -2551,7 +2626,7 @@ msgid ""
|
|
2551 |
msgstr ""
|
2552 |
|
2553 |
#: includes/admin/settings/contextual-help.php:65
|
2554 |
-
#: includes/admin/settings/register-settings.php:
|
2555 |
msgid "Styles"
|
2556 |
msgstr ""
|
2557 |
|
@@ -2647,153 +2722,142 @@ msgstr ""
|
|
2647 |
msgid "A description of all the options are provided beside their input boxes."
|
2648 |
msgstr ""
|
2649 |
|
2650 |
-
#: includes/admin/settings/register-settings.php:220
|
2651 |
-
msgid "Test Mode"
|
2652 |
-
msgstr ""
|
2653 |
-
|
2654 |
#: includes/admin/settings/register-settings.php:221
|
2655 |
-
msgid ""
|
2656 |
-
"While in test mode no live transactions are processed. To fully use test "
|
2657 |
-
"mode, you must have a sandbox (test) account for the payment gateway you "
|
2658 |
-
"are testing."
|
2659 |
-
msgstr ""
|
2660 |
-
|
2661 |
-
#: includes/admin/settings/register-settings.php:226
|
2662 |
msgid "Checkout Page"
|
2663 |
msgstr ""
|
2664 |
|
2665 |
-
#: includes/admin/settings/register-settings.php:
|
2666 |
msgid ""
|
2667 |
"This is the checkout page where buyers will complete their purchases. The "
|
2668 |
"[download_checkout] short code must be on this page."
|
2669 |
msgstr ""
|
2670 |
|
2671 |
-
#: includes/admin/settings/register-settings.php:
|
2672 |
-
#: includes/admin/settings/register-settings.php:
|
2673 |
-
#: includes/admin/settings/register-settings.php:
|
2674 |
-
#: includes/admin/settings/register-settings.php:
|
2675 |
msgid "Select a page"
|
2676 |
msgstr ""
|
2677 |
|
2678 |
-
#: includes/admin/settings/register-settings.php:
|
2679 |
msgid "Success Page"
|
2680 |
msgstr ""
|
2681 |
|
2682 |
-
#: includes/admin/settings/register-settings.php:
|
2683 |
msgid ""
|
2684 |
"This is the page buyers are sent to after completing their purchases. The "
|
2685 |
"[edd_receipt] short code should be on this page."
|
2686 |
msgstr ""
|
2687 |
|
2688 |
-
#: includes/admin/settings/register-settings.php:
|
2689 |
msgid "Failed Transaction Page"
|
2690 |
msgstr ""
|
2691 |
|
2692 |
-
#: includes/admin/settings/register-settings.php:
|
2693 |
msgid ""
|
2694 |
"This is the page buyers are sent to if their transaction is cancelled or "
|
2695 |
"fails"
|
2696 |
msgstr ""
|
2697 |
|
2698 |
-
#: includes/admin/settings/register-settings.php:
|
2699 |
msgid "Purchase History Page"
|
2700 |
msgstr ""
|
2701 |
|
2702 |
-
#: includes/admin/settings/register-settings.php:
|
2703 |
msgid ""
|
2704 |
"This page shows a complete purchase history for the current user, including "
|
2705 |
"download links"
|
2706 |
msgstr ""
|
2707 |
|
2708 |
-
#: includes/admin/settings/register-settings.php:
|
2709 |
msgid "Base Country"
|
2710 |
msgstr ""
|
2711 |
|
2712 |
-
#: includes/admin/settings/register-settings.php:
|
2713 |
msgid "Where does your store operate from?"
|
2714 |
msgstr ""
|
2715 |
|
2716 |
-
#: includes/admin/settings/register-settings.php:
|
2717 |
msgid "Base State / Province"
|
2718 |
msgstr ""
|
2719 |
|
2720 |
-
#: includes/admin/settings/register-settings.php:
|
2721 |
msgid "What state / province does your store operate from?"
|
2722 |
msgstr ""
|
2723 |
|
2724 |
-
#: includes/admin/settings/register-settings.php:
|
2725 |
msgid "Currency Settings"
|
2726 |
msgstr ""
|
2727 |
|
2728 |
-
#: includes/admin/settings/register-settings.php:
|
2729 |
msgid "Configure the currency options"
|
2730 |
msgstr ""
|
2731 |
|
2732 |
-
#: includes/admin/settings/register-settings.php:
|
2733 |
msgid "Currency"
|
2734 |
msgstr ""
|
2735 |
|
2736 |
-
#: includes/admin/settings/register-settings.php:
|
2737 |
msgid ""
|
2738 |
"Choose your currency. Note that some payment gateways have currency "
|
2739 |
"restrictions."
|
2740 |
msgstr ""
|
2741 |
|
2742 |
-
#: includes/admin/settings/register-settings.php:
|
2743 |
msgid "Currency Position"
|
2744 |
msgstr ""
|
2745 |
|
2746 |
-
#: includes/admin/settings/register-settings.php:
|
2747 |
msgid "Choose the location of the currency sign."
|
2748 |
msgstr ""
|
2749 |
|
2750 |
-
#: includes/admin/settings/register-settings.php:
|
2751 |
msgid "Before - $10"
|
2752 |
msgstr ""
|
2753 |
|
2754 |
-
#: includes/admin/settings/register-settings.php:
|
2755 |
msgid "After - 10$"
|
2756 |
msgstr ""
|
2757 |
|
2758 |
-
#: includes/admin/settings/register-settings.php:
|
2759 |
msgid "Thousands Separator"
|
2760 |
msgstr ""
|
2761 |
|
2762 |
-
#: includes/admin/settings/register-settings.php:
|
2763 |
msgid "The symbol (usually , or .) to separate thousands"
|
2764 |
msgstr ""
|
2765 |
|
2766 |
-
#: includes/admin/settings/register-settings.php:
|
2767 |
msgid "Decimal Separator"
|
2768 |
msgstr ""
|
2769 |
|
2770 |
-
#: includes/admin/settings/register-settings.php:
|
2771 |
msgid "The symbol (usually , or .) to separate decimal points"
|
2772 |
msgstr ""
|
2773 |
|
2774 |
-
#: includes/admin/settings/register-settings.php:
|
2775 |
msgid "API Settings"
|
2776 |
msgstr ""
|
2777 |
|
2778 |
-
#: includes/admin/settings/register-settings.php:
|
2779 |
msgid "Allow User Keys"
|
2780 |
msgstr ""
|
2781 |
|
2782 |
-
#: includes/admin/settings/register-settings.php:
|
2783 |
msgid ""
|
2784 |
"Check this box to allow all users to generate API keys. Users with the "
|
2785 |
"'manage_shop_settings' capability are always allowed to generate keys."
|
2786 |
msgstr ""
|
2787 |
|
2788 |
-
#: includes/admin/settings/register-settings.php:
|
2789 |
msgid "Tracking Settings"
|
2790 |
msgstr ""
|
2791 |
|
2792 |
-
#: includes/admin/settings/register-settings.php:
|
2793 |
msgid "Allow Usage Tracking?"
|
2794 |
msgstr ""
|
2795 |
|
2796 |
-
#: includes/admin/settings/register-settings.php:
|
2797 |
msgid ""
|
2798 |
"Allow Easy Digital Downloads to anonymously track how this plugin is used "
|
2799 |
"and help us make the plugin better. Opt-in and receive a 20% discount code "
|
@@ -2802,580 +2866,608 @@ msgid ""
|
|
2802 |
"Digital Downloads store</a>. Your discount code will be emailed to you."
|
2803 |
msgstr ""
|
2804 |
|
2805 |
-
#: includes/admin/settings/register-settings.php:
|
2806 |
msgid "Remove Data on Uninstall?"
|
2807 |
msgstr ""
|
2808 |
|
2809 |
-
#: includes/admin/settings/register-settings.php:
|
2810 |
msgid ""
|
2811 |
"Check this box if you would like EDD to completely remove all of its data "
|
2812 |
"when the plugin is deleted."
|
2813 |
msgstr ""
|
2814 |
|
2815 |
-
#: includes/admin/settings/register-settings.php:
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
2816 |
msgid "Choose the payment gateways you want to enable."
|
2817 |
msgstr ""
|
2818 |
|
2819 |
-
#: includes/admin/settings/register-settings.php:
|
2820 |
msgid "Default Gateway"
|
2821 |
msgstr ""
|
2822 |
|
2823 |
-
#: includes/admin/settings/register-settings.php:
|
2824 |
msgid "This gateway will be loaded automatically with the checkout page."
|
2825 |
msgstr ""
|
2826 |
|
2827 |
-
#: includes/admin/settings/register-settings.php:
|
2828 |
msgid "Accepted Payment Method Icons"
|
2829 |
msgstr ""
|
2830 |
|
2831 |
-
#: includes/admin/settings/register-settings.php:
|
2832 |
msgid "Display icons for the selected payment methods"
|
2833 |
msgstr ""
|
2834 |
|
2835 |
-
#: includes/admin/settings/register-settings.php:
|
2836 |
msgid ""
|
2837 |
"You will also need to configure your gateway settings if you are accepting "
|
2838 |
"credit cards"
|
2839 |
msgstr ""
|
2840 |
|
2841 |
-
#: includes/admin/settings/register-settings.php:
|
2842 |
msgid "PayPal Settings"
|
2843 |
msgstr ""
|
2844 |
|
2845 |
-
#: includes/admin/settings/register-settings.php:
|
2846 |
msgid "Configure the PayPal settings"
|
2847 |
msgstr ""
|
2848 |
|
2849 |
-
#: includes/admin/settings/register-settings.php:
|
2850 |
msgid "PayPal Email"
|
2851 |
msgstr ""
|
2852 |
|
2853 |
-
#: includes/admin/settings/register-settings.php:
|
2854 |
msgid "Enter your PayPal account's email"
|
2855 |
msgstr ""
|
2856 |
|
2857 |
-
#: includes/admin/settings/register-settings.php:
|
2858 |
msgid "PayPal Page Style"
|
2859 |
msgstr ""
|
2860 |
|
2861 |
-
#: includes/admin/settings/register-settings.php:
|
2862 |
msgid "Enter the name of the page style to use, or leave blank for default"
|
2863 |
msgstr ""
|
2864 |
|
2865 |
-
#: includes/admin/settings/register-settings.php:
|
2866 |
msgid "Disable PayPal IPN Verification"
|
2867 |
msgstr ""
|
2868 |
|
2869 |
-
#: includes/admin/settings/register-settings.php:
|
2870 |
msgid ""
|
2871 |
"If payments are not getting marked as complete, then check this box. This "
|
2872 |
"forces the site to use a slightly less secure method of verifying purchases."
|
2873 |
msgstr ""
|
2874 |
|
2875 |
-
#: includes/admin/settings/register-settings.php:
|
2876 |
msgid "Email Template"
|
2877 |
msgstr ""
|
2878 |
|
2879 |
-
#: includes/admin/settings/register-settings.php:
|
2880 |
msgid ""
|
2881 |
"Choose a template. Click \"Save Changes\" then \"Preview Purchase Receipt\" "
|
2882 |
"to see the new template."
|
2883 |
msgstr ""
|
2884 |
|
2885 |
-
#: includes/admin/settings/register-settings.php:
|
2886 |
msgid "Logo"
|
2887 |
msgstr ""
|
2888 |
|
2889 |
-
#: includes/admin/settings/register-settings.php:
|
2890 |
msgid ""
|
2891 |
"Upload or choose a logo to be displayed at the top of the purchase receipt "
|
2892 |
"emails. Displayed on HTML emails only."
|
2893 |
msgstr ""
|
2894 |
|
2895 |
-
#: includes/admin/settings/register-settings.php:
|
2896 |
msgid "From Name"
|
2897 |
msgstr ""
|
2898 |
|
2899 |
-
#: includes/admin/settings/register-settings.php:
|
2900 |
msgid ""
|
2901 |
"The name purchase receipts are said to come from. This should probably be "
|
2902 |
"your site or shop name."
|
2903 |
msgstr ""
|
2904 |
|
2905 |
-
#: includes/admin/settings/register-settings.php:
|
2906 |
msgid "From Email"
|
2907 |
msgstr ""
|
2908 |
|
2909 |
-
#: includes/admin/settings/register-settings.php:
|
2910 |
msgid ""
|
2911 |
"Email to send purchase receipts from. This will act as the \"from\" and "
|
2912 |
"\"reply-to\" address."
|
2913 |
msgstr ""
|
2914 |
|
2915 |
-
#: includes/admin/settings/register-settings.php:
|
2916 |
msgid "Purchase Email Subject"
|
2917 |
msgstr ""
|
2918 |
|
2919 |
-
#: includes/admin/settings/register-settings.php:
|
2920 |
msgid "Enter the subject line for the purchase receipt email"
|
2921 |
msgstr ""
|
2922 |
|
2923 |
-
#: includes/admin/settings/register-settings.php:
|
2924 |
-
#: includes/admin/settings/register-settings.php:
|
2925 |
-
#: includes/
|
2926 |
-
#: includes/emails/functions.php:
|
|
|
2927 |
#: includes/emails/template.php:139
|
2928 |
msgid "Purchase Receipt"
|
2929 |
msgstr ""
|
2930 |
|
2931 |
#: includes/admin/settings/register-settings.php:454
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
2932 |
#: includes/deprecated-functions.php:301
|
2933 |
msgid ""
|
2934 |
"Enter the email that is sent to users after completing a successful "
|
2935 |
"purchase. HTML is accepted. Available template tags:"
|
2936 |
msgstr ""
|
2937 |
|
2938 |
-
#: includes/admin/settings/register-settings.php:
|
2939 |
#: includes/emails/template.php:157
|
2940 |
msgid "Dear"
|
2941 |
msgstr ""
|
2942 |
|
2943 |
-
#: includes/admin/settings/register-settings.php:
|
2944 |
#: includes/emails/template.php:158
|
2945 |
msgid ""
|
2946 |
"Thank you for your purchase. Please click on the link(s) below to download "
|
2947 |
"your files."
|
2948 |
msgstr ""
|
2949 |
|
2950 |
-
#: includes/admin/settings/register-settings.php:
|
2951 |
msgid "New Sale Notifications"
|
2952 |
msgstr ""
|
2953 |
|
2954 |
-
#: includes/admin/settings/register-settings.php:
|
2955 |
msgid "Configure new sale notification emails"
|
2956 |
msgstr ""
|
2957 |
|
2958 |
-
#: includes/admin/settings/register-settings.php:
|
2959 |
msgid "Sale Notification Subject"
|
2960 |
msgstr ""
|
2961 |
|
2962 |
-
#: includes/admin/settings/register-settings.php:
|
2963 |
msgid "Enter the subject line for the sale notification email"
|
2964 |
msgstr ""
|
2965 |
|
2966 |
-
#: includes/admin/settings/register-settings.php:
|
2967 |
msgid "Sale Notification"
|
2968 |
msgstr ""
|
2969 |
|
2970 |
-
#: includes/admin/settings/register-settings.php:
|
2971 |
#: includes/deprecated-functions.php:334
|
2972 |
msgid ""
|
2973 |
"Enter the email that is sent to sale notification emails after completion "
|
2974 |
"of a purchase. HTML is accepted. Available template tags:"
|
2975 |
msgstr ""
|
2976 |
|
2977 |
-
#: includes/admin/settings/register-settings.php:
|
2978 |
msgid "Sale Notification Emails"
|
2979 |
msgstr ""
|
2980 |
|
2981 |
-
#: includes/admin/settings/register-settings.php:
|
2982 |
msgid ""
|
2983 |
"Enter the email address(es) that should receive a notification anytime a "
|
2984 |
"sale is made, one per line"
|
2985 |
msgstr ""
|
2986 |
|
2987 |
-
#: includes/admin/settings/register-settings.php:
|
2988 |
msgid "Disable Admin Notifications"
|
2989 |
msgstr ""
|
2990 |
|
2991 |
-
#: includes/admin/settings/register-settings.php:
|
2992 |
msgid "Check this box if you do not want to receive emails when new sales are made."
|
2993 |
msgstr ""
|
2994 |
|
2995 |
-
#: includes/admin/settings/register-settings.php:
|
2996 |
msgid "Disable Styles"
|
2997 |
msgstr ""
|
2998 |
|
2999 |
-
#: includes/admin/settings/register-settings.php:
|
3000 |
msgid ""
|
3001 |
"Check this to disable all included styling of buttons, checkout fields, and "
|
3002 |
"all other elements."
|
3003 |
msgstr ""
|
3004 |
|
3005 |
-
#: includes/admin/settings/register-settings.php:
|
3006 |
msgid "Buttons"
|
3007 |
msgstr ""
|
3008 |
|
3009 |
-
#: includes/admin/settings/register-settings.php:
|
3010 |
msgid "Options for add to cart and purchase buttons"
|
3011 |
msgstr ""
|
3012 |
|
3013 |
-
#: includes/admin/settings/register-settings.php:
|
3014 |
msgid "Default Button Style"
|
3015 |
msgstr ""
|
3016 |
|
3017 |
-
#: includes/admin/settings/register-settings.php:
|
3018 |
msgid "Choose the style you want to use for the buttons."
|
3019 |
msgstr ""
|
3020 |
|
3021 |
-
#: includes/admin/settings/register-settings.php:
|
3022 |
msgid "Default Button Color"
|
3023 |
msgstr ""
|
3024 |
|
3025 |
-
#: includes/admin/settings/register-settings.php:
|
3026 |
msgid "Choose the color you want to use for the buttons."
|
3027 |
msgstr ""
|
3028 |
|
3029 |
-
#: includes/admin/settings/register-settings.php:
|
3030 |
msgid "Enable Taxes"
|
3031 |
msgstr ""
|
3032 |
|
3033 |
-
#: includes/admin/settings/register-settings.php:
|
3034 |
msgid "Check this to enable taxes on purchases."
|
3035 |
msgstr ""
|
3036 |
|
3037 |
-
#: includes/admin/settings/register-settings.php:
|
3038 |
msgid "Tax Rates"
|
3039 |
msgstr ""
|
3040 |
|
3041 |
-
#: includes/admin/settings/register-settings.php:
|
3042 |
msgid "Enter tax rates for specific regions."
|
3043 |
msgstr ""
|
3044 |
|
3045 |
-
#: includes/admin/settings/register-settings.php:
|
3046 |
msgid "Fallback Tax Rate"
|
3047 |
msgstr ""
|
3048 |
|
3049 |
-
#: includes/admin/settings/register-settings.php:
|
3050 |
msgid ""
|
3051 |
"Enter a percentage, such as 6.5. Customers not in a specific rate will be "
|
3052 |
"charged this rate."
|
3053 |
msgstr ""
|
3054 |
|
3055 |
-
#: includes/admin/settings/register-settings.php:
|
3056 |
msgid "Prices entered with tax"
|
3057 |
msgstr ""
|
3058 |
|
3059 |
-
#: includes/admin/settings/register-settings.php:
|
3060 |
msgid "This option affects how you enter prices."
|
3061 |
msgstr ""
|
3062 |
|
3063 |
-
#: includes/admin/settings/register-settings.php:
|
3064 |
msgid "Yes, I will enter prices inclusive of tax"
|
3065 |
msgstr ""
|
3066 |
|
3067 |
-
#: includes/admin/settings/register-settings.php:
|
3068 |
msgid "No, I will enter prices exclusive of tax"
|
3069 |
msgstr ""
|
3070 |
|
3071 |
-
#: includes/admin/settings/register-settings.php:
|
3072 |
msgid "Display Tax Rate on Prices"
|
3073 |
msgstr ""
|
3074 |
|
3075 |
-
#: includes/admin/settings/register-settings.php:
|
3076 |
msgid "Some countries require a notice when product prices include tax."
|
3077 |
msgstr ""
|
3078 |
|
3079 |
-
#: includes/admin/settings/register-settings.php:
|
3080 |
msgid "Display during checkout"
|
3081 |
msgstr ""
|
3082 |
|
3083 |
-
#: includes/admin/settings/register-settings.php:
|
3084 |
msgid "Should prices on the checkout page be shown with or without tax?"
|
3085 |
msgstr ""
|
3086 |
|
3087 |
-
#: includes/admin/settings/register-settings.php:
|
3088 |
msgid "Including tax"
|
3089 |
msgstr ""
|
3090 |
|
3091 |
-
#: includes/admin/settings/register-settings.php:
|
3092 |
msgid "Excluding tax"
|
3093 |
msgstr ""
|
3094 |
|
3095 |
-
#: includes/admin/settings/register-settings.php:
|
3096 |
msgid "Enable Ajax"
|
3097 |
msgstr ""
|
3098 |
|
3099 |
-
#: includes/admin/settings/register-settings.php:
|
3100 |
msgid "Check this to enable AJAX for the shopping cart."
|
3101 |
msgstr ""
|
3102 |
|
3103 |
-
#: includes/admin/settings/register-settings.php:
|
3104 |
msgid "Redirect to Checkout"
|
3105 |
msgstr ""
|
3106 |
|
3107 |
-
#: includes/admin/settings/register-settings.php:
|
3108 |
msgid "Immediately redirect to checkout after adding an item to the cart?"
|
3109 |
msgstr ""
|
3110 |
|
3111 |
-
#: includes/admin/settings/register-settings.php:
|
3112 |
msgid "Enforce SSL on Checkout"
|
3113 |
msgstr ""
|
3114 |
|
3115 |
-
#: includes/admin/settings/register-settings.php:
|
3116 |
msgid ""
|
3117 |
"Check this to force users to be redirected to the secure checkout page. You "
|
3118 |
"must have an SSL certificate installed to use this option."
|
3119 |
msgstr ""
|
3120 |
|
3121 |
-
#: includes/admin/settings/register-settings.php:
|
3122 |
msgid "Disable Guest Checkout"
|
3123 |
msgstr ""
|
3124 |
|
3125 |
-
#: includes/admin/settings/register-settings.php:
|
3126 |
msgid "Require that users be logged-in to purchase files."
|
3127 |
msgstr ""
|
3128 |
|
3129 |
-
#: includes/admin/settings/register-settings.php:
|
3130 |
msgid "Show Register / Login Form?"
|
3131 |
msgstr ""
|
3132 |
|
3133 |
-
#: includes/admin/settings/register-settings.php:
|
3134 |
msgid ""
|
3135 |
"Display the registration and login forms on the checkout page for "
|
3136 |
"non-logged-in users."
|
3137 |
msgstr ""
|
3138 |
|
3139 |
-
#: includes/admin/settings/register-settings.php:
|
3140 |
msgid "Registration and Login Forms"
|
3141 |
msgstr ""
|
3142 |
|
3143 |
-
#: includes/admin/settings/register-settings.php:
|
3144 |
msgid "Registration Form Only"
|
3145 |
msgstr ""
|
3146 |
|
3147 |
-
#: includes/admin/settings/register-settings.php:
|
3148 |
msgid "Login Form Only"
|
3149 |
msgstr ""
|
3150 |
|
3151 |
-
#: includes/admin/settings/register-settings.php:
|
3152 |
msgid "Item Quantities"
|
3153 |
msgstr ""
|
3154 |
|
3155 |
-
#: includes/admin/settings/register-settings.php:
|
3156 |
msgid "Allow item quantities to be changed."
|
3157 |
msgstr ""
|
3158 |
|
3159 |
-
#: includes/admin/settings/register-settings.php:
|
3160 |
msgid "Multiple Discounts"
|
3161 |
msgstr ""
|
3162 |
|
3163 |
-
#: includes/admin/settings/register-settings.php:
|
3164 |
msgid "Allow customers to use multiple discounts on the same purchase?"
|
3165 |
msgstr ""
|
3166 |
|
3167 |
-
#: includes/admin/settings/register-settings.php:
|
3168 |
msgid "Enable Cart Saving"
|
3169 |
msgstr ""
|
3170 |
|
3171 |
-
#: includes/admin/settings/register-settings.php:
|
3172 |
msgid "Check this to enable cart saving on the checkout."
|
3173 |
msgstr ""
|
3174 |
|
3175 |
-
#: includes/admin/settings/register-settings.php:
|
3176 |
msgid "Download Method"
|
3177 |
msgstr ""
|
3178 |
|
3179 |
-
#: includes/admin/settings/register-settings.php:
|
3180 |
msgid "Select the file download method. Note, not all methods work on all servers."
|
3181 |
msgstr ""
|
3182 |
|
3183 |
-
#: includes/admin/settings/register-settings.php:
|
3184 |
msgid "Forced"
|
3185 |
msgstr ""
|
3186 |
|
3187 |
-
#: includes/admin/settings/register-settings.php:
|
3188 |
msgid "Redirect"
|
3189 |
msgstr ""
|
3190 |
|
3191 |
-
#: includes/admin/settings/register-settings.php:
|
3192 |
msgid "Symlink File Downloads?"
|
3193 |
msgstr ""
|
3194 |
|
3195 |
-
#: includes/admin/settings/register-settings.php:
|
3196 |
msgid ""
|
3197 |
"Check this if you are delivering really large files or having problems with "
|
3198 |
"file downloads completing."
|
3199 |
msgstr ""
|
3200 |
|
3201 |
-
#: includes/admin/settings/register-settings.php:
|
3202 |
msgid "File Download Limit"
|
3203 |
msgstr ""
|
3204 |
|
3205 |
-
#: includes/admin/settings/register-settings.php:
|
3206 |
msgid ""
|
3207 |
"The maximum number of times files can be downloaded for purchases. Can be "
|
3208 |
"overwritten for each %s."
|
3209 |
msgstr ""
|
3210 |
|
3211 |
-
#: includes/admin/settings/register-settings.php:
|
3212 |
msgid "Download Link Expiration"
|
3213 |
msgstr ""
|
3214 |
|
3215 |
-
#: includes/admin/settings/register-settings.php:
|
3216 |
msgid ""
|
3217 |
"How long should download links be valid for? Default is 24 hours from the "
|
3218 |
"time they are generated. Enter a time in hours."
|
3219 |
msgstr ""
|
3220 |
|
3221 |
-
#: includes/admin/settings/register-settings.php:
|
3222 |
msgid "Disable Redownload?"
|
3223 |
msgstr ""
|
3224 |
|
3225 |
-
#: includes/admin/settings/register-settings.php:
|
3226 |
msgid ""
|
3227 |
"Check this if you do not want to allow users to redownload items from their "
|
3228 |
"purchase history."
|
3229 |
msgstr ""
|
3230 |
|
3231 |
-
#: includes/admin/settings/register-settings.php:
|
3232 |
msgid "Accounting Settings"
|
3233 |
msgstr ""
|
3234 |
|
3235 |
-
#: includes/admin/settings/register-settings.php:
|
3236 |
msgid "Enable SKU Entry"
|
3237 |
msgstr ""
|
3238 |
|
3239 |
-
#: includes/admin/settings/register-settings.php:
|
3240 |
msgid ""
|
3241 |
"Check this box to allow entry of product SKUs. SKUs will be shown on "
|
3242 |
"purchase receipt and exported purchase histories."
|
3243 |
msgstr ""
|
3244 |
|
3245 |
-
#: includes/admin/settings/register-settings.php:
|
3246 |
msgid "Sequential Order Numbers"
|
3247 |
msgstr ""
|
3248 |
|
3249 |
-
#: includes/admin/settings/register-settings.php:
|
3250 |
-
msgid "Check this box to sequential order numbers."
|
3251 |
msgstr ""
|
3252 |
|
3253 |
-
#: includes/admin/settings/register-settings.php:
|
3254 |
msgid "Sequential Starting Number"
|
3255 |
msgstr ""
|
3256 |
|
3257 |
-
#: includes/admin/settings/register-settings.php:
|
3258 |
msgid "The number that sequential order numbers should start at."
|
3259 |
msgstr ""
|
3260 |
|
3261 |
-
#: includes/admin/settings/register-settings.php:
|
3262 |
msgid "Sequential Number Prefix"
|
3263 |
msgstr ""
|
3264 |
|
3265 |
-
#: includes/admin/settings/register-settings.php:
|
3266 |
msgid "A prefix to prepend to all sequential order numbers."
|
3267 |
msgstr ""
|
3268 |
|
3269 |
-
#: includes/admin/settings/register-settings.php:
|
3270 |
msgid "Sequential Number Postfix"
|
3271 |
msgstr ""
|
3272 |
|
3273 |
-
#: includes/admin/settings/register-settings.php:
|
3274 |
msgid "A postfix to append to all sequential order numbers."
|
3275 |
msgstr ""
|
3276 |
|
3277 |
-
#: includes/admin/settings/register-settings.php:
|
3278 |
msgid "Terms of Agreement"
|
3279 |
msgstr ""
|
3280 |
|
3281 |
-
#: includes/admin/settings/register-settings.php:
|
3282 |
msgid "Agree to Terms"
|
3283 |
msgstr ""
|
3284 |
|
3285 |
-
#: includes/admin/settings/register-settings.php:
|
3286 |
msgid ""
|
3287 |
"Check this to show an agree to terms on the checkout that users must agree "
|
3288 |
"to before purchasing."
|
3289 |
msgstr ""
|
3290 |
|
3291 |
-
#: includes/admin/settings/register-settings.php:
|
3292 |
msgid "Agree to Terms Label"
|
3293 |
msgstr ""
|
3294 |
|
3295 |
-
#: includes/admin/settings/register-settings.php:
|
3296 |
msgid "Label shown next to the agree to terms check box."
|
3297 |
msgstr ""
|
3298 |
|
3299 |
-
#: includes/admin/settings/register-settings.php:
|
3300 |
msgid "Agreement Text"
|
3301 |
msgstr ""
|
3302 |
|
3303 |
-
#: includes/admin/settings/register-settings.php:
|
3304 |
msgid "If Agree to Terms is checked, enter the agreement terms here."
|
3305 |
msgstr ""
|
3306 |
|
3307 |
-
#: includes/admin/settings/register-settings.php:
|
3308 |
msgid "Complete Purchase Text"
|
3309 |
msgstr ""
|
3310 |
|
3311 |
-
#: includes/admin/settings/register-settings.php:
|
3312 |
msgid "The button label for completing a purchase."
|
3313 |
msgstr ""
|
3314 |
|
3315 |
-
#: includes/admin/settings/register-settings.php:
|
3316 |
msgid "Add to Cart Text"
|
3317 |
msgstr ""
|
3318 |
|
3319 |
-
#: includes/admin/settings/register-settings.php:
|
3320 |
msgid "Text shown on the Add to Cart Buttons."
|
3321 |
msgstr ""
|
3322 |
|
3323 |
-
#: includes/admin/settings/register-settings.php:
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
3324 |
msgid "Settings updated."
|
3325 |
msgstr ""
|
3326 |
|
3327 |
-
#: includes/admin/settings/register-settings.php:
|
3328 |
msgid "Licenses"
|
3329 |
msgstr ""
|
3330 |
|
3331 |
-
#: includes/admin/settings/register-settings.php:
|
3332 |
msgid "Misc"
|
3333 |
msgstr ""
|
3334 |
|
3335 |
-
#: includes/admin/settings/register-settings.php:
|
3336 |
msgid "The callback function used for the <strong>%s</strong> setting is missing."
|
3337 |
msgstr ""
|
3338 |
|
3339 |
-
#: includes/admin/settings/register-settings.php:
|
3340 |
msgid "Upload File"
|
3341 |
msgstr ""
|
3342 |
|
3343 |
-
#: includes/admin/settings/register-settings.php:
|
3344 |
msgid "Apply rate to whole country, regardless of state / province"
|
3345 |
msgstr ""
|
3346 |
|
3347 |
-
#: includes/admin/settings/register-settings.php:
|
3348 |
msgid "Country Wide"
|
3349 |
msgstr ""
|
3350 |
|
3351 |
-
#: includes/admin/settings/register-settings.php:
|
3352 |
msgid "Rate"
|
3353 |
msgstr ""
|
3354 |
|
3355 |
-
#: includes/admin/settings/register-settings.php:
|
3356 |
-
#: includes/admin/settings/register-settings.php:
|
3357 |
msgid "Choose a country"
|
3358 |
msgstr ""
|
3359 |
|
3360 |
-
#: includes/admin/settings/register-settings.php:
|
3361 |
msgid "Choose a state"
|
3362 |
msgstr ""
|
3363 |
|
3364 |
-
#: includes/admin/settings/register-settings.php:
|
3365 |
-
#: includes/admin/settings/register-settings.php:
|
3366 |
msgid "Apply to whole country"
|
3367 |
msgstr ""
|
3368 |
|
3369 |
-
#: includes/admin/settings/register-settings.php:
|
3370 |
-
#: includes/admin/settings/register-settings.php:
|
3371 |
msgid "Remove Rate"
|
3372 |
msgstr ""
|
3373 |
|
3374 |
-
#: includes/admin/settings/register-settings.php:
|
3375 |
msgid "Add Tax Rate"
|
3376 |
msgstr ""
|
3377 |
|
3378 |
-
#: includes/admin/settings/register-settings.php:
|
3379 |
msgid "Deactivate License"
|
3380 |
msgstr ""
|
3381 |
|
@@ -3467,41 +3559,41 @@ msgid ""
|
|
3467 |
"such as the <a href=\"%s\">EDD mobile apps</a>."
|
3468 |
msgstr ""
|
3469 |
|
3470 |
-
#: includes/admin/tools.php:
|
3471 |
msgid "Export Settings"
|
3472 |
msgstr ""
|
3473 |
|
3474 |
-
#: includes/admin/tools.php:
|
3475 |
msgid ""
|
3476 |
"Export the Easy Digital Downloads settings for this site as a .json file. "
|
3477 |
"This allows you to easily import the configuration into another site."
|
3478 |
msgstr ""
|
3479 |
|
3480 |
-
#: includes/admin/tools.php:
|
3481 |
msgid ""
|
3482 |
"To export shop data (purchases, customers, etc), visit the <a "
|
3483 |
"href=\"%s\">Reports</a> page."
|
3484 |
msgstr ""
|
3485 |
|
3486 |
-
#: includes/admin/tools.php:
|
3487 |
msgid "Import Settings"
|
3488 |
msgstr ""
|
3489 |
|
3490 |
-
#: includes/admin/tools.php:
|
3491 |
msgid ""
|
3492 |
"Import the Easy Digital Downloads settings from a .json file. This file can "
|
3493 |
"be obtained by exporting the settings on another site using the form above."
|
3494 |
msgstr ""
|
3495 |
|
3496 |
-
#: includes/admin/tools.php:
|
3497 |
msgid "Import"
|
3498 |
msgstr ""
|
3499 |
|
3500 |
-
#: includes/admin/tools.php:
|
3501 |
msgid "Please upload a valid .json file"
|
3502 |
msgstr ""
|
3503 |
|
3504 |
-
#: includes/admin/tools.php:
|
3505 |
msgid "Please upload a file to import"
|
3506 |
msgstr ""
|
3507 |
|
@@ -3579,20 +3671,27 @@ msgid ""
|
|
3579 |
"href=\"%s\">here</a> to start the upgrade."
|
3580 |
msgstr ""
|
3581 |
|
3582 |
-
#: includes/admin/upgrades/upgrade-functions.php:
|
3583 |
-
|
3584 |
-
|
3585 |
-
|
3586 |
-
|
3587 |
-
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
3588 |
msgid "You do not have permission to do shop upgrades"
|
3589 |
msgstr ""
|
3590 |
|
3591 |
-
#: includes/admin/upgrades/upgrade-functions.php:
|
3592 |
msgid "Transaction Failed"
|
3593 |
msgstr ""
|
3594 |
|
3595 |
-
#: includes/admin/upgrades/upgrade-functions.php:
|
3596 |
msgid "Your transaction failed, please try again or contact site support."
|
3597 |
msgstr ""
|
3598 |
|
@@ -4011,40 +4110,117 @@ msgstr ""
|
|
4011 |
msgid "No valid changlog was found."
|
4012 |
msgstr ""
|
4013 |
|
4014 |
-
#: includes/ajax-functions.php:
|
4015 |
msgid "No results found"
|
4016 |
msgstr ""
|
4017 |
|
4018 |
-
#: includes/ajax-functions.php:
|
4019 |
msgid "No users found"
|
4020 |
msgstr ""
|
4021 |
|
4022 |
-
#: includes/
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
4023 |
msgid "includes %s tax"
|
4024 |
msgstr ""
|
4025 |
|
4026 |
-
#: includes/cart/functions.php:
|
4027 |
msgid "excludes %s tax"
|
4028 |
msgstr ""
|
4029 |
|
4030 |
-
#: includes/cart/functions.php:
|
4031 |
#: templates/shortcode-profile-editor.php:20
|
4032 |
msgid "Success"
|
4033 |
msgstr ""
|
4034 |
|
4035 |
-
#: includes/cart/functions.php:
|
4036 |
msgid "Cart saved successfully. You can restore your cart using this URL:"
|
4037 |
msgstr ""
|
4038 |
|
4039 |
-
#: includes/cart/functions.php:
|
4040 |
msgid "Cart restoration failed. Invalid token."
|
4041 |
msgstr ""
|
4042 |
|
4043 |
-
#: includes/cart/functions.php:
|
4044 |
msgid "The cart cannot be restored. Invalid token."
|
4045 |
msgstr ""
|
4046 |
|
4047 |
-
#: includes/cart/functions.php:
|
4048 |
msgid "Cart restored successfully."
|
4049 |
msgstr ""
|
4050 |
|
@@ -4068,343 +4244,270 @@ msgstr ""
|
|
4068 |
msgid "Update Cart"
|
4069 |
msgstr ""
|
4070 |
|
4071 |
-
#: includes/cart/template.php:
|
4072 |
msgid "You have successfully added %s to your shopping cart."
|
4073 |
msgstr ""
|
4074 |
|
4075 |
-
#: includes/cart/template.php:
|
4076 |
msgid "Checkout."
|
4077 |
msgstr ""
|
4078 |
|
4079 |
-
#: includes/checkout/template.php:
|
4080 |
msgid "Personal Info"
|
4081 |
msgstr ""
|
4082 |
|
4083 |
-
#: includes/checkout/template.php:
|
4084 |
#: templates/shortcode-register.php:24
|
4085 |
msgid "Email Address"
|
4086 |
msgstr ""
|
4087 |
|
4088 |
-
#: includes/checkout/template.php:
|
4089 |
msgid "We will send the purchase receipt to this address."
|
4090 |
msgstr ""
|
4091 |
|
4092 |
-
#: includes/checkout/template.php:
|
4093 |
msgid "Email address"
|
4094 |
msgstr ""
|
4095 |
|
4096 |
-
#: includes/checkout/template.php:
|
4097 |
msgid "We will use this to personalize your account experience."
|
4098 |
msgstr ""
|
4099 |
|
4100 |
-
#: includes/checkout/template.php:
|
4101 |
msgid "First name"
|
4102 |
msgstr ""
|
4103 |
|
4104 |
-
#: includes/checkout/template.php:
|
4105 |
msgid "We will use this as well to personalize your account experience."
|
4106 |
msgstr ""
|
4107 |
|
4108 |
-
#: includes/checkout/template.php:
|
4109 |
msgid "Last name"
|
4110 |
msgstr ""
|
4111 |
|
4112 |
-
#: includes/checkout/template.php:
|
4113 |
msgid "Credit Card Info"
|
4114 |
msgstr ""
|
4115 |
|
4116 |
-
#: includes/checkout/template.php:
|
4117 |
msgid "This is a secure SSL encrypted payment."
|
4118 |
msgstr ""
|
4119 |
|
4120 |
-
#: includes/checkout/template.php:
|
4121 |
msgid "Card Number"
|
4122 |
msgstr ""
|
4123 |
|
4124 |
-
#: includes/checkout/template.php:
|
4125 |
msgid "The (typically) 16 digits on the front of your credit card."
|
4126 |
msgstr ""
|
4127 |
|
4128 |
-
#: includes/checkout/template.php:
|
4129 |
msgid "Card number"
|
4130 |
msgstr ""
|
4131 |
|
4132 |
-
#: includes/checkout/template.php:
|
4133 |
msgid "CVC"
|
4134 |
msgstr ""
|
4135 |
|
4136 |
-
#: includes/checkout/template.php:
|
4137 |
msgid "The 3 digit (back) or 4 digit (front) value on your card."
|
4138 |
msgstr ""
|
4139 |
|
4140 |
-
#: includes/checkout/template.php:
|
4141 |
msgid "Security code"
|
4142 |
msgstr ""
|
4143 |
|
4144 |
-
#: includes/checkout/template.php:
|
4145 |
msgid "Name on the Card"
|
4146 |
msgstr ""
|
4147 |
|
4148 |
-
#: includes/checkout/template.php:
|
4149 |
msgid "The name printed on the front of your credit card."
|
4150 |
msgstr ""
|
4151 |
|
4152 |
-
#: includes/checkout/template.php:
|
4153 |
msgid "Card name"
|
4154 |
msgstr ""
|
4155 |
|
4156 |
-
#: includes/checkout/template.php:
|
4157 |
msgid "Expiration (MM/YY)"
|
4158 |
msgstr ""
|
4159 |
|
4160 |
-
#: includes/checkout/template.php:
|
4161 |
msgid "The date your credit card expires, typically on the front of the card."
|
4162 |
msgstr ""
|
4163 |
|
4164 |
-
#: includes/checkout/template.php:
|
4165 |
msgid "Billing Details"
|
4166 |
msgstr ""
|
4167 |
|
4168 |
-
#: includes/checkout/template.php:
|
4169 |
msgid "The primary billing address for your credit card."
|
4170 |
msgstr ""
|
4171 |
|
4172 |
-
#: includes/checkout/template.php:
|
4173 |
msgid "Address line 1"
|
4174 |
msgstr ""
|
4175 |
|
4176 |
-
#: includes/checkout/template.php:
|
4177 |
msgid "Billing Address Line 2 (optional)"
|
4178 |
msgstr ""
|
4179 |
|
4180 |
-
#: includes/checkout/template.php:
|
4181 |
msgid "The suite, apt no, PO box, etc, associated with your billing address."
|
4182 |
msgstr ""
|
4183 |
|
4184 |
-
#: includes/checkout/template.php:
|
4185 |
msgid "Address line 2"
|
4186 |
msgstr ""
|
4187 |
|
4188 |
-
#: includes/checkout/template.php:
|
4189 |
msgid "Billing City"
|
4190 |
msgstr ""
|
4191 |
|
4192 |
-
#: includes/checkout/template.php:
|
4193 |
msgid "The city for your billing address."
|
4194 |
msgstr ""
|
4195 |
|
4196 |
-
#: includes/checkout/template.php:
|
4197 |
msgid "Billing Zip / Postal Code"
|
4198 |
msgstr ""
|
4199 |
|
4200 |
-
#: includes/checkout/template.php:
|
4201 |
msgid "The zip or postal code for your billing address."
|
4202 |
msgstr ""
|
4203 |
|
4204 |
-
#: includes/checkout/template.php:
|
4205 |
msgid "Zip / Postal code"
|
4206 |
msgstr ""
|
4207 |
|
4208 |
-
#: includes/checkout/template.php:
|
4209 |
msgid "Billing Country"
|
4210 |
msgstr ""
|
4211 |
|
4212 |
-
#: includes/checkout/template.php:
|
4213 |
msgid "The country for your billing address."
|
4214 |
msgstr ""
|
4215 |
|
4216 |
-
#: includes/checkout/template.php:
|
4217 |
msgid "Billing State / Province"
|
4218 |
msgstr ""
|
4219 |
|
4220 |
-
#: includes/checkout/template.php:
|
4221 |
msgid "The state or province for your billing address."
|
4222 |
msgstr ""
|
4223 |
|
4224 |
-
#: includes/checkout/template.php:
|
4225 |
msgid "Already have an account?"
|
4226 |
msgstr ""
|
4227 |
|
4228 |
-
#: includes/checkout/template.php:
|
4229 |
msgid "Login"
|
4230 |
msgstr ""
|
4231 |
|
4232 |
-
#: includes/checkout/template.php:
|
4233 |
msgid "Create an account"
|
4234 |
msgstr ""
|
4235 |
|
4236 |
-
#: includes/checkout/template.php:
|
4237 |
msgid "(optional)"
|
4238 |
msgstr ""
|
4239 |
|
4240 |
-
#: includes/checkout/template.php:
|
4241 |
msgid "The username you will use to log into your account."
|
4242 |
msgstr ""
|
4243 |
|
4244 |
-
#: includes/checkout/template.php:
|
4245 |
-
#: includes/checkout/template.php:
|
4246 |
#: templates/shortcode-register.php:28
|
4247 |
msgid "Password"
|
4248 |
msgstr ""
|
4249 |
|
4250 |
-
#: includes/checkout/template.php:
|
4251 |
msgid "The password used to access your account."
|
4252 |
msgstr ""
|
4253 |
|
4254 |
-
#: includes/checkout/template.php:
|
4255 |
msgid "Password Again"
|
4256 |
msgstr ""
|
4257 |
|
4258 |
-
#: includes/checkout/template.php:
|
4259 |
msgid "Confirm your password."
|
4260 |
msgstr ""
|
4261 |
|
4262 |
-
#: includes/checkout/template.php:
|
4263 |
msgid "Confirm password"
|
4264 |
msgstr ""
|
4265 |
|
4266 |
-
#: includes/checkout/template.php:
|
4267 |
msgid "Need to create an account?"
|
4268 |
msgstr ""
|
4269 |
|
4270 |
-
#: includes/checkout/template.php:
|
4271 |
msgid "Register"
|
4272 |
msgstr ""
|
4273 |
|
4274 |
-
#: includes/checkout/template.php:
|
4275 |
msgid "or checkout as a guest."
|
4276 |
msgstr ""
|
4277 |
|
4278 |
-
#: includes/checkout/template.php:
|
4279 |
msgid "Your username"
|
4280 |
msgstr ""
|
4281 |
|
4282 |
-
#: includes/checkout/template.php:
|
4283 |
msgid "Your password"
|
4284 |
msgstr ""
|
4285 |
|
4286 |
-
#: includes/checkout/template.php:
|
4287 |
msgid "Select Payment Method"
|
4288 |
msgstr ""
|
4289 |
|
4290 |
-
#: includes/checkout/template.php:
|
4291 |
msgid "Have a discount code?"
|
4292 |
msgstr ""
|
4293 |
|
4294 |
-
#: includes/checkout/template.php:
|
4295 |
msgid "Discount"
|
4296 |
msgstr ""
|
4297 |
|
4298 |
-
#: includes/checkout/template.php:
|
4299 |
msgid "Enter a coupon code if you have one."
|
4300 |
msgstr ""
|
4301 |
|
4302 |
-
#: includes/checkout/template.php:
|
4303 |
-
#: includes/scripts.php:
|
4304 |
msgid "Enter discount"
|
4305 |
msgstr ""
|
4306 |
|
4307 |
-
#: includes/checkout/template.php:
|
4308 |
msgid "Agree to Terms?"
|
4309 |
msgstr ""
|
4310 |
|
4311 |
-
#: includes/checkout/template.php:
|
4312 |
msgid "Show Terms"
|
4313 |
msgstr ""
|
4314 |
|
4315 |
-
#: includes/checkout/template.php:
|
4316 |
msgid "Hide Terms"
|
4317 |
msgstr ""
|
4318 |
|
4319 |
-
#: includes/checkout/template.php:
|
4320 |
msgid "Purchase Total:"
|
4321 |
msgstr ""
|
4322 |
|
4323 |
-
#: includes/checkout/template.php:
|
4324 |
msgid "Go back"
|
4325 |
msgstr ""
|
4326 |
|
4327 |
-
#: includes/checkout/template.php:
|
4328 |
msgid "Next"
|
4329 |
msgstr ""
|
4330 |
|
4331 |
-
#: includes/checkout/template.php:
|
4332 |
msgid "Free Download"
|
4333 |
msgstr ""
|
4334 |
|
4335 |
-
#: includes/class-edd-api.php:255
|
4336 |
-
msgid "You must specify both a token and API key!"
|
4337 |
-
msgstr ""
|
4338 |
-
|
4339 |
-
#: includes/class-edd-api.php:272
|
4340 |
-
msgid "Your request could not be authenticated!"
|
4341 |
-
msgstr ""
|
4342 |
-
|
4343 |
-
#: includes/class-edd-api.php:290
|
4344 |
-
msgid "Invalid API key!"
|
4345 |
-
msgstr ""
|
4346 |
-
|
4347 |
-
#: includes/class-edd-api.php:409
|
4348 |
-
msgid "Invalid query!"
|
4349 |
-
msgstr ""
|
4350 |
-
|
4351 |
-
#: includes/class-edd-api.php:726
|
4352 |
-
msgid "Customer %s not found!"
|
4353 |
-
msgstr ""
|
4354 |
-
|
4355 |
-
#: includes/class-edd-api.php:731
|
4356 |
-
msgid "No customers found!"
|
4357 |
-
msgstr ""
|
4358 |
-
|
4359 |
-
#: includes/class-edd-api.php:843 includes/class-edd-api.php:987
|
4360 |
-
#: includes/class-edd-api.php:1097
|
4361 |
-
msgid "Product %s not found!"
|
4362 |
-
msgstr ""
|
4363 |
-
|
4364 |
-
#: includes/class-edd-api.php:898 includes/class-edd-api.php:1004
|
4365 |
-
msgid "The end date must be later than the start date!"
|
4366 |
-
msgstr ""
|
4367 |
-
|
4368 |
-
#: includes/class-edd-api.php:903 includes/class-edd-api.php:1009
|
4369 |
-
msgid "Invalid or no date range specified!"
|
4370 |
-
msgstr ""
|
4371 |
-
|
4372 |
-
#: includes/class-edd-api.php:1235
|
4373 |
-
msgid "No discounts found!"
|
4374 |
-
msgstr ""
|
4375 |
-
|
4376 |
-
#: includes/class-edd-api.php:1282
|
4377 |
-
msgid "Discount %s not found!"
|
4378 |
-
msgstr ""
|
4379 |
-
|
4380 |
-
#: includes/class-edd-api.php:1426
|
4381 |
-
msgid "Easy Digital Downloads API Keys"
|
4382 |
-
msgstr ""
|
4383 |
-
|
4384 |
-
#: includes/class-edd-api.php:1431
|
4385 |
-
msgid "Generate API Key"
|
4386 |
-
msgstr ""
|
4387 |
-
|
4388 |
-
#: includes/class-edd-api.php:1433
|
4389 |
-
msgid "Public key:"
|
4390 |
-
msgstr ""
|
4391 |
-
|
4392 |
-
#: includes/class-edd-api.php:1434
|
4393 |
-
msgid "Secret key:"
|
4394 |
-
msgstr ""
|
4395 |
-
|
4396 |
-
#: includes/class-edd-api.php:1435
|
4397 |
-
msgid "Token:"
|
4398 |
-
msgstr ""
|
4399 |
-
|
4400 |
-
#: includes/class-edd-api.php:1437
|
4401 |
-
msgid "Revoke API Keys"
|
4402 |
-
msgstr ""
|
4403 |
-
|
4404 |
-
#: includes/class-edd-api.php:1471 includes/class-edd-api.php:1473
|
4405 |
-
msgid "You do not have permission to %s API keys for this user"
|
4406 |
-
msgstr ""
|
4407 |
-
|
4408 |
#: includes/class-edd-cache-helper.php:117
|
4409 |
msgid ""
|
4410 |
"In order for <strong>database caching</strong> to work with Easy Digital "
|
@@ -4557,7 +4660,7 @@ msgstr ""
|
|
4557 |
msgid "%d customers created in %d seconds"
|
4558 |
msgstr ""
|
4559 |
|
4560 |
-
#: includes/class-edd-cli.php:311 includes/class-edd-html-elements.php:
|
4561 |
msgid "No customers found"
|
4562 |
msgstr ""
|
4563 |
|
@@ -4641,8 +4744,8 @@ msgstr ""
|
|
4641 |
msgid " Product: %s - %s"
|
4642 |
msgstr ""
|
4643 |
|
4644 |
-
#: includes/class-edd-cli.php:419 includes/class-edd-html-elements.php:
|
4645 |
-
#: includes/shortcodes.php:
|
4646 |
msgid "No discounts found"
|
4647 |
msgstr ""
|
4648 |
|
@@ -4731,46 +4834,43 @@ msgid "New Download Product"
|
|
4731 |
msgstr ""
|
4732 |
|
4733 |
#: includes/class-edd-html-elements.php:43
|
|
|
4734 |
msgid "Select a %s"
|
4735 |
msgstr ""
|
4736 |
|
4737 |
-
#: includes/class-edd-html-elements.php:
|
4738 |
msgid "No products found"
|
4739 |
msgstr ""
|
4740 |
|
4741 |
-
#: includes/class-edd-html-elements.php:
|
4742 |
msgid "Select a Customer"
|
4743 |
msgstr ""
|
4744 |
|
4745 |
-
#: includes/class-edd-html-elements.php:
|
4746 |
msgid "No customer attached"
|
4747 |
msgstr ""
|
4748 |
|
4749 |
-
#: includes/class-edd-html-elements.php:
|
4750 |
-
msgid "All Categories"
|
4751 |
-
msgstr ""
|
4752 |
-
|
4753 |
-
#: includes/class-edd-html-elements.php:537
|
4754 |
msgid "Enter username"
|
4755 |
msgstr ""
|
4756 |
|
4757 |
-
#: includes/class-edd-license-handler.php:
|
4758 |
msgid "%1$s License Key"
|
4759 |
msgstr ""
|
4760 |
|
4761 |
-
#: includes/class-edd-license-handler.php:
|
4762 |
msgid "This license does not belong to the product you have entered it for."
|
4763 |
msgstr ""
|
4764 |
|
4765 |
-
#: includes/class-edd-license-handler.php:
|
4766 |
msgid "This license does not have any activations left"
|
4767 |
msgstr ""
|
4768 |
|
4769 |
-
#: includes/class-edd-license-handler.php:
|
4770 |
msgid "This license key is expired. Please renew it."
|
4771 |
msgstr ""
|
4772 |
|
4773 |
-
#: includes/class-edd-license-handler.php:
|
4774 |
msgid ""
|
4775 |
"There was a problem activating your license key, please try again or "
|
4776 |
"contact support. Error code: %s"
|
@@ -5106,39 +5206,39 @@ msgstr ""
|
|
5106 |
msgid "No payments matching your request were found."
|
5107 |
msgstr ""
|
5108 |
|
5109 |
-
#: includes/discount-functions.php:
|
5110 |
msgid "This discount is expired."
|
5111 |
msgstr ""
|
5112 |
|
5113 |
-
#: includes/discount-functions.php:
|
5114 |
msgid "This discount is not active."
|
5115 |
msgstr ""
|
5116 |
|
5117 |
-
#: includes/discount-functions.php:
|
5118 |
msgid "This discount is not active yet."
|
5119 |
msgstr ""
|
5120 |
|
5121 |
-
#: includes/discount-functions.php:
|
5122 |
msgid "This discount has reached it's maximum usage."
|
5123 |
msgstr ""
|
5124 |
|
5125 |
-
#: includes/discount-functions.php:
|
5126 |
msgid "Minimum order of %s not met."
|
5127 |
msgstr ""
|
5128 |
|
5129 |
-
#: includes/discount-functions.php:
|
5130 |
msgid "The product requirements for this discount are not met."
|
5131 |
msgstr ""
|
5132 |
|
5133 |
-
#: includes/discount-functions.php:
|
5134 |
msgid "This discount is not valid for the cart contents."
|
5135 |
msgstr ""
|
5136 |
|
5137 |
-
#: includes/discount-functions.php:
|
5138 |
msgid "This discount has already been redeemed."
|
5139 |
msgstr ""
|
5140 |
|
5141 |
-
#: includes/discount-functions.php:
|
5142 |
msgid "This discount is invalid."
|
5143 |
msgstr ""
|
5144 |
|
@@ -5176,39 +5276,39 @@ msgstr ""
|
|
5176 |
msgid "You cannot send email with EDD_Emails until init/admin_init has been reached"
|
5177 |
msgstr ""
|
5178 |
|
5179 |
-
#: includes/emails/functions.php:
|
5180 |
msgid "New download purchase - Order #%1$s"
|
5181 |
msgstr ""
|
5182 |
|
5183 |
-
#: includes/emails/functions.php:
|
5184 |
msgid "New Sale!"
|
5185 |
msgstr ""
|
5186 |
|
5187 |
-
#: includes/emails/functions.php:
|
5188 |
msgid "Hello"
|
5189 |
msgstr ""
|
5190 |
|
5191 |
-
#: includes/emails/functions.php:
|
5192 |
msgid "A %s purchase has been made"
|
5193 |
msgstr ""
|
5194 |
|
5195 |
-
#: includes/emails/functions.php:
|
5196 |
msgid "%s sold:"
|
5197 |
msgstr ""
|
5198 |
|
5199 |
-
#: includes/emails/functions.php:
|
5200 |
msgid "Purchased by: "
|
5201 |
msgstr ""
|
5202 |
|
5203 |
-
#: includes/emails/functions.php:
|
5204 |
msgid "Amount: "
|
5205 |
msgstr ""
|
5206 |
|
5207 |
-
#: includes/emails/functions.php:
|
5208 |
msgid "Payment Method: "
|
5209 |
msgstr ""
|
5210 |
|
5211 |
-
#: includes/emails/functions.php:
|
5212 |
msgid "Thank you"
|
5213 |
msgstr ""
|
5214 |
|
@@ -5256,6 +5356,142 @@ msgstr ""
|
|
5256 |
msgid "You must enable a payment gateway to use Easy Digital Downloads"
|
5257 |
msgstr ""
|
5258 |
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
5259 |
#: includes/gateways/functions.php:25
|
5260 |
msgid "PayPal Standard"
|
5261 |
msgstr ""
|
@@ -5268,11 +5504,11 @@ msgstr ""
|
|
5268 |
msgid "Test Payment"
|
5269 |
msgstr ""
|
5270 |
|
5271 |
-
#: includes/gateways/functions.php:
|
5272 |
msgid "Free Purchase"
|
5273 |
msgstr ""
|
5274 |
|
5275 |
-
#: includes/gateways/functions.php:
|
5276 |
msgid "The requested price ID does not exist."
|
5277 |
msgstr ""
|
5278 |
|
@@ -5290,15 +5526,6 @@ msgstr ""
|
|
5290 |
msgid "Payment creation failed before sending buyer to PayPal. Payment data: %s"
|
5291 |
msgstr ""
|
5292 |
|
5293 |
-
#: includes/gateways/paypal-standard.php:274
|
5294 |
-
#: includes/gateways/paypal-standard.php:279
|
5295 |
-
#: includes/gateways/paypal-standard.php:340
|
5296 |
-
#: includes/gateways/paypal-standard.php:349
|
5297 |
-
#: includes/gateways/paypal-standard.php:399
|
5298 |
-
#: includes/gateways/paypal-standard.php:406
|
5299 |
-
msgid "IPN Error"
|
5300 |
-
msgstr ""
|
5301 |
-
|
5302 |
#: includes/gateways/paypal-standard.php:274
|
5303 |
#: includes/gateways/paypal-standard.php:279
|
5304 |
msgid "Invalid IPN verification response. IPN data: %s"
|
@@ -5401,8 +5628,8 @@ msgstr ""
|
|
5401 |
msgid "PayPal Refund Transaction ID: %s"
|
5402 |
msgstr ""
|
5403 |
|
5404 |
-
#: includes/install.php:60 includes/template-functions.php:
|
5405 |
-
#: templates/widget-cart-
|
5406 |
msgid "Checkout"
|
5407 |
msgstr ""
|
5408 |
|
@@ -5422,16 +5649,16 @@ msgstr ""
|
|
5422 |
msgid "The password you entered is incorrect"
|
5423 |
msgstr ""
|
5424 |
|
5425 |
-
#: includes/login-register.php:87 includes/process-purchase.php:
|
5426 |
msgid "The username you entered does not exist"
|
5427 |
msgstr ""
|
5428 |
|
5429 |
#: includes/login-register.php:140 includes/login-register.php:148
|
5430 |
-
#: includes/process-purchase.php:
|
5431 |
msgid "Invalid username"
|
5432 |
msgstr ""
|
5433 |
|
5434 |
-
#: includes/login-register.php:144 includes/process-purchase.php:
|
5435 |
msgid "Username already taken"
|
5436 |
msgstr ""
|
5437 |
|
@@ -5439,8 +5666,8 @@ msgstr ""
|
|
5439 |
msgid "Email address already taken"
|
5440 |
msgstr ""
|
5441 |
|
5442 |
-
#: includes/login-register.php:156 includes/process-purchase.php:
|
5443 |
-
#: includes/process-purchase.php:
|
5444 |
msgid "Invalid email"
|
5445 |
msgstr ""
|
5446 |
|
@@ -5576,19 +5803,19 @@ msgid ""
|
|
5576 |
"%2$s with no alternative available."
|
5577 |
msgstr ""
|
5578 |
|
5579 |
-
#: includes/payments/actions.php:
|
5580 |
msgid "Status changed from %s to %s"
|
5581 |
msgstr ""
|
5582 |
|
5583 |
-
#: includes/payments/functions.php:
|
5584 |
msgid "Complete"
|
5585 |
msgstr ""
|
5586 |
|
5587 |
-
#: includes/payments/functions.php:
|
5588 |
msgid "EDD Bot"
|
5589 |
msgstr ""
|
5590 |
|
5591 |
-
#: includes/payments/functions.php:
|
5592 |
msgid "Delete this payment note"
|
5593 |
msgstr ""
|
5594 |
|
@@ -5706,6 +5933,10 @@ msgstr ""
|
|
5706 |
msgid "Search Categories"
|
5707 |
msgstr ""
|
5708 |
|
|
|
|
|
|
|
|
|
5709 |
#: includes/post-types.php:206
|
5710 |
msgid "Parent Category"
|
5711 |
msgstr ""
|
@@ -5730,6 +5961,10 @@ msgstr ""
|
|
5730 |
msgid "New Category Name"
|
5731 |
msgstr ""
|
5732 |
|
|
|
|
|
|
|
|
|
5733 |
#: includes/post-types.php:231
|
5734 |
msgid "Search Tags"
|
5735 |
msgstr ""
|
@@ -5766,83 +6001,83 @@ msgstr ""
|
|
5766 |
msgid "Choose from most used %s tags"
|
5767 |
msgstr ""
|
5768 |
|
5769 |
-
#: includes/post-types.php:
|
5770 |
msgid "Refunded <span class=\"count\">(%s)</span>"
|
5771 |
msgid_plural "Refunded <span class=\"count\">(%s)</span>"
|
5772 |
msgstr[0] ""
|
5773 |
msgstr[1] ""
|
5774 |
|
5775 |
-
#: includes/post-types.php:
|
5776 |
msgid "Failed <span class=\"count\">(%s)</span>"
|
5777 |
msgid_plural "Failed <span class=\"count\">(%s)</span>"
|
5778 |
msgstr[0] ""
|
5779 |
msgstr[1] ""
|
5780 |
|
5781 |
-
#: includes/post-types.php:
|
5782 |
msgid "Revoked <span class=\"count\">(%s)</span>"
|
5783 |
msgid_plural "Revoked <span class=\"count\">(%s)</span>"
|
5784 |
msgstr[0] ""
|
5785 |
msgstr[1] ""
|
5786 |
|
5787 |
-
#: includes/post-types.php:
|
5788 |
msgid "Abandoned <span class=\"count\">(%s)</span>"
|
5789 |
msgid_plural "Abandoned <span class=\"count\">(%s)</span>"
|
5790 |
msgstr[0] ""
|
5791 |
msgstr[1] ""
|
5792 |
|
5793 |
-
#: includes/post-types.php:
|
5794 |
msgid "Active <span class=\"count\">(%s)</span>"
|
5795 |
msgid_plural "Active <span class=\"count\">(%s)</span>"
|
5796 |
msgstr[0] ""
|
5797 |
msgstr[1] ""
|
5798 |
|
5799 |
-
#: includes/post-types.php:
|
5800 |
msgid "Inactive <span class=\"count\">(%s)</span>"
|
5801 |
msgid_plural "Inactive <span class=\"count\">(%s)</span>"
|
5802 |
msgstr[0] ""
|
5803 |
msgstr[1] ""
|
5804 |
|
5805 |
-
#: includes/post-types.php:
|
5806 |
msgid "%2$s updated. %1$sView %2$s%3$s."
|
5807 |
msgstr ""
|
5808 |
|
5809 |
-
#: includes/post-types.php:
|
5810 |
msgid "%2$s published. %1$sView %2$s%3$s."
|
5811 |
msgstr ""
|
5812 |
|
5813 |
-
#: includes/post-types.php:
|
5814 |
msgid "%2$s saved. %1$sView %2$s%3$s."
|
5815 |
msgstr ""
|
5816 |
|
5817 |
-
#: includes/post-types.php:
|
5818 |
msgid "%2$s submitted. %1$sView %2$s%3$s."
|
5819 |
msgstr ""
|
5820 |
|
5821 |
-
#: includes/post-types.php:
|
5822 |
msgid "%1$s %2$s updated."
|
5823 |
msgid_plural "%1$s %3$s updated."
|
5824 |
msgstr[0] ""
|
5825 |
msgstr[1] ""
|
5826 |
|
5827 |
-
#: includes/post-types.php:
|
5828 |
msgid "%1$s %2$s not updated, somebody is editing it."
|
5829 |
msgid_plural "%1$s %3$s not updated, somebody is editing them."
|
5830 |
msgstr[0] ""
|
5831 |
msgstr[1] ""
|
5832 |
|
5833 |
-
#: includes/post-types.php:
|
5834 |
msgid "%1$s %2$s permanently deleted."
|
5835 |
msgid_plural "%1$s %3$s permanently deleted."
|
5836 |
msgstr[0] ""
|
5837 |
msgstr[1] ""
|
5838 |
|
5839 |
-
#: includes/post-types.php:
|
5840 |
msgid "%1$s %2$s moved to the Trash."
|
5841 |
msgid_plural "%1$s %3$s moved to the Trash."
|
5842 |
msgstr[0] ""
|
5843 |
msgstr[1] ""
|
5844 |
|
5845 |
-
#: includes/post-types.php:
|
5846 |
msgid "%1$s %2$s restored from the Trash."
|
5847 |
msgid_plural "%1$s %3$s restored from the Trash."
|
5848 |
msgstr[0] ""
|
@@ -5856,99 +6091,99 @@ msgstr ""
|
|
5856 |
msgid "Purchase Verification Failed"
|
5857 |
msgstr ""
|
5858 |
|
5859 |
-
#: includes/process-purchase.php:
|
5860 |
msgid "Your cart is empty"
|
5861 |
msgstr ""
|
5862 |
|
5863 |
-
#: includes/process-purchase.php:
|
5864 |
msgid "The selected payment gateway is not enabled"
|
5865 |
msgstr ""
|
5866 |
|
5867 |
-
#: includes/process-purchase.php:
|
5868 |
msgid "One or more of the discounts you entered is invalid"
|
5869 |
msgstr ""
|
5870 |
|
5871 |
-
#: includes/process-purchase.php:
|
5872 |
msgid "You must agree to the terms of use"
|
5873 |
msgstr ""
|
5874 |
|
5875 |
-
#: includes/process-purchase.php:
|
5876 |
msgid "Please enter a valid email address"
|
5877 |
msgstr ""
|
5878 |
|
5879 |
-
#: includes/process-purchase.php:
|
5880 |
msgid "Please enter your first name"
|
5881 |
msgstr ""
|
5882 |
|
5883 |
-
#: includes/process-purchase.php:
|
5884 |
msgid "Please enter your zip / postal code"
|
5885 |
msgstr ""
|
5886 |
|
5887 |
-
#: includes/process-purchase.php:
|
5888 |
msgid "Please enter your billing city"
|
5889 |
msgstr ""
|
5890 |
|
5891 |
-
#: includes/process-purchase.php:
|
5892 |
msgid "Please select your billing country"
|
5893 |
msgstr ""
|
5894 |
|
5895 |
-
#: includes/process-purchase.php:
|
5896 |
msgid "Please enter billing state / province"
|
5897 |
msgstr ""
|
5898 |
|
5899 |
-
#: includes/process-purchase.php:
|
5900 |
msgid "The user information is invalid"
|
5901 |
msgstr ""
|
5902 |
|
5903 |
-
#: includes/process-purchase.php:
|
5904 |
msgid "Invalid username. Only lowercase letters (a-z) and numbers are allowed"
|
5905 |
msgstr ""
|
5906 |
|
5907 |
-
#: includes/process-purchase.php:
|
5908 |
msgid "You must register or login to complete your purchase"
|
5909 |
msgstr ""
|
5910 |
|
5911 |
-
#: includes/process-purchase.php:
|
5912 |
msgid "Email already used"
|
5913 |
msgstr ""
|
5914 |
|
5915 |
-
#: includes/process-purchase.php:
|
5916 |
msgid "Enter an email"
|
5917 |
msgstr ""
|
5918 |
|
5919 |
-
#: includes/process-purchase.php:
|
5920 |
msgid "Passwords don't match"
|
5921 |
msgstr ""
|
5922 |
|
5923 |
-
#: includes/process-purchase.php:
|
5924 |
msgid "Enter a password"
|
5925 |
msgstr ""
|
5926 |
|
5927 |
-
#: includes/process-purchase.php:
|
5928 |
msgid "Enter the password confirmation"
|
5929 |
msgstr ""
|
5930 |
|
5931 |
-
#: includes/process-purchase.php:
|
5932 |
msgid "You must login or register to complete your purchase"
|
5933 |
msgstr ""
|
5934 |
|
5935 |
-
#: includes/process-purchase.php:
|
5936 |
msgid "The password you entered is incorrect. %sReset Password%s"
|
5937 |
msgstr ""
|
5938 |
|
5939 |
-
#: includes/process-purchase.php:
|
5940 |
msgid "Lost Password"
|
5941 |
msgstr ""
|
5942 |
|
5943 |
-
#: includes/process-purchase.php:
|
5944 |
msgid "You must be logged into an account to purchase"
|
5945 |
msgstr ""
|
5946 |
|
5947 |
-
#: includes/process-purchase.php:
|
5948 |
msgid "The zip / postal code you entered for your billing address is invalid"
|
5949 |
msgstr ""
|
5950 |
|
5951 |
-
#: includes/process-purchase.php:
|
5952 |
msgid "An internal error has occurred, please try again or contact support."
|
5953 |
msgstr ""
|
5954 |
|
@@ -5956,195 +6191,199 @@ msgstr ""
|
|
5956 |
msgid "You do not have permission to view this file."
|
5957 |
msgstr ""
|
5958 |
|
5959 |
-
#: includes/scripts.php:
|
5960 |
msgid "Please select a payment method"
|
5961 |
msgstr ""
|
5962 |
|
5963 |
-
#: includes/scripts.php:
|
5964 |
msgid "Please enter a discount code"
|
5965 |
msgstr ""
|
5966 |
|
5967 |
-
#: includes/scripts.php:
|
5968 |
msgid "Discount Applied"
|
5969 |
msgstr ""
|
5970 |
|
5971 |
-
#: includes/scripts.php:
|
5972 |
msgid "Please enter an email address before applying a discount code"
|
5973 |
msgstr ""
|
5974 |
|
5975 |
-
#: includes/scripts.php:
|
5976 |
msgid "Please enter a username before applying a discount code"
|
5977 |
msgstr ""
|
5978 |
|
5979 |
-
#: includes/scripts.php:
|
5980 |
msgid "Please Wait..."
|
5981 |
msgstr ""
|
5982 |
|
5983 |
-
#: includes/scripts.php:
|
5984 |
msgid "You have already added this item to your cart"
|
5985 |
msgstr ""
|
5986 |
|
5987 |
-
#: includes/scripts.php:
|
5988 |
msgid "Loading"
|
5989 |
msgstr ""
|
5990 |
|
5991 |
-
#: includes/scripts.php:
|
5992 |
msgid "Please select an option"
|
5993 |
msgstr ""
|
5994 |
|
5995 |
-
#: includes/scripts.php:
|
5996 |
msgid "Add New Download"
|
5997 |
msgstr ""
|
5998 |
|
5999 |
-
#: includes/scripts.php:
|
6000 |
msgid "Use This File"
|
6001 |
msgstr ""
|
6002 |
|
6003 |
-
#: includes/scripts.php:
|
6004 |
msgid "Sorry, not available for variable priced products."
|
6005 |
msgstr ""
|
6006 |
|
6007 |
-
#: includes/scripts.php:
|
6008 |
msgid "Are you sure you wish to delete this payment?"
|
6009 |
msgstr ""
|
6010 |
|
6011 |
-
#: includes/scripts.php:
|
6012 |
msgid "Are you sure you wish to delete this note?"
|
6013 |
msgstr ""
|
6014 |
|
6015 |
-
#: includes/scripts.php:
|
6016 |
msgid "Are you sure you wish to delete this tax rate?"
|
6017 |
msgstr ""
|
6018 |
|
6019 |
-
#: includes/scripts.php:
|
6020 |
msgid "Are you sure you wish to revoke this API key?"
|
6021 |
msgstr ""
|
6022 |
|
6023 |
-
#: includes/scripts.php:
|
6024 |
msgid "Are you sure you wish to regenerate this API key?"
|
6025 |
msgstr ""
|
6026 |
|
6027 |
-
#: includes/scripts.php:
|
6028 |
msgid "Are you sure you wish to resend the purchase receipt?"
|
6029 |
msgstr ""
|
6030 |
|
6031 |
-
#: includes/scripts.php:
|
6032 |
msgid "Copy these links to your clipboard and give them to your customer"
|
6033 |
msgstr ""
|
6034 |
|
6035 |
-
#: includes/scripts.php:
|
6036 |
msgid "Are you sure you wish to delete this %s?"
|
6037 |
msgstr ""
|
6038 |
|
6039 |
-
#: includes/scripts.php:
|
6040 |
msgid "You must have at least one price"
|
6041 |
msgstr ""
|
6042 |
|
6043 |
-
#: includes/scripts.php:
|
6044 |
msgid "You must have at least one field"
|
6045 |
msgstr ""
|
6046 |
|
6047 |
-
#: includes/scripts.php:
|
|
|
|
|
|
|
|
|
6048 |
msgid "Choose a %s"
|
6049 |
msgstr ""
|
6050 |
|
6051 |
-
#: includes/scripts.php:
|
6052 |
msgid "Choose one or more %s"
|
6053 |
msgstr ""
|
6054 |
|
6055 |
-
#: includes/scripts.php:
|
6056 |
msgid "Item price must be numeric"
|
6057 |
msgstr ""
|
6058 |
|
6059 |
-
#: includes/scripts.php:
|
6060 |
msgid "Quantity must be numeric"
|
6061 |
msgstr ""
|
6062 |
|
6063 |
-
#: includes/scripts.php:
|
6064 |
msgid "Type to search %s"
|
6065 |
msgstr ""
|
6066 |
|
6067 |
-
#: includes/shortcodes.php:
|
6068 |
msgid "Purchase All Items"
|
6069 |
msgstr ""
|
6070 |
|
6071 |
-
#: includes/shortcodes.php:
|
6072 |
msgid "Sorry, trouble retrieving payment receipt."
|
6073 |
msgstr ""
|
6074 |
|
6075 |
-
#: includes/shortcodes.php:
|
6076 |
msgid "The passwords you entered do not match. Please try again."
|
6077 |
msgstr ""
|
6078 |
|
6079 |
-
#: includes/shortcodes.php:
|
6080 |
msgid "The email you entered is invalid. Please enter a valid email."
|
6081 |
msgstr ""
|
6082 |
|
6083 |
-
#: includes/shortcodes.php:
|
6084 |
msgid "The email you entered belongs to another user. Please use another."
|
6085 |
msgstr ""
|
6086 |
|
6087 |
-
#: includes/template-functions.php:
|
6088 |
msgid "Free"
|
6089 |
msgstr ""
|
6090 |
|
6091 |
-
#: includes/template-functions.php:
|
6092 |
msgid "Added to cart"
|
6093 |
msgstr ""
|
6094 |
|
6095 |
-
#: includes/template-functions.php:
|
6096 |
msgid "Go to Checkout"
|
6097 |
msgstr ""
|
6098 |
|
6099 |
-
#: includes/template-functions.php:
|
6100 |
msgid "Includes %1$s% tax"
|
6101 |
msgstr ""
|
6102 |
|
6103 |
-
#: includes/template-functions.php:
|
6104 |
msgid "Excluding %1$s% tax"
|
6105 |
msgstr ""
|
6106 |
|
6107 |
-
#: includes/template-functions.php:
|
6108 |
msgid "White"
|
6109 |
msgstr ""
|
6110 |
|
6111 |
-
#: includes/template-functions.php:
|
6112 |
msgid "Gray"
|
6113 |
msgstr ""
|
6114 |
|
6115 |
-
#: includes/template-functions.php:
|
6116 |
msgid "Blue"
|
6117 |
msgstr ""
|
6118 |
|
6119 |
-
#: includes/template-functions.php:
|
6120 |
msgid "Red"
|
6121 |
msgstr ""
|
6122 |
|
6123 |
-
#: includes/template-functions.php:
|
6124 |
msgid "Green"
|
6125 |
msgstr ""
|
6126 |
|
6127 |
-
#: includes/template-functions.php:
|
6128 |
msgid "Yellow"
|
6129 |
msgstr ""
|
6130 |
|
6131 |
-
#: includes/template-functions.php:
|
6132 |
msgid "Orange"
|
6133 |
msgstr ""
|
6134 |
|
6135 |
-
#: includes/template-functions.php:
|
6136 |
msgid "Dark Gray"
|
6137 |
msgstr ""
|
6138 |
|
6139 |
-
#: includes/template-functions.php:
|
6140 |
msgid "Inherit"
|
6141 |
msgstr ""
|
6142 |
|
6143 |
-
#: includes/template-functions.php:
|
6144 |
msgid "Button"
|
6145 |
msgstr ""
|
6146 |
|
6147 |
-
#: includes/template-functions.php:
|
6148 |
msgid "Plain Text"
|
6149 |
msgstr ""
|
6150 |
|
@@ -6160,7 +6399,7 @@ msgstr ""
|
|
6160 |
msgid "Display the downloads shopping cart"
|
6161 |
msgstr ""
|
6162 |
|
6163 |
-
#: includes/widgets.php:86 includes/widgets.php:165 includes/widgets.php:
|
6164 |
msgid "Title:"
|
6165 |
msgstr ""
|
6166 |
|
@@ -6180,52 +6419,40 @@ msgstr ""
|
|
6180 |
msgid "Taxonomy:"
|
6181 |
msgstr ""
|
6182 |
|
6183 |
-
#: includes/widgets.php:
|
6184 |
msgid "Show Count:"
|
6185 |
msgstr ""
|
6186 |
|
6187 |
-
#: includes/widgets.php:
|
6188 |
msgid "Hide Empty Categories:"
|
6189 |
msgstr ""
|
6190 |
|
6191 |
-
#: includes/widgets.php:
|
6192 |
msgid "%s Details"
|
6193 |
msgstr ""
|
6194 |
|
6195 |
-
#: includes/widgets.php:
|
6196 |
msgid "Display the details of a specific %s"
|
6197 |
msgstr ""
|
6198 |
|
6199 |
-
#: includes/widgets.php:
|
6200 |
-
msgid "Categories: %1$s"
|
6201 |
-
msgstr ""
|
6202 |
-
|
6203 |
-
#: includes/widgets.php:261
|
6204 |
-
msgid "Tags: %2$s"
|
6205 |
-
msgstr ""
|
6206 |
-
|
6207 |
-
#: includes/widgets.php:306
|
6208 |
msgid "%s"
|
6209 |
msgstr ""
|
6210 |
|
6211 |
-
#: includes/widgets.php:
|
6212 |
msgid "Use current"
|
6213 |
msgstr ""
|
6214 |
|
6215 |
-
#: includes/widgets.php:
|
6216 |
msgid "Show Title"
|
6217 |
msgstr ""
|
6218 |
|
6219 |
-
#: includes/widgets.php:
|
6220 |
msgid "Show Purchase Button"
|
6221 |
msgstr ""
|
6222 |
|
6223 |
-
#: includes/widgets.php:
|
6224 |
-
msgid "Show
|
6225 |
-
msgstr ""
|
6226 |
-
|
6227 |
-
#: includes/widgets.php:336
|
6228 |
-
msgid "Show Tags"
|
6229 |
msgstr ""
|
6230 |
|
6231 |
#: templates/checkout_cart.php:11
|
@@ -6236,11 +6463,11 @@ msgstr ""
|
|
6236 |
msgid "Item Price"
|
6237 |
msgstr ""
|
6238 |
|
6239 |
-
#: templates/checkout_cart.php:
|
6240 |
msgid "Subtotal"
|
6241 |
msgstr ""
|
6242 |
|
6243 |
-
#: templates/checkout_cart.php:
|
6244 |
msgid "Total"
|
6245 |
msgstr ""
|
6246 |
|
@@ -6386,10 +6613,14 @@ msgstr ""
|
|
6386 |
msgid "Confirm Password"
|
6387 |
msgstr ""
|
6388 |
|
6389 |
-
#: templates/widget-cart-checkout.php:
|
6390 |
msgid "Subtotal:"
|
6391 |
msgstr ""
|
6392 |
|
|
|
|
|
|
|
|
|
6393 |
#: templates/widget-cart-item.php:4
|
6394 |
msgid "remove"
|
6395 |
msgstr ""
|
@@ -6422,27 +6653,32 @@ msgctxt "State / province of address"
|
|
6422 |
msgid "State / Province:"
|
6423 |
msgstr ""
|
6424 |
|
6425 |
-
#: includes/admin/reporting/reports.php:
|
6426 |
msgctxt "Date one to date two"
|
6427 |
msgid "to"
|
6428 |
msgstr ""
|
6429 |
|
6430 |
-
#: includes/checkout/template.php:
|
6431 |
msgctxt "Entering a discount code"
|
6432 |
msgid "Click to enter it"
|
6433 |
msgstr ""
|
6434 |
|
6435 |
-
#: includes/checkout/template.php:
|
6436 |
msgctxt "Apply discount at checkout"
|
6437 |
msgid "Apply"
|
6438 |
msgstr ""
|
6439 |
|
6440 |
-
#: includes/class-edd-html-elements.php:
|
|
|
|
|
|
|
|
|
|
|
6441 |
msgctxt "all dropdown items"
|
6442 |
msgid "All"
|
6443 |
msgstr ""
|
6444 |
|
6445 |
-
#: includes/class-edd-html-elements.php:
|
6446 |
msgctxt "no dropdown items"
|
6447 |
msgid "None"
|
6448 |
msgstr ""
|
@@ -6452,7 +6688,7 @@ msgctxt "download post type name"
|
|
6452 |
msgid "%2$s"
|
6453 |
msgstr ""
|
6454 |
|
6455 |
-
#: includes/shortcodes.php:
|
6456 |
msgctxt "download post type name"
|
6457 |
msgid "No %s found"
|
6458 |
msgstr ""
|
@@ -6489,12 +6725,12 @@ msgstr ""
|
|
6489 |
|
6490 |
#: includes/post-types.php:202
|
6491 |
msgctxt "taxonomy general name"
|
6492 |
-
msgid "
|
6493 |
msgstr ""
|
6494 |
|
6495 |
#: includes/post-types.php:229
|
6496 |
msgctxt "taxonomy general name"
|
6497 |
-
msgid "
|
6498 |
msgstr ""
|
6499 |
|
6500 |
#: includes/post-types.php:203
|
@@ -6507,32 +6743,32 @@ msgctxt "taxonomy singular name"
|
|
6507 |
msgid "Tag"
|
6508 |
msgstr ""
|
6509 |
|
6510 |
-
#: includes/post-types.php:
|
6511 |
msgctxt "Refunded payment status"
|
6512 |
msgid "Refunded"
|
6513 |
msgstr ""
|
6514 |
|
6515 |
-
#: includes/post-types.php:
|
6516 |
msgctxt "Failed payment status"
|
6517 |
msgid "Failed"
|
6518 |
msgstr ""
|
6519 |
|
6520 |
-
#: includes/post-types.php:
|
6521 |
msgctxt "Revoked payment status"
|
6522 |
msgid "Revoked"
|
6523 |
msgstr ""
|
6524 |
|
6525 |
-
#: includes/post-types.php:
|
6526 |
msgctxt "Abandoned payment status"
|
6527 |
msgid "Abandoned"
|
6528 |
msgstr ""
|
6529 |
|
6530 |
-
#: includes/post-types.php:
|
6531 |
msgctxt "Active discount code status"
|
6532 |
msgid "Active"
|
6533 |
msgstr ""
|
6534 |
|
6535 |
-
#: includes/post-types.php:
|
6536 |
msgctxt "Inactive discount code status"
|
6537 |
msgid "Inactive"
|
6538 |
msgstr ""
|
2 |
# This file is distributed under the same license as the Easy Digital Downloads package.
|
3 |
msgid ""
|
4 |
msgstr ""
|
5 |
+
"Project-Id-Version: Easy Digital Downloads 2.3.9\n"
|
6 |
"Report-Msgid-Bugs-To: https://easydigitaldownloads.com/\n"
|
7 |
+
"POT-Creation-Date: 2015-06-18 14:05:03+00:00\n"
|
8 |
"MIME-Version: 1.0\n"
|
9 |
"Content-Type: text/plain; charset=utf-8\n"
|
10 |
"Content-Transfer-Encoding: 8bit\n"
|
11 |
"PO-Revision-Date: 2015-MO-DA HO:MI+ZONE\n"
|
12 |
"Last-Translator: WP-Translations (http://wp-translations.org/)\n"
|
13 |
"Language-Team: WP-Translations <wpt@wp-translations.org>\n"
|
14 |
+
"X-Generator: grunt-wp-i18n 0.5.0\n"
|
15 |
"X-Poedit-KeywordsList: "
|
16 |
"__;_e;_x:1,2c;_ex:1,2c;_n:1,2;_nx:1,2,4c;_n_noop:1,2;_nx_noop:1,2,3c;esc_"
|
17 |
"attr__;esc_html__;esc_attr_e;esc_html_e;esc_attr_x:1,2c;esc_html_x:1,2c;\n"
|
54 |
#: includes/admin/discounts/discount-actions.php:173
|
55 |
#: includes/admin/discounts/discount-actions.php:194
|
56 |
#: includes/admin/discounts/edit-discount.php:16
|
57 |
+
#: includes/admin/downloads/dashboard-columns.php:171
|
58 |
#: includes/admin/payments/actions.php:25
|
59 |
#: includes/admin/payments/actions.php:189
|
60 |
#: includes/admin/payments/actions.php:338
|
63 |
#: includes/admin/payments/actions.php:401
|
64 |
#: includes/admin/payments/view-order-details.php:22
|
65 |
#: includes/admin/payments/view-order-details.php:32
|
66 |
+
#: includes/admin/reporting/class-api-requests-logs-list-table.php:134
|
67 |
#: includes/admin/reporting/class-export.php:172
|
68 |
#: includes/admin/reporting/class-gateway-error-logs-list-table.php:119
|
69 |
+
#: includes/admin/reporting/export/class-batch-export.php:112
|
70 |
+
#: includes/admin/reporting/export/export-functions.php:83
|
71 |
#: includes/admin/reporting/pdf-reports.php:29
|
72 |
#: includes/admin/reporting/pdf-reports.php:33
|
73 |
+
#: includes/admin/reporting/reports.php:97 includes/admin/tools.php:347
|
74 |
+
#: includes/admin/tools.php:353
|
75 |
+
#: includes/admin/upgrades/upgrade-functions.php:160
|
76 |
+
#: includes/admin/upgrades/upgrade-functions.php:513
|
77 |
+
#: includes/admin/upgrades/upgrade-functions.php:595
|
78 |
+
#: includes/admin/upgrades/upgrade-functions.php:706
|
79 |
+
#: includes/admin/upgrades/upgrade-functions.php:803
|
80 |
+
#: includes/admin/upgrades/upgrade-functions.php:877
|
81 |
+
#: includes/admin/upgrades/upgrade-functions.php:1005
|
82 |
+
#: includes/api/class-edd-api.php:1681 includes/api/class-edd-api.php:1694
|
83 |
+
#: includes/api/class-edd-api.php:1696 includes/cart/functions.php:1067
|
84 |
+
#: includes/cart/functions.php:1084 includes/class-edd-license-handler.php:188
|
85 |
+
#: includes/class-edd-license-handler.php:261
|
86 |
#: includes/deprecated-functions.php:517 includes/deprecated-functions.php:532
|
87 |
#: includes/deprecated-functions.php:542 includes/download-functions.php:1152
|
88 |
#: includes/emails/actions.php:48 includes/emails/template.php:241
|
89 |
+
#: includes/error-tracking.php:36 includes/gateways/functions.php:211
|
90 |
#: includes/gateways/manual.php:33 includes/gateways/paypal-standard.php:34
|
91 |
#: includes/process-download.php:231 includes/process-download.php:698
|
92 |
#: includes/query-filters.php:48
|
163 |
|
164 |
#: includes/admin/admin-pages.php:41 includes/admin/plugins.php:59
|
165 |
#: includes/admin/settings/contextual-help.php:87
|
166 |
+
#: includes/admin/settings/register-settings.php:937
|
167 |
msgid "Extensions"
|
168 |
msgstr ""
|
169 |
|
179 |
msgid "API Keys"
|
180 |
msgstr ""
|
181 |
|
182 |
+
#: includes/admin/class-api-keys-table.php:135
|
183 |
msgid "View API Log"
|
184 |
msgstr ""
|
185 |
|
186 |
+
#: includes/admin/class-api-keys-table.php:142
|
187 |
msgid "Reissue"
|
188 |
msgstr ""
|
189 |
|
190 |
+
#: includes/admin/class-api-keys-table.php:147
|
191 |
msgid "Revoke"
|
192 |
msgstr ""
|
193 |
|
194 |
+
#: includes/admin/class-api-keys-table.php:164
|
195 |
+
#: includes/checkout/template.php:465 includes/checkout/template.php:471
|
196 |
+
#: includes/checkout/template.php:536 templates/shortcode-login.php:15
|
197 |
#: templates/shortcode-login.php:16 templates/shortcode-register.php:18
|
198 |
#: templates/shortcode-register.php:19
|
199 |
msgid "Username"
|
200 |
msgstr ""
|
201 |
|
202 |
+
#: includes/admin/class-api-keys-table.php:165
|
203 |
msgid "Public Key"
|
204 |
msgstr ""
|
205 |
|
206 |
+
#: includes/admin/class-api-keys-table.php:166
|
207 |
+
msgid "Token"
|
208 |
msgstr ""
|
209 |
|
210 |
+
#: includes/admin/class-api-keys-table.php:167
|
211 |
+
msgid "Secret Key"
|
212 |
msgstr ""
|
213 |
|
214 |
+
#: includes/admin/class-api-keys-table.php:193
|
215 |
msgid "Generate New API Keys"
|
216 |
msgstr ""
|
217 |
|
224 |
#: includes/admin/class-edd-notices.php:47
|
225 |
#: includes/admin/class-edd-notices.php:61
|
226 |
#: includes/admin/class-edd-notices.php:74
|
|
|
227 |
msgid "Dismiss Notice"
|
228 |
msgstr ""
|
229 |
|
242 |
#: includes/admin/class-edd-notices.php:59
|
243 |
msgid ""
|
244 |
"To protect them, you must add a redirect rule as explained in <a "
|
245 |
+
"href=\"https://docs.easydigitaldownloads.com/article/682-protected-download-"
|
246 |
"files-on-nginx\">this guide</a>."
|
247 |
msgstr ""
|
248 |
|
265 |
"<strong>%s</strong> directory, and copy the following into it:"
|
266 |
msgstr ""
|
267 |
|
268 |
+
#: includes/admin/class-edd-notices.php:93
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
269 |
msgid "Discount code added."
|
270 |
msgstr ""
|
271 |
|
272 |
+
#: includes/admin/class-edd-notices.php:96
|
273 |
msgid "There was a problem adding your discount code, please try again."
|
274 |
msgstr ""
|
275 |
|
276 |
+
#: includes/admin/class-edd-notices.php:99
|
277 |
msgid "A discount with that code already exists, please use a different code."
|
278 |
msgstr ""
|
279 |
|
280 |
+
#: includes/admin/class-edd-notices.php:102
|
281 |
msgid "Discount code updated."
|
282 |
msgstr ""
|
283 |
|
284 |
+
#: includes/admin/class-edd-notices.php:105
|
285 |
msgid "There was a problem updating your discount code, please try again."
|
286 |
msgstr ""
|
287 |
|
288 |
+
#: includes/admin/class-edd-notices.php:114
|
289 |
msgid "The payment has been deleted."
|
290 |
msgstr ""
|
291 |
|
292 |
+
#: includes/admin/class-edd-notices.php:117
|
293 |
msgid "The purchase receipt has been resent."
|
294 |
msgstr ""
|
295 |
|
296 |
+
#: includes/admin/class-edd-notices.php:120
|
297 |
msgid "The payment note has been deleted."
|
298 |
msgstr ""
|
299 |
|
300 |
+
#: includes/admin/class-edd-notices.php:129
|
301 |
msgid "The settings have been imported."
|
302 |
msgstr ""
|
303 |
|
304 |
+
#: includes/admin/class-edd-notices.php:132
|
305 |
msgid "API keys successfully generated."
|
306 |
msgstr ""
|
307 |
|
308 |
+
#: includes/admin/class-edd-notices.php:135
|
309 |
msgid "The specified user already has API keys."
|
310 |
msgstr ""
|
311 |
|
312 |
+
#: includes/admin/class-edd-notices.php:138
|
313 |
msgid "API keys successfully regenerated."
|
314 |
msgstr ""
|
315 |
|
316 |
+
#: includes/admin/class-edd-notices.php:141
|
317 |
msgid "API keys successfully revoked."
|
318 |
msgstr ""
|
319 |
|
320 |
+
#: includes/admin/class-edd-notices.php:150
|
321 |
msgid "The payment note has been added successfully."
|
322 |
msgstr ""
|
323 |
|
324 |
+
#: includes/admin/class-edd-notices.php:153
|
325 |
msgid "The payment has been successfully updated."
|
326 |
msgstr ""
|
327 |
|
328 |
+
#: includes/admin/class-edd-notices.php:162
|
329 |
msgid "Customer successfully deleted"
|
330 |
msgstr ""
|
331 |
|
353 |
#: includes/admin/discounts/add-discount.php:24
|
354 |
#: includes/admin/discounts/class-discount-codes-table.php:145
|
355 |
#: includes/admin/discounts/edit-discount.php:37
|
356 |
+
#: includes/admin/downloads/dashboard-columns.php:31
|
357 |
#: includes/admin/reporting/class-export-customers.php:76
|
358 |
+
#: includes/admin/reporting/export/class-batch-export-customers.php:43
|
359 |
#: templates/shortcode-receipt.php:123
|
360 |
msgid "Name"
|
361 |
msgstr ""
|
365 |
#: includes/admin/reporting/class-export-customers.php:68
|
366 |
#: includes/admin/reporting/class-export-customers.php:79
|
367 |
#: includes/admin/reporting/class-export-payments.php:63
|
368 |
+
#: includes/admin/reporting/export/class-batch-export-customers.php:44
|
369 |
+
#: includes/admin/reporting/export/class-batch-export-payments.php:42
|
370 |
#: templates/shortcode-register.php:23
|
371 |
msgid "Email"
|
372 |
msgstr ""
|
481 |
|
482 |
#: includes/admin/customers/customers.php:219
|
483 |
#: includes/admin/reporting/class-export-payments.php:68
|
484 |
+
#: includes/admin/reporting/export/class-batch-export-payments.php:47
|
485 |
+
#: includes/checkout/template.php:355 templates/shortcode-profile-editor.php:69
|
486 |
msgid "City"
|
487 |
msgstr ""
|
488 |
|
489 |
#: includes/admin/customers/customers.php:246
|
490 |
+
#: includes/admin/settings/register-settings.php:1506
|
491 |
+
#: includes/checkout/template.php:416 templates/shortcode-profile-editor.php:82
|
492 |
msgid "State / Province"
|
493 |
msgstr ""
|
494 |
|
514 |
|
515 |
#: includes/admin/customers/customers.php:289
|
516 |
#: includes/admin/reporting/class-export-payments.php:187
|
517 |
+
#: includes/admin/reporting/export/class-batch-export-payments.php:181
|
518 |
msgid "none"
|
519 |
msgstr ""
|
520 |
|
533 |
#: includes/admin/customers/customers.php:305
|
534 |
#: includes/admin/customers/customers.php:520
|
535 |
#: includes/admin/payments/view-order-details.php:423
|
536 |
+
#: includes/admin/thickbox.php:135 includes/class-edd-html-elements.php:573
|
537 |
msgid "Cancel"
|
538 |
msgstr ""
|
539 |
|
560 |
#: includes/admin/payments/class-payments-table.php:221
|
561 |
#: includes/admin/reporting/class-export-payments.php:61
|
562 |
#: includes/admin/reporting/class-export.php:69
|
563 |
+
#: includes/admin/reporting/export/class-batch-export-customers.php:42
|
564 |
+
#: includes/admin/reporting/export/class-batch-export-payments.php:40
|
565 |
#: templates/history-purchases.php:13
|
566 |
msgid "ID"
|
567 |
msgstr ""
|
572 |
#: includes/admin/discounts/edit-discount.php:70
|
573 |
#: includes/admin/payments/class-payments-table.php:224
|
574 |
#: includes/admin/reporting/class-export-payments.php:74
|
575 |
+
#: includes/admin/reporting/export/class-batch-export-payments.php:53
|
576 |
#: templates/history-purchases.php:15
|
577 |
msgid "Amount"
|
578 |
msgstr ""
|
579 |
|
580 |
#: includes/admin/customers/customers.php:346
|
581 |
+
#: includes/admin/downloads/dashboard-columns.php:37
|
582 |
#: includes/admin/payments/class-payments-table.php:225
|
583 |
+
#: includes/admin/reporting/class-api-requests-logs-list-table.php:94
|
584 |
#: includes/admin/reporting/class-export-download-history.php:64
|
585 |
#: includes/admin/reporting/class-export-earnings.php:62
|
586 |
#: includes/admin/reporting/class-export-payments.php:80
|
588 |
#: includes/admin/reporting/class-file-downloads-logs-list-table.php:138
|
589 |
#: includes/admin/reporting/class-gateway-error-logs-list-table.php:122
|
590 |
#: includes/admin/reporting/class-sales-logs-list-table.php:100
|
591 |
+
#: includes/admin/reporting/export/class-batch-export-file-downloads.php:42
|
592 |
+
#: includes/admin/reporting/export/class-batch-export-payments.php:59
|
593 |
#: templates/history-purchases.php:14 templates/shortcode-receipt.php:59
|
594 |
msgid "Date"
|
595 |
msgstr ""
|
599 |
#: includes/admin/discounts/edit-discount.php:175
|
600 |
#: includes/admin/payments/class-payments-table.php:227
|
601 |
#: includes/admin/reporting/class-export-payments.php:82
|
602 |
+
#: includes/admin/reporting/export/class-batch-export-payments.php:61
|
603 |
msgid "Status"
|
604 |
msgstr ""
|
605 |
|
661 |
#: includes/admin/dashboard-widgets.php:67
|
662 |
#: includes/admin/dashboard-widgets.php:85
|
663 |
#: includes/admin/dashboard-widgets.php:111
|
664 |
+
#: includes/admin/downloads/dashboard-columns.php:36
|
665 |
#: includes/admin/reporting/class-download-reports-table.php:100
|
666 |
#: includes/admin/reporting/class-export-earnings.php:64
|
667 |
+
#: includes/admin/reporting/graphing.php:183
|
668 |
+
#: includes/admin/reporting/graphing.php:434
|
669 |
+
#: includes/admin/reporting/pdf-reports.php:206
|
670 |
#: includes/admin/reporting/reports.php:54
|
671 |
msgid "Earnings"
|
672 |
msgstr ""
|
679 |
msgstr[1] ""
|
680 |
|
681 |
#: includes/admin/dashboard-widgets.php:80
|
682 |
+
#: includes/admin/reporting/graphing.php:475 includes/class-edd-stats.php:89
|
683 |
msgid "Last Month"
|
684 |
msgstr ""
|
685 |
|
686 |
#: includes/admin/dashboard-widgets.php:105
|
687 |
+
#: includes/admin/reporting/graphing.php:470 includes/class-edd-stats.php:84
|
688 |
msgid "Today"
|
689 |
msgstr ""
|
690 |
|
691 |
#: includes/admin/dashboard-widgets.php:119
|
692 |
+
#: includes/admin/downloads/dashboard-columns.php:35
|
693 |
#: includes/admin/reporting/class-download-reports-table.php:99
|
694 |
#: includes/admin/reporting/class-export-earnings.php:63
|
695 |
+
#: includes/admin/reporting/graphing.php:184
|
696 |
+
#: includes/admin/reporting/graphing.php:435
|
697 |
#: includes/admin/reporting/logs.php:145
|
698 |
+
#: includes/admin/reporting/pdf-reports.php:223
|
699 |
msgid "Sales"
|
700 |
msgstr ""
|
701 |
|
704 |
msgstr ""
|
705 |
|
706 |
#: includes/admin/dashboard-widgets.php:138
|
707 |
+
#: includes/admin/reporting/class-categories-reports-table.php:65
|
708 |
msgid "Total Earnings"
|
709 |
msgstr ""
|
710 |
|
711 |
#: includes/admin/dashboard-widgets.php:142
|
712 |
+
#: includes/admin/reporting/class-categories-reports-table.php:64
|
713 |
#: includes/admin/reporting/class-gateways-reports-table.php:81
|
714 |
msgid "Total Sales"
|
715 |
msgstr ""
|
733 |
|
734 |
#: includes/admin/discounts/add-discount.php:16
|
735 |
#: includes/admin/discounts/edit-discount.php:29
|
736 |
+
#: includes/admin/reporting/reports.php:189
|
737 |
msgid "Go Back"
|
738 |
msgstr ""
|
739 |
|
943 |
#: includes/admin/discounts/class-discount-codes-table.php:274
|
944 |
#: includes/admin/payments/class-payments-table.php:302
|
945 |
#: includes/admin/payments/class-payments-table.php:375
|
946 |
+
#: includes/payments/functions.php:1658
|
947 |
msgid "Delete"
|
948 |
msgstr ""
|
949 |
|
1002 |
|
1003 |
#: includes/admin/discounts/contextual-help.php:38
|
1004 |
#: includes/admin/settings/contextual-help.php:42
|
1005 |
+
#: includes/admin/settings/register-settings.php:930
|
1006 |
#: includes/admin/tools.php:68
|
1007 |
msgid "General"
|
1008 |
msgstr ""
|
1264 |
"Documentation</a>"
|
1265 |
msgstr ""
|
1266 |
|
1267 |
+
#: includes/admin/downloads/dashboard-columns.php:34
|
1268 |
+
#: includes/admin/downloads/dashboard-columns.php:286
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
1269 |
#: includes/admin/downloads/metabox.php:417
|
1270 |
#: includes/admin/reporting/pdf-reports.php:69
|
1271 |
#: templates/shortcode-receipt.php:130
|
1272 |
msgid "Price"
|
1273 |
msgstr ""
|
1274 |
|
1275 |
+
#: includes/admin/downloads/dashboard-columns.php:171
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
1276 |
msgid "You do not have permission to view this data."
|
1277 |
msgstr ""
|
1278 |
|
1279 |
+
#: includes/admin/downloads/dashboard-columns.php:218
|
1280 |
+
#: includes/admin/downloads/dashboard-columns.php:230
|
1281 |
+
msgid "Show all %s"
|
1282 |
msgstr ""
|
1283 |
|
1284 |
+
#: includes/admin/downloads/dashboard-columns.php:284
|
|
|
|
|
|
|
|
|
1285 |
msgid "%s Configuration"
|
1286 |
msgstr ""
|
1287 |
|
1402 |
msgstr ""
|
1403 |
|
1404 |
#: includes/admin/downloads/metabox.php:865
|
1405 |
+
#: includes/admin/settings/register-settings.php:762
|
1406 |
+
#: includes/admin/thickbox.php:62 includes/checkout/template.php:828
|
1407 |
+
#: includes/scripts.php:58 includes/shortcodes.php:36
|
1408 |
+
#: includes/template-functions.php:67
|
1409 |
+
msgid "Purchase"
|
1410 |
+
msgstr ""
|
1411 |
+
|
1412 |
+
#: includes/admin/downloads/metabox.php:871
|
1413 |
+
msgid "Purchase Shortcode:"
|
1414 |
+
msgstr ""
|
1415 |
+
|
1416 |
+
#: includes/admin/downloads/metabox.php:891
|
1417 |
msgid "Accounting Options:"
|
1418 |
msgstr ""
|
1419 |
|
1420 |
+
#: includes/admin/downloads/metabox.php:899
|
1421 |
msgid "Enter an SKU for this %s."
|
1422 |
msgstr ""
|
1423 |
|
1424 |
+
#: includes/admin/downloads/metabox.php:918
|
1425 |
msgid "Button Options:"
|
1426 |
msgstr ""
|
1427 |
|
1428 |
+
#: includes/admin/downloads/metabox.php:925
|
1429 |
msgid "Disable the automatic output of the purchase button"
|
1430 |
msgstr ""
|
1431 |
|
1432 |
+
#: includes/admin/downloads/metabox.php:934
|
1433 |
+
#: includes/admin/settings/register-settings.php:769
|
1434 |
#: includes/admin/thickbox.php:100
|
1435 |
msgid "Add to Cart"
|
1436 |
msgstr ""
|
1437 |
|
1438 |
+
#: includes/admin/downloads/metabox.php:935
|
1439 |
+
#: includes/admin/settings/register-settings.php:776 includes/shortcodes.php:46
|
1440 |
+
#: includes/template-functions.php:67
|
1441 |
msgid "Buy Now"
|
1442 |
msgstr ""
|
1443 |
|
1444 |
+
#: includes/admin/downloads/metabox.php:941
|
1445 |
msgid "Purchase button behavior"
|
1446 |
msgstr ""
|
1447 |
|
1448 |
+
#: includes/admin/downloads/metabox.php:978
|
1449 |
msgid ""
|
1450 |
"Special notes or instructions for this product. These notes will be added "
|
1451 |
"to the purchase receipt."
|
1452 |
msgstr ""
|
1453 |
|
1454 |
+
#: includes/admin/downloads/metabox.php:1005
|
1455 |
msgid "Sales:"
|
1456 |
msgstr ""
|
1457 |
|
1458 |
+
#: includes/admin/downloads/metabox.php:1006
|
1459 |
msgid "View Sales Log"
|
1460 |
msgstr ""
|
1461 |
|
1462 |
+
#: includes/admin/downloads/metabox.php:1010
|
1463 |
msgid "Earnings:"
|
1464 |
msgstr ""
|
1465 |
|
1466 |
+
#: includes/admin/downloads/metabox.php:1017
|
1467 |
msgid "View File Download Log"
|
1468 |
msgstr ""
|
1469 |
|
1470 |
+
#: includes/admin/downloads/metabox.php:1020
|
1471 |
msgid "View Detailed Earnings Report"
|
1472 |
msgstr ""
|
1473 |
|
1513 |
msgstr ""
|
1514 |
|
1515 |
#: includes/admin/payments/class-payments-table.php:201
|
1516 |
+
#: includes/payments/functions.php:602
|
1517 |
msgid "Pending"
|
1518 |
msgstr ""
|
1519 |
|
1520 |
#: includes/admin/payments/class-payments-table.php:202
|
1521 |
+
#: includes/payments/functions.php:604
|
1522 |
msgid "Refunded"
|
1523 |
msgstr ""
|
1524 |
|
1525 |
#: includes/admin/payments/class-payments-table.php:203
|
1526 |
+
#: includes/payments/functions.php:607
|
1527 |
msgid "Revoked"
|
1528 |
msgstr ""
|
1529 |
|
1530 |
#: includes/admin/payments/class-payments-table.php:204
|
1531 |
+
#: includes/payments/functions.php:605
|
1532 |
msgid "Failed"
|
1533 |
msgstr ""
|
1534 |
|
1535 |
#: includes/admin/payments/class-payments-table.php:205
|
1536 |
+
#: includes/payments/functions.php:606
|
1537 |
msgid "Abandoned"
|
1538 |
msgstr ""
|
1539 |
|
1546 |
#: includes/admin/reporting/class-export-payments.php:81
|
1547 |
#: includes/admin/reporting/class-file-downloads-logs-list-table.php:134
|
1548 |
#: includes/admin/reporting/class-sales-logs-list-table.php:96
|
1549 |
+
#: includes/admin/reporting/export/class-batch-export-payments.php:60
|
1550 |
msgid "User"
|
1551 |
msgstr ""
|
1552 |
|
1566 |
#: includes/admin/payments/class-payments-table.php:357
|
1567 |
#: includes/admin/payments/class-payments-table.php:359
|
1568 |
#: includes/admin/reporting/class-export-payments.php:192
|
1569 |
+
#: includes/admin/reporting/export/class-batch-export-payments.php:186
|
1570 |
msgid "guest"
|
1571 |
msgstr ""
|
1572 |
|
1738 |
|
1739 |
#: includes/admin/payments/view-order-details.php:101
|
1740 |
#: includes/admin/reporting/class-export-payments.php:76
|
1741 |
+
#: includes/admin/reporting/export/class-batch-export-payments.php:55
|
1742 |
msgid "Discount Code"
|
1743 |
msgstr ""
|
1744 |
|
1745 |
#: includes/admin/payments/view-order-details.php:102
|
1746 |
+
#: includes/admin/settings/register-settings.php:629
|
1747 |
msgid "None"
|
1748 |
msgstr ""
|
1749 |
|
1754 |
|
1755 |
#: includes/admin/payments/view-order-details.php:122
|
1756 |
#: includes/admin/reporting/class-export-payments.php:75
|
1757 |
+
#: includes/admin/reporting/export/class-batch-export-payments.php:54
|
1758 |
+
#: templates/checkout_cart.php:115 templates/shortcode-receipt.php:90
|
1759 |
msgid "Tax"
|
1760 |
msgstr ""
|
1761 |
|
1828 |
msgstr ""
|
1829 |
|
1830 |
#: includes/admin/payments/view-order-details.php:323
|
1831 |
+
#: templates/widget-cart-checkout.php:5
|
1832 |
msgid "Total:"
|
1833 |
msgstr ""
|
1834 |
|
1838 |
msgstr ""
|
1839 |
|
1840 |
#: includes/admin/payments/view-order-details.php:333
|
1841 |
+
#: includes/admin/settings/register-settings.php:1509 includes/scripts.php:202
|
1842 |
+
#: templates/checkout_cart.php:52 templates/checkout_cart.php:70
|
1843 |
msgid "Remove"
|
1844 |
msgstr ""
|
1845 |
|
1883 |
msgstr ""
|
1884 |
|
1885 |
#: includes/admin/payments/view-order-details.php:441
|
1886 |
+
#: includes/checkout/template.php:329
|
1887 |
msgid "Billing Address"
|
1888 |
msgstr ""
|
1889 |
|
1896 |
msgstr ""
|
1897 |
|
1898 |
#: includes/admin/payments/view-order-details.php:483
|
1899 |
+
#: includes/admin/settings/register-settings.php:262
|
1900 |
msgid "Select a country"
|
1901 |
msgstr ""
|
1902 |
|
1903 |
#: includes/admin/payments/view-order-details.php:499
|
1904 |
+
#: includes/admin/settings/register-settings.php:270
|
1905 |
msgid "Select a state"
|
1906 |
msgstr ""
|
1907 |
|
1937 |
msgstr ""
|
1938 |
|
1939 |
#: includes/admin/reporting/class-api-requests-logs-list-table.php:91
|
1940 |
+
msgid "API Version"
|
1941 |
+
msgstr ""
|
1942 |
+
|
1943 |
+
#: includes/admin/reporting/class-api-requests-logs-list-table.php:92
|
1944 |
msgid "Request IP"
|
1945 |
msgstr ""
|
1946 |
|
1947 |
+
#: includes/admin/reporting/class-api-requests-logs-list-table.php:93
|
1948 |
+
msgid "Request Speed"
|
1949 |
+
msgstr ""
|
1950 |
+
|
1951 |
+
#: includes/admin/reporting/class-api-requests-logs-list-table.php:125
|
1952 |
msgid "View Request Details"
|
1953 |
msgstr ""
|
1954 |
|
1955 |
+
#: includes/admin/reporting/class-api-requests-logs-list-table.php:125
|
1956 |
msgid "View Request"
|
1957 |
msgstr ""
|
1958 |
|
1959 |
+
#: includes/admin/reporting/class-api-requests-logs-list-table.php:131
|
1960 |
msgid "API Request:"
|
1961 |
msgstr ""
|
1962 |
|
1963 |
+
#: includes/admin/reporting/class-api-requests-logs-list-table.php:137
|
1964 |
msgid "API User:"
|
1965 |
msgstr ""
|
1966 |
|
1967 |
+
#: includes/admin/reporting/class-api-requests-logs-list-table.php:139
|
1968 |
msgid "API Key:"
|
1969 |
msgstr ""
|
1970 |
|
1971 |
+
#: includes/admin/reporting/class-api-requests-logs-list-table.php:141
|
1972 |
msgid "Request Date:"
|
1973 |
msgstr ""
|
1974 |
|
1975 |
+
#: includes/admin/reporting/class-categories-reports-table.php:63
|
1976 |
+
msgid "Category"
|
1977 |
+
msgstr ""
|
1978 |
+
|
1979 |
+
#: includes/admin/reporting/class-categories-reports-table.php:66
|
1980 |
+
msgid "Monthly Sales Avg"
|
1981 |
+
msgstr ""
|
1982 |
+
|
1983 |
+
#: includes/admin/reporting/class-categories-reports-table.php:67
|
1984 |
+
msgid "Monthly Earnings Avg"
|
1985 |
+
msgstr ""
|
1986 |
+
|
1987 |
#: includes/admin/reporting/class-download-reports-table.php:83
|
1988 |
msgid "View Detailed Report"
|
1989 |
msgstr ""
|
2002 |
|
2003 |
#: includes/admin/reporting/class-export-customers.php:66
|
2004 |
#: includes/admin/reporting/class-export-payments.php:64
|
2005 |
+
#: includes/admin/reporting/export/class-batch-export-payments.php:43
|
2006 |
+
#: includes/checkout/template.php:191 templates/shortcode-profile-editor.php:31
|
2007 |
msgid "First Name"
|
2008 |
msgstr ""
|
2009 |
|
2010 |
#: includes/admin/reporting/class-export-customers.php:67
|
2011 |
#: includes/admin/reporting/class-export-payments.php:65
|
2012 |
+
#: includes/admin/reporting/export/class-batch-export-payments.php:44
|
2013 |
+
#: includes/checkout/template.php:201 templates/shortcode-profile-editor.php:34
|
2014 |
msgid "Last Name"
|
2015 |
msgstr ""
|
2016 |
|
2027 |
msgstr ""
|
2028 |
|
2029 |
#: includes/admin/reporting/class-export-download-history.php:65
|
2030 |
+
#: includes/admin/reporting/export/class-batch-export-file-downloads.php:43
|
2031 |
msgid "Downloaded by"
|
2032 |
msgstr ""
|
2033 |
|
2034 |
#: includes/admin/reporting/class-export-download-history.php:66
|
2035 |
#: includes/admin/reporting/class-file-downloads-logs-list-table.php:137
|
2036 |
+
#: includes/admin/reporting/export/class-batch-export-file-downloads.php:44
|
2037 |
msgid "IP Address"
|
2038 |
msgstr ""
|
2039 |
|
2040 |
#: includes/admin/reporting/class-export-download-history.php:67
|
2041 |
+
#: includes/admin/reporting/export/class-batch-export-file-downloads.php:45
|
2042 |
msgid "Product"
|
2043 |
msgstr ""
|
2044 |
|
2045 |
#: includes/admin/reporting/class-export-download-history.php:68
|
2046 |
#: includes/admin/reporting/class-file-downloads-logs-list-table.php:136
|
2047 |
+
#: includes/admin/reporting/export/class-batch-export-file-downloads.php:46
|
2048 |
msgid "File"
|
2049 |
msgstr ""
|
2050 |
|
2051 |
#: includes/admin/reporting/class-export-payments.php:62
|
2052 |
+
#: includes/admin/reporting/export/class-batch-export-payments.php:41
|
2053 |
msgid "Payment Number"
|
2054 |
msgstr ""
|
2055 |
|
2056 |
#: includes/admin/reporting/class-export-payments.php:66
|
2057 |
+
#: includes/admin/reporting/export/class-batch-export-payments.php:45
|
2058 |
msgid "Address"
|
2059 |
msgstr ""
|
2060 |
|
2061 |
#: includes/admin/reporting/class-export-payments.php:67
|
2062 |
+
#: includes/admin/reporting/export/class-batch-export-payments.php:46
|
2063 |
msgid "Address (Line 2)"
|
2064 |
msgstr ""
|
2065 |
|
2066 |
#: includes/admin/reporting/class-export-payments.php:69
|
2067 |
+
#: includes/admin/reporting/export/class-batch-export-payments.php:48
|
2068 |
msgid "State"
|
2069 |
msgstr ""
|
2070 |
|
2071 |
#: includes/admin/reporting/class-export-payments.php:70
|
2072 |
+
#: includes/admin/reporting/export/class-batch-export-payments.php:49
|
2073 |
+
#: includes/admin/settings/register-settings.php:1505
|
2074 |
#: templates/shortcode-profile-editor.php:75
|
2075 |
msgid "Country"
|
2076 |
msgstr ""
|
2077 |
|
2078 |
#: includes/admin/reporting/class-export-payments.php:71
|
2079 |
+
#: includes/admin/reporting/export/class-batch-export-payments.php:50
|
2080 |
msgid "Zip Code"
|
2081 |
msgstr ""
|
2082 |
|
2083 |
#: includes/admin/reporting/class-export-payments.php:72
|
2084 |
+
#: includes/admin/reporting/export/class-batch-export-payments.php:51
|
2085 |
#: templates/shortcode-receipt.php:119
|
2086 |
msgid "Products"
|
2087 |
msgstr ""
|
2088 |
|
2089 |
#: includes/admin/reporting/class-export-payments.php:73
|
2090 |
+
#: includes/admin/reporting/export/class-batch-export-payments.php:52
|
2091 |
msgid "SKUs"
|
2092 |
msgstr ""
|
2093 |
|
2094 |
#: includes/admin/reporting/class-export-payments.php:77
|
2095 |
+
#: includes/admin/reporting/export/class-batch-export-payments.php:56
|
2096 |
#: templates/shortcode-receipt.php:53
|
2097 |
msgid "Payment Method"
|
2098 |
msgstr ""
|
2099 |
|
2100 |
#: includes/admin/reporting/class-export-payments.php:78
|
2101 |
+
#: includes/admin/reporting/export/class-batch-export-payments.php:57
|
2102 |
msgid "Transaction ID"
|
2103 |
msgstr ""
|
2104 |
|
2105 |
#: includes/admin/reporting/class-export-payments.php:79
|
2106 |
+
#: includes/admin/reporting/export/class-batch-export-payments.php:58
|
2107 |
msgid "Purchase Key"
|
2108 |
msgstr ""
|
2109 |
|
2110 |
#: includes/admin/reporting/class-export.php:172
|
2111 |
+
#: includes/admin/reporting/export/class-batch-export.php:112
|
2112 |
msgid "You do not have permission to export data."
|
2113 |
msgstr ""
|
2114 |
|
2159 |
msgstr ""
|
2160 |
|
2161 |
#: includes/admin/reporting/contextual-help.php:48
|
2162 |
+
#: includes/admin/reporting/reports.php:31 includes/admin/tools.php:265
|
2163 |
msgid "Export"
|
2164 |
msgstr ""
|
2165 |
|
2215 |
msgid "You can enter the download file's name"
|
2216 |
msgstr ""
|
2217 |
|
2218 |
+
#: includes/admin/reporting/export/class-batch-export-customers.php:45
|
2219 |
+
msgid "Number of Purchases"
|
2220 |
+
msgstr ""
|
2221 |
+
|
2222 |
+
#: includes/admin/reporting/export/class-batch-export-customers.php:46
|
2223 |
+
msgid "Customer Value"
|
2224 |
+
msgstr ""
|
2225 |
+
|
2226 |
+
#: includes/admin/reporting/export/export-functions.php:83
|
2227 |
+
#: includes/admin/reporting/pdf-reports.php:33
|
2228 |
+
#: includes/api/class-edd-api.php:1681
|
2229 |
+
#: includes/class-edd-license-handler.php:188
|
2230 |
+
#: includes/class-edd-license-handler.php:261
|
2231 |
+
msgid "Nonce verification failed"
|
2232 |
+
msgstr ""
|
2233 |
+
|
2234 |
+
#: includes/admin/reporting/graphing.php:193
|
2235 |
msgid "Earnings Over Time"
|
2236 |
msgstr ""
|
2237 |
|
2238 |
+
#: includes/admin/reporting/graphing.php:211
|
2239 |
+
#: includes/admin/reporting/graphing.php:451
|
2240 |
msgid "Total earnings for period shown: "
|
2241 |
msgstr ""
|
2242 |
|
2243 |
+
#: includes/admin/reporting/graphing.php:219
|
2244 |
+
#: includes/admin/reporting/graphing.php:452
|
2245 |
msgid "Total sales for period shown: "
|
2246 |
msgstr ""
|
2247 |
|
2248 |
+
#: includes/admin/reporting/graphing.php:225
|
2249 |
msgid "Estimated monthly earnings: "
|
2250 |
msgstr ""
|
2251 |
|
2252 |
+
#: includes/admin/reporting/graphing.php:233
|
2253 |
msgid "Estimated monthly sales: "
|
2254 |
msgstr ""
|
2255 |
|
2256 |
+
#: includes/admin/reporting/graphing.php:240
|
2257 |
+
msgid "Excludes sales tax."
|
2258 |
+
msgstr ""
|
2259 |
+
|
2260 |
+
#: includes/admin/reporting/graphing.php:441
|
2261 |
msgid "Earnings Over Time for %s"
|
2262 |
msgstr ""
|
2263 |
|
2264 |
+
#: includes/admin/reporting/graphing.php:453
|
2265 |
msgid "Average monthly earnings: %s"
|
2266 |
msgstr ""
|
2267 |
|
2268 |
+
#: includes/admin/reporting/graphing.php:454
|
2269 |
msgid "Average monthly sales: %s"
|
2270 |
msgstr ""
|
2271 |
|
2272 |
+
#: includes/admin/reporting/graphing.php:471 includes/class-edd-stats.php:85
|
2273 |
msgid "Yesterday"
|
2274 |
msgstr ""
|
2275 |
|
2276 |
+
#: includes/admin/reporting/graphing.php:472 includes/class-edd-stats.php:86
|
2277 |
msgid "This Week"
|
2278 |
msgstr ""
|
2279 |
|
2280 |
+
#: includes/admin/reporting/graphing.php:473 includes/class-edd-stats.php:87
|
2281 |
msgid "Last Week"
|
2282 |
msgstr ""
|
2283 |
|
2284 |
+
#: includes/admin/reporting/graphing.php:474 includes/class-edd-stats.php:88
|
2285 |
msgid "This Month"
|
2286 |
msgstr ""
|
2287 |
|
2288 |
+
#: includes/admin/reporting/graphing.php:476 includes/class-edd-stats.php:90
|
2289 |
msgid "This Quarter"
|
2290 |
msgstr ""
|
2291 |
|
2292 |
+
#: includes/admin/reporting/graphing.php:477
|
2293 |
msgid "Last Quarter"
|
2294 |
msgstr ""
|
2295 |
|
2296 |
+
#: includes/admin/reporting/graphing.php:478 includes/class-edd-stats.php:92
|
2297 |
msgid "This Year"
|
2298 |
msgstr ""
|
2299 |
|
2300 |
+
#: includes/admin/reporting/graphing.php:479 includes/class-edd-stats.php:93
|
2301 |
msgid "Last Year"
|
2302 |
msgstr ""
|
2303 |
|
2304 |
+
#: includes/admin/reporting/graphing.php:480
|
2305 |
msgid "Custom"
|
2306 |
msgstr ""
|
2307 |
|
2308 |
+
#: includes/admin/reporting/graphing.php:512
|
2309 |
msgid "From"
|
2310 |
msgstr ""
|
2311 |
|
2312 |
+
#: includes/admin/reporting/graphing.php:528
|
2313 |
msgid "To"
|
2314 |
msgstr ""
|
2315 |
|
2316 |
+
#: includes/admin/reporting/graphing.php:548
|
2317 |
+
msgid "Exclude Taxes"
|
2318 |
+
msgstr ""
|
2319 |
+
|
2320 |
+
#: includes/admin/reporting/graphing.php:553
|
2321 |
msgid "Filter"
|
2322 |
msgstr ""
|
2323 |
|
2324 |
#: includes/admin/reporting/logs.php:144
|
2325 |
+
#: includes/admin/settings/register-settings.php:652
|
2326 |
msgid "File Downloads"
|
2327 |
msgstr ""
|
2328 |
|
2342 |
msgid "You do not have permission to generate PDF sales reports"
|
2343 |
msgstr ""
|
2344 |
|
|
|
|
|
|
|
|
|
|
|
|
|
2345 |
#: includes/admin/reporting/pdf-reports.php:39
|
2346 |
msgid "to"
|
2347 |
msgstr ""
|
2363 |
msgid "Product Name"
|
2364 |
msgstr ""
|
2365 |
|
2366 |
+
#: includes/admin/reporting/pdf-reports.php:72 includes/post-types.php:239
|
2367 |
+
msgid "Tags"
|
2368 |
msgstr ""
|
2369 |
|
2370 |
#: includes/admin/reporting/pdf-reports.php:73
|
2371 |
+
msgid "Number of Sales"
|
2372 |
+
msgstr ""
|
2373 |
+
|
2374 |
+
#: includes/admin/reporting/pdf-reports.php:74
|
2375 |
msgid "Earnings to Date"
|
2376 |
msgstr ""
|
2377 |
|
2378 |
+
#: includes/admin/reporting/pdf-reports.php:127
|
2379 |
msgid "No %s found."
|
2380 |
msgstr ""
|
2381 |
|
2382 |
+
#: includes/admin/reporting/pdf-reports.php:134
|
2383 |
msgid "Graph View"
|
2384 |
msgstr ""
|
2385 |
|
2386 |
+
#: includes/admin/reporting/pdf-reports.php:227
|
2387 |
msgid "Sales and Earnings by Month for all Products"
|
2388 |
msgstr ""
|
2389 |
|
2390 |
+
#: includes/admin/reporting/pdf-reports.php:238
|
2391 |
msgid "Jan"
|
2392 |
msgstr ""
|
2393 |
|
2394 |
+
#: includes/admin/reporting/pdf-reports.php:239
|
2395 |
msgid "Feb"
|
2396 |
msgstr ""
|
2397 |
|
2398 |
+
#: includes/admin/reporting/pdf-reports.php:240
|
2399 |
msgid "Mar"
|
2400 |
msgstr ""
|
2401 |
|
2402 |
+
#: includes/admin/reporting/pdf-reports.php:241
|
2403 |
msgid "Apr"
|
2404 |
msgstr ""
|
2405 |
|
2406 |
+
#: includes/admin/reporting/pdf-reports.php:242
|
2407 |
msgid "May"
|
2408 |
msgstr ""
|
2409 |
|
2410 |
+
#: includes/admin/reporting/pdf-reports.php:243
|
2411 |
msgid "June"
|
2412 |
msgstr ""
|
2413 |
|
2414 |
+
#: includes/admin/reporting/pdf-reports.php:244
|
2415 |
msgid "July"
|
2416 |
msgstr ""
|
2417 |
|
2418 |
+
#: includes/admin/reporting/pdf-reports.php:245
|
2419 |
msgid "Aug"
|
2420 |
msgstr ""
|
2421 |
|
2422 |
+
#: includes/admin/reporting/pdf-reports.php:246
|
2423 |
msgid "Sept"
|
2424 |
msgstr ""
|
2425 |
|
2426 |
+
#: includes/admin/reporting/pdf-reports.php:247
|
2427 |
msgid "Oct"
|
2428 |
msgstr ""
|
2429 |
|
2430 |
+
#: includes/admin/reporting/pdf-reports.php:248
|
2431 |
msgid "Nov"
|
2432 |
msgstr ""
|
2433 |
|
2434 |
+
#: includes/admin/reporting/pdf-reports.php:249
|
2435 |
msgid "Dec"
|
2436 |
msgstr ""
|
2437 |
|
2438 |
+
#: includes/admin/reporting/reports.php:55
|
2439 |
+
msgid "Earnings by Category"
|
2440 |
msgstr ""
|
2441 |
|
2442 |
#: includes/admin/reporting/reports.php:57
|
2443 |
+
msgid "Payment Methods"
|
2444 |
+
msgstr ""
|
2445 |
+
|
2446 |
+
#: includes/admin/reporting/reports.php:58
|
2447 |
#: includes/admin/settings/contextual-help.php:71
|
2448 |
+
#: includes/admin/settings/register-settings.php:934
|
2449 |
msgid "Taxes"
|
2450 |
msgstr ""
|
2451 |
|
2452 |
+
#: includes/admin/reporting/reports.php:97
|
2453 |
msgid "You do not have permission to access this report"
|
2454 |
msgstr ""
|
2455 |
|
2456 |
+
#: includes/admin/reporting/reports.php:128
|
2457 |
msgid "Report Type"
|
2458 |
msgstr ""
|
2459 |
|
2460 |
+
#: includes/admin/reporting/reports.php:138
|
2461 |
msgid "Show"
|
2462 |
msgstr ""
|
2463 |
|
2464 |
+
#: includes/admin/reporting/reports.php:265
|
2465 |
+
msgid "Category Sales Mix: "
|
2466 |
+
msgstr ""
|
2467 |
+
|
2468 |
+
#: includes/admin/reporting/reports.php:269
|
2469 |
+
msgid "Category Earnings Mix: "
|
2470 |
+
msgstr ""
|
2471 |
+
|
2472 |
+
#: includes/admin/reporting/reports.php:278
|
2473 |
+
msgid ""
|
2474 |
+
"All Parent categories include sales and earnings stats from child "
|
2475 |
+
"categories."
|
2476 |
+
msgstr ""
|
2477 |
+
|
2478 |
+
#: includes/admin/reporting/reports.php:281
|
2479 |
+
msgid "Stats include all sales and earnings for the lifetime of the store."
|
2480 |
+
msgstr ""
|
2481 |
+
|
2482 |
+
#: includes/admin/reporting/reports.php:310
|
2483 |
msgid "Tax Report"
|
2484 |
msgstr ""
|
2485 |
|
2486 |
+
#: includes/admin/reporting/reports.php:312
|
2487 |
msgid ""
|
2488 |
"This report shows the total amount collected in sales tax for the given "
|
2489 |
"year."
|
2490 |
msgstr ""
|
2491 |
|
2492 |
+
#: includes/admin/reporting/reports.php:323
|
2493 |
msgid "Submit"
|
2494 |
msgstr ""
|
2495 |
|
2496 |
+
#: includes/admin/reporting/reports.php:352
|
2497 |
msgid "Export PDF of Sales and Earnings"
|
2498 |
msgstr ""
|
2499 |
|
2500 |
+
#: includes/admin/reporting/reports.php:354
|
2501 |
msgid ""
|
2502 |
"Download a PDF of Sales and Earnings reports for all products for the "
|
2503 |
"current year."
|
2504 |
msgstr ""
|
2505 |
|
2506 |
+
#: includes/admin/reporting/reports.php:354
|
2507 |
msgid "Date range reports will be coming soon."
|
2508 |
msgstr ""
|
2509 |
|
2510 |
+
#: includes/admin/reporting/reports.php:355
|
2511 |
msgid "Generate PDF"
|
2512 |
msgstr ""
|
2513 |
|
2514 |
+
#: includes/admin/reporting/reports.php:360
|
2515 |
msgid "Export Earnings and Sales Stats"
|
2516 |
msgstr ""
|
2517 |
|
2518 |
+
#: includes/admin/reporting/reports.php:362
|
2519 |
msgid "Download a CSV of earnings and sales over time."
|
2520 |
msgstr ""
|
2521 |
|
2522 |
+
#: includes/admin/reporting/reports.php:371
|
2523 |
+
#: includes/admin/reporting/reports.php:396
|
2524 |
+
#: includes/admin/reporting/reports.php:422
|
2525 |
+
#: includes/admin/reporting/reports.php:437
|
2526 |
msgid "Generate CSV"
|
2527 |
msgstr ""
|
2528 |
|
2529 |
+
#: includes/admin/reporting/reports.php:378
|
2530 |
msgid "Export Payment History"
|
2531 |
msgstr ""
|
2532 |
|
2533 |
+
#: includes/admin/reporting/reports.php:380
|
2534 |
msgid "Download a CSV of all payments recorded."
|
2535 |
msgstr ""
|
2536 |
|
2537 |
+
#: includes/admin/reporting/reports.php:383
|
2538 |
+
#: includes/admin/reporting/reports.php:434
|
2539 |
+
msgid "Choose start date"
|
2540 |
msgstr ""
|
2541 |
|
2542 |
+
#: includes/admin/reporting/reports.php:384
|
2543 |
+
#: includes/admin/reporting/reports.php:435
|
2544 |
+
msgid "Choose end date"
|
2545 |
msgstr ""
|
2546 |
|
2547 |
+
#: includes/admin/reporting/reports.php:386
|
2548 |
+
msgid "All Statuses"
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
2549 |
msgstr ""
|
2550 |
|
2551 |
+
#: includes/admin/reporting/reports.php:405
|
2552 |
+
msgid "Export Customers in CSV"
|
|
|
|
|
2553 |
msgstr ""
|
2554 |
|
2555 |
+
#: includes/admin/reporting/reports.php:407
|
2556 |
+
msgid "Download a CSV of customers."
|
2557 |
msgstr ""
|
2558 |
|
2559 |
+
#: includes/admin/reporting/reports.php:411
|
2560 |
+
msgid "All %s"
|
2561 |
msgstr ""
|
2562 |
|
2563 |
+
#: includes/admin/reporting/reports.php:429
|
2564 |
msgid "Export Download History in CSV"
|
2565 |
msgstr ""
|
2566 |
|
2567 |
+
#: includes/admin/reporting/reports.php:431
|
2568 |
+
msgid "Download a CSV of file downloads."
|
2569 |
msgstr ""
|
2570 |
|
2571 |
#: includes/admin/settings/contextual-help.php:43
|
2576 |
msgstr ""
|
2577 |
|
2578 |
#: includes/admin/settings/contextual-help.php:48
|
2579 |
+
#: includes/admin/settings/register-settings.php:355
|
2580 |
+
#: includes/admin/settings/register-settings.php:931
|
2581 |
msgid "Payment Gateways"
|
2582 |
msgstr ""
|
2583 |
|
2605 |
"address in order for payments to get processed."
|
2606 |
msgstr ""
|
2607 |
|
2608 |
+
#: includes/admin/settings/contextual-help.php:57
|
2609 |
+
#: includes/admin/settings/register-settings.php:932
|
2610 |
+
msgid "Emails"
|
2611 |
+
msgstr ""
|
2612 |
+
|
2613 |
#: includes/admin/settings/contextual-help.php:59
|
2614 |
msgid ""
|
2615 |
"This screen allows you to customize how emails act throughout your store. "
|
2626 |
msgstr ""
|
2627 |
|
2628 |
#: includes/admin/settings/contextual-help.php:65
|
2629 |
+
#: includes/admin/settings/register-settings.php:933
|
2630 |
msgid "Styles"
|
2631 |
msgstr ""
|
2632 |
|
2722 |
msgid "A description of all the options are provided beside their input boxes."
|
2723 |
msgstr ""
|
2724 |
|
|
|
|
|
|
|
|
|
2725 |
#: includes/admin/settings/register-settings.php:221
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
2726 |
msgid "Checkout Page"
|
2727 |
msgstr ""
|
2728 |
|
2729 |
+
#: includes/admin/settings/register-settings.php:222
|
2730 |
msgid ""
|
2731 |
"This is the checkout page where buyers will complete their purchases. The "
|
2732 |
"[download_checkout] short code must be on this page."
|
2733 |
msgstr ""
|
2734 |
|
2735 |
+
#: includes/admin/settings/register-settings.php:226
|
2736 |
+
#: includes/admin/settings/register-settings.php:235
|
2737 |
+
#: includes/admin/settings/register-settings.php:244
|
2738 |
+
#: includes/admin/settings/register-settings.php:253
|
2739 |
msgid "Select a page"
|
2740 |
msgstr ""
|
2741 |
|
2742 |
+
#: includes/admin/settings/register-settings.php:230
|
2743 |
msgid "Success Page"
|
2744 |
msgstr ""
|
2745 |
|
2746 |
+
#: includes/admin/settings/register-settings.php:231
|
2747 |
msgid ""
|
2748 |
"This is the page buyers are sent to after completing their purchases. The "
|
2749 |
"[edd_receipt] short code should be on this page."
|
2750 |
msgstr ""
|
2751 |
|
2752 |
+
#: includes/admin/settings/register-settings.php:239
|
2753 |
msgid "Failed Transaction Page"
|
2754 |
msgstr ""
|
2755 |
|
2756 |
+
#: includes/admin/settings/register-settings.php:240
|
2757 |
msgid ""
|
2758 |
"This is the page buyers are sent to if their transaction is cancelled or "
|
2759 |
"fails"
|
2760 |
msgstr ""
|
2761 |
|
2762 |
+
#: includes/admin/settings/register-settings.php:248
|
2763 |
msgid "Purchase History Page"
|
2764 |
msgstr ""
|
2765 |
|
2766 |
+
#: includes/admin/settings/register-settings.php:249
|
2767 |
msgid ""
|
2768 |
"This page shows a complete purchase history for the current user, including "
|
2769 |
"download links"
|
2770 |
msgstr ""
|
2771 |
|
2772 |
+
#: includes/admin/settings/register-settings.php:257
|
2773 |
msgid "Base Country"
|
2774 |
msgstr ""
|
2775 |
|
2776 |
+
#: includes/admin/settings/register-settings.php:258
|
2777 |
msgid "Where does your store operate from?"
|
2778 |
msgstr ""
|
2779 |
|
2780 |
+
#: includes/admin/settings/register-settings.php:266
|
2781 |
msgid "Base State / Province"
|
2782 |
msgstr ""
|
2783 |
|
2784 |
+
#: includes/admin/settings/register-settings.php:267
|
2785 |
msgid "What state / province does your store operate from?"
|
2786 |
msgstr ""
|
2787 |
|
2788 |
+
#: includes/admin/settings/register-settings.php:274
|
2789 |
msgid "Currency Settings"
|
2790 |
msgstr ""
|
2791 |
|
2792 |
+
#: includes/admin/settings/register-settings.php:275
|
2793 |
msgid "Configure the currency options"
|
2794 |
msgstr ""
|
2795 |
|
2796 |
+
#: includes/admin/settings/register-settings.php:280
|
2797 |
msgid "Currency"
|
2798 |
msgstr ""
|
2799 |
|
2800 |
+
#: includes/admin/settings/register-settings.php:281
|
2801 |
msgid ""
|
2802 |
"Choose your currency. Note that some payment gateways have currency "
|
2803 |
"restrictions."
|
2804 |
msgstr ""
|
2805 |
|
2806 |
+
#: includes/admin/settings/register-settings.php:288
|
2807 |
msgid "Currency Position"
|
2808 |
msgstr ""
|
2809 |
|
2810 |
+
#: includes/admin/settings/register-settings.php:289
|
2811 |
msgid "Choose the location of the currency sign."
|
2812 |
msgstr ""
|
2813 |
|
2814 |
+
#: includes/admin/settings/register-settings.php:292
|
2815 |
msgid "Before - $10"
|
2816 |
msgstr ""
|
2817 |
|
2818 |
+
#: includes/admin/settings/register-settings.php:293
|
2819 |
msgid "After - 10$"
|
2820 |
msgstr ""
|
2821 |
|
2822 |
+
#: includes/admin/settings/register-settings.php:298
|
2823 |
msgid "Thousands Separator"
|
2824 |
msgstr ""
|
2825 |
|
2826 |
+
#: includes/admin/settings/register-settings.php:299
|
2827 |
msgid "The symbol (usually , or .) to separate thousands"
|
2828 |
msgstr ""
|
2829 |
|
2830 |
+
#: includes/admin/settings/register-settings.php:306
|
2831 |
msgid "Decimal Separator"
|
2832 |
msgstr ""
|
2833 |
|
2834 |
+
#: includes/admin/settings/register-settings.php:307
|
2835 |
msgid "The symbol (usually , or .) to separate decimal points"
|
2836 |
msgstr ""
|
2837 |
|
2838 |
+
#: includes/admin/settings/register-settings.php:314
|
2839 |
msgid "API Settings"
|
2840 |
msgstr ""
|
2841 |
|
2842 |
+
#: includes/admin/settings/register-settings.php:320
|
2843 |
msgid "Allow User Keys"
|
2844 |
msgstr ""
|
2845 |
|
2846 |
+
#: includes/admin/settings/register-settings.php:321
|
2847 |
msgid ""
|
2848 |
"Check this box to allow all users to generate API keys. Users with the "
|
2849 |
"'manage_shop_settings' capability are always allowed to generate keys."
|
2850 |
msgstr ""
|
2851 |
|
2852 |
+
#: includes/admin/settings/register-settings.php:326
|
2853 |
msgid "Tracking Settings"
|
2854 |
msgstr ""
|
2855 |
|
2856 |
+
#: includes/admin/settings/register-settings.php:332
|
2857 |
msgid "Allow Usage Tracking?"
|
2858 |
msgstr ""
|
2859 |
|
2860 |
+
#: includes/admin/settings/register-settings.php:333
|
2861 |
msgid ""
|
2862 |
"Allow Easy Digital Downloads to anonymously track how this plugin is used "
|
2863 |
"and help us make the plugin better. Opt-in and receive a 20% discount code "
|
2866 |
"Digital Downloads store</a>. Your discount code will be emailed to you."
|
2867 |
msgstr ""
|
2868 |
|
2869 |
+
#: includes/admin/settings/register-settings.php:338
|
2870 |
msgid "Remove Data on Uninstall?"
|
2871 |
msgstr ""
|
2872 |
|
2873 |
+
#: includes/admin/settings/register-settings.php:339
|
2874 |
msgid ""
|
2875 |
"Check this box if you would like EDD to completely remove all of its data "
|
2876 |
"when the plugin is deleted."
|
2877 |
msgstr ""
|
2878 |
|
2879 |
+
#: includes/admin/settings/register-settings.php:349
|
2880 |
+
msgid "Test Mode"
|
2881 |
+
msgstr ""
|
2882 |
+
|
2883 |
+
#: includes/admin/settings/register-settings.php:350
|
2884 |
+
msgid ""
|
2885 |
+
"While in test mode no live transactions are processed. To fully use test "
|
2886 |
+
"mode, you must have a sandbox (test) account for the payment gateway you "
|
2887 |
+
"are testing."
|
2888 |
+
msgstr ""
|
2889 |
+
|
2890 |
+
#: includes/admin/settings/register-settings.php:356
|
2891 |
msgid "Choose the payment gateways you want to enable."
|
2892 |
msgstr ""
|
2893 |
|
2894 |
+
#: includes/admin/settings/register-settings.php:362
|
2895 |
msgid "Default Gateway"
|
2896 |
msgstr ""
|
2897 |
|
2898 |
+
#: includes/admin/settings/register-settings.php:363
|
2899 |
msgid "This gateway will be loaded automatically with the checkout page."
|
2900 |
msgstr ""
|
2901 |
|
2902 |
+
#: includes/admin/settings/register-settings.php:369
|
2903 |
msgid "Accepted Payment Method Icons"
|
2904 |
msgstr ""
|
2905 |
|
2906 |
+
#: includes/admin/settings/register-settings.php:370
|
2907 |
msgid "Display icons for the selected payment methods"
|
2908 |
msgstr ""
|
2909 |
|
2910 |
+
#: includes/admin/settings/register-settings.php:370
|
2911 |
msgid ""
|
2912 |
"You will also need to configure your gateway settings if you are accepting "
|
2913 |
"credit cards"
|
2914 |
msgstr ""
|
2915 |
|
2916 |
+
#: includes/admin/settings/register-settings.php:383
|
2917 |
msgid "PayPal Settings"
|
2918 |
msgstr ""
|
2919 |
|
2920 |
+
#: includes/admin/settings/register-settings.php:384
|
2921 |
msgid "Configure the PayPal settings"
|
2922 |
msgstr ""
|
2923 |
|
2924 |
+
#: includes/admin/settings/register-settings.php:389
|
2925 |
msgid "PayPal Email"
|
2926 |
msgstr ""
|
2927 |
|
2928 |
+
#: includes/admin/settings/register-settings.php:390
|
2929 |
msgid "Enter your PayPal account's email"
|
2930 |
msgstr ""
|
2931 |
|
2932 |
+
#: includes/admin/settings/register-settings.php:396
|
2933 |
msgid "PayPal Page Style"
|
2934 |
msgstr ""
|
2935 |
|
2936 |
+
#: includes/admin/settings/register-settings.php:397
|
2937 |
msgid "Enter the name of the page style to use, or leave blank for default"
|
2938 |
msgstr ""
|
2939 |
|
2940 |
+
#: includes/admin/settings/register-settings.php:403
|
2941 |
msgid "Disable PayPal IPN Verification"
|
2942 |
msgstr ""
|
2943 |
|
2944 |
+
#: includes/admin/settings/register-settings.php:404
|
2945 |
msgid ""
|
2946 |
"If payments are not getting marked as complete, then check this box. This "
|
2947 |
"forces the site to use a slightly less secure method of verifying purchases."
|
2948 |
msgstr ""
|
2949 |
|
2950 |
+
#: includes/admin/settings/register-settings.php:414
|
2951 |
msgid "Email Template"
|
2952 |
msgstr ""
|
2953 |
|
2954 |
+
#: includes/admin/settings/register-settings.php:415
|
2955 |
msgid ""
|
2956 |
"Choose a template. Click \"Save Changes\" then \"Preview Purchase Receipt\" "
|
2957 |
"to see the new template."
|
2958 |
msgstr ""
|
2959 |
|
2960 |
+
#: includes/admin/settings/register-settings.php:421
|
2961 |
msgid "Logo"
|
2962 |
msgstr ""
|
2963 |
|
2964 |
+
#: includes/admin/settings/register-settings.php:422
|
2965 |
msgid ""
|
2966 |
"Upload or choose a logo to be displayed at the top of the purchase receipt "
|
2967 |
"emails. Displayed on HTML emails only."
|
2968 |
msgstr ""
|
2969 |
|
2970 |
+
#: includes/admin/settings/register-settings.php:433
|
2971 |
msgid "From Name"
|
2972 |
msgstr ""
|
2973 |
|
2974 |
+
#: includes/admin/settings/register-settings.php:434
|
2975 |
msgid ""
|
2976 |
"The name purchase receipts are said to come from. This should probably be "
|
2977 |
"your site or shop name."
|
2978 |
msgstr ""
|
2979 |
|
2980 |
+
#: includes/admin/settings/register-settings.php:440
|
2981 |
msgid "From Email"
|
2982 |
msgstr ""
|
2983 |
|
2984 |
+
#: includes/admin/settings/register-settings.php:441
|
2985 |
msgid ""
|
2986 |
"Email to send purchase receipts from. This will act as the \"from\" and "
|
2987 |
"\"reply-to\" address."
|
2988 |
msgstr ""
|
2989 |
|
2990 |
+
#: includes/admin/settings/register-settings.php:447
|
2991 |
msgid "Purchase Email Subject"
|
2992 |
msgstr ""
|
2993 |
|
2994 |
+
#: includes/admin/settings/register-settings.php:448
|
2995 |
msgid "Enter the subject line for the purchase receipt email"
|
2996 |
msgstr ""
|
2997 |
|
2998 |
+
#: includes/admin/settings/register-settings.php:450
|
2999 |
+
#: includes/admin/settings/register-settings.php:457
|
3000 |
+
#: includes/admin/settings/register-settings.php:461
|
3001 |
+
#: includes/emails/functions.php:36 includes/emails/functions.php:40
|
3002 |
+
#: includes/emails/functions.php:77 includes/emails/functions.php:81
|
3003 |
#: includes/emails/template.php:139
|
3004 |
msgid "Purchase Receipt"
|
3005 |
msgstr ""
|
3006 |
|
3007 |
#: includes/admin/settings/register-settings.php:454
|
3008 |
+
msgid "Purchase Email Heading"
|
3009 |
+
msgstr ""
|
3010 |
+
|
3011 |
+
#: includes/admin/settings/register-settings.php:455
|
3012 |
+
msgid "Enter the heading for the purchase receipt email"
|
3013 |
+
msgstr ""
|
3014 |
+
|
3015 |
+
#: includes/admin/settings/register-settings.php:462
|
3016 |
#: includes/deprecated-functions.php:301
|
3017 |
msgid ""
|
3018 |
"Enter the email that is sent to users after completing a successful "
|
3019 |
"purchase. HTML is accepted. Available template tags:"
|
3020 |
msgstr ""
|
3021 |
|
3022 |
+
#: includes/admin/settings/register-settings.php:464
|
3023 |
#: includes/emails/template.php:157
|
3024 |
msgid "Dear"
|
3025 |
msgstr ""
|
3026 |
|
3027 |
+
#: includes/admin/settings/register-settings.php:464
|
3028 |
#: includes/emails/template.php:158
|
3029 |
msgid ""
|
3030 |
"Thank you for your purchase. Please click on the link(s) below to download "
|
3031 |
"your files."
|
3032 |
msgstr ""
|
3033 |
|
3034 |
+
#: includes/admin/settings/register-settings.php:468
|
3035 |
msgid "New Sale Notifications"
|
3036 |
msgstr ""
|
3037 |
|
3038 |
+
#: includes/admin/settings/register-settings.php:469
|
3039 |
msgid "Configure new sale notification emails"
|
3040 |
msgstr ""
|
3041 |
|
3042 |
+
#: includes/admin/settings/register-settings.php:474
|
3043 |
msgid "Sale Notification Subject"
|
3044 |
msgstr ""
|
3045 |
|
3046 |
+
#: includes/admin/settings/register-settings.php:475
|
3047 |
msgid "Enter the subject line for the sale notification email"
|
3048 |
msgstr ""
|
3049 |
|
3050 |
+
#: includes/admin/settings/register-settings.php:481
|
3051 |
msgid "Sale Notification"
|
3052 |
msgstr ""
|
3053 |
|
3054 |
+
#: includes/admin/settings/register-settings.php:482
|
3055 |
#: includes/deprecated-functions.php:334
|
3056 |
msgid ""
|
3057 |
"Enter the email that is sent to sale notification emails after completion "
|
3058 |
"of a purchase. HTML is accepted. Available template tags:"
|
3059 |
msgstr ""
|
3060 |
|
3061 |
+
#: includes/admin/settings/register-settings.php:488
|
3062 |
msgid "Sale Notification Emails"
|
3063 |
msgstr ""
|
3064 |
|
3065 |
+
#: includes/admin/settings/register-settings.php:489
|
3066 |
msgid ""
|
3067 |
"Enter the email address(es) that should receive a notification anytime a "
|
3068 |
"sale is made, one per line"
|
3069 |
msgstr ""
|
3070 |
|
3071 |
+
#: includes/admin/settings/register-settings.php:495
|
3072 |
msgid "Disable Admin Notifications"
|
3073 |
msgstr ""
|
3074 |
|
3075 |
+
#: includes/admin/settings/register-settings.php:496
|
3076 |
msgid "Check this box if you do not want to receive emails when new sales are made."
|
3077 |
msgstr ""
|
3078 |
|
3079 |
+
#: includes/admin/settings/register-settings.php:506
|
3080 |
msgid "Disable Styles"
|
3081 |
msgstr ""
|
3082 |
|
3083 |
+
#: includes/admin/settings/register-settings.php:507
|
3084 |
msgid ""
|
3085 |
"Check this to disable all included styling of buttons, checkout fields, and "
|
3086 |
"all other elements."
|
3087 |
msgstr ""
|
3088 |
|
3089 |
+
#: includes/admin/settings/register-settings.php:512
|
3090 |
msgid "Buttons"
|
3091 |
msgstr ""
|
3092 |
|
3093 |
+
#: includes/admin/settings/register-settings.php:513
|
3094 |
msgid "Options for add to cart and purchase buttons"
|
3095 |
msgstr ""
|
3096 |
|
3097 |
+
#: includes/admin/settings/register-settings.php:518
|
3098 |
msgid "Default Button Style"
|
3099 |
msgstr ""
|
3100 |
|
3101 |
+
#: includes/admin/settings/register-settings.php:519
|
3102 |
msgid "Choose the style you want to use for the buttons."
|
3103 |
msgstr ""
|
3104 |
|
3105 |
+
#: includes/admin/settings/register-settings.php:525
|
3106 |
msgid "Default Button Color"
|
3107 |
msgstr ""
|
3108 |
|
3109 |
+
#: includes/admin/settings/register-settings.php:526
|
3110 |
msgid "Choose the color you want to use for the buttons."
|
3111 |
msgstr ""
|
3112 |
|
3113 |
+
#: includes/admin/settings/register-settings.php:537
|
3114 |
msgid "Enable Taxes"
|
3115 |
msgstr ""
|
3116 |
|
3117 |
+
#: includes/admin/settings/register-settings.php:538
|
3118 |
msgid "Check this to enable taxes on purchases."
|
3119 |
msgstr ""
|
3120 |
|
3121 |
+
#: includes/admin/settings/register-settings.php:543
|
3122 |
msgid "Tax Rates"
|
3123 |
msgstr ""
|
3124 |
|
3125 |
+
#: includes/admin/settings/register-settings.php:544
|
3126 |
msgid "Enter tax rates for specific regions."
|
3127 |
msgstr ""
|
3128 |
|
3129 |
+
#: includes/admin/settings/register-settings.php:549
|
3130 |
msgid "Fallback Tax Rate"
|
3131 |
msgstr ""
|
3132 |
|
3133 |
+
#: includes/admin/settings/register-settings.php:550
|
3134 |
msgid ""
|
3135 |
"Enter a percentage, such as 6.5. Customers not in a specific rate will be "
|
3136 |
"charged this rate."
|
3137 |
msgstr ""
|
3138 |
|
3139 |
+
#: includes/admin/settings/register-settings.php:556
|
3140 |
msgid "Prices entered with tax"
|
3141 |
msgstr ""
|
3142 |
|
3143 |
+
#: includes/admin/settings/register-settings.php:557
|
3144 |
msgid "This option affects how you enter prices."
|
3145 |
msgstr ""
|
3146 |
|
3147 |
+
#: includes/admin/settings/register-settings.php:561
|
3148 |
msgid "Yes, I will enter prices inclusive of tax"
|
3149 |
msgstr ""
|
3150 |
|
3151 |
+
#: includes/admin/settings/register-settings.php:562
|
3152 |
msgid "No, I will enter prices exclusive of tax"
|
3153 |
msgstr ""
|
3154 |
|
3155 |
+
#: includes/admin/settings/register-settings.php:567
|
3156 |
msgid "Display Tax Rate on Prices"
|
3157 |
msgstr ""
|
3158 |
|
3159 |
+
#: includes/admin/settings/register-settings.php:568
|
3160 |
msgid "Some countries require a notice when product prices include tax."
|
3161 |
msgstr ""
|
3162 |
|
3163 |
+
#: includes/admin/settings/register-settings.php:573
|
3164 |
msgid "Display during checkout"
|
3165 |
msgstr ""
|
3166 |
|
3167 |
+
#: includes/admin/settings/register-settings.php:574
|
3168 |
msgid "Should prices on the checkout page be shown with or without tax?"
|
3169 |
msgstr ""
|
3170 |
|
3171 |
+
#: includes/admin/settings/register-settings.php:578
|
3172 |
msgid "Including tax"
|
3173 |
msgstr ""
|
3174 |
|
3175 |
+
#: includes/admin/settings/register-settings.php:579
|
3176 |
msgid "Excluding tax"
|
3177 |
msgstr ""
|
3178 |
|
3179 |
+
#: includes/admin/settings/register-settings.php:596
|
3180 |
msgid "Enable Ajax"
|
3181 |
msgstr ""
|
3182 |
|
3183 |
+
#: includes/admin/settings/register-settings.php:597
|
3184 |
msgid "Check this to enable AJAX for the shopping cart."
|
3185 |
msgstr ""
|
3186 |
|
3187 |
+
#: includes/admin/settings/register-settings.php:603
|
3188 |
msgid "Redirect to Checkout"
|
3189 |
msgstr ""
|
3190 |
|
3191 |
+
#: includes/admin/settings/register-settings.php:604
|
3192 |
msgid "Immediately redirect to checkout after adding an item to the cart?"
|
3193 |
msgstr ""
|
3194 |
|
3195 |
+
#: includes/admin/settings/register-settings.php:609
|
3196 |
msgid "Enforce SSL on Checkout"
|
3197 |
msgstr ""
|
3198 |
|
3199 |
+
#: includes/admin/settings/register-settings.php:610
|
3200 |
msgid ""
|
3201 |
"Check this to force users to be redirected to the secure checkout page. You "
|
3202 |
"must have an SSL certificate installed to use this option."
|
3203 |
msgstr ""
|
3204 |
|
3205 |
+
#: includes/admin/settings/register-settings.php:615
|
3206 |
msgid "Disable Guest Checkout"
|
3207 |
msgstr ""
|
3208 |
|
3209 |
+
#: includes/admin/settings/register-settings.php:616
|
3210 |
msgid "Require that users be logged-in to purchase files."
|
3211 |
msgstr ""
|
3212 |
|
3213 |
+
#: includes/admin/settings/register-settings.php:621
|
3214 |
msgid "Show Register / Login Form?"
|
3215 |
msgstr ""
|
3216 |
|
3217 |
+
#: includes/admin/settings/register-settings.php:622
|
3218 |
msgid ""
|
3219 |
"Display the registration and login forms on the checkout page for "
|
3220 |
"non-logged-in users."
|
3221 |
msgstr ""
|
3222 |
|
3223 |
+
#: includes/admin/settings/register-settings.php:626
|
3224 |
msgid "Registration and Login Forms"
|
3225 |
msgstr ""
|
3226 |
|
3227 |
+
#: includes/admin/settings/register-settings.php:627
|
3228 |
msgid "Registration Form Only"
|
3229 |
msgstr ""
|
3230 |
|
3231 |
+
#: includes/admin/settings/register-settings.php:628
|
3232 |
msgid "Login Form Only"
|
3233 |
msgstr ""
|
3234 |
|
3235 |
+
#: includes/admin/settings/register-settings.php:634
|
3236 |
msgid "Item Quantities"
|
3237 |
msgstr ""
|
3238 |
|
3239 |
+
#: includes/admin/settings/register-settings.php:635
|
3240 |
msgid "Allow item quantities to be changed."
|
3241 |
msgstr ""
|
3242 |
|
3243 |
+
#: includes/admin/settings/register-settings.php:640
|
3244 |
msgid "Multiple Discounts"
|
3245 |
msgstr ""
|
3246 |
|
3247 |
+
#: includes/admin/settings/register-settings.php:641
|
3248 |
msgid "Allow customers to use multiple discounts on the same purchase?"
|
3249 |
msgstr ""
|
3250 |
|
3251 |
+
#: includes/admin/settings/register-settings.php:646
|
3252 |
msgid "Enable Cart Saving"
|
3253 |
msgstr ""
|
3254 |
|
3255 |
+
#: includes/admin/settings/register-settings.php:647
|
3256 |
msgid "Check this to enable cart saving on the checkout."
|
3257 |
msgstr ""
|
3258 |
|
3259 |
+
#: includes/admin/settings/register-settings.php:658
|
3260 |
msgid "Download Method"
|
3261 |
msgstr ""
|
3262 |
|
3263 |
+
#: includes/admin/settings/register-settings.php:659
|
3264 |
msgid "Select the file download method. Note, not all methods work on all servers."
|
3265 |
msgstr ""
|
3266 |
|
3267 |
+
#: includes/admin/settings/register-settings.php:662
|
3268 |
msgid "Forced"
|
3269 |
msgstr ""
|
3270 |
|
3271 |
+
#: includes/admin/settings/register-settings.php:663
|
3272 |
msgid "Redirect"
|
3273 |
msgstr ""
|
3274 |
|
3275 |
+
#: includes/admin/settings/register-settings.php:668
|
3276 |
msgid "Symlink File Downloads?"
|
3277 |
msgstr ""
|
3278 |
|
3279 |
+
#: includes/admin/settings/register-settings.php:669
|
3280 |
msgid ""
|
3281 |
"Check this if you are delivering really large files or having problems with "
|
3282 |
"file downloads completing."
|
3283 |
msgstr ""
|
3284 |
|
3285 |
+
#: includes/admin/settings/register-settings.php:674
|
3286 |
msgid "File Download Limit"
|
3287 |
msgstr ""
|
3288 |
|
3289 |
+
#: includes/admin/settings/register-settings.php:675
|
3290 |
msgid ""
|
3291 |
"The maximum number of times files can be downloaded for purchases. Can be "
|
3292 |
"overwritten for each %s."
|
3293 |
msgstr ""
|
3294 |
|
3295 |
+
#: includes/admin/settings/register-settings.php:681
|
3296 |
msgid "Download Link Expiration"
|
3297 |
msgstr ""
|
3298 |
|
3299 |
+
#: includes/admin/settings/register-settings.php:682
|
3300 |
msgid ""
|
3301 |
"How long should download links be valid for? Default is 24 hours from the "
|
3302 |
"time they are generated. Enter a time in hours."
|
3303 |
msgstr ""
|
3304 |
|
3305 |
+
#: includes/admin/settings/register-settings.php:690
|
3306 |
msgid "Disable Redownload?"
|
3307 |
msgstr ""
|
3308 |
|
3309 |
+
#: includes/admin/settings/register-settings.php:691
|
3310 |
msgid ""
|
3311 |
"Check this if you do not want to allow users to redownload items from their "
|
3312 |
"purchase history."
|
3313 |
msgstr ""
|
3314 |
|
3315 |
+
#: includes/admin/settings/register-settings.php:696
|
3316 |
msgid "Accounting Settings"
|
3317 |
msgstr ""
|
3318 |
|
3319 |
+
#: includes/admin/settings/register-settings.php:702
|
3320 |
msgid "Enable SKU Entry"
|
3321 |
msgstr ""
|
3322 |
|
3323 |
+
#: includes/admin/settings/register-settings.php:703
|
3324 |
msgid ""
|
3325 |
"Check this box to allow entry of product SKUs. SKUs will be shown on "
|
3326 |
"purchase receipt and exported purchase histories."
|
3327 |
msgstr ""
|
3328 |
|
3329 |
+
#: includes/admin/settings/register-settings.php:708
|
3330 |
msgid "Sequential Order Numbers"
|
3331 |
msgstr ""
|
3332 |
|
3333 |
+
#: includes/admin/settings/register-settings.php:709
|
3334 |
+
msgid "Check this box to enable sequential order numbers."
|
3335 |
msgstr ""
|
3336 |
|
3337 |
+
#: includes/admin/settings/register-settings.php:714
|
3338 |
msgid "Sequential Starting Number"
|
3339 |
msgstr ""
|
3340 |
|
3341 |
+
#: includes/admin/settings/register-settings.php:715
|
3342 |
msgid "The number that sequential order numbers should start at."
|
3343 |
msgstr ""
|
3344 |
|
3345 |
+
#: includes/admin/settings/register-settings.php:722
|
3346 |
msgid "Sequential Number Prefix"
|
3347 |
msgstr ""
|
3348 |
|
3349 |
+
#: includes/admin/settings/register-settings.php:723
|
3350 |
msgid "A prefix to prepend to all sequential order numbers."
|
3351 |
msgstr ""
|
3352 |
|
3353 |
+
#: includes/admin/settings/register-settings.php:728
|
3354 |
msgid "Sequential Number Postfix"
|
3355 |
msgstr ""
|
3356 |
|
3357 |
+
#: includes/admin/settings/register-settings.php:729
|
3358 |
msgid "A postfix to append to all sequential order numbers."
|
3359 |
msgstr ""
|
3360 |
|
3361 |
+
#: includes/admin/settings/register-settings.php:734
|
3362 |
msgid "Terms of Agreement"
|
3363 |
msgstr ""
|
3364 |
|
3365 |
+
#: includes/admin/settings/register-settings.php:740
|
3366 |
msgid "Agree to Terms"
|
3367 |
msgstr ""
|
3368 |
|
3369 |
+
#: includes/admin/settings/register-settings.php:741
|
3370 |
msgid ""
|
3371 |
"Check this to show an agree to terms on the checkout that users must agree "
|
3372 |
"to before purchasing."
|
3373 |
msgstr ""
|
3374 |
|
3375 |
+
#: includes/admin/settings/register-settings.php:746
|
3376 |
msgid "Agree to Terms Label"
|
3377 |
msgstr ""
|
3378 |
|
3379 |
+
#: includes/admin/settings/register-settings.php:747
|
3380 |
msgid "Label shown next to the agree to terms check box."
|
3381 |
msgstr ""
|
3382 |
|
3383 |
+
#: includes/admin/settings/register-settings.php:753
|
3384 |
msgid "Agreement Text"
|
3385 |
msgstr ""
|
3386 |
|
3387 |
+
#: includes/admin/settings/register-settings.php:754
|
3388 |
msgid "If Agree to Terms is checked, enter the agreement terms here."
|
3389 |
msgstr ""
|
3390 |
|
3391 |
+
#: includes/admin/settings/register-settings.php:759
|
3392 |
msgid "Complete Purchase Text"
|
3393 |
msgstr ""
|
3394 |
|
3395 |
+
#: includes/admin/settings/register-settings.php:760
|
3396 |
msgid "The button label for completing a purchase."
|
3397 |
msgstr ""
|
3398 |
|
3399 |
+
#: includes/admin/settings/register-settings.php:766
|
3400 |
msgid "Add to Cart Text"
|
3401 |
msgstr ""
|
3402 |
|
3403 |
+
#: includes/admin/settings/register-settings.php:767
|
3404 |
msgid "Text shown on the Add to Cart Buttons."
|
3405 |
msgstr ""
|
3406 |
|
3407 |
+
#: includes/admin/settings/register-settings.php:773
|
3408 |
+
msgid "Buy Now Text"
|
3409 |
+
msgstr ""
|
3410 |
+
|
3411 |
+
#: includes/admin/settings/register-settings.php:774
|
3412 |
+
msgid "Text shown on the Buy Now Buttons."
|
3413 |
+
msgstr ""
|
3414 |
+
|
3415 |
+
#: includes/admin/settings/register-settings.php:847
|
3416 |
msgid "Settings updated."
|
3417 |
msgstr ""
|
3418 |
|
3419 |
+
#: includes/admin/settings/register-settings.php:940
|
3420 |
msgid "Licenses"
|
3421 |
msgstr ""
|
3422 |
|
3423 |
+
#: includes/admin/settings/register-settings.php:943
|
3424 |
msgid "Misc"
|
3425 |
msgstr ""
|
3426 |
|
3427 |
+
#: includes/admin/settings/register-settings.php:1285
|
3428 |
msgid "The callback function used for the <strong>%s</strong> setting is missing."
|
3429 |
msgstr ""
|
3430 |
|
3431 |
+
#: includes/admin/settings/register-settings.php:1418
|
3432 |
msgid "Upload File"
|
3433 |
msgstr ""
|
3434 |
|
3435 |
+
#: includes/admin/settings/register-settings.php:1507
|
3436 |
msgid "Apply rate to whole country, regardless of state / province"
|
3437 |
msgstr ""
|
3438 |
|
3439 |
+
#: includes/admin/settings/register-settings.php:1507
|
3440 |
msgid "Country Wide"
|
3441 |
msgstr ""
|
3442 |
|
3443 |
+
#: includes/admin/settings/register-settings.php:1508
|
3444 |
msgid "Rate"
|
3445 |
msgstr ""
|
3446 |
|
3447 |
+
#: includes/admin/settings/register-settings.php:1525
|
3448 |
+
#: includes/admin/settings/register-settings.php:1568
|
3449 |
msgid "Choose a country"
|
3450 |
msgstr ""
|
3451 |
|
3452 |
+
#: includes/admin/settings/register-settings.php:1540
|
3453 |
msgid "Choose a state"
|
3454 |
msgstr ""
|
3455 |
|
3456 |
+
#: includes/admin/settings/register-settings.php:1551
|
3457 |
+
#: includes/admin/settings/register-settings.php:1578
|
3458 |
msgid "Apply to whole country"
|
3459 |
msgstr ""
|
3460 |
|
3461 |
+
#: includes/admin/settings/register-settings.php:1554
|
3462 |
+
#: includes/admin/settings/register-settings.php:1581
|
3463 |
msgid "Remove Rate"
|
3464 |
msgstr ""
|
3465 |
|
3466 |
+
#: includes/admin/settings/register-settings.php:1586
|
3467 |
msgid "Add Tax Rate"
|
3468 |
msgstr ""
|
3469 |
|
3470 |
+
#: includes/admin/settings/register-settings.php:1626
|
3471 |
msgid "Deactivate License"
|
3472 |
msgstr ""
|
3473 |
|
3559 |
"such as the <a href=\"%s\">EDD mobile apps</a>."
|
3560 |
msgstr ""
|
3561 |
|
3562 |
+
#: includes/admin/tools.php:257
|
3563 |
msgid "Export Settings"
|
3564 |
msgstr ""
|
3565 |
|
3566 |
+
#: includes/admin/tools.php:259
|
3567 |
msgid ""
|
3568 |
"Export the Easy Digital Downloads settings for this site as a .json file. "
|
3569 |
"This allows you to easily import the configuration into another site."
|
3570 |
msgstr ""
|
3571 |
|
3572 |
+
#: includes/admin/tools.php:260
|
3573 |
msgid ""
|
3574 |
"To export shop data (purchases, customers, etc), visit the <a "
|
3575 |
"href=\"%s\">Reports</a> page."
|
3576 |
msgstr ""
|
3577 |
|
3578 |
+
#: includes/admin/tools.php:272
|
3579 |
msgid "Import Settings"
|
3580 |
msgstr ""
|
3581 |
|
3582 |
+
#: includes/admin/tools.php:274
|
3583 |
msgid ""
|
3584 |
"Import the Easy Digital Downloads settings from a .json file. This file can "
|
3585 |
"be obtained by exporting the settings on another site using the form above."
|
3586 |
msgstr ""
|
3587 |
|
3588 |
+
#: includes/admin/tools.php:282
|
3589 |
msgid "Import"
|
3590 |
msgstr ""
|
3591 |
|
3592 |
+
#: includes/admin/tools.php:347
|
3593 |
msgid "Please upload a valid .json file"
|
3594 |
msgstr ""
|
3595 |
|
3596 |
+
#: includes/admin/tools.php:353
|
3597 |
msgid "Please upload a file to import"
|
3598 |
msgstr ""
|
3599 |
|
3671 |
"href=\"%s\">here</a> to start the upgrade."
|
3672 |
msgstr ""
|
3673 |
|
3674 |
+
#: includes/admin/upgrades/upgrade-functions.php:129
|
3675 |
+
msgid ""
|
3676 |
+
"Easy Digital Downloads needs to upgrade the API Key database, click <a "
|
3677 |
+
"href=\"%s\">here</a> to start the upgrade."
|
3678 |
+
msgstr ""
|
3679 |
+
|
3680 |
+
#: includes/admin/upgrades/upgrade-functions.php:160
|
3681 |
+
#: includes/admin/upgrades/upgrade-functions.php:513
|
3682 |
+
#: includes/admin/upgrades/upgrade-functions.php:595
|
3683 |
+
#: includes/admin/upgrades/upgrade-functions.php:706
|
3684 |
+
#: includes/admin/upgrades/upgrade-functions.php:803
|
3685 |
+
#: includes/admin/upgrades/upgrade-functions.php:877
|
3686 |
+
#: includes/admin/upgrades/upgrade-functions.php:1005
|
3687 |
msgid "You do not have permission to do shop upgrades"
|
3688 |
msgstr ""
|
3689 |
|
3690 |
+
#: includes/admin/upgrades/upgrade-functions.php:366 includes/install.php:85
|
3691 |
msgid "Transaction Failed"
|
3692 |
msgstr ""
|
3693 |
|
3694 |
+
#: includes/admin/upgrades/upgrade-functions.php:367 includes/install.php:86
|
3695 |
msgid "Your transaction failed, please try again or contact site support."
|
3696 |
msgstr ""
|
3697 |
|
4110 |
msgid "No valid changlog was found."
|
4111 |
msgstr ""
|
4112 |
|
4113 |
+
#: includes/ajax-functions.php:534 includes/ajax-functions.php:585
|
4114 |
msgid "No results found"
|
4115 |
msgstr ""
|
4116 |
|
4117 |
+
#: includes/ajax-functions.php:672
|
4118 |
msgid "No users found"
|
4119 |
msgstr ""
|
4120 |
|
4121 |
+
#: includes/api/class-edd-api.php:443
|
4122 |
+
msgid "You must specify both a token and API key!"
|
4123 |
+
msgstr ""
|
4124 |
+
|
4125 |
+
#: includes/api/class-edd-api.php:460
|
4126 |
+
msgid "Your request could not be authenticated!"
|
4127 |
+
msgstr ""
|
4128 |
+
|
4129 |
+
#: includes/api/class-edd-api.php:478
|
4130 |
+
msgid "Invalid API key!"
|
4131 |
+
msgstr ""
|
4132 |
+
|
4133 |
+
#: includes/api/class-edd-api.php:494
|
4134 |
+
msgid "Invalid API version!"
|
4135 |
+
msgstr ""
|
4136 |
+
|
4137 |
+
#: includes/api/class-edd-api.php:641
|
4138 |
+
msgid "Invalid query!"
|
4139 |
+
msgstr ""
|
4140 |
+
|
4141 |
+
#: includes/api/class-edd-api.php:941
|
4142 |
+
msgid "Customer %s not found!"
|
4143 |
+
msgstr ""
|
4144 |
+
|
4145 |
+
#: includes/api/class-edd-api.php:946
|
4146 |
+
msgid "No customers found!"
|
4147 |
+
msgstr ""
|
4148 |
+
|
4149 |
+
#: includes/api/class-edd-api.php:992 includes/api/class-edd-api.php:1185
|
4150 |
+
#: includes/api/class-edd-api.php:1295
|
4151 |
+
msgid "Product %s not found!"
|
4152 |
+
msgstr ""
|
4153 |
+
|
4154 |
+
#: includes/api/class-edd-api.php:1096 includes/api/class-edd-api.php:1202
|
4155 |
+
msgid "The end date must be later than the start date!"
|
4156 |
+
msgstr ""
|
4157 |
+
|
4158 |
+
#: includes/api/class-edd-api.php:1101 includes/api/class-edd-api.php:1207
|
4159 |
+
msgid "Invalid or no date range specified!"
|
4160 |
+
msgstr ""
|
4161 |
+
|
4162 |
+
#: includes/api/class-edd-api.php:1435
|
4163 |
+
msgid "No discounts found!"
|
4164 |
+
msgstr ""
|
4165 |
+
|
4166 |
+
#: includes/api/class-edd-api.php:1482
|
4167 |
+
msgid "Discount %s not found!"
|
4168 |
+
msgstr ""
|
4169 |
+
|
4170 |
+
#: includes/api/class-edd-api.php:1645
|
4171 |
+
msgid "Easy Digital Downloads API Keys"
|
4172 |
+
msgstr ""
|
4173 |
+
|
4174 |
+
#: includes/api/class-edd-api.php:1654
|
4175 |
+
msgid "Generate API Key"
|
4176 |
+
msgstr ""
|
4177 |
+
|
4178 |
+
#: includes/api/class-edd-api.php:1656
|
4179 |
+
msgid "Public key:"
|
4180 |
+
msgstr ""
|
4181 |
+
|
4182 |
+
#: includes/api/class-edd-api.php:1657
|
4183 |
+
msgid "Secret key:"
|
4184 |
+
msgstr ""
|
4185 |
+
|
4186 |
+
#: includes/api/class-edd-api.php:1658
|
4187 |
+
msgid "Token:"
|
4188 |
+
msgstr ""
|
4189 |
+
|
4190 |
+
#: includes/api/class-edd-api.php:1660
|
4191 |
+
msgid "Revoke API Keys"
|
4192 |
+
msgstr ""
|
4193 |
+
|
4194 |
+
#: includes/api/class-edd-api.php:1694 includes/api/class-edd-api.php:1696
|
4195 |
+
msgid "You do not have permission to %s API keys for this user"
|
4196 |
+
msgstr ""
|
4197 |
+
|
4198 |
+
#: includes/cart/functions.php:403
|
4199 |
msgid "includes %s tax"
|
4200 |
msgstr ""
|
4201 |
|
4202 |
+
#: includes/cart/functions.php:405
|
4203 |
msgid "excludes %s tax"
|
4204 |
msgstr ""
|
4205 |
|
4206 |
+
#: includes/cart/functions.php:1029 includes/cart/functions.php:1097
|
4207 |
#: templates/shortcode-profile-editor.php:20
|
4208 |
msgid "Success"
|
4209 |
msgstr ""
|
4210 |
|
4211 |
+
#: includes/cart/functions.php:1030
|
4212 |
msgid "Cart saved successfully. You can restore your cart using this URL:"
|
4213 |
msgstr ""
|
4214 |
|
4215 |
+
#: includes/cart/functions.php:1067 includes/cart/functions.php:1084
|
4216 |
msgid "Cart restoration failed. Invalid token."
|
4217 |
msgstr ""
|
4218 |
|
4219 |
+
#: includes/cart/functions.php:1075 includes/cart/functions.php:1087
|
4220 |
msgid "The cart cannot be restored. Invalid token."
|
4221 |
msgstr ""
|
4222 |
|
4223 |
+
#: includes/cart/functions.php:1097
|
4224 |
msgid "Cart restored successfully."
|
4225 |
msgstr ""
|
4226 |
|
4244 |
msgid "Update Cart"
|
4245 |
msgstr ""
|
4246 |
|
4247 |
+
#: includes/cart/template.php:252
|
4248 |
msgid "You have successfully added %s to your shopping cart."
|
4249 |
msgstr ""
|
4250 |
|
4251 |
+
#: includes/cart/template.php:253
|
4252 |
msgid "Checkout."
|
4253 |
msgstr ""
|
4254 |
|
4255 |
+
#: includes/checkout/template.php:176
|
4256 |
msgid "Personal Info"
|
4257 |
msgstr ""
|
4258 |
|
4259 |
+
#: includes/checkout/template.php:180 templates/shortcode-profile-editor.php:56
|
4260 |
#: templates/shortcode-register.php:24
|
4261 |
msgid "Email Address"
|
4262 |
msgstr ""
|
4263 |
|
4264 |
+
#: includes/checkout/template.php:185
|
4265 |
msgid "We will send the purchase receipt to this address."
|
4266 |
msgstr ""
|
4267 |
|
4268 |
+
#: includes/checkout/template.php:186
|
4269 |
msgid "Email address"
|
4270 |
msgstr ""
|
4271 |
|
4272 |
+
#: includes/checkout/template.php:196
|
4273 |
msgid "We will use this to personalize your account experience."
|
4274 |
msgstr ""
|
4275 |
|
4276 |
+
#: includes/checkout/template.php:197
|
4277 |
msgid "First name"
|
4278 |
msgstr ""
|
4279 |
|
4280 |
+
#: includes/checkout/template.php:206
|
4281 |
msgid "We will use this as well to personalize your account experience."
|
4282 |
msgstr ""
|
4283 |
|
4284 |
+
#: includes/checkout/template.php:207
|
4285 |
msgid "Last name"
|
4286 |
msgstr ""
|
4287 |
|
4288 |
+
#: includes/checkout/template.php:229
|
4289 |
msgid "Credit Card Info"
|
4290 |
msgstr ""
|
4291 |
|
4292 |
+
#: includes/checkout/template.php:233
|
4293 |
msgid "This is a secure SSL encrypted payment."
|
4294 |
msgstr ""
|
4295 |
|
4296 |
+
#: includes/checkout/template.php:238
|
4297 |
msgid "Card Number"
|
4298 |
msgstr ""
|
4299 |
|
4300 |
+
#: includes/checkout/template.php:242
|
4301 |
msgid "The (typically) 16 digits on the front of your credit card."
|
4302 |
msgstr ""
|
4303 |
|
4304 |
+
#: includes/checkout/template.php:243
|
4305 |
msgid "Card number"
|
4306 |
msgstr ""
|
4307 |
|
4308 |
+
#: includes/checkout/template.php:247
|
4309 |
msgid "CVC"
|
4310 |
msgstr ""
|
4311 |
|
4312 |
+
#: includes/checkout/template.php:250
|
4313 |
msgid "The 3 digit (back) or 4 digit (front) value on your card."
|
4314 |
msgstr ""
|
4315 |
|
4316 |
+
#: includes/checkout/template.php:251
|
4317 |
msgid "Security code"
|
4318 |
msgstr ""
|
4319 |
|
4320 |
+
#: includes/checkout/template.php:255
|
4321 |
msgid "Name on the Card"
|
4322 |
msgstr ""
|
4323 |
|
4324 |
+
#: includes/checkout/template.php:258
|
4325 |
msgid "The name printed on the front of your credit card."
|
4326 |
msgstr ""
|
4327 |
|
4328 |
+
#: includes/checkout/template.php:259
|
4329 |
msgid "Card name"
|
4330 |
msgstr ""
|
4331 |
|
4332 |
+
#: includes/checkout/template.php:264
|
4333 |
msgid "Expiration (MM/YY)"
|
4334 |
msgstr ""
|
4335 |
|
4336 |
+
#: includes/checkout/template.php:267
|
4337 |
msgid "The date your credit card expires, typically on the front of the card."
|
4338 |
msgstr ""
|
4339 |
|
4340 |
+
#: includes/checkout/template.php:325
|
4341 |
msgid "Billing Details"
|
4342 |
msgstr ""
|
4343 |
|
4344 |
+
#: includes/checkout/template.php:334
|
4345 |
msgid "The primary billing address for your credit card."
|
4346 |
msgstr ""
|
4347 |
|
4348 |
+
#: includes/checkout/template.php:335
|
4349 |
msgid "Address line 1"
|
4350 |
msgstr ""
|
4351 |
|
4352 |
+
#: includes/checkout/template.php:339
|
4353 |
msgid "Billing Address Line 2 (optional)"
|
4354 |
msgstr ""
|
4355 |
|
4356 |
+
#: includes/checkout/template.php:344
|
4357 |
msgid "The suite, apt no, PO box, etc, associated with your billing address."
|
4358 |
msgstr ""
|
4359 |
|
4360 |
+
#: includes/checkout/template.php:345
|
4361 |
msgid "Address line 2"
|
4362 |
msgstr ""
|
4363 |
|
4364 |
+
#: includes/checkout/template.php:349
|
4365 |
msgid "Billing City"
|
4366 |
msgstr ""
|
4367 |
|
4368 |
+
#: includes/checkout/template.php:354
|
4369 |
msgid "The city for your billing address."
|
4370 |
msgstr ""
|
4371 |
|
4372 |
+
#: includes/checkout/template.php:359
|
4373 |
msgid "Billing Zip / Postal Code"
|
4374 |
msgstr ""
|
4375 |
|
4376 |
+
#: includes/checkout/template.php:364
|
4377 |
msgid "The zip or postal code for your billing address."
|
4378 |
msgstr ""
|
4379 |
|
4380 |
+
#: includes/checkout/template.php:365
|
4381 |
msgid "Zip / Postal code"
|
4382 |
msgstr ""
|
4383 |
|
4384 |
+
#: includes/checkout/template.php:369
|
4385 |
msgid "Billing Country"
|
4386 |
msgstr ""
|
4387 |
|
4388 |
+
#: includes/checkout/template.php:374
|
4389 |
msgid "The country for your billing address."
|
4390 |
msgstr ""
|
4391 |
|
4392 |
+
#: includes/checkout/template.php:393
|
4393 |
msgid "Billing State / Province"
|
4394 |
msgstr ""
|
4395 |
|
4396 |
+
#: includes/checkout/template.php:398
|
4397 |
msgid "The state or province for your billing address."
|
4398 |
msgstr ""
|
4399 |
|
4400 |
+
#: includes/checkout/template.php:455
|
4401 |
msgid "Already have an account?"
|
4402 |
msgstr ""
|
4403 |
|
4404 |
+
#: includes/checkout/template.php:455 includes/checkout/template.php:545
|
4405 |
msgid "Login"
|
4406 |
msgstr ""
|
4407 |
|
4408 |
+
#: includes/checkout/template.php:461
|
4409 |
msgid "Create an account"
|
4410 |
msgstr ""
|
4411 |
|
4412 |
+
#: includes/checkout/template.php:461
|
4413 |
msgid "(optional)"
|
4414 |
msgstr ""
|
4415 |
|
4416 |
+
#: includes/checkout/template.php:470
|
4417 |
msgid "The username you will use to log into your account."
|
4418 |
msgstr ""
|
4419 |
|
4420 |
+
#: includes/checkout/template.php:475 includes/checkout/template.php:481
|
4421 |
+
#: includes/checkout/template.php:540 templates/shortcode-login.php:19
|
4422 |
#: templates/shortcode-register.php:28
|
4423 |
msgid "Password"
|
4424 |
msgstr ""
|
4425 |
|
4426 |
+
#: includes/checkout/template.php:480
|
4427 |
msgid "The password used to access your account."
|
4428 |
msgstr ""
|
4429 |
|
4430 |
+
#: includes/checkout/template.php:485
|
4431 |
msgid "Password Again"
|
4432 |
msgstr ""
|
4433 |
|
4434 |
+
#: includes/checkout/template.php:490
|
4435 |
msgid "Confirm your password."
|
4436 |
msgstr ""
|
4437 |
|
4438 |
+
#: includes/checkout/template.php:491
|
4439 |
msgid "Confirm password"
|
4440 |
msgstr ""
|
4441 |
|
4442 |
+
#: includes/checkout/template.php:528
|
4443 |
msgid "Need to create an account?"
|
4444 |
msgstr ""
|
4445 |
|
4446 |
+
#: includes/checkout/template.php:530 templates/shortcode-register.php:44
|
4447 |
msgid "Register"
|
4448 |
msgstr ""
|
4449 |
|
4450 |
+
#: includes/checkout/template.php:530
|
4451 |
msgid "or checkout as a guest."
|
4452 |
msgstr ""
|
4453 |
|
4454 |
+
#: includes/checkout/template.php:537
|
4455 |
msgid "Your username"
|
4456 |
msgstr ""
|
4457 |
|
4458 |
+
#: includes/checkout/template.php:541
|
4459 |
msgid "Your password"
|
4460 |
msgstr ""
|
4461 |
|
4462 |
+
#: includes/checkout/template.php:573
|
4463 |
msgid "Select Payment Method"
|
4464 |
msgstr ""
|
4465 |
|
4466 |
+
#: includes/checkout/template.php:701
|
4467 |
msgid "Have a discount code?"
|
4468 |
msgstr ""
|
4469 |
|
4470 |
+
#: includes/checkout/template.php:705
|
4471 |
msgid "Discount"
|
4472 |
msgstr ""
|
4473 |
|
4474 |
+
#: includes/checkout/template.php:708
|
4475 |
msgid "Enter a coupon code if you have one."
|
4476 |
msgstr ""
|
4477 |
|
4478 |
+
#: includes/checkout/template.php:709 includes/process-purchase.php:273
|
4479 |
+
#: includes/scripts.php:53
|
4480 |
msgid "Enter discount"
|
4481 |
msgstr ""
|
4482 |
|
4483 |
+
#: includes/checkout/template.php:730
|
4484 |
msgid "Agree to Terms?"
|
4485 |
msgstr ""
|
4486 |
|
4487 |
+
#: includes/checkout/template.php:741
|
4488 |
msgid "Show Terms"
|
4489 |
msgstr ""
|
4490 |
|
4491 |
+
#: includes/checkout/template.php:742
|
4492 |
msgid "Hide Terms"
|
4493 |
msgstr ""
|
4494 |
|
4495 |
+
#: includes/checkout/template.php:761
|
4496 |
msgid "Purchase Total:"
|
4497 |
msgstr ""
|
4498 |
|
4499 |
+
#: includes/checkout/template.php:787
|
4500 |
msgid "Go back"
|
4501 |
msgstr ""
|
4502 |
|
4503 |
+
#: includes/checkout/template.php:810
|
4504 |
msgid "Next"
|
4505 |
msgstr ""
|
4506 |
|
4507 |
+
#: includes/checkout/template.php:830
|
4508 |
msgid "Free Download"
|
4509 |
msgstr ""
|
4510 |
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
4511 |
#: includes/class-edd-cache-helper.php:117
|
4512 |
msgid ""
|
4513 |
"In order for <strong>database caching</strong> to work with Easy Digital "
|
4660 |
msgid "%d customers created in %d seconds"
|
4661 |
msgstr ""
|
4662 |
|
4663 |
+
#: includes/class-edd-cli.php:311 includes/class-edd-html-elements.php:144
|
4664 |
msgid "No customers found"
|
4665 |
msgstr ""
|
4666 |
|
4744 |
msgid " Product: %s - %s"
|
4745 |
msgstr ""
|
4746 |
|
4747 |
+
#: includes/class-edd-cli.php:419 includes/class-edd-html-elements.php:204
|
4748 |
+
#: includes/shortcodes.php:213
|
4749 |
msgid "No discounts found"
|
4750 |
msgstr ""
|
4751 |
|
4834 |
msgstr ""
|
4835 |
|
4836 |
#: includes/class-edd-html-elements.php:43
|
4837 |
+
#: includes/class-edd-html-elements.php:72
|
4838 |
msgid "Select a %s"
|
4839 |
msgstr ""
|
4840 |
|
4841 |
+
#: includes/class-edd-html-elements.php:77
|
4842 |
msgid "No products found"
|
4843 |
msgstr ""
|
4844 |
|
4845 |
+
#: includes/class-edd-html-elements.php:126
|
4846 |
msgid "Select a Customer"
|
4847 |
msgstr ""
|
4848 |
|
4849 |
+
#: includes/class-edd-html-elements.php:139
|
4850 |
msgid "No customer attached"
|
4851 |
msgstr ""
|
4852 |
|
4853 |
+
#: includes/class-edd-html-elements.php:558
|
|
|
|
|
|
|
|
|
4854 |
msgid "Enter username"
|
4855 |
msgstr ""
|
4856 |
|
4857 |
+
#: includes/class-edd-license-handler.php:151
|
4858 |
msgid "%1$s License Key"
|
4859 |
msgstr ""
|
4860 |
|
4861 |
+
#: includes/class-edd-license-handler.php:337
|
4862 |
msgid "This license does not belong to the product you have entered it for."
|
4863 |
msgstr ""
|
4864 |
|
4865 |
+
#: includes/class-edd-license-handler.php:342
|
4866 |
msgid "This license does not have any activations left"
|
4867 |
msgstr ""
|
4868 |
|
4869 |
+
#: includes/class-edd-license-handler.php:347
|
4870 |
msgid "This license key is expired. Please renew it."
|
4871 |
msgstr ""
|
4872 |
|
4873 |
+
#: includes/class-edd-license-handler.php:352
|
4874 |
msgid ""
|
4875 |
"There was a problem activating your license key, please try again or "
|
4876 |
"contact support. Error code: %s"
|
5206 |
msgid "No payments matching your request were found."
|
5207 |
msgstr ""
|
5208 |
|
5209 |
+
#: includes/discount-functions.php:374
|
5210 |
msgid "This discount is expired."
|
5211 |
msgstr ""
|
5212 |
|
5213 |
+
#: includes/discount-functions.php:380
|
5214 |
msgid "This discount is not active."
|
5215 |
msgstr ""
|
5216 |
|
5217 |
+
#: includes/discount-functions.php:607
|
5218 |
msgid "This discount is not active yet."
|
5219 |
msgstr ""
|
5220 |
|
5221 |
+
#: includes/discount-functions.php:638
|
5222 |
msgid "This discount has reached it's maximum usage."
|
5223 |
msgstr ""
|
5224 |
|
5225 |
+
#: includes/discount-functions.php:667
|
5226 |
msgid "Minimum order of %s not met."
|
5227 |
msgstr ""
|
5228 |
|
5229 |
+
#: includes/discount-functions.php:729 includes/discount-functions.php:749
|
5230 |
msgid "The product requirements for this discount are not met."
|
5231 |
msgstr ""
|
5232 |
|
5233 |
+
#: includes/discount-functions.php:765
|
5234 |
msgid "This discount is not valid for the cart contents."
|
5235 |
msgstr ""
|
5236 |
|
5237 |
+
#: includes/discount-functions.php:855
|
5238 |
msgid "This discount has already been redeemed."
|
5239 |
msgstr ""
|
5240 |
|
5241 |
+
#: includes/discount-functions.php:894
|
5242 |
msgid "This discount is invalid."
|
5243 |
msgstr ""
|
5244 |
|
5276 |
msgid "You cannot send email with EDD_Emails until init/admin_init has been reached"
|
5277 |
msgstr ""
|
5278 |
|
5279 |
+
#: includes/emails/functions.php:126
|
5280 |
msgid "New download purchase - Order #%1$s"
|
5281 |
msgstr ""
|
5282 |
|
5283 |
+
#: includes/emails/functions.php:144
|
5284 |
msgid "New Sale!"
|
5285 |
msgstr ""
|
5286 |
|
5287 |
+
#: includes/emails/functions.php:189 includes/emails/template.php:212
|
5288 |
msgid "Hello"
|
5289 |
msgstr ""
|
5290 |
|
5291 |
+
#: includes/emails/functions.php:189 includes/emails/template.php:212
|
5292 |
msgid "A %s purchase has been made"
|
5293 |
msgstr ""
|
5294 |
|
5295 |
+
#: includes/emails/functions.php:190 includes/emails/template.php:213
|
5296 |
msgid "%s sold:"
|
5297 |
msgstr ""
|
5298 |
|
5299 |
+
#: includes/emails/functions.php:192 includes/emails/template.php:215
|
5300 |
msgid "Purchased by: "
|
5301 |
msgstr ""
|
5302 |
|
5303 |
+
#: includes/emails/functions.php:193 includes/emails/template.php:216
|
5304 |
msgid "Amount: "
|
5305 |
msgstr ""
|
5306 |
|
5307 |
+
#: includes/emails/functions.php:194 includes/emails/template.php:217
|
5308 |
msgid "Payment Method: "
|
5309 |
msgstr ""
|
5310 |
|
5311 |
+
#: includes/emails/functions.php:195 includes/emails/template.php:218
|
5312 |
msgid "Thank you"
|
5313 |
msgstr ""
|
5314 |
|
5356 |
msgid "You must enable a payment gateway to use Easy Digital Downloads"
|
5357 |
msgstr ""
|
5358 |
|
5359 |
+
#: includes/gateways/amazon-payments.php:222
|
5360 |
+
#: includes/gateways/amazon-payments.php:223
|
5361 |
+
msgid "Amazon"
|
5362 |
+
msgstr ""
|
5363 |
+
|
5364 |
+
#: includes/gateways/amazon-payments.php:262
|
5365 |
+
msgid "Login & Pay with Amazon Settings"
|
5366 |
+
msgstr ""
|
5367 |
+
|
5368 |
+
#: includes/gateways/amazon-payments.php:263
|
5369 |
+
msgid "Configure the Amazon settings"
|
5370 |
+
msgstr ""
|
5371 |
+
|
5372 |
+
#: includes/gateways/amazon-payments.php:268
|
5373 |
+
msgid "Register with Amazon"
|
5374 |
+
msgstr ""
|
5375 |
+
|
5376 |
+
#: includes/gateways/amazon-payments.php:269
|
5377 |
+
msgid ""
|
5378 |
+
"<p><a href=\"%s\" class=\"button\" target=\"_blank\">Connect Easy Digital "
|
5379 |
+
"Downloads to your Amazon account, or register a new one</a></p><p "
|
5380 |
+
"class=\"description\">Once registration is complete, enter your API "
|
5381 |
+
"credentials below.</p>"
|
5382 |
+
msgstr ""
|
5383 |
+
|
5384 |
+
#: includes/gateways/amazon-payments.php:274
|
5385 |
+
msgid "Client ID"
|
5386 |
+
msgstr ""
|
5387 |
+
|
5388 |
+
#: includes/gateways/amazon-payments.php:275
|
5389 |
+
msgid "The Amazon Client ID. Should look like `amzn1.application-oa2...`"
|
5390 |
+
msgstr ""
|
5391 |
+
|
5392 |
+
#: includes/gateways/amazon-payments.php:281
|
5393 |
+
msgid "Seller ID"
|
5394 |
+
msgstr ""
|
5395 |
+
|
5396 |
+
#: includes/gateways/amazon-payments.php:282
|
5397 |
+
msgid "Found in the Integration settings. Also called a Merchent ID"
|
5398 |
+
msgstr ""
|
5399 |
+
|
5400 |
+
#: includes/gateways/amazon-payments.php:288
|
5401 |
+
msgid "MWS Access Key"
|
5402 |
+
msgstr ""
|
5403 |
+
|
5404 |
+
#: includes/gateways/amazon-payments.php:289
|
5405 |
+
#: includes/gateways/amazon-payments.php:296
|
5406 |
+
msgid "Found on Seller Central in the MWS Keys section"
|
5407 |
+
msgstr ""
|
5408 |
+
|
5409 |
+
#: includes/gateways/amazon-payments.php:295
|
5410 |
+
msgid "MWS Secret Key"
|
5411 |
+
msgstr ""
|
5412 |
+
|
5413 |
+
#: includes/gateways/amazon-payments.php:302
|
5414 |
+
msgid "Amazon MWS Callback URL"
|
5415 |
+
msgstr ""
|
5416 |
+
|
5417 |
+
#: includes/gateways/amazon-payments.php:303
|
5418 |
+
msgid ""
|
5419 |
+
"The Return URL to provide in your MWS Application. Enter this under your "
|
5420 |
+
"Login and Pay → Web Settings"
|
5421 |
+
msgstr ""
|
5422 |
+
|
5423 |
+
#: includes/gateways/amazon-payments.php:311
|
5424 |
+
msgid "Amazon Merchant IPN URL"
|
5425 |
+
msgstr ""
|
5426 |
+
|
5427 |
+
#: includes/gateways/amazon-payments.php:312
|
5428 |
+
msgid ""
|
5429 |
+
"The IPN URL to provide in your MWS account. Enter this under your <a "
|
5430 |
+
"href=\"%s\">Integration Settings</a>"
|
5431 |
+
msgstr ""
|
5432 |
+
|
5433 |
+
#: includes/gateways/amazon-payments.php:598
|
5434 |
+
msgid "Currently logged into Amazon as"
|
5435 |
+
msgstr ""
|
5436 |
+
|
5437 |
+
#: includes/gateways/amazon-payments.php:599
|
5438 |
+
msgid "Logout"
|
5439 |
+
msgstr ""
|
5440 |
+
|
5441 |
+
#: includes/gateways/amazon-payments.php:724
|
5442 |
+
#: includes/gateways/amazon-payments.php:739
|
5443 |
+
msgid "Missing Reference ID, please try again"
|
5444 |
+
msgstr ""
|
5445 |
+
|
5446 |
+
#: includes/gateways/amazon-payments.php:774
|
5447 |
+
msgid ""
|
5448 |
+
"Your payment could not be authorized, please try a different payment "
|
5449 |
+
"method. Reason: %s"
|
5450 |
+
msgstr ""
|
5451 |
+
|
5452 |
+
#: includes/gateways/amazon-payments.php:823
|
5453 |
+
msgid "There was an issue processing your payment. Amazon error: %s"
|
5454 |
+
msgstr ""
|
5455 |
+
|
5456 |
+
#: includes/gateways/amazon-payments.php:959
|
5457 |
+
msgid "Invalid Amazon seller ID"
|
5458 |
+
msgstr ""
|
5459 |
+
|
5460 |
+
#: includes/gateways/amazon-payments.php:959
|
5461 |
+
#: includes/gateways/amazon-payments.php:1013
|
5462 |
+
#: includes/gateways/paypal-standard.php:274
|
5463 |
+
#: includes/gateways/paypal-standard.php:279
|
5464 |
+
#: includes/gateways/paypal-standard.php:340
|
5465 |
+
#: includes/gateways/paypal-standard.php:349
|
5466 |
+
#: includes/gateways/paypal-standard.php:399
|
5467 |
+
#: includes/gateways/paypal-standard.php:406
|
5468 |
+
msgid "IPN Error"
|
5469 |
+
msgstr ""
|
5470 |
+
|
5471 |
+
#: includes/gateways/amazon-payments.php:983
|
5472 |
+
msgid "Capture declined in Amazon"
|
5473 |
+
msgstr ""
|
5474 |
+
|
5475 |
+
#: includes/gateways/amazon-payments.php:1001
|
5476 |
+
msgid "Refund completed in Amazon. Refund ID: %s"
|
5477 |
+
msgstr ""
|
5478 |
+
|
5479 |
+
#: includes/gateways/amazon-payments.php:1078
|
5480 |
+
msgid "Refund declined in Amazon. Refeund ID: %s"
|
5481 |
+
msgstr ""
|
5482 |
+
|
5483 |
+
#: includes/gateways/amazon-payments.php:1085
|
5484 |
+
msgid "Refund completed in Amazon. Refeund ID: %s"
|
5485 |
+
msgstr ""
|
5486 |
+
|
5487 |
+
#: includes/gateways/amazon-payments.php:1091
|
5488 |
+
msgid "Refund initiated in Amazon. Reference ID: %s"
|
5489 |
+
msgstr ""
|
5490 |
+
|
5491 |
+
#: includes/gateways/amazon-payments.php:1100
|
5492 |
+
msgid "Refund request failed in Amazon."
|
5493 |
+
msgstr ""
|
5494 |
+
|
5495 |
#: includes/gateways/functions.php:25
|
5496 |
msgid "PayPal Standard"
|
5497 |
msgstr ""
|
5504 |
msgid "Test Payment"
|
5505 |
msgstr ""
|
5506 |
|
5507 |
+
#: includes/gateways/functions.php:110 includes/gateways/functions.php:129
|
5508 |
msgid "Free Purchase"
|
5509 |
msgstr ""
|
5510 |
|
5511 |
+
#: includes/gateways/functions.php:211
|
5512 |
msgid "The requested price ID does not exist."
|
5513 |
msgstr ""
|
5514 |
|
5526 |
msgid "Payment creation failed before sending buyer to PayPal. Payment data: %s"
|
5527 |
msgstr ""
|
5528 |
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
5529 |
#: includes/gateways/paypal-standard.php:274
|
5530 |
#: includes/gateways/paypal-standard.php:279
|
5531 |
msgid "Invalid IPN verification response. IPN data: %s"
|
5628 |
msgid "PayPal Refund Transaction ID: %s"
|
5629 |
msgstr ""
|
5630 |
|
5631 |
+
#: includes/install.php:60 includes/template-functions.php:179
|
5632 |
+
#: templates/widget-cart-empty.php:3
|
5633 |
msgid "Checkout"
|
5634 |
msgstr ""
|
5635 |
|
5649 |
msgid "The password you entered is incorrect"
|
5650 |
msgstr ""
|
5651 |
|
5652 |
+
#: includes/login-register.php:87 includes/process-purchase.php:576
|
5653 |
msgid "The username you entered does not exist"
|
5654 |
msgstr ""
|
5655 |
|
5656 |
#: includes/login-register.php:140 includes/login-register.php:148
|
5657 |
+
#: includes/process-purchase.php:464
|
5658 |
msgid "Invalid username"
|
5659 |
msgstr ""
|
5660 |
|
5661 |
+
#: includes/login-register.php:144 includes/process-purchase.php:457
|
5662 |
msgid "Username already taken"
|
5663 |
msgstr ""
|
5664 |
|
5666 |
msgid "Email address already taken"
|
5667 |
msgstr ""
|
5668 |
|
5669 |
+
#: includes/login-register.php:156 includes/process-purchase.php:404
|
5670 |
+
#: includes/process-purchase.php:479 includes/process-purchase.php:609
|
5671 |
msgid "Invalid email"
|
5672 |
msgstr ""
|
5673 |
|
5803 |
"%2$s with no alternative available."
|
5804 |
msgstr ""
|
5805 |
|
5806 |
+
#: includes/payments/actions.php:135
|
5807 |
msgid "Status changed from %s to %s"
|
5808 |
msgstr ""
|
5809 |
|
5810 |
+
#: includes/payments/functions.php:603
|
5811 |
msgid "Complete"
|
5812 |
msgstr ""
|
5813 |
|
5814 |
+
#: includes/payments/functions.php:1643
|
5815 |
msgid "EDD Bot"
|
5816 |
msgstr ""
|
5817 |
|
5818 |
+
#: includes/payments/functions.php:1658
|
5819 |
msgid "Delete this payment note"
|
5820 |
msgstr ""
|
5821 |
|
5933 |
msgid "Search Categories"
|
5934 |
msgstr ""
|
5935 |
|
5936 |
+
#: includes/post-types.php:205
|
5937 |
+
msgid "All Categories"
|
5938 |
+
msgstr ""
|
5939 |
+
|
5940 |
#: includes/post-types.php:206
|
5941 |
msgid "Parent Category"
|
5942 |
msgstr ""
|
5961 |
msgid "New Category Name"
|
5962 |
msgstr ""
|
5963 |
|
5964 |
+
#: includes/post-types.php:212
|
5965 |
+
msgid "Categories"
|
5966 |
+
msgstr ""
|
5967 |
+
|
5968 |
#: includes/post-types.php:231
|
5969 |
msgid "Search Tags"
|
5970 |
msgstr ""
|
6001 |
msgid "Choose from most used %s tags"
|
6002 |
msgstr ""
|
6003 |
|
6004 |
+
#: includes/post-types.php:304
|
6005 |
msgid "Refunded <span class=\"count\">(%s)</span>"
|
6006 |
msgid_plural "Refunded <span class=\"count\">(%s)</span>"
|
6007 |
msgstr[0] ""
|
6008 |
msgstr[1] ""
|
6009 |
|
6010 |
+
#: includes/post-types.php:312
|
6011 |
msgid "Failed <span class=\"count\">(%s)</span>"
|
6012 |
msgid_plural "Failed <span class=\"count\">(%s)</span>"
|
6013 |
msgstr[0] ""
|
6014 |
msgstr[1] ""
|
6015 |
|
6016 |
+
#: includes/post-types.php:320
|
6017 |
msgid "Revoked <span class=\"count\">(%s)</span>"
|
6018 |
msgid_plural "Revoked <span class=\"count\">(%s)</span>"
|
6019 |
msgstr[0] ""
|
6020 |
msgstr[1] ""
|
6021 |
|
6022 |
+
#: includes/post-types.php:328
|
6023 |
msgid "Abandoned <span class=\"count\">(%s)</span>"
|
6024 |
msgid_plural "Abandoned <span class=\"count\">(%s)</span>"
|
6025 |
msgstr[0] ""
|
6026 |
msgstr[1] ""
|
6027 |
|
6028 |
+
#: includes/post-types.php:338
|
6029 |
msgid "Active <span class=\"count\">(%s)</span>"
|
6030 |
msgid_plural "Active <span class=\"count\">(%s)</span>"
|
6031 |
msgstr[0] ""
|
6032 |
msgstr[1] ""
|
6033 |
|
6034 |
+
#: includes/post-types.php:346
|
6035 |
msgid "Inactive <span class=\"count\">(%s)</span>"
|
6036 |
msgid_plural "Inactive <span class=\"count\">(%s)</span>"
|
6037 |
msgstr[0] ""
|
6038 |
msgstr[1] ""
|
6039 |
|
6040 |
+
#: includes/post-types.php:368 includes/post-types.php:369
|
6041 |
msgid "%2$s updated. %1$sView %2$s%3$s."
|
6042 |
msgstr ""
|
6043 |
|
6044 |
+
#: includes/post-types.php:370
|
6045 |
msgid "%2$s published. %1$sView %2$s%3$s."
|
6046 |
msgstr ""
|
6047 |
|
6048 |
+
#: includes/post-types.php:371
|
6049 |
msgid "%2$s saved. %1$sView %2$s%3$s."
|
6050 |
msgstr ""
|
6051 |
|
6052 |
+
#: includes/post-types.php:372
|
6053 |
msgid "%2$s submitted. %1$sView %2$s%3$s."
|
6054 |
msgstr ""
|
6055 |
|
6056 |
+
#: includes/post-types.php:392
|
6057 |
msgid "%1$s %2$s updated."
|
6058 |
msgid_plural "%1$s %3$s updated."
|
6059 |
msgstr[0] ""
|
6060 |
msgstr[1] ""
|
6061 |
|
6062 |
+
#: includes/post-types.php:393
|
6063 |
msgid "%1$s %2$s not updated, somebody is editing it."
|
6064 |
msgid_plural "%1$s %3$s not updated, somebody is editing them."
|
6065 |
msgstr[0] ""
|
6066 |
msgstr[1] ""
|
6067 |
|
6068 |
+
#: includes/post-types.php:394
|
6069 |
msgid "%1$s %2$s permanently deleted."
|
6070 |
msgid_plural "%1$s %3$s permanently deleted."
|
6071 |
msgstr[0] ""
|
6072 |
msgstr[1] ""
|
6073 |
|
6074 |
+
#: includes/post-types.php:395
|
6075 |
msgid "%1$s %2$s moved to the Trash."
|
6076 |
msgid_plural "%1$s %3$s moved to the Trash."
|
6077 |
msgstr[0] ""
|
6078 |
msgstr[1] ""
|
6079 |
|
6080 |
+
#: includes/post-types.php:396
|
6081 |
msgid "%1$s %2$s restored from the Trash."
|
6082 |
msgid_plural "%1$s %3$s restored from the Trash."
|
6083 |
msgstr[0] ""
|
6091 |
msgid "Purchase Verification Failed"
|
6092 |
msgstr ""
|
6093 |
|
6094 |
+
#: includes/process-purchase.php:31 includes/scripts.php:73
|
6095 |
msgid "Your cart is empty"
|
6096 |
msgstr ""
|
6097 |
|
6098 |
+
#: includes/process-purchase.php:240
|
6099 |
msgid "The selected payment gateway is not enabled"
|
6100 |
msgstr ""
|
6101 |
|
6102 |
+
#: includes/process-purchase.php:300
|
6103 |
msgid "One or more of the discounts you entered is invalid"
|
6104 |
msgstr ""
|
6105 |
|
6106 |
+
#: includes/process-purchase.php:317
|
6107 |
msgid "You must agree to the terms of use"
|
6108 |
msgstr ""
|
6109 |
|
6110 |
+
#: includes/process-purchase.php:332
|
6111 |
msgid "Please enter a valid email address"
|
6112 |
msgstr ""
|
6113 |
|
6114 |
+
#: includes/process-purchase.php:336
|
6115 |
msgid "Please enter your first name"
|
6116 |
msgstr ""
|
6117 |
|
6118 |
+
#: includes/process-purchase.php:346
|
6119 |
msgid "Please enter your zip / postal code"
|
6120 |
msgstr ""
|
6121 |
|
6122 |
+
#: includes/process-purchase.php:350
|
6123 |
msgid "Please enter your billing city"
|
6124 |
msgstr ""
|
6125 |
|
6126 |
+
#: includes/process-purchase.php:354
|
6127 |
msgid "Please select your billing country"
|
6128 |
msgstr ""
|
6129 |
|
6130 |
+
#: includes/process-purchase.php:358
|
6131 |
msgid "Please enter billing state / province"
|
6132 |
msgstr ""
|
6133 |
|
6134 |
+
#: includes/process-purchase.php:409
|
6135 |
msgid "The user information is invalid"
|
6136 |
msgstr ""
|
6137 |
|
6138 |
+
#: includes/process-purchase.php:462
|
6139 |
msgid "Invalid username. Only lowercase letters (a-z) and numbers are allowed"
|
6140 |
msgstr ""
|
6141 |
|
6142 |
+
#: includes/process-purchase.php:471
|
6143 |
msgid "You must register or login to complete your purchase"
|
6144 |
msgstr ""
|
6145 |
|
6146 |
+
#: includes/process-purchase.php:482
|
6147 |
msgid "Email already used"
|
6148 |
msgstr ""
|
6149 |
|
6150 |
+
#: includes/process-purchase.php:489 includes/process-purchase.php:616
|
6151 |
msgid "Enter an email"
|
6152 |
msgstr ""
|
6153 |
|
6154 |
+
#: includes/process-purchase.php:497
|
6155 |
msgid "Passwords don't match"
|
6156 |
msgstr ""
|
6157 |
|
6158 |
+
#: includes/process-purchase.php:506 includes/process-purchase.php:572
|
6159 |
msgid "Enter a password"
|
6160 |
msgstr ""
|
6161 |
|
6162 |
+
#: includes/process-purchase.php:509
|
6163 |
msgid "Enter the password confirmation"
|
6164 |
msgstr ""
|
6165 |
|
6166 |
+
#: includes/process-purchase.php:533
|
6167 |
msgid "You must login or register to complete your purchase"
|
6168 |
msgstr ""
|
6169 |
|
6170 |
+
#: includes/process-purchase.php:553
|
6171 |
msgid "The password you entered is incorrect. %sReset Password%s"
|
6172 |
msgstr ""
|
6173 |
|
6174 |
+
#: includes/process-purchase.php:554 templates/shortcode-login.php:29
|
6175 |
msgid "Lost Password"
|
6176 |
msgstr ""
|
6177 |
|
6178 |
+
#: includes/process-purchase.php:598
|
6179 |
msgid "You must be logged into an account to purchase"
|
6180 |
msgstr ""
|
6181 |
|
6182 |
+
#: includes/process-purchase.php:778
|
6183 |
msgid "The zip / postal code you entered for your billing address is invalid"
|
6184 |
msgstr ""
|
6185 |
|
6186 |
+
#: includes/process-purchase.php:1040
|
6187 |
msgid "An internal error has occurred, please try again or contact support."
|
6188 |
msgstr ""
|
6189 |
|
6191 |
msgid "You do not have permission to view this file."
|
6192 |
msgstr ""
|
6193 |
|
6194 |
+
#: includes/scripts.php:51
|
6195 |
msgid "Please select a payment method"
|
6196 |
msgstr ""
|
6197 |
|
6198 |
+
#: includes/scripts.php:52
|
6199 |
msgid "Please enter a discount code"
|
6200 |
msgstr ""
|
6201 |
|
6202 |
+
#: includes/scripts.php:54
|
6203 |
msgid "Discount Applied"
|
6204 |
msgstr ""
|
6205 |
|
6206 |
+
#: includes/scripts.php:55
|
6207 |
msgid "Please enter an email address before applying a discount code"
|
6208 |
msgstr ""
|
6209 |
|
6210 |
+
#: includes/scripts.php:56
|
6211 |
msgid "Please enter a username before applying a discount code"
|
6212 |
msgstr ""
|
6213 |
|
6214 |
+
#: includes/scripts.php:57
|
6215 |
msgid "Please Wait..."
|
6216 |
msgstr ""
|
6217 |
|
6218 |
+
#: includes/scripts.php:72
|
6219 |
msgid "You have already added this item to your cart"
|
6220 |
msgstr ""
|
6221 |
|
6222 |
+
#: includes/scripts.php:74
|
6223 |
msgid "Loading"
|
6224 |
msgstr ""
|
6225 |
|
6226 |
+
#: includes/scripts.php:75
|
6227 |
msgid "Please select an option"
|
6228 |
msgstr ""
|
6229 |
|
6230 |
+
#: includes/scripts.php:179
|
6231 |
msgid "Add New Download"
|
6232 |
msgstr ""
|
6233 |
|
6234 |
+
#: includes/scripts.php:180
|
6235 |
msgid "Use This File"
|
6236 |
msgstr ""
|
6237 |
|
6238 |
+
#: includes/scripts.php:181
|
6239 |
msgid "Sorry, not available for variable priced products."
|
6240 |
msgstr ""
|
6241 |
|
6242 |
+
#: includes/scripts.php:182
|
6243 |
msgid "Are you sure you wish to delete this payment?"
|
6244 |
msgstr ""
|
6245 |
|
6246 |
+
#: includes/scripts.php:183
|
6247 |
msgid "Are you sure you wish to delete this note?"
|
6248 |
msgstr ""
|
6249 |
|
6250 |
+
#: includes/scripts.php:184
|
6251 |
msgid "Are you sure you wish to delete this tax rate?"
|
6252 |
msgstr ""
|
6253 |
|
6254 |
+
#: includes/scripts.php:185
|
6255 |
msgid "Are you sure you wish to revoke this API key?"
|
6256 |
msgstr ""
|
6257 |
|
6258 |
+
#: includes/scripts.php:186
|
6259 |
msgid "Are you sure you wish to regenerate this API key?"
|
6260 |
msgstr ""
|
6261 |
|
6262 |
+
#: includes/scripts.php:187
|
6263 |
msgid "Are you sure you wish to resend the purchase receipt?"
|
6264 |
msgstr ""
|
6265 |
|
6266 |
+
#: includes/scripts.php:188
|
6267 |
msgid "Copy these links to your clipboard and give them to your customer"
|
6268 |
msgstr ""
|
6269 |
|
6270 |
+
#: includes/scripts.php:189
|
6271 |
msgid "Are you sure you wish to delete this %s?"
|
6272 |
msgstr ""
|
6273 |
|
6274 |
+
#: includes/scripts.php:190
|
6275 |
msgid "You must have at least one price"
|
6276 |
msgstr ""
|
6277 |
|
6278 |
+
#: includes/scripts.php:191
|
6279 |
msgid "You must have at least one field"
|
6280 |
msgstr ""
|
6281 |
|
6282 |
+
#: includes/scripts.php:192
|
6283 |
+
msgid "Payments must contain at least one item"
|
6284 |
+
msgstr ""
|
6285 |
+
|
6286 |
+
#: includes/scripts.php:193
|
6287 |
msgid "Choose a %s"
|
6288 |
msgstr ""
|
6289 |
|
6290 |
+
#: includes/scripts.php:194
|
6291 |
msgid "Choose one or more %s"
|
6292 |
msgstr ""
|
6293 |
|
6294 |
+
#: includes/scripts.php:195
|
6295 |
msgid "Item price must be numeric"
|
6296 |
msgstr ""
|
6297 |
|
6298 |
+
#: includes/scripts.php:196
|
6299 |
msgid "Quantity must be numeric"
|
6300 |
msgstr ""
|
6301 |
|
6302 |
+
#: includes/scripts.php:203
|
6303 |
msgid "Type to search %s"
|
6304 |
msgstr ""
|
6305 |
|
6306 |
+
#: includes/shortcodes.php:237
|
6307 |
msgid "Purchase All Items"
|
6308 |
msgstr ""
|
6309 |
|
6310 |
+
#: includes/shortcodes.php:615
|
6311 |
msgid "Sorry, trouble retrieving payment receipt."
|
6312 |
msgstr ""
|
6313 |
|
6314 |
+
#: includes/shortcodes.php:755
|
6315 |
msgid "The passwords you entered do not match. Please try again."
|
6316 |
msgstr ""
|
6317 |
|
6318 |
+
#: includes/shortcodes.php:765
|
6319 |
msgid "The email you entered is invalid. Please enter a valid email."
|
6320 |
msgstr ""
|
6321 |
|
6322 |
+
#: includes/shortcodes.php:770
|
6323 |
msgid "The email you entered belongs to another user. Please use another."
|
6324 |
msgstr ""
|
6325 |
|
6326 |
+
#: includes/template-functions.php:131
|
6327 |
msgid "Free"
|
6328 |
msgstr ""
|
6329 |
|
6330 |
+
#: includes/template-functions.php:186
|
6331 |
msgid "Added to cart"
|
6332 |
msgstr ""
|
6333 |
|
6334 |
+
#: includes/template-functions.php:187
|
6335 |
msgid "Go to Checkout"
|
6336 |
msgstr ""
|
6337 |
|
6338 |
+
#: includes/template-functions.php:196
|
6339 |
msgid "Includes %1$s% tax"
|
6340 |
msgstr ""
|
6341 |
|
6342 |
+
#: includes/template-functions.php:198
|
6343 |
msgid "Excluding %1$s% tax"
|
6344 |
msgstr ""
|
6345 |
|
6346 |
+
#: includes/template-functions.php:414
|
6347 |
msgid "White"
|
6348 |
msgstr ""
|
6349 |
|
6350 |
+
#: includes/template-functions.php:418
|
6351 |
msgid "Gray"
|
6352 |
msgstr ""
|
6353 |
|
6354 |
+
#: includes/template-functions.php:422
|
6355 |
msgid "Blue"
|
6356 |
msgstr ""
|
6357 |
|
6358 |
+
#: includes/template-functions.php:426
|
6359 |
msgid "Red"
|
6360 |
msgstr ""
|
6361 |
|
6362 |
+
#: includes/template-functions.php:430
|
6363 |
msgid "Green"
|
6364 |
msgstr ""
|
6365 |
|
6366 |
+
#: includes/template-functions.php:434
|
6367 |
msgid "Yellow"
|
6368 |
msgstr ""
|
6369 |
|
6370 |
+
#: includes/template-functions.php:438
|
6371 |
msgid "Orange"
|
6372 |
msgstr ""
|
6373 |
|
6374 |
+
#: includes/template-functions.php:442
|
6375 |
msgid "Dark Gray"
|
6376 |
msgstr ""
|
6377 |
|
6378 |
+
#: includes/template-functions.php:446
|
6379 |
msgid "Inherit"
|
6380 |
msgstr ""
|
6381 |
|
6382 |
+
#: includes/template-functions.php:464
|
6383 |
msgid "Button"
|
6384 |
msgstr ""
|
6385 |
|
6386 |
+
#: includes/template-functions.php:465
|
6387 |
msgid "Plain Text"
|
6388 |
msgstr ""
|
6389 |
|
6399 |
msgid "Display the downloads shopping cart"
|
6400 |
msgstr ""
|
6401 |
|
6402 |
+
#: includes/widgets.php:86 includes/widgets.php:165 includes/widgets.php:306
|
6403 |
msgid "Title:"
|
6404 |
msgstr ""
|
6405 |
|
6419 |
msgid "Taxonomy:"
|
6420 |
msgstr ""
|
6421 |
|
6422 |
+
#: includes/widgets.php:180
|
6423 |
msgid "Show Count:"
|
6424 |
msgstr ""
|
6425 |
|
6426 |
+
#: includes/widgets.php:184
|
6427 |
msgid "Hide Empty Categories:"
|
6428 |
msgstr ""
|
6429 |
|
6430 |
+
#: includes/widgets.php:206 includes/widgets.php:294
|
6431 |
msgid "%s Details"
|
6432 |
msgstr ""
|
6433 |
|
6434 |
+
#: includes/widgets.php:208
|
6435 |
msgid "Display the details of a specific %s"
|
6436 |
msgstr ""
|
6437 |
|
6438 |
+
#: includes/widgets.php:320
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
6439 |
msgid "%s"
|
6440 |
msgstr ""
|
6441 |
|
6442 |
+
#: includes/widgets.php:322
|
6443 |
msgid "Use current"
|
6444 |
msgstr ""
|
6445 |
|
6446 |
+
#: includes/widgets.php:332
|
6447 |
msgid "Show Title"
|
6448 |
msgstr ""
|
6449 |
|
6450 |
+
#: includes/widgets.php:338
|
6451 |
msgid "Show Purchase Button"
|
6452 |
msgstr ""
|
6453 |
|
6454 |
+
#: includes/widgets.php:345 includes/widgets.php:352
|
6455 |
+
msgid "Show %s"
|
|
|
|
|
|
|
|
|
6456 |
msgstr ""
|
6457 |
|
6458 |
#: templates/checkout_cart.php:11
|
6463 |
msgid "Item Price"
|
6464 |
msgstr ""
|
6465 |
|
6466 |
+
#: templates/checkout_cart.php:97 templates/shortcode-receipt.php:98
|
6467 |
msgid "Subtotal"
|
6468 |
msgstr ""
|
6469 |
|
6470 |
+
#: templates/checkout_cart.php:124
|
6471 |
msgid "Total"
|
6472 |
msgstr ""
|
6473 |
|
6613 |
msgid "Confirm Password"
|
6614 |
msgstr ""
|
6615 |
|
6616 |
+
#: templates/widget-cart-checkout.php:2 templates/widget-cart-empty.php:2
|
6617 |
msgid "Subtotal:"
|
6618 |
msgstr ""
|
6619 |
|
6620 |
+
#: templates/widget-cart-checkout.php:3
|
6621 |
+
msgid "Estimated Tax:"
|
6622 |
+
msgstr ""
|
6623 |
+
|
6624 |
#: templates/widget-cart-item.php:4
|
6625 |
msgid "remove"
|
6626 |
msgstr ""
|
6653 |
msgid "State / Province:"
|
6654 |
msgstr ""
|
6655 |
|
6656 |
+
#: includes/admin/reporting/reports.php:367
|
6657 |
msgctxt "Date one to date two"
|
6658 |
msgid "to"
|
6659 |
msgstr ""
|
6660 |
|
6661 |
+
#: includes/checkout/template.php:701
|
6662 |
msgctxt "Entering a discount code"
|
6663 |
msgid "Click to enter it"
|
6664 |
msgstr ""
|
6665 |
|
6666 |
+
#: includes/checkout/template.php:710
|
6667 |
msgctxt "Apply discount at checkout"
|
6668 |
msgid "Apply"
|
6669 |
msgstr ""
|
6670 |
|
6671 |
+
#: includes/class-edd-html-elements.php:240
|
6672 |
+
msgctxt "plural: Example: \"All Categories\""
|
6673 |
+
msgid "All %s"
|
6674 |
+
msgstr ""
|
6675 |
+
|
6676 |
+
#: includes/class-edd-html-elements.php:330
|
6677 |
msgctxt "all dropdown items"
|
6678 |
msgid "All"
|
6679 |
msgstr ""
|
6680 |
|
6681 |
+
#: includes/class-edd-html-elements.php:331
|
6682 |
msgctxt "no dropdown items"
|
6683 |
msgid "None"
|
6684 |
msgstr ""
|
6688 |
msgid "%2$s"
|
6689 |
msgstr ""
|
6690 |
|
6691 |
+
#: includes/shortcodes.php:569
|
6692 |
msgctxt "download post type name"
|
6693 |
msgid "No %s found"
|
6694 |
msgstr ""
|
6725 |
|
6726 |
#: includes/post-types.php:202
|
6727 |
msgctxt "taxonomy general name"
|
6728 |
+
msgid "Categories"
|
6729 |
msgstr ""
|
6730 |
|
6731 |
#: includes/post-types.php:229
|
6732 |
msgctxt "taxonomy general name"
|
6733 |
+
msgid "Tags"
|
6734 |
msgstr ""
|
6735 |
|
6736 |
#: includes/post-types.php:203
|
6743 |
msgid "Tag"
|
6744 |
msgstr ""
|
6745 |
|
6746 |
+
#: includes/post-types.php:299
|
6747 |
msgctxt "Refunded payment status"
|
6748 |
msgid "Refunded"
|
6749 |
msgstr ""
|
6750 |
|
6751 |
+
#: includes/post-types.php:307
|
6752 |
msgctxt "Failed payment status"
|
6753 |
msgid "Failed"
|
6754 |
msgstr ""
|
6755 |
|
6756 |
+
#: includes/post-types.php:315
|
6757 |
msgctxt "Revoked payment status"
|
6758 |
msgid "Revoked"
|
6759 |
msgstr ""
|
6760 |
|
6761 |
+
#: includes/post-types.php:323
|
6762 |
msgctxt "Abandoned payment status"
|
6763 |
msgid "Abandoned"
|
6764 |
msgstr ""
|
6765 |
|
6766 |
+
#: includes/post-types.php:333
|
6767 |
msgctxt "Active discount code status"
|
6768 |
msgid "Active"
|
6769 |
msgstr ""
|
6770 |
|
6771 |
+
#: includes/post-types.php:341
|
6772 |
msgctxt "Inactive discount code status"
|
6773 |
msgid "Inactive"
|
6774 |
msgstr ""
|
readme.txt
CHANGED
@@ -7,7 +7,7 @@ Tags: download, downloads, e-store, eshop, digital downloads, e-downloads, ecomm
|
|
7 |
Requires at least: 3.9.2
|
8 |
Tested up to: 4.2
|
9 |
|
10 |
-
Stable Tag: 2.
|
11 |
|
12 |
License: GNU Version 2 or Any Later Version
|
13 |
|
@@ -21,7 +21,7 @@ Features of the plugin include:
|
|
21 |
|
22 |
* Cart system for purchasing multiple downloads at once
|
23 |
* Complete promotional code system
|
24 |
-
* Many payment gateways. PayPal
|
25 |
* Complete payment history
|
26 |
* User purchase history and ability to redownload files
|
27 |
* Multiple files per downloadable product
|
@@ -191,6 +191,48 @@ Yes, through the addition of one or more of the add-on payment gateways, you can
|
|
191 |
|
192 |
== Changelog ==
|
193 |
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
194 |
= 2.3.9, May 25, 2015 =
|
195 |
|
196 |
* Fix: Variable price assignment options get removed from download when deleting file row
|
7 |
Requires at least: 3.9.2
|
8 |
Tested up to: 4.2
|
9 |
|
10 |
+
Stable Tag: 2.4
|
11 |
|
12 |
License: GNU Version 2 or Any Later Version
|
13 |
|
21 |
|
22 |
* Cart system for purchasing multiple downloads at once
|
23 |
* Complete promotional code system
|
24 |
+
* Many payment gateways. PayPal, Amazon, Test Payments are included by default with Stripe, PayPal Pro, PayPal Express, and others available as [extensions](https://easydigitaldownloads.com/blog/extensions/categories/gateways/?utm_source=gateways&utm_medium=description_tab&utm_content=gateways&utm_campaign=readme)
|
25 |
* Complete payment history
|
26 |
* User purchase history and ability to redownload files
|
27 |
* Multiple files per downloadable product
|
191 |
|
192 |
== Changelog ==
|
193 |
|
194 |
+
= 2.4, June 30, 2015 =
|
195 |
+
|
196 |
+
* New: Added support for Amazon Login and Pay
|
197 |
+
* New: Added Earnings by Category report
|
198 |
+
* New: Added batch processing to data export for handling large amounts of data
|
199 |
+
* New: Added versioning to the REST API
|
200 |
+
* New: Added a filter to disable redirect to checkout on per-download basis
|
201 |
+
* New: Added method for extensions to pre-fill customer details on checkout
|
202 |
+
* New: Added helper functions for verifying credit / debit card numbers
|
203 |
+
* New: Added date range options to payment and file download history exports
|
204 |
+
* New: Added options to control the text shown on Buy Now buttons
|
205 |
+
* New: Added an action to the cart item title column
|
206 |
+
* New: Added an action to the Actions column of the cart
|
207 |
+
* New: Added standardized classes for error, notice, and alert messages
|
208 |
+
* New: Added date_field() method to EDD_HTML_Elements class
|
209 |
+
* New: Added filters for the From Address for admin sale notifications
|
210 |
+
* Tweak: Improved performance of user validation in the REST API
|
211 |
+
* Tweak: Improved edd_is_admin_page() helper function for detecting when on specific EDD admin pages
|
212 |
+
* Tweak: Stylesheets are now registered before enqueueed
|
213 |
+
* Tweak: Moved Test Mode option to the Payment Gateways tab
|
214 |
+
* Tweak: Earnings and sales states now incremented while in Test Mode
|
215 |
+
* Tweak: Download Details widget now properly respects taxonomy labels
|
216 |
+
* Tweak: Improved customer count functions in the REST API
|
217 |
+
* Tweak: Default gateway now shows as first gateway on checkout
|
218 |
+
* Tweak: Purchase link shortcode now shown in the Download Settings meta box
|
219 |
+
* Tweak: edd_recalculate_taxes() now includes a raw amount in the response
|
220 |
+
* Tweak: Customer export is now standarized for all export options
|
221 |
+
* Tweak: Sequential order numbers improved to protect against race conditions
|
222 |
+
* Fix: Opt-in tracking accidentally enabled for all installs
|
223 |
+
* Fix: Minor security flaw with gateway selection on checkout
|
224 |
+
* Fix: Symlink file downloads option gets hidden after reload
|
225 |
+
* Fix: Undefined index error with banned emails
|
226 |
+
* Fix: Notices thrown when logging API requests
|
227 |
+
* Fix: Customer email not updated when associated user account's email is updated
|
228 |
+
* Fix: Incorrect for attribute on checkout's password field
|
229 |
+
* Fix: edd_items_in_cart cookie disables cache improperly
|
230 |
+
* Fix: API keys are difficult to select on mobile
|
231 |
+
* Fix: Tools tab displays poorly on mobile
|
232 |
+
* Fix: Buy Now buttons not properly setting item quantity through PayPal
|
233 |
+
* Fix: December month data is plotted in January when viewing custom date range
|
234 |
+
* Fix: Double error message when entering discount code that has already been used
|
235 |
+
|
236 |
= 2.3.9, May 25, 2015 =
|
237 |
|
238 |
* Fix: Variable price assignment options get removed from download when deleting file row
|
templates/checkout_cart.php
CHANGED
@@ -1,7 +1,7 @@
|
|
1 |
<?php
|
2 |
/**
|
3 |
* This template is used to display the Checkout page when items are in the cart
|
4 |
-
*/
|
5 |
|
6 |
global $post; ?>
|
7 |
<table id="edd_checkout_cart" <?php if ( ! edd_is_ajax_disabled() ) { echo 'class="ajaxed"'; } ?>>
|
@@ -33,15 +33,22 @@ global $post; ?>
|
|
33 |
$item_title .= ' - ' . edd_get_cart_item_price_name( $item );
|
34 |
}
|
35 |
echo '<span class="edd_checkout_cart_item_title">' . esc_html( $item_title ) . '</span>';
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
36 |
?>
|
37 |
</td>
|
38 |
-
<td class="edd_cart_item_price"><?php echo edd_cart_item_price( $item['id'], $item['options'] ); ?></td>
|
39 |
<td class="edd_cart_actions">
|
40 |
<?php if( edd_item_quantities_enabled() ) : ?>
|
41 |
<input type="number" min="1" step="1" name="edd-cart-download-<?php echo $key; ?>-quantity" data-key="<?php echo $key; ?>" class="edd-input edd-item-quantity" value="<?php echo edd_get_cart_item_quantity( $item['id'], $item['options'] ); ?>"/>
|
42 |
<input type="hidden" name="edd-cart-downloads[]" value="<?php echo $item['id']; ?>"/>
|
43 |
<input type="hidden" name="edd-cart-download-<?php echo $key; ?>-options" value="<?php echo esc_attr( serialize( $item['options'] ) ); ?>"/>
|
44 |
<?php endif; ?>
|
|
|
45 |
<a class="edd_cart_remove_item_btn" href="<?php echo esc_url( edd_remove_item_url( $key ) ); ?>"><?php _e( 'Remove', 'edd' ); ?></a>
|
46 |
</td>
|
47 |
<?php do_action( 'edd_checkout_table_body_last', $item ); ?>
|
@@ -53,13 +60,20 @@ global $post; ?>
|
|
53 |
<?php if( edd_cart_has_fees() ) : ?>
|
54 |
<?php foreach( edd_get_cart_fees() as $fee_id => $fee ) : ?>
|
55 |
<tr class="edd_cart_fee" id="edd_cart_fee_<?php echo $fee_id; ?>">
|
|
|
|
|
|
|
56 |
<td class="edd_cart_fee_label"><?php echo esc_html( $fee['label'] ); ?></td>
|
57 |
<td class="edd_cart_fee_amount"><?php echo esc_html( edd_currency_filter( edd_format_amount( $fee['amount'] ) ) ); ?></td>
|
58 |
<td>
|
59 |
<?php if( ! empty( $fee['type'] ) && 'item' == $fee['type'] ) : ?>
|
60 |
<a href="<?php echo esc_url( edd_remove_cart_fee_url( $fee_id ) ); ?>"><?php _e( 'Remove', 'edd' ); ?></a>
|
61 |
<?php endif; ?>
|
|
|
62 |
</td>
|
|
|
|
|
|
|
63 |
</tr>
|
64 |
<?php endforeach; ?>
|
65 |
<?php endif; ?>
|
@@ -85,7 +99,7 @@ global $post; ?>
|
|
85 |
<?php do_action( 'edd_checkout_table_subtotal_last' ); ?>
|
86 |
</tr>
|
87 |
<?php endif; ?>
|
88 |
-
|
89 |
<tr class="edd_cart_footer_row edd_cart_discount_row" <?php if( ! edd_cart_has_discounts() ) echo ' style="display:none;"'; ?>>
|
90 |
<?php do_action( 'edd_checkout_table_discount_first' ); ?>
|
91 |
<th colspan="<?php echo edd_checkout_cart_columns(); ?>" class="edd_cart_discount">
|
1 |
<?php
|
2 |
/**
|
3 |
* This template is used to display the Checkout page when items are in the cart
|
4 |
+
*/
|
5 |
|
6 |
global $post; ?>
|
7 |
<table id="edd_checkout_cart" <?php if ( ! edd_is_ajax_disabled() ) { echo 'class="ajaxed"'; } ?>>
|
33 |
$item_title .= ' - ' . edd_get_cart_item_price_name( $item );
|
34 |
}
|
35 |
echo '<span class="edd_checkout_cart_item_title">' . esc_html( $item_title ) . '</span>';
|
36 |
+
do_action( 'edd_checkout_cart_item_title_after', $item );
|
37 |
+
?>
|
38 |
+
</td>
|
39 |
+
<td class="edd_cart_item_price">
|
40 |
+
<?php
|
41 |
+
echo edd_cart_item_price( $item['id'], $item['options'] );
|
42 |
+
do_action( 'edd_checkout_cart_item_price_after', $item );
|
43 |
?>
|
44 |
</td>
|
|
|
45 |
<td class="edd_cart_actions">
|
46 |
<?php if( edd_item_quantities_enabled() ) : ?>
|
47 |
<input type="number" min="1" step="1" name="edd-cart-download-<?php echo $key; ?>-quantity" data-key="<?php echo $key; ?>" class="edd-input edd-item-quantity" value="<?php echo edd_get_cart_item_quantity( $item['id'], $item['options'] ); ?>"/>
|
48 |
<input type="hidden" name="edd-cart-downloads[]" value="<?php echo $item['id']; ?>"/>
|
49 |
<input type="hidden" name="edd-cart-download-<?php echo $key; ?>-options" value="<?php echo esc_attr( serialize( $item['options'] ) ); ?>"/>
|
50 |
<?php endif; ?>
|
51 |
+
<?php do_action( 'edd_cart_actions', $item, $key ); ?>
|
52 |
<a class="edd_cart_remove_item_btn" href="<?php echo esc_url( edd_remove_item_url( $key ) ); ?>"><?php _e( 'Remove', 'edd' ); ?></a>
|
53 |
</td>
|
54 |
<?php do_action( 'edd_checkout_table_body_last', $item ); ?>
|
60 |
<?php if( edd_cart_has_fees() ) : ?>
|
61 |
<?php foreach( edd_get_cart_fees() as $fee_id => $fee ) : ?>
|
62 |
<tr class="edd_cart_fee" id="edd_cart_fee_<?php echo $fee_id; ?>">
|
63 |
+
|
64 |
+
<?php do_action( 'edd_cart_fee_rows_before', $fee_id, $fee ); ?>
|
65 |
+
|
66 |
<td class="edd_cart_fee_label"><?php echo esc_html( $fee['label'] ); ?></td>
|
67 |
<td class="edd_cart_fee_amount"><?php echo esc_html( edd_currency_filter( edd_format_amount( $fee['amount'] ) ) ); ?></td>
|
68 |
<td>
|
69 |
<?php if( ! empty( $fee['type'] ) && 'item' == $fee['type'] ) : ?>
|
70 |
<a href="<?php echo esc_url( edd_remove_cart_fee_url( $fee_id ) ); ?>"><?php _e( 'Remove', 'edd' ); ?></a>
|
71 |
<?php endif; ?>
|
72 |
+
|
73 |
</td>
|
74 |
+
|
75 |
+
<?php do_action( 'edd_cart_fee_rows_after', $fee_id, $fee ); ?>
|
76 |
+
|
77 |
</tr>
|
78 |
<?php endforeach; ?>
|
79 |
<?php endif; ?>
|
99 |
<?php do_action( 'edd_checkout_table_subtotal_last' ); ?>
|
100 |
</tr>
|
101 |
<?php endif; ?>
|
102 |
+
|
103 |
<tr class="edd_cart_footer_row edd_cart_discount_row" <?php if( ! edd_cart_has_discounts() ) echo ' style="display:none;"'; ?>>
|
104 |
<?php do_action( 'edd_checkout_table_discount_first' ); ?>
|
105 |
<th colspan="<?php echo edd_checkout_cart_columns(); ?>" class="edd_cart_discount">
|
templates/edd.css
CHANGED
@@ -238,7 +238,7 @@
|
|
238 |
display: inline-block;
|
239 |
width: auto;
|
240 |
}
|
241 |
-
#edd_checkout_form_wrap p {
|
242 |
margin: 0 0 21px
|
243 |
}
|
244 |
#edd_checkout_form_wrap span.edd-required-indicator {
|
@@ -421,6 +421,44 @@
|
|
421 |
-moz-box-shadow: none;
|
422 |
box-shadow: none;
|
423 |
}
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
424 |
/* =Ajax Add To Cart Button
|
425 |
-------------------------------------------------------------- */
|
426 |
|
@@ -909,19 +947,36 @@ input[type="submit"].edd-submit:focus,
|
|
909 |
font-style: italic;
|
910 |
color: grey;
|
911 |
}
|
912 |
-
.edd_subtotal {
|
913 |
font-weight: bold;
|
914 |
-
margin: 8px 0 8px 0;
|
915 |
font-style: italic;
|
916 |
}
|
917 |
-
.
|
918 |
-
font-size:
|
919 |
font-style: italic;
|
920 |
}
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
921 |
/* =Error styles
|
922 |
-------------------------------------------------------------- */
|
923 |
|
924 |
-
.edd_errors {
|
925 |
-webkit-border-radius: 2px;
|
926 |
-moz-border-radius: 2px;
|
927 |
border-radius: 2px;
|
@@ -939,7 +994,7 @@ p.edd_error {
|
|
939 |
/* =Success Message styles
|
940 |
-------------------------------------------------------------- */
|
941 |
|
942 |
-
.edd_success {
|
943 |
-webkit-border-radius: 2px;
|
944 |
-moz-border-radius: 2px;
|
945 |
border-radius: 2px;
|
@@ -949,4 +1004,56 @@ p.edd_error {
|
|
949 |
color: #567622;
|
950 |
padding: 6px 8px;
|
951 |
box-shadow: inset 0 1px 0 rgba(255, 255, 255, 0.7);
|
952 |
-
}
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
238 |
display: inline-block;
|
239 |
width: auto;
|
240 |
}
|
241 |
+
#edd_checkout_form_wrap > p {
|
242 |
margin: 0 0 21px
|
243 |
}
|
244 |
#edd_checkout_form_wrap span.edd-required-indicator {
|
421 |
-moz-box-shadow: none;
|
422 |
box-shadow: none;
|
423 |
}
|
424 |
+
|
425 |
+
.edd-amazon-profile-wrapper {
|
426 |
+
font-size: 12px;
|
427 |
+
}
|
428 |
+
|
429 |
+
.edd-amazon-profile-name {
|
430 |
+
font-weight: 600;
|
431 |
+
}
|
432 |
+
|
433 |
+
.edd-amazon-logout {
|
434 |
+
font-size: 10px;
|
435 |
+
line-height: 12px;
|
436 |
+
}
|
437 |
+
|
438 |
+
.edd-amazon-logout a {
|
439 |
+
cursor: pointer;
|
440 |
+
}
|
441 |
+
|
442 |
+
#edd-amazon-address-box {
|
443 |
+
height: 228px;
|
444 |
+
width: 350px;
|
445 |
+
margin-bottom: 15px;
|
446 |
+
}
|
447 |
+
|
448 |
+
#edd-amazon-wallet-box {
|
449 |
+
height: 228px;
|
450 |
+
width: 350px;
|
451 |
+
}
|
452 |
+
|
453 |
+
/* Desktop and tablet */
|
454 |
+
@media only screen and (min-width: 768px) {
|
455 |
+
#edd-amazon-address-box,
|
456 |
+
#edd-amazon-wallet-box {
|
457 |
+
width: 100%;
|
458 |
+
height: 228px;
|
459 |
+
}
|
460 |
+
}
|
461 |
+
|
462 |
/* =Ajax Add To Cart Button
|
463 |
-------------------------------------------------------------- */
|
464 |
|
947 |
font-style: italic;
|
948 |
color: grey;
|
949 |
}
|
950 |
+
.edd-cart-meta.edd_subtotal {
|
951 |
font-weight: bold;
|
|
|
952 |
font-style: italic;
|
953 |
}
|
954 |
+
.edd-cart-meta.edd_cart_tax {
|
955 |
+
font-size: 1em;
|
956 |
font-style: italic;
|
957 |
}
|
958 |
+
|
959 |
+
/** Since this is a LI, make sure to not italicize any list item images */
|
960 |
+
.edd-cart-meta.edd_cart_tax::before {
|
961 |
+
font-style: normal;
|
962 |
+
}
|
963 |
+
|
964 |
+
.edd-cart-meta.edd_total {
|
965 |
+
font-weight: bold;
|
966 |
+
}
|
967 |
+
.edd-cart-meta {
|
968 |
+
padding: 2px 5px;
|
969 |
+
}
|
970 |
+
.edd-cart-meta.edd_subtotal,
|
971 |
+
.edd-cart-meta.edd_total {
|
972 |
+
background-color: #f9f9f9;
|
973 |
+
}
|
974 |
+
|
975 |
+
/** Old Error Styles */
|
976 |
/* =Error styles
|
977 |
-------------------------------------------------------------- */
|
978 |
|
979 |
+
.edd_errors:not(.edd-alert) {
|
980 |
-webkit-border-radius: 2px;
|
981 |
-moz-border-radius: 2px;
|
982 |
border-radius: 2px;
|
994 |
/* =Success Message styles
|
995 |
-------------------------------------------------------------- */
|
996 |
|
997 |
+
.edd_success:not(.edd-alert) {
|
998 |
-webkit-border-radius: 2px;
|
999 |
-moz-border-radius: 2px;
|
1000 |
border-radius: 2px;
|
1004 |
color: #567622;
|
1005 |
padding: 6px 8px;
|
1006 |
box-shadow: inset 0 1px 0 rgba(255, 255, 255, 0.7);
|
1007 |
+
}
|
1008 |
+
/** End old Error */
|
1009 |
+
|
1010 |
+
/** Usage Is as Follows */
|
1011 |
+
/* <div class="edd-alert edd-alert-error">This is your error message</div> */
|
1012 |
+
/* Replace edd-error with the class of your choice */
|
1013 |
+
|
1014 |
+
/* Alert Styles */
|
1015 |
+
.edd-alert {
|
1016 |
+
-webkit-border-radius: 2px;
|
1017 |
+
-moz-border-radius: 2px;
|
1018 |
+
border-radius: 2px;
|
1019 |
+
margin-bottom: 20px;
|
1020 |
+
padding: 10px;
|
1021 |
+
border: 1px solid transparent;
|
1022 |
+
vertical-align: middle;
|
1023 |
+
}
|
1024 |
+
|
1025 |
+
.edd-alert p {
|
1026 |
+
padding: 0;
|
1027 |
+
}
|
1028 |
+
|
1029 |
+
.edd-alert p:not(:last-child) {
|
1030 |
+
margin-bottom: 5px;
|
1031 |
+
}
|
1032 |
+
|
1033 |
+
.edd-alert p:last-child {
|
1034 |
+
margin-bottom: 0;
|
1035 |
+
}
|
1036 |
+
|
1037 |
+
.edd-alert-error {
|
1038 |
+
color: #a94442;
|
1039 |
+
background-color: #f2dede;
|
1040 |
+
border-color: #ebccd1;
|
1041 |
+
}
|
1042 |
+
|
1043 |
+
.edd-alert-success {
|
1044 |
+
background-color: #dff0d8;
|
1045 |
+
border-color: #d6e9c6;
|
1046 |
+
color:#3c763d;
|
1047 |
+
}
|
1048 |
+
|
1049 |
+
.edd-alert-info {
|
1050 |
+
color: #31708f;
|
1051 |
+
background-color: #d9edf7;
|
1052 |
+
border-color: #bce8f1;
|
1053 |
+
}
|
1054 |
+
|
1055 |
+
.edd-alert-warn {
|
1056 |
+
color: #8a6d3b;
|
1057 |
+
background-color: #fcf8e3;
|
1058 |
+
border-color: #faebcc;
|
1059 |
+
}
|
templates/edd.min.css
CHANGED
@@ -1 +1 @@
|
|
1 |
-
@charset "UTF-8";@font-face{font-family:EDD-Icons;src:url(fonts/EDD-Icons.eot);src:url(fonts/EDD-Icons.eot?#iefix) format('embedded-opentype'),url(fonts/EDD-Icons.woff) format('woff'),url(fonts/EDD-Icons.ttf) format('truetype'),url(fonts/EDD-Icons.svg#EDD-Icons) format('svg');font-weight:400;font-style:normal}[class*=edd-icon-],[class*=" edd-icon-"]{font-family:EDD-Icons;speak:none;font-style:normal;font-weight:400;font-variant:normal;text-transform:none;width:auto;height:auto;line-height:1;-webkit-font-smoothing:antialiased}[class*=edd-icon-]:before,[class*=" edd-icon-"]:before{text-decoration:inherit;display:inline-block;cursor:default;speak:none}.edd-icon-spinner:before{content:"\71"}.edd-icon-ok:before{content:"\77"}.edd-icon-remove:before{content:"\65"}.edd-icon-remove-circle:before{content:"\72"}.edd-icon-ok-circle:before{content:"\74"}.edd-icon-spin{display:inline-block;-moz-animation:edd-icon-spin 2s infinite linear;-o-animation:edd-icon-spin 2s infinite linear;-webkit-animation:edd-icon-spin 2s infinite linear;animation:edd-icon- spin 2s infinite linear}@-moz-keyframes edd-icon-spin{0%{-moz-transform:rotate(0deg)}100%{-moz-transform:rotate(359deg)}}@-webkit-keyframes edd-icon-spin{0%{-webkit-transform:rotate(0deg)}100%{-webkit-transform:rotate(359deg)}}@-o-keyframes edd-icon-spin{0%{-o-transform:rotate(0deg)}100%{-o-transform:rotate(359deg)}}@-ms-keyframes edd-icon-spin{0%{-ms-transform:rotate(0deg)}100%{-ms-transform:rotate(359deg)}}@keyframes edd-icon-spin{0%{transform:rotate(0deg)}100%{transform:rotate(359deg)}}.edd_clearfix:after{display:block;visibility:hidden;float:none;clear:both;text-indent:-9999px;content:"."}#edd_checkout_cart{text-align:left;width:100%;border:none;margin:0 0 21px;table-layout:auto}#edd_checkout_cart td,#edd_checkout_cart th{text-align:left;border:1px solid #eee;color:#666;padding:.5em 1.387em}#edd_checkout_cart .edd_cart_header_row th{background:#fafafa;padding:1.387em}#edd_checkout_cart .edd_cart_discount_row th,#edd_checkout_cart .edd_cart_tax_row th{background:0 0}#edd_checkout_cart th{font-weight:700}#edd_checkout_cart td{line-height:25px;vertical-align:middle;background:#fff}#edd_checkout_cart td.edd_cart_actions,#edd_checkout_cart td:last-child,#edd_checkout_cart th.edd_cart_actions,#edd_checkout_cart th.edd_cart_total,#edd_checkout_cart th:last-child{text-align:right}#edd_checkout_cart td img{float:left;margin:0 8px 0 0;background:0 0;padding:0;border:none}#edd_checkout_cart input.edd-item-quantity{width:3em;padding:2px}#edd_checkout_cart .edd_discount{display:inline-block;margin-left:5px}.edd_discount_remove{display:inline-block;width:10px;height:11px;background:url(images/xit.gif) no-repeat;position:relative;top:3px}.edd_discount_remove:hover{background-position:-10px 0}#edd_checkout_cart br{display:none}#edd_checkout_cart a.edd-cart-saving-button{font-weight:400;text-decoration:none}#edd_checkout_form_wrap legend{display:block;font-size:120%;line-height:1;font-weight:700;width:100%;margin:0 0 21px;padding:0}#edd_checkout_form_wrap label{font-weight:700;display:block;position:relative;line-height:100%;font-size:95%;margin:0 0 5px}#edd_checkout_form_wrap label:after{display:block;visibility:hidden;float:none;clear:both;height:0;text-indent:-9999px;content:"."}#edd_checkout_form_wrap span.edd-description{color:#666;font-size:80%;display:block;margin:0 0 5px}#edd_checkout_form_wrap input.edd-input,#edd_checkout_form_wrap textarea.edd-input{display:inline-block;width:70%}#edd_checkout_form_wrap select.edd-select{display:block;width:60%}#edd_checkout_form_wrap select.edd-select.edd-select-small{display:inline;width:auto}#edd_checkout_form_wrap input.edd-input.error,#edd_checkout_form_wrap textarea.edd-input.error{border-color:#c4554e}#edd_checkout_form_wrap #edd_tax_opt_in_fields label,#edd_checkout_form_wrap #edd_terms_agreement label{display:inline-block;width:auto}#edd_checkout_form_wrap p{margin:0 0 21px}#edd_checkout_form_wrap span.edd-required-indicator{color:#b94a48;display:inline}#edd_checkout_form_wrap input[type=text],#edd_checkout_form_wrap input[type=email],#edd_checkout_form_wrap input[type=password],#edd_checkout_form_wrap textarea{padding:4px 6px}#edd_checkout_form_wrap input[type=radio]{border:none;margin-right:5px}#edd_checkout_form_wrap input[type=checkbox]{float:left;margin:0 8px 0 0}#edd_checkout_form_wrap .edd-payment-icons{height:32px;display:block;margin:0 0 8px}#edd_checkout_form_wrap .edd-payment-icons img.payment-icon{max-height:32px;width:auto;margin:0 3px 0 0;float:left;background:0 0;padding:0;border:none;-webkit-box-shadow:none;-moz-box-shadow:none;box-shadow:none}#edd_checkout_form_wrap #edd-payment-mode-wrap label{display:inline-block;margin:0 20px 0 0}#edd_checkout_form_wrap #edd-payment-mode-wrap .edd-payment-mode-label{font-weight:700;display:inline-block;position:relative;margin-bottom:5px}#edd_checkout_form_wrap fieldset{border:1px solid #eee;padding:1.387em;margin:0 0 21px}#edd_checkout_form_wrap #edd_discount_code,#edd_checkout_form_wrap #edd_purchase_submit,#edd_checkout_form_wrap #edd_register_account_fields{padding:0;border:none}#edd_checkout_form_wrap fieldset fieldset{margin:0;border:none;padding:0}#edd_checkout_form_wrap #edd-login-account-wrap,#edd_checkout_form_wrap #edd-new-account-wrap,#edd_checkout_form_wrap #edd_final_total_wrap,#edd_checkout_form_wrap #edd_show_discount,#edd_checkout_form_wrap .edd-cart-adjustment{background:#fafafa;color:#666;padding:.5em 1.387em}#edd_checkout_form_wrap #edd-discount-code-wrap,#edd_checkout_form_wrap #edd_final_total_wrap,#edd_checkout_form_wrap #edd_show_discount{border:1px solid #eee}#edd_checkout_form_wrap .edd-cart-adjustment{padding:1.387em}#edd_checkout_form_wrap .edd-cart-adjustment input.edd-input,#edd_checkout_form_wrap .edd-cart-adjustment input.edd-submit{display:inline-block}#edd_checkout_form_wrap .edd-cart-adjustment input.edd-submit{padding:3px 12px;margin-bottom:2px}#edd_checkout_form_wrap #edd-discount-error-wrap{width:100%;display:inline-block;margin:1em 0 0}#edd_checkout_form_wrap #edd-login-account-wrap,#edd_checkout_form_wrap #edd-new-account-wrap{margin:-1.387em -1.387em 21px;border-left:none;border-right:none;border-top:none}#edd_checkout_form_wrap #edd_payment_mode_select,#edd_checkout_form_wrap fieldset#edd_register_fields #edd_checkout_user_info{margin-bottom:21px}#edd_checkout_form_wrap fieldset#edd_register_account_fields legend{padding-top:11px}#edd_checkout_form_wrap fieldset#edd_register_account_fields p.edd_login_password,#edd_checkout_form_wrap fieldset#edd_register_account_fields p.edd_register_password{margin:0}#edd_checkout_form_wrap fieldset#edd_cc_fields{border:1px solid #f0f0f0;background:#f9f9f9;position:relative}#edd_checkout_form_wrap fieldset#edd_cc_fields legend{border:none;padding:0}#edd_checkout_form_wrap fieldset p:last-child{margin-bottom:0}#edd_checkout_form_wrap fieldset#edd_cc_fields #edd-card-number-wrap{margin-top:5px}#edd_checkout_form_wrap #edd_purchase_final_total{margin:21px 0}#edd_checkout_form_wrap #edd_purchase_final_total p{margin:0}#edd_secure_site_wrapper{padding:4px 4px 4px 0;font-weight:700}#edd_secure_site_wrapper span.padlock:before{content:'\f160';display:inline-block;-webkit-font-smoothing:antialiased;font:400 20px/1 dashicons;vertical-align:top}#edd_checkout_form_wrap input.edd-input.card-number.valid{background-image:url(images/tick.png);background-repeat:no-repeat;background-position:98% 50%}#edd_checkout_form_wrap span.exp-divider{display:inline}#edd_checkout_form_wrap span.card-type{position:absolute;top:-2px;right:0;width:43px;height:32px;background-size:43px 32px!important}#edd_checkout_form_wrap span.card-type.off{display:none}#edd_checkout_form_wrap span.card-type.visa{background:url(images/icons/visa.gif) no-repeat}#edd_checkout_form_wrap span.card-type.mastercard{background:url(images/icons/mastercard.gif) no-repeat}#edd_checkout_form_wrap span.card-type.discover{background:url(images/icons/discover.gif) no-repeat}#edd_checkout_form_wrap span.card-type.amex{background:url(images/icons/americanexpress.gif) no-repeat}#edd_checkeout_form_wrap .edd-cart-ajax,#edd_checkout_form_wrap #edd-discount-loader{-webkit-box-shadow:none;-moz-box-shadow:none;box-shadow:none}.edd_purchase_submit_wrapper{position:relative}.edd_purchase_submit_wrapper a.edd-add-to-cart{text-decoration:none;display:none;position:relative;overflow:hidden}.edd_purchase_submit_wrapper a.edd-add-to-cart.edd-has-js{display:inline-block}.edd_purchase_submit_wrapper .edd-cart-ajax{display:none;position:relative;left:-35px}.edd-submit.button.edd-ajax-loading{padding-right:30px}.edd-add-to-cart .edd-add-to-cart-label{opacity:1;filter:alpha(opacity=100)}a.edd-add-to-cart .edd-loading{position:absolute;left:50%;top:50%;opacity:0;filter:alpha(opacity=0)}a.edd-add-to-cart .edd-add-to-cart-label,a.edd-add-to-cart .edd-loading{-webkit-transition:.1s opacity!important;-moz-transition:.1s opacity!important;-ms-transition:.1s opacity!important;-o-transition:.1s opacity!important;transition:.1s opacity!important}.edd-add-to-cart[data-edd-loading] .edd-add-to-cart-label{opacity:0;filter:alpha(opacity=0)}.edd-add-to-cart[data-edd-loading] .edd-loading{opacity:1;filter:alpha(opacity=100)}.edd-cart-added-alert{color:#567622;display:block;position:absolute}.edd_form input.edd-input.required,.edd_form select.edd-select.required{color:#000}body.edd_receipt_page{background-color:#fff;color:#141412;margin:0;font-family:Helvetica,sans-serif;font-size:12px}body.edd_receipt_page:before{position:relative}body.edd_receipt_page #edd_receipt_wrapper{width:660px;margin:0 auto;padding:50px 0}body.edd_receipt_page table{display:table;width:100%;border-bottom:1px solid #ededed;border-collapse:collapse;border-spacing:0;font-size:14px;line-height:2;margin:0 0 20px}body.edd_receipt_page td,body.edd_receipt_page th{display:table-cell;text-align:left;border-top:1px solid #ededed;padding:6px 10px;font-weight:400}body.edd_receipt_page th{font-weight:700;text-transform:uppercase}body.edd_receipt_page h3{font-size:22px;margin:40px 0 5px;clear:both;display:block;font-weight:700}body.edd_receipt_page li{list-style:none}table#edd_purchase_receipt,table#edd_purchase_receipt_products{width:100%}table#edd_purchase_receipt td,table#edd_purchase_receipt th,table#edd_purchase_receipt_products td,table#edd_purchase_receipt_products th{text-align:left}table#edd_purchase_receipt .edd_receipt_payment_status.cancelled,table#edd_purchase_receipt .edd_receipt_payment_status.failed,table#edd_purchase_receipt .edd_receipt_payment_status.pending,table#edd_purchase_receipt .edd_receipt_payment_status.revoked{color:#f73f2e}table#edd_purchase_receipt_products li{list-style:none;margin:0 0 8px 10px}table#edd_purchase_receipt ul,table#edd_purchase_receipt_products ul.edd_purchase_receipt_files{margin:0;padding:0}table#edd_purchase_receipt li.edd_download_file{list-style:none;margin:0 0 8px}table#edd_purchase_receipt_products .edd_purchase_receipt_product_notes{font-style:italic}table#edd_purchase_receipt_products .edd_purchase_receipt_product_name{font-weight:700}table#edd_purchase_receipt_products .edd_bundled_product_name{font-style:italic;font-weight:700}#edd_user_history{text-align:left;width:100%;border-top:1px solid #f0f0f0;border-bottom:none}#edd_user_history td,#edd_user_history th{text-align:left;padding:3px 5px;border-bottom:1px solid #f0f0f0;border-top:none}#edd_user_history th{font-weight:700;background:#f5f5f5}#edd_user_history td{line-height:25px;vertical-align:middle}#edd_user_history .edd_purchase_status.cancelled,#edd_user_history .edd_purchase_status.failed,#edd_user_history .edd_purchase_status.pending,#edd_user_history .edd_purchase_status.revoked{color:#f73f2e}#edd_login_form .edd-input,#edd_login_form label,#edd_register_form .edd-input,#edd_register_form label{display:inline-block;width:200px}#edd_profile_editor_form p{margin-bottom:8px}#edd_profile_editor_form label{display:inline-block;width:200px}.edd_added_to_cart_alert{padding:5px;font-size:14px;border:1px solid #046a9e;background:#9ecce2;color:#333;margin:8px 0}.edd_added_to_cart_alert a.edd_alert_checkout_link{color:#000!important}input.edd_submit_plain{background:0 0!important;border:none!important;padding:0!important;display:inline;cursor:pointer}.single-download .edd_download_purchase_form{margin-bottom:1.387em}.edd_download_purchase_form .edd_download_quantity_wrapper{margin:0 0 .5em}.edd_download_purchase_form .edd_download_quantity_wrapper .edd-item-quantity{width:75px}.edd_download_purchase_form .edd_price_options{margin:0 0 15px}.edd_download_purchase_form .edd_price_options ul{margin:0;padding:0;list-style:none}.edd_download_purchase_form .edd_price_options li{display:block;padding:0;margin:0}.edd_download_purchase_form .edd_price_options span{display:inline;padding:0;margin:0}.edd_download_purchase_form .edd_price_options .edd_download_quantity_wrapper{padding-left:18px}.edd_download_purchase_form .edd_price_options .edd_download_quantity_wrapper *{font-size:80%}.edd_download_purchase_form .edd_price_options input.edd-item-quantity{display:inline;width:50px;max-width:90%}#edd-purchase-button,.edd-submit,input[type=submit].edd-submit{display:inline-block;padding:6px 12px;margin:0;font-size:14px;font-weight:400;line-height:1.428571429;text-align:center;white-space:nowrap;vertical-align:middle;cursor:pointer;border:1px solid #ccc;border-radius:4px;-webkit-box-shadow:none;-moz-box-shadow:none;box-shadow:none;-webkit-user-select:none;-moz-user-select:none;-ms-user-select:none;-o-user-select:none;user-select:none}.edd-submit.button:focus,input[type=submit].edd-submit:focus{outline:#333 dotted thin;outline:-webkit-focus-ring-color auto 5px;outline-offset:-2px}.edd-submit.button:focus,.edd-submit.button:hover,input[type=submit].edd-submit:focus,input[type=submit].edd-submit:hover{color:#333;text-decoration:none}.edd-submit.button:active{background-image:none;outline:0;-webkit-box-shadow:inset 0 3px 5px rgba(0,0,0,.125);box-shadow:inset 0 3px 5px rgba(0,0,0,.125)}.edd-submit.plain{padding:0}.edd-submit.button,.edd-submit.button.gray,.edd-submit.button:visited{color:#333;background:#f0f0f0;border-color:#ccc}.edd-submit.button.gray:active,.edd-submit.button.gray:focus,.edd-submit.button.gray:hover,.edd-submit.button:active,.edd-submit.button:focus,.edd-submit.button:hover{color:#333;background:#ebebeb;border-color:#adadad}.edd-submit.button.gray:active{background-image:none}.edd-submit.button.white{color:#333;background:#fff;border-color:#ccc}.edd-submit.button.white:active,.edd-submit.button.white:focus,.edd-submit.button.white:hover{color:#333;background:#ebebeb;border-color:#adadad}.edd-submit.button.white:active{background-image:none}.edd-submit.button.blue{color:#fff;background:#428bca;border-color:#357ebd}.edd-submit.button.blue.active,.edd-submit.button.blue:focus,.edd-submit.button.blue:hover{color:#fff;background:#3276b1;border-color:#285e8e}.edd-submit.button.blue.active{background-image:none}.edd-submit.button.red{color:#fff;background:#d9534f;border-color:#d43f3a}.edd-submit.button.red:active,.edd-submit.button.red:focus,.edd-submit.button.red:hover{color:#fff;background:#d2322d;border-color:#ac2925}.edd-submit.button.red:active{background-image:none}.edd-submit.button.green{color:#fff;background:#5cb85c;border-color:#4cae4c}.edd-submit.button.green:active,.edd-submit.button.green:focus,.edd-submit.button.green:hover{color:#fff;background:#47a447;border-color:#398439}.edd-submit.button.green:active{background-image:none}.edd-submit.button.yellow{color:#fff;background:#f0ad4e;border-color:#eea236}.edd-submit.button.yellow:active,.edd-submit.button.yellow:focus,.edd-submit.button.yellow:hover{color:#fff;background:#ed9c28;border-color:#d58512}.edd-submit.button.yellow:active{background-image:none}.edd-submit.button.orange{color:#fff;background:#ed9c28;border-color:#e3921e}.edd-submit.button.orange:active,.edd-submit.button.orange:focus,.edd-submit.button.orange:hover{color:#fff;background:#e59016;border-color:#d58512}.edd-submit.button.orange:active{background-image:none}.edd-submit.button.dark-gray{color:#fff;background:#363636;border-color:#222}.edd-submit.button.dark-gray:active,.edd-submit.button.dark-gray:focus,.edd-submit.button.dark-gray:hover{color:#fff;background:#333;border-color:#adadad}.edd-submit.button.dark-gray:active{background-image:none}.edd_download_inner{padding:0 8px 8px;margin:0 0 10px}.edd_download_image{max-width:100%}.edd_download .edd_price{margin-bottom:10px}.edd-cart-ajax{margin:0 8px 0 4px;position:relative;top:2px;background:0 0;border:none;padding:0}.edd-cart-number-of-items{font-style:italic;color:grey}.edd_subtotal{font-weight:700;margin:8px 0;font-style:italic}.edd_purchase_tax_rate{font-size:75%;font-style:italic}.edd_errors{-webkit-border-radius:2px;-moz-border-radius:2px;border-radius:2px;border:1px solid #E6DB55;margin:0 0 21px;background:#FFFFE0;color:#333}.edd_error{padding:10px}p.edd_error{margin:0!important}.edd_success{-webkit-border-radius:2px;-moz-border-radius:2px;border-radius:2px;border:1px solid #b3ce89;margin:20px 0;background:#d5eab3;color:#567622;padding:6px 8px;box-shadow:inset 0 1px 0 rgba(255,255,255,.7)}
|
1 |
+
@charset "UTF-8";@font-face{font-family:EDD-Icons;src:url(fonts/EDD-Icons.eot);src:url(fonts/EDD-Icons.eot?#iefix) format('embedded-opentype'),url(fonts/EDD-Icons.woff) format('woff'),url(fonts/EDD-Icons.ttf) format('truetype'),url(fonts/EDD-Icons.svg#EDD-Icons) format('svg');font-weight:400;font-style:normal}[class*=edd-icon-],[class*=" edd-icon-"]{font-family:EDD-Icons;speak:none;font-style:normal;font-weight:400;font-variant:normal;text-transform:none;width:auto;height:auto;line-height:1;-webkit-font-smoothing:antialiased}[class*=edd-icon-]:before,[class*=" edd-icon-"]:before{text-decoration:inherit;display:inline-block;cursor:default;speak:none}.edd-icon-spinner:before{content:"\71"}.edd-icon-ok:before{content:"\77"}.edd-icon-remove:before{content:"\65"}.edd-icon-remove-circle:before{content:"\72"}.edd-icon-ok-circle:before{content:"\74"}.edd-icon-spin{display:inline-block;-moz-animation:edd-icon-spin 2s infinite linear;-o-animation:edd-icon-spin 2s infinite linear;-webkit-animation:edd-icon-spin 2s infinite linear;animation:edd-icon- spin 2s infinite linear}@-moz-keyframes edd-icon-spin{0%{-moz-transform:rotate(0deg)}100%{-moz-transform:rotate(359deg)}}@-webkit-keyframes edd-icon-spin{0%{-webkit-transform:rotate(0deg)}100%{-webkit-transform:rotate(359deg)}}@-o-keyframes edd-icon-spin{0%{-o-transform:rotate(0deg)}100%{-o-transform:rotate(359deg)}}@-ms-keyframes edd-icon-spin{0%{-ms-transform:rotate(0deg)}100%{-ms-transform:rotate(359deg)}}@keyframes edd-icon-spin{0%{transform:rotate(0deg)}100%{transform:rotate(359deg)}}.edd_clearfix:after{display:block;visibility:hidden;float:none;clear:both;text-indent:-9999px;content:"."}#edd_checkout_cart{text-align:left;width:100%;border:none;margin:0 0 21px;table-layout:auto}#edd_checkout_cart td,#edd_checkout_cart th{text-align:left;border:1px solid #eee;color:#666;padding:.5em 1.387em}#edd_checkout_cart .edd_cart_header_row th{background:#fafafa;padding:1.387em}#edd_checkout_cart .edd_cart_discount_row th,#edd_checkout_cart .edd_cart_tax_row th{background:0 0}#edd_checkout_cart th{font-weight:700}#edd_checkout_cart td{line-height:25px;vertical-align:middle;background:#fff}#edd_checkout_cart td.edd_cart_actions,#edd_checkout_cart td:last-child,#edd_checkout_cart th.edd_cart_actions,#edd_checkout_cart th.edd_cart_total,#edd_checkout_cart th:last-child{text-align:right}#edd_checkout_cart td img{float:left;margin:0 8px 0 0;background:0 0;padding:0;border:none}#edd_checkout_cart input.edd-item-quantity{width:3em;padding:2px}#edd_checkout_cart .edd_discount{display:inline-block;margin-left:5px}.edd_discount_remove{display:inline-block;width:10px;height:11px;background:url(images/xit.gif) no-repeat;position:relative;top:3px}.edd_discount_remove:hover{background-position:-10px 0}#edd_checkout_cart br{display:none}#edd_checkout_cart a.edd-cart-saving-button{font-weight:400;text-decoration:none}#edd_checkout_form_wrap legend{display:block;font-size:120%;line-height:1;font-weight:700;width:100%;margin:0 0 21px;padding:0}#edd_checkout_form_wrap label{font-weight:700;display:block;position:relative;line-height:100%;font-size:95%;margin:0 0 5px}#edd_checkout_form_wrap label:after{display:block;visibility:hidden;float:none;clear:both;height:0;text-indent:-9999px;content:"."}#edd_checkout_form_wrap span.edd-description{color:#666;font-size:80%;display:block;margin:0 0 5px}#edd_checkout_form_wrap input.edd-input,#edd_checkout_form_wrap textarea.edd-input{display:inline-block;width:70%}#edd_checkout_form_wrap select.edd-select{display:block;width:60%}#edd_checkout_form_wrap select.edd-select.edd-select-small{display:inline;width:auto}#edd_checkout_form_wrap input.edd-input.error,#edd_checkout_form_wrap textarea.edd-input.error{border-color:#c4554e}#edd_checkout_form_wrap #edd_tax_opt_in_fields label,#edd_checkout_form_wrap #edd_terms_agreement label{display:inline-block;width:auto}#edd_checkout_form_wrap>p{margin:0 0 21px}#edd_checkout_form_wrap span.edd-required-indicator{color:#b94a48;display:inline}#edd_checkout_form_wrap input[type=text],#edd_checkout_form_wrap input[type=email],#edd_checkout_form_wrap input[type=password],#edd_checkout_form_wrap textarea{padding:4px 6px}#edd_checkout_form_wrap input[type=radio]{border:none;margin-right:5px}#edd_checkout_form_wrap input[type=checkbox]{float:left;margin:0 8px 0 0}#edd_checkout_form_wrap .edd-payment-icons{height:32px;display:block;margin:0 0 8px}#edd_checkout_form_wrap .edd-payment-icons img.payment-icon{max-height:32px;width:auto;margin:0 3px 0 0;float:left;background:0 0;padding:0;border:none;-webkit-box-shadow:none;-moz-box-shadow:none;box-shadow:none}#edd_checkout_form_wrap #edd-payment-mode-wrap label{display:inline-block;margin:0 20px 0 0}#edd_checkout_form_wrap #edd-payment-mode-wrap .edd-payment-mode-label{font-weight:700;display:inline-block;position:relative;margin-bottom:5px}#edd_checkout_form_wrap fieldset{border:1px solid #eee;padding:1.387em;margin:0 0 21px}#edd_checkout_form_wrap #edd_discount_code,#edd_checkout_form_wrap #edd_purchase_submit,#edd_checkout_form_wrap #edd_register_account_fields{padding:0;border:none}#edd_checkout_form_wrap fieldset fieldset{margin:0;border:none;padding:0}#edd_checkout_form_wrap #edd-login-account-wrap,#edd_checkout_form_wrap #edd-new-account-wrap,#edd_checkout_form_wrap #edd_final_total_wrap,#edd_checkout_form_wrap #edd_show_discount,#edd_checkout_form_wrap .edd-cart-adjustment{background:#fafafa;color:#666;padding:.5em 1.387em}#edd_checkout_form_wrap #edd-discount-code-wrap,#edd_checkout_form_wrap #edd_final_total_wrap,#edd_checkout_form_wrap #edd_show_discount{border:1px solid #eee}#edd_checkout_form_wrap .edd-cart-adjustment{padding:1.387em}#edd_checkout_form_wrap .edd-cart-adjustment input.edd-input,#edd_checkout_form_wrap .edd-cart-adjustment input.edd-submit{display:inline-block}#edd_checkout_form_wrap .edd-cart-adjustment input.edd-submit{padding:3px 12px;margin-bottom:2px}#edd_checkout_form_wrap #edd-discount-error-wrap{width:100%;display:inline-block;margin:1em 0 0}#edd_checkout_form_wrap #edd-login-account-wrap,#edd_checkout_form_wrap #edd-new-account-wrap{margin:-1.387em -1.387em 21px;border-left:none;border-right:none;border-top:none}#edd_checkout_form_wrap #edd_payment_mode_select,#edd_checkout_form_wrap fieldset#edd_register_fields #edd_checkout_user_info{margin-bottom:21px}#edd_checkout_form_wrap fieldset#edd_register_account_fields legend{padding-top:11px}#edd_checkout_form_wrap fieldset#edd_register_account_fields p.edd_login_password,#edd_checkout_form_wrap fieldset#edd_register_account_fields p.edd_register_password{margin:0}#edd_checkout_form_wrap fieldset#edd_cc_fields{border:1px solid #f0f0f0;background:#f9f9f9;position:relative}#edd_checkout_form_wrap fieldset#edd_cc_fields legend{border:none;padding:0}#edd_checkout_form_wrap fieldset p:last-child{margin-bottom:0}#edd_checkout_form_wrap fieldset#edd_cc_fields #edd-card-number-wrap{margin-top:5px}#edd_checkout_form_wrap #edd_purchase_final_total{margin:21px 0}#edd_checkout_form_wrap #edd_purchase_final_total p{margin:0}#edd_secure_site_wrapper{padding:4px 4px 4px 0;font-weight:700}#edd_secure_site_wrapper span.padlock:before{content:'\f160';display:inline-block;-webkit-font-smoothing:antialiased;font:400 20px/1 dashicons;vertical-align:top}#edd_checkout_form_wrap input.edd-input.card-number.valid{background-image:url(images/tick.png);background-repeat:no-repeat;background-position:98% 50%}#edd_checkout_form_wrap span.exp-divider{display:inline}#edd_checkout_form_wrap span.card-type{position:absolute;top:-2px;right:0;width:43px;height:32px;background-size:43px 32px!important}#edd_checkout_form_wrap span.card-type.off{display:none}#edd_checkout_form_wrap span.card-type.visa{background:url(images/icons/visa.gif) no-repeat}#edd_checkout_form_wrap span.card-type.mastercard{background:url(images/icons/mastercard.gif) no-repeat}#edd_checkout_form_wrap span.card-type.discover{background:url(images/icons/discover.gif) no-repeat}#edd_checkout_form_wrap span.card-type.amex{background:url(images/icons/americanexpress.gif) no-repeat}#edd_checkeout_form_wrap .edd-cart-ajax,#edd_checkout_form_wrap #edd-discount-loader{-webkit-box-shadow:none;-moz-box-shadow:none;box-shadow:none}.edd-amazon-profile-wrapper{font-size:12px}.edd-amazon-profile-name{font-weight:600}.edd-amazon-logout{font-size:10px;line-height:12px}.edd-amazon-logout a{cursor:pointer}#edd-amazon-address-box{height:228px;width:350px;margin-bottom:15px}#edd-amazon-wallet-box{height:228px;width:350px}@media only screen and (min-width:768px){#edd-amazon-address-box,#edd-amazon-wallet-box{width:100%;height:228px}}.edd_purchase_submit_wrapper{position:relative}.edd_purchase_submit_wrapper a.edd-add-to-cart{text-decoration:none;display:none;position:relative;overflow:hidden}.edd_purchase_submit_wrapper a.edd-add-to-cart.edd-has-js{display:inline-block}.edd_purchase_submit_wrapper .edd-cart-ajax{display:none;position:relative;left:-35px}.edd-submit.button.edd-ajax-loading{padding-right:30px}.edd-add-to-cart .edd-add-to-cart-label{opacity:1;filter:alpha(opacity=100)}a.edd-add-to-cart .edd-loading{position:absolute;left:50%;top:50%;opacity:0;filter:alpha(opacity=0)}a.edd-add-to-cart .edd-add-to-cart-label,a.edd-add-to-cart .edd-loading{-webkit-transition:.1s opacity!important;-moz-transition:.1s opacity!important;-ms-transition:.1s opacity!important;-o-transition:.1s opacity!important;transition:.1s opacity!important}.edd-add-to-cart[data-edd-loading] .edd-add-to-cart-label{opacity:0;filter:alpha(opacity=0)}.edd-add-to-cart[data-edd-loading] .edd-loading{opacity:1;filter:alpha(opacity=100)}.edd-cart-added-alert{color:#567622;display:block;position:absolute}.edd_form input.edd-input.required,.edd_form select.edd-select.required{color:#000}body.edd_receipt_page{background-color:#fff;color:#141412;margin:0;font-family:Helvetica,sans-serif;font-size:12px}body.edd_receipt_page:before{position:relative}body.edd_receipt_page #edd_receipt_wrapper{width:660px;margin:0 auto;padding:50px 0}body.edd_receipt_page table{display:table;width:100%;border-bottom:1px solid #ededed;border-collapse:collapse;border-spacing:0;font-size:14px;line-height:2;margin:0 0 20px}body.edd_receipt_page td,body.edd_receipt_page th{display:table-cell;text-align:left;border-top:1px solid #ededed;padding:6px 10px;font-weight:400}body.edd_receipt_page th{font-weight:700;text-transform:uppercase}body.edd_receipt_page h3{font-size:22px;margin:40px 0 5px;clear:both;display:block;font-weight:700}body.edd_receipt_page li{list-style:none}table#edd_purchase_receipt,table#edd_purchase_receipt_products{width:100%}table#edd_purchase_receipt td,table#edd_purchase_receipt th,table#edd_purchase_receipt_products td,table#edd_purchase_receipt_products th{text-align:left}table#edd_purchase_receipt .edd_receipt_payment_status.cancelled,table#edd_purchase_receipt .edd_receipt_payment_status.failed,table#edd_purchase_receipt .edd_receipt_payment_status.pending,table#edd_purchase_receipt .edd_receipt_payment_status.revoked{color:#f73f2e}table#edd_purchase_receipt_products li{list-style:none;margin:0 0 8px 10px}table#edd_purchase_receipt ul,table#edd_purchase_receipt_products ul.edd_purchase_receipt_files{margin:0;padding:0}table#edd_purchase_receipt li.edd_download_file{list-style:none;margin:0 0 8px}table#edd_purchase_receipt_products .edd_purchase_receipt_product_notes{font-style:italic}table#edd_purchase_receipt_products .edd_purchase_receipt_product_name{font-weight:700}table#edd_purchase_receipt_products .edd_bundled_product_name{font-style:italic;font-weight:700}#edd_user_history{text-align:left;width:100%;border-top:1px solid #f0f0f0;border-bottom:none}#edd_user_history td,#edd_user_history th{text-align:left;padding:3px 5px;border-bottom:1px solid #f0f0f0;border-top:none}#edd_user_history th{font-weight:700;background:#f5f5f5}#edd_user_history td{line-height:25px;vertical-align:middle}#edd_user_history .edd_purchase_status.cancelled,#edd_user_history .edd_purchase_status.failed,#edd_user_history .edd_purchase_status.pending,#edd_user_history .edd_purchase_status.revoked{color:#f73f2e}#edd_login_form .edd-input,#edd_login_form label,#edd_register_form .edd-input,#edd_register_form label{display:inline-block;width:200px}#edd_profile_editor_form p{margin-bottom:8px}#edd_profile_editor_form label{display:inline-block;width:200px}.edd_added_to_cart_alert{padding:5px;font-size:14px;border:1px solid #046a9e;background:#9ecce2;color:#333;margin:8px 0}.edd_added_to_cart_alert a.edd_alert_checkout_link{color:#000!important}input.edd_submit_plain{background:0 0!important;border:none!important;padding:0!important;display:inline;cursor:pointer}.single-download .edd_download_purchase_form{margin-bottom:1.387em}.edd_download_purchase_form .edd_download_quantity_wrapper{margin:0 0 .5em}.edd_download_purchase_form .edd_download_quantity_wrapper .edd-item-quantity{width:75px}.edd_download_purchase_form .edd_price_options{margin:0 0 15px}.edd_download_purchase_form .edd_price_options ul{margin:0;padding:0;list-style:none}.edd_download_purchase_form .edd_price_options li{display:block;padding:0;margin:0}.edd_download_purchase_form .edd_price_options span{display:inline;padding:0;margin:0}.edd_download_purchase_form .edd_price_options .edd_download_quantity_wrapper{padding-left:18px}.edd_download_purchase_form .edd_price_options .edd_download_quantity_wrapper *{font-size:80%}.edd_download_purchase_form .edd_price_options input.edd-item-quantity{display:inline;width:50px;max-width:90%}#edd-purchase-button,.edd-submit,input[type=submit].edd-submit{display:inline-block;padding:6px 12px;margin:0;font-size:14px;font-weight:400;line-height:1.428571429;text-align:center;white-space:nowrap;vertical-align:middle;cursor:pointer;border:1px solid #ccc;border-radius:4px;-webkit-box-shadow:none;-moz-box-shadow:none;box-shadow:none;-webkit-user-select:none;-moz-user-select:none;-ms-user-select:none;-o-user-select:none;user-select:none}.edd-submit.button:focus,input[type=submit].edd-submit:focus{outline:#333 dotted thin;outline:-webkit-focus-ring-color auto 5px;outline-offset:-2px}.edd-submit.button:focus,.edd-submit.button:hover,input[type=submit].edd-submit:focus,input[type=submit].edd-submit:hover{color:#333;text-decoration:none}.edd-submit.button:active{background-image:none;outline:0;-webkit-box-shadow:inset 0 3px 5px rgba(0,0,0,.125);box-shadow:inset 0 3px 5px rgba(0,0,0,.125)}.edd-submit.plain{padding:0}.edd-submit.button,.edd-submit.button.gray,.edd-submit.button:visited{color:#333;background:#f0f0f0;border-color:#ccc}.edd-submit.button.gray:active,.edd-submit.button.gray:focus,.edd-submit.button.gray:hover,.edd-submit.button:active,.edd-submit.button:focus,.edd-submit.button:hover{color:#333;background:#ebebeb;border-color:#adadad}.edd-submit.button.gray:active{background-image:none}.edd-submit.button.white{color:#333;background:#fff;border-color:#ccc}.edd-submit.button.white:active,.edd-submit.button.white:focus,.edd-submit.button.white:hover{color:#333;background:#ebebeb;border-color:#adadad}.edd-submit.button.white:active{background-image:none}.edd-submit.button.blue{color:#fff;background:#428bca;border-color:#357ebd}.edd-submit.button.blue.active,.edd-submit.button.blue:focus,.edd-submit.button.blue:hover{color:#fff;background:#3276b1;border-color:#285e8e}.edd-submit.button.blue.active{background-image:none}.edd-submit.button.red{color:#fff;background:#d9534f;border-color:#d43f3a}.edd-submit.button.red:active,.edd-submit.button.red:focus,.edd-submit.button.red:hover{color:#fff;background:#d2322d;border-color:#ac2925}.edd-submit.button.red:active{background-image:none}.edd-submit.button.green{color:#fff;background:#5cb85c;border-color:#4cae4c}.edd-submit.button.green:active,.edd-submit.button.green:focus,.edd-submit.button.green:hover{color:#fff;background:#47a447;border-color:#398439}.edd-submit.button.green:active{background-image:none}.edd-submit.button.yellow{color:#fff;background:#f0ad4e;border-color:#eea236}.edd-submit.button.yellow:active,.edd-submit.button.yellow:focus,.edd-submit.button.yellow:hover{color:#fff;background:#ed9c28;border-color:#d58512}.edd-submit.button.yellow:active{background-image:none}.edd-submit.button.orange{color:#fff;background:#ed9c28;border-color:#e3921e}.edd-submit.button.orange:active,.edd-submit.button.orange:focus,.edd-submit.button.orange:hover{color:#fff;background:#e59016;border-color:#d58512}.edd-submit.button.orange:active{background-image:none}.edd-submit.button.dark-gray{color:#fff;background:#363636;border-color:#222}.edd-submit.button.dark-gray:active,.edd-submit.button.dark-gray:focus,.edd-submit.button.dark-gray:hover{color:#fff;background:#333;border-color:#adadad}.edd-submit.button.dark-gray:active{background-image:none}.edd_download_inner{padding:0 8px 8px;margin:0 0 10px}.edd_download_image{max-width:100%}.edd_download .edd_price{margin-bottom:10px}.edd-cart-ajax{margin:0 8px 0 4px;position:relative;top:2px;background:0 0;border:none;padding:0}.edd-cart-number-of-items{font-style:italic;color:grey}.edd-cart-meta.edd_subtotal{font-weight:700;font-style:italic}.edd-cart-meta.edd_cart_tax{font-size:1em;font-style:italic}.edd-cart-meta.edd_cart_tax::before{font-style:normal}.edd-cart-meta.edd_total{font-weight:700}.edd-cart-meta{padding:2px 5px}.edd-cart-meta.edd_subtotal,.edd-cart-meta.edd_total{background-color:#f9f9f9}.edd_errors:not(.edd-alert){-webkit-border-radius:2px;-moz-border-radius:2px;border-radius:2px;border:1px solid #E6DB55;margin:0 0 21px;background:#FFFFE0;color:#333}.edd_error{padding:10px}p.edd_error{margin:0!important}.edd_success:not(.edd-alert){-webkit-border-radius:2px;-moz-border-radius:2px;border-radius:2px;border:1px solid #b3ce89;margin:20px 0;background:#d5eab3;color:#567622;padding:6px 8px;box-shadow:inset 0 1px 0 rgba(255,255,255,.7)}.edd-alert{-webkit-border-radius:2px;-moz-border-radius:2px;border-radius:2px;margin-bottom:20px;padding:10px;border:1px solid transparent;vertical-align:middle}.edd-alert p{padding:0}.edd-alert p:not(:last-child){margin-bottom:5px}.edd-alert p:last-child{margin-bottom:0}.edd-alert-error{color:#a94442;background-color:#f2dede;border-color:#ebccd1}.edd-alert-success{background-color:#dff0d8;border-color:#d6e9c6;color:#3c763d}.edd-alert-info{color:#31708f;background-color:#d9edf7;border-color:#bce8f1}.edd-alert-warn{color:#8a6d3b;background-color:#fcf8e3;border-color:#faebcc}
|
templates/images/icons/amazon.gif
ADDED
Binary file
|
templates/shortcode-profile-editor.php
CHANGED
@@ -13,11 +13,11 @@ if ( is_user_logged_in() ):
|
|
13 |
|
14 |
if ( edd_is_cart_saved() ): ?>
|
15 |
<?php $restore_url = add_query_arg( array( 'edd_action' => 'restore_cart', 'edd_cart_token' => edd_get_cart_token() ), edd_get_checkout_uri() ); ?>
|
16 |
-
<
|
17 |
<?php endif; ?>
|
18 |
|
19 |
<?php if ( isset( $_GET['updated'] ) && $_GET['updated'] == true && ! edd_get_errors() ): ?>
|
20 |
-
<
|
21 |
<?php endif; ?>
|
22 |
|
23 |
<?php edd_print_errors(); ?>
|
13 |
|
14 |
if ( edd_is_cart_saved() ): ?>
|
15 |
<?php $restore_url = add_query_arg( array( 'edd_action' => 'restore_cart', 'edd_cart_token' => edd_get_cart_token() ), edd_get_checkout_uri() ); ?>
|
16 |
+
<div class="edd_success edd-alert edd-alert-success"><strong><?php _e( 'Saved cart', 'edd'); ?>:</strong> <?php printf( __( 'You have a saved cart, <a href="%s">click here</a> to restore it.', 'edd' ), esc_url( $restore_url ) ); ?></div>
|
17 |
<?php endif; ?>
|
18 |
|
19 |
<?php if ( isset( $_GET['updated'] ) && $_GET['updated'] == true && ! edd_get_errors() ): ?>
|
20 |
+
<div class="edd_success edd-alert edd-alert-success"><strong><?php _e( 'Success', 'edd'); ?>:</strong> <?php _e( 'Your profile has been edited successfully.', 'edd' ); ?></=div>
|
21 |
<?php endif; ?>
|
22 |
|
23 |
<?php edd_print_errors(); ?>
|
templates/shortcode-receipt.php
CHANGED
@@ -8,8 +8,8 @@ $payment = get_post( $edd_receipt_args['id'] );
|
|
8 |
|
9 |
if( empty( $payment ) ) : ?>
|
10 |
|
11 |
-
<div class="edd_errors">
|
12 |
-
|
13 |
</div>
|
14 |
|
15 |
<?php
|
8 |
|
9 |
if( empty( $payment ) ) : ?>
|
10 |
|
11 |
+
<div class="edd_errors edd-alert edd-alert-error">
|
12 |
+
<?php _e( 'The specified receipt ID appears to be invalid', 'edd' ); ?>
|
13 |
</div>
|
14 |
|
15 |
<?php
|
templates/widget-cart-checkout.php
CHANGED
@@ -1,2 +1,6 @@
|
|
1 |
-
|
|
|
|
|
|
|
|
|
2 |
<li class="cart_item edd_checkout"><a href="<?php echo edd_get_checkout_uri(); ?>"><?php _e( 'Checkout', 'edd' ); ?></a></li>
|
1 |
+
<?php if ( edd_use_taxes() ) : ?>
|
2 |
+
<li class="cart_item edd-cart-meta edd_subtotal"><?php echo __( 'Subtotal:', 'edd' ). " <span class='subtotal'>" . edd_currency_filter( edd_format_amount( edd_get_cart_subtotal() ) ); ?></span></li>
|
3 |
+
<li class="cart_item edd-cart-meta edd_cart_tax"><?php _e( 'Estimated Tax:', 'edd' ); ?> <span class="cart-tax"><?php echo edd_currency_filter( edd_format_amount( edd_get_cart_tax() ) ); ?></span></li>
|
4 |
+
<?php endif; ?>
|
5 |
+
<li class="cart_item edd-cart-meta edd_total"><?php _e( 'Total:', 'edd' ); ?> <span class="cart-total"><?php echo edd_currency_filter( edd_format_amount( edd_get_cart_total() ) ); ?></span></li>
|
6 |
<li class="cart_item edd_checkout"><a href="<?php echo edd_get_checkout_uri(); ?>"><?php _e( 'Checkout', 'edd' ); ?></a></li>
|
templates/widget-cart-empty.php
CHANGED
@@ -1,3 +1,7 @@
|
|
1 |
<li class="cart_item empty"><?php echo edd_empty_cart_message(); ?></li>
|
2 |
-
|
|
|
|
|
|
|
|
|
3 |
<li class="cart_item edd_checkout" style="display:none;"><a href="<?php echo edd_get_checkout_uri(); ?>"><?php _e( 'Checkout', 'edd' ); ?></a></li>
|
1 |
<li class="cart_item empty"><?php echo edd_empty_cart_message(); ?></li>
|
2 |
+
<?php if ( edd_use_taxes() ) : ?>
|
3 |
+
<li class="cart_item edd-cart-meta edd_subtotal" style="display:none;"><?php echo __( 'Subtotal:', 'edd' ). " <span class='subtotal'>" . edd_currency_filter( edd_format_amount( edd_get_cart_subtotal() ) ); ?></span></li>
|
4 |
+
<li class="cart_item edd-cart-meta edd_cart_tax" style="display:none;"><?php _e( 'Estimated Tax:', 'edd' ); ?> <span class="cart-tax"><?php echo edd_currency_filter( edd_format_amount( edd_get_cart_tax() ) ); ?></span></li>
|
5 |
+
<?php endif; ?>
|
6 |
+
<li class="cart_item edd-cart-meta edd_total" style="display:none;"><?php _e( 'Total:', 'edd' ); ?> <span class="cart-total"><?php echo edd_currency_filter( edd_format_amount( edd_get_cart_total() ) ); ?></span></li>
|
7 |
<li class="cart_item edd_checkout" style="display:none;"><a href="<?php echo edd_get_checkout_uri(); ?>"><?php _e( 'Checkout', 'edd' ); ?></a></li>
|
templates/widget-cart.php
CHANGED
@@ -1,7 +1,7 @@
|
|
1 |
<?php
|
2 |
/**
|
3 |
* This template is used to display the Downloads cart widget.
|
4 |
-
*/
|
5 |
$cart_items = edd_get_cart_contents();
|
6 |
$cart_quantity = edd_get_cart_quantity();
|
7 |
$display = $cart_quantity > 0 ? '' : ' style="display:none;"';
|
1 |
<?php
|
2 |
/**
|
3 |
* This template is used to display the Downloads cart widget.
|
4 |
+
*/
|
5 |
$cart_items = edd_get_cart_contents();
|
6 |
$cart_quantity = edd_get_cart_quantity();
|
7 |
$display = $cart_quantity > 0 ? '' : ' style="display:none;"';
|