Easy Digital Downloads - Version 2.4.5

Version Description

Download this release

Release Info

Developer mordauk
Plugin Icon 128x128 Easy Digital Downloads
Version 2.4.5
Comparing to
See all releases

Code changes from version 2.4.3 to 2.4.5

assets/css/edd-admin.css CHANGED
@@ -233,8 +233,10 @@ td.edd_order_price { text-align: right; }
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; }
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: 15px; height: 15px; width: 95%; }
237
  .edd-export-form .edd-progress div { height: 100%; background: #ccc; width: 0; }
238
+ .edd-export-form .notice-wrap { background-color: #f4f4f4; padding: 12px 12px 4px; margin: 20px -12px -23px; border-style: solid; border-width: 1px 0; border-color: #eae9e9; overflow: auto; }
239
+ .edd-export-form .notice-wrap .spinner { margin: 4px 10px 8px; }
240
  .admin-color-fresh .edd-export-form .edd-progress div { background: #0073aa; }
241
  .admin-color-light .edd-export-form .edd-progress div { background: #888; }
242
  .admin-color-blue .edd-export-form .edd-progress div { background: #096484; }
assets/css/edd-admin.min.css CHANGED
@@ -1 +1 @@
1
- .edd-admin-box .label,.edd-admin-box-inside .strong{font-weight:600}.edd-mobile-link,.edd_repeatable_row td{vertical-align:middle}#customer-stats-wrapper a,#edd-customer-card-wrapper a.delete,.edd-wrap a{text-decoration:none}.edd-hidden{display:none}.edd-clearfix:after{display:block;visibility:hidden;content:".";text-indent:-9999px;height:0}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}.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}#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_repeatable_product_wrapper .edd-select,.edd_repeatable_upload_wrapper .pricing select{min-width:100%}#edd_product_notes_field{width:98%;margin:0;height:4em}.edd_repeatable_default_wrapper{text-align:center;width:25px}#edd-purchased-files ul li.remove,td.edd_order_price{text-align:right}.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-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-customer-details .actions,#edd-order-recalc-total{float:right}#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-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 .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-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%}@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;-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);border-radius:3px 3px 0 0}.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 .customer-id,.customer-info .customer-name{font-size:24px;font-weight:600}#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;overflow:auto}#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-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,#edd-customer-card-wrapper .edd_user_search_results ul{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{color:red;margin-right:5px}.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}#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 .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,.delete-customer{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}
1
+ .edd-admin-box .label,.edd-admin-box-inside .strong{font-weight:600}.edd-mobile-link,.edd_repeatable_row td{vertical-align:middle}#customer-stats-wrapper a,#edd-customer-card-wrapper a.delete,.edd-wrap a{text-decoration:none}.edd-hidden{display:none}.edd-clearfix:after{display:block;visibility:hidden;content:".";text-indent:-9999px;height:0}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}.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}#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_repeatable_product_wrapper .edd-select,.edd_repeatable_upload_wrapper .pricing select{min-width:100%}#edd_product_notes_field{width:98%;margin:0;height:4em}.edd_repeatable_default_wrapper{text-align:center;width:25px}#edd-purchased-files ul li.remove,td.edd_order_price{text-align:right}.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-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-customer-details .actions,#edd-order-recalc-total{float:right}#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-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 .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-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%}@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:15px;height:15px;width:95%}.edd-export-form .edd-progress div{height:100%;background:#ccc;width:0}.edd-export-form .notice-wrap{background-color:#f4f4f4;padding:12px 12px 4px;margin:20px -12px -23px;border-style:solid;border-width:1px 0;border-color:#eae9e9;overflow:auto}.edd-export-form .notice-wrap .spinner{margin:4px 10px 8px}.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;-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);border-radius:3px 3px 0 0}.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 .customer-id,.customer-info .customer-name{font-size:24px;font-weight:600}#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;overflow:auto}#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-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,#edd-customer-card-wrapper .edd_user_search_results ul{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{color:red;margin-right:5px}.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}#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 .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,.delete-customer{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}
assets/js/admin-scripts.js CHANGED
@@ -1236,7 +1236,8 @@ jQuery(document).ready(function ($) {
1236
  var data = $(this).serialize();
1237
 
1238
  submitButton.addClass( 'button-disabled' );
1239
- $(this).append( '<span class="spinner is-active"></span><div class="edd-progress"><div></div></div>' );
 
1240
 
1241
  // start the process
1242
  self.process_step( 1, data, self );
@@ -1259,18 +1260,27 @@ jQuery(document).ready(function ($) {
1259
  dataType: "json",
1260
  success: function( response ) {
1261
 
1262
- if( 'done' == response.step ) {
1263
 
1264
- var export_form = $('.edd-export-form');
 
 
1265
 
1266
- export_form.find('.spinner').remove();
1267
- export_form.find('.edd-progress').remove();
1268
  export_form.find('.button-disabled').removeClass('button-disabled');
1269
 
1270
- window.location = response.url;
1271
 
1272
- } else {
 
 
 
 
 
 
1273
 
 
 
 
1274
  $('.edd-progress div').animate({
1275
  width: response.percentage + '%',
1276
  }, 50, function() {
1236
  var data = $(this).serialize();
1237
 
1238
  submitButton.addClass( 'button-disabled' );
1239
+ $(this).find('.notice-wrap').remove();
1240
+ $(this).append( '<div class="notice-wrap"><span class="spinner is-active"></span><div class="edd-progress"><div></div></div></div>' );
1241
 
1242
  // start the process
1243
  self.process_step( 1, data, self );
1260
  dataType: "json",
1261
  success: function( response ) {
1262
 
1263
+ if( 'done' == response.step || response.error ) {
1264
 
1265
+ // We need to get the actual in progress form, not all forms on the page
1266
+ var export_form = $('.edd-export-form').find('.edd-progress').parent().parent();
1267
+ var notice_wrap = export_form.find('.notice-wrap');
1268
 
 
 
1269
  export_form.find('.button-disabled').removeClass('button-disabled');
1270
 
1271
+ if ( response.error ) {
1272
 
1273
+ var error_message = response.message;
1274
+ notice_wrap.html('<div class="update error"><p>' + error_message + '</p></div>');
1275
+
1276
+ } else {
1277
+
1278
+ notice_wrap.remove();
1279
+ window.location = response.url;
1280
 
1281
+ }
1282
+
1283
+ } else {
1284
  $('.edd-progress div').animate({
1285
  width: response.percentage + '%',
1286
  }, 50, function() {
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=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.find(".search-choice").remove(),clone.find(".chosen-container").remove(),clone},add:function(){e(document.body).on("click",".submit .edd_add_repeatable",function(d){d.preventDefault();var n=e(this),a=n.parent().parent().prev("tr"),i=t.clone_repeatable(a);i.insertAfter(a).find("input, textarea, select").filter(":visible").eq(0).focus(),i.find(".edd-select-chosen").chosen({inherit_select_classes:!0,placeholder_text_single:edd_vars.one_option,placeholder_text_multiple:edd_vars.one_or_more_option}),i.find(".edd-select-chosen").css("width","100%")})},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(document.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"),i="tr.edd_repeatable_"+a+"s";if("price"===a){var o=d.data("key");e('.edd_repeatable_condition_field option[value="'+o+'"]').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(i).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(document.body).on("change","#_edd_product_type",function(){var t=e("#edd_products"),d=e("#edd_download_files"),n=e("#edd_download_limit_wrap");"bundle"===e(this).val()?(t.show(),d.hide(),n.hide()):(t.hide(),d.show(),n.show())})},prices:function(){e(document.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(document.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(document.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))})}};t.init();var d=e(".edd_datepicker");if(d.length>0){var n="mm/dd/yy";d.datepicker({dateFormat:n})}var a={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){var d=e("#edd-order-address-state-wrap select, #edd-order-address-state-wrap input");d.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(){var t=e(document.body).find("#edd-purchased-files > .row").length;if(1===t)return alert(edd_vars.one_download_min),!1;if(confirm(edd_vars.delete_payment_download)){var d=e(this).data("key"),n=(e(".edd-payment-id").val(),e('input[name="edd-payment-details-downloads['+d+'][id]"]').val()),a=e('input[name="edd-payment-details-downloads['+d+'][price_id]"]').val(),i=e('input[name="edd-payment-details-downloads['+d+'][quantity]"]').val(),o=e('input[name="edd-payment-details-downloads['+d+'][amount]"]').val(),r=e('input[name="edd-payment-removed"]').val();r=e.parseJSON(r),r.length<1&&(r={});var s=[{id:n,price_id:a,quantity:i,amount:o}];r[d]=s,e('input[name="edd-payment-removed"]').val(JSON.stringify(r)),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();var d=e("#edd-new-customer");d.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"),n=e("#edd-order-download-quantity"),a=e("#edd-order-download-amount"),i=e(".edd_price_options_select option:selected"),o=d.val(),r=d.find(":selected").text(),s=n.val(),c=a.val(),l=i.val(),u=i.text();if(1>o)return!1;if(c||(c=0),c=parseFloat(c),isNaN(c))return alert(edd_vars.numeric_item_price),!1;if("1"===edd_vars.quantities_enabled){if(isNaN(parseInt(s)))return alert(edd_vars.numeric_quantity),!1;c*=s}c=c.toFixed(edd_vars.currency_decimals);var _=c+edd_vars.currency_sign;"before"===edd_vars.currency_pos&&(_=edd_vars.currency_sign+c),u&&(r=r+" - "+u);var p=e("#edd-purchased-files div.row").length,f=e("#edd-purchased-files div.row:last").clone();f.find(".download span").html('<a href="post.php?post='+o+'&action=edit"></a>'),f.find(".download span a").text(r),f.find(".price-text").text(_),f.find(".item-quantity").text(s),f.find(".item-price").text(edd_vars.currency_sign+(c/s).toFixed(edd_vars.currency_decimals)),f.find("input.edd-payment-details-download-id").val(o),f.find("input.edd-payment-details-download-price-id").val(l),f.find("input.edd-payment-details-download-amount").val(c),f.find("input.edd-payment-details-download-quantity").val(s),f.find("input.edd-payment-details-download-has-log").val(0),f.find("input").each(function(){var t=e(this).attr("name");t=t.replace(/\[(\d+)\]/,"["+parseInt(p)+"]"),e(this).attr("name",t).attr("id",t)}),e("#edd-payment-downloads-changed").val(1),e(f).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,n=e("#edd-purchased-files .row .edd-payment-details-download-amount");n.length&&n.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(document.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(document.body).on("click","#edd-resend-receipt",function(){return confirm(edd_vars.resend_receipt)})},copy_download_link:function(){e(document.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)})})}};a.init();var i={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(){var t=e("#edd-discount-product-conditions");e(this).val()?t.show():t.hide()})}};i.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),d=e("#edd-date-range-options");"other"===t.val()?d.show():d.hide()})},customers_export:function(){e("#edd_customer_export_download").change(function(){var t=e(this),d=e("option:selected",t).val(),n=e("#edd_customer_export_option");if("0"===t.val()?n.show():n.hide(),0!=parseInt(d)){var a={action:"edd_check_for_download_price_variations",download_id:d},i=e(".edd_price_options_select");e.post(ajaxurl,a,function(e){i.remove(),t.after(e)})}else i.remove()})}};o.init();var r={init:function(){this.general(),this.taxes(),this.emails(),this.misc()},general:function(){var t=e(".edd-color-picker");if(t.length&&t.wpColorPicker(),"undefined"==typeof wp||"1"!==edd_vars.new_media_ui){var d=e(".edd_settings_upload_button");d.length>0&&(window.formfield="",e(document.body).on("click",d,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 n;window.formfield="",e(document.body).on("click",".edd_settings_upload_button",function(t){t.preventDefault();var d=e(this);return window.formfield=e(this).parent().prev(),n?void n.open():(n=wp.media.frames.file_frame=wp.media({frame:"post",state:"insert",title:d.data("uploader_title"),button:{text:d.data("uploader_button_text")},multiple:!1}),n.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)}),n.on("insert",function(){var e=n.state().get("selection");e.each(function(e){e=e.toJSON(),window.formfield.val(e.url)})}),void n.open())});var n;window.formfield=""}},taxes:function(){var t=e("select.edd-no-states");t.length&&t.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(document.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(document.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"),d=t.length;2===d?(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(),e("#edd_tax_rates tr").each(function(t){e(this).children().find("input, select").each(function(){var d=e(this).attr("name");d=d.replace(/\[(\d+)\]/,"["+(t-1)+"]"),e(this).attr("name",d).attr("id",d)})})}return!1})},emails:function(){var t=e("#email-preview-wrap");if(t.length){var d=e("#email-preview");t.colorbox({inline:!0,href:d,width:"80%",height:"auto"})}},misc:function(){var t=e('select[name="edd_settings[download_method]"]'),d=t.parent().parent().next();"direct"==t.val()&&(d.hide(),d.find("input").prop("checked",!1)),t.on("change",function(){"direct"==e(this).val()?(d.hide(),d.find("input").prop("checked",!1)):d.show()})}};r.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(document.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 s,c=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",""),i=(t.which,"edd_download_search");n.attr("id").indexOf("customer")>=0&&(i="edd_customer_search"),d.length<=3&&"edd_download_search"==i||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(s),s=setTimeout(function(){e.ajax({type:"GET",url:ajaxurl,data:{action:i,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(){})},c))}),e("#post").on("click",".edd-thickbox",function(){e(".edd-select-chosen","#choose-download").css("width","100%")});var l={init:function(){this.revoke_api_key(),this.regenerate_api_key()},revoke_api_key:function(){e(document.body).on("click",".edd-revoke-api-key",function(){return confirm(edd_vars.revoke_api_key)})},regenerate_api_key:function(){e(document.body).on("click",".edd-regenerate-api-key",function(){return confirm(edd_vars.regenerate_api_key)})}};l.init();var u={init:function(){this.submit()},submit:function(){var t=this;e(document.body).on("submit",".edd-export-form",function(d){d.preventDefault();var n=e(this).find('input[type="submit"]');if(!n.hasClass("button-disabled")){var a=e(this).serialize();n.addClass("button-disabled"),e(this).append('<span class="spinner is-active"></span><div class="edd-progress"><div></div></div>'),t.process_step(1,a,t)}})},process_step:function(t,d,n){e.ajax({type:"POST",url:ajaxurl,data:{form:d,action:"edd_do_ajax_export",step:t},dataType:"json",success:function(t){if("done"==t.step){var a=e(".edd-export-form");a.find(".spinner").remove(),a.find(".edd-progress").remove(),a.find(".button-disabled").removeClass("button-disabled"),window.location=t.url}else e(".edd-progress div").animate({width:t.percentage+"%"},50,function(){}),n.process_step(parseInt(t.step),d,n)}}).fail(function(e){window.console&&window.console.log&&console.log(e)})}};u.init();var _={vars:{customer_card_wrap_editable:e("#edd-customer-card-wrapper .editable"),customer_card_wrap_edit_item:e("#edd-customer-card-wrapper .edit-item"),user_id:e('input[name="customerinfo[user_id]"]'),state_input:e(':input[name="customerinfo[state]"]'),note:e("#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(){e(document.body).on("click","#edit-customer",function(e){e.preventDefault(),_.vars.customer_card_wrap_editable.hide(),_.vars.customer_card_wrap_edit_item.fadeIn().css("display","block")})},user_search:function(){e(document.body).on("click.eddSelectUser",".edd_user_search_results a",function(t){t.preventDefault();var d=e(this).data("userid");_.vars.user_id.val(d)})},remove_user:function(){e(document.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(document.body).on("click","#edd-edit-customer-cancel",function(t){t.preventDefault(),_.vars.customer_card_wrap_edit_item.hide(),_.vars.customer_card_wrap_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(e){_.vars.state_input.replaceWith("nostates"==e?'<input type="text" name="'+data.field_name+'" value="" class="edd-edit-toggles medium-text"/>':e)}),!1})},add_note:function(){e(document.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:_.vars.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(),_.vars.note.val("")}}).fail(function(e){window.console&&window.console.log&&console.log(e)});else{var n=_.vars.note.css("border-color");_.vars.note.css("border-color","red"),setTimeout(function(){_.vars.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))})}};_.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(document.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(document.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()})});var eddFormatCurrency=function(e){var t=parseFloat(e),d=edd_vars.currency,n=edd_vars.currency_decimals;return t.toLocaleString(d,{style:"currency",currency:d,minimumFractionDigits:n,maximumFractionDigits:n})},eddFormatNumber=function(e){{var t=parseFloat(e),d=edd_vars.currency;edd_vars.currency_decimals}return t.toLocaleString(d,{style:"decimal",minimumFractionDigits:0,maximumFractionDigits:0})},eddLabelFormatter=function(e){return'<div style="font-size:12px; text-align:center; padding:2px">'+e+"</div>"},eddLegendFormatterSales=function(e,t){var d=e.toLowerCase().replace(/\s/g,"-"),n='<div class="edd-legend-color" style="background-color: '+t.color+'"></div>',a='<div class="edd-pie-legend-item">'+e+": "+Math.round(t.percent)+"% ("+eddFormatNumber(t.data[0][1])+")</div>",i='<div id="'+t.edd_vars.id+d+'" class="edd-legend-item-wrapper">'+n+a+"</div>";return jQuery("#edd-pie-legend-"+t.edd_vars.id).append(i),i},eddLegendFormatterEarnings=function(e,t){var d=e.toLowerCase().replace(/\s/g,"-"),n='<div class="edd-legend-color" style="background-color: '+t.color+'"></div>',a='<div class="edd-pie-legend-item">'+e+": "+Math.round(t.percent)+"% ("+eddFormatCurrency(t.data[0][1])+")</div>",i='<div id="'+t.edd_vars.id+d+'" class="edd-legend-item-wrapper">'+n+a+"</div>";return jQuery("#edd-pie-legend-"+t.edd_vars.id).append(i),i};
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=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.find(".search-choice").remove(),clone.find(".chosen-container").remove(),clone},add:function(){e(document.body).on("click",".submit .edd_add_repeatable",function(d){d.preventDefault();var n=e(this),a=n.parent().parent().prev("tr"),i=t.clone_repeatable(a);i.insertAfter(a).find("input, textarea, select").filter(":visible").eq(0).focus(),i.find(".edd-select-chosen").chosen({inherit_select_classes:!0,placeholder_text_single:edd_vars.one_option,placeholder_text_multiple:edd_vars.one_or_more_option}),i.find(".edd-select-chosen").css("width","100%")})},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(document.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"),i="tr.edd_repeatable_"+a+"s";if("price"===a){var o=d.data("key");e('.edd_repeatable_condition_field option[value="'+o+'"]').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(i).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(document.body).on("change","#_edd_product_type",function(){var t=e("#edd_products"),d=e("#edd_download_files"),n=e("#edd_download_limit_wrap");"bundle"===e(this).val()?(t.show(),d.hide(),n.hide()):(t.hide(),d.show(),n.show())})},prices:function(){e(document.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(document.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(document.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))})}};t.init();var d=e(".edd_datepicker");if(d.length>0){var n="mm/dd/yy";d.datepicker({dateFormat:n})}var a={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){var d=e("#edd-order-address-state-wrap select, #edd-order-address-state-wrap input");d.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(){var t=e(document.body).find("#edd-purchased-files > .row").length;if(1===t)return alert(edd_vars.one_download_min),!1;if(confirm(edd_vars.delete_payment_download)){var d=e(this).data("key"),n=(e(".edd-payment-id").val(),e('input[name="edd-payment-details-downloads['+d+'][id]"]').val()),a=e('input[name="edd-payment-details-downloads['+d+'][price_id]"]').val(),i=e('input[name="edd-payment-details-downloads['+d+'][quantity]"]').val(),o=e('input[name="edd-payment-details-downloads['+d+'][amount]"]').val(),r=e('input[name="edd-payment-removed"]').val();r=e.parseJSON(r),r.length<1&&(r={});var s=[{id:n,price_id:a,quantity:i,amount:o}];r[d]=s,e('input[name="edd-payment-removed"]').val(JSON.stringify(r)),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();var d=e("#edd-new-customer");d.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"),n=e("#edd-order-download-quantity"),a=e("#edd-order-download-amount"),i=e(".edd_price_options_select option:selected"),o=d.val(),r=d.find(":selected").text(),s=n.val(),c=a.val(),l=i.val(),u=i.text();if(1>o)return!1;if(c||(c=0),c=parseFloat(c),isNaN(c))return alert(edd_vars.numeric_item_price),!1;if("1"===edd_vars.quantities_enabled){if(isNaN(parseInt(s)))return alert(edd_vars.numeric_quantity),!1;c*=s}c=c.toFixed(edd_vars.currency_decimals);var _=c+edd_vars.currency_sign;"before"===edd_vars.currency_pos&&(_=edd_vars.currency_sign+c),u&&(r=r+" - "+u);var p=e("#edd-purchased-files div.row").length,f=e("#edd-purchased-files div.row:last").clone();f.find(".download span").html('<a href="post.php?post='+o+'&action=edit"></a>'),f.find(".download span a").text(r),f.find(".price-text").text(_),f.find(".item-quantity").text(s),f.find(".item-price").text(edd_vars.currency_sign+(c/s).toFixed(edd_vars.currency_decimals)),f.find("input.edd-payment-details-download-id").val(o),f.find("input.edd-payment-details-download-price-id").val(l),f.find("input.edd-payment-details-download-amount").val(c),f.find("input.edd-payment-details-download-quantity").val(s),f.find("input.edd-payment-details-download-has-log").val(0),f.find("input").each(function(){var t=e(this).attr("name");t=t.replace(/\[(\d+)\]/,"["+parseInt(p)+"]"),e(this).attr("name",t).attr("id",t)}),e("#edd-payment-downloads-changed").val(1),e(f).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,n=e("#edd-purchased-files .row .edd-payment-details-download-amount");n.length&&n.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(document.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(document.body).on("click","#edd-resend-receipt",function(){return confirm(edd_vars.resend_receipt)})},copy_download_link:function(){e(document.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)})})}};a.init();var i={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(){var t=e("#edd-discount-product-conditions");e(this).val()?t.show():t.hide()})}};i.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),d=e("#edd-date-range-options");"other"===t.val()?d.show():d.hide()})},customers_export:function(){e("#edd_customer_export_download").change(function(){var t=e(this),d=e("option:selected",t).val(),n=e("#edd_customer_export_option");if("0"===t.val()?n.show():n.hide(),0!=parseInt(d)){var a={action:"edd_check_for_download_price_variations",download_id:d},i=e(".edd_price_options_select");e.post(ajaxurl,a,function(e){i.remove(),t.after(e)})}else i.remove()})}};o.init();var r={init:function(){this.general(),this.taxes(),this.emails(),this.misc()},general:function(){var t=e(".edd-color-picker");if(t.length&&t.wpColorPicker(),"undefined"==typeof wp||"1"!==edd_vars.new_media_ui){var d=e(".edd_settings_upload_button");d.length>0&&(window.formfield="",e(document.body).on("click",d,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 n;window.formfield="",e(document.body).on("click",".edd_settings_upload_button",function(t){t.preventDefault();var d=e(this);return window.formfield=e(this).parent().prev(),n?void n.open():(n=wp.media.frames.file_frame=wp.media({frame:"post",state:"insert",title:d.data("uploader_title"),button:{text:d.data("uploader_button_text")},multiple:!1}),n.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)}),n.on("insert",function(){var e=n.state().get("selection");e.each(function(e){e=e.toJSON(),window.formfield.val(e.url)})}),void n.open())});var n;window.formfield=""}},taxes:function(){var t=e("select.edd-no-states");t.length&&t.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(document.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(document.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"),d=t.length;2===d?(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(),e("#edd_tax_rates tr").each(function(t){e(this).children().find("input, select").each(function(){var d=e(this).attr("name");d=d.replace(/\[(\d+)\]/,"["+(t-1)+"]"),e(this).attr("name",d).attr("id",d)})})}return!1})},emails:function(){var t=e("#email-preview-wrap");if(t.length){var d=e("#email-preview");t.colorbox({inline:!0,href:d,width:"80%",height:"auto"})}},misc:function(){var t=e('select[name="edd_settings[download_method]"]'),d=t.parent().parent().next();"direct"==t.val()&&(d.hide(),d.find("input").prop("checked",!1)),t.on("change",function(){"direct"==e(this).val()?(d.hide(),d.find("input").prop("checked",!1)):d.show()})}};r.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(document.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 s,c=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",""),i=(t.which,"edd_download_search");n.attr("id").indexOf("customer")>=0&&(i="edd_customer_search"),d.length<=3&&"edd_download_search"==i||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(s),s=setTimeout(function(){e.ajax({type:"GET",url:ajaxurl,data:{action:i,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(){})},c))}),e("#post").on("click",".edd-thickbox",function(){e(".edd-select-chosen","#choose-download").css("width","100%")});var l={init:function(){this.revoke_api_key(),this.regenerate_api_key()},revoke_api_key:function(){e(document.body).on("click",".edd-revoke-api-key",function(){return confirm(edd_vars.revoke_api_key)})},regenerate_api_key:function(){e(document.body).on("click",".edd-regenerate-api-key",function(){return confirm(edd_vars.regenerate_api_key)})}};l.init();var u={init:function(){this.submit()},submit:function(){var t=this;e(document.body).on("submit",".edd-export-form",function(d){d.preventDefault();var n=e(this).find('input[type="submit"]');if(!n.hasClass("button-disabled")){var a=e(this).serialize();n.addClass("button-disabled"),e(this).find(".notice-wrap").remove(),e(this).append('<div class="notice-wrap"><span class="spinner is-active"></span><div class="edd-progress"><div></div></div></div>'),t.process_step(1,a,t)}})},process_step:function(t,d,n){e.ajax({type:"POST",url:ajaxurl,data:{form:d,action:"edd_do_ajax_export",step:t},dataType:"json",success:function(t){if("done"==t.step||t.error){var a=e(".edd-export-form").find(".edd-progress").parent().parent(),i=a.find(".notice-wrap");if(a.find(".button-disabled").removeClass("button-disabled"),t.error){var o=t.message;i.html('<div class="update error"><p>'+o+"</p></div>")}else i.remove(),window.location=t.url}else e(".edd-progress div").animate({width:t.percentage+"%"},50,function(){}),n.process_step(parseInt(t.step),d,n)}}).fail(function(e){window.console&&window.console.log&&console.log(e)})}};u.init();var _={vars:{customer_card_wrap_editable:e("#edd-customer-card-wrapper .editable"),customer_card_wrap_edit_item:e("#edd-customer-card-wrapper .edit-item"),user_id:e('input[name="customerinfo[user_id]"]'),state_input:e(':input[name="customerinfo[state]"]'),note:e("#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(){e(document.body).on("click","#edit-customer",function(e){e.preventDefault(),_.vars.customer_card_wrap_editable.hide(),_.vars.customer_card_wrap_edit_item.fadeIn().css("display","block")})},user_search:function(){e(document.body).on("click.eddSelectUser",".edd_user_search_results a",function(t){t.preventDefault();var d=e(this).data("userid");_.vars.user_id.val(d)})},remove_user:function(){e(document.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(document.body).on("click","#edd-edit-customer-cancel",function(t){t.preventDefault(),_.vars.customer_card_wrap_edit_item.hide(),_.vars.customer_card_wrap_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(e){_.vars.state_input.replaceWith("nostates"==e?'<input type="text" name="'+data.field_name+'" value="" class="edd-edit-toggles medium-text"/>':e)}),!1})},add_note:function(){e(document.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:_.vars.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(),_.vars.note.val("")}}).fail(function(e){window.console&&window.console.log&&console.log(e)});else{var n=_.vars.note.css("border-color");_.vars.note.css("border-color","red"),setTimeout(function(){_.vars.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))})}};_.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(document.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(document.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()})});var eddFormatCurrency=function(e){var t=parseFloat(e),d=edd_vars.currency,n=edd_vars.currency_decimals;return t.toLocaleString(d,{style:"currency",currency:d,minimumFractionDigits:n,maximumFractionDigits:n})},eddFormatNumber=function(e){{var t=parseFloat(e),d=edd_vars.currency;edd_vars.currency_decimals}return t.toLocaleString(d,{style:"decimal",minimumFractionDigits:0,maximumFractionDigits:0})},eddLabelFormatter=function(e){return'<div style="font-size:12px; text-align:center; padding:2px">'+e+"</div>"},eddLegendFormatterSales=function(e,t){var d=e.toLowerCase().replace(/\s/g,"-"),n='<div class="edd-legend-color" style="background-color: '+t.color+'"></div>',a='<div class="edd-pie-legend-item">'+e+": "+Math.round(t.percent)+"% ("+eddFormatNumber(t.data[0][1])+")</div>",i='<div id="'+t.edd_vars.id+d+'" class="edd-legend-item-wrapper">'+n+a+"</div>";return jQuery("#edd-pie-legend-"+t.edd_vars.id).append(i),i},eddLegendFormatterEarnings=function(e,t){var d=e.toLowerCase().replace(/\s/g,"-"),n='<div class="edd-legend-color" style="background-color: '+t.color+'"></div>',a='<div class="edd-pie-legend-item">'+e+": "+Math.round(t.percent)+"% ("+eddFormatCurrency(t.data[0][1])+")</div>",i='<div id="'+t.edd_vars.id+d+'" class="edd-legend-item-wrapper">'+n+a+"</div>";return jQuery("#edd-pie-legend-"+t.edd_vars.id).append(i),i};
assets/js/edd-ajax.min.js CHANGED
@@ -1 +1 @@
1
- function edd_load_gateway(e){jQuery(".edd-cart-ajax").show(),jQuery("#edd_purchase_form_wrap").html('<img src="'+edd_scripts.ajax_loader+'"/>'),jQuery.post(edd_scripts.ajaxurl+"?payment-mode="+e,{action:"edd_load_gateway",edd_payment_mode:e},function(e){jQuery("#edd_purchase_form_wrap").html(e),jQuery(".edd-no-js").hide()})}var edd_scripts;jQuery(document).ready(function(e){e(".edd-no-js").hide(),e("a.edd-add-to-cart").addClass("edd-has-js"),e("body").on("click.eddRemoveFromCart",".edd-remove-from-cart",function(){var d=e(this),t=d.data("cart-item"),a=d.data("action"),i=d.data("download-id"),r={action:a,cart_item:t};return e.ajax({type:"POST",data:r,dataType:"json",url:edd_scripts.ajaxurl,xhrFields:{withCredentials:!0},success:function(d){if(d.removed){if(parseInt(edd_scripts.position_in_cart,10)===parseInt(t,10))return window.location=window.location,!1;e(".edd-cart").find("[data-cart-item='"+t+"']").parent().remove();var a=0;e(".edd-cart").find("[data-cart-item]").each(function(){e(this).attr("data-cart-item",a),a+=1}),e("#edd_purchase_"+i).length&&(e("#edd_purchase_"+i+" .edd_go_to_checkout").hide(),e("#edd_purchase_"+i+" a.edd-add-to-cart").show().removeAttr("data-edd-loading"),"1"==edd_scripts.quantities_enabled&&e("#edd_purchase_"+i+" .edd_download_quantity_wrapper").show()),e("span.edd-cart-quantity").text(d.cart_quantity),e("body").trigger("edd_quantity_updated",[d.cart_quantity]),edd_scripts.taxes_enabled&&(e(".cart_item.edd_subtotal span").html(d.subtotal),e(".cart_item.edd_cart_tax span").html(d.tax)),e(".cart_item.edd_total span").html(d.total),0==d.cart_quantity&&(e(".cart_item.edd_subtotal,.edd-cart-number-of-items,.cart_item.edd_checkout,.cart_item.edd_cart_tax,.cart_item.edd_total").hide(),e(".edd-cart").append('<li class="cart_item empty">'+edd_scripts.empty_cart_message+"</li>")),e("body").trigger("edd_cart_item_removed",[d])}}}).fail(function(e){window.console&&window.console.log&&console.log(e)}).done(function(){}),!1}),e("body").on("click.eddAddToCart",".edd-add-to-cart",function(d){d.preventDefault();var t=e(this),a=t.closest("form"),i=t.find(".edd-loading"),r=t.closest("div"),o=i.width(),c=i.height();t.attr("data-edd-loading",""),i.css({"margin-left":o/-2,"margin-top":c/-2});var a=t.parents("form").last(),n=t.data("download-id"),s=t.data("variable-price"),_=t.data("price-mode"),l=[],u=!0;if("yes"==s)if(a.find(".edd_price_option_"+n).is("input:hidden"))l[0]=e(".edd_price_option_"+n,a).val();else{if(!a.find(".edd_price_option_"+n+":checked",a).length)return t.removeAttr("data-edd-loading"),void alert(edd_scripts.select_option);a.find(".edd_price_option_"+n+":checked",a).each(function(d){if(l[d]=e(this).val(),!0===u){var t=e(this).data("price");t&&t>0&&(u=!1)}})}else l[0]=n,t.data("price")&&t.data("price")>0&&(u=!1);if(u&&a.find(".edd_action_input").val("add_to_cart"),"straight_to_gateway"==a.find(".edd_action_input").val())return a.submit(),!0;var p=t.data("action"),m={action:p,download_id:n,price_ids:l,post_data:e(a).serialize()};return e.ajax({type:"POST",data:m,dataType:"json",url:edd_scripts.ajaxurl,xhrFields:{withCredentials:!0},success:function(d){if("1"==edd_scripts.redirect_to_checkout&&"1"==a.find("#edd_redirect_to_checkout").val())window.location=edd_scripts.checkout_page;else{"1"===edd_scripts.taxes_enabled&&(e(".cart_item.edd_subtotal").show(),e(".cart_item.edd_cart_tax").show()),e(".cart_item.edd_total").show(),e(".cart_item.edd_checkout").show(),e(".cart_item.empty").length?(e(d.cart_item).insertBefore(".edd-cart-meta:first"),e(".cart_item.empty").hide()):e(d.cart_item).insertBefore(".edd-cart-meta:first"),"1"===edd_scripts.taxes_enabled&&(e(".edd-cart-meta.edd_subtotal span").html(d.subtotal),e(".edd-cart-meta.edd_cart_tax span").html(d.tax)),e(".edd-cart-meta.edd_total span").html(d.total);{e(".edd-cart-item-title",d.cart_item).length}if(e("span.edd-cart-quantity").each(function(){e(this).text(d.cart_quantity),e("body").trigger("edd_quantity_updated",[d.cart_quantity])}),"none"==e(".edd-cart-number-of-items").css("display")&&e(".edd-cart-number-of-items").show("slow"),("no"==s||"multi"!=_)&&(e("a.edd-add-to-cart",r).toggle(),e(".edd_go_to_checkout",r).css("display","inline-block")),"multi"==_&&t.removeAttr("data-edd-loading"),e(".edd_download_purchase_form").length&&("no"==s||!a.find(".edd_price_option_"+n).is("input:hidden"))){var i=e('.edd_download_purchase_form *[data-download-id="'+n+'"]').parents("form");e("a.edd-add-to-cart",i).hide(),"multi"!=_&&i.find(".edd_download_quantity_wrapper").slideUp(),e(".edd_go_to_checkout",i).show().removeAttr("data-edd-loading")}"incart"!=d&&(e(".edd-cart-added-alert",r).fadeIn(),setTimeout(function(){e(".edd-cart-added-alert",r).fadeOut()},3e3)),e("body").trigger("edd_cart_item_added",[d])}}}).fail(function(e){window.console&&window.console.log&&console.log(e)}).done(function(){}),!1}),e("#edd_checkout_form_wrap").on("click",".edd_checkout_register_login",function(){var d=e(this),t={action:d.data("action")};return e(".edd-cart-ajax").show(),e.post(edd_scripts.ajaxurl,t,function(d){e("#edd_checkout_login_register").html(edd_scripts.loading),e("#edd_checkout_login_register").html(d),e(".edd-cart-ajax").hide()}),!1}),e(document).on("click","#edd_purchase_form #edd_login_fields input[type=submit]",function(d){d.preventDefault();var t=e(this).val();e(this).val(edd_global_vars.purchase_loading),e(this).after('<span class="edd-cart-ajax"><i class="edd-icon-spinner edd-icon-spin"></i></span>');var a={action:"edd_process_checkout_login",edd_ajax:1,edd_user_login:e("#edd_login_fields #edd_user_login").val(),edd_user_pass:e("#edd_login_fields #edd_user_pass").val()};e.post(edd_global_vars.ajaxurl,a,function(d){"success"==e.trim(d)?(e(".edd_errors").remove(),window.location=edd_scripts.checkout_page):(e("#edd_login_fields input[type=submit]").val(t),e(".edd-cart-ajax").remove(),e(".edd_errors").remove(),e("#edd-user-login-submit").before(d))})}),e("select#edd-gateway, input.edd-gateway").change(function(){var d=e("#edd-gateway option:selected, input.edd-gateway:checked").val();return"0"==d?!1:(edd_load_gateway(d),!1)}),"1"==edd_scripts.is_checkout&&e("select#edd-gateway, input.edd-gateway").length&&setTimeout(function(){edd_load_gateway(edd_scripts.default_gateway)},200),e(document).on("click","#edd_purchase_form #edd_purchase_submit input[type=submit]",function(d){var t=document.getElementById("edd_purchase_form");if("function"!=typeof t.checkValidity||!1!==t.checkValidity()){d.preventDefault();var a=e(this).val();e(this).val(edd_global_vars.purchase_loading),e(this).after('<span class="edd-cart-ajax"><i class="edd-icon-spinner edd-icon-spin"></i></span>'),e.post(edd_global_vars.ajaxurl,e("#edd_purchase_form").serialize()+"&action=edd_process_checkout&edd_ajax=true",function(d){"success"==e.trim(d)?(e(".edd_errors").remove(),e(".edd-error").hide(),e(t).submit()):(e("#edd-purchase-button").val(a),e(".edd-cart-ajax").remove(),e(".edd_errors").remove(),e(".edd-error").hide(),e("#edd_purchase_submit").before(d))})}})});
1
+ function edd_load_gateway(e){jQuery(".edd-cart-ajax").show(),jQuery("#edd_purchase_form_wrap").html('<img src="'+edd_scripts.ajax_loader+'"/>'),jQuery.post(edd_scripts.ajaxurl+"?payment-mode="+e,{action:"edd_load_gateway",edd_payment_mode:e},function(e){jQuery("#edd_purchase_form_wrap").html(e),jQuery(".edd-no-js").hide()})}var edd_scripts;jQuery(document).ready(function(e){e(".edd-no-js").hide(),e("a.edd-add-to-cart").addClass("edd-has-js"),e("body").on("click.eddRemoveFromCart",".edd-remove-from-cart",function(){var d=e(this),t=d.data("cart-item"),a=d.data("action"),i=d.data("download-id"),r={action:a,cart_item:t};return e.ajax({type:"POST",data:r,dataType:"json",url:edd_scripts.ajaxurl,xhrFields:{withCredentials:!0},success:function(d){if(d.removed){if(parseInt(edd_scripts.position_in_cart,10)===parseInt(t,10))return window.location=window.location,!1;e(".edd-cart").find("[data-cart-item='"+t+"']").parent().remove();var a=0;e(".edd-cart").find("[data-cart-item]").each(function(){e(this).attr("data-cart-item",a),a+=1}),e("#edd_purchase_"+i).length&&(e("#edd_purchase_"+i+" .edd_go_to_checkout").hide(),e("#edd_purchase_"+i+" a.edd-add-to-cart").show().removeAttr("data-edd-loading"),"1"==edd_scripts.quantities_enabled&&e("#edd_purchase_"+i+" .edd_download_quantity_wrapper").show()),e("span.edd-cart-quantity").text(d.cart_quantity),e("body").trigger("edd_quantity_updated",[d.cart_quantity]),edd_scripts.taxes_enabled&&(e(".cart_item.edd_subtotal span").html(d.subtotal),e(".cart_item.edd_cart_tax span").html(d.tax)),e(".cart_item.edd_total span").html(d.total),0==d.cart_quantity&&(e(".cart_item.edd_subtotal,.edd-cart-number-of-items,.cart_item.edd_checkout,.cart_item.edd_cart_tax,.cart_item.edd_total").hide(),e(".edd-cart").append('<li class="cart_item empty">'+edd_scripts.empty_cart_message+"</li>")),e("body").trigger("edd_cart_item_removed",[d])}}}).fail(function(e){window.console&&window.console.log&&console.log(e)}).done(function(){}),!1}),e("body").on("click.eddAddToCart",".edd-add-to-cart",function(d){d.preventDefault();var t=e(this),a=t.closest("form"),i=t.find(".edd-loading"),r=t.closest("div"),o=i.width(),c=i.height();t.attr("data-edd-loading",""),i.css({"margin-left":o/-2,"margin-top":c/-2});var a=t.parents("form").last(),n=t.data("download-id"),s=t.data("variable-price"),_=t.data("price-mode"),l=[],u=!0;if("yes"==s)if(a.find(".edd_price_option_"+n).is("input:hidden"))l[0]=e(".edd_price_option_"+n,a).val(),a.find(".edd-submit").data("price")&&a.find(".edd-submit").data("price")>0&&(u=!1);else{if(!a.find(".edd_price_option_"+n+":checked",a).length)return t.removeAttr("data-edd-loading"),void alert(edd_scripts.select_option);a.find(".edd_price_option_"+n+":checked",a).each(function(d){if(l[d]=e(this).val(),!0===u){var t=e(this).data("price");t&&t>0&&(u=!1)}})}else l[0]=n,t.data("price")&&t.data("price")>0&&(u=!1);if(u&&a.find(".edd_action_input").val("add_to_cart"),"straight_to_gateway"==a.find(".edd_action_input").val())return a.submit(),!0;var p=t.data("action"),m={action:p,download_id:n,price_ids:l,post_data:e(a).serialize()};return e.ajax({type:"POST",data:m,dataType:"json",url:edd_scripts.ajaxurl,xhrFields:{withCredentials:!0},success:function(d){if("1"==edd_scripts.redirect_to_checkout&&"1"==a.find("#edd_redirect_to_checkout").val())window.location=edd_scripts.checkout_page;else{"1"===edd_scripts.taxes_enabled&&(e(".cart_item.edd_subtotal").show(),e(".cart_item.edd_cart_tax").show()),e(".cart_item.edd_total").show(),e(".cart_item.edd_checkout").show(),e(".cart_item.empty").length?(e(d.cart_item).insertBefore(".edd-cart-meta:first"),e(".cart_item.empty").hide()):e(d.cart_item).insertBefore(".edd-cart-meta:first"),"1"===edd_scripts.taxes_enabled&&(e(".edd-cart-meta.edd_subtotal span").html(d.subtotal),e(".edd-cart-meta.edd_cart_tax span").html(d.tax)),e(".edd-cart-meta.edd_total span").html(d.total);{e(".edd-cart-item-title",d.cart_item).length}if(e("span.edd-cart-quantity").each(function(){e(this).text(d.cart_quantity),e("body").trigger("edd_quantity_updated",[d.cart_quantity])}),"none"==e(".edd-cart-number-of-items").css("display")&&e(".edd-cart-number-of-items").show("slow"),("no"==s||"multi"!=_)&&(e("a.edd-add-to-cart",r).toggle(),e(".edd_go_to_checkout",r).css("display","inline-block")),"multi"==_&&t.removeAttr("data-edd-loading"),e(".edd_download_purchase_form").length&&("no"==s||!a.find(".edd_price_option_"+n).is("input:hidden"))){var i=e('.edd_download_purchase_form *[data-download-id="'+n+'"]').parents("form");e("a.edd-add-to-cart",i).hide(),"multi"!=_&&i.find(".edd_download_quantity_wrapper").slideUp(),e(".edd_go_to_checkout",i).show().removeAttr("data-edd-loading")}"incart"!=d&&(e(".edd-cart-added-alert",r).fadeIn(),setTimeout(function(){e(".edd-cart-added-alert",r).fadeOut()},3e3)),e("body").trigger("edd_cart_item_added",[d])}}}).fail(function(e){window.console&&window.console.log&&console.log(e)}).done(function(){}),!1}),e("#edd_checkout_form_wrap").on("click",".edd_checkout_register_login",function(){var d=e(this),t={action:d.data("action")};return e(".edd-cart-ajax").show(),e.post(edd_scripts.ajaxurl,t,function(d){e("#edd_checkout_login_register").html(edd_scripts.loading),e("#edd_checkout_login_register").html(d),e(".edd-cart-ajax").hide()}),!1}),e(document).on("click","#edd_purchase_form #edd_login_fields input[type=submit]",function(d){d.preventDefault();var t=e(this).val();e(this).val(edd_global_vars.purchase_loading),e(this).after('<span class="edd-cart-ajax"><i class="edd-icon-spinner edd-icon-spin"></i></span>');var a={action:"edd_process_checkout_login",edd_ajax:1,edd_user_login:e("#edd_login_fields #edd_user_login").val(),edd_user_pass:e("#edd_login_fields #edd_user_pass").val()};e.post(edd_global_vars.ajaxurl,a,function(d){"success"==e.trim(d)?(e(".edd_errors").remove(),window.location=edd_scripts.checkout_page):(e("#edd_login_fields input[type=submit]").val(t),e(".edd-cart-ajax").remove(),e(".edd_errors").remove(),e("#edd-user-login-submit").before(d))})}),e("select#edd-gateway, input.edd-gateway").change(function(){var d=e("#edd-gateway option:selected, input.edd-gateway:checked").val();return"0"==d?!1:(edd_load_gateway(d),!1)}),"1"==edd_scripts.is_checkout&&e("select#edd-gateway, input.edd-gateway").length&&setTimeout(function(){edd_load_gateway(edd_scripts.default_gateway)},200),e(document).on("click","#edd_purchase_form #edd_purchase_submit input[type=submit]",function(d){var t=document.getElementById("edd_purchase_form");if("function"!=typeof t.checkValidity||!1!==t.checkValidity()){d.preventDefault();var a=e(this).val();e(this).val(edd_global_vars.purchase_loading),e(this).after('<span class="edd-cart-ajax"><i class="edd-icon-spinner edd-icon-spin"></i></span>'),e.post(edd_global_vars.ajaxurl,e("#edd_purchase_form").serialize()+"&action=edd_process_checkout&edd_ajax=true",function(d){"success"==e.trim(d)?(e(".edd_errors").remove(),e(".edd-error").hide(),e(t).submit()):(e("#edd-purchase-button").val(a),e(".edd-cart-ajax").remove(),e(".edd_errors").remove(),e(".edd-error").hide(),e("#edd_purchase_submit").before(d))})}})});
assets/js/edd-checkout-global.js CHANGED
@@ -316,7 +316,7 @@ window.EDD_Checkout = (function($) {
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 = {
316
  var $this = $(this),
317
  quantity = $this.val(),
318
  key = $this.data('key'),
319
+ download_id = $this.closest('.edd_cart_item').data('download-id'),
320
  options = $this.parent().find('input[name="edd-cart-download-' + key + '-options"]').val();
321
 
322
  var postData = {
assets/js/edd-checkout-global.min.js CHANGED
@@ -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);
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(".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);
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.4.3
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.4.3
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.4.3' );
191
  }
192
 
193
  // Plugin Folder Path
5
  * Description: Serve Digital Downloads Through WordPress
6
  * Author: Pippin Williamson
7
  * Author URI: https://pippinsplugins.com
8
+ * Version: 2.4.5
9
  * Text Domain: edd
10
  * Domain Path: languages
11
  *
25
  * @package EDD
26
  * @category Core
27
  * @author Pippin Williamson
28
+ * @version 2.4.5
29
  */
30
 
31
  // Exit if accessed directly
187
 
188
  // Plugin version
189
  if ( ! defined( 'EDD_VERSION' ) ) {
190
+ define( 'EDD_VERSION', '2.4.5' );
191
  }
192
 
193
  // Plugin Folder Path
includes/admin/customers/customer-functions.php CHANGED
@@ -55,3 +55,57 @@ function edd_register_delete_customer_tab( $tabs ) {
55
  return $tabs;
56
  }
57
  add_filter( 'edd_customer_tabs', 'edd_register_delete_customer_tab', PHP_INT_MAX, 1 );
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
55
  return $tabs;
56
  }
57
  add_filter( 'edd_customer_tabs', 'edd_register_delete_customer_tab', PHP_INT_MAX, 1 );
58
+
59
+ /**
60
+ * Remove the admin bar edit profile link when the user is not verified
61
+ *
62
+ * @since 2.4.4
63
+ * @return void
64
+ */
65
+ function edd_maybe_remove_adminbar_profile_link() {
66
+
67
+ if ( current_user_can( 'manage_shop_settings' ) ) {
68
+ return;
69
+ }
70
+
71
+ if ( edd_user_pending_verification() ) {
72
+
73
+ global $wp_admin_bar;
74
+ $wp_admin_bar->remove_menu('edit-profile', 'user-actions');
75
+
76
+ }
77
+
78
+ }
79
+ add_action( 'wp_before_admin_bar_render', 'edd_maybe_remove_adminbar_profile_link' );
80
+
81
+ /**
82
+ * Remove the admin menus and disable profile access for non-verified users
83
+ *
84
+ * @since 2.4.4
85
+ * @return void
86
+ */
87
+ function edd_maybe_remove_menu_profile_links() {
88
+
89
+ if ( current_user_can( 'manage_shop_settings' ) ) {
90
+ return;
91
+ }
92
+
93
+ if ( edd_user_pending_verification() ) {
94
+
95
+ if( defined( 'IS_PROFILE_PAGE' ) && true === IS_PROFILE_PAGE ) {
96
+ $url = esc_url( edd_get_user_verification_request_url() );
97
+ $message = sprintf( __( 'Your account is pending verification. Please click the link in your email to activate your account. No email? <a href="%s">Click here</a> to send a new activation code.', 'edd' ), $url );
98
+ $title = __( 'Account Pending Verification', 'edd' );
99
+ $args = array(
100
+ 'response' => 403,
101
+ );
102
+ wp_die( $message, $title, $args );
103
+ }
104
+
105
+ remove_menu_page( 'profile.php' );
106
+ remove_submenu_page( 'users.php', 'profile.php' );
107
+
108
+ }
109
+
110
+ }
111
+ add_action( 'admin_init', 'edd_maybe_remove_menu_profile_links' );
includes/admin/downloads/metabox.php CHANGED
@@ -135,7 +135,7 @@ function edd_download_meta_box_save( $post_id, $post ) {
135
 
136
  } elseif ( '_edd_default_price_id' == $field && edd_has_variable_prices( $post_id ) ) {
137
 
138
- $new_default_price_id = ! empty( $_POST[$field] ) && is_numeric( $_POST[$field] ) ? (int)$_POST[$field] : 1;
139
  update_post_meta( $post_id, $field, $new_default_price_id );
140
 
141
  } else {
135
 
136
  } elseif ( '_edd_default_price_id' == $field && edd_has_variable_prices( $post_id ) ) {
137
 
138
+ $new_default_price_id = ( ! empty( $_POST[$field] ) && is_numeric( $_POST[$field] ) ) || ( 0 === (int)$_POST[$field] ) ? (int)$_POST[$field] : 1;
139
  update_post_meta( $post_id, $field, $new_default_price_id );
140
 
141
  } else {
includes/admin/reporting/export/class-batch-export-payments.php CHANGED
@@ -210,8 +210,8 @@ class EDD_Batch_Payments_Export extends EDD_Batch_Export {
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 ) {
210
 
211
  $status = $this->status;
212
  $args = array(
213
+ 'start-date' => date( 'n/d/Y', strtotime( $this->start ) ),
214
+ 'end-date' => date( 'n/d/Y', strtotime( $this->end ) ),
215
  );
216
 
217
  if( 'any' == $status ) {
includes/admin/reporting/export/class-batch-export.php CHANGED
@@ -84,6 +84,20 @@ class EDD_Batch_Export extends EDD_Export {
84
  */
85
  public $price_id = null;
86
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
87
  /**
88
  * Get things started
89
  *
@@ -96,6 +110,11 @@ class EDD_Batch_Export extends EDD_Export {
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
  }
@@ -208,10 +227,24 @@ class EDD_Batch_Export extends EDD_Export {
208
  * @return string
209
  */
210
  protected 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
 
@@ -228,6 +261,13 @@ class EDD_Batch_Export extends EDD_Export {
228
  $file .= $data;
229
  @file_put_contents( $this->file, $file );
230
 
 
 
 
 
 
 
 
231
  }
232
 
233
  /**
84
  */
85
  public $price_id = null;
86
 
87
+ /**
88
+ * Is the export file writable
89
+ *
90
+ * @since 2.4.4
91
+ */
92
+ public $is_writable = true;
93
+
94
+ /**
95
+ * Is the export file empty
96
+ *
97
+ * @since 2.4.4
98
+ */
99
+ public $is_empty = false;
100
+
101
  /**
102
  * Get things started
103
  *
110
  $this->filetype = '.csv';
111
  $this->filename = 'edd-' . $this->export_type . $this->filetype;
112
  $this->file = trailingslashit( $upload_dir['basedir'] ) . $this->filename;
113
+
114
+ if ( ! is_writeable( $upload_dir['basedir'] ) ) {
115
+ $this->is_writable = false;
116
+ }
117
+
118
  $this->step = $_step;
119
  $this->done = false;
120
  }
227
  * @return string
228
  */
229
  protected function get_file() {
230
+
231
+ $file = '';
232
+
233
+ if ( @file_exists( $this->file ) ) {
234
+
235
+ if ( ! is_writeable( $this->file ) ) {
236
+ $this->is_writable = false;
237
+ }
238
+
239
+ $file = @file_get_contents( $this->file );
240
+
241
+ } else {
242
+
243
  @file_put_contents( $this->file, '' );
244
+ @chmod( $this->file, 0664 );
245
+
246
  }
247
+
248
  return $file;
249
  }
250
 
261
  $file .= $data;
262
  @file_put_contents( $this->file, $file );
263
 
264
+ // If we have no rows after this step, mark it as an empty export
265
+ $file_rows = file( $this->file, FILE_SKIP_EMPTY_LINES);
266
+ $default_cols = $this->get_csv_cols();
267
+ $default_cols = empty( $default_cols ) ? 0 : 1;
268
+
269
+ $this->is_empty = count( $file_rows ) == $default_cols ? true : false;
270
+
271
  }
272
 
273
  /**
includes/admin/reporting/export/export-functions.php CHANGED
@@ -45,6 +45,10 @@ function edd_do_ajax_export() {
45
  die( '-1' );
46
  }
47
 
 
 
 
 
48
  $export->set_properties( $_REQUEST );
49
 
50
  $ret = $export->process_step( $step );
@@ -56,6 +60,10 @@ function edd_do_ajax_export() {
56
  $step += 1;
57
  echo json_encode( array( 'step' => $step, 'percentage' => $percentage ) ); exit;
58
 
 
 
 
 
59
  } else {
60
 
61
  $args = array_merge( $_REQUEST, array(
@@ -71,4 +79,4 @@ function edd_do_ajax_export() {
71
 
72
  }
73
  }
74
- add_action( 'wp_ajax_edd_do_ajax_export', 'edd_do_ajax_export' );
45
  die( '-1' );
46
  }
47
 
48
+ if ( ! $export->is_writable ) {
49
+ echo json_encode( array( 'error' => true, 'message' => __( 'Export location or file not writable', 'edd' ) ) ); exit;
50
+ }
51
+
52
  $export->set_properties( $_REQUEST );
53
 
54
  $ret = $export->process_step( $step );
60
  $step += 1;
61
  echo json_encode( array( 'step' => $step, 'percentage' => $percentage ) ); exit;
62
 
63
+ } elseif ( true === $export->is_empty ) {
64
+
65
+ echo json_encode( array( 'error' => true, 'message' => __( 'No data found for export parameters', 'edd' ) ) ); exit;
66
+
67
  } else {
68
 
69
  $args = array_merge( $_REQUEST, array(
79
 
80
  }
81
  }
82
+ add_action( 'wp_ajax_edd_do_ajax_export', 'edd_do_ajax_export' );
includes/admin/upload-functions.php CHANGED
@@ -150,9 +150,10 @@ function edd_get_htaccess_rules( $method = false ) {
150
  case 'direct' :
151
  default :
152
  // Prevent directory browsing and direct access to all files, except images (they must be allowed for featured images / thumbnails)
 
153
  $rules = "Options -Indexes\n";
154
  $rules .= "deny from all\n";
155
- $rules .= "<FilesMatch '\.(jpg|png|gif|mp3|ogg)$'>\n";
156
  $rules .= "Order Allow,Deny\n";
157
  $rules .= "Allow from all\n";
158
  $rules .= "</FilesMatch>\n";
150
  case 'direct' :
151
  default :
152
  // Prevent directory browsing and direct access to all files, except images (they must be allowed for featured images / thumbnails)
153
+ $allowed_filetypes = apply_filters( 'edd_protected_directory_allowed_filetypes', array( 'jpg', 'png', 'gif', 'mp3', 'ogg' ) );
154
  $rules = "Options -Indexes\n";
155
  $rules .= "deny from all\n";
156
+ $rules .= "<FilesMatch '\.(" . implode( '|', $allowed_filetypes ) . ")$'>\n";
157
  $rules .= "Order Allow,Deny\n";
158
  $rules .= "Allow from all\n";
159
  $rules .= "</FilesMatch>\n";
includes/admin/welcome.php CHANGED
@@ -448,7 +448,7 @@ class EDD_Welcome {
448
  $file = file_exists( EDD_PLUGIN_DIR . 'readme.txt' ) ? EDD_PLUGIN_DIR . 'readme.txt' : null;
449
 
450
  if ( ! $file ) {
451
- $readme = '<p>' . __( 'No valid changlog was found.', 'edd' ) . '</p>';
452
  } else {
453
  $readme = file_get_contents( $file );
454
  $readme = nl2br( esc_html( $readme ) );
448
  $file = file_exists( EDD_PLUGIN_DIR . 'readme.txt' ) ? EDD_PLUGIN_DIR . 'readme.txt' : null;
449
 
450
  if ( ! $file ) {
451
+ $readme = '<p>' . __( 'No valid changelog was found.', 'edd' ) . '</p>';
452
  } else {
453
  $readme = file_get_contents( $file );
454
  $readme = nl2br( esc_html( $readme ) );
includes/api/class-edd-api.php CHANGED
@@ -318,7 +318,7 @@ class EDD_API {
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'] ) ) ) {
@@ -341,6 +341,7 @@ class EDD_API {
341
  $this->is_valid_request = true;
342
  $wp_query->set( 'key', 'public' );
343
  }
 
344
  }
345
 
346
  /**
@@ -538,6 +539,7 @@ class EDD_API {
538
 
539
  $data = array();
540
  $this->routes = new $this->versions[ $this->get_queried_version() ];
 
541
 
542
  switch( $this->endpoint ) :
543
 
@@ -914,7 +916,7 @@ class EDD_API {
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
 
318
  }
319
 
320
  // Auth was provided, include the upgrade routine so we can use the fallback api checks
321
+ require_once 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'] ) ) ) {
341
  $this->is_valid_request = true;
342
  $wp_query->set( 'key', 'public' );
343
  }
344
+
345
  }
346
 
347
  /**
539
 
540
  $data = array();
541
  $this->routes = new $this->versions[ $this->get_queried_version() ];
542
+ $this->routes->validate_request();
543
 
544
  switch( $this->endpoint ) :
545
 
916
  $customers['customers'][$customer_count]['info']['last_name'] = $last_name;
917
  $customers['customers'][$customer_count]['info']['email'] = $customer_obj->email;
918
 
919
+ if ( ! empty( $customer_obj->user_id ) && $customer_obj->user_id > 0 ) {
920
 
921
  $user_data = get_userdata( $customer_obj->user_id );
922
 
includes/cart/functions.php CHANGED
@@ -773,7 +773,7 @@ function edd_get_purchase_summary( $purchase_data, $email = true ) {
773
  }
774
 
775
  $summary = substr( $summary, 0, -2 );
776
- }
777
 
778
  return apply_filters( 'edd_get_purchase_summary', $summary, $purchase_data, $email );
779
  }
@@ -877,13 +877,13 @@ function edd_remove_item_url( $cart_key ) {
877
 
878
  global $wp_query;
879
 
880
- if ( defined('DOING_AJAX') ) {
881
  $current_page = edd_get_checkout_uri();
882
  } else {
883
  $current_page = edd_get_current_page_url();
884
  }
885
 
886
- $remove_url = add_query_arg( array( 'cart_item' => $cart_key, 'edd_action' => 'remove', 'nocache' => current_time( 'timestamp' ) ), $current_page );
887
 
888
  return apply_filters( 'edd_remove_item_url', $remove_url );
889
  }
@@ -905,7 +905,7 @@ function edd_remove_cart_fee_url( $fee_id = '') {
905
  $current_page = edd_get_current_page_url();
906
  }
907
 
908
- $remove_url = add_query_arg( array( 'fee' => $fee_id, 'edd_action' => 'remove_fee', 'nocache' => current_time( 'timestamp' ) ), $current_page );
909
 
910
  return apply_filters( 'edd_remove_fee_url', $remove_url );
911
  }
773
  }
774
 
775
  $summary = substr( $summary, 0, -2 );
776
+ }
777
 
778
  return apply_filters( 'edd_get_purchase_summary', $summary, $purchase_data, $email );
779
  }
877
 
878
  global $wp_query;
879
 
880
+ if ( defined( 'DOING_AJAX' ) ) {
881
  $current_page = edd_get_checkout_uri();
882
  } else {
883
  $current_page = edd_get_current_page_url();
884
  }
885
 
886
+ $remove_url = edd_add_cache_busting( add_query_arg( array( 'cart_item' => $cart_key, 'edd_action' => 'remove' ), $current_page ) );
887
 
888
  return apply_filters( 'edd_remove_item_url', $remove_url );
889
  }
905
  $current_page = edd_get_current_page_url();
906
  }
907
 
908
+ $remove_url = add_query_arg( array( 'fee' => $fee_id, 'edd_action' => 'remove_fee', 'nocache' => 'true' ), $current_page );
909
 
910
  return apply_filters( 'edd_remove_fee_url', $remove_url );
911
  }
includes/checkout/functions.php CHANGED
@@ -131,8 +131,9 @@ function edd_get_checkout_uri( $args = array() ) {
131
  $uri = preg_replace( '/^http:/', 'https:', $uri );
132
  }
133
 
134
- if ( edd_get_option( 'no_cache_checkout', false ) && edd_is_caching_plugin_active() )
135
- $uri = add_query_arg( 'nocache', 'true', $uri );
 
136
 
137
  return apply_filters( 'edd_get_checkout_uri', $uri );
138
  }
@@ -323,10 +324,6 @@ function edd_enforced_ssl_redirect_handler() {
323
  return;
324
  }
325
 
326
- if ( isset( $_SERVER["HTTPS"] ) && $_SERVER["HTTPS"] == "on" ) {
327
- return;
328
- }
329
-
330
  $uri = 'https://' . $_SERVER['HTTP_HOST'] . $_SERVER['REQUEST_URI'];
331
 
332
  wp_safe_redirect( $uri );
131
  $uri = preg_replace( '/^http:/', 'https:', $uri );
132
  }
133
 
134
+ if ( edd_get_option( 'no_cache_checkout', false ) ) {
135
+ $uri = edd_add_cache_busting( $uri );
136
+ }
137
 
138
  return apply_filters( 'edd_get_checkout_uri', $uri );
139
  }
324
  return;
325
  }
326
 
 
 
 
 
327
  $uri = 'https://' . $_SERVER['HTTP_HOST'] . $_SERVER['REQUEST_URI'];
328
 
329
  wp_safe_redirect( $uri );
includes/checkout/template.php CHANGED
@@ -270,7 +270,7 @@ function edd_get_cc_form() {
270
  </select>
271
  <span class="exp-divider"> / </span>
272
  <select id="card_exp_year" name="card_exp_year" class="card-expiry-year edd-select edd-select-small required">
273
- <?php for( $i = date('Y'); $i <= date('Y') + 10; $i++ ) { echo '<option value="' . $i . '">' . substr( $i, 2 ) . '</option>'; } ?>
274
  </select>
275
  </p>
276
  <?php do_action( 'edd_after_cc_expiration' ); ?>
@@ -902,9 +902,12 @@ add_filter( 'the_content', 'edd_filter_success_page_content', 99999 );
902
  /**
903
  * Show a download's files in the purchase receipt
904
  *
905
- * @since 1.8.6
 
 
 
906
  * @return boolean
907
- */
908
- function edd_receipt_show_download_files( $item_id, $receipt_args ) {
909
- return apply_filters( 'edd_receipt_show_download_files', true, $item_id, $receipt_args );
910
  }
270
  </select>
271
  <span class="exp-divider"> / </span>
272
  <select id="card_exp_year" name="card_exp_year" class="card-expiry-year edd-select edd-select-small required">
273
+ <?php for( $i = date('Y'); $i <= date('Y') + 30; $i++ ) { echo '<option value="' . $i . '">' . substr( $i, 2 ) . '</option>'; } ?>
274
  </select>
275
  </p>
276
  <?php do_action( 'edd_after_cc_expiration' ); ?>
902
  /**
903
  * Show a download's files in the purchase receipt
904
  *
905
+ * @since 1.8.6
906
+ * @param int $item_id The download ID
907
+ * @param array $receipt_args Args specified in the [edd_receipt] shortcode
908
+ * @param array $item Cart item array
909
  * @return boolean
910
+ */
911
+ function edd_receipt_show_download_files( $item_id, $receipt_args, $item ) {
912
+ return apply_filters( 'edd_receipt_show_download_files', true, $item_id, $receipt_args, $item );
913
  }
includes/misc-functions.php CHANGED
@@ -425,29 +425,45 @@ function edd_get_php_arg_separator_output() {
425
  * Get the current page URL
426
  *
427
  * @since 1.3
428
- * @global $post
429
  * @return string $page_url Current page URL
430
  */
431
- function edd_get_current_page_url() {
432
- global $post;
433
 
434
- if ( is_front_page() ) :
435
- $page_url = home_url();
436
- else :
437
- $page_url = 'http';
438
 
439
- if ( isset( $_SERVER["HTTPS"] ) && $_SERVER["HTTPS"] == "on" )
440
- $page_url .= "s";
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
441
 
442
- $page_url .= "://";
443
 
444
- if ( isset( $_SERVER["SERVER_PORT"] ) && $_SERVER["SERVER_PORT"] != "80" )
445
- $page_url .= $_SERVER["SERVER_NAME"].":".$_SERVER["SERVER_PORT"].$_SERVER["REQUEST_URI"];
446
- else
447
- $page_url .= $_SERVER["SERVER_NAME"].$_SERVER["REQUEST_URI"];
448
- endif;
449
 
450
- return apply_filters( 'edd_get_current_page_url', esc_url( $page_url ) );
451
  }
452
 
453
  /**
@@ -794,3 +810,44 @@ if ( ! function_exists( 'getallheaders' ) ) :
794
  }
795
 
796
  endif;
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
425
  * Get the current page URL
426
  *
427
  * @since 1.3
428
+ * @param bool $nocache If we should bust cache on the returned URL
429
  * @return string $page_url Current page URL
430
  */
431
+ function edd_get_current_page_url( $nocache = false ) {
 
432
 
433
+ $scheme = is_ssl() ? 'https' : 'http';
434
+ $uri = esc_url( site_url( $_SERVER['REQUEST_URI'], $scheme ) );
 
 
435
 
436
+ if ( is_front_page() ) {
437
+ $uri = home_url();
438
+ } elseif ( edd_is_checkout( array(), false ) ) {
439
+ $uri = edd_get_checkout_uri();
440
+ }
441
+
442
+ $uri = apply_filters( 'edd_get_current_page_url', $uri );
443
+
444
+ if ( $nocache ) {
445
+ $uri = edd_add_cache_busting( $uri );
446
+ }
447
+
448
+ return $uri;
449
+ }
450
+
451
+ /**
452
+ * Adds the 'nocache' parameter to the provided URL
453
+ *
454
+ * @since 2.4.4
455
+ * @param string $url The URL being requested
456
+ * @return string The URL with cache busting added or not
457
+ */
458
+ function edd_add_cache_busting( $url = '' ) {
459
 
460
+ $no_cache_checkout = edd_get_option( 'no_cache_checkout', false );
461
 
462
+ if ( edd_is_caching_plugin_active() || ( edd_is_checkout() && $no_cache_checkout ) ) {
463
+ $url = add_query_arg( 'nocache', 'true', $url );
464
+ }
 
 
465
 
466
+ return $url;
467
  }
468
 
469
  /**
810
  }
811
 
812
  endif;
813
+
814
+ /**
815
+ * Determines the receipt visibility status
816
+ *
817
+ * @return bool Whether the receipt is visible or not.
818
+ */
819
+ function edd_can_view_receipt( $payment_key = '' ) {
820
+
821
+ $return = false;
822
+
823
+ if ( empty( $payment_key ) ) {
824
+ return $return;
825
+ }
826
+
827
+ global $edd_receipt_args;
828
+
829
+ $edd_receipt_args['id'] = edd_get_purchase_id_by_key( $payment_key );
830
+
831
+ $user_id = (int) edd_get_payment_user_id( $edd_receipt_args['id'] );
832
+
833
+ $payment_meta = edd_get_payment_meta( $edd_receipt_args['id'] );
834
+
835
+ if ( is_user_logged_in() ) {
836
+ if ( $user_id === (int) get_current_user_id() ) {
837
+ $return = true;
838
+ } elseif ( wp_get_current_user()->user_email === edd_get_payment_user_email( $edd_receipt_args['id'] ) ) {
839
+ $return = true;
840
+ } elseif ( current_user_can( 'view_shop_sensitive_data' ) ) {
841
+ $return = true;
842
+ }
843
+ }
844
+
845
+ $session = edd_get_purchase_session();
846
+ if ( ! empty( $session ) && ! is_user_logged_in() ) {
847
+ if ( $session['purchase_key'] === $payment_meta['key'] ) {
848
+ $return = true;
849
+ }
850
+ }
851
+
852
+ return (bool) apply_filters( 'edd_can_view_receipt', $return, $payment_key );
853
+ }
includes/payments/functions.php CHANGED
@@ -489,7 +489,7 @@ function edd_count_payments( $args = array() ) {
489
  }
490
 
491
  // Limit payments count by date
492
- if ( ! empty( $args['start-date'] ) && false !== strpos( '/', $args['start-date'] ) ) {
493
 
494
  $date_parts = explode( '/', $args['start-date'] );
495
  $month = ! empty( $date_parts[0] ) && is_numeric( $date_parts[0] ) ? $date_parts[0] : 0;
@@ -511,7 +511,7 @@ function edd_count_payments( $args = array() ) {
511
 
512
  }
513
 
514
- if ( ! empty ( $args['end-date'] ) && false !== strpos( '/', $args['end-date'] ) ) {
515
 
516
  $date_parts = explode( '/', $args['end-date'] );
517
 
@@ -532,8 +532,6 @@ function edd_count_payments( $args = array() ) {
532
  $where = apply_filters( 'edd_count_payments_where', $where );
533
  $join = apply_filters( 'edd_count_payments_join', $join );
534
 
535
- $cache_key = md5( implode( '|', $args ) . $where );
536
-
537
  $query = "SELECT p.post_status,count( * ) AS num_posts
538
  FROM $wpdb->posts p
539
  $join
@@ -541,9 +539,12 @@ function edd_count_payments( $args = array() ) {
541
  GROUP BY p.post_status
542
  ";
543
 
 
 
544
  $count = wp_cache_get( $cache_key, 'counts');
545
- if ( false !== $count )
546
  return $count;
 
547
 
548
  $count = $wpdb->get_results( $query, ARRAY_A );
549
 
@@ -1054,6 +1055,20 @@ function edd_get_payment_user_email( $payment_id ) {
1054
  return apply_filters( 'edd_payment_user_email', $email );
1055
  }
1056
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1057
  /**
1058
  * Get the user ID associated with a payment
1059
  *
@@ -1062,9 +1077,37 @@ function edd_get_payment_user_email( $payment_id ) {
1062
  * @return string $user_id User ID
1063
  */
1064
  function edd_get_payment_user_id( $payment_id ) {
1065
- $user_id = edd_get_payment_meta( $payment_id, '_edd_payment_user_id', true );
1066
 
1067
- return apply_filters( 'edd_payment_user_id', $user_id );
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1068
  }
1069
 
1070
  /**
489
  }
490
 
491
  // Limit payments count by date
492
+ if ( ! empty( $args['start-date'] ) && false !== strpos( $args['start-date'], '/' ) ) {
493
 
494
  $date_parts = explode( '/', $args['start-date'] );
495
  $month = ! empty( $date_parts[0] ) && is_numeric( $date_parts[0] ) ? $date_parts[0] : 0;
511
 
512
  }
513
 
514
+ if ( ! empty ( $args['end-date'] ) && false !== strpos( $args['end-date'], '/' ) ) {
515
 
516
  $date_parts = explode( '/', $args['end-date'] );
517
 
532
  $where = apply_filters( 'edd_count_payments_where', $where );
533
  $join = apply_filters( 'edd_count_payments_join', $join );
534
 
 
 
535
  $query = "SELECT p.post_status,count( * ) AS num_posts
536
  FROM $wpdb->posts p
537
  $join
539
  GROUP BY p.post_status
540
  ";
541
 
542
+ $cache_key = md5( $query );
543
+
544
  $count = wp_cache_get( $cache_key, 'counts');
545
+ if ( false !== $count ) {
546
  return $count;
547
+ }
548
 
549
  $count = $wpdb->get_results( $query, ARRAY_A );
550
 
1055
  return apply_filters( 'edd_payment_user_email', $email );
1056
  }
1057
 
1058
+ /**
1059
+ * Is the payment provided associated with a user account
1060
+ *
1061
+ * @since 2.4.4
1062
+ * @param int $payment_id The payment ID
1063
+ * @return bool If the payment is associted with a user (false) or not (true)
1064
+ */
1065
+ function edd_is_guest_payment( $payment_id ) {
1066
+ $payment_user_id = edd_get_payment_user_id( $payment_id );
1067
+ $is_guest_payment = ! empty( $payment_user_id ) && $payment_user_id > 0 ? false : true;
1068
+
1069
+ return (bool) apply_filters( 'edd_is_guest_payment', $is_guest_payment, $payment_id );
1070
+ }
1071
+
1072
  /**
1073
  * Get the user ID associated with a payment
1074
  *
1077
  * @return string $user_id User ID
1078
  */
1079
  function edd_get_payment_user_id( $payment_id ) {
 
1080
 
1081
+ $user_id = -1;
1082
+
1083
+ // check the customer record first
1084
+ $customer_id = edd_get_payment_customer_id( $payment_id );
1085
+ $customer = new EDD_Customer( $customer_id );
1086
+
1087
+ if ( ! empty( $customer->user_id ) && $customer->user_id > 0 ) {
1088
+ $user_id = $customer->user_id;
1089
+ }
1090
+
1091
+ // check the payment meta if we're still not finding a user with the customer record
1092
+ if ( empty( $user_id ) || $user_id < 1 ) {
1093
+ $payment_meta_user_id = edd_get_payment_meta( $payment_id, '_edd_payment_user_id', true );
1094
+
1095
+ if ( ! empty( $payment_meta_user_id ) ) {
1096
+ $user_id = $payment_meta_user_id;
1097
+ }
1098
+ }
1099
+
1100
+ // Last ditch effort is to connect payment email with a user in the user table
1101
+ if ( empty( $user_id ) || $user_id < 1 ) {
1102
+ $payment_email = edd_get_payment_user_email( $payment_id );
1103
+ $user = get_user_by( 'email', $payment_email );
1104
+
1105
+ if ( false !== $user ) {
1106
+ $user_id = $user->ID;
1107
+ }
1108
+ }
1109
+
1110
+ return apply_filters( 'edd_payment_user_id', (int) $user_id );
1111
  }
1112
 
1113
  /**
includes/plugin-compatibility.php CHANGED
@@ -51,7 +51,7 @@ add_action( 'template_redirect', 'edd_disable_jetpack_og_on_checkout' );
51
  * @return bool $caching True if caching plugin is enabled, false otherwise
52
  */
53
  function edd_is_caching_plugin_active() {
54
- $caching = ( function_exists( 'wpsupercache_site_admin' ) || defined( 'W3TC' ) );
55
  return apply_filters( 'edd_is_caching_plugin_active', $caching );
56
  }
57
 
51
  * @return bool $caching True if caching plugin is enabled, false otherwise
52
  */
53
  function edd_is_caching_plugin_active() {
54
+ $caching = ( function_exists( 'wpsupercache_site_admin' ) || defined( 'W3TC' ) || function_exists( 'rocket_init' ) );
55
  return apply_filters( 'edd_is_caching_plugin_active', $caching );
56
  }
57
 
includes/scripts.php CHANGED
@@ -171,7 +171,7 @@ function edd_load_admin_scripts( $hook ) {
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(
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', 'inline-edit-post' ), EDD_VERSION, false );
175
  wp_enqueue_script( 'edd-admin-scripts' );
176
 
177
  wp_localize_script( 'edd-admin-scripts', 'edd_vars', array(
includes/shortcodes.php CHANGED
@@ -33,7 +33,7 @@ function edd_download_shortcode( $atts, $content = null ) {
33
  'sku' => '',
34
  'price' => '1',
35
  'direct' => '0',
36
- 'text' => edd_get_option( 'add_to_cart_text', __( 'Purchase', 'edd' ) ),
37
  'style' => edd_get_option( 'button_style', 'button' ),
38
  'color' => edd_get_option( 'checkout_color', 'blue' ),
39
  'class' => 'edd-submit',
@@ -41,9 +41,13 @@ function edd_download_shortcode( $atts, $content = null ) {
41
  ),
42
  $atts, 'purchase_link' );
43
 
44
- // Override text if direct == 1
45
- if( $atts['direct'] == '1' || $atts['direct'] == 'true' ) {
46
- $atts['text'] = edd_get_option( 'buy_now_text', __( 'Buy Now', 'edd' ) );
 
 
 
 
47
  }
48
 
49
  // Override color if color == inherit
@@ -82,7 +86,17 @@ add_shortcode( 'purchase_link', 'edd_download_shortcode' );
82
  function edd_download_history() {
83
  if ( is_user_logged_in() ) {
84
  ob_start();
85
- edd_get_template_part( 'history', 'downloads' );
 
 
 
 
 
 
 
 
 
 
86
  return ob_get_clean();
87
  }
88
  }
@@ -98,7 +112,17 @@ add_shortcode( 'download_history', 'edd_download_history' );
98
  */
99
  function edd_purchase_history() {
100
  ob_start();
101
- edd_get_template_part( 'history', 'purchases' );
 
 
 
 
 
 
 
 
 
 
102
  return ob_get_clean();
103
  }
104
  add_shortcode( 'purchase_history', 'edd_purchase_history' );
@@ -277,20 +301,29 @@ function edd_downloads_query( $atts, $content = null ) {
277
  'thumbnails' => 'true',
278
  'orderby' => 'post_date',
279
  'order' => 'DESC',
280
- 'ids' => ''
 
281
  ), $atts, 'downloads' );
282
 
283
  $query = array(
284
  'post_type' => 'download',
285
- 'posts_per_page' => (int) $atts['number'],
286
  'orderby' => $atts['orderby'],
287
  'order' => $atts['order']
288
  );
289
 
290
- if ( $query['posts_per_page'] < -1 ) {
291
- $query['posts_per_page'] = abs( $query['posts_per_page'] );
 
 
 
 
 
 
 
292
  }
293
 
 
 
294
  switch ( $atts['orderby'] ) {
295
  case 'price':
296
  $atts['orderby'] = 'meta_value';
@@ -633,11 +666,27 @@ function edd_receipt_shortcode( $atts, $content = null ) {
633
  }
634
 
635
  // No key found
636
- if ( ! isset( $payment_key ) )
637
- return $edd_receipt_args['error'];
 
638
 
639
- $edd_receipt_args['id'] = edd_get_purchase_id_by_key( $payment_key );
640
- $customer_id = edd_get_payment_user_id( $edd_receipt_args['id'] );
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
641
 
642
  /*
643
  * Check if the user has permission to view the receipt
@@ -650,10 +699,9 @@ function edd_receipt_shortcode( $atts, $content = null ) {
650
  *
651
  */
652
 
653
- $user_can_view = ( is_user_logged_in() && $customer_id == get_current_user_id() ) || ( ( $customer_id == 0 || $customer_id == '-1' ) && ! is_user_logged_in() && edd_get_purchase_session() ) || current_user_can( 'view_shop_sensitive_data' );
654
 
655
  if ( ! apply_filters( 'edd_user_can_view_receipt', $user_can_view, $edd_receipt_args ) ) {
656
- return $edd_receipt_args['error'];
657
  }
658
 
659
  ob_start();
@@ -688,7 +736,15 @@ add_shortcode( 'edd_receipt', 'edd_receipt_shortcode' );
688
  function edd_profile_editor_shortcode( $atts, $content = null ) {
689
  ob_start();
690
 
691
- edd_get_template_part( 'shortcode', 'profile-editor' );
 
 
 
 
 
 
 
 
692
 
693
  $display = ob_get_clean();
694
 
@@ -708,12 +764,19 @@ add_shortcode( 'edd_profile_editor', 'edd_profile_editor_shortcode' );
708
  */
709
  function edd_process_profile_editor_updates( $data ) {
710
  // Profile field change request
711
- if ( empty( $_POST['edd_profile_editor_submit'] ) && !is_user_logged_in() )
712
  return false;
 
 
 
 
 
 
713
 
714
  // Nonce security
715
- if ( ! wp_verify_nonce( $data['edd_profile_editor_nonce'], 'edd-profile-editor-nonce' ) )
716
  return false;
 
717
 
718
  $user_id = get_current_user_id();
719
  $old_user_data = get_userdata( $user_id );
33
  'sku' => '',
34
  'price' => '1',
35
  'direct' => '0',
36
+ 'text' => '',
37
  'style' => edd_get_option( 'button_style', 'button' ),
38
  'color' => edd_get_option( 'checkout_color', 'blue' ),
39
  'class' => 'edd-submit',
41
  ),
42
  $atts, 'purchase_link' );
43
 
44
+ // Override text only if not provided / empty
45
+ if ( ! $atts['text'] ) {
46
+ if( $atts['direct'] == '1' || $atts['direct'] == 'true' ) {
47
+ $atts['text'] = edd_get_option( 'buy_now_text', __( 'Buy Now', 'edd' ) );
48
+ } else {
49
+ $atts['text'] = edd_get_option( 'add_to_cart_text', __( 'Purchase', 'edd' ) );
50
+ }
51
  }
52
 
53
  // Override color if color == inherit
86
  function edd_download_history() {
87
  if ( is_user_logged_in() ) {
88
  ob_start();
89
+
90
+ if( ! edd_user_pending_verification() ) {
91
+
92
+ edd_get_template_part( 'history', 'downloads' );
93
+
94
+ } else {
95
+
96
+ edd_get_template_part( 'account', 'pending' );
97
+
98
+ }
99
+
100
  return ob_get_clean();
101
  }
102
  }
112
  */
113
  function edd_purchase_history() {
114
  ob_start();
115
+
116
+ if( ! edd_user_pending_verification() ) {
117
+
118
+ edd_get_template_part( 'history', 'purchases' );
119
+
120
+ } else {
121
+
122
+ edd_get_template_part( 'account', 'pending' );
123
+
124
+ }
125
+
126
  return ob_get_clean();
127
  }
128
  add_shortcode( 'purchase_history', 'edd_purchase_history' );
301
  'thumbnails' => 'true',
302
  'orderby' => 'post_date',
303
  'order' => 'DESC',
304
+ 'ids' => '',
305
+ 'pagination' => 'true'
306
  ), $atts, 'downloads' );
307
 
308
  $query = array(
309
  'post_type' => 'download',
 
310
  'orderby' => $atts['orderby'],
311
  'order' => $atts['order']
312
  );
313
 
314
+ if( 'true' === $atts['pagination'] ) {
315
+
316
+ $query['posts_per_page'] = (int) $atts['number'];
317
+
318
+ if ( $query['posts_per_page'] < 0 ) {
319
+ $query['posts_per_page'] = abs( $query['posts_per_page'] );
320
+ }
321
+ } else {
322
+ $query['nopaging'] = true;
323
  }
324
 
325
+
326
+
327
  switch ( $atts['orderby'] ) {
328
  case 'price':
329
  $atts['orderby'] = 'meta_value';
666
  }
667
 
668
  // No key found
669
+ if ( ! isset( $payment_key ) ) {
670
+ return '<p class="edd-alert edd-alert-error">' . $edd_receipt_args['error'] . '</p>';
671
+ }
672
 
673
+ $payment_id = edd_get_purchase_id_by_key( $payment_key );
674
+ $user_can_view = edd_can_view_receipt( $payment_key );
675
+
676
+ // Key was provided, but user is logged out. Offer them the ability to login and view the receipt
677
+ if ( ! $user_can_view && ! empty( $payment_key ) && ! is_user_logged_in() && ! edd_is_guest_payment( $payment_id ) ) {
678
+ global $edd_login_redirect;
679
+ $edd_login_redirect = edd_get_current_page_url();
680
+
681
+ ob_start();
682
+
683
+ echo '<p class="edd-alert edd-alert-warn">' . __( 'You must be logged in to view this payment receipt.', 'edd' ) . '</p>';
684
+ edd_get_template_part( 'shortcode', 'login' );
685
+
686
+ $login_form = ob_get_clean();
687
+
688
+ return $login_form;
689
+ }
690
 
691
  /*
692
  * Check if the user has permission to view the receipt
699
  *
700
  */
701
 
 
702
 
703
  if ( ! apply_filters( 'edd_user_can_view_receipt', $user_can_view, $edd_receipt_args ) ) {
704
+ return '<p class="edd-alert edd-alert-error">' . $edd_receipt_args['error'] . '</p>';
705
  }
706
 
707
  ob_start();
736
  function edd_profile_editor_shortcode( $atts, $content = null ) {
737
  ob_start();
738
 
739
+ if( ! edd_user_pending_verification() ) {
740
+
741
+ edd_get_template_part( 'shortcode', 'profile-editor' );
742
+
743
+ } else {
744
+
745
+ edd_get_template_part( 'account', 'pending' );
746
+
747
+ }
748
 
749
  $display = ob_get_clean();
750
 
764
  */
765
  function edd_process_profile_editor_updates( $data ) {
766
  // Profile field change request
767
+ if ( empty( $_POST['edd_profile_editor_submit'] ) && !is_user_logged_in() ) {
768
  return false;
769
+ }
770
+
771
+ // Pending users can't edit their profile
772
+ if ( edd_user_pending_verification() ) {
773
+ return false;
774
+ }
775
 
776
  // Nonce security
777
+ if ( ! wp_verify_nonce( $data['edd_profile_editor_nonce'], 'edd-profile-editor-nonce' ) ) {
778
  return false;
779
+ }
780
 
781
  $user_id = get_current_user_id();
782
  $old_user_data = get_userdata( $user_id );
includes/user-functions.php CHANGED
@@ -136,6 +136,9 @@ function edd_get_users_purchased_products( $user = 0, $status = 'complete' ) {
136
  $purchase_product_ids[] = @wp_list_pluck( $purchase_meta, 'id' );
137
  }
138
 
 
 
 
139
  if ( empty( $purchase_product_ids ) ) {
140
  return false;
141
  }
@@ -262,12 +265,17 @@ function edd_get_purchase_stats_by_user( $user = '' ) {
262
 
263
  }
264
 
 
265
  $customer = EDD()->customers->get_customer_by( $field, $user );
266
- $customer = new EDD_Customer( $customer->id );
267
 
268
- $stats = array();
269
- $stats['purchases'] = absint( $customer->purchase_count );
270
- $stats['total_spent'] = edd_sanitize_amount( $customer->purchase_value );
 
 
 
 
 
271
 
272
 
273
  return (array) apply_filters( 'edd_purchase_stats_by_user', $stats, $user );
@@ -373,6 +381,12 @@ function edd_add_past_purchases_to_new_user( $user_id ) {
373
  $payments = edd_get_payments( array( 's' => $email ) );
374
 
375
  if( $payments ) {
 
 
 
 
 
 
376
  foreach( $payments as $payment ) {
377
  if( intval( edd_get_payment_user_id( $payment->ID ) ) > 0 )
378
  continue; // This payment already associated with an account
@@ -452,6 +466,380 @@ function edd_new_user_notification( $user_id = 0, $user_data = array() ) {
452
  return;
453
  }
454
 
455
- wp_new_user_notification( $user_id, __( '[Password entered at checkout]', 'edd' ) );
 
 
 
 
 
 
 
 
 
 
 
 
456
  }
457
  add_action( 'edd_insert_user', 'edd_new_user_notification', 10, 2 );
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
136
  $purchase_product_ids[] = @wp_list_pluck( $purchase_meta, 'id' );
137
  }
138
 
139
+ // Ensure that grabbed products actually HAVE downloads
140
+ $purchase_product_ids = array_filter( $purchase_product_ids );
141
+
142
  if ( empty( $purchase_product_ids ) ) {
143
  return false;
144
  }
265
 
266
  }
267
 
268
+ $stats = array();
269
  $customer = EDD()->customers->get_customer_by( $field, $user );
 
270
 
271
+ if( $customer ) {
272
+
273
+ $customer = new EDD_Customer( $customer->id );
274
+
275
+ $stats['purchases'] = absint( $customer->purchase_count );
276
+ $stats['total_spent'] = edd_sanitize_amount( $customer->purchase_value );
277
+
278
+ }
279
 
280
 
281
  return (array) apply_filters( 'edd_purchase_stats_by_user', $stats, $user );
381
  $payments = edd_get_payments( array( 's' => $email ) );
382
 
383
  if( $payments ) {
384
+
385
+ // Set a flag to force the account to be verified before purchase history can be accessed
386
+ edd_set_user_to_pending( $user_id );
387
+
388
+ edd_send_user_verification_email( $user_id );
389
+
390
  foreach( $payments as $payment ) {
391
  if( intval( edd_get_payment_user_id( $payment->ID ) ) > 0 )
392
  continue; // This payment already associated with an account
466
  return;
467
  }
468
 
469
+ $blogname = wp_specialchars_decode( get_option( 'blogname' ), ENT_QUOTES );
470
+ $message = sprintf( __( 'New user registration on your site %s:' ), $blogname ) . "\r\n\r\n";
471
+ $message .= sprintf( __( 'Username: %s'), $user_data['user_login'] ) . "\r\n\r\n";
472
+ $message .= sprintf( __( 'E-mail: %s'), $user_data['user_email'] ) . "\r\n";
473
+
474
+ @wp_mail( get_option( 'admin_email' ), sprintf( __('[%s] New User Registration' ), $blogname ), $message );
475
+
476
+ $message = sprintf( __( 'Username: %s' ), $user_data['user_login'] ) . "\r\n";
477
+ $message .= sprintf( __( 'Password: %s' ), __( '[Password entered at checkout]', 'edd' ) ) . "\r\n";
478
+ $message .= wp_login_url() . "\r\n";
479
+
480
+ wp_mail( $user_data['user_email'], sprintf( __( '[%s] Your username and password' ), $blogname ), $message );
481
+
482
  }
483
  add_action( 'edd_insert_user', 'edd_new_user_notification', 10, 2 );
484
+
485
+ /**
486
+ * Set a user's status to pending
487
+ *
488
+ * @since 2.4.4
489
+ * @param integer $user_id The User ID to set to pending
490
+ * @return bool If the update was successful
491
+ */
492
+ function edd_set_user_to_pending( $user_id = 0 ) {
493
+ if ( empty( $user_id ) ) {
494
+ return false;
495
+ }
496
+
497
+ do_action( 'edd_pre_set_user_to_pending', $user_id );
498
+
499
+ $update_successful = (bool) update_user_meta( $user_id, '_edd_pending_verification', '1' );
500
+
501
+ do_action( 'edd_post_set_user_to_pending', $user_id, $update_successful );
502
+
503
+ return $update_successful;
504
+ }
505
+
506
+ /**
507
+ * Set the user from pending to active
508
+ *
509
+ * @since 2.4.4
510
+ * @param integer $user_id The User ID to activate
511
+ * @return bool If the user was marked as active or not
512
+ */
513
+ function edd_set_user_to_verified( $user_id = 0 ) {
514
+
515
+ if ( empty( $user_id ) ) {
516
+ return false;
517
+ }
518
+
519
+ if ( ! edd_user_pending_verification( $user_id ) ) {
520
+ return false;
521
+ }
522
+
523
+ do_action( 'edd_pre_set_user_to_active', $user_id );
524
+
525
+ $update_successful = delete_user_meta( $user_id, '_edd_pending_verification', '1' );
526
+
527
+ do_action( 'edd_post_set_user_to_active', $user_id, $update_successful );
528
+
529
+ return $update_successful;
530
+ }
531
+
532
+ /**
533
+ * Determines if the user account is pending verification. Pending accounts cannot view purchase history
534
+ *
535
+ * @access public
536
+ * @since 2.4.4
537
+ * @return bool
538
+ */
539
+ function edd_user_pending_verification( $user_id = 0 ) {
540
+
541
+ if( empty( $user_id ) ) {
542
+ $user_id = get_current_user_id();
543
+ }
544
+
545
+ // No need to run a DB lookup on an empty user id
546
+ if ( empty( $user_id ) ) {
547
+ return false;
548
+ }
549
+
550
+ $pending = get_user_meta( $user_id, '_edd_pending_verification', true );
551
+
552
+ return (bool) apply_filters( 'edd_user_pending_verification', ! empty( $pending ), $user_id );
553
+
554
+ }
555
+
556
+ /**
557
+ * Gets the activation URL for the specified user
558
+ *
559
+ * @access public
560
+ * @since 2.4.4
561
+ * @return string
562
+ */
563
+ function edd_get_user_verification_url( $user_id = 0 ) {
564
+
565
+ if( empty( $user_id ) ) {
566
+ return false;
567
+ }
568
+
569
+ $base_url = add_query_arg( array(
570
+ 'edd_action' => 'verify_user',
571
+ 'user_id' => $user_id,
572
+ 'ttl' => strtotime( '+24 hours' )
573
+ ), untrailingslashit( get_permalink( edd_get_option( 'purchase_history_page', 0 ) ) ) );
574
+
575
+ $token = edd_get_user_verification_token( $base_url );
576
+ $url = add_query_arg( 'token', $token, $base_url );
577
+
578
+ return apply_filters( 'edd_get_user_verification_url', $url, $user_id );
579
+
580
+ }
581
+
582
+ /**
583
+ * Gets the URL that triggers a new verification email to be sent
584
+ *
585
+ * @access public
586
+ * @since 2.4.4
587
+ * @return string
588
+ */
589
+ function edd_get_user_verification_request_url( $user_id = 0 ) {
590
+
591
+ if( empty( $user_id ) ) {
592
+ $user_id = get_current_user_id();
593
+ }
594
+
595
+ $url = wp_nonce_url( add_query_arg( array(
596
+ 'edd_action' => 'send_verification_email'
597
+ ) ), 'edd-request-verification' );
598
+
599
+ return apply_filters( 'edd_get_user_verification_request_url', $url, $user_id );
600
+
601
+ }
602
+
603
+ /**
604
+ * Sends an email to the specified user with a URL to verify their account
605
+ *
606
+ * @access public
607
+ * @since 2.4.4
608
+ * @return void
609
+ */
610
+ function edd_send_user_verification_email( $user_id = 0 ) {
611
+
612
+ if( empty( $user_id ) ) {
613
+ return;
614
+ }
615
+
616
+ if( ! edd_user_pending_verification( $user_id ) ) {
617
+ return;
618
+ }
619
+
620
+ $user_data = get_userdata( $user_id );
621
+
622
+ if( ! $user_data ) {
623
+ return;
624
+ }
625
+
626
+ $verify_url = edd_get_user_verification_url( $user_id );
627
+ $name = $user_data->display_name;
628
+ $url = edd_get_user_verification_url( $user_id );
629
+ $from_name = edd_get_option( 'from_name', wp_specialchars_decode( get_bloginfo( 'name' ), ENT_QUOTES ) );
630
+ $from_email = edd_get_option( 'from_email', get_bloginfo( 'admin_email' ) );
631
+ $subject = apply_filters( 'edd_user_verification_email_subject', __( 'Verify your account', 'edd' ), $user_id );
632
+ $heading = apply_filters( 'edd_user_verification_email_heading', __( 'Verify your account', 'edd' ), $user_id );
633
+ $message = sprintf( __( "Hello %s,\n\nYour account with %s needs to be verified before you can access your purchase history. <a href='%s'>Click here</a> to verify your account.", 'edd' ), $name, $from_name, $url );
634
+ $message = apply_filters( 'edd_user_verification_email_message', $message, $user_id );
635
+
636
+ $emails = new EDD_Emails;
637
+
638
+ $emails->__set( 'from_name', $from_name );
639
+ $emails->__set( 'from_email', $from_email );
640
+ $emails->__set( 'heading', $heading );
641
+
642
+ $emails->send( $user_data->user_email, $subject, $message );
643
+
644
+ }
645
+
646
+ /**
647
+ * Generates a token for a user verification URL.
648
+ *
649
+ * An 'o' query parameter on a URL can include optional variables to test
650
+ * against when verifying a token without passing those variables around in
651
+ * the URL. For example, downloads can be limited to the IP that the URL was
652
+ * generated for by adding 'o=ip' to the query string.
653
+ *
654
+ * Or suppose when WordPress requested a URL for automatic updates, the user
655
+ * agent could be tested to ensure the URL is only valid for requests from
656
+ * that user agent.
657
+ *
658
+ * @since 2.4.4
659
+ *
660
+ * @param string $url The URL to generate a token for.
661
+ * @return string The token for the URL.
662
+ */
663
+ function edd_get_user_verification_token( $url = '' ) {
664
+
665
+ $args = array();
666
+ $hash = apply_filters( 'edd_get_user_verification_token_algorithm', 'sha256' );
667
+ $secret = apply_filters( 'edd_get_user_verification_token_secret', hash( $hash, wp_salt() ) );
668
+
669
+ /*
670
+ * Add additional args to the URL for generating the token.
671
+ * Allows for restricting access to IP and/or user agent.
672
+ */
673
+ $parts = parse_url( $url );
674
+ $options = array();
675
+
676
+ if ( isset( $parts['query'] ) ) {
677
+
678
+ wp_parse_str( $parts['query'], $query_args );
679
+
680
+ // o = option checks (ip, user agent).
681
+ if ( ! empty( $query_args['o'] ) ) {
682
+
683
+ // Multiple options can be checked by separating them with a colon in the query parameter.
684
+ $options = explode( ':', rawurldecode( $query_args['o'] ) );
685
+
686
+ if ( in_array( 'ip', $options ) ) {
687
+
688
+ $args['ip'] = edd_get_ip();
689
+
690
+ }
691
+
692
+ if ( in_array( 'ua', $options ) ) {
693
+
694
+ $ua = isset( $_SERVER['HTTP_USER_AGENT'] ) ? $_SERVER['HTTP_USER_AGENT'] : '';
695
+ $args['user_agent'] = rawurlencode( $ua );
696
+
697
+ }
698
+
699
+ }
700
+
701
+ }
702
+
703
+ /*
704
+ * Filter to modify arguments and allow custom options to be tested.
705
+ * Be sure to rawurlencode any custom options for consistent results.
706
+ */
707
+ $args = apply_filters( 'edd_get_user_verification_token_args', $args, $url, $options );
708
+
709
+ $args['secret'] = $secret;
710
+ $args['token'] = false; // Removes a token if present.
711
+
712
+ $url = add_query_arg( $args, $url );
713
+ $parts = parse_url( $url );
714
+
715
+ // In the event there isn't a path, set an empty one so we can MD5 the token
716
+ if ( ! isset( $parts['path'] ) ) {
717
+
718
+ $parts['path'] = '';
719
+
720
+ }
721
+
722
+ $token = md5( $parts['path'] . '?' . $parts['query'] );
723
+
724
+ return $token;
725
+
726
+ }
727
+
728
+ /**
729
+ * Generate a token for a URL and match it against the existing token to make
730
+ * sure the URL hasn't been tampered with.
731
+ *
732
+ * @since 2.4.4
733
+ *
734
+ * @param string $url URL to test.
735
+ * @return bool
736
+ */
737
+ function edd_validate_user_verification_token( $url = '' ) {
738
+
739
+ $ret = false;
740
+ $parts = parse_url( $url );
741
+ $query_args = array();
742
+
743
+ if ( isset( $parts['query'] ) ) {
744
+
745
+ wp_parse_str( $parts['query'], $query_args );
746
+
747
+ if ( isset( $query_args['ttl'] ) && current_time( 'timestamp' ) > $query_args['ttl'] ) {
748
+
749
+ do_action( 'edd_user_verification_token_expired' );
750
+
751
+ wp_die( apply_filters( 'edd_verification_link_expired_text', __( 'Sorry but your account verification link has expired. <a href="#">Click here</a> to request a new verification URL.', 'edd' ) ), __( 'Error', 'edd' ), array( 'response' => 403 ) );
752
+
753
+ }
754
+
755
+ if ( isset( $query_args['token'] ) && $query_args['token'] == edd_get_user_verification_token( $url ) ) {
756
+
757
+ $ret = true;
758
+
759
+ }
760
+
761
+ }
762
+
763
+ return apply_filters( 'edd_validate_user_verification_token', $ret, $url, $query_args );
764
+ }
765
+
766
+ /**
767
+ * Processes an account verification email request
768
+ *
769
+ * @since 2.4.4
770
+ *
771
+ * @return void
772
+ */
773
+ function edd_process_user_verification_request() {
774
+
775
+ if( ! wp_verify_nonce( $_GET['_wpnonce'], 'edd-request-verification' ) ) {
776
+ wp_die( __( 'Nonce verification failed.', 'edd' ), __( 'Error', 'edd' ), array( 'response' => 403 ) );
777
+ }
778
+
779
+ if( ! is_user_logged_in() ) {
780
+ wp_die( __( 'You must be logged in to verify your account.', 'edd' ), __( 'Notice', 'edd' ), array( 'response' => 403 ) );
781
+ }
782
+
783
+ if( ! edd_user_pending_verification( get_current_user_id() ) ) {
784
+ wp_die( __( 'Your account has already been verified.', 'edd' ), __( 'Notice', 'edd' ), array( 'response' => 403 ) );
785
+ }
786
+
787
+ edd_send_user_verification_email( get_current_user_id() );
788
+
789
+ $redirect = apply_filters(
790
+ 'edd_user_account_verification_request_redirect',
791
+ add_query_arg( 'edd-verify-request', '1', get_permalink( edd_get_option( 'purchase_history_page', 0 ) ) )
792
+ );
793
+
794
+ wp_safe_redirect( $redirect );
795
+ exit;
796
+
797
+ }
798
+ add_action( 'edd_send_verification_email', 'edd_process_user_verification_request' );
799
+
800
+ /**
801
+ * Processes an account verification
802
+ *
803
+ * @since 2.4.4
804
+ *
805
+ * @return void
806
+ */
807
+ function edd_process_user_account_verification() {
808
+
809
+ if( empty( $_GET['token'] ) ) {
810
+ return false;
811
+ }
812
+
813
+ if( empty( $_GET['user_id'] ) ) {
814
+ return false;
815
+ }
816
+
817
+ if( empty( $_GET['ttl'] ) ) {
818
+ return false;
819
+ }
820
+
821
+ $parts = parse_url( add_query_arg( array() ) );
822
+ wp_parse_str( $parts['query'], $query_args );
823
+ $url = add_query_arg( $query_args, untrailingslashit( get_permalink( edd_get_option( 'purchase_history_page', 0 ) ) ) );
824
+
825
+ if( ! edd_validate_user_verification_token( $url ) ) {
826
+
827
+ do_action( 'edd_invalid_user_verification_token' );
828
+
829
+ wp_die( __( 'Invalid verification token provided.', 'edd' ), __( 'Error', 'edd' ), array( 'response' => 403 ) );
830
+ }
831
+
832
+ edd_set_user_to_verified( absint( $_GET['user_id'] ) );
833
+
834
+ do_action( 'edd_user_verification_token_validated' );
835
+
836
+ $redirect = apply_filters(
837
+ 'edd_user_account_verified_redirect',
838
+ add_query_arg( 'edd-verify-success', '1', get_permalink( edd_get_option( 'purchase_history_page', 0 ) ) )
839
+ );
840
+
841
+ wp_safe_redirect( $redirect );
842
+ exit;
843
+
844
+ }
845
+ add_action( 'edd_verify_user', 'edd_process_user_account_verification' );
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.3
9
 
10
- Stable Tag: 2.4.3
11
 
12
  License: GNU Version 2 or Any Later Version
13
 
@@ -191,6 +191,28 @@ Yes, through the addition of one or more of the add-on payment gateways, you can
191
 
192
  == Changelog ==
193
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
194
  = 2.4.3, August 18, 2015 =
195
 
196
  * Tweak: Added new action hooks to the Sales Summary widget
7
  Requires at least: 3.9.2
8
  Tested up to: 4.3
9
 
10
+ Stable Tag: 2.4.5
11
 
12
  License: GNU Version 2 or Any Later Version
13
 
191
 
192
  == Changelog ==
193
 
194
+ = 2.4.5, September 16, 2015 =
195
+
196
+ * Fix: Bug with AJAX URL on checkout and mixed-content error messages for sites that use HTTPS on checkout but not in /wp-admin/
197
+
198
+ = 2.4.4, September 14, 2015 =
199
+
200
+ * Fix: Incorrectly shown "Sorry, trouble retrieving payment receipt" error
201
+ * Fix: Credit / debit cards with an expiration more than 10 years in the future cannot be used
202
+ * Fix: Non-object notice on /edd-api/customers endpoint
203
+ * Fix: Javascript error on category / tag quick edit screen
204
+ * Fix: Not array PHP error on customer details screen when customer has purchases without any items
205
+ * Fix: Cart item quantities cannnot be changed in HTML structure of cart items is changed
206
+ * Fix: Purchase link shortcode attributes for "text" not working properly
207
+ * Fix: Default price ID cannot be saved with ID of 0
208
+ * Fix: New user notifications not working properly since WordPress 4.3
209
+ * Fix: Incorrect URl returned by edd_get_current_page_url() in some instances
210
+ * Tweak: Improved account creation process
211
+ * Tweak: Introduced "pagination" parameter for downloads shortcode to disable pagination
212
+ * Tweak: Introduced edd_protected_directory_allowed_filetypes filter
213
+ * Tweak: Add $item to edd_receipt_show_download_files filter
214
+ * Tweak: Better error reporting when batch export process fails
215
+
216
  = 2.4.3, August 18, 2015 =
217
 
218
  * Tweak: Added new action hooks to the Sales Summary widget
templates/account-pending.php ADDED
@@ -0,0 +1,9 @@
 
 
 
 
 
 
 
 
 
1
+ <?php if( ! empty( $_GET['edd-verify-request'] ) ) : ?>
2
+ <p class="edd-account-pending edd_success">
3
+ <?php _e( 'An email with an activation link has been sent.', 'edd' ); ?>
4
+ </p>
5
+ <?php endif; ?>
6
+ <p class="edd-account-pending">
7
+ <?php $url = esc_url( edd_get_user_verification_request_url() ); ?>
8
+ <?php printf( __( 'Your account is pending verification. Please click the link in your email to activate your account. No email? <a href="%s">Click here</a> to send a new activation code.', 'edd' ), $url ); ?>
9
+ </p>
templates/history-downloads.php CHANGED
@@ -1,4 +1,9 @@
 
 
 
 
1
  <?php
 
2
  /**
3
  * This template is used to display the download history of the current user.
4
  */
@@ -99,9 +104,7 @@ if ( $purchases ) :
99
  ) );
100
  ?>
101
  </div>
102
- <?php
103
- do_action( 'edd_after_download_history' );
104
- else : ?>
105
  <p class="edd-no-downloads"><?php _e( 'You have not purchased any downloads', 'edd' ); ?></p>
106
- <?php
107
- endif;
1
+ <?php if( ! empty( $_GET['edd-verify-success'] ) ) : ?>
2
+ <p class="edd-account-verified edd_success">
3
+ <?php _e( 'Your account has been successfully verified!', 'edd' ); ?>
4
+ </p>
5
  <?php
6
+ endif;
7
  /**
8
  * This template is used to display the download history of the current user.
9
  */
104
  ) );
105
  ?>
106
  </div>
107
+ <?php do_action( 'edd_after_download_history' ); ?>
108
+ <?php else : ?>
 
109
  <p class="edd-no-downloads"><?php _e( 'You have not purchased any downloads', 'edd' ); ?></p>
110
+ <?php endif; ?>
 
templates/history-purchases.php CHANGED
@@ -1,4 +1,9 @@
 
 
 
 
1
  <?php
 
2
  /**
3
  * This template is used to display the purchase history of the current user.
4
  */
1
+ <?php if( ! empty( $_GET['edd-verify-success'] ) ) : ?>
2
+ <p class="edd-account-verified edd_success">
3
+ <?php _e( 'Your account has been successfully verified!', 'edd' ); ?>
4
+ </p>
5
  <?php
6
+ endif;
7
  /**
8
  * This template is used to display the purchase history of the current user.
9
  */
templates/shortcode-receipt.php CHANGED
@@ -159,7 +159,7 @@ $status = edd_get_payment_status( $payment, true );
159
  <?php endif; ?>
160
 
161
  <?php
162
- if( edd_is_payment_complete( $payment->ID ) && edd_receipt_show_download_files( $item['id'], $edd_receipt_args ) ) : ?>
163
  <ul class="edd_purchase_receipt_files">
164
  <?php
165
  if ( ! empty( $download_files ) && is_array( $download_files ) ) :
159
  <?php endif; ?>
160
 
161
  <?php
162
+ if( edd_is_payment_complete( $payment->ID ) && edd_receipt_show_download_files( $item['id'], $edd_receipt_args, $item ) ) : ?>
163
  <ul class="edd_purchase_receipt_files">
164
  <?php
165
  if ( ! empty( $download_files ) && is_array( $download_files ) ) :