Flexible Shipping for WooCommerce - Version 1.9.1

Version Description

  • 2017-06-02 =
  • Added compatibility with WooCommerce InPost 3.3
Download this release

Release Info

Developer wpdesk
Plugin Icon 128x128 Flexible Shipping for WooCommerce
Version 1.9.1
Comparing to
See all releases

Code changes from version 1.9 to 1.9.1

Files changed (44) hide show
  1. assets/css/admin.css +15 -3
  2. assets/css/admin.min.css +1 -1
  3. assets/images/icon-pp.jpg +0 -0
  4. assets/js/admin.js +115 -1
  5. assets/js/admin.min.js +1 -1
  6. classes/bulk-actions.php +316 -85
  7. classes/manifest/class-manifest-fs.php +42 -0
  8. classes/manifest/class-manifest.php +213 -0
  9. classes/manifest/cpt-shipping-manifest.php +328 -0
  10. classes/manifest/functions.php +62 -0
  11. classes/manifest/interface-manifest.php +37 -0
  12. classes/manifest/views/column-actions.php +2 -0
  13. classes/manifest/views/column-number.php +1 -0
  14. classes/manifest/views/filter-form.php +11 -0
  15. classes/manifest/views/manifest-metabox.php +55 -0
  16. classes/settings-flexible-shipping.php +1 -1
  17. classes/settings-shipping-method-form.php +6 -6
  18. classes/shipment/ajax.php +65 -0
  19. classes/shipment/class-shipment.php +294 -0
  20. classes/shipment/cpt-shipment.php +256 -0
  21. classes/shipment/functions.php +108 -0
  22. classes/shipment/interface-shipment.php +76 -0
  23. classes/shipment/views/order-metabox.php +9 -0
  24. classes/shipping_method.php +3 -3
  25. classes/tracker.php +227 -0
  26. classes/views/html-column-shipping-shipping.php +2 -2
  27. classes/views/html-shipping-method-rules.php +2 -2
  28. classes/views/html-shipping-method-settings.php +2 -2
  29. flexible-shipping.php +105 -53
  30. inc/wpdesk-tracker/assets/css/tracker.css +99 -0
  31. inc/wpdesk-tracker/assets/css/tracker.min.css +1 -0
  32. inc/wpdesk-tracker/assets/images/logo.png +0 -0
  33. inc/wpdesk-tracker/assets/images/logo@2x.png +0 -0
  34. inc/wpdesk-tracker/class-wpdesk-tracker.php +804 -0
  35. inc/wpdesk-tracker/lang/wpdesk-tracker-pl_PL.mo +0 -0
  36. inc/wpdesk-tracker/lang/wpdesk-tracker-pl_PL.po +472 -0
  37. inc/wpdesk-tracker/views/tracker-connect.php +84 -0
  38. inc/wpdesk-tracker/views/tracker-deactivate.php +136 -0
  39. inc/wpdesk-tracker/views/tracker-notice.php +81 -0
  40. inc/wpdesk-tracker/views/tracker-opt-out-notice.php +4 -0
  41. inc/wpdesk-tracker/views/tracker-plugins-footer.php +24 -0
  42. languages/flexible-shipping-pl_PL.mo +0 -0
  43. languages/flexible-shipping-pl_PL.po +331 -52
  44. readme.txt +4 -1
assets/css/admin.css CHANGED
@@ -75,10 +75,10 @@ div.flexilble_shipping_export_import {
75
  min-width: 180px;
76
  right: 0;
77
  position: absolute;
78
- top: 50px;
79
  }
80
 
81
- @media screen and (max-width: 1023px) {
82
  .flexible-shipping-pro-box {
83
  display: none;
84
  }
@@ -139,4 +139,16 @@ div.flexilble_shipping_export_import {
139
 
140
  .column-flexible_shipping mark.failed:after {
141
  color: #a00 !important;
142
- }
 
 
 
 
 
 
 
 
 
 
 
 
75
  min-width: 180px;
76
  right: 0;
77
  position: absolute;
78
+ top: 155px;
79
  }
80
 
81
+ @media screen and (max-width: 1199px) {
82
  .flexible-shipping-pro-box {
83
  display: none;
84
  }
139
 
140
  .column-flexible_shipping mark.failed:after {
141
  color: #a00 !important;
142
+ }
143
+
144
+ .column-flexible_shipping mark.manifest:after {
145
+ color: #2ea2cc !important;
146
+ }
147
+
148
+ .flexible_shipping_shipment_message {
149
+ color: green;
150
+ }
151
+
152
+ .flexible_shipping_shipment_message_error {
153
+ color: red;
154
+ }
assets/css/admin.min.css CHANGED
@@ -1 +1 @@
1
- table.flexible_shipping_methods th.select,table.flexible_shipping_methods td.select{text-align:center;width:40px;margin-top:-7px;margin-left:-6px}table.flexible_shipping_methods .checkbox-select-all{margin:0 12px 0 8px}table.flexible_shipping_methods th.integration,table.flexible_shipping_methods td.integration{text-align:center;width:130px}table.flexible_shipping_methods tr.highlight td{background-color:#e4f2fd}table.flexible_shipping_methods.wc_shipping th{font-weight:400;width:auto}table.flexible_shipping_method_rules td p,table.flexible_shipping_method_rules td p input,table.flexible_shipping_method_rules td p select{margin:0;width:100%}table.flexible_shipping_method_rules td p input[type=checkbox]{margin:0;width:auto}table.flexible_shipping_method_rules th,table.flexible_shipping_method_rules td{text-align:center}.woocommerce table.form-table .flexible_shipping_method_rules th span.woocommerce-help-tip{float:none}.woocommerce table.form-table .flexible_shipping_method_rules .select2-container{margin:0}.woocommerce table.form-table .fs-locations-table .select2-container{max-width:none}.woocommerce table.form-table .fs-locations-table th .woocommerce-help-tip{float:none}div.flexilble_shipping_export_import{float:right}.woocommerce_page_wc-settings #mainform{position:relative}.flexible-shipping-pro-box{max-width:280px;min-width:180px;right:0;position:absolute;top:50px}@media screen and (max-width:1023px){.flexible-shipping-pro-box{display:none}}.column-flexible_shipping{width:130px}.column-flexible_shipping .shipping-status{float:left;margin-right:8px;margin-top:4px;text-align:left;width:18px}.column-flexible_shipping .shipping-status .created:after{color:#d0c21f !important}.column-flexible_shipping .shipping-actions a.button{float:left;margin:0 4px 2px 0;display:block;height:2em !important;padding:0 !important;position:relative;text-indent:-9999px;width:2em}.column-flexible_shipping .shipping-actions a.button:after{font-family:WooCommerce;font-variant:normal;font-weight:400;height:100%;left:0;line-height:1.85;margin:0;position:absolute;text-align:center;text-indent:0;text-transform:none;top:0;width:100%}.column-flexible_shipping .shipping-actions a.button.get-label:after{content:"\e01e"}.column-flexible_shipping .shipping-actions a.button.track:after{content:"\e01b"}.column-flexible_shipping mark.failed:after{color:#a00 !important}
1
+ table.flexible_shipping_methods th.select,table.flexible_shipping_methods td.select{text-align:center;width:40px;margin-top:-7px;margin-left:-6px}table.flexible_shipping_methods .checkbox-select-all{margin:0 12px 0 8px}table.flexible_shipping_methods th.integration,table.flexible_shipping_methods td.integration{text-align:center;width:130px}table.flexible_shipping_methods tr.highlight td{background-color:#e4f2fd}table.flexible_shipping_methods.wc_shipping th{font-weight:400;width:auto}table.flexible_shipping_method_rules td p,table.flexible_shipping_method_rules td p input,table.flexible_shipping_method_rules td p select{margin:0;width:100%}table.flexible_shipping_method_rules td p input[type=checkbox]{margin:0;width:auto}table.flexible_shipping_method_rules th,table.flexible_shipping_method_rules td{text-align:center}.woocommerce table.form-table .flexible_shipping_method_rules th span.woocommerce-help-tip{float:none}.woocommerce table.form-table .flexible_shipping_method_rules .select2-container{margin:0}.woocommerce table.form-table .fs-locations-table .select2-container{max-width:none}.woocommerce table.form-table .fs-locations-table th .woocommerce-help-tip{float:none}div.flexilble_shipping_export_import{float:right}.woocommerce_page_wc-settings #mainform{position:relative}.flexible-shipping-pro-box{max-width:280px;min-width:180px;right:0;position:absolute;top:155px}@media screen and (max-width:1199px){.flexible-shipping-pro-box{display:none}}.column-flexible_shipping{width:130px}.column-flexible_shipping .shipping-status{float:left;margin-right:8px;margin-top:4px;text-align:left;width:18px}.column-flexible_shipping .shipping-status .created:after{color:#d0c21f !important}.column-flexible_shipping .shipping-actions a.button{float:left;margin:0 4px 2px 0;display:block;height:2em !important;padding:0 !important;position:relative;text-indent:-9999px;width:2em}.column-flexible_shipping .shipping-actions a.button:after{font-family:WooCommerce;font-variant:normal;font-weight:400;height:100%;left:0;line-height:1.85;margin:0;position:absolute;text-align:center;text-indent:0;text-transform:none;top:0;width:100%}.column-flexible_shipping .shipping-actions a.button.get-label:after{content:"\e01e"}.column-flexible_shipping .shipping-actions a.button.track:after{content:"\e01b"}.column-flexible_shipping mark.failed:after{color:#a00 !important}.column-flexible_shipping mark.manifest:after{color:#2ea2cc !important}.flexible_shipping_shipment_message{color:green}.flexible_shipping_shipment_message_error{color:red}
assets/images/icon-pp.jpg DELETED
Binary file
assets/js/admin.js CHANGED
@@ -3,17 +3,22 @@ jQuery(document).ready(function(){
3
  window.location.href = jQuery('#flexible_shipping_labels_url').attr('href');
4
  }
5
 
 
 
 
 
6
  if ( typeof window.history.pushState == 'function' ) {
7
  var url = document.location.href;
8
  var url2 = document.location.href;
9
  url = fs_removeParam('bulk_flexible_shipping_labels', url);
10
  url = fs_removeParam('bulk_flexible_shipping_send', url);
 
11
  url = fs_trimChar(url,'?');
12
  if ( url != url2 ) {
13
  window.history.pushState({}, "", url);
14
  }
15
  }
16
- })
17
 
18
  function fs_removeParam(key, sourceURL) {
19
  var rtn = sourceURL.split("?")[0],
@@ -32,6 +37,7 @@ function fs_removeParam(key, sourceURL) {
32
  }
33
  return rtn;
34
  }
 
35
  function fs_trimChar(string, charToRemove) {
36
  while(string.charAt(0)==charToRemove) {
37
  string = string.substring(1);
@@ -43,3 +49,111 @@ function fs_trimChar(string, charToRemove) {
43
 
44
  return string;
45
  }
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
3
  window.location.href = jQuery('#flexible_shipping_labels_url').attr('href');
4
  }
5
 
6
+ if ( jQuery('a.shipping_manifest_download').length == 1 ) {
7
+ window.location.href = jQuery('a.shipping_manifest_download').attr('href');
8
+ }
9
+
10
  if ( typeof window.history.pushState == 'function' ) {
11
  var url = document.location.href;
12
  var url2 = document.location.href;
13
  url = fs_removeParam('bulk_flexible_shipping_labels', url);
14
  url = fs_removeParam('bulk_flexible_shipping_send', url);
15
+ url = fs_removeParam('bulk_flexible_shipping_manifests', url);
16
  url = fs_trimChar(url,'?');
17
  if ( url != url2 ) {
18
  window.history.pushState({}, "", url);
19
  }
20
  }
21
+ });
22
 
23
  function fs_removeParam(key, sourceURL) {
24
  var rtn = sourceURL.split("?")[0],
37
  }
38
  return rtn;
39
  }
40
+
41
  function fs_trimChar(string, charToRemove) {
42
  while(string.charAt(0)==charToRemove) {
43
  string = string.substring(1);
49
 
50
  return string;
51
  }
52
+
53
+
54
+ // Order functions
55
+
56
+ function fs_id( element ) {
57
+ return jQuery(element).closest('.flexible_shipping_shipment').attr('data-id');
58
+ }
59
+
60
+ function fs_data_set_val( data, name, val ) {
61
+ if ( typeof name == 'undefined' ) {
62
+ return data;
63
+ }
64
+ if ( name.indexOf("[") == -1 ) {
65
+ data[name] = val;
66
+ }
67
+ else {
68
+ var names = name.split("[");
69
+ var data2 = data;
70
+ var data3 = data;
71
+ var name2 = '';
72
+ jQuery.each(names,function(index,name) {
73
+ name2 = name.replace("]","");
74
+ if ( typeof data2[name2] == 'undefined' ) {
75
+ data2[name2] = {};
76
+ }
77
+ data3 = data2;
78
+ data2 = data2[name2];
79
+ });
80
+ data3[name2] = val;
81
+ }
82
+ return data;
83
+ }
84
+
85
+ function fs_ajax(button, id, fs_action) {
86
+ jQuery('.button-shipping').attr('disabled', true);
87
+ jQuery(button).parent().find('.spinner').css({visibility: 'visible'});
88
+ var data = {};
89
+
90
+ jQuery('#flexible_shipping_shipment_' + id + ' .flexible_shipping_shipment_content input, #flexible_shipping_shipment_' + id + ' .flexible_shipping_shipment_content select, #flexible_shipping_shipment_' + id + ' .flexible_shipping_shipment_content textarea').each(function () {
91
+ if (jQuery(this).attr('type') == 'radio') {
92
+ //data[jQuery(this).attr('name')] = jQuery('#flexible_shipping_shipment_' + id + ' input[name=' + jQuery(this).attr('name') + ']:checked').val();
93
+ data = fs_data_set_val( data, jQuery(this).attr('name'), jQuery('#flexible_shipping_shipment_' + id + ' input[name=' + jQuery(this).attr('name') + ']:checked').val() );
94
+ }
95
+ else if (jQuery(this).attr('type') == 'checkbox') {
96
+ if (jQuery(this).is(':checked')) {
97
+ //data[jQuery(this).attr('name')] = jQuery(this).val();
98
+ data = fs_data_set_val( data, jQuery(this).attr('name'), jQuery(this).val() );
99
+ }
100
+ else {
101
+ //data[jQuery(this).attr('name')] = '';
102
+ data = fs_data_set_val( data, jQuery(this).attr('name'), '' );
103
+ }
104
+ }
105
+ else {
106
+ //data[jQuery(this).attr('name')] = jQuery(this).val();
107
+ data = fs_data_set_val( data, jQuery(this).attr('name'), jQuery(this).val() );
108
+ }
109
+ });
110
+
111
+ var nonce = jQuery('#flexible_shipping_shipment_nonce_' + id).val();
112
+
113
+ jQuery('#flexible_shipping_shipment_' + id + ' .flexible_shipping_shipment_message').hide();
114
+ jQuery('#flexible_shipping_shipment_' + id + ' .flexible_shipping_shipment_message').removeClass("flexible_shipping_shipment_message_error");
115
+
116
+ jQuery.ajax({
117
+ url: fs_admin.ajax_url,
118
+ type: 'POST',
119
+ data: {
120
+ fs_action: fs_action,
121
+ action: 'flexible_shipping',
122
+ nonce: nonce,
123
+ shipment_id: id,
124
+ data: data,
125
+ },
126
+ dataType: 'json',
127
+ }).done(function (response) {
128
+ if (response) {
129
+ if (response == '0') {
130
+ jQuery('#flexible_shipping_shipment_' + id + ' .flexible_shipping_shipment_message').show();
131
+ jQuery('#flexible_shipping_shipment_' + id + ' .flexible_shipping_shipment_message').html("Invalid response: 0");
132
+ }
133
+ else if (response.status == 'success') {
134
+ jQuery('#flexible_shipping_shipment_' + id + ' .flexible_shipping_shipment_content').html(response.content);
135
+ jQuery('#flexible_shipping_shipment_' + id + ' .flexible_shipping_shipment_message').hide();
136
+ if ( typeof response.message != 'undefined' ) {
137
+ jQuery('#flexible_shipping_shipment_' + id + ' .flexible_shipping_shipment_message').show();
138
+ jQuery('#flexible_shipping_shipment_' + id + ' .flexible_shipping_shipment_message').html(response.message);
139
+ }
140
+ }
141
+ else {
142
+ jQuery('#flexible_shipping_shipment_' + id + ' .flexible_shipping_shipment_message').addClass("flexible_shipping_shipment_message_error");
143
+ jQuery('#flexible_shipping_shipment_' + id + ' .flexible_shipping_shipment_message').show();
144
+ jQuery('#flexible_shipping_shipment_' + id + ' .flexible_shipping_shipment_message').html(response.message);
145
+ }
146
+ }
147
+ else {
148
+ jQuery('#flexible_shipping_shipment_' + id + ' .flexible_shipping_shipment_message').addClass("flexible_shipping_shipment_message_error");
149
+ jQuery('#flexible_shipping_shipment_' + id + ' .flexible_shipping_shipment_message').show();
150
+ jQuery('#flexible_shipping_shipment_' + id + ' .flexible_shipping_shipment_message').html("Request failed: invalid method?");
151
+ }
152
+ }).always(function () {
153
+ jQuery('.button-shipping').attr('disabled', false);
154
+ jQuery('.shipping-spinner').parent().find('.spinner').css({visibility: 'hidden'});
155
+ }).fail(function (jqXHR, textStatus) {
156
+ jQuery('#flexible_shipping_shipment_' + id + ' .flexible_shipping_shipment_message').show();
157
+ jQuery('#flexible_shipping_shipment_' + id + ' .flexible_shipping_shipment_message').html("Request failed: " + textStatus + " " + jqXHR.status);
158
+ })
159
+ }
assets/js/admin.min.js CHANGED
@@ -1 +1 @@
1
- jQuery(document).ready(function(){if(jQuery("#flexible_shipping_labels_url").length){window.location.href=jQuery("#flexible_shipping_labels_url").attr("href")}if(typeof window.history.pushState=="function"){var a=document.location.href;var b=document.location.href;a=fs_removeParam("bulk_flexible_shipping_labels",a);a=fs_removeParam("bulk_flexible_shipping_send",a);a=fs_trimChar(a,"?");if(a!=b){window.history.pushState({},"",a)}}});function fs_removeParam(b,d){var e=d.split("?")[0],f,c=[],g=(d.indexOf("?")!==-1)?d.split("?")[1]:"";if(g!==""){c=g.split("&");for(var a=c.length-1;a>=0;a-=1){f=c[a].split("=")[0];if(f===b){c.splice(a,1)}}e=e+"?"+c.join("&")}return e}function fs_trimChar(b,a){while(b.charAt(0)==a){b=b.substring(1)}while(b.charAt(b.length-1)==a){b=b.substring(0,b.length-1)}return b};
1
+ jQuery(document).ready(function(){if(jQuery("#flexible_shipping_labels_url").length){window.location.href=jQuery("#flexible_shipping_labels_url").attr("href")}if(jQuery("a.shipping_manifest_download").length==1){window.location.href=jQuery("a.shipping_manifest_download").attr("href")}if(typeof window.history.pushState=="function"){var a=document.location.href;var b=document.location.href;a=fs_removeParam("bulk_flexible_shipping_labels",a);a=fs_removeParam("bulk_flexible_shipping_send",a);a=fs_removeParam("bulk_flexible_shipping_manifests",a);a=fs_trimChar(a,"?");if(a!=b){window.history.pushState({},"",a)}}});function fs_removeParam(b,d){var e=d.split("?")[0],f,c=[],g=(d.indexOf("?")!==-1)?d.split("?")[1]:"";if(g!==""){c=g.split("&");for(var a=c.length-1;a>=0;a-=1){f=c[a].split("=")[0];if(f===b){c.splice(a,1)}}e=e+"?"+c.join("&")}return e}function fs_trimChar(b,a){while(b.charAt(0)==a){b=b.substring(1)}while(b.charAt(b.length-1)==a){b=b.substring(0,b.length-1)}return b}function fs_id(a){return jQuery(a).closest(".flexible_shipping_shipment").attr("data-id")}function fs_data_set_val(c,a,f){if(typeof a=="undefined"){return c}if(a.indexOf("[")==-1){c[a]=f}else{var d=a.split("[");var g=c;var e=c;var b="";jQuery.each(d,function(i,h){b=h.replace("]","");if(typeof g[b]=="undefined"){g[b]={}}e=g;g=g[b]});e[b]=f}return c}function fs_ajax(a,e,d){jQuery(".button-shipping").attr("disabled",true);jQuery(a).parent().find(".spinner").css({visibility:"visible"});var c={};jQuery("#flexible_shipping_shipment_"+e+" .flexible_shipping_shipment_content input, #flexible_shipping_shipment_"+e+" .flexible_shipping_shipment_content select, #flexible_shipping_shipment_"+e+" .flexible_shipping_shipment_content textarea").each(function(){if(jQuery(this).attr("type")=="radio"){c=fs_data_set_val(c,jQuery(this).attr("name"),jQuery("#flexible_shipping_shipment_"+e+" input[name="+jQuery(this).attr("name")+"]:checked").val())}else{if(jQuery(this).attr("type")=="checkbox"){if(jQuery(this).is(":checked")){c=fs_data_set_val(c,jQuery(this).attr("name"),jQuery(this).val())}else{c=fs_data_set_val(c,jQuery(this).attr("name"),"")}}else{c=fs_data_set_val(c,jQuery(this).attr("name"),jQuery(this).val())}}});var b=jQuery("#flexible_shipping_shipment_nonce_"+e).val();jQuery("#flexible_shipping_shipment_"+e+" .flexible_shipping_shipment_message").hide();jQuery("#flexible_shipping_shipment_"+e+" .flexible_shipping_shipment_message").removeClass("flexible_shipping_shipment_message_error");jQuery.ajax({url:fs_admin.ajax_url,type:"POST",data:{fs_action:d,action:"flexible_shipping",nonce:b,shipment_id:e,data:c},dataType:"json"}).done(function(f){if(f){if(f=="0"){jQuery("#flexible_shipping_shipment_"+e+" .flexible_shipping_shipment_message").show();jQuery("#flexible_shipping_shipment_"+e+" .flexible_shipping_shipment_message").html("Invalid response: 0")}else{if(f.status=="success"){jQuery("#flexible_shipping_shipment_"+e+" .flexible_shipping_shipment_content").html(f.content);jQuery("#flexible_shipping_shipment_"+e+" .flexible_shipping_shipment_message").hide();if(typeof f.message!="undefined"){jQuery("#flexible_shipping_shipment_"+e+" .flexible_shipping_shipment_message").show();jQuery("#flexible_shipping_shipment_"+e+" .flexible_shipping_shipment_message").html(f.message)}}else{jQuery("#flexible_shipping_shipment_"+e+" .flexible_shipping_shipment_message").addClass("flexible_shipping_shipment_message_error");jQuery("#flexible_shipping_shipment_"+e+" .flexible_shipping_shipment_message").show();jQuery("#flexible_shipping_shipment_"+e+" .flexible_shipping_shipment_message").html(f.message)}}}else{jQuery("#flexible_shipping_shipment_"+e+" .flexible_shipping_shipment_message").addClass("flexible_shipping_shipment_message_error");jQuery("#flexible_shipping_shipment_"+e+" .flexible_shipping_shipment_message").show();jQuery("#flexible_shipping_shipment_"+e+" .flexible_shipping_shipment_message").html("Request failed: invalid method?")}}).always(function(){jQuery(".button-shipping").attr("disabled",false);jQuery(".shipping-spinner").parent().find(".spinner").css({visibility:"hidden"})}).fail(function(f,g){jQuery("#flexible_shipping_shipment_"+e+" .flexible_shipping_shipment_message").show();jQuery("#flexible_shipping_shipment_"+e+" .flexible_shipping_shipment_message").html("Request failed: "+g+" "+f.status)})};
classes/bulk-actions.php CHANGED
@@ -11,42 +11,109 @@ if ( ! class_exists( 'WPDesk_Flexible_Shipping_Bulk_Actions' ) ) {
11
 
12
  public function hooks() {
13
 
14
- $integrations = apply_filters( 'flexible_shipping_integration_options', array() );
 
 
 
 
15
 
16
- if ( count( $integrations ) ) {
17
- add_filter( 'manage_edit-shop_order_columns', array( $this, 'manage_edit_shop_order_columns' ), 11 );
18
- add_action( 'manage_shop_order_posts_custom_column', array(
19
- $this,
20
- 'manage_shop_order_posts_custom_column'
21
- ), 11 );
22
 
23
- add_filter( 'bulk_actions-edit-shop_order', array( $this, 'bulk_actions_edit_shop_order' ) );
24
- add_filter( 'handle_bulk_actions-edit-shop_order', array(
25
- $this,
26
- 'handle_bulk_actions_edit_shop_order'
27
- ), 10, 3 );
28
 
29
- add_action( 'restrict_manage_posts', array( $this, 'restrict_manage_posts' ), 9999 );
30
 
31
- add_filter( 'parse_query', array( $this, 'parse_query' ), 666 );
 
32
 
33
- add_action( 'admin_notices', array( $this, 'admin_notices' ) );
34
 
35
- add_action( 'admin_init', array( $this, 'admin_init' ), 1 );
36
- }
37
 
38
  add_filter( 'flexible_shipping_status', array( $this, 'flexible_shipping_status' ) );
39
 
40
  }
41
 
 
 
 
 
42
  public function flexible_shipping_status( $statuses ) {
43
  $statuses['new'] = __( 'New', 'flexible-shipping' );
44
  $statuses['created'] = __( 'Created', 'flexible-shipping' );
45
  $statuses['confirmed'] = __( 'Confirmed', 'flexible-shipping' );
 
46
  $statuses['failed'] = __( 'Failed', 'flexible-shipping' );
47
  return $statuses;
48
  }
49
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
50
  public function parse_query( $query ) {
51
  global $pagenow;
52
  $type = 'shop_order';
@@ -63,24 +130,27 @@ if ( ! class_exists( 'WPDesk_Flexible_Shipping_Bulk_Actions' ) ) {
63
  if ( isset( $_GET['flexible_shipping_status_filter'] ) ) {
64
  $status = $_GET['flexible_shipping_status_filter'];
65
  }
66
- if ( $integration != '' ) {
67
- if ( !isset( $query->query_vars['meta_query'] ) ) {
68
- $query->query_vars['meta_query'] = array();
69
- }
70
- $meta_query = array();
71
- $meta_query['key'] = '_flexible_shipping_integration';
72
- $meta_query['value'] = $integration;
73
- $query->query_vars['meta_query'][] = $meta_query;
74
- }
75
- if ( $status != '' ) {
76
- if ( !isset( $query->query_vars['meta_query'] ) ) {
77
- $query->query_vars['meta_query'] = array();
78
- }
79
- $meta_query = array();
80
- $meta_query['key'] = '_flexible_shipping_status';
81
- $meta_query['value'] = $status;
82
- $query->query_vars['meta_query'][] = $meta_query;
83
- }
 
 
 
84
  }
85
  }
86
  }
@@ -91,6 +161,11 @@ if ( ! class_exists( 'WPDesk_Flexible_Shipping_Bulk_Actions' ) ) {
91
  return;
92
  }
93
 
 
 
 
 
 
94
  global $typenow;
95
  if ( 'shop_order' == $typenow ){
96
  $integrations = apply_filters( 'flexible_shipping_integration_options', array() );
@@ -108,47 +183,66 @@ if ( ! class_exists( 'WPDesk_Flexible_Shipping_Bulk_Actions' ) ) {
108
  }
109
 
110
  public function manage_shop_order_posts_custom_column( $column ) {
111
- global $post, $woocommerce, $the_order;
112
  if ( $column == 'flexible_shipping' ) {
113
- $classes = array(
114
- 'error' => 'failed',
115
- 'new' => 'on-hold',
116
- 'created' => 'processing created',
117
- 'confirmed' => 'processing confirmed',
118
- );
119
- $statuses = array(
120
- 'error' => __( 'Error', 'flexible-shipping' ),
121
- 'new' => __( 'New shipping', 'flexible-shipping' ),
122
- 'created' => __( 'Created', 'flexible-shipping' ),
123
- 'confirmed' => __( 'Confirmed', 'flexible-shipping' ),
124
- );
125
- $shippings = array();
126
- $shippings = apply_filters( 'flexible_shipping_shipping_data', $shippings );
127
- if( !session_id() ) {
128
- session_start();
129
- }
130
- foreach ( $shippings as $shipping ) {
131
- if ( $shipping['status'] == 'error' ) {
132
- $statuses['error'] = $shipping['error'];
133
- }
134
- else {
135
- $statuses['error'] = __( 'Error', 'flexible-shipping' );
136
- }
137
- include( 'views/html-column-shipping-shipping.php' );
138
- }
139
- $messages = array();
140
- if ( isset( $_SESSION['flexible_shipping_bulk_send'] ) ) {
141
- $messages = $_SESSION['flexible_shipping_bulk_send'];
142
- }
143
- if ( isset( $messages[$post->ID] ) ) {
144
- //include( 'views/html-column-shipping-message.php' );
145
- unset( $messages[$post->ID] );
146
- }
147
- $_SESSION['flexible_shipping_bulk_send'] = $messages;
148
- }
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
149
  }
150
 
151
  public function manage_edit_shop_order_columns( $columns ) {
 
 
 
 
152
  if ( isset( $columns['flexible_shipping'] ) ) {
153
  return $columns;
154
  }
@@ -163,16 +257,43 @@ if ( ! class_exists( 'WPDesk_Flexible_Shipping_Bulk_Actions' ) ) {
163
  }
164
 
165
  function bulk_actions_edit_shop_order( $bulk_actions ) {
166
- $bulk_actions['flexible_shipping_send'] = __( 'Send shipping', 'flexible-shipping');
167
- $bulk_actions['flexible_shipping_labels'] = __( 'Get labels', 'flexible-shipping');
 
 
 
 
 
 
168
  return $bulk_actions;
169
  }
170
 
171
- public function handle_bulk_actions_edit_shop_order( $redirect_to, $doaction, $post_ids ) {
172
- if ( $doaction == 'flexible_shipping_send' ) {
 
 
 
173
  $messages = array();
174
  foreach ( $post_ids as $post_id ) {
175
- $messages[$post_id] = apply_filters(
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
176
  'flexible_shipping_bulk_send',
177
  array( 'status' => 'none', 'message' => __( 'No action performed.', 'flexible-shipping' )
178
  ), $post_id );
@@ -182,10 +303,26 @@ if ( ! class_exists( 'WPDesk_Flexible_Shipping_Bulk_Actions' ) ) {
182
  }
183
  $_SESSION['flexible_shipping_bulk_send'] = $messages;
184
  $redirect_to = add_query_arg( 'bulk_flexible_shipping_send', count( $post_ids ), $redirect_to );
 
185
  }
186
- if ( $doaction == 'flexible_shipping_labels' ) {
187
  $labels = array();
188
  foreach ( $post_ids as $post_id ) {
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
189
  $labels = apply_filters( 'flexible_shipping_bulk_label', $labels, $post_id );
190
  }
191
  $tmp_zip = tempnam ( 'tmp', 'labels_' ) . '.zip';
@@ -206,8 +343,81 @@ if ( ! class_exists( 'WPDesk_Flexible_Shipping_Bulk_Actions' ) ) {
206
  }
207
  $_SESSION['flexible_shipping_bulk_labels'] = $labels;
208
  $redirect_to = add_query_arg( 'bulk_flexible_shipping_labels', count( $post_ids ), $redirect_to );
 
209
  }
210
  }
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
211
  return $redirect_to;
212
  }
213
 
@@ -215,7 +425,7 @@ if ( ! class_exists( 'WPDesk_Flexible_Shipping_Bulk_Actions' ) ) {
215
  if ( ! empty( $_REQUEST['bulk_flexible_shipping_send'] ) ) {
216
  $bulk_flexible_shipping_send_count = intval( $_REQUEST['bulk_flexible_shipping_send'] );
217
  printf( '<div id="message" class="updated fade"><p>' .
218
- __( 'Bulk send shipping - processed orders: %d' ).
219
  '</p></div>', $bulk_flexible_shipping_send_count
220
  );
221
  }
@@ -224,16 +434,37 @@ if ( ! class_exists( 'WPDesk_Flexible_Shipping_Bulk_Actions' ) ) {
224
  if ( ! session_id() ) {
225
  session_start();
226
  }
227
- $labels = array();
228
  if ( isset( $_SESSION['flexible_shipping_bulk_labels'] ) ) {
229
  $labels = $_SESSION['flexible_shipping_bulk_labels'];
 
230
  }
231
- $nonce = wp_create_nonce( 'flexible_shipping_labels' );
232
- printf( '<div id="message" class="updated fade"><p>' .
233
- __( 'Bulk labels - processed orders: %d. If download not start automatically click %shere%s.' ).
234
- '</p></div>', $bulk_flexible_shipping_labels_count, '<a id="flexible_shipping_labels_url" target="_blank" href=' . admin_url( '?flexible_shipping_labels=' . basename( $labels['tmp_zip'] ) . '&nonce=' . $nonce ) . '>', '</a>'
235
- );
 
 
236
  }
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
237
  }
238
 
239
  public function admin_init() {
11
 
12
  public function hooks() {
13
 
14
+ add_filter( 'manage_edit-shop_order_columns', array( $this, 'manage_edit_shop_order_columns' ), 11 );
15
+ add_action( 'manage_shop_order_posts_custom_column', array(
16
+ $this,
17
+ 'manage_shop_order_posts_custom_column'
18
+ ), 11 );
19
 
20
+ add_filter( 'bulk_actions-edit-shop_order', array( $this, 'bulk_actions_edit_shop_order' ) );
21
+ add_filter( 'handle_bulk_actions-edit-shop_order', array(
22
+ $this,
23
+ 'handle_bulk_actions_edit_shop_order'
24
+ ), 10, 3 );
 
25
 
26
+ add_action( 'restrict_manage_posts', array( $this, 'restrict_manage_posts' ), 9999 );
 
 
 
 
27
 
28
+ //add_filter( 'parse_query', array( $this, 'parse_query' ), 999 );
29
 
30
+ add_filter( 'posts_where', array( $this, 'posts_where' ), 999 );
31
+ //add_filter( 'posts_clauses', array( $this, 'posts_clauses' ), 999, 2 );
32
 
33
+ add_action( 'admin_notices', array( $this, 'admin_notices' ) );
34
 
35
+ add_action( 'admin_init', array( $this, 'admin_init' ), 1 );
 
36
 
37
  add_filter( 'flexible_shipping_status', array( $this, 'flexible_shipping_status' ) );
38
 
39
  }
40
 
41
+ public function posts_clauses( $clauses, $query ) {
42
+ return $clauses;
43
+ }
44
+
45
  public function flexible_shipping_status( $statuses ) {
46
  $statuses['new'] = __( 'New', 'flexible-shipping' );
47
  $statuses['created'] = __( 'Created', 'flexible-shipping' );
48
  $statuses['confirmed'] = __( 'Confirmed', 'flexible-shipping' );
49
+ $statuses['manifest'] = __( 'Manifest', 'flexible-shipping' );
50
  $statuses['failed'] = __( 'Failed', 'flexible-shipping' );
51
  return $statuses;
52
  }
53
 
54
+ public function posts_where( $where = '' ) {
55
+ global $pagenow;
56
+ global $wp_query;
57
+ global $wpdb;
58
+ $query = $wp_query;
59
+ $type = 'shop_order';
60
+ if ( isset( $_GET['post_type'] ) ) {
61
+ $type = $_GET['post_type'];
62
+ }
63
+ if ( isset( $query->query_vars['post_type'] ) && $query->query_vars['post_type'] == 'shop_order' ) {
64
+ if ( 'shop_order' == $type && is_admin() && 'edit.php' == $pagenow ) {
65
+ $integration = '';
66
+ if (isset($_GET['flexible_shipping_integration_filter'])) {
67
+ $integration = $_GET['flexible_shipping_integration_filter'];
68
+ }
69
+ $status = '';
70
+ if (isset($_GET['flexible_shipping_status_filter'])) {
71
+ $status = $_GET['flexible_shipping_status_filter'];
72
+ }
73
+ if ( $integration != '' || $status != '' ) {
74
+ $add_where_meta_integration = '';
75
+ $add_where_meta_status = '';
76
+ $add_where_shipment_integration = '';
77
+ $add_where_shipment_status = '';
78
+ $add_where = '';
79
+ if ( $integration != '' ) {
80
+ $add_where_meta_integration = " EXISTS ( SELECT 1 FROM {$wpdb->postmeta} fs_postmeta WHERE wp_posts.ID = fs_postmeta.post_id AND fs_postmeta.meta_key = '_flexible_shipping_integration' AND fs_postmeta.meta_value = '$integration' ) ";
81
+ $add_where_shipment_integration = " EXISTS ( SELECT 1 FROM {$wpdb->posts} fs_posts, {$wpdb->postmeta} fs_postmeta WHERE wp_posts.ID = fs_posts.post_parent AND fs_posts.ID = fs_postmeta.post_id AND fs_postmeta.meta_key = '_integration' AND fs_postmeta.meta_value = '$integration' ) ";
82
+ }
83
+ if ( $status != '' ) {
84
+ $add_where_meta_status = " EXISTS ( SELECT 1 FROM {$wpdb->postmeta} fs_postmeta WHERE wp_posts.ID = fs_postmeta.post_id AND fs_postmeta.meta_key = '_flexible_shipping_status' AND fs_postmeta.meta_value = '$status' ) ";
85
+ $add_where_shipment_status = " EXISTS ( SELECT 1 FROM {$wpdb->posts} fs_posts WHERE wp_posts.ID = fs_posts.post_parent AND fs_posts.post_status = 'fs-{$status}' ) ";
86
+ }
87
+ $add_where_meta = '';
88
+ if ( $add_where_meta_integration != '' ) {
89
+ $add_where_meta .= $add_where_meta_integration;
90
+ }
91
+ if ( $add_where_meta_status != '' ) {
92
+ if ( $add_where_meta != '' ) {
93
+ $add_where_meta .= ' AND ';
94
+ }
95
+ $add_where_meta .= $add_where_meta_status;
96
+ }
97
+ $add_where_shipment = '';
98
+ if ( $add_where_shipment_integration != '' ) {
99
+ $add_where_shipment .= $add_where_shipment_integration;
100
+ }
101
+ if ( $add_where_shipment_status != '' ) {
102
+ if ( $add_where_shipment != '' ) {
103
+ $add_where_shipment .= ' AND ';
104
+ }
105
+ $add_where_shipment .= $add_where_shipment_status;
106
+ }
107
+ $add_where_meta = ' ( ' . $add_where_meta . ' ) ';
108
+ $add_where_shipment = ' ( ' . $add_where_shipment . ' ) ';
109
+ $add_where = ' AND ( ' . $add_where_meta . ' OR ' . $add_where_shipment . ' ) ';
110
+ $where .= $add_where;
111
+ }
112
+ }
113
+ }
114
+ return $where;
115
+ }
116
+
117
  public function parse_query( $query ) {
118
  global $pagenow;
119
  $type = 'shop_order';
130
  if ( isset( $_GET['flexible_shipping_status_filter'] ) ) {
131
  $status = $_GET['flexible_shipping_status_filter'];
132
  }
133
+ if ( $integration != '' || $status != '' ) {
134
+ if ($integration != '') {
135
+ if (!isset($query->query_vars['meta_query'])) {
136
+ $query->query_vars['meta_query'] = array();
137
+ }
138
+ $meta_query = array();
139
+ $meta_query['key'] = '_flexible_shipping_integration';
140
+ $meta_query['value'] = $integration;
141
+ $query->query_vars['meta_query'][] = $meta_query;
142
+ }
143
+ /* */
144
+ if ($status != '') {
145
+ if (!isset($query->query_vars['meta_query'])) {
146
+ $query->query_vars['meta_query'] = array();
147
+ }
148
+ $meta_query = array();
149
+ $meta_query['key'] = '_flexible_shipping_status';
150
+ $meta_query['value'] = $status;
151
+ $query->query_vars['meta_query'][] = $meta_query;
152
+ }
153
+ }
154
  }
155
  }
156
  }
161
  return;
162
  }
163
 
164
+ $integrations = apply_filters( 'flexible_shipping_integration_options', array() );
165
+ if ( count( $integrations ) == 0 ) {
166
+ return;
167
+ }
168
+
169
  global $typenow;
170
  if ( 'shop_order' == $typenow ){
171
  $integrations = apply_filters( 'flexible_shipping_integration_options', array() );
183
  }
184
 
185
  public function manage_shop_order_posts_custom_column( $column ) {
186
+ global $post;
187
  if ( $column == 'flexible_shipping' ) {
188
+ $classes = array(
189
+ 'error' => 'failed',
190
+ 'new' => 'on-hold',
191
+ 'created' => 'processing created',
192
+ 'confirmed' => 'processing confirmed',
193
+ 'manifest' => 'processing manifest',
194
+ );
195
+ $statuses = array(
196
+ 'error' => __('Error', 'flexible-shipping'),
197
+ 'new' => __('New shipment', 'flexible-shipping'),
198
+ 'created' => __('Created', 'flexible-shipping'),
199
+ 'confirmed' => __('Confirmed', 'flexible-shipping'),
200
+ 'manifest' => __('Manifest created', 'flexible-shipping'),
201
+ );
202
+ $shippings = array();
203
+ $shipments = fs_get_order_shipments($post->ID);
204
+ foreach ($shipments as $shipment) {
205
+ /* @var $shipment WPDesk_Flexible_Shipping_Shipment|WPDesk_Flexible_Shipping_Shipment_Interface */
206
+ $shipping = array();
207
+ $shipping['order_id'] = $post->ID;
208
+ $shipping['integration'] = $shipment->get_integration();
209
+ $shipping['url'] = $shipment->get_order_metabox_url();
210
+ $shipping['error'] = $shipment->get_error_message();
211
+ $shipping['status'] = $shipment->get_status_for_shipping_column();
212
+ $shipping['tracking_number'] = $shipment->get_tracking_number();
213
+ $shipping['label_url'] = $shipment->get_label_url();
214
+ $shipping['tracking_url'] = $shipment->get_tracking_url();
215
+ $shipping['shipment'] = $shipment;
216
+ $shippings[] = $shipping;
217
+ }
218
+ $shippings = apply_filters( 'flexible_shipping_shipping_data', $shippings );
219
+ if (!session_id()) {
220
+ session_start();
221
+ }
222
+ foreach ($shippings as $shipping) {
223
+ if ($shipping['status'] == 'error') {
224
+ $statuses['error'] = $shipping['error'];
225
+ } else {
226
+ $statuses['error'] = __('Error', 'flexible-shipping');
227
+ }
228
+ include('views/html-column-shipping-shipping.php');
229
+ }
230
+ $messages = array();
231
+ if (isset($_SESSION['flexible_shipping_bulk_send'])) {
232
+ $messages = $_SESSION['flexible_shipping_bulk_send'];
233
+ }
234
+ if (isset($messages[$post->ID])) {
235
+ unset($messages[$post->ID]);
236
+ }
237
+ $_SESSION['flexible_shipping_bulk_send'] = $messages;
238
+ }
239
  }
240
 
241
  public function manage_edit_shop_order_columns( $columns ) {
242
+ $integrations = apply_filters( 'flexible_shipping_integration_options', array() );
243
+ if ( count( $integrations ) == 0 ) {
244
+ return $columns;
245
+ }
246
  if ( isset( $columns['flexible_shipping'] ) ) {
247
  return $columns;
248
  }
257
  }
258
 
259
  function bulk_actions_edit_shop_order( $bulk_actions ) {
260
+ $integrations = apply_filters( 'flexible_shipping_integration_options', array() );
261
+ if ( count( $integrations ) ) {
262
+ $bulk_actions['flexible_shipping_send'] = __('Send shipment', 'flexible-shipping');
263
+ $bulk_actions['flexible_shipping_labels'] = __('Get labels', 'flexible-shipping');
264
+ if ( apply_filters( 'flexible_shipping_has_manifests', false ) ) {
265
+ $bulk_actions['flexible_shipping_manifest'] = __( 'Create shipping manifest', 'flexible-shipping' );
266
+ }
267
+ }
268
  return $bulk_actions;
269
  }
270
 
271
+ public function handle_bulk_actions_edit_shop_order( $redirect_to, $do_action, $post_ids ) {
272
+ $redirect_to = remove_query_arg( 'bulk_flexible_shipping_send', $redirect_to );
273
+ $redirect_to = remove_query_arg( 'bulk_flexible_shipping_labels', $redirect_to );
274
+ $redirect_to = remove_query_arg( 'bulk_flexible_shipping_manifests', $redirect_to );
275
+ if ( $do_action == 'flexible_shipping_send' ) {
276
  $messages = array();
277
  foreach ( $post_ids as $post_id ) {
278
+ $shipments = fs_get_order_shipments( $post_id );
279
+ $messages[$post_id] = array();
280
+ foreach ($shipments as $shipment) {
281
+ /* @var $shipment WPDesk_Flexible_Shipping_Shipment|WPDesk_Flexible_Shipping_Shipment_Interface */
282
+ try {
283
+ $shipment->api_create();
284
+ $messages[$post_id][$shipment->get_id()] = array(
285
+ 'status' => 'created',
286
+ 'message' => __( 'Shipment created.', 'paczkomaty_shipping_method' )
287
+ );
288
+ }
289
+ catch ( Exception $e ) {
290
+ $messages[$post_id][$shipment->get_id()] = array(
291
+ 'status' => 'error',
292
+ 'message' => $e->getMessage()
293
+ );
294
+ }
295
+ }
296
+ $messages[$post_id][] = apply_filters(
297
  'flexible_shipping_bulk_send',
298
  array( 'status' => 'none', 'message' => __( 'No action performed.', 'flexible-shipping' )
299
  ), $post_id );
303
  }
304
  $_SESSION['flexible_shipping_bulk_send'] = $messages;
305
  $redirect_to = add_query_arg( 'bulk_flexible_shipping_send', count( $post_ids ), $redirect_to );
306
+ return $redirect_to;
307
  }
308
+ if ( $do_action == 'flexible_shipping_labels' ) {
309
  $labels = array();
310
  foreach ( $post_ids as $post_id ) {
311
+ $shipments = fs_get_order_shipments( $post_id );
312
+ foreach ($shipments as $shipment) {
313
+ /* @var $shipment WPDesk_Flexible_Shipping_Shipment|WPDesk_Flexible_Shipping_Shipment_Interface */
314
+ try {
315
+ $label = $shipment->get_label();
316
+ $labels[] = array(
317
+ 'status' => 'created',
318
+ 'message' => __('Label downloaded.', 'paczkomaty_shipping_method'),
319
+ 'content' => $label['content'],
320
+ 'file_name' => $label['file_name']
321
+ );
322
+ }
323
+ catch ( Exception $e ) {
324
+ }
325
+ }
326
  $labels = apply_filters( 'flexible_shipping_bulk_label', $labels, $post_id );
327
  }
328
  $tmp_zip = tempnam ( 'tmp', 'labels_' ) . '.zip';
343
  }
344
  $_SESSION['flexible_shipping_bulk_labels'] = $labels;
345
  $redirect_to = add_query_arg( 'bulk_flexible_shipping_labels', count( $post_ids ), $redirect_to );
346
+ return $redirect_to;
347
  }
348
  }
349
+ if ( $do_action == 'flexible_shipping_manifest' ) {
350
+ $manifests = array();
351
+ foreach ( $post_ids as $post_id ) {
352
+ $shipments = fs_get_order_shipments( $post_id );
353
+ foreach ( $shipments as $shipment ) {
354
+ /* @var $shipment WPDesk_Flexible_Shipping_Shipment|WPDesk_Flexible_Shipping_Shipment_Interface */
355
+ if ( $shipment->get_status() != 'fs-confirmed' || $shipment->get_meta( '_manifest', '' ) != '' ) {
356
+ continue;
357
+ }
358
+ try {
359
+ $integration = $shipment->get_integration();
360
+ $manifest = null;
361
+ if ( empty( $manifests[$integration] ) ) {
362
+ if ( fs_manifest_integration_exists( $integration ) ) {
363
+ $manifest = fs_create_manifest( $integration );
364
+ }
365
+ }
366
+ else {
367
+ $manifest = $manifests[$integration];
368
+ }
369
+ if ( $manifest != null ) {
370
+ $manifest->add_shipments( $shipment );
371
+ $manifest->save();
372
+ $shipment->update_status('fs-manifest' );
373
+ $shipment->save();
374
+ $manifests[$integration] = $manifest;
375
+ }
376
+ }
377
+ catch ( Exception $e ) {
378
+ }
379
+ }
380
+ }
381
+ $messages = array();
382
+ $integrations = apply_filters( 'flexible_shipping_integration_options', array() );
383
+ foreach ( $manifests as $manifest ) {
384
+ try {
385
+ $manifest->generate();
386
+ $manifest->save();
387
+ $download_manifest_url = admin_url('edit.php?post_type=shipping_manifest&flexible_shipping_download_manifest=' . $manifest->get_id() . '&nonce=' . wp_create_nonce('flexible_shipping_download_manifest'));
388
+ $messages[] = array(
389
+ 'type' => 'updated',
390
+ 'message' => sprintf(
391
+ __( 'Created manifest: %s (%s). If download not start automatically click %shere%s.', 'flexible-shipping' ),
392
+ $manifest->get_number(),
393
+ $integrations[$manifest->get_integration()],
394
+ '<a class="shipping_manifest_download" target="_blank" href="' . $download_manifest_url . '">',
395
+ '</a>'
396
+ )
397
+ );
398
+ }
399
+ catch( Exception $e ) {
400
+ $messages[] = array(
401
+ 'type' => 'error',
402
+ 'message' => sprintf(
403
+ __( 'Manifest creation error: %s (%s).', 'flexible-shipping' ),
404
+ $e->getMessage(),
405
+ $integrations[$manifest->get_integration()]
406
+ )
407
+ );
408
+ fs_delete_manifest( $manifest );
409
+ }
410
+ }
411
+ if ( count( $messages ) == 0 ) {
412
+ $messages[] = array(
413
+ 'type' => 'updated',
414
+ 'message' => __( 'No manifests created.', 'flexible-shipping' )
415
+ );
416
+ }
417
+ $_SESSION['flexible_shipping_bulk_manifests'] = $messages;
418
+ $redirect_to = add_query_arg( 'bulk_flexible_shipping_manifests', count( $post_ids ), $redirect_to );
419
+ return $redirect_to;
420
+ }
421
  return $redirect_to;
422
  }
423
 
425
  if ( ! empty( $_REQUEST['bulk_flexible_shipping_send'] ) ) {
426
  $bulk_flexible_shipping_send_count = intval( $_REQUEST['bulk_flexible_shipping_send'] );
427
  printf( '<div id="message" class="updated fade"><p>' .
428
+ __( 'Bulk send shipment - processed orders: %d' ).
429
  '</p></div>', $bulk_flexible_shipping_send_count
430
  );
431
  }
434
  if ( ! session_id() ) {
435
  session_start();
436
  }
437
+ $labels = null;
438
  if ( isset( $_SESSION['flexible_shipping_bulk_labels'] ) ) {
439
  $labels = $_SESSION['flexible_shipping_bulk_labels'];
440
+ unset( $_SESSION['flexible_shipping_bulk_labels'] );
441
  }
442
+ if ( is_array( $labels ) ) {
443
+ $nonce = wp_create_nonce('flexible_shipping_labels');
444
+ printf('<div id="message" class="updated fade"><p>' .
445
+ __('Bulk labels - processed orders: %d. If download not start automatically click %shere%s.') .
446
+ '</p></div>', $bulk_flexible_shipping_labels_count, '<a id="flexible_shipping_labels_url" target="_blank" href=' . admin_url('?flexible_shipping_labels=' . basename($labels['tmp_zip']) . '&nonce=' . $nonce) . '>', '</a>'
447
+ );
448
+ }
449
  }
450
+ if ( ! empty( $_REQUEST['bulk_flexible_shipping_manifests'] ) ) {
451
+ $bulk_flexible_shipping_manifest_count = intval( $_REQUEST['bulk_flexible_shipping_manifests'] );
452
+ printf( '<div id="message" class="updated fade"><p>' .
453
+ __( 'Bulk shipping manifest - processed orders: %d', 'flexible-shipping' ).
454
+ '</p></div>', $bulk_flexible_shipping_manifest_count
455
+ );
456
+ if ( ! session_id() ) {
457
+ session_start();
458
+ }
459
+ $messages = null;
460
+ if ( isset( $_SESSION['flexible_shipping_bulk_manifests'] ) ) {
461
+ $messages = $_SESSION['flexible_shipping_bulk_manifests'];
462
+ unset( $_SESSION['flexible_shipping_bulk_manifests'] );
463
+ foreach ( $messages as $message ) {
464
+ printf( '<div id="message" class="%s fade"><p>%s</p></div>', $message['type'], $message['message'] );
465
+ }
466
+ }
467
+ }
468
  }
469
 
470
  public function admin_init() {
classes/manifest/class-manifest-fs.php ADDED
@@ -0,0 +1,42 @@
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
+ <?php
2
+
3
+ if ( ! defined( 'ABSPATH' ) ) exit; // Exit if accessed directly
4
+
5
+
6
+ class WPDesk_Flexible_Shipping_Manifest_FS extends WPDesk_Flexible_Shipping_Manifest implements WPDesk_Flexible_Shipping_Manifest_Interface {
7
+
8
+ /**
9
+ * @return array
10
+ * Returns manifest data in array
11
+ * file_name => file name for manifest
12
+ * content => pdf content
13
+ */
14
+ public function get_manifest() {
15
+ return null;
16
+ }
17
+
18
+ /**
19
+ * @return string
20
+ * Returns manifest number
21
+ */
22
+ public function get_number() {
23
+ return null;
24
+ }
25
+
26
+ /**
27
+ * @return null
28
+ * Generates manifest (ie. in API)
29
+ */
30
+ public function generate() {
31
+ return null;
32
+ }
33
+
34
+ /**
35
+ * @return null
36
+ * Cancels manifest (ie. in API)
37
+ */
38
+ public function cancel() {
39
+ return null;
40
+ }
41
+
42
+ }
classes/manifest/class-manifest.php ADDED
@@ -0,0 +1,213 @@
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
+ <?php
2
+
3
+ if ( ! defined( 'ABSPATH' ) ) exit; // Exit if accessed directly
4
+
5
+ if ( ! class_exists( 'WPDesk_Flexible_Shipping_Manifest' ) ) {
6
+ /**
7
+ * Class WPDesk_Flexible_Shipping_Shipment
8
+ */
9
+ abstract class WPDesk_Flexible_Shipping_Manifest {
10
+
11
+ /**
12
+ * @var int
13
+ */
14
+ private $id;
15
+
16
+ /**
17
+ * @var WP_Post
18
+ * Post assigned to manifest
19
+ */
20
+ private $post;
21
+
22
+ /**
23
+ * @var bool
24
+ * True if assigned post ich changed. Used when saving post
25
+ */
26
+ private $save_post = false;
27
+
28
+ /**
29
+ * @var null
30
+ * Holds old status when manifest status is changed
31
+ */
32
+ private $old_status = null;
33
+
34
+ /**
35
+ * @var bool
36
+ * True when status changing
37
+ */
38
+ private $status_changed = false;
39
+
40
+ /**
41
+ * @var array
42
+ * Manifest metadata (from postmeta table)
43
+ */
44
+ private $meta_data = array();
45
+
46
+ /**
47
+ * @var bool
48
+ * True when manifest metadata loaded
49
+ */
50
+ private $meta_data_loaded = false;
51
+
52
+ /**
53
+ * @var array
54
+ * Holds changed metadata keys. Used when saving manifest
55
+ */
56
+ private $meta_data_save_keys = array();
57
+
58
+ /**
59
+ * WPDesk_Flexible_Shipping_Manifest constructor.
60
+ * @param $manifest
61
+ * @param WC_Order|null $order
62
+ */
63
+ public function __construct( $manifest, WC_Order $order = null ) {
64
+ if ( is_numeric( $manifest ) ) {
65
+ $this->id = absint( $manifest );
66
+ $this->post = get_post( $this->id );
67
+ } elseif ( $manifest instanceof WPDesk_Flexible_Shipping_Manifest ) {
68
+ $this->id = absint( $manifest->get_id() );
69
+ $this->post = $manifest->get_post();
70
+ } elseif ( isset( $manifest->ID ) ) {
71
+ $this->id = absint( $manifest->ID );
72
+ $this->post = $manifest;
73
+ }
74
+ $this->order = $order;
75
+ }
76
+
77
+ /**
78
+ * @return mixed
79
+ */
80
+ public function get_id() {
81
+ return $this->id;
82
+ }
83
+
84
+ /**
85
+ * @return mixed
86
+ */
87
+ public function get_post() {
88
+ return $this->post;
89
+ }
90
+
91
+ /**
92
+ * @param string $meta_key
93
+ * @param null|string $default
94
+ * @return array|string|null
95
+ */
96
+ public function get_meta( $meta_key = '', $default = null ) {
97
+ $this->load_meta_data();
98
+ if ( $meta_key == '' ) {
99
+ return $this->meta_data;
100
+ }
101
+ if ( isset( $this->meta_data[$meta_key] ) ) {
102
+ return maybe_unserialize( $this->meta_data[$meta_key][0] );
103
+ }
104
+ else {
105
+ return $default;
106
+ }
107
+ }
108
+
109
+ /**
110
+ * @param string $meta_key
111
+ * @param int|string|array|object|null $value
112
+ */
113
+ public function set_meta( $meta_key, $value ) {
114
+ $this->load_meta_data();
115
+ if ( !isset( $this->meta_data[$meta_key] ) ) {
116
+ $this->meta_data[$meta_key] = array();
117
+ }
118
+ $this->meta_data[$meta_key][0] = $value;
119
+ $this->meta_data_save_keys[$meta_key] = $meta_key;
120
+ }
121
+
122
+ /**
123
+ * @param string $meta_key
124
+ */
125
+ public function delete_meta( $meta_key ) {
126
+ unset( $this->meta_data[$meta_key] );
127
+ $this->meta_data_save_keys[$meta_key] = $meta_key;
128
+ }
129
+
130
+ /**
131
+ * Saves manifest data to database.
132
+ */
133
+ public function save() {
134
+ if ( $this->save_post ) {
135
+ wp_update_post($this->post);
136
+ $this->save_post = false;
137
+ }
138
+ foreach ( $this->meta_data_save_keys as $key ) {
139
+ if ( isset( $this->meta_data[$key] ) ) {
140
+ update_post_meta( $this->id, $key, $this->meta_data[$key][0] );
141
+ }
142
+ else {
143
+ delete_post_meta( $this->id, $key );
144
+ }
145
+ unset( $this->meta_data_save_keys[$key] );
146
+ }
147
+ if ( $this->status_changed ) {
148
+ do_action( 'flexible_shipping_manifest_status_updated', $this->old_status, $this->post->post_status, $this );
149
+ $this->status_changed = false;
150
+ $this->old_status = null;
151
+ }
152
+ }
153
+
154
+ /**
155
+ * Loads all meta data from postmeta
156
+ */
157
+ public function load_meta_data() {
158
+ if ( !$this->meta_data_loaded ) {
159
+ $this->meta_data = get_post_meta( $this->id );
160
+ $this->meta_data_loaded = true;
161
+ }
162
+ }
163
+
164
+ /**
165
+ * @return array|null
166
+ * Returns integration assigned to manifest
167
+ */
168
+ public function get_integration() {
169
+ return $this->get_meta( '_integration' );
170
+ }
171
+
172
+ /**
173
+ * @return string
174
+ */
175
+ public function get_status() {
176
+ return $this->post->post_status;
177
+ }
178
+
179
+ public function get_date() {
180
+ return $this->post->post_date;
181
+ }
182
+
183
+ /**
184
+ * @param string $new_status
185
+ */
186
+ public function update_status( $new_status ) {
187
+ $this->old_status = $this->post->post_status;
188
+ $this->post->post_status = $new_status;
189
+ $this->save_post = true;
190
+ $this->status_changed = true;
191
+ }
192
+
193
+
194
+ /**
195
+ * @param mixed $shipments
196
+ */
197
+ public function add_shipments( $shipments ) {
198
+ if ( !is_array( $shipments ) ) {
199
+ $shipments = array( $shipments );
200
+ }
201
+ $shipments_ids = $this->get_meta( '_shipments', array() );
202
+ foreach ( $shipments as $shipment ) {
203
+ /* @var WPDesk_Flexible_Shipping_Shipment $shipment */
204
+ $shipment->add_to_manifest( $this );
205
+ $shipment->save();
206
+ $shipments_ids[] = $shipment->get_id();
207
+ }
208
+ $this->set_meta( '_shipments', $shipments_ids );
209
+ $this->save();
210
+ }
211
+
212
+ }
213
+ }
classes/manifest/cpt-shipping-manifest.php ADDED
@@ -0,0 +1,328 @@
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
+ <?php
2
+
3
+ if ( !defined( 'ABSPATH' ) ) exit; // Exit if accessed directly
4
+
5
+ class WPDesk_Flexible_Shipping_Shipping_Manifest_CPT {
6
+
7
+ private $plugin = null;
8
+
9
+ public function __construct( WPDesk_Flexible_Shipping_Free_Plugin $plugin ) {
10
+ $this->plugin = $plugin;
11
+ $this->hooks();
12
+ }
13
+
14
+ public function hooks() {
15
+
16
+ add_action( 'init', array( $this, 'register_post_types' ), 20 );
17
+
18
+ add_action( 'admin_init', array( $this, 'cancel_manifest' ), 20 );
19
+
20
+ add_action( 'admin_init', array( $this, 'download_manifest' ), 20 );
21
+
22
+ add_action( 'admin_menu', array( $this, 'admin_menu' ), 199 );
23
+
24
+ add_action( 'add_meta_boxes', array( $this, 'add_meta_boxes' ), 20, 2 );
25
+
26
+ add_action( 'trash_shipping_manifest', array( $this, 'trash_shipping_manifest' ) );
27
+
28
+ add_filter( 'manage_edit-shipping_manifest_columns', array( $this, 'manage_edit_shipping_manifest_columns' ), 11 );
29
+
30
+ add_action( 'manage_shipping_manifest_posts_custom_column', array(
31
+ $this,
32
+ 'manage_shipping_manifest_posts_custom_column'
33
+ ), 11 );
34
+
35
+ add_filter( 'post_row_actions', array( $this, 'shipping_manifest_row_actions' ), 10, 2 ) ;
36
+
37
+ add_action( 'do_meta_boxes', array( $this, 'hide_publish_metabox' ) );
38
+
39
+ add_filter( 'woocommerce_screen_ids', array( $this, 'woocommerce_screen_ids' ) );
40
+
41
+ add_filter( 'bulk_actions-edit-shipping_manifest', array( $this, 'bulk_actions_edit_shipping_manifest' ) );
42
+
43
+ add_action( 'restrict_manage_posts', array( $this, 'restrict_manage_posts' ), 9999 );
44
+ add_filter( 'parse_query', array( $this, 'parse_query' ), 999 );
45
+
46
+ }
47
+
48
+ /**
49
+ * Register post types.
50
+ */
51
+ public function register_post_types() {
52
+
53
+ if ( post_type_exists( 'shipping_manifest' ) ) {
54
+ return;
55
+ }
56
+
57
+ register_post_type( 'shipping_manifest',
58
+ array(
59
+ 'labels' => array(
60
+ 'name' => __( 'Shipping Manifests', 'flexible-shipping' ),
61
+ 'singular_name' => __( 'Shipping Manifest', 'flexible-shipping' ),
62
+ 'menu_name' => __( 'Shipping Manifests', 'flexible-shipping' ),
63
+ 'parent_item_colon' => '',
64
+ 'all_items' => __( 'Shipping Manifests', 'flexible-shipping' ),
65
+ 'view_item' => __( 'View Shipping Manifests', 'flexible-shipping' ),
66
+ 'add_new_item' => __( 'Add new Shipping Manifest', 'flexible-shipping' ),
67
+ 'add_new' => __( 'Add new Shipping Manifests', 'flexible-shipping' ),
68
+ 'edit_item' => __( 'Edit Shipping Manifest', 'flexible-shipping' ),
69
+ 'update_item' => __( 'Save Shipping Manifest', 'flexible-shipping' ),
70
+ 'search_items' => __( 'Search Shipping Manifests', 'flexible-shipping' ),
71
+ 'not_found' => __( 'Shipping Manifests not found', 'flexible-shipping' ),
72
+ 'not_found_in_trash' => __( 'Shipping Manifests not found in trash', 'flexible-shipping' )
73
+ ),
74
+ 'description' => __( 'Shipping Manifests.', 'flexible-shipping' ),
75
+ 'public' => false,
76
+ 'show_ui' => true,
77
+ 'capability_type' => 'post',
78
+ 'capabilities' => array( 'create_posts' => false ),
79
+ 'map_meta_cap' => true,
80
+ 'publicly_queryable' => false,
81
+ 'exclude_from_search' => true,
82
+ 'hierarchical' => false,
83
+ 'query_var' => true,
84
+ 'supports' => array( 'title' ),
85
+ 'has_archive' => false,
86
+ 'show_in_nav_menus' => false,
87
+ 'show_in_menu' => 'edit.php?post_type=shop_order',
88
+ 'menu_icon' => 'dashicons-upload',
89
+ )
90
+ );
91
+
92
+ }
93
+
94
+ public function admin_menu() {
95
+ $show_in_menu = current_user_can( 'manage_woocommerce' ) ? 'woocommerce' : false;
96
+ if ( apply_filters( 'flexible_shipping_has_manifests', false ) ) {
97
+ $slug = add_submenu_page( $show_in_menu, __( 'Shipping Manifests', 'flexible-shipping' ), __( 'Shipping Manifests', 'flexible-shipping' ), 'manage_woocommerce', 'edit.php?post_type=shipping_manifest' );
98
+ }
99
+ }
100
+
101
+
102
+ public function add_meta_boxes( $post_type, $post ) {
103
+ if ( $post_type == 'shipping_manifest' ) {
104
+ /*
105
+ add_meta_box(
106
+ 'shipping_manifest_meta_box',
107
+ __('Shipping manifest data', 'flexible-shipping'),
108
+ array( $this, 'metabox' ),
109
+ 'shipping_manifest',
110
+ 'normal',
111
+ 'high'
112
+ );
113
+ */
114
+ add_meta_box(
115
+ 'shipping_manifest_shipments',
116
+ __('Shipments', 'flexible-shipping'),
117
+ array( $this, 'shipments_metabox' ),
118
+ 'shipping_manifest',
119
+ 'normal',
120
+ 'high'
121
+ );
122
+ }
123
+ }
124
+
125
+ public function metabox() {
126
+ global $post;
127
+ echo '<pre>';
128
+ print_r( $post );
129
+ echo '</pre>';
130
+ $meta_data = get_post_meta( $post->ID );
131
+ foreach ( $meta_data as $key => $val ) {
132
+ echo '<pre>';
133
+ echo $key;
134
+ echo ' = ';
135
+ print_r( maybe_unserialize( $val[0] ) );
136
+ echo '</pre>';
137
+ }
138
+ }
139
+
140
+ public function shipments_metabox() {
141
+ global $post;
142
+ $manifest = fs_get_manifest( $post->ID );
143
+ $shipments_array = $manifest->get_meta( '_shipments', array() );
144
+ $shipments = array();
145
+ foreach ( $shipments_array as $shipment_id ) {
146
+ $shipments[] = fs_get_shipment( $shipment_id );
147
+ }
148
+ include('views/manifest-metabox.php');
149
+ /*
150
+ echo "<pre>";
151
+ print_r($shipments);
152
+ echo "</pre>";
153
+ */
154
+ }
155
+
156
+ public function manage_edit_shipping_manifest_columns( $columns ) {
157
+ unset( $columns['title'] );
158
+ unset( $columns['date'] );
159
+ unset( $columns['cb'] );
160
+ $columns['manifest_date'] = __( 'Date', 'flexible-shipping' );
161
+ $columns['integration'] = __( 'Integration', 'flexible-shipping' );
162
+ $columns['external_number'] = __( 'Number', 'flexible-shipping' );
163
+ $columns['shipment_count'] = __( 'Shipments count', 'flexible-shipping' );
164
+ $columns['actions'] = __( 'Actions', 'flexible-shipping' );
165
+ return $columns;
166
+ }
167
+
168
+ public function shipping_manifest_row_actions( $actions, $post ) {
169
+ if ( $post->post_type == 'shipping_manifest' ) {
170
+ $actions = array();
171
+ }
172
+ return $actions;
173
+ }
174
+
175
+ public function manage_shipping_manifest_posts_custom_column( $column ) {
176
+ global $post;
177
+ global $manifest;
178
+ $integrations = apply_filters( 'flexible_shipping_integration_options', array() );
179
+ if ( empty( $manifest ) || $manifest->get_id() != $post->ID ) {
180
+ $manifest = fs_get_manifest( $post->ID );
181
+ }
182
+ if ( $column == 'manifest_date' ) {
183
+ echo $manifest->get_date();
184
+ }
185
+ if ( $column == 'integration' ) {
186
+ echo $integrations[$manifest->get_integration()];
187
+ }
188
+ if ( $column == 'external_number' ) {
189
+ $download_manifest_url = admin_url('edit.php?post_type=shipping_manifest&flexible_shipping_download_manifest=' . $manifest->get_id() . '&nonce=' . wp_create_nonce('flexible_shipping_download_manifest'));
190
+ include('views/column-number.php');
191
+ }
192
+ if ( $column == 'shipment_count' ) {
193
+ echo count( $manifest->get_meta( '_shipments', array() ) );
194
+ }
195
+ if ( $column == 'actions' ) {
196
+ if ( $manifest->get_status() != 'trash' ) {
197
+ $download_manifest_url = admin_url('edit.php?post_type=shipping_manifest&flexible_shipping_download_manifest=' . $manifest->get_id() . '&nonce=' . wp_create_nonce('flexible_shipping_download_manifest'));
198
+ $cancel_url = admin_url('edit.php?post_type=shipping_manifest&flexible_shipping_cancel_manifest=' . $manifest->get_id() . '&nonce=' . wp_create_nonce('flexible_shipping_cancel_manifest'));
199
+ include('views/column-actions.php');
200
+ }
201
+ }
202
+ }
203
+
204
+ public function woocommerce_screen_ids( $screen_ids ) {
205
+ $screen_ids[] = 'edit-shipping_manifest';
206
+ $screen_ids[] = 'shipping_manifest';
207
+ return $screen_ids;
208
+ }
209
+
210
+ public function bulk_actions_edit_shipping_manifest( $bulk_actions ) {
211
+ $bulk_actions = array();
212
+ return $bulk_actions;
213
+ }
214
+
215
+ public function cancel_manifest() {
216
+ if ( !empty( $_GET['flexible_shipping_cancel_manifest'] ) && !empty( $_GET['nonce'] ) ) {
217
+ $nonce = $_GET['nonce'];
218
+ if ( !wp_verify_nonce( $nonce, 'flexible_shipping_cancel_manifest' ) ) {
219
+ echo __( 'Invalid nonce!', 'flexible-shipping' );
220
+ }
221
+ $sendback = admin_url( 'edit.php?post_type=shipping_manifest' );
222
+ try {
223
+ $shipping_manifest_id = $_GET['flexible_shipping_cancel_manifest'];
224
+ $shipping_manifest = fs_get_manifest( $shipping_manifest_id );
225
+ $shipping_manifest->cancel();
226
+ fs_delete_manifest( $shipping_manifest );
227
+ wp_redirect( $sendback );
228
+ exit();
229
+ }
230
+ catch ( Exception $e ) {
231
+ wp_redirect( $sendback );
232
+ exit();
233
+ }
234
+
235
+ }
236
+ }
237
+
238
+ public function download_manifest() {
239
+ if ( !empty( $_GET['flexible_shipping_download_manifest'] ) && !empty( $_GET['nonce'] ) ) {
240
+ $nonce = $_GET['nonce'];
241
+ if ( !wp_verify_nonce( $nonce, 'flexible_shipping_download_manifest' ) ) {
242
+ echo __( 'Invalid nonce!', 'flexible-shipping' );
243
+ }
244
+ try {
245
+ $shipping_manifest_id = $_GET['flexible_shipping_download_manifest'];
246
+ $shipping_manifest = fs_get_manifest( $shipping_manifest_id );
247
+ $manifest = $shipping_manifest->get_manifest();
248
+ header( "Content-type: application/octet-stream" );
249
+ header( "Content-Disposition: attachment; filename=" . $manifest['file_name'] );
250
+ echo $manifest['content'];
251
+ }
252
+ catch ( Exception $e ) {
253
+ echo $e->getMessage();
254
+ exit();
255
+ }
256
+
257
+ }
258
+ }
259
+
260
+ public function hide_publish_metabox() {
261
+ remove_meta_box( 'submitdiv', 'shipping_manifest', 'side' );
262
+ }
263
+
264
+ public function trash_shipping_manifest( $post_id ) {
265
+ $manifest = fs_get_manifest( $post_id );
266
+ $shipments_posts = get_posts( array(
267
+ 'posts_per_page' => -1,
268
+ 'post_type' => 'shipment',
269
+ 'post_status' => 'any',
270
+ 'meta_key' => '_manifest',
271
+ 'meta_value' => $post_id
272
+ ));
273
+ foreach ( $shipments_posts as $shipment_post ) {
274
+ $shipment = fs_get_shipment( $shipment_post->ID );
275
+ $shipment->delete_meta( '_manifest' );
276
+ $shipment->update_status('fs-confirmed' );
277
+ $shipment->save();
278
+ }
279
+ $manifest->delete_meta( '_shipments' );
280
+ $manifest->save();
281
+ }
282
+
283
+ public function restrict_manage_posts() {
284
+ global $typenow;
285
+ if ( 'shipping_manifest' == $typenow ){
286
+ $integrations = apply_filters( 'flexible_shipping_integration_options', array() );
287
+ foreach ( $integrations as $key => $integration ) {
288
+ if ( !class_exists( 'WPDesk_Flexible_Shipping_Manifest_' . $key ) ) {
289
+ unset( $integrations[$key] );
290
+ }
291
+ }
292
+ $integration = '';
293
+ if ( isset( $_GET['flexible_shipping_integration_filter'] ) ) {
294
+ $integration = $_GET['flexible_shipping_integration_filter'];
295
+ }
296
+ include( 'views/filter-form.php' );
297
+ }
298
+ }
299
+
300
+ public function parse_query( $query ) {
301
+ global $pagenow;
302
+ $type = 'shipping_manifest';
303
+ if ( isset( $_GET['post_type'] ) ) {
304
+ $type = $_GET['post_type'];
305
+ }
306
+ if ( isset( $query->query_vars['post_type'] ) && $query->query_vars['post_type'] == 'shipping_manifest' ) {
307
+ if ( 'shipping_manifest' == $type && is_admin() && 'edit.php' == $pagenow ) {
308
+ $integration = '';
309
+ if ( isset( $_GET['flexible_shipping_integration_filter'] ) ) {
310
+ $integration = $_GET['flexible_shipping_integration_filter'];
311
+ }
312
+ if ( $integration != '' ) {
313
+ if ($integration != '') {
314
+ if (!isset($query->query_vars['meta_query'])) {
315
+ $query->query_vars['meta_query'] = array();
316
+ }
317
+ $meta_query = array();
318
+ $meta_query['key'] = '_integration';
319
+ $meta_query['value'] = $integration;
320
+ $query->query_vars['meta_query'][] = $meta_query;
321
+ }
322
+ }
323
+ }
324
+ }
325
+ }
326
+
327
+
328
+ }
classes/manifest/functions.php ADDED
@@ -0,0 +1,62 @@
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
+ <?php
2
+
3
+ if ( ! defined( 'ABSPATH' ) ) exit; // Exit if accessed directly
4
+
5
+
6
+ function fs_manifest_integration_exists( $integration ) {
7
+ $class_name = 'WPDesk_Flexible_Shipping_Manifest' . '_' . $integration ;
8
+ if ( class_exists( $class_name ) ) {
9
+ return true;
10
+ }
11
+ return false;
12
+ }
13
+
14
+
15
+ function fs_create_manifest( $integration ) {
16
+ $post_title = sprintf( __( 'Shipping manifest %s, %s', 'flexible-shipping' ), $integration, date_i18n( get_option( 'date_format' ) ) );
17
+ $post_title = apply_filters( 'flexible_shipping_manifest_post_title_'. $integration, $post_title );
18
+ $manifest_post = array(
19
+ 'post_title' => $post_title,
20
+ 'post_type' => 'shipping_manifest',
21
+ 'post_status' => 'publish',
22
+ );
23
+ $manifest_id = wp_insert_post( $manifest_post );
24
+ update_post_meta( $manifest_id, '_integration', $integration );
25
+ return fs_get_manifest( $manifest_id );
26
+ }
27
+
28
+ /**
29
+ * @param $manifest_id
30
+ * @return WPDesk_Flexible_Shipping_Manifest
31
+ */
32
+ function fs_get_manifest( $manifest_id ) {
33
+ $integration = get_post_meta( $manifest_id, '_integration', true );
34
+ $class_name = 'WPDesk_Flexible_Shipping_Manifest';
35
+ if ( class_exists( $class_name . '_' . $integration ) ) {
36
+ $class_name = $class_name . '_' . $integration;
37
+ }
38
+ else {
39
+ $class_name = 'WPDesk_Flexible_Shipping_Manifest_FS';
40
+ }
41
+ return new $class_name( $manifest_id );
42
+ }
43
+
44
+ function fs_delete_manifest( $manifest ) {
45
+ $shipments_posts = get_posts( array(
46
+ 'posts_per_page' => -1,
47
+ 'post_type' => 'shipment',
48
+ 'post_status' => 'any',
49
+ 'meta_key' => '_manifest',
50
+ 'meta_value' => $manifest->get_id()
51
+ ) );
52
+ foreach ( $shipments_posts as $shipment_post ) {
53
+ $shipment = fs_get_shipment( $shipment_post->ID );
54
+ $shipment->delete_meta( '_manifest' );
55
+ $shipment->update_status('fs-confirmed' );
56
+ $shipment->save();
57
+ }
58
+ $manifest->set_meta( '_shipments', array() );
59
+ $manifest->update_status( 'trash' );
60
+ $manifest->save();
61
+ }
62
+
classes/manifest/interface-manifest.php ADDED
@@ -0,0 +1,37 @@
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
+ <?php
2
+
3
+ if ( ! defined( 'ABSPATH' ) ) exit; // Exit if accessed directly
4
+
5
+ if ( ! interface_exists( 'WPDesk_Flexible_Shipping_Manifest_Interface' ) ) {
6
+
7
+ interface WPDesk_Flexible_Shipping_Manifest_Interface {
8
+
9
+ /**
10
+ * @return array
11
+ * Returns manifest data in array
12
+ * file_name => file name for manifest
13
+ * content => pdf content
14
+ */
15
+ public function get_manifest();
16
+
17
+ /**
18
+ * @return string
19
+ * Returns manifest number
20
+ */
21
+ public function get_number();
22
+
23
+ /**
24
+ * @return null
25
+ * Generates manifest (ie. in API)
26
+ */
27
+ public function generate();
28
+
29
+ /**
30
+ * @return null
31
+ * Cancels manifest (ie. in API)
32
+ */
33
+ public function cancel();
34
+
35
+ }
36
+
37
+ }
classes/manifest/views/column-actions.php ADDED
@@ -0,0 +1,2 @@
 
 
1
+ <a class="button button-primary" target="_blank" href="<?php echo $download_manifest_url; ?>"><?php _e( 'Download', 'flexible-shipping' ); ?></a>
2
+ <a class="button" href="<?php echo $cancel_url; ?>"><?php _e( 'Cancel', 'flexible-shipping' ); ?></a>
classes/manifest/views/column-number.php ADDED
@@ -0,0 +1 @@
 
1
+ <a target="_blank" href="<?php echo $download_manifest_url; ?>"><?php echo $manifest->get_number(); ?></a>
classes/manifest/views/filter-form.php ADDED
@@ -0,0 +1,11 @@
 
 
 
 
 
 
 
 
 
 
 
1
+ <?php ?>
2
+ <div class="alignleft actions">
3
+ <select name="flexible_shipping_integration_filter">
4
+ <option value=""><?php _e( 'All manifests', 'flexible-shipping' ); ?></option>
5
+ <optgroup label="<?php _e( 'Integration', 'flexible-shipping' ); ?>">
6
+ <?php foreach ( $integrations as $key => $val ) : ?>
7
+ <option value="<?php echo $key; ?>" <?php echo ($key == $integration ? 'selected' : '' ); ?>><?php echo $val; ?></option>
8
+ <?php endforeach; ?>
9
+ </optgroup>
10
+ </select>
11
+ </div>
classes/manifest/views/manifest-metabox.php ADDED
@@ -0,0 +1,55 @@
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
+ <table class="wp-list-table widefat fixed striped">
2
+ <thead>
3
+ <tr>
4
+ <th>
5
+ </th>
6
+ <th>
7
+ <?php _e( 'Shipment', 'flexible-shipping' ); ?>
8
+ </th>
9
+ <th>
10
+ <?php _e( 'Order', 'flexible-shipping' ); ?>
11
+ </th>
12
+ </tr>
13
+ </thead>
14
+
15
+ <tbody id="the-list">
16
+ <?php $count = 0; ?>
17
+ <?php foreach ( $shipments as $shipment ) : ?>
18
+ <?php
19
+ $count++;
20
+ $order = $shipment->get_order();
21
+ if ( version_compare( WC_VERSION, '2.7', '<' ) ) {
22
+ $order_id = $order->id;
23
+ }
24
+ else {
25
+ $order_id = $order->get_id();
26
+ }
27
+ ?>
28
+ <tr>
29
+ <td>
30
+ <?php echo $count; ?>
31
+ </td>
32
+ <td>
33
+ <a href="<?php echo $shipment->get_order_metabox_url(); ?>"><?php echo $shipment->get_tracking_number(); ?></a>
34
+ </td>
35
+ <td>
36
+ <a href="<?php echo admin_url( 'post.php?action=edit&post=' . $order_id ); ?>"><?php echo $order->get_order_number(); ?></a>
37
+ </td>
38
+ </tr>
39
+ <?php endforeach; ?>
40
+ </tbody>
41
+
42
+ <tfoot>
43
+ <tr>
44
+ <th>
45
+ </th>
46
+ <th>
47
+ <?php _e( 'Shipment', 'flexible-shipping' ); ?>
48
+ </th>
49
+ <th>
50
+ <?php _e( 'Order', 'flexible-shipping' ); ?>
51
+ </th>
52
+ </tr>
53
+ </tfoot>
54
+
55
+ </table>
classes/settings-flexible-shipping.php CHANGED
@@ -7,7 +7,7 @@ if ( ! defined( 'ABSPATH' ) ) {
7
  $docs_link = get_locale() === 'pl_PL' ? 'https://www.wpdesk.pl/docs/flexible-shipping-pro-woocommerce-docs/' : 'https://www.wpdesk.net/docs/flexible-shipping-pro-woocommerce-docs/';
8
 
9
  /**
10
- * Settings for flexible shipping
11
  */
12
  $settings = array(
13
  array(
7
  $docs_link = get_locale() === 'pl_PL' ? 'https://www.wpdesk.pl/docs/flexible-shipping-pro-woocommerce-docs/' : 'https://www.wpdesk.net/docs/flexible-shipping-pro-woocommerce-docs/';
8
 
9
  /**
10
+ * Settings for flexible shipment
11
  */
12
  $settings = array(
13
  array(
classes/settings-shipping-method-form.php CHANGED
@@ -3,11 +3,11 @@
3
  if ( ! defined( 'ABSPATH' ) ) exit;
4
 
5
  /**
6
- * Settings for flexible shipping, shipping method
7
  */
8
 
9
  $shipping_classes = array();
10
- $shipping_classes['0'] = __( 'Select shipping class', 'flexible-shipping' );
11
  foreach ( WC()->shipping->get_shipping_classes() as $shipping_class ) {
12
  $shipping_classes[$shipping_class->term_id] = $shipping_class->name;
13
  }
@@ -30,7 +30,7 @@ $settings = array(
30
  'title' => __( 'Enable/Disable', 'flexible-shipping' ),
31
  'type' => 'checkbox',
32
  'default' => $shipping_method['method_enabled'],
33
- 'label' => __( 'Enable this shipping method', 'flexible-shipping' )
34
  ),
35
  'method_title' => array(
36
  'title' => __( 'Method Title', 'flexible-shipping' ),
@@ -58,14 +58,14 @@ $settings = array(
58
  'title' => __( 'Free Shipping', 'flexible-shipping' ),
59
  'type' => 'price',
60
  'default' => floatval( $shipping_method['method_free_shipping'] ),
61
- 'description' => __( 'Enter a minimum order amount for free shipping. This will override the costs configured below.', 'flexible-shipping' ),
62
  'desc_tip' => true
63
  ),
64
  'method_free_shipping_label' => array(
65
  'title' => __( 'Free Shipping Label', 'flexible-shipping' ),
66
  'type' => 'text',
67
  'default' => $shipping_method['method_free_shipping_label'],
68
- 'description' => __( 'Enter additional label for shipping when free shipping available.', 'flexible-shipping' ),
69
  'desc_tip' => true
70
  ),
71
  array(
@@ -143,6 +143,6 @@ if ( class_exists('WC_Shipping_Zones1') ) {
143
 
144
  $docs_link = get_locale() === 'pl_PL' ? 'https://www.wpdesk.pl/docs/flexible-shipping-pro-woocommerce-docs/' : 'https://www.wpdesk.net/docs/flexible-shipping-pro-woocommerce-docs/';
145
 
146
- echo '<p>' . sprintf( __( 'See how to %sconfigure shipping methods%s.', 'flexible-shipping' ), '<a href="' . $docs_link . '" target="_blank">', '</a>' ) . '</p>';
147
 
148
  return $settings;
3
  if ( ! defined( 'ABSPATH' ) ) exit;
4
 
5
  /**
6
+ * Settings for flexible shipment, shipment method
7
  */
8
 
9
  $shipping_classes = array();
10
+ $shipping_classes['0'] = __( 'Select shipment class', 'flexible-shipping' );
11
  foreach ( WC()->shipping->get_shipping_classes() as $shipping_class ) {
12
  $shipping_classes[$shipping_class->term_id] = $shipping_class->name;
13
  }
30
  'title' => __( 'Enable/Disable', 'flexible-shipping' ),
31
  'type' => 'checkbox',
32
  'default' => $shipping_method['method_enabled'],
33
+ 'label' => __( 'Enable this shipment method', 'flexible-shipping' )
34
  ),
35
  'method_title' => array(
36
  'title' => __( 'Method Title', 'flexible-shipping' ),
58
  'title' => __( 'Free Shipping', 'flexible-shipping' ),
59
  'type' => 'price',
60
  'default' => floatval( $shipping_method['method_free_shipping'] ),
61
+ 'description' => __( 'Enter a minimum order amount for free shipment. This will override the costs configured below.', 'flexible-shipping' ),
62
  'desc_tip' => true
63
  ),
64
  'method_free_shipping_label' => array(
65
  'title' => __( 'Free Shipping Label', 'flexible-shipping' ),
66
  'type' => 'text',
67
  'default' => $shipping_method['method_free_shipping_label'],
68
+ 'description' => __( 'Enter additional label for shipment when free shipment available.', 'flexible-shipping' ),
69
  'desc_tip' => true
70
  ),
71
  array(
143
 
144
  $docs_link = get_locale() === 'pl_PL' ? 'https://www.wpdesk.pl/docs/flexible-shipping-pro-woocommerce-docs/' : 'https://www.wpdesk.net/docs/flexible-shipping-pro-woocommerce-docs/';
145
 
146
+ echo '<p>' . sprintf( __( 'See how to %sconfigure shipment methods%s.', 'flexible-shipping' ), '<a href="' . $docs_link . '" target="_blank">', '</a>' ) . '</p>';
147
 
148
  return $settings;
classes/shipment/ajax.php ADDED
@@ -0,0 +1,65 @@
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
+ <?php
2
+
3
+ if ( ! defined( 'ABSPATH' ) ) exit; // Exit if accessed directly
4
+
5
+ if ( ! class_exists( 'WPDesk_Flexible_Shipping_Shipment_Ajax' ) ) {
6
+
7
+ class WPDesk_Flexible_Shipping_Shipment_Ajax {
8
+
9
+ private $plugin = null;
10
+
11
+ public function __construct( WPDesk_Flexible_Shipping_Free_Plugin $plugin ) {
12
+ $this->plugin = $plugin;
13
+ $this->hooks();
14
+ }
15
+
16
+ public function hooks() {
17
+ add_action( 'wp_ajax_flexible_shipping', array( $this, 'wp_ajax_flexible_shipping' ) );
18
+ }
19
+
20
+ public function wp_ajax_flexible_shipping() {
21
+ $json = array('status' => 'fail');
22
+ $json['message'] = __( 'Unknown error!', 'flexible-shipping' );
23
+ if ( empty( $_REQUEST['nonce'] ) || !wp_verify_nonce( $_REQUEST['nonce'], 'flexible_shipping_shipment_nonce' ) ) {
24
+ $json['status'] = 'fail';
25
+ $json['message'] = __( 'Nonce verification error! Invalid request.', 'flexible-shipping' );
26
+ }
27
+ else if ( empty( $_REQUEST['shipment_id'] ) ) {
28
+ $json['status'] = 'fail';
29
+ $json['message'] = __( 'No shipment id!', 'flexible-shipping' );
30
+ }
31
+ else if ( empty( $_REQUEST['data'] ) || !is_array( $_REQUEST['data'] ) ) {
32
+ $json['status'] = 'fail';
33
+ $json['message'] = __( 'No data!', 'flexible-shipping' );
34
+ }
35
+ else {
36
+ $shipment = fs_get_shipment( intval( $_REQUEST['shipment_id'] ) );
37
+ $action = $_REQUEST['fs_action'];
38
+ $data = $_REQUEST['data'];
39
+ try {
40
+ $ajax_request = $shipment->ajax_request( $action, $data );
41
+ if ( is_array( $ajax_request ) ) {
42
+ $json['content'] = $ajax_request['content'];
43
+ $json['message'] = '';
44
+ if ( isset( $ajax_request['message'] ) ) {
45
+ $json['message'] = $ajax_request['message'];
46
+ }
47
+ }
48
+ else {
49
+ $json['content'] = $ajax_request;
50
+ $json['message'] = __('Saved', 'flexible-shipping');
51
+ }
52
+ $json['status'] = 'success';
53
+ }
54
+ catch ( Exception $e ) {
55
+ $json['status'] = 'fail';
56
+ $json['message'] = $e->getMessage();
57
+ }
58
+ }
59
+ echo json_encode($json);
60
+ die;
61
+ }
62
+
63
+ }
64
+
65
+ }
classes/shipment/class-shipment.php ADDED
@@ -0,0 +1,294 @@
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
+ <?php
2
+
3
+ if ( ! defined( 'ABSPATH' ) ) exit; // Exit if accessed directly
4
+
5
+ if ( ! class_exists( 'WPDesk_Flexible_Shipping_Shipment' ) ) {
6
+ /**
7
+ * Class WPDesk_Flexible_Shipping_Shipment
8
+ */
9
+ abstract class WPDesk_Flexible_Shipping_Shipment {
10
+
11
+ /**
12
+ * @var int
13
+ */
14
+ private $id;
15
+
16
+ /**
17
+ * @var WP_Post
18
+ * Post assigned to shipment
19
+ */
20
+ private $post;
21
+
22
+ /**
23
+ * @var null|WC_Order
24
+ * WC_Order assigned to shipment
25
+ */
26
+ private $order = null;
27
+
28
+ /**
29
+ * @var bool
30
+ * True if assigned post ich changed. Used when saving post
31
+ */
32
+ private $save_post = false;
33
+
34
+ /**
35
+ * @var null
36
+ * Holds old status when shipment status is changed
37
+ */
38
+ private $old_status = null;
39
+
40
+ /**
41
+ * @var bool
42
+ * True when status changing
43
+ */
44
+ private $status_changed = false;
45
+
46
+ /**
47
+ * @var array
48
+ * Shipment metadata (from postmeta table)
49
+ */
50
+ private $meta_data = array();
51
+
52
+ /**
53
+ * @var bool
54
+ * True when shipment metadata loaded
55
+ */
56
+ private $meta_data_loaded = false;
57
+
58
+ /**
59
+ * @var array
60
+ * Holds changed metadata keys. Used when saving shipment
61
+ */
62
+ private $meta_data_save_keys = array();
63
+
64
+ /**
65
+ * @var string
66
+ * Context for order metabox
67
+ */
68
+ private $order_metabox_context = 'side';
69
+
70
+
71
+ /**
72
+ * WPDesk_Flexible_Shipping_Shipment constructor.
73
+ * @param $shipment
74
+ * @param WC_Order|null $order
75
+ */
76
+ public function __construct( $shipment, WC_Order $order = null ) {
77
+ if ( is_numeric( $shipment ) ) {
78
+ $this->id = absint( $shipment );
79
+ $this->post = get_post( $this->id );
80
+ } elseif ( $shipment instanceof WPDesk_Flexible_Shipping_Shipment ) {
81
+ $this->id = absint( $shipment->get_id() );
82
+ $this->post = $shipment->get_post();
83
+ } elseif ( isset( $shipment->ID ) ) {
84
+ $this->id = absint( $shipment->ID );
85
+ $this->post = $shipment;
86
+ }
87
+ $this->order = $order;
88
+ }
89
+
90
+ /**
91
+ * @return mixed
92
+ */
93
+ public function get_id() {
94
+ return $this->id;
95
+ }
96
+
97
+ /**
98
+ * @return mixed
99
+ */
100
+ public function get_post() {
101
+ return $this->post;
102
+ }
103
+
104
+ /**
105
+ * @return WC_Order
106
+ */
107
+ public function get_order() {
108
+ if ( $this->order == null ) {
109
+ $this->order = wc_get_order( $this->post->post_parent );
110
+ }
111
+ return $this->order;
112
+ }
113
+
114
+ /**
115
+ * @return int
116
+ */
117
+ public function get_order_id() {
118
+ return $this->post->post_parent;
119
+ }
120
+
121
+ /**
122
+ * @return string
123
+ */
124
+ public function get_order_metabox_context() {
125
+ return $this->order_metabox_context;
126
+ }
127
+
128
+ /**
129
+ * @param string $order_metabox_context
130
+ */
131
+ public function set_order_metabox_context( $order_metabox_context ) {
132
+ $this->order_metabox_context = $order_metabox_context;
133
+ }
134
+
135
+ /**
136
+ * @param string $meta_key
137
+ * @param null|sting $default
138
+ * @return array|string|null
139
+ */
140
+ public function get_meta( $meta_key = '', $default = null ) {
141
+ $this->load_meta_data();
142
+ if ( $meta_key == '' ) {
143
+ return $this->meta_data;
144
+ }
145
+ if ( isset( $this->meta_data[$meta_key] ) ) {
146
+ return maybe_unserialize( $this->meta_data[$meta_key][0] );
147
+ }
148
+ else {
149
+ return $default;
150
+ }
151
+ return null;
152
+ }
153
+
154
+ /**
155
+ * @param string $meta_key
156
+ * @param int|string|array|object|null $value
157
+ */
158
+ public function set_meta( $meta_key, $value ) {
159
+ $this->load_meta_data();
160
+ if ( !isset( $this->meta_data[$meta_key] ) ) {
161
+ $this->meta_data[$meta_key] = array();
162
+ }
163
+ $this->meta_data[$meta_key][0] = $value;
164
+ $this->meta_data_save_keys[$meta_key] = $meta_key;
165
+ }
166
+
167
+ /**
168
+ * @param string $meta_key
169
+ */
170
+ public function delete_meta( $meta_key ) {
171
+ unset( $this->meta_data[$meta_key] );
172
+ $this->meta_data_save_keys[$meta_key] = $meta_key;
173
+ }
174
+
175
+ /**
176
+ * Saves shipment data to database.
177
+ */
178
+ public function save() {
179
+ if ( $this->save_post ) {
180
+ wp_update_post($this->post);
181
+ $this->save_post = false;
182
+ }
183
+ foreach ( $this->meta_data_save_keys as $key ) {
184
+ if ( isset( $this->meta_data[$key] ) ) {
185
+ update_post_meta( $this->id, $key, $this->meta_data[$key][0] );
186
+ }
187
+ else {
188
+ delete_post_meta( $this->id, $key );
189
+ }
190
+ unset( $this->meta_data_save_keys[$key] );
191
+ }
192
+ if ( $this->status_changed ) {
193
+ do_action( 'flexible_shipping_shipment_status_updated', $this->old_status, $this->post->post_status, $this );
194
+ $this->status_changed = false;
195
+ $this->old_status = null;
196
+ }
197
+ }
198
+
199
+ /**
200
+ * Loads all meta data from postmeta
201
+ */
202
+ public function load_meta_data() {
203
+ if ( !$this->meta_data_loaded ) {
204
+ $this->meta_data = get_post_meta( $this->id );
205
+ $this->meta_data_loaded = true;
206
+ }
207
+ }
208
+
209
+ /**
210
+ * @return array|null
211
+ * Returns integration assigned to shipment
212
+ */
213
+ public function get_integration() {
214
+ return $this->get_meta( '_integration' );
215
+ }
216
+
217
+ /**
218
+ * @return string
219
+ * Returns URL for admin metabox for this shipment
220
+ */
221
+ public function get_order_metabox_url() {
222
+ return admin_url( 'post.php?post=' . $this->get_order_id() . '&action=edit#shipment_meta_box_' . $this->get_id() );
223
+ }
224
+
225
+ /**
226
+ * @return string
227
+ */
228
+ public function get_status() {
229
+ return $this->post->post_status;
230
+ }
231
+
232
+ /**
233
+ * @return string
234
+ */
235
+ public function get_status_for_shipping_column() {
236
+ $statuses = array(
237
+ 'fs-new' => 'new',
238
+ 'fs-created' => 'created',
239
+ 'fs-confirmed' => 'confirmed',
240
+ 'fs-failed' => 'error',
241
+ 'fs-manifest' => 'manifest',
242
+ );
243
+ return $statuses[$this->get_status()];
244
+ }
245
+
246
+ /**
247
+ * @return null|string
248
+ * Returns URL for label
249
+ */
250
+ public function get_label_url() {
251
+ if ( in_array( $this->get_status(), array( 'fs-new', 'fs-created', 'fs-failed' ) ) ) {
252
+ return null;
253
+ }
254
+ $label_url = '?flexible_shipping_get_label=' . $this->get_id() . '&nonce=' . wp_create_nonce( 'flexible_shipping_get_label' ) ;
255
+ return site_url( $label_url );
256
+ }
257
+
258
+ /**
259
+ * @param string $new_status
260
+ */
261
+ public function update_status( $new_status ) {
262
+ $this->old_status = $this->post->post_status;
263
+ $this->post->post_status = $new_status;
264
+ $this->save_post = true;
265
+ $this->status_changed = true;
266
+ }
267
+
268
+ public function add_to_manifest( WPDesk_Flexible_Shipping_Manifest $manifest ) {
269
+ $this->set_meta( '_manifest', $manifest->get_id() );
270
+ }
271
+
272
+ public function label_avaliable() {
273
+ if ( in_array( $this->get_status(), array( 'fs-confirmed', 'fs-manifest' ) ) ) {
274
+ return true;
275
+ }
276
+ return false;
277
+ }
278
+
279
+ /**
280
+ * Displays shipping column in orders list view.
281
+ * Must be overwritten!
282
+ */
283
+ public function shipping_column() {
284
+ echo _( 'Please override shipping_column method!', 'flexible-shipping' );
285
+ echo '<pre>';
286
+ print_r( $this->post );
287
+ echo '</pre>';
288
+ echo '<pre>';
289
+ print_r( $this->meta_data );
290
+ echo '</pre>';
291
+ }
292
+
293
+ }
294
+ }
classes/shipment/cpt-shipment.php ADDED
@@ -0,0 +1,256 @@
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
+ <?php
2
+
3
+ if ( !defined( 'ABSPATH' ) ) exit; // Exit if accessed directly
4
+
5
+ class WPDesk_Flexible_Shipping_Shipment_CPT {
6
+
7
+ private $plugin = null;
8
+
9
+ public function __construct( WPDesk_Flexible_Shipping_Free_Plugin $plugin ) {
10
+ $this->plugin = $plugin;
11
+ $this->hooks();
12
+ }
13
+
14
+ public function hooks() {
15
+
16
+ add_action( 'init', array( $this, 'register_post_types' ), 20 );
17
+ add_action( 'init', array( $this, 'flexible_shipping_get_label' ), 9999999 );
18
+ add_action( 'add_meta_boxes', array( $this, 'add_meta_boxes' ), 20, 2 );
19
+
20
+ add_action( 'woocommerce_checkout_update_order_meta', array( $this, 'woocommerce_checkout_update_order_meta' ) );
21
+
22
+ add_action( 'woocommerce_order_details_after_order_table', array( $this, 'woocommerce_order_details_after_order_table' ) );
23
+
24
+ add_action( 'woocommerce_email_after_order_table', array( $this, 'woocommerce_email_after_order_table' ), 10, 2 );
25
+ }
26
+
27
+ /**
28
+ * Register post types.
29
+ */
30
+ public function register_post_types() {
31
+
32
+ if ( post_type_exists( 'shipment' ) ) {
33
+ return;
34
+ }
35
+
36
+ register_post_type( 'shipment',
37
+ array(
38
+ 'labels' => array(
39
+ 'name' => __( 'Shipments', 'flexible-shipping' ),
40
+ 'singular_name' => __( 'Shipment', 'flexible-shipping' ),
41
+ 'menu_name' => __( 'Shipments', 'flexible-shipping' ),
42
+ 'parent_item_colon' => '',
43
+ 'all_items' => __( 'Shipments', 'flexible-shipping' ),
44
+ 'view_item' => __( 'View Shipments', 'flexible-shipping' ),
45
+ 'add_new_item' => __( 'Add new Shipment', 'flexible-shipping' ),
46
+ 'add_new' => __( 'Add new Shipment', 'flexible-shipping' ),
47
+ 'edit_item' => __( 'Edit Shipment', 'flexible-shipping' ),
48
+ 'update_item' => __( 'Save Shipment', 'flexible-shipping' ),
49
+ 'search_items' => __( 'Search Shipments', 'flexible-shipping' ),
50
+ 'not_found' => __( 'Shipment not found', 'flexible-shipping' ),
51
+ 'not_found_in_trash' => __( 'Shipment not found in trash', 'flexible-shipping' )
52
+ ),
53
+ 'description' => __( 'Shipments.', 'flexible-shipping' ),
54
+ 'public' => false,
55
+ 'show_ui' => false,
56
+ 'capability_type' => 'post',
57
+ 'capabilities' => array(),
58
+ 'map_meta_cap' => true,
59
+ 'publicly_queryable' => false,
60
+ 'exclude_from_search' => true,
61
+ 'hierarchical' => false,
62
+ 'query_var' => true,
63
+ 'supports' => array( 'title' ),
64
+ 'has_archive' => false,
65
+ 'show_in_nav_menus' => true,
66
+ 'menu_icon' => 'dashicons-upload',
67
+ )
68
+ );
69
+
70
+ $shipment_statuses = apply_filters( 'flexible_shipping_register_shipment_statuses',
71
+ array(
72
+ 'fs-new' => array(
73
+ 'label' => _x( 'New', 'Shipment status', 'flexible-shipping' ),
74
+ 'public' => false,
75
+ 'exclude_from_search' => false,
76
+ 'show_in_admin_all_list' => true,
77
+ 'show_in_admin_status_list' => true,
78
+ 'label_count' => _n_noop( 'New <span class="count">(%s)</span>', 'New <span class="count">(%s)</span>', 'flexible-shipping' ),
79
+ ),
80
+ 'fs-created' => array(
81
+ 'label' => _x( 'Created', 'Shipment status', 'flexible-shipping' ),
82
+ 'public' => false,
83
+ 'exclude_from_search' => false,
84
+ 'show_in_admin_all_list' => true,
85
+ 'show_in_admin_status_list' => true,
86
+ 'label_count' => _n_noop( 'Created <span class="count">(%s)</span>', 'Created <span class="count">(%s)</span>', 'flexible-shipping' ),
87
+ ),
88
+ 'fs-confirmed' => array(
89
+ 'label' => _x( 'Confirmed', 'Shipment status', 'flexible-shipping' ),
90
+ 'public' => false,
91
+ 'exclude_from_search' => false,
92
+ 'show_in_admin_all_list' => true,
93
+ 'show_in_admin_status_list' => true,
94
+ 'label_count' => _n_noop( 'Confirmed <span class="count">(%s)</span>', 'Confirmed <span class="count">(%s)</span>', 'flexible-shipping' ),
95
+ ),
96
+ 'fs-manifest' => array(
97
+ 'label' => _x( 'Manifest created', 'Shipment status', 'flexible-shipping' ),
98
+ 'public' => false,
99
+ 'exclude_from_search' => false,
100
+ 'show_in_admin_all_list' => true,
101
+ 'show_in_admin_status_list' => true,
102
+ 'label_count' => _n_noop( 'Confirmed <span class="count">(%s)</span>', 'Confirmed <span class="count">(%s)</span>', 'flexible-shipping' ),
103
+ ),
104
+ 'fs-failed' => array(
105
+ 'label' => _x( 'Failed', 'Shipment status', 'flexible-shipping' ),
106
+ 'public' => false,
107
+ 'exclude_from_search' => false,
108
+ 'show_in_admin_all_list' => true,
109
+ 'show_in_admin_status_list' => true,
110
+ 'label_count' => _n_noop( 'Failed <span class="count">(%s)</span>', 'Failed <span class="count">(%s)</span>', 'flexible-shipping' ),
111
+ ),
112
+ )
113
+ );
114
+
115
+ foreach ( $shipment_statuses as $shipment_status => $values ) {
116
+ register_post_status( $shipment_status, $values );
117
+ }
118
+
119
+ }
120
+
121
+ public function add_meta_boxes( $post_type, $post ) {
122
+ if ( $post_type == 'shipment' ) {
123
+ add_meta_box(
124
+ 'shipment_meta_box',
125
+ __('Shipment data', 'flexible-shipping'),
126
+ array( $this, 'metabox' ),
127
+ 'shipment',
128
+ 'normal',
129
+ 'high'
130
+ );
131
+ }
132
+ if ( $post_type == 'shop_order' ) {
133
+ $shipments = fs_get_order_shipments( $post->ID );
134
+ foreach ( $shipments as $shipment ) {
135
+ $args = array( 'shipment' => $shipment );
136
+ add_meta_box(
137
+ 'shipment_meta_box_' . $shipment->get_id(),
138
+ $shipment->get_order_metabox_title(),
139
+ array( $this, 'order_metabox' ),
140
+ 'shop_order',
141
+ $shipment->get_order_metabox_context(),
142
+ 'default',
143
+ $args
144
+ );
145
+
146
+ }
147
+ }
148
+ }
149
+
150
+ public function order_metabox( $post, $args ) {
151
+ $shipment = $args['args']['shipment'];
152
+ include( 'views/order-metabox.php' );
153
+ }
154
+
155
+ public function metabox() {
156
+ global $post;
157
+ echo '<pre>';
158
+ print_r( $post );
159
+ echo '</pre>';
160
+ $meta_data = get_post_meta( $post->ID );
161
+ foreach ( $meta_data as $key => $val ) {
162
+ echo '<pre>';
163
+ echo $key;
164
+ echo ' = ';
165
+ print_r( maybe_unserialize( $val[0] ) );
166
+ echo '</pre>';
167
+ }
168
+ }
169
+
170
+ public function flexible_shipping_get_label() {
171
+ if ( !empty( $_GET['flexible_shipping_get_label'] ) && !empty( $_GET['nonce'] ) ) {
172
+ $nonce = $_GET['nonce'];
173
+ if ( !wp_verify_nonce( $nonce, 'flexible_shipping_get_label' ) ) {
174
+ echo __( 'Invalid nonce!', 'flexible-shipping' );
175
+ }
176
+ try {
177
+ $shipment_id = $_GET['flexible_shipping_get_label'];
178
+ $shipment = fs_get_shipment( $shipment_id );
179
+ $label_data = $shipment->get_label();
180
+ header( "Content-type: application/octet-stream" );
181
+ header( "Content-Disposition: attachment; filename=" . $label_data['file_name'] );
182
+ echo $label_data['content'];
183
+ }
184
+ catch ( Exception $e ) {
185
+ echo $e->getMessage();
186
+ }
187
+ exit();
188
+ }
189
+ }
190
+
191
+ public function woocommerce_checkout_update_order_meta( $order_id ) {
192
+ $order = wc_get_order( $order_id );
193
+ $order_shipping_methods = $order->get_shipping_methods();
194
+ $packages = WC()->shipping->get_packages();
195
+ $package_id = -1;
196
+ foreach ( $order_shipping_methods as $shipping_id => $shipping_method ) {
197
+ $package_id++;
198
+ $fs_method = array();
199
+ if ( version_compare( WC_VERSION, '2.7', '<' ) ) {
200
+ if (isset($shipping_method['item_meta'])
201
+ && isset($shipping_method['item_meta']['_fs_method'])
202
+ && isset($shipping_method['item_meta']['_fs_method'][0])
203
+ ) {
204
+ $fs_method = unserialize($shipping_method['item_meta']['_fs_method'][0]);
205
+ }
206
+ }
207
+ else {
208
+ if ( isset( $shipping_method['item_meta'] )
209
+ && isset( $shipping_method['item_meta']['_fs_method'] )
210
+ ) {
211
+ $fs_method = $shipping_method['item_meta']['_fs_method'];
212
+ }
213
+ }
214
+ if ( !empty( $fs_method['method_integration'] ) ) {
215
+ if ( fs_shipment_integration_exists( $fs_method['method_integration'] ) ) {
216
+ $shipment = fs_create_shipment( $order, $fs_method );
217
+ $shipment->set_meta( '_fs_method', $fs_method );
218
+ $shipment->set_meta( '_shipping_id', $shipping_id );
219
+ $shipment->set_meta( '_shipping_method', $shipping_method );
220
+ $shipment->set_meta( '_package', $packages[$package_id] );
221
+ $shipment->set_meta( '_packages', $packages );
222
+ $shipment->checkout( $fs_method, $packages[$package_id] );
223
+ $shipment->save();
224
+ }
225
+ }
226
+ }
227
+ }
228
+
229
+ public function woocommerce_order_details_after_order_table( WC_Order $order ) {
230
+ if ( version_compare( WC_VERSION, '2.7', '<' ) ) {
231
+ $order_id = $order->id;
232
+ }
233
+ else {
234
+ $order_id = $order->get_id();
235
+ }
236
+ $shipments = fs_get_order_shipments( $order_id );
237
+ foreach ( $shipments as $shipment ) {
238
+ echo $shipment->get_after_order_table();
239
+ }
240
+ }
241
+
242
+ public function woocommerce_email_after_order_table( $order, $sent_to_admin ) {
243
+ if ( version_compare( WC_VERSION, '2.7', '<' ) ) {
244
+ $order_id = $order->id;
245
+ }
246
+ else {
247
+ $order_id = $order->get_id();
248
+ }
249
+ $shipments = fs_get_order_shipments( $order_id );
250
+ foreach ( $shipments as $shipment ) {
251
+ echo $shipment->get_email_after_order_table();
252
+ }
253
+ }
254
+
255
+
256
+ }
classes/shipment/functions.php ADDED
@@ -0,0 +1,108 @@
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
+ <?php
2
+
3
+ if ( ! defined( 'ABSPATH' ) ) exit; // Exit if accessed directly
4
+
5
+
6
+ function fs_shipment_integration_exists( $integration ) {
7
+ $class_name = 'WPDesk_Flexible_Shipping_Shipment' . '_' . $integration ;
8
+ if ( class_exists( $class_name ) ) {
9
+ return true;
10
+ }
11
+ return false;
12
+ }
13
+
14
+
15
+ function fs_create_shipment( WC_Order $order, $fs_method ) {
16
+ if ( version_compare( WC_VERSION, '2.7', '<' ) ) {
17
+ $order_id = $order->id;
18
+ }
19
+ else {
20
+ $order_id = $order->get_id();
21
+ }
22
+ $integration = $fs_method['method_integration'];
23
+ $post_title = sprintf( __( 'Shipment for order %s, %s', 'flexible-shipping' ), $order_id, $integration );
24
+ $post_title = apply_filters( 'flexible_shipping_shipment_post_title_'. $integration, $post_title, $fs_method );
25
+ $shipment_post = array(
26
+ 'post_title' => $post_title,
27
+ 'post_type' => 'shipment',
28
+ 'post_status' => 'fs-new',
29
+ 'post_parent' => $order_id
30
+ );
31
+ $shipment_id = wp_insert_post( $shipment_post );
32
+ update_post_meta( $shipment_id, '_integration', $integration );
33
+ return fs_get_shipment( $shipment_id, $order );
34
+ }
35
+
36
+ /**
37
+ * @param $order_id
38
+ * @param string|null $integration
39
+ * @return WPDesk_Flexible_Shipping_Shipment[]|WPDesk_Flexible_Shipping_Shipment_Interface[]
40
+ */
41
+ function fs_get_order_shipments( $order_id, $integration = null ) {
42
+ $shipments_posts_query = array(
43
+ 'posts_per_page' => -1,
44
+ 'post_parent' => $order_id,
45
+ 'post_type' => 'shipment',
46
+ 'post_status' => 'any'
47
+ );
48
+ if ( !empty( $integration ) ) {
49
+ $shipments_posts_query['meta_key'] = '_integration';
50
+ $shipments_posts_query['meta_value'] = $integration;
51
+ }
52
+ $shipments_posts = get_posts( $shipments_posts_query );
53
+ $shipments = array();
54
+ if ( count( $shipments_posts ) ) {
55
+ $order = wc_get_order($order_id);
56
+ foreach ($shipments_posts as $shipment_post) {
57
+ $integration = get_post_meta($shipment_post->ID, '_integration', true);
58
+ if ( fs_shipment_integration_exists( $integration ) ) {
59
+ $shipments[] = fs_get_shipment($shipment_post->ID, $order);
60
+ }
61
+ }
62
+ }
63
+ return $shipments;
64
+ }
65
+
66
+ /**
67
+ * @param $shipment_id
68
+ * @param WC_Order|null $order
69
+ * @return WPDesk_Flexible_Shipping_Shipment
70
+ */
71
+ function fs_get_shipment( $shipment_id, WC_Order $order = null ) {
72
+ $integration = get_post_meta( $shipment_id, '_integration', true );
73
+ $class_name = 'WPDesk_Flexible_Shipping_Shipment';
74
+ if ( class_exists( $class_name . '_' . $integration ) ) {
75
+ $class_name = $class_name . '_' . $integration;
76
+ }
77
+ return new $class_name( $shipment_id, $order );
78
+ }
79
+
80
+
81
+ function fs_calculate_order_weight( WC_Order $order ) {
82
+ $weight = 0;
83
+ if ( sizeof( $order->get_items() ) > 0 ) {
84
+ foreach( $order->get_items() as $item ) {
85
+ if ( $item['product_id'] > 0 ) {
86
+ if ( version_compare( WC_VERSION, '2.7', '<' ) ) {
87
+ $product = $order->get_product_from_item( $item );
88
+ }
89
+ else {
90
+ $product = $item->get_product();
91
+ }
92
+ $product_weight = $product->get_weight();
93
+ if ( ! $product->is_virtual() && is_numeric( $product_weight ) ) {
94
+ $weight += $product->get_weight() * $item['qty'];
95
+ }
96
+ }
97
+ }
98
+ }
99
+ return $weight;
100
+ }
101
+
102
+ function fs_calculate_package_weight( $package ) {
103
+ $weight = 0;
104
+ foreach( $package['contents'] as $item ) {
105
+ $weight += $item['data']->get_weight() * $item['quantity'];
106
+ }
107
+ return $weight;
108
+ }
classes/shipment/interface-shipment.php ADDED
@@ -0,0 +1,76 @@
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
+ <?php
2
+
3
+ if ( ! defined( 'ABSPATH' ) ) exit; // Exit if accessed directly
4
+
5
+ if ( ! interface_exists( 'WPDesk_Flexible_Shipping_Shipment_Interface' ) ) {
6
+
7
+ interface WPDesk_Flexible_Shipping_Shipment_Interface {
8
+
9
+ /**
10
+ * @param array $fs_method
11
+ * @param array $package
12
+ * @return void
13
+ * Executes on woocommerce checkout when order is created
14
+ */
15
+ public function checkout( array $fs_method, $package );
16
+
17
+ /**
18
+ * @return void
19
+ * Displays metabox in woocommerce order
20
+ */
21
+ public function order_metabox();
22
+
23
+ /**
24
+ * @return string
25
+ * Returns woocommerce metabox title
26
+ */
27
+ public function get_order_metabox_title();
28
+
29
+ /**
30
+ * @param string $action
31
+ * @param array $data
32
+ * @return void
33
+ * Executes on ajax request. $data contains all woocommerce order metabox fields values from metabox generated in order_metabox() method.
34
+ */
35
+ public function ajax_request( $action, $data );
36
+
37
+ /**
38
+ * @return string
39
+ * Returns error message
40
+ */
41
+ public function get_error_message();
42
+
43
+ /**
44
+ * @return string
45
+ * Returns tracking number for shipment
46
+ */
47
+ public function get_tracking_number();
48
+
49
+ /**
50
+ * @return string
51
+ * Returns tracking URL for shipping
52
+ */
53
+ public function get_tracking_url();
54
+
55
+ /**
56
+ * @return array
57
+ * Return label data foe shipping in array:
58
+ * 'label_format' => 'pdf'
59
+ * 'content' => pdf content,
60
+ * 'file_name' => file name for label
61
+ */
62
+ public function get_label();
63
+
64
+ /**
65
+ * @return mixed
66
+ */
67
+ public function get_after_order_table();
68
+
69
+ /**
70
+ * @return mixed
71
+ */
72
+ public function get_email_after_order_table();
73
+
74
+ }
75
+
76
+ }
classes/shipment/views/order-metabox.php ADDED
@@ -0,0 +1,9 @@
 
 
 
 
 
 
 
 
 
1
+ <div class="flexible_shipping_shipment" id="flexible_shipping_shipment_<?php echo $shipment->get_id(); ?>" data-id="<?php echo $shipment->get_id(); ?>">
2
+ <?php wp_nonce_field( 'flexible_shipping_shipment_nonce', 'flexible_shipping_shipment_nonce_' . $shipment->get_id(), false ); ?>
3
+ <div class="flexible_shipping_shipment_content">
4
+ <?php $shipment->order_metabox(); ?>
5
+ </div>
6
+ <div class="flexible_shipping_shipment_message flexible_shipping_shipment_message_error">
7
+ <?php echo $shipment->get_error_message(); ?>
8
+ </div>
9
+ </div>
classes/shipping_method.php CHANGED
@@ -10,7 +10,7 @@ if ( ! class_exists( 'WPDesk_Flexible_Shipping' ) ) {
10
  private $message_added = false;
11
 
12
  /**
13
- * Constructor for your shipping class
14
  *
15
  * @access public
16
  * @return void
@@ -21,7 +21,7 @@ if ( ! class_exists( 'WPDesk_Flexible_Shipping' ) ) {
21
  $this->shipping_methods_option = 'flexible_shipping_methods_' . $this->instance_id;
22
  $this->shipping_method_order_option = 'flexible_shipping_method_order_' . $this->instance_id;
23
  $this->section_name = 'flexible_shipping';
24
- $this->method_title = __( 'Flexible Shipping', 'flexible-shipping' );
25
  $this->method_description = __( 'Flexible Shipping', 'flexible-shipping' );
26
 
27
  $this->supports = array(
@@ -33,7 +33,7 @@ if ( ! class_exists( 'WPDesk_Flexible_Shipping' ) ) {
33
  'enabled' => array(
34
  'title' => __( 'Enable/Disable', 'flexible-shipping' ),
35
  'type' => 'checkbox',
36
- 'label' => __( 'Enable this shipping method', 'flexible-shipping' ),
37
  'default' => 'yes',
38
  ),
39
  'title' => array(
10
  private $message_added = false;
11
 
12
  /**
13
+ * Constructor for your shipment class
14
  *
15
  * @access public
16
  * @return void
21
  $this->shipping_methods_option = 'flexible_shipping_methods_' . $this->instance_id;
22
  $this->shipping_method_order_option = 'flexible_shipping_method_order_' . $this->instance_id;
23
  $this->section_name = 'flexible_shipping';
24
+ $this->method_title = __( 'Flexible Shipping', 'flexible-shipping' );
25
  $this->method_description = __( 'Flexible Shipping', 'flexible-shipping' );
26
 
27
  $this->supports = array(
33
  'enabled' => array(
34
  'title' => __( 'Enable/Disable', 'flexible-shipping' ),
35
  'type' => 'checkbox',
36
+ 'label' => __( 'Enable this shipment method', 'flexible-shipping' ),
37
  'default' => 'yes',
38
  ),
39
  'title' => array(
classes/tracker.php ADDED
@@ -0,0 +1,227 @@
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
+ <?php
2
+
3
+ if ( ! defined( 'ABSPATH' ) ) exit; // Exit if accessed directly
4
+
5
+ if ( ! class_exists( 'WPDesk_Flexible_Shipping_Tracker' ) ) {
6
+ class WPDesk_Flexible_Shipping_Tracker {
7
+
8
+ public static $script_version = '11';
9
+
10
+ public function __construct() {
11
+ $this->hooks();
12
+ }
13
+
14
+ public function hooks() {
15
+ add_filter( 'wpdesk_tracker_data', array( $this, 'wpdesk_tracker_data_flexible_shipping' ), 11 );
16
+ add_filter( 'wpdesk_tracker_notice_screens', array( $this, 'wpdesk_tracker_notice_screens' ) );
17
+ add_filter( 'wpdesk_track_plugin_deactivation', array( $this, 'wpdesk_track_plugin_deactivation' ) );
18
+
19
+ add_filter( 'plugin_action_links_flexible-shipping/flexible-shipping.php', array( $this, 'plugin_action_links' ) );
20
+ add_action( 'activated_plugin', array( $this, 'activated_plugin' ), 10, 2 );
21
+ }
22
+
23
+ public function wpdesk_track_plugin_deactivation( $plugins ) {
24
+ $plugins['flexible-shipping/flexible-shipping.php'] = 'flexible-shipping/flexible-shipping.php';
25
+ return $plugins;
26
+ }
27
+
28
+ public function wpdesk_tracker_data_flexible_shipping( $data ) {
29
+ $all_shipping_methods = flexible_shipping_get_all_shipping_methods();
30
+
31
+ $flexible_shipping = $all_shipping_methods['flexible_shipping'];
32
+
33
+ $flexible_shipping_rates = $flexible_shipping->get_all_rates();
34
+ $data['flexible_shipping'] = array();
35
+ $data['flexible_shipping']['total_shipping_methods'] = 0;
36
+ $data['flexible_shipping']['avg_rules'] = 0;
37
+ $data['flexible_shipping']['max_rules'] = 0;
38
+ $data['flexible_shipping']['integrations'] = array();
39
+ $data['flexible_shipping']['free_shipping_requires'] = array();
40
+ $data['flexible_shipping']['calculation_methods'] = array();
41
+ $data['flexible_shipping']['based_on'] = array();
42
+ $data['flexible_shipping']['shipping_class_option'] = array();
43
+ $data['flexible_shipping']['method_description_count'] = 0;
44
+ $data['flexible_shipping']['free_shipping_label_count'] = 0;
45
+ $data['flexible_shipping']['max_cost_count'] = 0;
46
+ $data['flexible_shipping']['visibility_count'] = 0;
47
+ $data['flexible_shipping']['default_count'] = 0;
48
+
49
+ $data['flexible_shipping']['additional_cost_count'] = 0;
50
+
51
+ $data['flexible_shipping']['min_count'] = 0;
52
+ $data['flexible_shipping']['max_count'] = 0;
53
+
54
+ $data['flexible_shipping']['cost_per_order_count'] = 0;
55
+ $data['flexible_shipping']['stop_count'] = 0;
56
+ $data['flexible_shipping']['cancel_count'] = 0;
57
+ foreach ( $flexible_shipping_rates as $flexible_shipping_rate ) {
58
+
59
+ $data['flexible_shipping']['total_shipping_methods']++;
60
+
61
+ $data['flexible_shipping']['avg_rules'] += count( $flexible_shipping_rate['method_rules'] );
62
+
63
+ if ( count( $flexible_shipping_rate['method_rules'] ) > $data['flexible_shipping']['max_rules'] ) {
64
+ $data['flexible_shipping']['max_rules'] = count( $flexible_shipping_rate['method_rules'] );
65
+ }
66
+
67
+ if ( empty( $flexible_shipping_rate['method_integration'] ) ) {
68
+ $flexible_shipping_rate['method_integration'] = 'none';
69
+ }
70
+ if ( empty( $data['flexible_shipping']['integrations'][$flexible_shipping_rate['method_integration']] ) ) {
71
+ $data['flexible_shipping']['integrations'][$flexible_shipping_rate['method_integration']] = 0;
72
+ }
73
+ $data['flexible_shipping']['integrations'][$flexible_shipping_rate['method_integration']]++;
74
+
75
+ if ( !empty( $flexible_shipping_rate['method_free_shipping_requires'] ) ) {
76
+ if ( empty( $data['flexible_shipping']['free_shipping_requires'][ $flexible_shipping_rate['method_free_shipping_requires'] ] ) ) {
77
+ $data['flexible_shipping']['free_shipping_requires'][ $flexible_shipping_rate['method_free_shipping_requires'] ] = 0;
78
+ }
79
+ $data['flexible_shipping']['free_shipping_requires'][ $flexible_shipping_rate['method_free_shipping_requires'] ] ++;
80
+ }
81
+
82
+ if ( empty( $data['flexible_shipping']['calculation_methods'][$flexible_shipping_rate['method_calculation_method']] ) ) {
83
+ $data['flexible_shipping']['calculation_methods'][$flexible_shipping_rate['method_calculation_method']] = 0;
84
+ }
85
+ $data['flexible_shipping']['calculation_methods'][$flexible_shipping_rate['method_calculation_method']]++;
86
+
87
+ if ( !empty( $flexible_shipping_rate['method_description'] ) ) {
88
+ $data['flexible_shipping']['method_description_count']++;
89
+ }
90
+
91
+ if ( !empty( $flexible_shipping_rate['method_free_shipping_label'] ) ) {
92
+ $data['flexible_shipping']['free_shipping_label_count']++;
93
+ }
94
+
95
+ if ( !empty( $flexible_shipping_rate['method_max_cost'] ) ) {
96
+ $data['flexible_shipping']['max_cost_count']++;
97
+ }
98
+
99
+ if ( !empty( $flexible_shipping_rate['method_visibility'] ) && $flexible_shipping_rate['method_visibility'] != 'no' ) {
100
+ $data['flexible_shipping']['visibility_count']++;
101
+ }
102
+
103
+ if ( !empty( $flexible_shipping_rate['method_default'] ) && $flexible_shipping_rate['method_default'] != 'no' ) {
104
+ $data['flexible_shipping']['default_count']++;
105
+ }
106
+
107
+ foreach ( $flexible_shipping_rate['method_rules'] as $method_rule ) {
108
+ if ( empty( $data['flexible_shipping']['based_on'][$method_rule['based_on']] ) ) {
109
+ $data['flexible_shipping']['based_on'][$method_rule['based_on']] = 0;
110
+ }
111
+ $data['flexible_shipping']['based_on'][$method_rule['based_on']]++;
112
+
113
+ if ( !empty( $method_rule['shipping_class'] ) ) {
114
+ $shipping_class = $method_rule['shipping_class'];
115
+ if ( !in_array( $shipping_class, array( 'all', 'any', 'none' ) ) ) {
116
+ $shipping_class = 'shipping_class';
117
+ }
118
+ if ( empty( $data['flexible_shipping']['shipping_class_option'][$shipping_class] ) ) {
119
+ $data['flexible_shipping']['shipping_class_option'][$shipping_class] = 0;
120
+ }
121
+ $data['flexible_shipping']['shipping_class_option'][$shipping_class]++;
122
+ }
123
+
124
+ if ( !empty( $method_rule['cost_additional'] ) ) {
125
+ $data['flexible_shipping']['additional_cost_count']++;
126
+ }
127
+
128
+ if ( !empty( $method_rule['min'] ) ) {
129
+ $data['flexible_shipping']['min_count']++;
130
+ }
131
+
132
+ if ( !empty( $method_rule['max'] ) ) {
133
+ $data['flexible_shipping']['max_count']++;
134
+ }
135
+
136
+ if ( !empty( $method_rule['cost_per_order'] ) ) {
137
+ $data['flexible_shipping']['cost_per_order_count']++;
138
+ }
139
+
140
+ if ( !empty( $method_rule['stop'] ) ) {
141
+ $data['flexible_shipping']['stop_count']++;
142
+ }
143
+
144
+ if ( !empty( $method_rule['cancel'] ) ) {
145
+ $data['flexible_shipping']['cancel_count']++;
146
+ }
147
+
148
+ }
149
+
150
+ }
151
+ if ( $data['flexible_shipping']['total_shipping_methods'] != 0 ) {
152
+ $data['flexible_shipping']['avg_rules'] = $data['flexible_shipping']['avg_rules'] / $data['flexible_shipping']['total_shipping_methods'];
153
+ }
154
+ return $data;
155
+ }
156
+
157
+ public function wpdesk_tracker_notice_screens( $screens ) {
158
+ $current_screen = get_current_screen();
159
+ if ( $current_screen->id == 'woocommerce_page_wc-settings' ) {
160
+ if ( isset( $_GET['tab'] ) && $_GET['tab'] == 'shipping' ) {
161
+ $screens[] = $current_screen->id;
162
+ }
163
+ }
164
+ return $screens;
165
+ }
166
+
167
+ public function plugin_action_links( $links ) {
168
+ if ( !wpdesk_tracker_enabled() ) {
169
+ return $links;
170
+ }
171
+ $options = get_option('wpdesk_helper_options', array() );
172
+ if ( empty( $options['wpdesk_tracker_agree'] ) ) {
173
+ $options['wpdesk_tracker_agree'] = '0';
174
+ }
175
+ $plugin_links = array();
176
+ if ( $options['wpdesk_tracker_agree'] == '0' ) {
177
+ $opt_in_link = admin_url( 'admin.php?page=wpdesk_tracker&plugin=flexible-shipping/flexible-shipping.php' );
178
+ $plugin_links[] = '<a href="' . $opt_in_link . '">' . __( 'Opt-in', 'flexible-shipping' ) . '</a>';
179
+ }
180
+ else {
181
+ $opt_in_link = admin_url( 'plugins.php?wpdesk_tracker_opt_out=1&plugin=flexible-shipping/flexible-shipping.php' );
182
+ $plugin_links[] = '<a href="' . $opt_in_link . '">' . __( 'Opt-out', 'flexible-shipping' ) . '</a>';
183
+ }
184
+ return array_merge( $plugin_links, $links );
185
+ }
186
+
187
+
188
+ public function activated_plugin( $plugin, $network_wide ) {
189
+ if ( !wpdesk_tracker_enabled() ) {
190
+ return;
191
+ }
192
+ if ( $plugin == 'flexible-shipping/flexible-shipping.php' ) {
193
+ $options = get_option('wpdesk_helper_options', array() );
194
+ if ( empty( $options ) ) {
195
+ $options = array();
196
+ }
197
+ if ( empty( $options['wpdesk_tracker_agree'] ) ) {
198
+ $options['wpdesk_tracker_agree'] = '0';
199
+ }
200
+ $wpdesk_tracker_skip_plugin = get_option( 'wpdesk_tracker_skip_flexible_shipping', '0' );
201
+ if ( $options['wpdesk_tracker_agree'] == '0' && $wpdesk_tracker_skip_plugin == '0' ) {
202
+ update_option( 'wpdesk_tracker_notice', '1' );
203
+ update_option( 'wpdesk_tracker_skip_flexible_shipping', '1' );
204
+ wp_redirect( admin_url( 'admin.php?page=wpdesk_tracker&plugin=flexible-shipping/flexible-shipping.php' ) );
205
+ exit;
206
+ }
207
+ }
208
+ }
209
+
210
+
211
+ }
212
+
213
+ new WPDesk_Flexible_Shipping_Tracker();
214
+
215
+ }
216
+
217
+ if ( !function_exists( 'wpdesk_activated_plugin_activation_date' ) ) {
218
+ function wpdesk_activated_plugin_activation_date( $plugin, $network_wide ) {
219
+ $option_name = 'plugin_activation_' . $plugin;
220
+ $activation_date = get_option( $option_name, '' );
221
+ if ( $activation_date == '' ) {
222
+ $activation_date = current_time( 'mysql' );
223
+ update_option( $option_name, $activation_date );
224
+ }
225
+ }
226
+ add_action( 'activated_plugin', 'wpdesk_activated_plugin_activation_date', 10, 2 );
227
+ }
classes/views/html-column-shipping-shipping.php CHANGED
@@ -7,10 +7,10 @@
7
  <?php do_action( 'flexible_shipping_shipping_status_html', $shipping ); ?>
8
  </div>
9
  <div class="shipping-actions order_actions">
10
- <?php if ( isset( $shipping['label_url'] ) ) : ?>
11
  <a class="button tips get-label" target="_blank" href="<?php echo $shipping['label_url']; ?>" data-tip="<?php _e( 'Get label for: ', 'flexible-shipping' ); ?><?php echo $shipping['tracking_number']; ?>"><?php _e( 'Get label for: ', 'flexible-shipping' ); ?><?php echo $shipping['tracking_number']; ?></a>
12
  <?php endif; ?>
13
- <?php if ( isset( $shipping['tracking_url'] ) ) : ?>
14
  <a class="button tips track" target="_blank" href="<?php echo $shipping['tracking_url']; ?>" data-tip="<?php _e( 'Track shipment for: ', 'flexible-shipping' ); ?><?php echo $shipping['tracking_number']; ?>"><?php _e( 'Track shipment for: ', 'flexible-shipping' ); ?><?php echo $shipping['tracking_number']; ?></a>
15
  <?php endif; ?>
16
  <?php do_action( 'flexible_shipping_shipping_actions_html', $shipping ); ?>
7
  <?php do_action( 'flexible_shipping_shipping_status_html', $shipping ); ?>
8
  </div>
9
  <div class="shipping-actions order_actions">
10
+ <?php if ( !empty( $shipping['label_url'] ) ) : ?>
11
  <a class="button tips get-label" target="_blank" href="<?php echo $shipping['label_url']; ?>" data-tip="<?php _e( 'Get label for: ', 'flexible-shipping' ); ?><?php echo $shipping['tracking_number']; ?>"><?php _e( 'Get label for: ', 'flexible-shipping' ); ?><?php echo $shipping['tracking_number']; ?></a>
12
  <?php endif; ?>
13
+ <?php if ( !empty( $shipping['tracking_url'] ) ) : ?>
14
  <a class="button tips track" target="_blank" href="<?php echo $shipping['tracking_url']; ?>" data-tip="<?php _e( 'Track shipment for: ', 'flexible-shipping' ); ?><?php echo $shipping['tracking_number']; ?>"><?php _e( 'Track shipment for: ', 'flexible-shipping' ); ?><?php echo $shipping['tracking_number']; ?></a>
15
  <?php endif; ?>
16
  <?php do_action( 'flexible_shipping_shipping_actions_html', $shipping ); ?>
classes/views/html-shipping-method-rules.php CHANGED
@@ -58,7 +58,7 @@
58
 
59
  if ( ! in_array( 'flexible-shipping-pro/flexible-shipping-pro.php', apply_filters( 'active_plugins', get_option( 'active_plugins' ) ) ) ):
60
  ?>
61
- <p><?php printf( __( 'Check %sFlexible Shipping PRO &rarr;%s to add advanced rules based on shipping classes, product/item count or additional handling fees/insurance.', 'flexible-shipping' ), '<a href="' . $fs_pro_link . '?utm_source=flexible-shipping-method&utm_medium=text-link&utm_campaign=flexible-shipping-pro" target="_blank">', '</a>' ); ?></p>
62
  <?php endif; ?>
63
  </th>
64
  </tr>
@@ -83,7 +83,7 @@
83
  </th>
84
  <th class="cost_per_order">
85
  <?php _e( 'Cost per order', 'flexible-shipping' ); ?>
86
- <span class="woocommerce-help-tip" data-tip="<?php _e( 'Enter shipping cost for this rule.', 'flexible-shipping' ); ?>"></span>
87
  </th>
88
  <?php do_action( 'flexible_shipping_method_rule_thead', '' ); ?>
89
  </tr>
58
 
59
  if ( ! in_array( 'flexible-shipping-pro/flexible-shipping-pro.php', apply_filters( 'active_plugins', get_option( 'active_plugins' ) ) ) ):
60
  ?>
61
+ <p><?php printf( __( 'Check %sFlexible Shipping PRO &rarr;%s to add advanced rules based on shipment classes, product/item count or additional handling fees/insurance.', 'flexible-shipping' ), '<a href="' . $fs_pro_link . '?utm_source=flexible-shipping-method&utm_medium=text-link&utm_campaign=flexible-shipping-pro" target="_blank">', '</a>' ); ?></p>
62
  <?php endif; ?>
63
  </th>
64
  </tr>
83
  </th>
84
  <th class="cost_per_order">
85
  <?php _e( 'Cost per order', 'flexible-shipping' ); ?>
86
+ <span class="woocommerce-help-tip" data-tip="<?php _e( 'Enter shipment cost for this rule.', 'flexible-shipping' ); ?>"></span>
87
  </th>
88
  <?php do_action( 'flexible_shipping_method_rule_thead', '' ); ?>
89
  </tr>
classes/views/html-shipping-method-settings.php CHANGED
@@ -66,7 +66,7 @@
66
  <tfoot>
67
  <tr>
68
  <th>&nbsp;</th>
69
- <th colspan="8"><span class="description"><?php _e( 'Drag and drop the above shipping methods to control their display order. Confirm by clicking Save changes button below.', 'flexible-shipping' ); ?></span></th>
70
  </tr>
71
  <tr>
72
  <th>&nbsp;</th>
@@ -152,7 +152,7 @@
152
  }
153
  })
154
  if ( first ) {
155
- alert( '<?php _e( 'Please select shipping methods to remove', 'flexible-shipping' ); ?>' );
156
  return false;
157
  }
158
  if ( url != '<?php echo add_query_arg( 'method_id' , '', add_query_arg( 'action', 'delete' ) ); ?>' ) {
66
  <tfoot>
67
  <tr>
68
  <th>&nbsp;</th>
69
+ <th colspan="8"><span class="description"><?php _e( 'Drag and drop the above shipment methods to control their display order. Confirm by clicking Save changes button below.', 'flexible-shipping' ); ?></span></th>
70
  </tr>
71
  <tr>
72
  <th>&nbsp;</th>
152
  }
153
  })
154
  if ( first ) {
155
+ alert( '<?php _e( 'Please select shipment methods to remove', 'flexible-shipping' ); ?>' );
156
  return false;
157
  }
158
  if ( url != '<?php echo add_query_arg( 'method_id' , '', add_query_arg( 'action', 'delete' ) ); ?>' ) {
flexible-shipping.php CHANGED
@@ -2,13 +2,13 @@
2
  /*
3
  Plugin Name: Flexible Shipping
4
  Plugin URI: https://wordpress.org/plugins/flexible-shipping/
5
- Description: Create additional shipping methods in WooCommerce and enable pricing based on cart weight or total.
6
- Version: 1.9
7
  Author: WP Desk
8
  Author URI: https://www.wpdesk.net/
9
  Text Domain: flexible-shipping
10
  Domain Path: /languages/
11
- Tested up to: 4.7.3
12
 
13
  Copyright 2017 WP Desk Ltd.
14
 
@@ -48,21 +48,52 @@ if ( !function_exists( 'wpdesk_is_plugin_active' ) ) {
48
  }
49
  }
50
 
 
 
 
 
 
 
 
 
 
 
 
 
 
51
  if ( wpdesk_is_plugin_active( 'woocommerce/woocommerce.php' ) ) {
52
 
53
  class WPDesk_Flexible_Shipping_Free_Plugin extends inspire_Plugin4 {
54
 
55
- private $scripts_version = '17';
56
 
57
  protected $_pluginNamespace = "flexible-shipping";
58
 
59
  public function __construct() {
60
  parent::__construct();
61
- add_action( 'plugins_loaded', array($this, 'init_flexible_shipping'), 1000 );
62
  }
63
 
64
  public function init_flexible_shipping() {
65
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
66
  require_once('classes/bulk-actions.php');
67
  new WPDesk_Flexible_Shipping_Bulk_Actions();
68
 
@@ -78,18 +109,15 @@ if ( wpdesk_is_plugin_active( 'woocommerce/woocommerce.php' ) ) {
78
 
79
  add_filter( 'woocommerce_shipping_chosen_method', array( $this, 'woocommerce_shipping_chosen_method' ), 10, 2);
80
 
81
- if ( version_compare( WC_VERSION, '2.7', '<' ) ) {
82
- add_action( 'woocommerce_checkout_update_order_meta', array(
83
- $this,
84
- 'woocommerce_checkout_update_order_meta'
85
- ) );
86
- }
87
- else {
88
- add_action( 'woocommerce_checkout_create_order', array(
89
- $this,
90
- 'woocommerce_checkout_create_order'
91
- ) );
92
- }
93
 
94
 
95
  add_action( 'init', array( $this, 'init_polylang') );
@@ -117,7 +145,7 @@ if ( wpdesk_is_plugin_active( 'woocommerce/woocommerce.php' ) ) {
117
 
118
  public function woocommerce_checkout_create_order( WC_Order $order ) {
119
  $order_shipping_methods = $order->get_shipping_methods();
120
- foreach ( $order_shipping_methods as $key => $shipping_method ) {
121
  if ( isset( $shipping_method['item_meta'] )
122
  && isset( $shipping_method['item_meta']['_fs_method'] )
123
  ) {
@@ -133,16 +161,18 @@ if ( wpdesk_is_plugin_active( 'woocommerce/woocommerce.php' ) ) {
133
  public function woocommerce_checkout_update_order_meta( $order_id ) {
134
  $order = wc_get_order( $order_id );
135
  $order_shipping_methods = $order->get_shipping_methods();
136
- foreach ( $order_shipping_methods as $key => $shipping_method ) {
137
- if ( isset( $shipping_method['item_meta'] )
138
- && isset( $shipping_method['item_meta']['_fs_method'] )
139
- && isset( $shipping_method['item_meta']['_fs_method'][0] )
140
- ) {
141
- $fs_method = unserialize( $shipping_method['item_meta']['_fs_method'][0] );
142
- if ( !empty( $fs_method['method_integration'] ) ) {
143
- add_post_meta( $order->id, '_flexible_shipping_integration', $fs_method['method_integration'] );
 
 
144
  }
145
- }
146
  }
147
  }
148
 
@@ -181,10 +211,9 @@ if ( wpdesk_is_plugin_active( 'woocommerce/woocommerce.php' ) ) {
181
  $shipping_method = WC_Shipping_Zones::get_shipping_method( $instance_id );
182
  $wc_shipping_classes = WC()->shipping->get_shipping_classes();
183
  $ret['shipping_method'] = $shipping_method;
184
- $all_shipping_methods = WC()->shipping()->get_shipping_methods();
185
- if ( empty( $all_shipping_methods ) ) {
186
- $all_shipping_methods = WC()->shipping()->load_shipping_methods();
187
- }
188
  $flexible_shipping = $all_shipping_methods['flexible_shipping'];
189
  $flexible_shipping_rates = $flexible_shipping->get_all_rates();
190
 
@@ -342,10 +371,7 @@ if ( wpdesk_is_plugin_active( 'woocommerce/woocommerce.php' ) ) {
342
 
343
  function init_polylang() {
344
  if ( function_exists( 'pll_register_string' ) ) {
345
- $all_shipping_methods = WC()->shipping()->get_shipping_methods();
346
- if ( empty( $all_shipping_methods ) ) {
347
- $all_shipping_methods = WC()->shipping()->load_shipping_methods();
348
- }
349
  $flexible_shipping = $all_shipping_methods['flexible_shipping'];
350
  $flexible_shipping_rates = $flexible_shipping->get_all_rates();
351
  foreach ( $flexible_shipping_rates as $flexible_shipping_rate ) {
@@ -365,10 +391,7 @@ if ( wpdesk_is_plugin_active( 'woocommerce/woocommerce.php' ) ) {
365
  function init_wpml() {
366
  if ( function_exists( 'icl_register_string' ) ) {
367
  $icl_language_code = defined('ICL_LANGUAGE_CODE') ? ICL_LANGUAGE_CODE : get_bloginfo('language');
368
- $all_shipping_methods = WC()->shipping()->get_shipping_methods();
369
- if ( empty( $all_shipping_methods ) ) {
370
- $all_shipping_methods = WC()->shipping()->load_shipping_methods();
371
- }
372
  $flexible_shipping = $all_shipping_methods['flexible_shipping'];
373
  $flexible_shipping_rates = $flexible_shipping->get_all_rates();
374
  foreach ( $flexible_shipping_rates as $flexible_shipping_rate ) {
@@ -440,10 +463,14 @@ if ( wpdesk_is_plugin_active( 'woocommerce/woocommerce.php' ) ) {
440
 
441
  function enqueue_admin_scripts() {
442
  $current_screen = get_current_screen();
443
- if ( $current_screen->id === 'woocommerce_page_wc-settings' || $current_screen->id === 'edit-shop_order' ) {
444
  $suffix = defined( 'SCRIPT_DEBUG' ) && SCRIPT_DEBUG ? '' : '.min';
445
- wp_enqueue_script( 'flexible-shipping-admin', $this->getPluginUrl() . 'assets/js/admin' . $suffix . '.js', array( 'jquery' ), $this->scripts_version );
446
- wp_enqueue_style( 'flexible-shipping-admin', $this->getPluginUrl() . 'assets/css/admin' . $suffix . '.css', array(), $this->scripts_version );
 
 
 
 
447
  }
448
  }
449
 
@@ -460,17 +487,23 @@ if ( wpdesk_is_plugin_active( 'woocommerce/woocommerce.php' ) ) {
460
  * @param mixed $links
461
  * @return void
462
  */
463
- public function linksFilter( $links ) {
464
- $docs_link = get_locale() === 'pl_PL' ? 'https://www.wpdesk.pl/docs/flexible-shipping-pro-woocommerce-docs/' : 'https://www.wpdesk.net/docs/flexible-shipping-pro-woocommerce-docs/';
465
  $support_link = get_locale() === 'pl_PL' ? 'https://www.wpdesk.pl/support/' : 'https://www.wpdesk.net/support';
466
 
467
  $plugin_links = array(
468
- '<a href="' . admin_url( 'admin.php?page=wc-settings&tab=shipping') . '">' . __( 'Settings', 'flexible-shipping-pro' ) . '</a>',
469
- '<a href="' . $docs_link . '">' . __( 'Docs', 'flexible-shipping-pro' ) . '</a>',
470
- '<a href="' . $support_link . '">' . __( 'Support', 'flexible-shipping-pro' ) . '</a>',
471
  );
472
 
473
- return array_merge( $plugin_links, $links );
 
 
 
 
 
 
474
  }
475
 
476
 
@@ -521,13 +554,22 @@ if ( wpdesk_is_plugin_active( 'woocommerce/woocommerce.php' ) ) {
521
 
522
  }
523
 
524
- function flexible_shipping_method_selected_in_cart( $shipping_method_integration ) {
525
- global $woocommerce;
526
- $shippings = $woocommerce->session->get('chosen_shipping_methods');
527
  $all_shipping_methods = WC()->shipping()->get_shipping_methods();
528
  if ( empty( $all_shipping_methods ) ) {
529
  $all_shipping_methods = WC()->shipping()->load_shipping_methods();
530
  }
 
 
 
 
 
 
 
 
 
 
531
  $flexible_shipping = $all_shipping_methods['flexible_shipping'];
532
  $flexible_shipping_rates = $flexible_shipping->get_all_rates();
533
  foreach ( $shippings as $id => $shipping ) {
@@ -546,7 +588,7 @@ if ( wpdesk_is_plugin_active( 'woocommerce/woocommerce.php' ) ) {
546
  $order = wc_get_order( $order );
547
  }
548
  $shippings = $order->get_shipping_methods();
549
- $all_shipping_methods = WC()->shipping()->get_shipping_methods();
550
  if ( isset( $all_shipping_methods['flexible_shipping'] ) ) {
551
  $flexible_shipping_rates = $all_shipping_methods['flexible_shipping']->get_all_rates();
552
  foreach ( $shippings as $id => $shipping ) {
@@ -562,7 +604,7 @@ if ( wpdesk_is_plugin_active( 'woocommerce/woocommerce.php' ) ) {
562
  }
563
 
564
  function flexible_shipping_get_integration_for_method( $method_id ) {
565
- $all_shipping_methods = WC()->shipping()->get_shipping_methods();
566
  if ( isset( $all_shipping_methods['flexible_shipping'] ) ) {
567
  $flexible_shipping_rates = $all_shipping_methods['flexible_shipping']->get_all_rates();
568
  if ( isset( $flexible_shipping_rates[$method_id] ) ) {
@@ -609,4 +651,14 @@ if ( wpdesk_is_plugin_active( 'woocommerce/woocommerce.php' ) ) {
609
  }
610
 
611
  $_GLOBALS['woocommerce_flexible_shipping'] = new WPDesk_Flexible_Shipping_Free_Plugin();
 
 
 
 
 
 
 
 
 
612
  }
 
2
  /*
3
  Plugin Name: Flexible Shipping
4
  Plugin URI: https://wordpress.org/plugins/flexible-shipping/
5
+ Description: Create additional shipment methods in WooCommerce and enable pricing based on cart weight or total.
6
+ Version: 1.9.1
7
  Author: WP Desk
8
  Author URI: https://www.wpdesk.net/
9
  Text Domain: flexible-shipping
10
  Domain Path: /languages/
11
+ Tested up to: 4.7.5
12
 
13
  Copyright 2017 WP Desk Ltd.
14
 
48
  }
49
  }
50
 
51
+ if ( !function_exists( 'wpdesk_tracker_enabled' ) ) {
52
+ function wpdesk_tracker_enabled() {
53
+ $tracker_enabled = true;
54
+ if ( !empty( $_SERVER['SERVER_ADDR'] ) && $_SERVER['SERVER_ADDR'] == '127.0.0.1' ) {
55
+ $tracker_enabled = false;
56
+ }
57
+ return apply_filters( 'wpdesk_tracker_enabled', $tracker_enabled );
58
+ // add_filter( 'wpdesk_tracker_enabled', '__return_true' );
59
+ }
60
+ }
61
+
62
+ //require_once('classes/tracker.php');
63
+
64
  if ( wpdesk_is_plugin_active( 'woocommerce/woocommerce.php' ) ) {
65
 
66
  class WPDesk_Flexible_Shipping_Free_Plugin extends inspire_Plugin4 {
67
 
68
+ private $scripts_version = '30';
69
 
70
  protected $_pluginNamespace = "flexible-shipping";
71
 
72
  public function __construct() {
73
  parent::__construct();
74
+ add_action( 'plugins_loaded', array($this, 'init_flexible_shipping'), 1 );
75
  }
76
 
77
  public function init_flexible_shipping() {
78
 
79
+ require_once('classes/shipment/cpt-shipment.php');
80
+ new WPDesk_Flexible_Shipping_Shipment_CPT( $this );
81
+
82
+ require_once('classes/manifest/cpt-shipping-manifest.php');
83
+ new WPDesk_Flexible_Shipping_Shipping_Manifest_CPT( $this );
84
+
85
+ require_once('classes/shipment/ajax.php');
86
+ new WPDesk_Flexible_Shipping_Shipment_Ajax( $this );
87
+
88
+ require_once('classes/shipment/class-shipment.php');
89
+ require_once('classes/shipment/interface-shipment.php');
90
+ require_once('classes/shipment/functions.php');
91
+
92
+ require_once('classes/manifest/class-manifest.php');
93
+ require_once('classes/manifest/interface-manifest.php');
94
+ require_once('classes/manifest/functions.php');
95
+ require_once('classes/manifest/class-manifest-fs.php');
96
+
97
  require_once('classes/bulk-actions.php');
98
  new WPDesk_Flexible_Shipping_Bulk_Actions();
99
 
109
 
110
  add_filter( 'woocommerce_shipping_chosen_method', array( $this, 'woocommerce_shipping_chosen_method' ), 10, 2);
111
 
112
+ add_action( 'woocommerce_checkout_update_order_meta', array(
113
+ $this,
114
+ 'woocommerce_checkout_update_order_meta'
115
+ ) );
116
+
117
+ add_action( 'woocommerce_checkout_create_order', array(
118
+ $this,
119
+ 'woocommerce_checkout_create_order'
120
+ ) );
 
 
 
121
 
122
 
123
  add_action( 'init', array( $this, 'init_polylang') );
145
 
146
  public function woocommerce_checkout_create_order( WC_Order $order ) {
147
  $order_shipping_methods = $order->get_shipping_methods();
148
+ foreach ( $order_shipping_methods as $shipping_id => $shipping_method ) {
149
  if ( isset( $shipping_method['item_meta'] )
150
  && isset( $shipping_method['item_meta']['_fs_method'] )
151
  ) {
161
  public function woocommerce_checkout_update_order_meta( $order_id ) {
162
  $order = wc_get_order( $order_id );
163
  $order_shipping_methods = $order->get_shipping_methods();
164
+ foreach ( $order_shipping_methods as $shipping_id => $shipping_method ) {
165
+ if ( version_compare( WC_VERSION, '2.7', '<' ) ) {
166
+ if (isset($shipping_method['item_meta'])
167
+ && isset($shipping_method['item_meta']['_fs_method'])
168
+ && isset($shipping_method['item_meta']['_fs_method'][0])
169
+ ) {
170
+ $fs_method = unserialize($shipping_method['item_meta']['_fs_method'][0]);
171
+ if ( !empty( $fs_method['method_integration'] ) ) {
172
+ add_post_meta($order->id, '_flexible_shipping_integration', $fs_method['method_integration']);
173
+ }
174
  }
175
+ }
176
  }
177
  }
178
 
211
  $shipping_method = WC_Shipping_Zones::get_shipping_method( $instance_id );
212
  $wc_shipping_classes = WC()->shipping->get_shipping_classes();
213
  $ret['shipping_method'] = $shipping_method;
214
+
215
+ $all_shipping_methods = flexible_shipping_get_all_shipping_methods();
216
+
 
217
  $flexible_shipping = $all_shipping_methods['flexible_shipping'];
218
  $flexible_shipping_rates = $flexible_shipping->get_all_rates();
219
 
371
 
372
  function init_polylang() {
373
  if ( function_exists( 'pll_register_string' ) ) {
374
+ $all_shipping_methods = flexible_shipping_get_all_shipping_methods();
 
 
 
375
  $flexible_shipping = $all_shipping_methods['flexible_shipping'];
376
  $flexible_shipping_rates = $flexible_shipping->get_all_rates();
377
  foreach ( $flexible_shipping_rates as $flexible_shipping_rate ) {
391
  function init_wpml() {
392
  if ( function_exists( 'icl_register_string' ) ) {
393
  $icl_language_code = defined('ICL_LANGUAGE_CODE') ? ICL_LANGUAGE_CODE : get_bloginfo('language');
394
+ $all_shipping_methods = flexible_shipping_get_all_shipping_methods();
 
 
 
395
  $flexible_shipping = $all_shipping_methods['flexible_shipping'];
396
  $flexible_shipping_rates = $flexible_shipping->get_all_rates();
397
  foreach ( $flexible_shipping_rates as $flexible_shipping_rate ) {
463
 
464
  function enqueue_admin_scripts() {
465
  $current_screen = get_current_screen();
466
+ if ( $current_screen->id === 'woocommerce_page_wc-settings' || $current_screen->id === 'edit-shop_order' || $current_screen->id === 'shop_order' ) {
467
  $suffix = defined( 'SCRIPT_DEBUG' ) && SCRIPT_DEBUG ? '' : '.min';
468
+ wp_register_script( 'fs_admin', $this->getPluginUrl() . 'assets/js/admin' . $suffix . '.js', array( 'jquery' ), $this->scripts_version );
469
+ wp_localize_script( 'fs_admin', 'fs_admin', array(
470
+ 'ajax_url' => admin_url( 'admin-ajax.php' ),
471
+ ));
472
+ wp_enqueue_script( 'fs_admin' );
473
+ wp_enqueue_style( 'fs_admin', $this->getPluginUrl() . 'assets/css/admin' . $suffix . '.css', array(), $this->scripts_version );
474
  }
475
  }
476
 
487
  * @param mixed $links
488
  * @return void
489
  */
490
+ public function linksFilter( $links ) {
491
+ $docs_link = get_locale() === 'pl_PL' ? 'https://www.wpdesk.pl/docs/flexible-shipping-pro-woocommerce-docs/' : 'https://www.wpdesk.net/docs/flexible-shipping-pro-woocommerce-docs/';
492
  $support_link = get_locale() === 'pl_PL' ? 'https://www.wpdesk.pl/support/' : 'https://www.wpdesk.net/support';
493
 
494
  $plugin_links = array(
495
+ '<a href="' . admin_url( 'admin.php?page=wc-settings&tab=shipping') . '">' . __( 'Settings', 'flexible-shipping' ) . '</a>',
496
+ '<a href="' . $docs_link . '">' . __( 'Docs', 'flexible-shipping' ) . '</a>',
497
+ '<a href="' . $support_link . '">' . __( 'Support', 'flexible-shipping' ) . '</a>',
498
  );
499
 
500
+ $pro_link = get_locale() === 'pl_PL' ? 'https://www.wpdesk.pl/sklep/flexible-shipping-pro-woocommerce/' : 'https://www.wpdesk.net/products/flexible-shipping-pro-woocommerce/';
501
+ $utm = '?utm_source=wp-admin-plugins&utm_medium=link&utm_campaign=flexible-shipping-plugins-upgrade-link';
502
+
503
+ if ( ! wpdesk_is_plugin_active( 'flexible-shipping-pro/flexible-shipping-pro.php' ) )
504
+ $plugin_links[] = '<a href="' . $pro_link . $utm . '" target="_blank" style="color:#d64e07;font-weight:bold;">' . __( 'Upgrade', 'flexible-shipping' ) . '</a>';
505
+
506
+ return array_merge( $plugin_links, $links );
507
  }
508
 
509
 
554
 
555
  }
556
 
557
+ function flexible_shipping_get_all_shipping_methods() {
558
+ /*
 
559
  $all_shipping_methods = WC()->shipping()->get_shipping_methods();
560
  if ( empty( $all_shipping_methods ) ) {
561
  $all_shipping_methods = WC()->shipping()->load_shipping_methods();
562
  }
563
+ */
564
+ $all_shipping_methods = WC()->shipping()->load_shipping_methods();
565
+ return $all_shipping_methods;
566
+ }
567
+
568
+
569
+ function flexible_shipping_method_selected_in_cart( $shipping_method_integration ) {
570
+ global $woocommerce;
571
+ $shippings = $woocommerce->session->get('chosen_shipping_methods');
572
+ $all_shipping_methods = flexible_shipping_get_all_shipping_methods();
573
  $flexible_shipping = $all_shipping_methods['flexible_shipping'];
574
  $flexible_shipping_rates = $flexible_shipping->get_all_rates();
575
  foreach ( $shippings as $id => $shipping ) {
588
  $order = wc_get_order( $order );
589
  }
590
  $shippings = $order->get_shipping_methods();
591
+ $all_shipping_methods = flexible_shipping_get_all_shipping_methods();
592
  if ( isset( $all_shipping_methods['flexible_shipping'] ) ) {
593
  $flexible_shipping_rates = $all_shipping_methods['flexible_shipping']->get_all_rates();
594
  foreach ( $shippings as $id => $shipping ) {
604
  }
605
 
606
  function flexible_shipping_get_integration_for_method( $method_id ) {
607
+ $all_shipping_methods = flexible_shipping_get_all_shipping_methods();
608
  if ( isset( $all_shipping_methods['flexible_shipping'] ) ) {
609
  $flexible_shipping_rates = $all_shipping_methods['flexible_shipping']->get_all_rates();
610
  if ( isset( $flexible_shipping_rates[$method_id] ) ) {
651
  }
652
 
653
  $_GLOBALS['woocommerce_flexible_shipping'] = new WPDesk_Flexible_Shipping_Free_Plugin();
654
+
655
+ //add_action( 'plugins_loaded', 'flexible_shipping_plugins_loaded', 9 );
656
+ function flexible_shipping_plugins_loaded() {
657
+ if ( !class_exists( 'WPDesk_Tracker' ) ) {
658
+ include( 'inc/wpdesk-tracker/class-wpdesk-tracker.php' );
659
+ WPDesk_Tracker::init( basename( dirname( __FILE__ ) ) );
660
+ }
661
+ }
662
+
663
  }
664
+
inc/wpdesk-tracker/assets/css/tracker.css ADDED
@@ -0,0 +1,99 @@
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
+ /* Connect */
2
+ #wpdesk_tracker_connect {
3
+ margin-top: 30px;
4
+ }
5
+
6
+ #wpdesk_tracker_connect .wpdesk-logo {
7
+ background-image: url(../images/logo.png);
8
+ background-repeat: no-repeat;
9
+ background-size: 215px 62px;
10
+ display: block;
11
+ height: 62px;
12
+ margin: 0 auto;
13
+ width: 215px;
14
+ }
15
+
16
+ @media (-webkit-min-device-pixel-ratio: 2), (min-resolution: 192dpi) {
17
+ #wpdesk_tracker_connect .wpdesk-logo {
18
+ background-image: url(../images/logo@2x.png);
19
+ background-size: 215px 62px;
20
+ }
21
+ }
22
+
23
+ #wpdesk_tracker_connect .message p {
24
+ font-size: 14px;
25
+ }
26
+
27
+ #wpdesk_tracker_connect .plugin-card-bottom {
28
+ border-bottom: 1px solid #ddd;
29
+ margin-bottom: 10px;
30
+ }
31
+
32
+ #wpdesk_tracker_connect .button-allow {
33
+ float: right;
34
+ }
35
+
36
+ #wpdesk_tracker_connect .permissions .trigger {
37
+ display: block;
38
+ font-size: .9em;
39
+ text-align: center;
40
+ margin-bottom: 10px;
41
+ text-decoration: none;
42
+ }
43
+
44
+ #wpdesk_tracker_connect .permissions .permissions-details {
45
+ height: 0;
46
+ overflow: hidden;
47
+ margin: 0;
48
+ }
49
+
50
+ #wpdesk_tracker_connect .permissions.open .permissions-details {
51
+ height: auto;
52
+ padding: 10px 20px;
53
+ }
54
+
55
+ #wpdesk_tracker_connect .permissions ul {
56
+ margin: 0;
57
+ }
58
+
59
+ #wpdesk_tracker_connect .permissions ul li {
60
+ margin-bottom: 12px;
61
+ }
62
+
63
+ #wpdesk_tracker_connect .permissions ul li i.dashicons {
64
+ float: left;
65
+ font-size: 40px;
66
+ width: 40px;
67
+ height: 40px;
68
+ }
69
+
70
+ #wpdesk_tracker_connect .permissions ul li div {
71
+ margin-left: 55px;
72
+ }
73
+
74
+ #wpdesk_tracker_connect .permissions ul li div span {
75
+ font-weight: bold;
76
+ }
77
+
78
+ #wpdesk_tracker_connect .permissions ul li div p {
79
+ margin: 2px 0 0 0;
80
+ }
81
+
82
+ #wpdesk_tracker_connect .terms {
83
+ font-size: .9em;
84
+ padding: 5px;
85
+ }
86
+
87
+ #wpdesk_tracker_connect .terms a {
88
+ color: #999;
89
+ }
90
+
91
+ /* Deactivate */
92
+ .wpdesk_tracker_deactivate .reason-input {
93
+ display: none;
94
+ }
95
+
96
+ .wpdesk_tracker_deactivate .reason-input input[type=text] {
97
+ margin-left: 25px;
98
+ width: 350px;
99
+ }
inc/wpdesk-tracker/assets/css/tracker.min.css ADDED
@@ -0,0 +1 @@
 
1
+ #wpdesk_tracker_connect{margin-top:30px}#wpdesk_tracker_connect .wpdesk-logo{background-image:url(../images/logo.png);background-repeat:no-repeat;background-size:215px 62px;display:block;height:62px;margin:0 auto;width:215px}@media (-webkit-min-device-pixel-ratio: 2),(min-resolution: 192dpi){#wpdesk_tracker_connect .wpdesk-logo{background-image:url(../images/logo@2x.png);background-size:215px 62px}}#wpdesk_tracker_connect .message p{font-size:14px}#wpdesk_tracker_connect .plugin-card-bottom{border-bottom:1px solid #ddd;margin-bottom:10px}#wpdesk_tracker_connect .button-allow{float:right}#wpdesk_tracker_connect .permissions .trigger{display:block;font-size:.9em;text-align:center;margin-bottom:10px;text-decoration:none}#wpdesk_tracker_connect .permissions .permissions-details{height:0;overflow:hidden;margin:0}#wpdesk_tracker_connect .permissions.open .permissions-details{height:auto;padding:10px 20px}#wpdesk_tracker_connect .permissions ul{margin:0}#wpdesk_tracker_connect .permissions ul li{margin-bottom:12px}#wpdesk_tracker_connect .permissions ul li i.dashicons{float:left;font-size:40px;width:40px;height:40px}#wpdesk_tracker_connect .permissions ul li div{margin-left:55px}#wpdesk_tracker_connect .permissions ul li div span{font-weight:bold}#wpdesk_tracker_connect .permissions ul li div p{margin:2px 0 0 0}#wpdesk_tracker_connect .terms{font-size:.9em;padding:5px}#wpdesk_tracker_connect .terms a{color:#999}.wpdesk_tracker_deactivate .reason-input{display:none}.wpdesk_tracker_deactivate .reason-input input[type=text]{margin-left:25px;width:350px}
inc/wpdesk-tracker/assets/images/logo.png ADDED
Binary file
inc/wpdesk-tracker/assets/images/logo@2x.png ADDED
Binary file
inc/wpdesk-tracker/class-wpdesk-tracker.php ADDED
@@ -0,0 +1,804 @@
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
+ <?php
2
+ /**
3
+ * WP Desk Tracker
4
+ *
5
+ * @class WPDESK_Tracker
6
+ * @version 2.3.0
7
+ * @package WPDESK/Helper
8
+ * @category Class
9
+ * @author WP Desk
10
+ */
11
+
12
+ if ( ! defined( 'ABSPATH' ) ) {
13
+ exit;
14
+ }
15
+
16
+ if ( !class_exists( 'WPDesk_Tracker' ) ) {
17
+
18
+ class WPDesk_Tracker {
19
+
20
+ public static $script_version = '11';
21
+
22
+ public static $request_coupon = false;
23
+
24
+ public static $plugin_basename = '';
25
+
26
+ /**
27
+ * URL to the WP Desk Tracker API endpoint.
28
+ * @var string
29
+ */
30
+ private static $api_url = 'https://data.wpdesk.org/?track=1';
31
+ //private static $api_url = 'http://woo271.grola.pl/?track=1';
32
+
33
+ /**
34
+ * Hook into cron event.
35
+ */
36
+ public static function init( $plugin_basename ) {
37
+ self::$plugin_basename = $plugin_basename;
38
+ add_action( 'plugins_loaded', array( __CLASS__, 'load_plugin_text_domain') );
39
+ add_action( 'admin_enqueue_scripts', array( __CLASS__, 'admin_enqueue_scripts' ), 100 );
40
+ add_action( 'wpdesk_tracker_send_event', array( __CLASS__, 'send_tracking_data' ) );
41
+ add_action( 'admin_menu', array( __CLASS__, 'admin_menu' ) );
42
+ add_action( 'admin_init', array( __CLASS__, 'admin_init' ) );
43
+ add_action( 'admin_notices', array( __CLASS__, 'admin_notices' ) );
44
+ add_action( 'wp_ajax_wpdesk_tracker_notice_handler', array( __CLASS__, 'wp_ajax_wpdesk_tracker_notice_handler' ) );
45
+ add_action( 'wp_ajax_wpdesk_tracker_deactivation_handler', array( __CLASS__, 'wp_ajax_wpdesk_tracker_deactivation_handler' ) );
46
+ add_action( 'update_option_wpdesk_helper_options', array( __CLASS__, 'update_option_wpdesk_helper_options' ), 10, 3 );
47
+
48
+ add_filter( 'wpdesk_tracker_data', array( __CLASS__, 'wpdesk_tracker_data_license_emails' ) );
49
+ add_filter( 'wpdesk_tracker_data', array( __CLASS__, 'wpdesk_tracker_data_shipping_country_per_order' ) );
50
+ add_filter( 'wpdesk_tracker_data', array( __CLASS__, 'wpdesk_tracker_data_shipping_classes' ) );
51
+ add_filter( 'wpdesk_tracker_data', array( __CLASS__, 'wpdesk_tracker_data_product_variations' ) );
52
+ add_filter( 'wpdesk_tracker_data', array( __CLASS__, 'wpdesk_tracker_data_orders_per_month' ) );
53
+
54
+ global $pagenow;
55
+ if ( 'plugins.php' === $pagenow ) {
56
+ add_action( 'admin_footer', array( __CLASS__, 'admin_footer' ) );
57
+ }
58
+
59
+ $options = get_option('wpdesk_helper_options', array() );
60
+ if ( !is_array( $options ) ) {
61
+ $options = array();
62
+ }
63
+ if ( empty( $options['wpdesk_tracker_agree'] ) ) {
64
+ $options['wpdesk_tracker_agree'] = '0';
65
+ }
66
+ $wpdesk_tracker_agree = $options['wpdesk_tracker_agree'];
67
+ $wp_next_scheduled = wp_next_scheduled( 'wpdesk_tracker_send_event' );
68
+ if ( $wpdesk_tracker_agree == '1' && !$wp_next_scheduled ) {
69
+ wp_schedule_event( time(), 'daily', 'wpdesk_tracker_send_event' );
70
+ }
71
+ if ( $wpdesk_tracker_agree == '0' && $wp_next_scheduled ) {
72
+ wp_clear_scheduled_hook( 'wpdesk_tracker_send_event' );
73
+ }
74
+ }
75
+
76
+ public static function load_plugin_text_domain() {
77
+ $wpdesk_translation = load_plugin_textdomain( 'wpdesk-tracker', FALSE, self::$plugin_basename . '/inc/wpdesk-tracker/lang' );
78
+ }
79
+
80
+ public static function admin_footer() {
81
+ if ( wpdesk_tracker_enabled() ) {
82
+ $plugins = array(
83
+ 'wpdesk-helper/wpdesk-helper.php' => 'wpdesk-helper/wpdesk-helper.php'
84
+ );
85
+ $plugins = apply_filters( 'wpdesk_track_plugin_deactivation', $plugins );
86
+ include( 'views/tracker-plugins-footer.php' );
87
+ }
88
+ }
89
+
90
+ public static function admin_enqueue_scripts() {
91
+ $screen = get_current_screen();
92
+ if ( $screen->id == 'admin_page_wpdesk_tracker' || $screen->id == 'admin_page_wpdesk_tracker_deactivate' ) {
93
+ wp_register_style( 'wpdesk-helper-tracker', plugin_dir_url( __FILE__ ) . 'assets/css/tracker.css', array(), self::$script_version, 'all' );
94
+ wp_enqueue_style( 'wpdesk-helper-tracker' );
95
+ }
96
+ }
97
+
98
+ public static function admin_menu() {
99
+ add_submenu_page(
100
+ null,
101
+ 'WP Desk Tracker',
102
+ 'WP Desk Tracker',
103
+ 'manage_options',
104
+ 'wpdesk_tracker',
105
+ array( __CLASS__, 'wpdesk_tracker_page' )
106
+ );
107
+ add_submenu_page(
108
+ null,
109
+ 'Deactivate plugin',
110
+ 'Deactivate plugin',
111
+ 'manage_options',
112
+ 'wpdesk_tracker_deactivate',
113
+ array( __CLASS__, 'wpdesk_tracker_deactivate' )
114
+ );
115
+ }
116
+
117
+ public static function wp_ajax_wpdesk_tracker_deactivation_handler() {
118
+ self::send_deactivation_data();
119
+ }
120
+
121
+
122
+ public static function wp_ajax_wpdesk_tracker_notice_handler() {
123
+ $type = '';
124
+ if ( isset( $_REQUEST['type'] ) ) {
125
+ $type = $_REQUEST['type'];
126
+ }
127
+ if ( $type == 'allow' ) {
128
+ $options = get_option('wpdesk_helper_options', array() );
129
+ if ( !is_array( $options ) ) {
130
+ $options = array();
131
+ }
132
+ update_option( 'wpdesk_helper_options', $options );
133
+ delete_option( 'wpdesk_tracker_notice' );
134
+ $options['wpdesk_tracker_agree'] = '1';
135
+ update_option( 'wpdesk_helper_options', $options );
136
+ }
137
+ if ( $type == 'dismiss' ) {
138
+ $options = get_option('wpdesk_helper_options', array() );
139
+ if ( !is_array( $options ) ) {
140
+ $options = array();
141
+ }
142
+ delete_option( 'wpdesk_tracker_notice' );
143
+ $options['wpdesk_tracker_agree'] = '0';
144
+ update_option( 'wpdesk_helper_options', $options );
145
+ update_option( 'wpdesk_tracker_notice', '1' );
146
+ }
147
+ if ( $type == 'allow_coupon' ) {
148
+ self::$request_coupon = true;
149
+ $options = get_option('wpdesk_helper_options', array() );
150
+ if ( !is_array( $options ) ) {
151
+ $options = array();
152
+ }
153
+ update_option( 'wpdesk_helper_options', $options );
154
+ delete_option( 'wpdesk_tracker_notice' );
155
+ $options['wpdesk_tracker_agree'] = '1';
156
+ update_option( 'wpdesk_helper_options', $options );
157
+ }
158
+ if ( $type == 'dismiss_coupon' ) {
159
+ $options = get_option('wpdesk_helper_options', array() );
160
+ if ( !is_array( $options ) ) {
161
+ $options = array();
162
+ }
163
+ delete_option( 'wpdesk_tracker_notice' );
164
+ $options['wpdesk_tracker_agree'] = '0';
165
+ update_option( 'wpdesk_helper_options', $options );
166
+ update_option( 'wpdesk_tracker_notice', 'dismiss_all' );
167
+ }
168
+ }
169
+
170
+ public static function update_option_wpdesk_helper_options( $old_value, $value, $option ) {
171
+ if ( empty( $old_value ) ) {
172
+ $old_value = array( 'wpdesk_tracker_agree' => '0' );
173
+ }
174
+ if ( empty( $old_value['wpdesk_tracker_agree'] ) ) {
175
+ $old_value['wpdesk_tracker_agree'] = '0';
176
+ }
177
+ if ( empty( $value ) ) {
178
+ $value = array( 'wpdesk_tracker_agree' => '0' );
179
+ }
180
+ if ( empty( $value['wpdesk_tracker_agree'] ) ) {
181
+ $value['wpdesk_tracker_agree'] = '0';
182
+ }
183
+ if ( $old_value['wpdesk_tracker_agree'] == '0' ) {
184
+ if ( $value['wpdesk_tracker_agree'] == '1' ) {
185
+ self::send_tracking_data( true, 'agree' );
186
+ }
187
+ }
188
+ if ( $old_value['wpdesk_tracker_agree'] == '1' ) {
189
+ if ( $value['wpdesk_tracker_agree'] == '0' ) {
190
+ self::send_tracking_data( true, 'no' );
191
+ update_option( 'wpdesk_tracker_notice', 'dismiss_all' );
192
+ }
193
+ }
194
+ }
195
+
196
+ public static function admin_notices() {
197
+ if ( !wpdesk_tracker_enabled() ) {
198
+ return;
199
+ }
200
+ $screen = get_current_screen();
201
+ $options = get_option('wpdesk_helper_options', array() );
202
+ if ( !is_array( $options ) ) {
203
+ $options = array();
204
+ }
205
+ if ( get_option( 'wpdesk_tracker_notice', '0' ) != 'dismiss_all' ) {
206
+ if ( empty( $options['wpdesk_tracker_agree'] ) || $options['wpdesk_tracker_agree'] == '0' ) {
207
+ $coupon_avaliable = false;
208
+ if ( get_option( 'wpdesk_tracker_notice', '0' ) == '1' ) {
209
+ $coupon_avaliable = true;
210
+ }
211
+ if ( in_array( $screen->id, apply_filters( 'wpdesk_tracker_notice_screens', array() ) ) ) {
212
+ $user = wp_get_current_user();
213
+ $username = $user->first_name ? $user->first_name : $user->user_login;
214
+ $terms_url = get_locale() == 'pl_PL' ? 'https://www.wpdesk.pl/dane-uzytkowania/' : 'https://www.wpdesk.net/usage-tracking/';
215
+ include( 'views/tracker-notice.php' );
216
+ }
217
+ }
218
+ }
219
+ if ( $screen->id == 'plugins' ) {
220
+ if ( isset( $_GET['wpdesk_tracker_opt_out'] ) ) {
221
+ $options = get_option('wpdesk_helper_options', array() );
222
+ if ( !is_array( $options ) ) {
223
+ $options = array();
224
+ }
225
+ delete_option( 'wpdesk_tracker_notice' );
226
+ $options['wpdesk_tracker_agree'] = '0';
227
+ update_option( 'wpdesk_helper_options', $options );
228
+ include( 'views/tracker-opt-out-notice.php' );
229
+ }
230
+ }
231
+ }
232
+
233
+ public static function wpdesk_tracker_page() {
234
+ $user = wp_get_current_user();
235
+ $username = $user->first_name ? $user->first_name : $user->user_login;
236
+ $allow_url = admin_url( 'admin.php?page=wpdesk_tracker' );
237
+ $allow_url = add_query_arg( 'plugin', $_GET['plugin'], $allow_url );
238
+ $skip_url = $allow_url;
239
+ $allow_url = add_query_arg( 'allow', '1', $allow_url );
240
+ $skip_url = add_query_arg( 'allow', '0', $skip_url );
241
+ $terms_url = get_locale() == 'pl_PL' ? 'https://www.wpdesk.pl/dane-uzytkowania/' : 'https://www.wpdesk.net/usage-tracking/';
242
+ include( 'views/tracker-connect.php' );
243
+ }
244
+
245
+ public static function wpdesk_tracker_deactivate() {
246
+ $user = wp_get_current_user();
247
+ $username = $user->first_name;
248
+ $plugin = $_GET['plugin'];
249
+ $active_plugins = get_plugins();
250
+ $plugin_name = $active_plugins[$plugin]['Name'];
251
+ include( 'views/tracker-deactivate.php' );
252
+ }
253
+
254
+ public static function admin_init() {
255
+ if ( isset( $_GET['page'] ) && $_GET['page'] == 'wpdesk_tracker' ) {
256
+ if ( isset( $_GET['plugin'] ) && isset( $_GET['allow'] ) ) {
257
+ $options = get_option('wpdesk_helper_options', array() );
258
+ if ( !is_array( $options ) ) {
259
+ $options = array();
260
+ }
261
+ if ( $_GET['allow'] == '0' ) {
262
+ $options['wpdesk_tracker_agree'] = '0';
263
+ update_option( 'wpdesk_helper_options', $options );
264
+ }
265
+ else {
266
+ delete_option( 'wpdesk_tracker_notice' );
267
+ update_option( 'wpdesk_tracker_agree', '1' );
268
+ $options['wpdesk_tracker_agree'] = '1';
269
+ update_option( 'wpdesk_helper_options', $options );
270
+ }
271
+ wp_redirect(admin_url( 'plugins.php' ) );
272
+ exit();
273
+ }
274
+ }
275
+ }
276
+
277
+ public static function wpdesk_tracker_data_license_emails( $data ) {
278
+ global $wpdesk_helper_plugins;
279
+ $license_emails_email = array();
280
+ $license_emails = array();
281
+ if ( ! isset( $wpdesk_helper_plugins ) ) $wpdesk_helper_plugins = array();
282
+ foreach ( $wpdesk_helper_plugins as $key => $plugin ) {
283
+ if ( isset( $plugin['api_manager'] ) ) {
284
+ $api_manager = $plugin['api_manager'];
285
+ if ( isset( $api_manager->options[$api_manager->activation_email] ) ) {
286
+ $license_emails_email[ $api_manager->options[ $api_manager->activation_email ] ] = $api_manager->options[ $api_manager->activation_email ];
287
+ }
288
+ }
289
+ }
290
+ foreach ( $license_emails_email as $email ) {
291
+ $license_emails[] = $email;
292
+ }
293
+ $data['license_emails'] = $license_emails;
294
+ return $data;
295
+ }
296
+
297
+ public static function wpdesk_tracker_data_shipping_country_per_order( $data ) {
298
+ global $wpdb;
299
+ $query = $wpdb->get_results("
300
+ SELECT m.meta_value AS shipping_country, p.post_status AS post_status , COUNT(p.ID) AS orders
301
+ FROM {$wpdb->postmeta} m, {$wpdb->posts} p
302
+ WHERE p.ID = m.post_id
303
+ AND m.meta_key = '_shipping_country'
304
+ GROUP BY shipping_country, post_status ORDER BY orders DESC"
305
+ );
306
+ $data['shipping_country_per_order'] = array();
307
+ if ( $query ) {
308
+ foreach ( $query as $row ) {
309
+ if ( !isset( $data['shipping_country_per_order'][$row->shipping_country] ) ) {
310
+ $data['shipping_country_per_order'][$row->shipping_country] = array();
311
+ }
312
+ $data['shipping_country_per_order'][$row->shipping_country][$row->post_status] = $row->orders;
313
+ }
314
+ }
315
+ return $data;
316
+ }
317
+
318
+ public static function wpdesk_tracker_data_shipping_classes( $data ) {
319
+ $data['number_of_shipping_classes'] = 0;
320
+ $shipping_classes = WC()->shipping()->get_shipping_classes();
321
+ if ( is_array( $shipping_classes ) ) {
322
+ $data['number_of_shipping_classes'] = count( $shipping_classes );
323
+ }
324
+ return $data;
325
+ }
326
+
327
+ public static function wpdesk_tracker_data_product_variations( $data ) {
328
+ $data['number_of_variations'] = 0;
329
+ $number_of_variations = wp_count_posts( 'product_variation' );
330
+ $data['number_of_variations'] = $number_of_variations;
331
+ return $data;
332
+ }
333
+
334
+ public static function wpdesk_tracker_data_orders_per_month( $data ) {
335
+ global $wpdb;
336
+ $query = $wpdb->get_results("
337
+ SELECT min(post_date) min, max(post_date) max, TIMESTAMPDIFF(MONTH, min(post_date), max(post_date) )+1 months
338
+ FROM {$wpdb->posts} p
339
+ WHERE p.post_type = 'shop_order'
340
+ AND p.post_status = 'wc-completed'
341
+ "
342
+ );
343
+ $data['orders_per_month'] = array();
344
+ if ( $query ) {
345
+ foreach ( $query as $row ) {
346
+ $data['orders_per_month']['first'] = $row->min;
347
+ $data['orders_per_month']['last'] = $row->max;
348
+ $data['orders_per_month']['months'] = $row->months;
349
+ if ( $row->months != 0 ) {
350
+ if ( isset( $data['orders'] ) && isset( $data['orders']['wc-completed'] ) ) {
351
+ $data['orders_per_month']['per_month'] = floatval($data['orders']['wc-completed'])/floatval($row->months);
352
+ }
353
+ }
354
+ }
355
+ }
356
+ return $data;
357
+ }
358
+
359
+
360
+ public static function send_deactivation_data() {
361
+
362
+ $params = array();
363
+
364
+ $params['click_action'] = 'plugin_deactivation';
365
+
366
+ $params['plugin'] = $_REQUEST['plugin'];
367
+
368
+ $params['plugin_name'] = $_REQUEST['plugin_name'];
369
+
370
+ $params['reason'] = $_REQUEST['reason'];
371
+
372
+ if ( !empty( $_REQUEST['additional_info'] ) ) {
373
+ $params['additional_info'] = $_REQUEST['additional_info'];
374
+ }
375
+ $response = wp_remote_post( self::$api_url, array(
376
+ 'method' => 'POST',
377
+ 'timeout' => 5,
378
+ 'redirection' => 5,
379
+ 'httpversion' => '1.0',
380
+ 'blocking' => false,
381
+ 'headers' => array( 'user-agent' => 'WPDeskTracker' ),
382
+ 'body' => json_encode( $params ),
383
+ 'cookies' => array(),
384
+ )
385
+ );
386
+ }
387
+
388
+
389
+ /**
390
+ * Decide whether to send tracking data or not.
391
+ *
392
+ * @param boolean $override
393
+ */
394
+ public static function send_tracking_data( $override = false, $click_action = null ) {
395
+ $options = get_option('wpdesk_helper_options', array() );
396
+ if ( empty( $options ) ) {
397
+ $options = array();
398
+ }
399
+ if ( empty( $options['wpdesk_tracker_agree'] ) ) {
400
+ $options['wpdesk_tracker_agree'] = '0';
401
+ }
402
+ if ( empty( $click_action ) && $options['wpdesk_tracker_agree'] == '0' ) {
403
+ return;
404
+ }
405
+ if ( ! wpdesk_tracker_enabled() ) {
406
+ return;
407
+ }
408
+ // Dont trigger this on AJAX Requests
409
+ if ( defined( 'DOING_AJAX' ) && DOING_AJAX ) {
410
+ //return;
411
+ }
412
+ if ( ! apply_filters( 'wpdesk_tracker_send_override', $override ) ) {
413
+ // Send a maximum of once per week by default.
414
+ $last_send = self::get_last_send_time();
415
+ if ( $last_send && $last_send > apply_filters( 'wpdesk_tracker_last_send_interval', strtotime( '-1 week' ) ) ) {
416
+ return;
417
+ }
418
+ } else {
419
+ // Make sure there is at least a 1 hour delay between override sends, we dont want duplicate calls due to double clicking links.
420
+ $last_send = self::get_last_send_time();
421
+ if ( empty( $click_action ) && $last_send && $last_send > strtotime( '-1 hours' ) ) {
422
+ return;
423
+ }
424
+ }
425
+
426
+ // Update time first before sending to ensure it is set
427
+ update_option( 'wpdesk_tracker_last_send', time() );
428
+
429
+ if ( empty( $click_action ) || $click_action == 'agree' ) {
430
+ $params = self::get_tracking_data();
431
+
432
+ if ( isset( $params['active_plugins'] ) ) {
433
+ foreach ( $params['active_plugins'] as $plugin=>$plugin_data ) {
434
+ $option_name = 'plugin_activation_' . $plugin;
435
+ $activation_date = get_option( $option_name, '' );
436
+ if ( $activation_date != '' ) {
437
+ $params['active_plugins'][$plugin]['activation_date'] = $activation_date;
438
+ }
439
+ }
440
+ }
441
+
442
+ if ( !empty( $click_action ) ) {
443
+ $params['click_action'] = 'agree';
444
+ }
445
+ if ( self::$request_coupon ) {
446
+ $params['get_coupon'] = 1;
447
+ $params['click_action'] = 'agree_coupon';
448
+ }
449
+ }
450
+ else {
451
+ $params = array( 'click_action' => 'no' );
452
+ }
453
+
454
+ $params['localhost'] = 'no';
455
+ if ( !empty( $_SERVER['SERVER_ADDR'] ) && $_SERVER['SERVER_ADDR'] == '127.0.0.1' ) {
456
+ $params['localhost'] = 'yes';
457
+ }
458
+
459
+ $response = wp_remote_post( self::$api_url, array(
460
+ 'method' => 'POST',
461
+ 'timeout' => 5,
462
+ 'redirection' => 5,
463
+ 'httpversion' => '1.0',
464
+ 'blocking' => false,
465
+ 'headers' => array( 'user-agent' => 'WPDeskTracker' ),
466
+ 'body' => json_encode( $params ),
467
+ 'cookies' => array(),
468
+ )
469
+ );
470
+ }
471
+
472
+ /**
473
+ * Get the last time tracking data was sent.
474
+ * @return int|bool
475
+ */
476
+ private static function get_last_send_time() {
477
+ return apply_filters( 'wpdesk_tracker_last_send_time', get_option( 'wpdesk_tracker_last_send', false ) );
478
+ }
479
+
480
+ /**
481
+ * Get all the tracking data.
482
+ * @return array
483
+ */
484
+ private static function get_tracking_data() {
485
+ $data = array();
486
+
487
+ // General site info
488
+ $data['url'] = home_url();
489
+ $data['email'] = apply_filters( 'wpdesk_tracker_admin_email', get_option( 'admin_email' ) );
490
+ $data['theme'] = self::get_theme_info();
491
+
492
+ // WordPress Info
493
+ $data['wp'] = self::get_wordpress_info();
494
+
495
+ // Server Info
496
+ $data['server'] = self::get_server_info();
497
+
498
+ // Plugin info
499
+ $all_plugins = self::get_all_plugins();
500
+ $data['active_plugins'] = $all_plugins['active_plugins'];
501
+ $data['inactive_plugins'] = $all_plugins['inactive_plugins'];
502
+
503
+ // Jetpack & WooCommerce Connect
504
+ $data['jetpack_version'] = defined( 'JETPACK__VERSION' ) ? JETPACK__VERSION : 'none';
505
+ $data['jetpack_connected'] = ( class_exists( 'Jetpack' ) && is_callable( 'Jetpack::is_active' ) && Jetpack::is_active() ) ? 'yes' : 'no';
506
+ $data['jetpack_is_staging'] = ( class_exists( 'Jetpack' ) && is_callable( 'Jetpack::is_staging_site' ) && Jetpack::is_staging_site() ) ? 'yes' : 'no';
507
+ $data['connect_installed'] = class_exists( 'WC_Connect_Loader' ) ? 'yes' : 'no';
508
+ $data['connect_active'] = ( class_exists( 'WC_Connect_Loader' ) && wp_next_scheduled( 'wc_connect_fetch_service_schemas' ) ) ? 'yes' : 'no';
509
+
510
+ // Store count info
511
+ $data['users'] = self::get_user_counts();
512
+ $data['products'] = self::get_product_counts();
513
+ $data['orders'] = self::get_order_counts();
514
+
515
+ // Payment gateway info
516
+ $data['gateways'] = self::get_active_payment_gateways();
517
+
518
+ // Shipping method info
519
+ $data['shipping_methods'] = self::get_active_shipping_methods();
520
+
521
+ // Get all WooCommerce options info
522
+ $data['settings'] = self::get_all_woocommerce_options_values();
523
+
524
+ // Template overrides
525
+ $data['template_overrides'] = self::get_all_template_overrides();
526
+
527
+ // Template overrides
528
+ $data['admin_user_agents'] = self::get_admin_user_agents();
529
+
530
+ return apply_filters( 'wpdesk_tracker_data', $data );
531
+ }
532
+
533
+ /**
534
+ * Get the current theme info, theme name and version.
535
+ * @return array
536
+ */
537
+ public static function get_theme_info() {
538
+ $theme_data = wp_get_theme();
539
+ $theme_child_theme = is_child_theme() ? 'Yes' : 'No';
540
+ $theme_wc_support = ( ! current_theme_supports( 'woocommerce' ) && ! in_array( $theme_data->template, wc_get_core_supported_themes() ) ) ? 'No' : 'Yes';
541
+
542
+ return array( 'name' => $theme_data->Name,
543
+ 'version' => $theme_data->Version,
544
+ 'child_theme' => $theme_child_theme,
545
+ 'wc_support' => $theme_wc_support
546
+ );
547
+ }
548
+
549
+ /**
550
+ * Get WordPress related data.
551
+ * @return array
552
+ */
553
+ private static function get_wordpress_info() {
554
+ $wp_data = array();
555
+
556
+ $memory = wc_let_to_num( WP_MEMORY_LIMIT );
557
+
558
+ if ( function_exists( 'memory_get_usage' ) ) {
559
+ $system_memory = wc_let_to_num( @ini_get( 'memory_limit' ) );
560
+ $memory = max( $memory, $system_memory );
561
+ }
562
+
563
+ $wp_data['memory_limit'] = size_format( $memory );
564
+ $wp_data['debug_mode'] = ( defined( 'WP_DEBUG' ) && WP_DEBUG ) ? 'Yes' : 'No';
565
+ $wp_data['locale'] = get_locale();
566
+ $wp_data['version'] = get_bloginfo( 'version' );
567
+ $wp_data['multisite'] = is_multisite() ? 'Yes' : 'No';
568
+
569
+ return $wp_data;
570
+ }
571
+
572
+ /**
573
+ * Get server related info.
574
+ * @return array
575
+ */
576
+ private static function get_server_info() {
577
+ $server_data = array();
578
+
579
+ if ( isset( $_SERVER['SERVER_SOFTWARE'] ) && ! empty( $_SERVER['SERVER_SOFTWARE'] ) ) {
580
+ $server_data['software'] = $_SERVER['SERVER_SOFTWARE'];
581
+ }
582
+
583
+ if ( function_exists( 'phpversion' ) ) {
584
+ $server_data['php_version'] = phpversion();
585
+ }
586
+
587
+ if ( function_exists( 'ini_get' ) ) {
588
+ $server_data['php_post_max_size'] = size_format( wc_let_to_num( ini_get( 'post_max_size' ) ) );
589
+ $server_data['php_time_limt'] = ini_get( 'max_execution_time' );
590
+ $server_data['php_max_input_vars'] = ini_get( 'max_input_vars' );
591
+ $server_data['php_suhosin'] = extension_loaded( 'suhosin' ) ? 'Yes' : 'No';
592
+ }
593
+
594
+ global $wpdb;
595
+ $server_data['mysql_version'] = $wpdb->db_version();
596
+
597
+ $server_data['php_max_upload_size'] = size_format( wp_max_upload_size() );
598
+ $server_data['php_default_timezone'] = date_default_timezone_get();
599
+ $server_data['php_soap'] = class_exists( 'SoapClient' ) ? 'Yes' : 'No';
600
+ $server_data['php_fsockopen'] = function_exists( 'fsockopen' ) ? 'Yes' : 'No';
601
+ $server_data['php_curl'] = function_exists( 'curl_init' ) ? 'Yes' : 'No';
602
+
603
+ return $server_data;
604
+ }
605
+
606
+ /**
607
+ * Get all plugins grouped into activated or not.
608
+ * @return array
609
+ */
610
+ private static function get_all_plugins() {
611
+ // Ensure get_plugins function is loaded
612
+ if ( ! function_exists( 'get_plugins' ) ) {
613
+ include ABSPATH . '/wp-admin/includes/plugin.php';
614
+ }
615
+
616
+ $plugins = get_plugins();
617
+ $active_plugins_keys = get_option( 'active_plugins', array() );
618
+ $active_plugins = array();
619
+
620
+ foreach ( $plugins as $k => $v ) {
621
+ // Take care of formatting the data how we want it.
622
+ $formatted = array();
623
+ $formatted['name'] = strip_tags( $v['Name'] );
624
+ if ( isset( $v['Version'] ) ) {
625
+ $formatted['version'] = strip_tags( $v['Version'] );
626
+ }
627
+ if ( isset( $v['Author'] ) ) {
628
+ $formatted['author'] = strip_tags( $v['Author'] );
629
+ }
630
+ if ( isset( $v['Network'] ) ) {
631
+ $formatted['network'] = strip_tags( $v['Network'] );
632
+ }
633
+ if ( isset( $v['PluginURI'] ) ) {
634
+ $formatted['plugin_uri'] = strip_tags( $v['PluginURI'] );
635
+ }
636
+ if ( in_array( $k, $active_plugins_keys ) ) {
637
+ // Remove active plugins from list so we can show active and inactive separately
638
+ unset( $plugins[ $k ] );
639
+ $active_plugins[ $k ] = $formatted;
640
+ } else {
641
+ $plugins[ $k ] = $formatted;
642
+ }
643
+ }
644
+
645
+ return array( 'active_plugins' => $active_plugins, 'inactive_plugins' => $plugins );
646
+ }
647
+
648
+ /**
649
+ * Get user totals based on user role.
650
+ * @return array
651
+ */
652
+ private static function get_user_counts() {
653
+ $user_count = array();
654
+ $user_count_data = count_users();
655
+ $user_count['total'] = $user_count_data['total_users'];
656
+
657
+ // Get user count based on user role
658
+ foreach ( $user_count_data['avail_roles'] as $role => $count ) {
659
+ $user_count[ $role ] = $count;
660
+ }
661
+
662
+ return $user_count;
663
+ }
664
+
665
+ /**
666
+ * Get product totals based on product type.
667
+ * @return array
668
+ */
669
+ private static function get_product_counts() {
670
+ $product_count = array();
671
+ $product_count_data = wp_count_posts( 'product' );
672
+ $product_count['total'] = $product_count_data->publish;
673
+
674
+ $product_statuses = get_terms( 'product_type', array( 'hide_empty' => 0 ) );
675
+ foreach ( $product_statuses as $product_status ) {
676
+ $product_count[ $product_status->name ] = $product_status->count;
677
+ }
678
+
679
+ return $product_count;
680
+ }
681
+
682
+ /**
683
+ * Get order counts based on order status.
684
+ * @return array
685
+ */
686
+ private static function get_order_counts() {
687
+ $order_count = array();
688
+ $order_count_data = wp_count_posts( 'shop_order' );
689
+
690
+ foreach ( wc_get_order_statuses() as $status_slug => $status_name ) {
691
+ $order_count[ $status_slug ] = $order_count_data->{$status_slug};
692
+ }
693
+
694
+ return $order_count;
695
+ }
696
+
697
+ /**
698
+ * Get a list of all active payment gateways.
699
+ * @return array
700
+ */
701
+ private static function get_active_payment_gateways() {
702
+ $active_gateways = array();
703
+ $gateways = WC()->payment_gateways->payment_gateways();
704
+ foreach ( $gateways as $id => $gateway ) {
705
+ if ( isset( $gateway->enabled ) && 'yes' === $gateway->enabled ) {
706
+ $active_gateways[ $id ] = array( 'title' => $gateway->title, 'supports' => $gateway->supports );
707
+ }
708
+ }
709
+
710
+ return $active_gateways;
711
+ }
712
+
713
+ /**
714
+ * Get a list of all active shipping methods.
715
+ * @return array
716
+ */
717
+ private static function get_active_shipping_methods() {
718
+ $active_methods = array();
719
+ $shipping_methods = WC()->shipping->get_shipping_methods();
720
+ foreach ( $shipping_methods as $id => $shipping_method ) {
721
+ if ( isset( $shipping_method->enabled ) && 'yes' === $shipping_method->enabled ) {
722
+ $active_methods[ $id ] = array( 'title' => $shipping_method->title,
723
+ 'tax_status' => $shipping_method->tax_status
724
+ );
725
+ }
726
+ }
727
+
728
+ return $active_methods;
729
+ }
730
+
731
+ /**
732
+ * Get all options starting with woocommerce_ prefix.
733
+ * @return array
734
+ */
735
+ private static function get_all_woocommerce_options_values() {
736
+ return array(
737
+ 'version' => WC()->version,
738
+ 'currency' => get_woocommerce_currency(),
739
+ 'base_location' => WC()->countries->get_base_country(),
740
+ 'selling_locations' => WC()->countries->get_allowed_countries(),
741
+ 'api_enabled' => get_option( 'woocommerce_api_enabled' ),
742
+ 'weight_unit' => get_option( 'woocommerce_weight_unit' ),
743
+ 'dimension_unit' => get_option( 'woocommerce_dimension_unit' ),
744
+ 'download_method' => get_option( 'woocommerce_file_download_method' ),
745
+ 'download_require_login' => get_option( 'woocommerce_downloads_require_login' ),
746
+ 'calc_taxes' => get_option( 'woocommerce_calc_taxes' ),
747
+ 'coupons_enabled' => get_option( 'woocommerce_enable_coupons' ),
748
+ 'guest_checkout' => get_option( 'woocommerce_enable_guest_checkout' ),
749
+ 'secure_checkout' => get_option( 'woocommerce_force_ssl_checkout' ),
750
+ 'enable_signup_and_login_from_checkout' => get_option( 'woocommerce_enable_signup_and_login_from_checkout' ),
751
+ 'enable_myaccount_registration' => get_option( 'woocommerce_enable_myaccount_registration' ),
752
+ 'registration_generate_username' => get_option( 'woocommerce_registration_generate_username' ),
753
+ 'registration_generate_password' => get_option( 'woocommerce_registration_generate_password' ),
754
+ );
755
+ }
756
+
757
+ /**
758
+ * Look for any template override and return filenames.
759
+ * @return array
760
+ */
761
+ private static function get_all_template_overrides() {
762
+ $override_data = array();
763
+ $template_paths = apply_filters( 'woocommerce_template_overrides_scan_paths', array( 'WooCommerce' => WC()->plugin_path() . '/templates/' ) );
764
+ $scanned_files = array();
765
+
766
+ require_once( WC()->plugin_path() . '/includes/admin/class-wc-admin-status.php' );
767
+
768
+ foreach ( $template_paths as $plugin_name => $template_path ) {
769
+ $scanned_files[ $plugin_name ] = WC_Admin_Status::scan_template_files( $template_path );
770
+ }
771
+
772
+ foreach ( $scanned_files as $plugin_name => $files ) {
773
+ foreach ( $files as $file ) {
774
+ if ( file_exists( get_stylesheet_directory() . '/' . $file ) ) {
775
+ $theme_file = get_stylesheet_directory() . '/' . $file;
776
+ } elseif ( file_exists( get_stylesheet_directory() . '/woocommerce/' . $file ) ) {
777
+ $theme_file = get_stylesheet_directory() . '/woocommerce/' . $file;
778
+ } elseif ( file_exists( get_template_directory() . '/' . $file ) ) {
779
+ $theme_file = get_template_directory() . '/' . $file;
780
+ } elseif ( file_exists( get_template_directory() . '/woocommerce/' . $file ) ) {
781
+ $theme_file = get_template_directory() . '/woocommerce/' . $file;
782
+ } else {
783
+ $theme_file = false;
784
+ }
785
+
786
+ if ( false !== $theme_file ) {
787
+ $override_data[] = basename( $theme_file );
788
+ }
789
+ }
790
+ }
791
+
792
+ return $override_data;
793
+ }
794
+
795
+ /**
796
+ * When an admin user logs in, there user agent is tracked in user meta and collected here.
797
+ * @return array
798
+ */
799
+ private static function get_admin_user_agents() {
800
+ return array_filter( (array) get_option( 'woocommerce_tracker_ua', array() ) );
801
+ }
802
+ }
803
+
804
+ }
inc/wpdesk-tracker/lang/wpdesk-tracker-pl_PL.mo ADDED
Binary file
inc/wpdesk-tracker/lang/wpdesk-tracker-pl_PL.po ADDED
@@ -0,0 +1,472 @@
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
+ msgid ""
2
+ msgstr ""
3
+ "Project-Id-Version: WP Desk Tracker\n"
4
+ "POT-Creation-Date: 2017-05-29 16:08+0200\n"
5
+ "PO-Revision-Date: 2017-05-29 16:08+0200\n"
6
+ "Last-Translator: Piotr Jabłonowski <piotr.jablonowski@wpdesk.net>\n"
7
+ "Language-Team: \n"
8
+ "Language: pl_PL\n"
9
+ "MIME-Version: 1.0\n"
10
+ "Content-Type: text/plain; charset=UTF-8\n"
11
+ "Content-Transfer-Encoding: 8bit\n"
12
+ "X-Generator: Poedit 2.0.2\n"
13
+ "X-Poedit-Basepath: ../..\n"
14
+ "Plural-Forms: nplurals=3; plural=(n==1 ? 0 : n%10>=2 && n%10<=4 && (n%100<10 "
15
+ "|| n%100>=20) ? 1 : 2);\n"
16
+ "X-Poedit-SourceCharset: UTF-8\n"
17
+ "X-Poedit-KeywordsList: __;_e;_n:1,2;_x:1,2c;_ex:1,2c;_nx:4c,1,2;esc_attr__;"
18
+ "esc_attr_e;esc_attr_x:1,2c;esc_html__;esc_html_e;esc_html_x:1,2c;_n_noop:1,2;"
19
+ "_nx_noop:3c,1,2;__ngettext_noop:1,2\n"
20
+ "X-Poedit-SearchPath-0: .\n"
21
+ "X-Poedit-SearchPathExcluded-0: wpdesk-logger.php\n"
22
+
23
+ #: wpdesk-tracker/views/tracker-connect.php:7
24
+ #: wpdesk-tracker/views/tracker-notice.php:5
25
+ #: wpdesk-tracker/views/tracker-notice.php:16
26
+ #, php-format
27
+ msgid "Hey %s,"
28
+ msgstr "Hej %s,"
29
+
30
+ #: wpdesk-tracker/views/tracker-connect.php:8
31
+ #: wpdesk-tracker/views/tracker-notice.php:17
32
+ msgid ""
33
+ "Please help us improve our plugins! If you opt-in, we will collect some non-"
34
+ "sensitive data and usage information. If you skip this, that's okay! All "
35
+ "plugins will work just fine."
36
+ msgstr ""
37
+ "Proszę pomóż nam udoskonalić nasze wtyczki! Jeśli się zgodzisz, będziemy "
38
+ "zbierać niewrażliwe dane użytkowania. Jeśli pominiesz ten krok, w porządku! "
39
+ "Wszystkie wtyczki będą działać."
40
+
41
+ #: wpdesk-tracker/views/tracker-connect.php:13
42
+ msgid "Allow & Continue &rarr;"
43
+ msgstr "Pozwól i kontunuuj &rarr;"
44
+
45
+ #: wpdesk-tracker/views/tracker-connect.php:14
46
+ msgid "Skip"
47
+ msgstr "Pomiń"
48
+
49
+ #: wpdesk-tracker/views/tracker-connect.php:19
50
+ msgid "What permissions are being granted?"
51
+ msgstr "Jakie uprawnienia są przyznawane?"
52
+
53
+ #: wpdesk-tracker/views/tracker-connect.php:26
54
+ msgid "Your Site Overview"
55
+ msgstr "Dane witryny"
56
+
57
+ #: wpdesk-tracker/views/tracker-connect.php:27
58
+ msgid "Site URL, WP version, PHP info, admin email"
59
+ msgstr "URL strony, wersja WP, wersja PHP, email admina"
60
+
61
+ #: wpdesk-tracker/views/tracker-connect.php:33
62
+ msgid "Plugin Usage"
63
+ msgstr "Dane użytkowania wtyczek"
64
+
65
+ #: wpdesk-tracker/views/tracker-connect.php:34
66
+ msgid "Current settings and usage information of WP Desk plugins"
67
+ msgstr "Ustawienia i informacje o użytkowaniu wtyczek WP Desk"
68
+
69
+ #: wpdesk-tracker/views/tracker-connect.php:40
70
+ msgid "Your Store Overview"
71
+ msgstr "Dane sklepu"
72
+
73
+ #: wpdesk-tracker/views/tracker-connect.php:41
74
+ msgid "Non-sensitive store usage information"
75
+ msgstr "Tylko niewrażliwe dane o użytkowaniu sklepu"
76
+
77
+ #: wpdesk-tracker/views/tracker-connect.php:47
78
+ msgid "Admin Updates"
79
+ msgstr "Powiadomienia"
80
+
81
+ #: wpdesk-tracker/views/tracker-connect.php:48
82
+ msgid "Announcements, updates, marketing, no spam and easy opt-out"
83
+ msgstr ""
84
+ "Ważne powiadomienia, uaktualnienia, marketing, żadnego spamu i łatwa "
85
+ "rezygnacja"
86
+
87
+ #: wpdesk-tracker/views/tracker-connect.php:54
88
+ #: wpdesk-tracker/views/tracker-notice.php:7
89
+ #: wpdesk-tracker/views/tracker-notice.php:18
90
+ msgid "Find out more &raquo;"
91
+ msgstr "Dowiedz się więcej &raquo;"
92
+
93
+ #: wpdesk-tracker/views/tracker-deactivate.php:3
94
+ #, php-format
95
+ msgid "You are deactivating %s plugin."
96
+ msgstr "Dezaktywowałeś wtyczkę %s."
97
+
98
+ #: wpdesk-tracker/views/tracker-deactivate.php:9
99
+ msgid ""
100
+ " If you have a moment, please let us know why you are deactivating plugin "
101
+ "(anonymous feedback):"
102
+ msgstr ""
103
+ "Jeśli masz chwilę, prosimy daj nam znać dlaczego dezaktywowałeś wtyczkę "
104
+ "(anonimowa opinia):"
105
+
106
+ #: wpdesk-tracker/views/tracker-deactivate.php:16
107
+ msgid "The plugin suddenly stopped working"
108
+ msgstr "Wtyczka nagle przestała działać"
109
+
110
+ #: wpdesk-tracker/views/tracker-deactivate.php:24
111
+ msgid "The plugin broke my site"
112
+ msgstr "Wtyczka zepsuła moją stronę"
113
+
114
+ #: wpdesk-tracker/views/tracker-deactivate.php:32
115
+ msgid "I found a better plugin"
116
+ msgstr "Znalazłem lepszą wtyczkę"
117
+
118
+ #: wpdesk-tracker/views/tracker-deactivate.php:35
119
+ msgid "What's the plugin's name?"
120
+ msgstr "Jaka jest nazwa wtyczki?"
121
+
122
+ #: wpdesk-tracker/views/tracker-deactivate.php:43
123
+ msgid "I only needed the plugin for a short period"
124
+ msgstr "Potrzebowałem wtyczki tylko przez krótki okres"
125
+
126
+ #: wpdesk-tracker/views/tracker-deactivate.php:51
127
+ msgid "I no longer need the plugin"
128
+ msgstr "Nie potrzebuję już wtyczki"
129
+
130
+ #: wpdesk-tracker/views/tracker-deactivate.php:59
131
+ msgid "It's a temporary deactivation. I'm just debugging an issue."
132
+ msgstr "Jest to tymczasowa dezaktywacja, debaguję problem"
133
+
134
+ #: wpdesk-tracker/views/tracker-deactivate.php:67
135
+ msgid "Other"
136
+ msgstr "Inny"
137
+
138
+ #: wpdesk-tracker/views/tracker-deactivate.php:70
139
+ msgid "Kindly tell us the reason so we can improve"
140
+ msgstr "Napisz nam powód abyśmy mogli go poprawić"
141
+
142
+ #: wpdesk-tracker/views/tracker-deactivate.php:77
143
+ msgid "Skip &amp; Deactivate"
144
+ msgstr "Pomiń i dezaktywuj"
145
+
146
+ #: wpdesk-tracker/views/tracker-deactivate.php:78
147
+ msgid "Cancel"
148
+ msgstr "Anuluj"
149
+
150
+ #: wpdesk-tracker/views/tracker-deactivate.php:92
151
+ msgid "Submit &amp; Deactivate"
152
+ msgstr "Wyślij i dezaktywuj"
153
+
154
+ #: wpdesk-tracker/views/tracker-notice.php:6
155
+ msgid ""
156
+ "Allow WP Desk to collect plugin usage information and <strong>get discount "
157
+ "coupon</strong> in our shop. No sensitive data is tracked."
158
+ msgstr ""
159
+ "Pozwól WP Desk na zbieranie danych użytkowania wtyczek i <strong>otrzymaj "
160
+ "kupon rabatowy</strong> do naszego sklepu. Żadne wrażliwe dane nie będą "
161
+ "zbierane."
162
+
163
+ #: wpdesk-tracker/views/tracker-notice.php:10
164
+ #: wpdesk-tracker/views/tracker-notice.php:21
165
+ msgid "Allow"
166
+ msgstr "Pozwól"
167
+
168
+ #: wpdesk-tracker/views/tracker-opt-out-notice.php:3
169
+ msgid ""
170
+ "You successfully opted out of collecting usage data by WP Desk. If you "
171
+ "change your mind, you can always opt in later in the plugin's quick links."
172
+ msgstr ""
173
+ "Twoja rezygnacja ze zbierania danych użytkowania wtyczek przez WP Desk "
174
+ "została przyjęta. Jeśli zmienisz zdanie, zawsze możesz włączyć zgodę poprzez "
175
+ "szybkie linki w menu wtyczek."
176
+
177
+ #~ msgid "Error"
178
+ #~ msgstr "Błąd"
179
+
180
+ #~ msgid "Debug"
181
+ #~ msgstr "Debug"
182
+
183
+ #~ msgid "Save Changes"
184
+ #~ msgstr "Zapisz zmiany"
185
+
186
+ #~ msgid "API License Activation"
187
+ #~ msgstr "Aktywacja licencji"
188
+
189
+ #~ msgid "API License Key Status"
190
+ #~ msgstr "Status licencji"
191
+
192
+ #~ msgid "API License Key"
193
+ #~ msgstr "Klucz licencyjny"
194
+
195
+ #~ msgid "API License email"
196
+ #~ msgstr "E-mail dla licencji"
197
+
198
+ #~ msgid "API License Deactivation"
199
+ #~ msgstr "Dezaktywacja licencji"
200
+
201
+ #~ msgid "Deactivate API License Key"
202
+ #~ msgstr "Dezaktywuj klucz licencyjny"
203
+
204
+ #~ msgid "Plugin activated. "
205
+ #~ msgstr "Wtyczka została włączona."
206
+
207
+ #~ msgid "Connection failed to the License Key API server. Try again later."
208
+ #~ msgstr "Nie udało się połączyć z serwerem licencji. Spróbuj później."
209
+
210
+ #~ msgid ""
211
+ #~ "The license could not be deactivated. Use the License Deactivation tab to "
212
+ #~ "manually deactivate the license before activating a new license."
213
+ #~ msgstr ""
214
+ #~ "Licencja nie może być dezaktywowana. Użyj ręcznej dezaktywacji licencji "
215
+ #~ "przed aktywacją nowej licencji."
216
+
217
+ #~ msgid "Plugin license deactivated. "
218
+ #~ msgstr "Licencja wtyczki dezaktywowana."
219
+
220
+ #~ msgid "Deactivates an API License Key so it can be used on another blog."
221
+ #~ msgstr ""
222
+ #~ "Dezaktywuje klucz licencyjny, dzięki czemu może być użyty na innej "
223
+ #~ "stronie."
224
+
225
+ #~ msgid "License Activation"
226
+ #~ msgstr "Aktywacja licencji"
227
+
228
+ #~ msgid "License Deactivation"
229
+ #~ msgstr "Dezaktywacja licencji"
230
+
231
+ #~ msgid ""
232
+ #~ "The %s%s%s License Key has not been activated, so the plugin is inactive! "
233
+ #~ "%sClick here%s to activate the license key and the plugin."
234
+ #~ msgstr ""
235
+ #~ "Klucz licencyjny wtyczki %s%s%s nie został aktywowany, więc wtyczka jest "
236
+ #~ "nieaktywna! %sKliknij tutaj%s, aby aktywować klucz licencyjny wtyczki."
237
+
238
+ #~ msgid ""
239
+ #~ "<b>Warning!</b> You're blocking external requests which means you won't "
240
+ #~ "be able to get %s updates. Please add %s to %s."
241
+ #~ msgstr ""
242
+ #~ "<b>Uwaga!</b> Blokujesz zewnętrzne połączenia i nie będziesz otrzymywać "
243
+ #~ "aktualizacji wtyczki: %s. Proszę dodaj host %s do %s."
244
+
245
+ #~ msgid ""
246
+ #~ "The license key for %s has expired. You can reactivate or purchase a "
247
+ #~ "license key from your account <a href=\"%s\" target=\"_blank\">dashboard</"
248
+ #~ "a>."
249
+ #~ msgstr ""
250
+ #~ "Licencja na wtyczkę: %s wygasła. Aby odnowić licencję, <a href=\"%s\" "
251
+ #~ "target=\"_blank\">kliknij tutaj</a>."
252
+
253
+ #~ msgid ""
254
+ #~ "The subscription for %s is on-hold. You can reactivate the subscription "
255
+ #~ "from your account <a href=\"%s\" target=\"_blank\">dashboard</a>."
256
+ #~ msgstr ""
257
+ #~ "Licencja na wtyczkę: %s jest wstrzymana. Możesz zarządzać licencjami <a "
258
+ #~ "href=\"%s\" target=\"_blank\">tutaj</a>."
259
+
260
+ #~ msgid ""
261
+ #~ "The subscription for %s has been cancelled. You can renew the "
262
+ #~ "subscription from your account <a href=\"%s\" target=\"_blank"
263
+ #~ "\">dashboard</a>. A new license key will be emailed to you after your "
264
+ #~ "order has been completed."
265
+ #~ msgstr ""
266
+ #~ "Licencja na wtyczkę: %s została anulowana. Aby odnowić licencję, <a href="
267
+ #~ "\"%s\" target=\"_blank\">kliknij tutaj</a>."
268
+
269
+ #~ msgid ""
270
+ #~ "The subscription for %s has expired. You can reactivate the subscription "
271
+ #~ "from your account <a href=\"%s\" target=\"_blank\">dashboard</a>."
272
+ #~ msgstr ""
273
+ #~ "Licencja na wtyczkę: %s wygasła. Aby odnowić licencję, <a href=\"%s\" "
274
+ #~ "target=\"_blank\">kliknij tutaj</a>."
275
+
276
+ #~ msgid ""
277
+ #~ "The subscription for %s has been suspended. You can reactivate the "
278
+ #~ "subscription from your account <a href=\"%s\" target=\"_blank"
279
+ #~ "\">dashboard</a>."
280
+ #~ msgstr ""
281
+ #~ "Licencja na wtyczkę: %s została zawieszona. Aby odnowić licencję, <a href="
282
+ #~ "\"%s\" target=\"_blank\">kliknij tutaj</a>."
283
+
284
+ #~ msgid ""
285
+ #~ "The subscription for %s is still pending. You can check on the status of "
286
+ #~ "the subscription from your account <a href=\"%s\" target=\"_blank"
287
+ #~ "\">dashboard</a>."
288
+ #~ msgstr ""
289
+ #~ "Licencja na wtyczkę: %s jest przetwarzana. Aby sprawdzić status licencji, "
290
+ #~ "<a href=\"%s\" target=\"_blank\">kliknij tutaj</a>."
291
+
292
+ #~ msgid ""
293
+ #~ "The subscription for %s has been placed in the trash and will be deleted "
294
+ #~ "soon. You can purchase a new subscription from your account <a href=\"%s"
295
+ #~ "\" target=\"_blank\">dashboard</a>."
296
+ #~ msgstr ""
297
+ #~ "Licencja na wtyczkę: %s została anulowana. Aby odnowić licencję, <a href="
298
+ #~ "\"%s\" target=\"_blank\">kliknij tutaj</a>."
299
+
300
+ #~ msgid ""
301
+ #~ "A subscription for %s could not be found. You can purchase a subscription "
302
+ #~ "from your account <a href=\"%s\" target=\"_blank\">dashboard</a>."
303
+ #~ msgstr ""
304
+ #~ "Licencja na wtyczkę: %s nie została znaleziona. Możesz zarządzać "
305
+ #~ "licencjami <a href=\"%s\" target=\"_blank\">tutaj</a>."
306
+
307
+ #~ msgid ""
308
+ #~ "A license key for %s could not be found. Maybe you forgot to enter a "
309
+ #~ "license key when setting up %s, or the key was deactivated in your "
310
+ #~ "account. You can reactivate or purchase a license key from your account "
311
+ #~ "<a href=\"%s\" target=\"_blank\">dashboard</a>."
312
+ #~ msgstr ""
313
+ #~ "Licencja na wtyczkę: %s nie została znaleziona. Być może zapomniałeś "
314
+ #~ "wpisać klucza licencyjnego przy aktywacji: %s lub klucz został "
315
+ #~ "dezaktywowany. Możesz zarządzać licencjami <a href=\"%s\" target=\"_blank"
316
+ #~ "\">tutaj</a>."
317
+
318
+ #~ msgid ""
319
+ #~ "Download permission for %s has been revoked possibly due to a license key "
320
+ #~ "or subscription expiring. You can reactivate or purchase a license key "
321
+ #~ "from your account <a href=\"%s\" target=\"_blank\">dashboard</a>."
322
+ #~ msgstr ""
323
+ #~ "Możliwość pobrania wtyczki: %s została zablokowana. Aby odnowić licencję, "
324
+ #~ "<a href=\"%s\" target=\"_blank\">kliknij tutaj</a>."
325
+
326
+ #~ msgid ""
327
+ #~ "%s has not been activated. Go to the settings page and enter the license "
328
+ #~ "key and license email to activate %s."
329
+ #~ msgstr ""
330
+ #~ "Wtyczka %s nie została aktywowana. Przejdź do ustawień i wpisz klucz "
331
+ #~ "licencyjny i e-mail, aby aktywować %s."
332
+
333
+ #~ msgid ""
334
+ #~ "You changed the subscription for %s, so you will need to enter your new "
335
+ #~ "API License Key in the settings page. The License Key should have arrived "
336
+ #~ "in your email inbox, if not you can get it by logging into your account "
337
+ #~ "<a href=\"%s\" target=\"_blank\">dashboard</a>."
338
+ #~ msgstr ""
339
+ #~ "Licencja na wtyczkę: %s została zmieniona. Możesz zarządzać licencjami <a "
340
+ #~ "href=\"%s\" target=\"_blank\">tutaj</a>."
341
+
342
+ #~ msgid "No WP Desk plugins found."
343
+ #~ msgstr "Nie znaleziono wtyczek WP Desk."
344
+
345
+ #~ msgid "License Status"
346
+ #~ msgstr "Status licencji"
347
+
348
+ #~ msgid "License Data"
349
+ #~ msgstr "Dane licencji"
350
+
351
+ #~ msgid "Deactivated"
352
+ #~ msgstr "Nieaktywna"
353
+
354
+ #~ msgid "Activated"
355
+ #~ msgstr "Aktywna"
356
+
357
+ #~ msgid ""
358
+ #~ "An Unexpected HTTP Error occurred during the API request.</p> <p><a href="
359
+ #~ "\"?\" onclick=\"document.location.reload(); return false;\">Try again</a>"
360
+ #~ msgstr ""
361
+ #~ "Wystąpił nieoczekiwany błąd HTTP podczas zapytania API.</p> <p><a href=\"?"
362
+ #~ "\" onclick=\"document.location.reload(); return false;\">Spróbuj "
363
+ #~ "ponownie</a>"
364
+
365
+ #~ msgid "An unknown error occurred"
366
+ #~ msgstr "Wystąpił nieznany błąd"
367
+
368
+ #~ msgid "Ustawienia"
369
+ #~ msgstr "Ustawienia"
370
+
371
+ #~ msgid "Dokumentacja"
372
+ #~ msgstr "Dokumentacja"
373
+
374
+ #~ msgid "Wsparcie"
375
+ #~ msgstr "Wsparcie"
376
+
377
+ #~ msgid "Settings"
378
+ #~ msgstr "Ustawienia"
379
+
380
+ #~ msgid "Documentation"
381
+ #~ msgstr "Dokumentacja"
382
+
383
+ #~ msgid "Support"
384
+ #~ msgstr "Wsparcie"
385
+
386
+ #~ msgid "Licenses"
387
+ #~ msgstr "Licencje"
388
+
389
+ #~ msgid "WP Desk Debug Log"
390
+ #~ msgstr "WP Desk Debug Log"
391
+
392
+ #~ msgid "Enable"
393
+ #~ msgstr "Włącz"
394
+
395
+ #~ msgid "Writes error log to %s."
396
+ #~ msgstr "Zapisuje log błędów do %s."
397
+
398
+ #~ msgid "WP Desk Helper Settings"
399
+ #~ msgstr "Ustawienia WP Desk Helper"
400
+
401
+ #~ msgid ""
402
+ #~ "Can not enable WP Desk Debug log! Cannot create directory %s or this "
403
+ #~ "directory is not writeable!"
404
+ #~ msgstr ""
405
+ #~ "Nie można włączyć WP Desk Debug log! Nie można utworzyć katalogu %s lub "
406
+ #~ "brak uprawnień do zapisu w tym katalogu!"
407
+
408
+ #~ msgid "WP Desk Debug Log is enabled. %sPlease disable it after testing%s."
409
+ #~ msgstr "WP Desk Debug Log jest włączony. %sWyłącz go po testach%s."
410
+
411
+ #~ msgid "Key:"
412
+ #~ msgstr "Klucz:"
413
+
414
+ #~ msgid "Email:"
415
+ #~ msgstr "E-mail:"
416
+
417
+ #~ msgid "Activate"
418
+ #~ msgstr "Aktywuj"
419
+
420
+ #~ msgid "WP Desk Licenses"
421
+ #~ msgstr "Licencje WP Desk"
422
+
423
+ #~ msgid "Get your license keys <a href=\"%s\" target=\"_blank\">here</a>."
424
+ #~ msgstr ""
425
+ #~ "Pobierz klucze licencyjne do aktywacji wtyczek <a href=\"%s\" target="
426
+ #~ "\"_blank\">tutaj</a>."
427
+
428
+ #~ msgid "Refresh"
429
+ #~ msgstr "Odśwież"
430
+
431
+ #~ msgid "Download plugin"
432
+ #~ msgstr "Pobierz wtyczkę"
433
+
434
+ #~ msgid "Activate plugin"
435
+ #~ msgstr "Włącz wtyczkę"
436
+
437
+ #~ msgid "Activate key"
438
+ #~ msgstr "Aktywuj licencję"
439
+
440
+ #~ msgid "Configure"
441
+ #~ msgstr "Skonfiguruj"
442
+
443
+ #~ msgid "WP Desk Helper"
444
+ #~ msgstr "WP Desk Helper"
445
+
446
+ #~ msgid "https://www.wpdesk.net/"
447
+ #~ msgstr "https://www.wpdesk.pl/"
448
+
449
+ #~ msgid "Enables WP Desk plugin activation and updates."
450
+ #~ msgstr "Umożliwia aktywację i aktualizacje wtyczek WP Desk."
451
+
452
+ #~ msgid "http://www.wpdesk.net/"
453
+ #~ msgstr "https://www.wpdesk.pl/"
454
+
455
+ #~ msgid "http://www.wpdesk.pl/"
456
+ #~ msgstr "http://www.wpdesk.pl/"
457
+
458
+ #~ msgid "WP Desk Debug Log is enabled. %sPlease disable it after testing.%s"
459
+ #~ msgstr "WP Desk Debug Log jest włączony. %sWyłącz go po testach.%s"
460
+
461
+ #, fuzzy
462
+ #~ msgid "Writes error log to file %s."
463
+ #~ msgstr "Zapisuje log błędów do %s."
464
+
465
+ #~ msgid "WP Desk Plugins"
466
+ #~ msgstr "Wtyczki WP Desk"
467
+
468
+ #~ msgid "http://www.wpdesk.pl/sklep/wpdesk-helper/"
469
+ #~ msgstr "http://www.wpdesk.pl/sklep/wpdesk-helper/"
470
+
471
+ #~ msgid "Product"
472
+ #~ msgstr "Produkt"
inc/wpdesk-tracker/views/tracker-connect.php ADDED
@@ -0,0 +1,84 @@
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
+ <?php if ( ! defined( 'ABSPATH' ) ) { exit; } ?>
2
+ <div id="wpdesk_tracker_connect" class="plugin-card">
3
+ <div class="message plugin-card-top">
4
+ <span class="wpdesk-logo"></span>
5
+
6
+ <p>
7
+ <?php printf ( __( 'Hey %s,', 'wpdesk-tracker'), $username ); ?><br/>
8
+ <?php _e( 'Please help us improve our plugins! If you opt-in, we will collect some non-sensitive data and usage information. If you skip this, that\'s okay! All plugins will work just fine.', 'wpdesk-tracker' ); ?>
9
+ </p>
10
+ </div>
11
+
12
+ <div class="actions plugin-card-bottom">
13
+ <a id="wpdesk_tracker_allow_button" href="<?php echo $allow_url; ?>" class="button button-primary button-allow button-large"><?php _e( 'Allow & Continue &rarr;', 'wpdesk-tracker' ); ?></a>
14
+ <a href="<?php echo $skip_url; ?>" class="button button-secondary"><?php _e( 'Skip', 'wpdesk-tracker' ); ?></a>
15
+ <div class="clear"></div>
16
+ </div>
17
+
18
+ <div class="permissions">
19
+ <a class="trigger" href="#"><?php _e( 'What permissions are being granted?', 'wpdesk-tracker' ); ?></a>
20
+
21
+ <div class="permissions-details">
22
+ <ul>
23
+ <li id="permission-site" class="permission site">
24
+ <i class="dashicons dashicons-admin-settings"></i>
25
+ <div>
26
+ <span><?php _e( 'Your Site Overview', 'wpdesk-tracker' ); ?></span>
27
+ <p><?php _e( 'Site URL, WP version, PHP info, admin email', 'wpdesk-tracker' ); ?></p>
28
+ </div>
29
+ </li>
30
+ <li id="permission-events" class="permission events">
31
+ <i class="dashicons dashicons-admin-plugins"></i>
32
+ <div>
33
+ <span><?php _e( 'Plugin Usage', 'wpdesk-tracker' ); ?></span>
34
+ <p><?php _e( 'Current settings and usage information of WP Desk plugins', 'wpdesk-tracker' ); ?></p>
35
+ </div>
36
+ </li>
37
+ <li id="permission-store" class="permission store">
38
+ <i class="dashicons dashicons-store"></i>
39
+ <div>
40
+ <span><?php _e( 'Your Store Overview', 'wpdesk-tracker' ); ?></span>
41
+ <p><?php _e( 'Non-sensitive store usage information', 'wpdesk-tracker' ); ?></p>
42
+ </div>
43
+ </li>
44
+ <li id="permission-notices" class="permission notices">
45
+ <i class="dashicons dashicons-testimonial"></i>
46
+ <div>
47
+ <span><?php _e( 'Admin Updates', 'wpdesk-tracker' ); ?></span>
48
+ <p><?php _e( 'Announcements, updates, marketing, no spam and easy opt-out', 'wpdesk-tracker' ); ?></p>
49
+ </div>
50
+ </li>
51
+ </ul>
52
+
53
+ <div class="terms">
54
+ <a href="<?php echo $terms_url; ?>" target="_blank"><?php _e( 'Find out more &raquo;', 'wpdesk-tracker' ); ?></a>
55
+ </div>
56
+ </div>
57
+ </div>
58
+ </div>
59
+ <script type="text/javascript">
60
+ jQuery('.trigger').click(function(e) {
61
+ e.preventDefault();
62
+ if (jQuery(this).parent().hasClass('open')) {
63
+ jQuery(this).parent().removeClass('open')
64
+ }
65
+ else {
66
+ jQuery(this).parent().addClass('open');
67
+ }
68
+ });
69
+ jQuery(document).on('click', '#wpdesk_tracker_allow_button',function(e){
70
+ e.preventDefault();
71
+ var href = jQuery(this).attr('href');
72
+ jQuery.ajax( '<?php echo admin_url('admin-ajax.php'); ?>',
73
+ {
74
+ type: 'POST',
75
+ data: {
76
+ action: 'wpdesk_tracker_notice_handler',
77
+ type: 'allow',
78
+ }
79
+ }
80
+ ).always(function() {
81
+ window.location.href = href;
82
+ });
83
+ });
84
+ </script>
inc/wpdesk-tracker/views/tracker-deactivate.php ADDED
@@ -0,0 +1,136 @@
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
+ <?php if ( ! defined( 'ABSPATH' ) ) { exit; } ?>
2
+
3
+ <h2><?php echo sprintf( __( 'You are deactivating %s plugin.', 'wpdesk-tracker' ), $plugin_name ); ?></h2>
4
+
5
+ <div class="wpdesk_tracker_deactivate">
6
+ <div class="body">
7
+ <div class="panel" data-panel-id="confirm"><p></p></div>
8
+ <div class="panel active" data-panel-id="reasons">
9
+ <h4><strong><?php _e(' If you have a moment, please let us know why you are deactivating plugin (anonymous feedback):', 'wpdesk-tracker' ); ?></strong></h4>
10
+ <ul id="reasons-list">
11
+ <li class="reason">
12
+ <label>
13
+ <span>
14
+ <input type="radio" name="selected-reason" value="plugin_stopped_working">
15
+ </span>
16
+ <span><?php _e( 'The plugin suddenly stopped working', 'wpdesk-tracker' ); ?></span>
17
+ </label>
18
+ </li>
19
+ <li class="reason">
20
+ <label>
21
+ <span>
22
+ <input type="radio" name="selected-reason" value="broke_my_site">
23
+ </span>
24
+ <span><?php _e( 'The plugin broke my site', 'wpdesk-tracker' ); ?></span>
25
+ </label>
26
+ </li>
27
+ <li class="reason has-input">
28
+ <label>
29
+ <span>
30
+ <input type="radio" name="selected-reason" value="found_better_plugin">
31
+ </span>
32
+ <span><?php _e( 'I found a better plugin', 'wpdesk-tracker' ); ?></span>
33
+ </label>
34
+ <div id="found_better_plugin" class="reason-input">
35
+ <input type="text" name="better_plugin_name" placeholder="<?php _e( 'What\'s the plugin\'s name?', 'wpdesk-tracker' ); ?>">
36
+ </div>
37
+ </li>
38
+ <li class="reason">
39
+ <label>
40
+ <span>
41
+ <input type="radio" name="selected-reason" value="plugin_for_short_period">
42
+ </span>
43
+ <span><?php _e('I only needed the plugin for a short period', 'wpdesk-tracker' ); ?></span>
44
+ </label>
45
+ </li>
46
+ <li class="reason">
47
+ <label>
48
+ <span>
49
+ <input type="radio" name="selected-reason" value="no_longer_need">
50
+ </span>
51
+ <span><?php _e( 'I no longer need the plugin', 'wpdesk-tracker' ); ?></span>
52
+ </label>
53
+ </li>
54
+ <li class="reason">
55
+ <label>
56
+ <span>
57
+ <input type="radio" name="selected-reason" value="temporary_deactivation">
58
+ </span>
59
+ <span><?php _e( 'It\'s a temporary deactivation. I\'m just debugging an issue.', 'wpdesk-tracker' ); ?></span>
60
+ </label>
61
+ </li>
62
+ <li class="reason has-input">
63
+ <label>
64
+ <span>
65
+ <input type="radio" name="selected-reason" value="other">
66
+ </span>
67
+ <span><?php _e( 'Other', 'wpdesk-tracker' ); ?></span>
68
+ </label>
69
+ <div id="other" class="reason-input">
70
+ <input type="text" name="other" placeholder="<?php _e( 'Kindly tell us the reason so we can improve', 'wpdesk-tracker' ); ?>">
71
+ </div>
72
+ </li>
73
+ </ul>
74
+ </div>
75
+ </div>
76
+ <div class="footer">
77
+ <a href="#" class="button button-secondary button-deactivate allow-deactivate"><?php _e( 'Skip &amp; Deactivate', 'wpdesk-tracker' ); ?></a>
78
+ <a href="#" class="button button-primary button-close"><?php _e( 'Cancel', 'wpdesk-tracker' ); ?></a>
79
+ </div>
80
+ </div>
81
+ <script type="text/javascript">
82
+ jQuery('input[type=radio]').click(function(){
83
+ var reason = jQuery('input[name=selected-reason]:checked').val();
84
+ console.log(reason);
85
+ jQuery('.reason-input').hide();
86
+ if ( reason == 'found_better_plugin' ) {
87
+ jQuery('#found_better_plugin').show();
88
+ }
89
+ if ( reason == 'other' ) {
90
+ jQuery('#other').show();
91
+ }
92
+ jQuery('.wpdesk_tracker_deactivate .button-deactivate').html( '<?php _e( 'Submit &amp; Deactivate', 'wpdesk-tracker' ); ?>' );
93
+ })
94
+ jQuery('.button-deactivate').click(function(e){
95
+ e.preventDefault();
96
+ console.log('deactivate');
97
+ var reason = jQuery('input[name=selected-reason]:checked').val();
98
+ var plugin = '<?php echo $plugin; ?>';
99
+ var plugin_name = '<?php echo $plugin_name; ?>';
100
+ var additional_info = '';
101
+ if ( reason == 'found_better_plugin' ) {
102
+ additional_info = jQuery('#found_better_plugin input').val();
103
+ }
104
+ if ( reason == 'other' ) {
105
+ additional_info = jQuery('#other input').val();
106
+ }
107
+ console.log(reason);
108
+ if ( typeof reason != 'undefined' ) {
109
+ console.log('not undefined');
110
+ jQuery('.button').attr('disabled',true);
111
+ jQuery.ajax( '<?php echo admin_url('admin-ajax.php'); ?>',
112
+ {
113
+ type: 'POST',
114
+ data: {
115
+ action: 'wpdesk_tracker_deactivation_handler',
116
+ reason: reason,
117
+ plugin: plugin,
118
+ plugin_name: plugin_name,
119
+ additional_info: additional_info,
120
+ }
121
+ }
122
+ ).always(function() {
123
+ var url = '<?php echo str_replace( '&amp;', '&', admin_url( wp_nonce_url( 'plugins.php?action=deactivate&plugin=' . $plugin . '&plugin_status=all&', 'deactivate-plugin_' . $plugin ) ) ); ?>';
124
+ window.location.href = url;
125
+ });
126
+ }
127
+ else {
128
+ var url = '<?php echo str_replace( '&amp;', '&', admin_url( wp_nonce_url( 'plugins.php?action=deactivate&plugin=' . $plugin . '&plugin_status=all&', 'deactivate-plugin_' . $plugin ) ) ); ?>';
129
+ window.location.href = url;
130
+ }
131
+ })
132
+ jQuery('.button-close').click(function(e){
133
+ e.preventDefault();
134
+ window.history.back();
135
+ })
136
+ </script>
inc/wpdesk-tracker/views/tracker-notice.php ADDED
@@ -0,0 +1,81 @@
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
+ <?php if ( ! defined( 'ABSPATH' ) ) { exit; } ?>
2
+ <?php if ( $coupon_avaliable ) : ?>
3
+ <div id="wpdesk_tracker_notice_coupon" class="updated notice wpdesk_tracker_notice is-dismissible">
4
+ <p>
5
+ <?php printf ( __( 'Hey %s,', 'wpdesk-tracker'), $username ); ?><br/>
6
+ <?php _e( 'Allow WP Desk to collect plugin usage information and <strong>get discount coupon</strong> in our shop. No sensitive data is tracked.', 'wpdesk-tracker'); ?>
7
+ <a href="<?php echo $terms_url; ?>" target="_blank"><?php _e( 'Find out more &raquo;', 'wpdesk-tracker' ); ?></a>
8
+ </p>
9
+ <p>
10
+ <button id="wpdesk_tracker_allow_coupon_button_notice" class="button button-primary"><?php _e( 'Allow', 'wpdesk-tracker' ); ?></button>
11
+ </p>
12
+ </div>
13
+ <?php else : ?>
14
+ <div id="wpdesk_tracker_notice" class="updated notice wpdesk_tracker_notice is-dismissible">
15
+ <p>
16
+ <?php printf ( __( 'Hey %s,', 'wpdesk-tracker'), $username ); ?><br/>
17
+ <?php _e( 'Please help us improve our plugins! If you opt-in, we will collect some non-sensitive data and usage information. If you skip this, that\'s okay! All plugins will work just fine.', 'wpdesk-tracker'); ?>
18
+ <a href="<?php echo $terms_url; ?>" target="_blank"><?php _e( 'Find out more &raquo;', 'wpdesk-tracker' ); ?></a>
19
+ </p>
20
+ <p>
21
+ <button id="wpdesk_tracker_allow_button_notice" class="button button-primary"><?php _e( 'Allow', 'wpdesk-tracker' ); ?></button>
22
+ </p>
23
+ </div>
24
+ <?php endif; ?>
25
+
26
+ <script type="text/javascript">
27
+ jQuery(document).on('click', '#wpdesk_tracker_notice_coupon .notice-dismiss',function(e){
28
+ e.preventDefault();
29
+ console.log('dismiss');
30
+ jQuery.ajax( '<?php echo admin_url('admin-ajax.php'); ?>',
31
+ {
32
+ type: 'POST',
33
+ data: {
34
+ action: 'wpdesk_tracker_notice_handler',
35
+ type: 'dismiss_coupon',
36
+ }
37
+ }
38
+ );
39
+ })
40
+ jQuery(document).on('click', '#wpdesk_tracker_allow_coupon_button_notice',function(e){
41
+ e.preventDefault();
42
+ console.log('allow');
43
+ jQuery.ajax( '<?php echo admin_url('admin-ajax.php'); ?>',
44
+ {
45
+ type: 'POST',
46
+ data: {
47
+ action: 'wpdesk_tracker_notice_handler',
48
+ type: 'allow_coupon',
49
+ }
50
+ }
51
+ );
52
+ jQuery('#wpdesk_tracker_notice_coupon').hide();
53
+ });
54
+ jQuery(document).on('click', '#wpdesk_tracker_notice .notice-dismiss',function(e){
55
+ e.preventDefault();
56
+ console.log('dismiss');
57
+ jQuery.ajax( '<?php echo admin_url('admin-ajax.php'); ?>',
58
+ {
59
+ type: 'POST',
60
+ data: {
61
+ action: 'wpdesk_tracker_notice_handler',
62
+ type: 'dismiss',
63
+ }
64
+ }
65
+ );
66
+ })
67
+ jQuery(document).on('click', '#wpdesk_tracker_allow_button_notice',function(e){
68
+ e.preventDefault();
69
+ console.log('allow');
70
+ jQuery.ajax( '<?php echo admin_url('admin-ajax.php'); ?>',
71
+ {
72
+ type: 'POST',
73
+ data: {
74
+ action: 'wpdesk_tracker_notice_handler',
75
+ type: 'allow',
76
+ }
77
+ }
78
+ );
79
+ jQuery('#wpdesk_tracker_notice').hide();
80
+ });
81
+ </script>
inc/wpdesk-tracker/views/tracker-opt-out-notice.php ADDED
@@ -0,0 +1,4 @@
 
 
 
 
1
+ <?php if ( ! defined( 'ABSPATH' ) ) { exit; } ?>
2
+ <div id="wpdesk_tracker_notice" class="updated notice wpdesk_tracker_notice">
3
+ <p><?php _e( 'You successfully opted out of collecting usage data by WP Desk. If you change your mind, you can always opt in later in the plugin\'s quick links.', 'wpdesk-tracker'); ?></p>
4
+ </div>
inc/wpdesk-tracker/views/tracker-plugins-footer.php ADDED
@@ -0,0 +1,24 @@
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
+ <?php if ( ! defined( 'ABSPATH' ) ) { exit; } ?>
2
+ <script type="text/javascript">
3
+ var wpdesk_track_deactivation_plugins = <?php echo json_encode( $plugins ); ?>;
4
+ console.log(wpdesk_track_deactivation_plugins);
5
+ jQuery("span.deactivate a").click(function(e){
6
+ var is_tracked = false;
7
+ console.log(jQuery(this).closest('tr'));
8
+ var data_plugin = jQuery(this).closest('tr').attr('data-plugin');
9
+ console.log(data_plugin);
10
+ var href = jQuery(this).attr('href');
11
+ console.log(href);
12
+ jQuery.each( wpdesk_track_deactivation_plugins, function( key, value ) {
13
+ console.log( key + ": " + value );
14
+ if ( value == data_plugin ) {
15
+ console.log('match');
16
+ is_tracked = true;
17
+ }
18
+ });
19
+ if ( is_tracked ) {
20
+ e.preventDefault();
21
+ window.location.href = '<?php echo admin_url( 'admin.php?page=wpdesk_tracker_deactivate&plugin=' ); ?>' + '&plugin=' + data_plugin;
22
+ }
23
+ })
24
+ </script>
languages/flexible-shipping-pl_PL.mo CHANGED
Binary file
languages/flexible-shipping-pl_PL.po CHANGED
@@ -1,9 +1,9 @@
1
  msgid ""
2
  msgstr ""
3
  "Project-Id-Version: Flexible Shipping\n"
4
- "POT-Creation-Date: 2017-03-29 15:12+0200\n"
5
- "PO-Revision-Date: 2017-03-30 14:13+0200\n"
6
- "Last-Translator: Piotr Jabłonowski <piotr.jablonowski@inspirelabs.pl>\n"
7
  "Language-Team: Maciej Swoboda <maciej.swoboda@gmail.com>\n"
8
  "Language: pl_PL\n"
9
  "MIME-Version: 1.0\n"
@@ -20,48 +20,69 @@ msgstr ""
20
  "_nx_noop:3c,1,2;__ngettext_noop:1,2\n"
21
  "X-Poedit-SearchPath-0: .\n"
22
  "X-Poedit-SearchPathExcluded-0: *.js\n"
 
23
 
24
- #: classes/bulk-actions.php:43
25
  msgid "New"
26
  msgstr "Nowa"
27
 
28
- #: classes/bulk-actions.php:44 classes/bulk-actions.php:122
29
  msgid "Created"
30
  msgstr "Utworzona"
31
 
32
- #: classes/bulk-actions.php:45 classes/bulk-actions.php:123
33
  msgid "Confirmed"
34
  msgstr "Zatwierdzona"
35
 
36
- #: classes/bulk-actions.php:46
 
 
 
 
37
  msgid "Failed"
38
  msgstr "Błąd"
39
 
40
- #: classes/bulk-actions.php:120 classes/bulk-actions.php:135
41
  msgid "Error"
42
  msgstr "Błąd"
43
 
44
- #: classes/bulk-actions.php:121
45
- msgid "New shipping"
46
  msgstr "Nowa"
47
 
48
- #: classes/bulk-actions.php:158
 
 
 
 
49
  msgid "Shipping"
50
  msgstr "Wysyłka"
51
 
52
- #: classes/bulk-actions.php:166
53
- msgid "Send shipping"
54
  msgstr "Nadaj przesyłki"
55
 
56
- #: classes/bulk-actions.php:167
57
  msgid "Get labels"
58
  msgstr "Pobierz etykiety nadawcze"
59
 
60
- #: classes/bulk-actions.php:177
 
 
 
 
 
 
 
 
61
  msgid "No action performed."
62
  msgstr "Nie wykonano żdanych działań."
63
 
64
- #: classes/bulk-actions.php:194
 
 
 
 
65
  msgid ""
66
  "Unable to create temporary zip archive for labels. Check temporary folder "
67
  "configuration on server."
@@ -69,19 +90,42 @@ msgstr ""
69
  "Nie można utworzyć tymczasowego archwium zip dla etykiet. Sprawdź "
70
  "konfigurację folderu na serwerze."
71
 
72
- #: classes/bulk-actions.php:218
 
 
 
 
 
 
 
 
 
73
  #, php-format
74
- msgid "Bulk send shipping - processed orders: %d"
 
 
 
 
 
 
 
 
 
75
  msgstr "Masowe nadawanie przesyłek - przetworzone zamówienia: %d"
76
 
77
- #: classes/bulk-actions.php:233
78
  #, php-format
79
  msgid ""
80
  "Bulk labels - processed orders: %d. If download not start automatically "
81
  "click %shere%s."
82
  msgstr ""
83
  "Masowe pobieranie etykiet - przetworzone zamówienia: %d. Jeśli pobieranie "
84
- "nie rozpoczęło się automatycznie kliknij %stutaj%s "
 
 
 
 
 
85
 
86
  #: classes/inspire/plugin4.php:218
87
  msgid ""
@@ -95,25 +139,132 @@ msgstr ""
95
  msgid "An unknown error occurred"
96
  msgstr "Wystąpił nieznany błąd"
97
 
98
- #: classes/inspire/plugin4.php:387 flexible-shipping.php:468
99
  msgid "Settings"
100
  msgstr "Ustawienia"
101
 
102
- #: classes/inspire/plugin4.php:388 flexible-shipping.php:469
103
  msgid "Docs"
104
  msgstr "Docs"
105
 
106
- #: classes/inspire/plugin4.php:389 flexible-shipping.php:470
107
  msgid "Support"
108
  msgstr "Wsparcie"
109
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
110
  #. Plugin Name of the plugin/theme
111
  #: classes/settings-flexible-shipping.php:14
112
  #: classes/settings-flexible-shipping.php:28
113
  #: classes/settings-shipping-method-form.php:39 classes/shipping_method.php:24
114
  #: classes/shipping_method.php:25 classes/shipping_method.php:43
115
- #: flexible-shipping.php:353 flexible-shipping.php:356
116
- #: flexible-shipping.php:359
117
  msgid "Flexible Shipping"
118
  msgstr "Flexible Shipping"
119
 
@@ -158,7 +309,7 @@ msgid "Shipping Methods"
158
  msgstr "Metody wysyłki"
159
 
160
  #: classes/settings-shipping-method-form.php:10
161
- msgid "Select shipping class"
162
  msgstr "Wybierz klasę wysyłkową"
163
 
164
  #: classes/settings-shipping-method-form.php:15
@@ -175,7 +326,7 @@ msgid "Free"
175
  msgstr "Bezpłatnie"
176
 
177
  #: classes/settings-shipping-method-form.php:33 classes/shipping_method.php:36
178
- msgid "Enable this shipping method"
179
  msgstr "Włącz tę metodę wysyłki"
180
 
181
  #: classes/settings-shipping-method-form.php:36
@@ -200,7 +351,7 @@ msgstr "Darmowa wysyłka"
200
 
201
  #: classes/settings-shipping-method-form.php:61
202
  msgid ""
203
- "Enter a minimum order amount for free shipping. This will override the costs "
204
  "configured below."
205
  msgstr ""
206
  "Wpisz minimalną kwotę zamówienia dla bezpłatnej wysyłki. Spowoduje to "
@@ -211,7 +362,7 @@ msgid "Free Shipping Label"
211
  msgstr "Etykieta darmowej wysyłki"
212
 
213
  #: classes/settings-shipping-method-form.php:68
214
- msgid "Enter additional label for shipping when free shipping available."
215
  msgstr ""
216
  "Wpisz dodatkową etykietę, która zostanie wyświetlona dla darmowej wysyłki."
217
 
@@ -253,12 +404,6 @@ msgstr ""
253
  "Zaznacz, aby ustawić tę metodę wysyłki jako domyślną przy składaniu "
254
  "zamówienia."
255
 
256
- #: classes/settings-shipping-method-form.php:97
257
- #: classes/views/html-orders-filter-form.php:5
258
- #: classes/views/html-shipping-method-settings.php:15
259
- msgid "Integration"
260
- msgstr "Integracja"
261
-
262
  #: classes/settings-shipping-method-form.php:99
263
  msgid "Select integration. "
264
  msgstr "Wybierz integrację. "
@@ -278,9 +423,131 @@ msgstr "Strefa wysyłki"
278
 
279
  #: classes/settings-shipping-method-form.php:146
280
  #, php-format
281
- msgid "See how to %sconfigure shipping methods%s."
282
  msgstr "Zobacz jak %sskonfigurować metody wysyłki %s."
283
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
284
  #: classes/shipping_method.php:40
285
  msgid "Shipping Title"
286
  msgstr "Tytuł"
@@ -378,6 +645,14 @@ msgstr "Metoda wysyłki nie znaleziona."
378
  msgid "Shipping method %s updated."
379
  msgstr "Metoda wysyłki zaktualizowana: %s."
380
 
 
 
 
 
 
 
 
 
381
  #: classes/views/html-ads.php:4
382
  msgid "Get Flexible Shipping PRO!"
383
  msgstr "Kup Flexible Shipping PRO!"
@@ -437,7 +712,7 @@ msgstr "Waga"
437
  #, php-format
438
  msgid ""
439
  "Check %sFlexible Shipping PRO &rarr;%s to add advanced rules based on "
440
- "shipping classes, product/item count or additional handling fees/insurance."
441
  msgstr ""
442
  "Sprawdź %sFlexible Shipping PRO &rarr;%s, aby dodawać zaawansowane reguły "
443
  "oparte o klasy wysyłkowe, liczbę produktów/pozycji lub naliczać dodatkowe "
@@ -472,7 +747,7 @@ msgid "Cost per order"
472
  msgstr "Koszt na zamówienie"
473
 
474
  #: classes/views/html-shipping-method-rules.php:86
475
- msgid "Enter shipping cost for this rule."
476
  msgstr "Wpisz koszt wysyłki dla tej reguły."
477
 
478
  #: classes/views/html-shipping-method-rules.php:162
@@ -520,7 +795,7 @@ msgstr "Pokaż dla wszystkich użytkowników"
520
 
521
  #: classes/views/html-shipping-method-settings.php:69
522
  msgid ""
523
- "Drag and drop the above shipping methods to control their display order. "
524
  "Confirm by clicking Save changes button below."
525
  msgstr ""
526
  "Przeciągnij i upuść metody wysyłki aby ustawić ich kolejność wyświetlania. "
@@ -540,41 +815,45 @@ msgid "Import"
540
  msgstr "Importuj"
541
 
542
  #: classes/views/html-shipping-method-settings.php:155
543
- msgid "Please select shipping methods to remove"
544
- msgstr "Prosze wybrać metody wysyłki do usunięcia."
545
 
546
  #: classes/views/html-shipping-method-settings.php:187
547
  msgid "Select file to import"
548
  msgstr "Wybierz plik do importu"
549
 
550
- #: flexible-shipping.php:396
551
  msgid ""
552
  "Flexible Shipping requires at least version 2.7 of Active Payments plugin."
553
  msgstr ""
554
  "Flexible Shipping wymaga wtyczki Aktywne płatności w wersji co najmniej 2.7."
555
 
556
- #: flexible-shipping.php:407
557
  msgid "Flexible Shipping requires at least version 1.2 of eNadawca plugin."
558
  msgstr "Flexible Shipping wymaga wtyczki eNadawca w wersji co najmniej 1.2."
559
 
560
- #: flexible-shipping.php:418
561
  msgid ""
562
  "Flexible Shipping requires at least version 1.1 of Paczka w Ruchu plugin."
563
  msgstr ""
564
  "Flexible Shipping wymaga wtyczki Paczka w Ruchu w wersji co najmniej 1.1."
565
 
566
- #: flexible-shipping.php:426
567
  #, php-format
568
  msgid ""
569
  "You are using WooCommerce Flexible Shipping below 1.4. Please deactivate it "
570
  "on %splugins page%s. Read about big changes in Flexible Shipping on %sour "
571
  "blog →%s"
572
  msgstr ""
573
- " Masz włączony WooCommerce Flexible Shipping w wersji starszej niż 1.4. "
574
  "Wyłącz go na %sstronie wtyczek%s. Przeczytaj o dużej zmianie we Flexible "
575
  "Shipping na %snaszym blogu →%s"
576
 
577
- #: flexible-shipping.php:579
 
 
 
 
578
  #, php-format
579
  msgid "Redirecting. If page not redirects click %s here %s."
580
  msgstr ""
@@ -587,7 +866,7 @@ msgstr "https://pl.wordpress.org/plugins/flexible-shipping/"
587
 
588
  #. Description of the plugin/theme
589
  msgid ""
590
- "Create additional shipping methods in WooCommerce and enable pricing based "
591
  "on cart weight or total."
592
  msgstr ""
593
  "Stwórz dodatkowe metody wysyłki w WooCommerce i włącz obliczanie kosztów w "
@@ -607,13 +886,13 @@ msgstr "https://www.wpdesk.pl/"
607
  #~ msgid "Minimum Order Amount"
608
  #~ msgstr "Minimalna wartość zamówienia"
609
 
610
- #~ msgid "Free shipping label"
611
  #~ msgstr "Etykieta darmowej wysyłki"
612
 
613
  #~ msgid "Calculation method"
614
  #~ msgstr "Metoda obliczania"
615
 
616
- #~ msgid "Free shipping"
617
  #~ msgstr "Darmowa wysyłka"
618
 
619
  #~ msgid ""
@@ -630,7 +909,7 @@ msgstr "https://www.wpdesk.pl/"
630
  #~ msgstr "Usuń"
631
 
632
  #~ msgid ""
633
- #~ "If you need more advanced rules based on shipping classes, product/item "
634
  #~ "count or adding additional handling/insurance fees make sure to check "
635
  #~ "%sFlexible Shipping PRO &rarr;%s"
636
  #~ msgstr ""
@@ -658,6 +937,6 @@ msgstr "https://www.wpdesk.pl/"
658
  #~ msgstr "Wartość"
659
 
660
  #~ msgid ""
661
- #~ "Enter minimum order amount for free shipping. This will override all "
662
  #~ "rules configured below."
663
  #~ msgstr "Wprowadź minimalną kwotę do bezpłatnej wysyłki. "
1
  msgid ""
2
  msgstr ""
3
  "Project-Id-Version: Flexible Shipping\n"
4
+ "POT-Creation-Date: 2017-05-29 14:07+0200\n"
5
+ "PO-Revision-Date: 2017-05-29 14:20+0200\n"
6
+ "Last-Translator: Maciej Swoboda <maciej.swoboda@gmail.com>\n"
7
  "Language-Team: Maciej Swoboda <maciej.swoboda@gmail.com>\n"
8
  "Language: pl_PL\n"
9
  "MIME-Version: 1.0\n"
20
  "_nx_noop:3c,1,2;__ngettext_noop:1,2\n"
21
  "X-Poedit-SearchPath-0: .\n"
22
  "X-Poedit-SearchPathExcluded-0: *.js\n"
23
+ "X-Poedit-SearchPathExcluded-1: inc/wpdesk-tracker\n"
24
 
25
+ #: classes/bulk-actions.php:46
26
  msgid "New"
27
  msgstr "Nowa"
28
 
29
+ #: classes/bulk-actions.php:47 classes/bulk-actions.php:198
30
  msgid "Created"
31
  msgstr "Utworzona"
32
 
33
+ #: classes/bulk-actions.php:48 classes/bulk-actions.php:199
34
  msgid "Confirmed"
35
  msgstr "Zatwierdzona"
36
 
37
+ #: classes/bulk-actions.php:49
38
+ msgid "Manifest"
39
+ msgstr "Protokół nadania"
40
+
41
+ #: classes/bulk-actions.php:50
42
  msgid "Failed"
43
  msgstr "Błąd"
44
 
45
+ #: classes/bulk-actions.php:196 classes/bulk-actions.php:226
46
  msgid "Error"
47
  msgstr "Błąd"
48
 
49
+ #: classes/bulk-actions.php:197
50
+ msgid "New shipment"
51
  msgstr "Nowa"
52
 
53
+ #: classes/bulk-actions.php:200
54
+ msgid "Manifest created"
55
+ msgstr "Protokół nadania utworzony"
56
+
57
+ #: classes/bulk-actions.php:252
58
  msgid "Shipping"
59
  msgstr "Wysyłka"
60
 
61
+ #: classes/bulk-actions.php:262
62
+ msgid "Send shipment"
63
  msgstr "Nadaj przesyłki"
64
 
65
+ #: classes/bulk-actions.php:263
66
  msgid "Get labels"
67
  msgstr "Pobierz etykiety nadawcze"
68
 
69
+ #: classes/bulk-actions.php:265
70
+ msgid "Create shipping manifest"
71
+ msgstr "Utwórz protokół nadania"
72
+
73
+ #: classes/bulk-actions.php:286
74
+ msgid "Shipment created."
75
+ msgstr "Przesyłka utworzona."
76
+
77
+ #: classes/bulk-actions.php:298
78
  msgid "No action performed."
79
  msgstr "Nie wykonano żdanych działań."
80
 
81
+ #: classes/bulk-actions.php:318
82
+ msgid "Label downloaded."
83
+ msgstr "Etykieta została pobrana."
84
+
85
+ #: classes/bulk-actions.php:331
86
  msgid ""
87
  "Unable to create temporary zip archive for labels. Check temporary folder "
88
  "configuration on server."
90
  "Nie można utworzyć tymczasowego archwium zip dla etykiet. Sprawdź "
91
  "konfigurację folderu na serwerze."
92
 
93
+ #: classes/bulk-actions.php:391
94
+ #, php-format
95
+ msgid ""
96
+ "Created manifest: %s (%s). If download not start automatically click %shere"
97
+ "%s."
98
+ msgstr ""
99
+ "Utworzone protokoły nadania: %s (%s). Jesli pobieranie nie rozpoczęło się "
100
+ "automatycznie kliknij %stutaj%s."
101
+
102
+ #: classes/bulk-actions.php:403
103
  #, php-format
104
+ msgid "Manifest creation error: %s (%s)."
105
+ msgstr "Błąd podczas tworzenia protokołu nadania: %s (%s)."
106
+
107
+ #: classes/bulk-actions.php:414
108
+ msgid "No manifests created."
109
+ msgstr "Nie zostały utworzone protokoły nadania."
110
+
111
+ #: classes/bulk-actions.php:428
112
+ #, php-format
113
+ msgid "Bulk send shipment - processed orders: %d"
114
  msgstr "Masowe nadawanie przesyłek - przetworzone zamówienia: %d"
115
 
116
+ #: classes/bulk-actions.php:445
117
  #, php-format
118
  msgid ""
119
  "Bulk labels - processed orders: %d. If download not start automatically "
120
  "click %shere%s."
121
  msgstr ""
122
  "Masowe pobieranie etykiet - przetworzone zamówienia: %d. Jeśli pobieranie "
123
+ "nie rozpoczęło się automatycznie kliknij %stutaj%s ."
124
+
125
+ #: classes/bulk-actions.php:453
126
+ #, php-format
127
+ msgid "Bulk shipping manifest - processed orders: %d"
128
+ msgstr "Zbiorcze tworzenie protokołów nadania - przetworzone zamówienia: %d"
129
 
130
  #: classes/inspire/plugin4.php:218
131
  msgid ""
139
  msgid "An unknown error occurred"
140
  msgstr "Wystąpił nieznany błąd"
141
 
142
+ #: classes/inspire/plugin4.php:387 flexible-shipping.php:483
143
  msgid "Settings"
144
  msgstr "Ustawienia"
145
 
146
+ #: classes/inspire/plugin4.php:388 flexible-shipping.php:484
147
  msgid "Docs"
148
  msgstr "Docs"
149
 
150
+ #: classes/inspire/plugin4.php:389 flexible-shipping.php:485
151
  msgid "Support"
152
  msgstr "Wsparcie"
153
 
154
+ #: classes/manifest/cpt-shipping-manifest.php:60
155
+ #: classes/manifest/cpt-shipping-manifest.php:62
156
+ #: classes/manifest/cpt-shipping-manifest.php:64
157
+ #: classes/manifest/cpt-shipping-manifest.php:97
158
+ msgid "Shipping Manifests"
159
+ msgstr "Protokoły nadania"
160
+
161
+ #: classes/manifest/cpt-shipping-manifest.php:61
162
+ msgid "Shipping Manifest"
163
+ msgstr "Protokół nadania"
164
+
165
+ #: classes/manifest/cpt-shipping-manifest.php:65
166
+ msgid "View Shipping Manifests"
167
+ msgstr "Wyświetl protokół nadania"
168
+
169
+ #: classes/manifest/cpt-shipping-manifest.php:66
170
+ msgid "Add new Shipping Manifest"
171
+ msgstr "Dodaj nowy Protokół nadania"
172
+
173
+ #: classes/manifest/cpt-shipping-manifest.php:67
174
+ msgid "Add new Shipping Manifests"
175
+ msgstr "Dodaj nowe Protokoły nadania"
176
+
177
+ #: classes/manifest/cpt-shipping-manifest.php:68
178
+ msgid "Edit Shipping Manifest"
179
+ msgstr "Edytuj protokół nadania"
180
+
181
+ #: classes/manifest/cpt-shipping-manifest.php:69
182
+ msgid "Save Shipping Manifest"
183
+ msgstr "Zapisz protokół nadania"
184
+
185
+ #: classes/manifest/cpt-shipping-manifest.php:70
186
+ msgid "Search Shipping Manifests"
187
+ msgstr "Szukaj protokół nadania"
188
+
189
+ #: classes/manifest/cpt-shipping-manifest.php:71
190
+ msgid "Shipping Manifests not found"
191
+ msgstr "Nie znaleziono protokołów nadania"
192
+
193
+ #: classes/manifest/cpt-shipping-manifest.php:72
194
+ msgid "Shipping Manifests not found in trash"
195
+ msgstr "Nie znaleziono protokołów nadania w koszu"
196
+
197
+ #: classes/manifest/cpt-shipping-manifest.php:74
198
+ msgid "Shipping Manifests."
199
+ msgstr "Protokoły nadania."
200
+
201
+ #: classes/manifest/cpt-shipping-manifest.php:116
202
+ #: classes/shipment/cpt-shipment.php:39 classes/shipment/cpt-shipment.php:41
203
+ #: classes/shipment/cpt-shipment.php:43
204
+ msgid "Shipments"
205
+ msgstr "Przesyłki"
206
+
207
+ #: classes/manifest/cpt-shipping-manifest.php:160
208
+ msgid "Date"
209
+ msgstr "Data"
210
+
211
+ #: classes/manifest/cpt-shipping-manifest.php:161
212
+ #: classes/manifest/views/filter-form.php:5
213
+ #: classes/settings-shipping-method-form.php:97
214
+ #: classes/views/html-orders-filter-form.php:5
215
+ #: classes/views/html-shipping-method-settings.php:15
216
+ msgid "Integration"
217
+ msgstr "Integracja"
218
+
219
+ #: classes/manifest/cpt-shipping-manifest.php:162
220
+ msgid "Number"
221
+ msgstr "Numer"
222
+
223
+ #: classes/manifest/cpt-shipping-manifest.php:163
224
+ msgid "Shipments count"
225
+ msgstr "Liczba przesyłek"
226
+
227
+ #: classes/manifest/cpt-shipping-manifest.php:164
228
+ msgid "Actions"
229
+ msgstr "Akcje"
230
+
231
+ #: classes/manifest/cpt-shipping-manifest.php:218
232
+ #: classes/manifest/cpt-shipping-manifest.php:241
233
+ #: classes/shipment/cpt-shipment.php:174
234
+ msgid "Invalid nonce!"
235
+ msgstr "Błąd weryfikacji nonce!"
236
+
237
+ #: classes/manifest/functions.php:16
238
+ #, php-format
239
+ msgid "Shipping manifest %s, %s"
240
+ msgstr "Protokół nadania %s, %s"
241
+
242
+ #: classes/manifest/views/column-actions.php:1
243
+ msgid "Cancel"
244
+ msgstr "Anuluj"
245
+
246
+ #: classes/manifest/views/filter-form.php:4
247
+ msgid "All manifests"
248
+ msgstr "Wszystkie protokoły nadania"
249
+
250
+ #: classes/manifest/views/manifest-metabox.php:7
251
+ #: classes/manifest/views/manifest-metabox.php:47
252
+ #: classes/shipment/cpt-shipment.php:40
253
+ msgid "Shipment"
254
+ msgstr "Przesyłka"
255
+
256
+ #: classes/manifest/views/manifest-metabox.php:10
257
+ #: classes/manifest/views/manifest-metabox.php:50
258
+ msgid "Order"
259
+ msgstr "Zamówienie"
260
+
261
  #. Plugin Name of the plugin/theme
262
  #: classes/settings-flexible-shipping.php:14
263
  #: classes/settings-flexible-shipping.php:28
264
  #: classes/settings-shipping-method-form.php:39 classes/shipping_method.php:24
265
  #: classes/shipping_method.php:25 classes/shipping_method.php:43
266
+ #: flexible-shipping.php:367 flexible-shipping.php:370
267
+ #: flexible-shipping.php:373
268
  msgid "Flexible Shipping"
269
  msgstr "Flexible Shipping"
270
 
309
  msgstr "Metody wysyłki"
310
 
311
  #: classes/settings-shipping-method-form.php:10
312
+ msgid "Select shipment class"
313
  msgstr "Wybierz klasę wysyłkową"
314
 
315
  #: classes/settings-shipping-method-form.php:15
326
  msgstr "Bezpłatnie"
327
 
328
  #: classes/settings-shipping-method-form.php:33 classes/shipping_method.php:36
329
+ msgid "Enable this shipment method"
330
  msgstr "Włącz tę metodę wysyłki"
331
 
332
  #: classes/settings-shipping-method-form.php:36
351
 
352
  #: classes/settings-shipping-method-form.php:61
353
  msgid ""
354
+ "Enter a minimum order amount for free shipment. This will override the costs "
355
  "configured below."
356
  msgstr ""
357
  "Wpisz minimalną kwotę zamówienia dla bezpłatnej wysyłki. Spowoduje to "
362
  msgstr "Etykieta darmowej wysyłki"
363
 
364
  #: classes/settings-shipping-method-form.php:68
365
+ msgid "Enter additional label for shipment when free shipment available."
366
  msgstr ""
367
  "Wpisz dodatkową etykietę, która zostanie wyświetlona dla darmowej wysyłki."
368
 
404
  "Zaznacz, aby ustawić tę metodę wysyłki jako domyślną przy składaniu "
405
  "zamówienia."
406
 
 
 
 
 
 
 
407
  #: classes/settings-shipping-method-form.php:99
408
  msgid "Select integration. "
409
  msgstr "Wybierz integrację. "
423
 
424
  #: classes/settings-shipping-method-form.php:146
425
  #, php-format
426
+ msgid "See how to %sconfigure shipment methods%s."
427
  msgstr "Zobacz jak %sskonfigurować metody wysyłki %s."
428
 
429
+ #: classes/shipment/ajax.php:22
430
+ msgid "Unknown error!"
431
+ msgstr "Nieznany błąd!"
432
+
433
+ #: classes/shipment/ajax.php:25
434
+ msgid "Nonce verification error! Invalid request."
435
+ msgstr "Błąd weryfikacji nonce! Nieprawidłowe żądanie."
436
+
437
+ #: classes/shipment/ajax.php:29
438
+ msgid "No shipment id!"
439
+ msgstr "Brak id przesyłki!"
440
+
441
+ #: classes/shipment/ajax.php:33
442
+ msgid "No data!"
443
+ msgstr "Brak danych!"
444
+
445
+ #: classes/shipment/ajax.php:50
446
+ msgid "Saved"
447
+ msgstr "Zapisano"
448
+
449
+ #: classes/shipment/class-shipment.php:284
450
+ msgid "Please override shipping_column method!"
451
+ msgstr "Proszę nadpisać metodę shipping_column!"
452
+
453
+ #: classes/shipment/cpt-shipment.php:44
454
+ msgid "View Shipments"
455
+ msgstr "Wyświetl przesyłki"
456
+
457
+ #: classes/shipment/cpt-shipment.php:45 classes/shipment/cpt-shipment.php:46
458
+ msgid "Add new Shipment"
459
+ msgstr "Dodaj nową przesyłkę"
460
+
461
+ #: classes/shipment/cpt-shipment.php:47
462
+ msgid "Edit Shipment"
463
+ msgstr "Edytuj przesyłkę"
464
+
465
+ #: classes/shipment/cpt-shipment.php:48
466
+ msgid "Save Shipment"
467
+ msgstr "Zapisz przesyłkę"
468
+
469
+ #: classes/shipment/cpt-shipment.php:49
470
+ msgid "Search Shipments"
471
+ msgstr "Szukaj przesyłek"
472
+
473
+ #: classes/shipment/cpt-shipment.php:50
474
+ msgid "Shipment not found"
475
+ msgstr "Nie znaleziono przesyłki"
476
+
477
+ #: classes/shipment/cpt-shipment.php:51
478
+ msgid "Shipment not found in trash"
479
+ msgstr "Nie znaleziono przesyłki w koszu"
480
+
481
+ #: classes/shipment/cpt-shipment.php:53
482
+ msgid "Shipments."
483
+ msgstr "Przesyłki."
484
+
485
+ #: classes/shipment/cpt-shipment.php:73
486
+ msgctxt "Shipment status"
487
+ msgid "New"
488
+ msgstr "Nowa"
489
+
490
+ #: classes/shipment/cpt-shipment.php:78
491
+ #, php-format
492
+ msgid "New <span class=\"count\">(%s)</span>"
493
+ msgid_plural "New <span class=\"count\">(%s)</span>"
494
+ msgstr[0] "Nowa <span class=\"count\">(%s)</span>"
495
+ msgstr[1] "Nowa <span class=\"count\">(%s)</span>"
496
+ msgstr[2] "Nowa <span class=\"count\">(%s)</span>"
497
+
498
+ #: classes/shipment/cpt-shipment.php:81
499
+ msgctxt "Shipment status"
500
+ msgid "Created"
501
+ msgstr "Utworzona"
502
+
503
+ #: classes/shipment/cpt-shipment.php:86
504
+ #, php-format
505
+ msgid "Created <span class=\"count\">(%s)</span>"
506
+ msgid_plural "Created <span class=\"count\">(%s)</span>"
507
+ msgstr[0] "Utworzona <span class=\"count\">(%s)</span>"
508
+ msgstr[1] "Utworzona <span class=\"count\">(%s)</span>"
509
+ msgstr[2] "Utworzona <span class=\"count\">(%s)</span>"
510
+
511
+ #: classes/shipment/cpt-shipment.php:89
512
+ msgctxt "Shipment status"
513
+ msgid "Confirmed"
514
+ msgstr "Zatwierdzona"
515
+
516
+ #: classes/shipment/cpt-shipment.php:94 classes/shipment/cpt-shipment.php:102
517
+ #, php-format
518
+ msgid "Confirmed <span class=\"count\">(%s)</span>"
519
+ msgid_plural "Confirmed <span class=\"count\">(%s)</span>"
520
+ msgstr[0] "Zatwierdzona <span class=\"count\">(%s)</span>"
521
+ msgstr[1] "Zatwierdzona <span class=\"count\">(%s)</span>"
522
+ msgstr[2] "Zatwierdzona <span class=\"count\">(%s)</span>"
523
+
524
+ #: classes/shipment/cpt-shipment.php:97
525
+ msgctxt "Shipment status"
526
+ msgid "Manifest created"
527
+ msgstr "Protokół nadania utworzony"
528
+
529
+ #: classes/shipment/cpt-shipment.php:105
530
+ msgctxt "Shipment status"
531
+ msgid "Failed"
532
+ msgstr "Błąd"
533
+
534
+ #: classes/shipment/cpt-shipment.php:110
535
+ #, php-format
536
+ msgid "Failed <span class=\"count\">(%s)</span>"
537
+ msgid_plural "Failed <span class=\"count\">(%s)</span>"
538
+ msgstr[0] "Błąd <span class=\"count\">(%s)</span>"
539
+ msgstr[1] "Błąd <span class=\"count\">(%s)</span>"
540
+ msgstr[2] "Błąd <span class=\"count\">(%s)</span>"
541
+
542
+ #: classes/shipment/cpt-shipment.php:125
543
+ msgid "Shipment data"
544
+ msgstr "Dane przesyłki"
545
+
546
+ #: classes/shipment/functions.php:23
547
+ #, php-format
548
+ msgid "Shipment for order %s, %s"
549
+ msgstr "Przesyłka do zamówienia %s, %s"
550
+
551
  #: classes/shipping_method.php:40
552
  msgid "Shipping Title"
553
  msgstr "Tytuł"
645
  msgid "Shipping method %s updated."
646
  msgstr "Metoda wysyłki zaktualizowana: %s."
647
 
648
+ #: classes/tracker.php:175
649
+ msgid "Opt-in"
650
+ msgstr "Opt-in"
651
+
652
+ #: classes/tracker.php:179
653
+ msgid "Opt-out"
654
+ msgstr "Opt-out"
655
+
656
  #: classes/views/html-ads.php:4
657
  msgid "Get Flexible Shipping PRO!"
658
  msgstr "Kup Flexible Shipping PRO!"
712
  #, php-format
713
  msgid ""
714
  "Check %sFlexible Shipping PRO &rarr;%s to add advanced rules based on "
715
+ "shipment classes, product/item count or additional handling fees/insurance."
716
  msgstr ""
717
  "Sprawdź %sFlexible Shipping PRO &rarr;%s, aby dodawać zaawansowane reguły "
718
  "oparte o klasy wysyłkowe, liczbę produktów/pozycji lub naliczać dodatkowe "
747
  msgstr "Koszt na zamówienie"
748
 
749
  #: classes/views/html-shipping-method-rules.php:86
750
+ msgid "Enter shipment cost for this rule."
751
  msgstr "Wpisz koszt wysyłki dla tej reguły."
752
 
753
  #: classes/views/html-shipping-method-rules.php:162
795
 
796
  #: classes/views/html-shipping-method-settings.php:69
797
  msgid ""
798
+ "Drag and drop the above shipment methods to control their display order. "
799
  "Confirm by clicking Save changes button below."
800
  msgstr ""
801
  "Przeciągnij i upuść metody wysyłki aby ustawić ich kolejność wyświetlania. "
815
  msgstr "Importuj"
816
 
817
  #: classes/views/html-shipping-method-settings.php:155
818
+ msgid "Please select shipment methods to remove"
819
+ msgstr "Proszę wybrać metody wysyłki do usunięcia"
820
 
821
  #: classes/views/html-shipping-method-settings.php:187
822
  msgid "Select file to import"
823
  msgstr "Wybierz plik do importu"
824
 
825
+ #: flexible-shipping.php:407
826
  msgid ""
827
  "Flexible Shipping requires at least version 2.7 of Active Payments plugin."
828
  msgstr ""
829
  "Flexible Shipping wymaga wtyczki Aktywne płatności w wersji co najmniej 2.7."
830
 
831
+ #: flexible-shipping.php:418
832
  msgid "Flexible Shipping requires at least version 1.2 of eNadawca plugin."
833
  msgstr "Flexible Shipping wymaga wtyczki eNadawca w wersji co najmniej 1.2."
834
 
835
+ #: flexible-shipping.php:429
836
  msgid ""
837
  "Flexible Shipping requires at least version 1.1 of Paczka w Ruchu plugin."
838
  msgstr ""
839
  "Flexible Shipping wymaga wtyczki Paczka w Ruchu w wersji co najmniej 1.1."
840
 
841
+ #: flexible-shipping.php:437
842
  #, php-format
843
  msgid ""
844
  "You are using WooCommerce Flexible Shipping below 1.4. Please deactivate it "
845
  "on %splugins page%s. Read about big changes in Flexible Shipping on %sour "
846
  "blog →%s"
847
  msgstr ""
848
+ "Masz włączony WooCommerce Flexible Shipping w wersji starszej niż 1.4. "
849
  "Wyłącz go na %sstronie wtyczek%s. Przeczytaj o dużej zmianie we Flexible "
850
  "Shipping na %snaszym blogu →%s"
851
 
852
+ #: flexible-shipping.php:492
853
+ msgid "Upgrade"
854
+ msgstr "Kup PRO"
855
+
856
+ #: flexible-shipping.php:609
857
  #, php-format
858
  msgid "Redirecting. If page not redirects click %s here %s."
859
  msgstr ""
866
 
867
  #. Description of the plugin/theme
868
  msgid ""
869
+ "Create additional shipment methods in WooCommerce and enable pricing based "
870
  "on cart weight or total."
871
  msgstr ""
872
  "Stwórz dodatkowe metody wysyłki w WooCommerce i włącz obliczanie kosztów w "
886
  #~ msgid "Minimum Order Amount"
887
  #~ msgstr "Minimalna wartość zamówienia"
888
 
889
+ #~ msgid "Free shipment label"
890
  #~ msgstr "Etykieta darmowej wysyłki"
891
 
892
  #~ msgid "Calculation method"
893
  #~ msgstr "Metoda obliczania"
894
 
895
+ #~ msgid "Free shipment"
896
  #~ msgstr "Darmowa wysyłka"
897
 
898
  #~ msgid ""
909
  #~ msgstr "Usuń"
910
 
911
  #~ msgid ""
912
+ #~ "If you need more advanced rules based on shipment classes, product/item "
913
  #~ "count or adding additional handling/insurance fees make sure to check "
914
  #~ "%sFlexible Shipping PRO &rarr;%s"
915
  #~ msgstr ""
937
  #~ msgstr "Wartość"
938
 
939
  #~ msgid ""
940
+ #~ "Enter minimum order amount for free shipment. This will override all "
941
  #~ "rules configured below."
942
  #~ msgstr "Wprowadź minimalną kwotę do bezpłatnej wysyłki. "
readme.txt CHANGED
@@ -4,7 +4,7 @@ Donate link: https://www.wpdesk.net/products/flexible-shipping-pro-woocommerce/
4
  Tags: table rate, table rate shipping, woocommerce shipping, flexible shipping, woocommerce table rate shipping, cart based shipping, weight shipping, weight based shipping, totals based shipping, order based shipping, shipping zones, shipping classes
5
  Requires at least: 4.4
6
  Tested up to: 4.7.5
7
- Stable tag: 1.9
8
  License: GPLv3 or later
9
  License URI: http://www.gnu.org/licenses/gpl-3.0.html
10
 
@@ -153,6 +153,9 @@ If you are upgrading from the old Flexible Shipping version (1.3.2, woo-flexible
153
 
154
  == Changelog ==
155
 
 
 
 
156
  = 1.9 - 2017-03-30 =
157
  * Added support for upcoming WooCommerce 3.0
158
  * Added support for bulk shipping available in our shipping integrations
4
  Tags: table rate, table rate shipping, woocommerce shipping, flexible shipping, woocommerce table rate shipping, cart based shipping, weight shipping, weight based shipping, totals based shipping, order based shipping, shipping zones, shipping classes
5
  Requires at least: 4.4
6
  Tested up to: 4.7.5
7
+ Stable tag: 1.9.1
8
  License: GPLv3 or later
9
  License URI: http://www.gnu.org/licenses/gpl-3.0.html
10
 
153
 
154
  == Changelog ==
155
 
156
+ = 1.9.1 - 2017-06-02 =
157
+ * Added compatibility with WooCommerce InPost 3.3
158
+
159
  = 1.9 - 2017-03-30 =
160
  * Added support for upcoming WooCommerce 3.0
161
  * Added support for bulk shipping available in our shipping integrations