Flexible Shipping for WooCommerce - Version 3.9.17

Version Description

  • 2020-04-24 =
  • Added Beacon functionality for Flexible Shipping PRO
  • Changed PRO advertising
Download this release

Release Info

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

Code changes from version 3.9.16 to 3.9.17

Files changed (29) hide show
  1. assets/css/admin.css +35 -14
  2. assets/css/admin.min.css +1 -1
  3. classes/class-flexible-shipping-plugin.php +1 -1
  4. classes/table-rate/settings/flexible-shipping.php +0 -1
  5. classes/table-rate/shipping-method.php +797 -779
  6. classes/table-rate/views/html-ads.php +5 -5
  7. classes/table-rate/views/html-shipping-method-rules.php +28 -31
  8. classes/table-rate/views/html-shipping-method-settings.php +0 -6
  9. composer.lock +331 -66
  10. flexible-shipping.php +3 -3
  11. readme.txt +6 -2
  12. vendor/autoload.php +1 -1
  13. vendor/composer/autoload_classmap.php +5 -0
  14. vendor/composer/autoload_real.php +4 -4
  15. vendor/composer/autoload_static.php +9 -4
  16. vendor_prefixed/wpdesk/wp-code-sniffer/composer.json +38 -0
  17. vendor_prefixed/wpdesk/wp-helpscout-beacon/assets/js/hs-bc.js +112 -0
  18. vendor_prefixed/wpdesk/wp-helpscout-beacon/composer.json +39 -0
  19. vendor_prefixed/wpdesk/wp-helpscout-beacon/src/Beacon/Beacon.php +95 -0
  20. vendor_prefixed/wpdesk/wp-helpscout-beacon/src/Beacon/BeaconGetShouldShowStrategy.php +43 -0
  21. vendor_prefixed/wpdesk/wp-helpscout-beacon/src/Beacon/BeaconPro.php +22 -0
  22. vendor_prefixed/wpdesk/wp-helpscout-beacon/src/Beacon/BeaconShouldShowStrategy.php +16 -0
  23. vendor_prefixed/wpdesk/wp-helpscout-beacon/src/Beacon/WooCommerceSettingsFieldsModifier.php +47 -0
  24. vendor_prefixed/wpdesk/wp-helpscout-beacon/src/Beacon/templates/html-beacon-script.php +88 -0
  25. vendor_prefixed/wpdesk/wp-plugin-flow/src/Initialization/HelperInstanceAsFilterTrait.php +1 -1
  26. vendor_prefixed/wpdesk/wp-plugin-flow/src/Initialization/Simple/SimplePaidStrategy.php +9 -7
  27. vendor_prefixed/wpdesk/wp-plugin-flow/src/Initialization/TrackerInstanceAsFilterTrait.php +10 -1
  28. vendor_prefixed/wpdesk/wp-plugin-flow/src/PluginBootstrap.php +2 -2
  29. vendor_prefixed/wpdesk/wp-wpdesk-tracker/src/views/tracker-notice.php +23 -8
assets/css/admin.css CHANGED
@@ -137,20 +137,6 @@ table.flexible_shipping_method_rules tfoot th {
137
  position: relative;
138
  }
139
 
140
- .flexible-shipping-pro-box {
141
- max-width: 280px;
142
- min-width: 180px;
143
- right: 0;
144
- position: absolute;
145
- top: 135px;
146
- }
147
-
148
- @media screen and (max-width: 1199px) {
149
- .flexible-shipping-pro-box {
150
- display: none;
151
- }
152
- }
153
-
154
  /* Flexible Shipping Column - Orders List */
155
 
156
  .column-flexible_shipping {
@@ -732,3 +718,38 @@ input.woocommerce_flexible_shipping_service_name {
732
  .hide-fs-connect-integration-box {
733
  display: none;
734
  }
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
137
  position: relative;
138
  }
139
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
140
  /* Flexible Shipping Column - Orders List */
141
 
142
  .column-flexible_shipping {
718
  .hide-fs-connect-integration-box {
719
  display: none;
720
  }
721
+
722
+ .fs-settings-div table.form-table {
723
+ width: 700px;
724
+ float: left;
725
+ }
726
+
727
+ .fs-flexible-shipping-sidebar {
728
+ float:right;
729
+ padding-left: 30px;
730
+ width: 300px;
731
+ margin-top: -100px;
732
+ }
733
+
734
+ @media (max-width: 1200px) {
735
+ .fs-flexible-shipping-sidebar {
736
+ display: none;
737
+ }
738
+ }
739
+
740
+ /* WP Desk Metabox */
741
+ .wpdesk-metabox {
742
+ background-color: #23282d;
743
+ color: #fff;
744
+ padding: 20px;
745
+ }
746
+
747
+ .wpdesk-metabox .title {
748
+ color: #fff;
749
+ }
750
+
751
+ .wpdesk-metabox .icon {
752
+ display: block;
753
+ margin: 0 auto;
754
+ width: 110px;
755
+ }
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;padding:2px}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_methods td.ui-sortable-handle:before,table.flexible_shipping_services td.ui-sortable-handle:before{content:'\f333';font-family:Dashicons;text-align:center;line-height:1;color:#999;display:block;width:17px;float:left;height:100%;line-height:24px}table.flexible_shipping_method_rules th,table.flexible_shipping_method_rules th{padding:5px 10px 5px 0}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%;box-shadow:none;padding:0 !important}table.flexible_shipping_method_rules td p input[type=text]{text-align:right;padding:0 5px 0 5px !important;width:100% !important}table.flexible_shipping_method_rules td p select{margin:0;width:100% !important;box-shadow:none;line-height:28px;height:37px;vertical-align:middle}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}table.flexible_shipping_method_rules th.shipping_class,table.flexible_shipping_method_rules td.shipping_class{text-align:center;width:200px}table.flexible_shipping_method_rules td.shipping_class span{border:0}table.flexible_shipping_method_rules th.stop,table.flexible_shipping_method_rules td.stop{text-align:center;width:30px}table.flexible_shipping_method_rules th.cancel,table.flexible_shipping_method_rules td.cancel{text-align:center;width:60px}.woocommerce table.form-table .flexible_shipping_method_rules th span.woocommerce-help-tip{float:none;margin:0}.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}table.flexible_shipping_method_rules tfoot th{padding:10px}.woocommerce_page_wc-settings #mainform{position:relative}.flexible-shipping-pro-box{max-width:280px;min-width:180px;right:0;position:absolute;top:135px}@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:#a00 !important}.flexible_shipping_shipment_message_error span{color:#444;font-weight:bold}.woocommerce .wp-admin select{height:100%}.button.flexible-printing-button-print{height:auto !important;white-space:normal !important;word-wrap:break-word !important}.inspire-settings{display:table;width:100%}.inspire-settings .inspire-main-content,.inspire-settings .inspire-sidebar{display:table-cell;height:500px;margin:0;padding:0;vertical-align:top}.inspire-settings .inspire-main-content{min-width:800px}.inspire-settings .inspire-sidebar{padding-left:30px;width:250px}.flexible-shipping-info ol{margin-top:0}#wpbody-content .flexible-shipping-info .metabox-holder{padding-top:0}#adminmenu #toplevel_page_flexible-shipping .menu-icon-generic div.wp-menu-image::before{font-family:WooCommerce !important;content:'\e01d'}.fs-new-service{color:#006799}span.flexible_shipping_saas_connection_error{color:#a00;font-weight:bold}.fs-order-item-fallback{margin-top:.5em;color:#888}.flexible_shipping_shipment_content p select{max-width:95%}.flexible_shipping_shipment_content span.description{display:block}.fs-saas-button-cancel-created{float:right;color:#a00;margin-top:5px}.fs-saas-button-cancel-created:hover{color:#a00;cursor:pointer}.flexible_shipping_shipment_content input[type=checkbox]{float:left;margin-right:5px;margin-top:2px !important;opacity:1;border-color:#888}.flexible_shipping_shipment_content input[type=checkbox]:disabled{opacity:.7;border-color:rgba(51,51,51,0.5)}.flexible_shipping_shipment_content p.fs-saas-status span{font-weight:bold;color:#444}.flexible_shipping_shipment_content p.fs-saas-status-fs-new{color:#ffba00}.flexible_shipping_shipment_content p.fs-saas-status-fs-created{color:#d0c21f}.flexible_shipping_shipment_content p.fs-saas-status-fs-confirmed{color:#444}.flexible_shipping_shipment_content p.fs-saas-status-fs-failed{color:#a00}.flexible_shipping_shipment_content p.fs-saas-status-fs-manifest{color:#2ea2cc}.flexible_shipping_shipment_content p.connection-error{font-weight:bold;color:#a00}.fs-saas-shipment span{font-weight:bold}.fs-saas-labels-counts span{font-weight:bold}.fs-saas-no-labels-left{color:#a00}div.flexible-shipping-shipment-attachments p{display:inline}.flexible_shipping_shipment_attachment_message{padding-top:10px;color:green}table.flexible_shipping_services{max-width:550px}table.flexible_shipping_services .sort{width:1%}table.flexible_shipping_services .service_code{width:30px}table.flexible_shipping_services .select{text-align:center;width:1%}table.flexible_shipping_services .select input{margin:0 8px 0 8px}.woocommerce table.form-table table.flexible_shipping_services td.service_name input{width:100%}input.woocommerce_flexible_shipping_service_name{width:100%}.updated .fs-banner__button-container{padding:.75rem 0 0}.notice-info.fs-connect__container{border-left:0;padding:0;box-shadow:0 0 0 1px #dfdfdf,0 1px 2px #dfdfdf}@media screen and (max-width:782px){.notice-info.fs-connect__container{padding:0 !important}}.fs-connect__container{display:block;position:relative;box-sizing:border-box}.fs-connect__inner-container>a:first-child{z-index:1}.fs-connect__inner-container{display:-ms-flexbox;display:flex;-ms-flex-direction:row;flex-direction:row;-ms-flex-wrap:nowrap;flex-wrap:nowrap;-ms-flex-pack:left;justify-content:left}.fs-connect__content-container{width:1250px;position:relative;padding:2rem;z-index:0}@media(min-width:782px){.fs-connect__content-container{padding:2rem 2rem 4rem 2rem}}.fs-connect__content-container p{color:#555;font-size:.875rem}.fs-connect__content-container h2{margin-top:0;color:#555;line-height:1.6}.fs-connect__content-icon{float:right;margin:0 1.5rem 0 2.25rem}.fs-connect__content-icon svg{fill:#0085ba;height:180px;width:auto}@media(max-width:782px){.fs-connect__content-icon.fs-connect-illo{float:none;width:100%;text-align:center;margin:2.25rem 0 1.5rem}}.fs-connect__slide{display:none}.fs-connect__slide.fs__slide-is-active{display:block}@media(min-width:782px){.fs-connect__content-container .fs-banner__button-container{position:absolute;bottom:.5rem}}.fs-banner__button-container .button-primary{margin:0 .3125rem .3125rem 0}.fs-connect__vertical-nav{background-color:#f1f1f1}@media(min-width:600px){.fs-connect__vertical-nav{-ms-flex-direction:column;flex-direction:column;-ms-flex-pack:start;justify-content:flex-start}}@media(max-width:600px){.fs-connect__vertical-nav{display:none}}.fs-connect__vertical-nav-container{width:15rem}.vertical-menu__feature-item-label{display:none}@media(min-width:600px){.vertical-menu__feature-item{display:-ms-flexbox;display:flex;-ms-flex-direction:row;flex-direction:row;-ms-flex-align:center;align-items:center;border:0;padding:.5rem;border-bottom:1px solid #dfdfdf;border-right:1px solid #dfdfdf;border-left:3px solid #f9f9f9;background-color:#f9f9f9;color:#555;cursor:pointer}.vertical-menu__feature-item:last-of-type{position:relative;top:1px}.vertical-menu__feature-item-is-selected{border-left:3px solid #0085ba;border-right:1px solid #fff;background-color:#fff;color:#2e4453}.vertical-menu__feature-item-is-selected.fs-feature-intro{border-left:3px solid #00be28}.vertical-menu__feature-item-icon{width:1.25rem;height:1.25rem;padding:.25rem;text-align:center}.vertical-menu__feature-item svg{fill:#555;vertical-align:middle}.vertical-menu__feature-item-is-selected svg{fill:#0085ba}.vertical-menu__feature-item-label{display:block;padding:.5rem}}.fs-couriers{margin-top:2.5em}.fs-courier{position:relative;margin-bottom:2.5em;text-align:center}.fs-courier img{height:50px;width:auto}.fs-courier-label{background-color:#333;border-radius:3px;color:#fff;padding:0 4px 1px;position:absolute;right:0;top:-10px}@media(min-width:1200px){.fs-couriers{align-items:center;display:flex;flex-wrap:wrap;justify-content:flex-start}.fs-courier{width:20%}}.admin_page_flexible_shipping_connect_register .notice.is-dismissible,.admin_page_flexible_shipping_connect_register .update-nag,.admin_page_flexible_shipping_connect_register .updated,.admin_page_flexible_shipping_connect_register .settings-error{display:none !important}.fs-page-wrap{margin:0 auto;max-width:45rem}.fs-page-wrap h1{font-weight:normal;margin-bottom:.67em;text-align:center}.fs-box{display:block;position:relative;margin:0 auto 20px;padding:16px;box-sizing:border-box;background:white;box-shadow:0 0 0 1px #dfdfdf,0 1px 2px #dfdfdf}.fs-box:after{content:".";display:block;height:0;clear:both;visibility:hidden}.admin_page_flexible_shipping_connect_register .fs-box,.fs-box.text-center{text-align:center}.admin_page_flexible_shipping_connect_register .fs-box p{margin:1.5em 0}.fs-box input[type="email"]{padding:8px 10px}.fs-actions{padding-left:40px}.fs-actions button:active{vertical-align:inherit !important}.fs-actions .spinner{float:none;margin-top:0}.fs-cols{display:flex;flex-wrap:wrap;justify-content:space-between}.fs-inner-box{box-sizing:border-box;margin-top:30px;padding:0 20px}.fs-inner-box h4{font-size:1.2em;margin-bottom:.37em}.fs-inner-box svg{fill:#0085ba;height:70px;width:auto}@media(min-width:600px){.fs-inner-box{width:33.33%}}.fs-connect-box-header{margin-top:3em}.hide-fs-connect-integration-box{display:none}
1
+ table.flexible_shipping_methods th.select,table.flexible_shipping_methods td.select{text-align:center;width:40px;margin-top:-7px;margin-left:-6px;padding:2px}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_methods td.ui-sortable-handle:before,table.flexible_shipping_services td.ui-sortable-handle:before{content:'\f333';font-family:Dashicons;text-align:center;line-height:1;color:#999;display:block;width:17px;float:left;height:100%;line-height:24px}table.flexible_shipping_method_rules th,table.flexible_shipping_method_rules th{padding:5px 10px 5px 0}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%;box-shadow:none;padding:0 !important}table.flexible_shipping_method_rules td p input[type=text]{text-align:right;padding:0 5px 0 5px !important;width:100% !important}table.flexible_shipping_method_rules td p select{margin:0;width:100% !important;box-shadow:none;line-height:28px;height:37px;vertical-align:middle}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}table.flexible_shipping_method_rules th.shipping_class,table.flexible_shipping_method_rules td.shipping_class{text-align:center;width:200px}table.flexible_shipping_method_rules td.shipping_class span{border:0}table.flexible_shipping_method_rules th.stop,table.flexible_shipping_method_rules td.stop{text-align:center;width:30px}table.flexible_shipping_method_rules th.cancel,table.flexible_shipping_method_rules td.cancel{text-align:center;width:60px}.woocommerce table.form-table .flexible_shipping_method_rules th span.woocommerce-help-tip{float:none;margin:0}.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}table.flexible_shipping_method_rules tfoot th{padding:10px}.woocommerce_page_wc-settings #mainform{position:relative}.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:#a00 !important}.flexible_shipping_shipment_message_error span{color:#444;font-weight:bold}.woocommerce .wp-admin select{height:100%}.button.flexible-printing-button-print{height:auto !important;white-space:normal !important;word-wrap:break-word !important}.inspire-settings{display:table;width:100%}.inspire-settings .inspire-main-content,.inspire-settings .inspire-sidebar{display:table-cell;height:500px;margin:0;padding:0;vertical-align:top}.inspire-settings .inspire-main-content{min-width:800px}.inspire-settings .inspire-sidebar{padding-left:30px;width:250px}.flexible-shipping-info ol{margin-top:0}#wpbody-content .flexible-shipping-info .metabox-holder{padding-top:0}#adminmenu #toplevel_page_flexible-shipping .menu-icon-generic div.wp-menu-image::before{font-family:WooCommerce !important;content:'\e01d'}.fs-new-service{color:#006799}.fs-order-item-fallback{margin-top:.5em;color:#888}.flexible_shipping_shipment_content p select{max-width:95%}.flexible_shipping_shipment_content span.description{display:block}.fs-saas-button-cancel-created{float:right;color:#a00;margin-top:5px}.fs-saas-button-cancel-created:hover{color:#a00;cursor:pointer}.flexible_shipping_shipment_content input[type=checkbox]{float:left;margin-right:5px;margin-top:2px !important;opacity:1;border-color:#888}.flexible_shipping_shipment_content input[type=checkbox]:disabled{opacity:.7;border-color:rgba(51,51,51,0.5)}.flexible_shipping_shipment_content p.fs-saas-status span{font-weight:bold;color:#444}.flexible_shipping_shipment_content p.fs-saas-status-fs-new{color:#ffba00}.flexible_shipping_shipment_content p.fs-saas-status-fs-created{color:#d0c21f}.flexible_shipping_shipment_content p.fs-saas-status-fs-confirmed{color:#444}.flexible_shipping_shipment_content p.fs-saas-status-fs-failed{color:#a00}.flexible_shipping_shipment_content p.fs-saas-status-fs-manifest{color:#2ea2cc}.flexible_shipping_shipment_content p.connection-error{font-weight:bold;color:#a00}.fs-saas-shipment span{font-weight:bold}.fs-saas-labels-counts span{font-weight:bold}.fs-saas-no-labels-left{color:#a00}div.flexible-shipping-shipment-attachments p{display:inline}.flexible_shipping_shipment_attachment_message{padding-top:10px;color:green}table.flexible_shipping_services{max-width:550px}table.flexible_shipping_services .sort{width:1%}table.flexible_shipping_services .service_code{width:30px}table.flexible_shipping_services .select{text-align:center;width:1%}table.flexible_shipping_services .select input{margin:0 8px 0 8px}.woocommerce table.form-table table.flexible_shipping_services td.service_name input{width:100%}input.woocommerce_flexible_shipping_service_name{width:100%}.updated .fs-banner__button-container{padding:.75rem 0 0}.notice-info.fs-connect__container{border-left:0;padding:0;box-shadow:0 0 0 1px #dfdfdf,0 1px 2px #dfdfdf}@media screen and (max-width:782px){.notice-info.fs-connect__container{padding:0 !important}}.fs-connect__container{display:block;position:relative;box-sizing:border-box}.fs-connect__inner-container>a:first-child{z-index:1}.fs-connect__inner-container{display:-ms-flexbox;display:flex;-ms-flex-direction:row;flex-direction:row;-ms-flex-wrap:nowrap;flex-wrap:nowrap;-ms-flex-pack:left;justify-content:left}.fs-connect__content-container{width:1250px;position:relative;padding:2rem;z-index:0}@media(min-width:782px){.fs-connect__content-container{padding:2rem 2rem 4rem 2rem}}.fs-connect__content-container p{color:#555;font-size:.875rem}.fs-connect__content-container h2{margin-top:0;color:#555;line-height:1.6}.fs-connect__content-icon{float:right;margin:0 1.5rem 0 2.25rem}.fs-connect__content-icon svg{fill:#0085ba;height:180px;width:auto}@media(max-width:782px){.fs-connect__content-icon.fs-connect-illo{float:none;width:100%;text-align:center;margin:2.25rem 0 1.5rem}}.fs-connect__slide{display:none}.fs-connect__slide.fs__slide-is-active{display:block}@media(min-width:782px){.fs-connect__content-container .fs-banner__button-container{position:absolute;bottom:.5rem}}.fs-banner__button-container .button-primary{margin:0 .3125rem .3125rem 0}.fs-connect__vertical-nav{background-color:#f1f1f1}@media(min-width:600px){.fs-connect__vertical-nav{-ms-flex-direction:column;flex-direction:column;-ms-flex-pack:start;justify-content:flex-start}}@media(max-width:600px){.fs-connect__vertical-nav{display:none}}.fs-connect__vertical-nav-container{width:15rem}.vertical-menu__feature-item-label{display:none}@media(min-width:600px){.vertical-menu__feature-item{display:-ms-flexbox;display:flex;-ms-flex-direction:row;flex-direction:row;-ms-flex-align:center;align-items:center;border:0;padding:.5rem;border-bottom:1px solid #dfdfdf;border-right:1px solid #dfdfdf;border-left:3px solid #f9f9f9;background-color:#f9f9f9;color:#555;cursor:pointer}.vertical-menu__feature-item:last-of-type{position:relative;top:1px}.vertical-menu__feature-item-is-selected{border-left:3px solid #0085ba;border-right:1px solid #fff;background-color:#fff;color:#2e4453}.vertical-menu__feature-item-is-selected.fs-feature-intro{border-left:3px solid #00be28}.vertical-menu__feature-item-icon{width:1.25rem;height:1.25rem;padding:.25rem;text-align:center}.vertical-menu__feature-item svg{fill:#555;vertical-align:middle}.vertical-menu__feature-item-is-selected svg{fill:#0085ba}.vertical-menu__feature-item-label{display:block;padding:.5rem}}.fs-couriers{margin-top:2.5em}.fs-courier{position:relative;margin-bottom:2.5em;text-align:center}.fs-courier img{height:50px;width:auto}.fs-courier-label{background-color:#333;border-radius:3px;color:#fff;padding:0 4px 1px;position:absolute;right:0;top:-10px}@media(min-width:1200px){.fs-couriers{align-items:center;display:flex;flex-wrap:wrap;justify-content:flex-start}.fs-courier{width:20%}}.admin_page_flexible_shipping_connect_register .notice.is-dismissible,.admin_page_flexible_shipping_connect_register .update-nag,.admin_page_flexible_shipping_connect_register .updated,.admin_page_flexible_shipping_connect_register .settings-error{display:none !important}.fs-page-wrap{margin:0 auto;max-width:45rem}.fs-page-wrap h1{font-weight:normal;margin-bottom:.67em;text-align:center}.fs-box{display:block;position:relative;margin:0 auto 20px;padding:16px;box-sizing:border-box;background:white;box-shadow:0 0 0 1px #dfdfdf,0 1px 2px #dfdfdf}.fs-box:after{content:".";display:block;height:0;clear:both;visibility:hidden}.admin_page_flexible_shipping_connect_register .fs-box,.fs-box.text-center{text-align:center}.admin_page_flexible_shipping_connect_register .fs-box p{margin:1.5em 0}.fs-box input[type="email"]{padding:8px 10px}.fs-actions{padding-left:40px}.fs-actions button:active{vertical-align:inherit !important}.fs-actions .spinner{float:none;margin-top:0}.fs-cols{display:flex;flex-wrap:wrap;justify-content:space-between}.fs-inner-box{box-sizing:border-box;margin-top:30px;padding:0 20px}.fs-inner-box h4{font-size:1.2em;margin-bottom:.37em}.fs-inner-box svg{fill:#0085ba;height:70px;width:auto}@media(min-width:600px){.fs-inner-box{width:33.33%}}.fs-connect-box-header{margin-top:3em}.hide-fs-connect-integration-box{display:none}.fs-settings-div table.form-table{width:700px;float:left}.fs-flexible-shipping-sidebar{float:right;padding-left:30px;width:300px;margin-top:-100px}@media(max-width:1200px){.fs-flexible-shipping-sidebar{display:none}}.wpdesk-metabox{background-color:#23282d;color:#fff;padding:20px}.wpdesk-metabox .title{color:#fff}.wpdesk-metabox .icon{display:block;margin:0 auto;width:110px}
classes/class-flexible-shipping-plugin.php CHANGED
@@ -41,7 +41,7 @@ class Flexible_Shipping_Plugin extends AbstractPlugin implements HookableCollect
41
  *
42
  * @var string
43
  */
44
- private $scripts_version = FLEXIBLE_SHIPPING_VERSION . '.202';
45
 
46
  /**
47
  * Admin notices.
41
  *
42
  * @var string
43
  */
44
+ private $scripts_version = FLEXIBLE_SHIPPING_VERSION . '.205';
45
 
46
  /**
47
  * Admin notices.
classes/table-rate/settings/flexible-shipping.php CHANGED
@@ -33,7 +33,6 @@ $settings = array(
33
  'tax_status' => array(
34
  'title' => __( 'Tax Status', 'flexible-shipping' ),
35
  'type' => 'select',
36
- 'class' => 'wc-enhanced-select',
37
  'default' => 'taxable',
38
  'options' => array(
39
  'taxable' => __( 'Taxable', 'flexible-shipping' ),
33
  'tax_status' => array(
34
  'title' => __( 'Tax Status', 'flexible-shipping' ),
35
  'type' => 'select',
 
36
  'default' => 'taxable',
37
  'options' => array(
38
  'taxable' => __( 'Taxable', 'flexible-shipping' ),
classes/table-rate/shipping-method.php CHANGED
@@ -1,915 +1,933 @@
1
  <?php
2
 
3
- if ( ! defined( 'ABSPATH' ) ) exit; // Exit if accessed directly
4
 
5
- if ( ! class_exists( 'WPDesk_Flexible_Shipping' ) ) {
6
- class WPDesk_Flexible_Shipping extends WC_Shipping_Method {
7
 
8
- const FIELD_METHOD_FREE_SHIPPING = 'method_free_shipping';
9
 
10
- const META_DEFAULT = '_default';
11
 
12
- const WEIGHT_ROUNDING_PRECISION = 6;
13
 
14
- /**
15
- * Message added.
16
- *
17
- * @var bool
18
- */
19
- private $message_added = false;
20
-
21
-
22
- /**
23
- * Constructor for your shipment class
24
- *
25
- * @access public
26
- * @return void
27
- */
28
- public function __construct( $instance_id = 0 ) {
29
- $this->instance_id = absint( $instance_id );
30
- $this->id = 'flexible_shipping';
31
- $this->shipping_methods_option = 'flexible_shipping_methods_' . $this->instance_id;
32
- $this->shipping_method_order_option = 'flexible_shipping_method_order_' . $this->instance_id;
33
- $this->section_name = 'flexible_shipping';
34
- $this->method_title = __( 'Flexible Shipping', 'flexible-shipping' );
35
- $this->method_description = __( 'Flexible Shipping', 'flexible-shipping' );
36
-
37
- $this->supports = array(
38
- 'shipping-zones',
39
- 'instance-settings',
40
- );
41
-
42
- $this->instance_form_fields = array(
43
- 'enabled' => array(
44
- 'title' => __( 'Enable/Disable', 'flexible-shipping' ),
45
- 'type' => 'checkbox',
46
- 'label' => __( 'Enable this shipment method', 'flexible-shipping' ),
47
- 'default' => 'yes',
48
- ),
49
- 'title' => array(
50
- 'title' => __( 'Shipping Title', 'flexible-shipping' ),
51
- 'type' => 'text',
52
- 'description' => __( 'This controls the title which the user sees during checkout.', 'flexible-shipping' ),
53
- 'default' => __( 'Flexible Shipping', 'flexible-shipping' ),
54
- 'desc_tip' => true
55
- )
56
- );
57
-
58
- if ( version_compare( WC()->version, '2.6' ) < 0 && $this->get_option( 'enabled', 'yes' ) == 'no' ) {
59
- $this->enabled = $this->get_option( 'enabled' );
60
- }
61
 
62
- $this->title = $this->get_option( 'title' );
63
 
64
- $this->init();
 
 
 
 
 
 
 
 
 
 
 
 
 
65
 
 
 
 
 
66
 
67
- //$this->method_title = $this->get_option( 'title' );
68
-
69
- //add_action( 'woocommerce_sections_' . $this->id, array( $this, 'process_admin_options' ) );
70
- add_action( 'woocommerce_update_options_shipping_' . $this->id, array( $this, 'process_admin_options' ) );
 
 
 
 
 
 
 
 
 
 
 
71
 
 
 
72
  }
73
 
74
- /**
75
- * Init your settings
76
- *
77
- * @access public
78
- * @return void
79
- */
80
- function init() {
81
- $this->instance_form_fields = include( 'settings/flexible-shipping.php' );
82
- // Load the settings API
83
- $this->init_form_fields(); // This is part of the settings API. Override the method to add your own settings
84
- $this->init_settings(); // This is part of the settings API. Loads settings you previously init.
85
 
86
- // Define user set variables
87
- $this->title = $this->get_option( 'title' );
88
- $this->tax_status = $this->get_option( 'tax_status' );
89
 
90
- $this->availability = $this->get_option( 'availability' );
91
 
92
- $this->type = $this->get_option( 'type', 'class' );
93
- }
94
 
 
 
95
 
96
- /**
97
- * @param unknown $key
98
- * @return string
99
- *
100
- * Dodane w WooCommerce 2.4
101
- * Dodane w celu zachowania kompatybilności z WooCommerce 2.3
102
- * Przetestowane na WooCommerce 2.3.9
103
- */
104
- public function get_field_key( $key ) {
105
- return $this->plugin_id . $this->id . '_' . $key;
106
- }
107
 
108
- public function generate_title_shipping_methods_html( $key, $data ) {
109
- $field = $this->get_field_key( $key );
110
- $defaults = array(
111
- 'title' => '',
112
- 'class' => ''
113
- );
 
 
 
 
 
 
 
 
 
 
 
 
 
 
114
 
115
- $data = wp_parse_args( $data, $defaults );
 
 
 
 
 
 
116
 
117
- ob_start();
 
 
 
 
 
118
 
119
- ?>
120
- </table>
121
- <h3 class="wc-settings-sub-title <?php echo esc_attr( $data['class'] ); ?>" id="<?php echo esc_attr( $field ); ?>"><?php echo wp_kses_post( $data['title'] ); ?>
122
- <a href="<?php echo remove_query_arg( 'added', add_query_arg( 'action', 'new' ) ); ?>" class="add-new-h2"><?php echo __('Add New', 'flexible-shipping' ); ?></a></h3>
123
 
124
- <?php if ( ! empty( $data['description'] ) ) : ?>
125
- <p><?php echo wp_kses_post( $data['description'] ); ?></p>
126
- <?php endif; ?>
127
- <table class="form-table">
128
- <?php
129
 
130
- return ob_get_clean();
131
- }
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
132
 
133
- public function generate_shipping_methods_html( $key, $data ) {
134
- $shipping_methods = $this->get_shipping_methods();
135
- $shipping_method_order = $this->get_shipping_method_order();
136
- ob_start();
137
- include ( 'views/html-shipping-method-settings.php' );
138
- return ob_get_clean();
139
- }
 
 
 
 
 
140
 
141
- public function get_shipping_methods( $enabled = false ) {
142
- $shipping_methods = get_option( $this->shipping_methods_option, array() );
143
- $shipping_method_order = get_option( $this->shipping_method_order_option, array() );
144
- $ret = array();
145
- if ( is_array( $shipping_method_order ) ) {
146
- foreach ( $shipping_method_order as $method_id ) {
147
- if ( isset( $shipping_methods[$method_id] ) ) $ret[$method_id] = $shipping_methods[$method_id];
148
- }
149
- }
150
- foreach ( $shipping_methods as $shipping_method ) {
151
- if ( !isset( $ret[$shipping_method['id']] ) ) $ret[$shipping_method['id']] = $shipping_method;
152
- }
153
- if ( $enabled ) {
154
- foreach ( $ret as $key => $shipping_method ) {
155
- if ( isset( $shipping_method['method_enabled'] ) && 'yes' != $shipping_method['method_enabled'] ) unset($ret[$key]);
156
- }
157
- }
158
- return $ret;
159
- }
160
 
161
- public function get_shipping_method_order() {
162
- $shipping_methods = get_option( $this->shipping_methods_option, array() );
163
- $shipping_method_order = get_option( $this->shipping_method_order_option, array() );
164
- $ret = array();
165
- if ( is_array( $shipping_method_order ) ) {
166
- foreach ( $shipping_method_order as $method_id ) {
167
- if ( isset( $shipping_methods[$method_id] ) ) $ret[$method_id] = $method_id;
168
- }
169
  }
170
- foreach ( $shipping_methods as $shipping_method ) {
171
- if ( !isset( $ret[$shipping_method['id']] ) ) $ret[$shipping_method['id']] = $shipping_method['id'];
 
 
 
 
 
172
  }
173
- return $ret;
174
  }
 
 
175
 
176
- public function generate_shipping_rules_html( $key, $data ) {
177
- if ( ! function_exists( 'woocommerce_form_field' ) ) {
178
- $wc_template_functions = trailingslashit( dirname( __FILE__) ) . '../../woocommerce/includes/wc-template-functions.php';
179
- if ( file_exists( $wc_template_functions ) ) {
180
- include_once( $wc_template_functions );
181
- }
 
182
  }
183
- ob_start();
184
- include ( 'views/html-shipping-method-rules.php' );
185
- return ob_get_clean();
186
  }
187
-
188
-
189
- /**
190
- * Initialise Settings Form Fields
191
- */
192
- public function init_form_fields() {
193
- $this->form_fields = include( 'settings/flexible-shipping.php' );
194
  }
 
 
195
 
196
- public function update_rates( $shipping_methods ) {
197
- $rates = array();
198
- foreach ( $shipping_methods as $shipping_method ) {
199
- $id = $this->id . '_' . $this->instance_id . '_' . sanitize_title($shipping_method['method_title'] );
200
- $id = apply_filters( 'flexible_shipping_method_rate_id', $id, $shipping_method );
201
- if ( ! isset( $rates[$id] ) && $shipping_method['method_enabled'] == 'yes' )
202
- $rates[$id] = array(
203
- 'identifier' => $id,
204
- 'title' => $shipping_method['method_title']
205
- );
206
  }
207
- update_option( 'flexible_shipping_rates', $rates );
208
- }
209
-
210
- public function shipping_method_title_used( $title, $shipping_methods ) {
211
- foreach ( $shipping_methods as $shipping_method ) {
212
- if ( $title == $shipping_method['method_title'] ) {
213
- return true;
214
- }
215
- }
216
- return false;
217
  }
 
 
 
 
218
 
219
- public function shipping_method_next_id( $shipping_methods ) {
220
- $next_id = 0;
221
- foreach ( $shipping_methods as $shipping_method ) {
222
- if ( intval($shipping_method['id'] ) > $next_id ) {
223
- $next_id = intval($shipping_method['id'] );
224
- }
225
- }
226
- $next_id++;
227
- return $next_id;
228
  }
 
 
229
 
230
- /**
231
- * Add method creation date.
232
- */
233
- private function add_method_creation_date() {
234
- if ( ! get_option( 'flexible_shipping_method_creation_date' ) ) {
235
- add_option( 'flexible_shipping_method_creation_date', current_time('mysql') );
236
  }
237
  }
 
 
 
238
 
239
- public function process_admin_options() {
240
- $action = false;
241
- if ( isset( $_POST['method_action'] ) ) {
242
- $action = sanitize_key( $_POST['method_action'] );
243
- }
244
- if ( $action == 'new' || $action == 'edit' ) {
245
- $this->add_method_creation_date();
 
 
 
246
  $shipping_methods = get_option( $this->shipping_methods_option, array() );
247
- $shipping_method = array();
248
- if ( $action == 'new' ) {
249
- $shipping_methods = get_option( $this->shipping_methods_option, array() );
250
- $shipping_method_order = get_option( $this->shipping_method_order_option, array() );
251
- //
252
- $method_id = get_option( 'flexible_shipping_method_id', 0 );
253
- //$method_id = 0;
254
- foreach ( $shipping_methods as $shipping_method ) {
255
- if ( intval( $shipping_method['id'] ) > $method_id ) $method_id = intval( $shipping_method['id'] );
256
- }
257
- $method_id++;
258
- update_option( 'flexible_shipping_method_id', $method_id );
259
- //
260
- $method_id_for_shipping = $this->id . '_' . $this->instance_id . '_' . $method_id;
261
- }
262
- else {
263
- $method_id = sanitize_text_field( wp_unslash( $_POST['method_id'] ) );
264
- $method_id_for_shipping = sanitize_text_field( wp_unslash( $_POST['method_id_for_shipping'] ) );
265
- if ( isset( $shipping_methods[ $method_id ] ) ) {
266
- $shipping_method = $shipping_methods[ $method_id ];
267
- }
268
- }
269
- $shipping_method['woocommerce_method_instance_id'] = $this->instance_id;
270
- $shipping_method['id'] = $method_id;
271
- $shipping_method['id_for_shipping'] = $method_id_for_shipping;
272
- $shipping_method['method_title'] = sanitize_text_field( wp_unslash( $_POST['woocommerce_' . $this->id . '_method_title'] ) );
273
- $shipping_method['method_description'] = sanitize_text_field( wp_unslash( $_POST['woocommerce_' . $this->id . '_method_description'] ) );
274
- $shipping_method[self::FIELD_METHOD_FREE_SHIPPING] = '';
275
-
276
- if ( isset( $_POST['woocommerce_' . $this->id . '_method_free_shipping'] ) && $_POST['woocommerce_' . $this->id . '_method_free_shipping'] != '' ) {
277
- $shipping_method[self::FIELD_METHOD_FREE_SHIPPING] = wc_format_decimal( sanitize_text_field( wp_unslash( $_POST['woocommerce_' . $this->id . '_method_free_shipping'] ) ) );
278
- }
279
- if ( version_compare( WC()->version, '2.6' ) >= 0 ) {
280
- $shipping_method['method_free_shipping_label'] = sanitize_text_field( wp_unslash( $_POST['woocommerce_' . $this->id . '_method_free_shipping_label'] ) );
281
- }
282
- $shipping_method['method_calculation_method'] = sanitize_text_field( wp_unslash( $_POST['woocommerce_' . $this->id . '_method_calculation_method'] ) );
283
- $shipping_method['method_visibility'] = 'no';
284
- if ( isset( $_POST['woocommerce_' . $this->id . '_method_visibility'] ) && $_POST['woocommerce_' . $this->id . '_method_visibility'] == 1 )
285
- $shipping_method['method_visibility'] = 'yes';
286
- //
287
- $shipping_method['method_default'] = 'no';
288
- if ( isset( $_POST['woocommerce_' . $this->id . '_method_default'] ) && $_POST['woocommerce_' . $this->id . '_method_default'] == 1 )
289
- $shipping_method['method_default'] = 'yes';
290
- //
291
- $shipping_method['method_enabled'] = 'no';
292
- if ( isset( $_POST['woocommerce_' . $this->id . '_method_enabled'] ) && $_POST['woocommerce_' . $this->id . '_method_enabled'] == 1 )
293
- $shipping_method['method_enabled'] = 'yes';
294
  //
295
- $shipping_method['method_integration'] = sanitize_text_field( wp_unslash( $_POST['woocommerce_' . $this->id . '_method_integration'] ) );
296
- //
297
- $shipping_method = apply_filters( 'flexible_shipping_process_admin_options', $shipping_method );
298
- //
299
- $count = 0;
300
- $shipping_method['method_rules'] = array();
301
- if ( isset( $_POST['method_rules'] ) ) {
302
- foreach ( $_POST['method_rules'] as $rule ) {
303
- $count++;
304
- $method_rule = array();
305
- $method_rule['based_on'] = sanitize_text_field( wp_unslash( $rule['based_on'] ) );
306
- $method_rule['min'] = wc_format_decimal( sanitize_text_field( wp_unslash( $rule['min'] ) ) );
307
- $method_rule['max'] = wc_format_decimal( sanitize_text_field( wp_unslash( $rule['max'] ) ) );
308
- $method_rule['cost_per_order'] = wc_format_decimal( sanitize_text_field( wp_unslash( $rule['cost_per_order'] ) ) );
309
- $method_rule = apply_filters( 'flexible_shipping_method_rule_save', $method_rule, $rule );
310
- $shipping_method['method_rules'][$count] = $method_rule;
311
- }
312
  }
 
 
313
  //
314
- $shipping_methods[$method_id] = $shipping_method;
315
- //
316
- update_option( $this->shipping_methods_option, $shipping_methods );
317
- //
318
- $this->update_rates($shipping_methods);
319
- //
320
- if ( $action == 'new' ) {
321
- $shipping_method_order[$method_id] = $method_id;
322
- update_option( $this->shipping_method_order_option, $shipping_method_order );
323
  }
324
- if ( $action == 'new' ) {
325
- $redirect = add_query_arg( array('added' => $method_id, 'action' => false, 'method_id' => false ));
326
- $redirect .= '#method_' . $method_id;
327
- $redirect = add_query_arg( array('added' => $method_id, 'action' => 'edit', 'method_id' => $method_id ));
328
- wpdesk_redirect( $redirect );
329
- exit;
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
330
  }
331
- if ( $action == 'edit' ) {
332
- $redirect = add_query_arg( array('updated' => $method_id, 'action' => false, 'method_id' => false ));
333
- $redirect .= '#method_' . $method_id;
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
334
  }
 
335
  }
336
  else {
337
- if ( isset( $_POST['import_action'] ) && $_POST['import_action'] == '1' ) {
338
- $tmp_name = $_FILES['import_file']['tmp_name'];
339
- $shipping_methods = get_option( $this->shipping_methods_option, array() );
340
- try {
341
- $importer = new WPDesk_Flexible_Shipping_Csv_Importer( $this );
342
- $shipping_methods = $importer->import( $tmp_name, $shipping_methods );
343
- update_option( $this->shipping_methods_option, $shipping_methods );
344
- } catch ( Exception $e ) {
345
- WC_Admin_Settings::add_message( $e->getMessage() );
346
- }
347
- WC_Admin_Settings::show_messages();
348
- }
349
- else {
350
- parent::process_admin_options();
351
- if ( isset( $_POST['method_order'] ) ) {
352
- $method_order = $_POST['method_order'];
353
- $method_order_security_alert = false;
354
- foreach ( $method_order as $method_order_key => $method_id ) {
355
- if ( strval( $method_order_key ) !== strval( sanitize_key( $method_order_key ) ) || strval( $method_id ) !== strval( sanitize_key( $method_id ) ) ) {
356
- $method_order_security_alert = true;
357
- }
358
- }
359
- if ( $method_order_security_alert ) {
360
- WC_Admin_Settings::add_error( __( 'Flexible Shipping: security check error. Shipping method order not saved!', 'flexible-shipping' ) );
361
- WC_Admin_Settings::show_messages();
362
- } else {
363
- update_option( $this->shipping_method_order_option, $method_order );
364
- }
365
- }
366
  }
367
  }
368
  }
 
369
 
370
- public function get_shipping_method_form( $shipping_method ) {
371
- $this->form_fields = include( 'settings/shipping-method-form.php' );
 
 
 
 
372
  }
 
373
 
 
 
 
 
 
 
 
 
 
 
 
 
 
374
 
375
- public function admin_options() {
376
- ?>
377
- <table class="form-table">
378
- <?php
379
- $action = false;
380
- if ( isset( $_GET['action'] ) )
381
- {
382
- $action = sanitize_key( $_GET['action'] );
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
383
  }
384
- if ( $action == 'new' || $action == 'edit' ) {
 
 
 
 
 
 
 
 
 
 
 
 
385
  $shipping_methods = get_option( $this->shipping_methods_option, array() );
386
- $shipping_method = array(
387
- 'method_title' => '',
388
- 'method_description' => '',
389
- 'method_enabled' => 'no',
390
- 'method_shipping_zone' => '',
391
- 'method_calculation_method' => 'sum',
392
- self::FIELD_METHOD_FREE_SHIPPING => '',
393
- 'method_free_shipping_label'=> '',
394
- 'method_visibility' => 'no',
395
- 'method_default' => 'no',
396
- 'method_integration' => '',
397
- );
398
- $method_id = '';
399
- if ( $action == 'edit' ) {
400
- $method_id = sanitize_key( $_GET['method_id'] );
 
 
 
 
 
 
 
401
  $shipping_method = $shipping_methods[$method_id];
402
- $method_id_for_shipping = $this->id . '_' . $this->instance_id . '_' . sanitize_title( $shipping_method['method_title'] );
403
- $method_id_for_shipping = apply_filters( 'flexible_shipping_method_rate_id', $method_id_for_shipping, $shipping_method );
 
 
 
 
 
404
  }
405
  else {
406
- $method_id_for_shipping = '';
407
  }
408
- ?>
409
- <input type="hidden" name="method_action" value="<?php echo $action; ?>" />
410
- <input type="hidden" name="method_id" value="<?php echo $method_id; ?>" />
411
- <input type="hidden" name="method_id_for_shipping" value="<?php echo $method_id_for_shipping; ?>" />
412
- <?php if ( $action == 'new' ) : ?>
413
- <h2><?php _e('New Shipping Method', 'flexible-shipping' ); ?></h2>
414
- <?php endif; ?>
415
- <?php if ( $action == 'edit' ) : ?>
416
- <h2><?php _e('Edit Shipping Method', 'flexible-shipping' ); ?></h2>
417
- <?php endif; ?>
418
- <?php
419
- if ( isset( $_GET['added'] ) ) {
420
- $method_id = sanitize_key( $_GET['added'] );
421
- $shipping_methods = get_option( $this->shipping_methods_option, array() );
422
- if ( isset( $shipping_methods[$method_id] ) )
423
- {
424
- if ( ! $this->message_added ) {
425
- $shipping_method = $shipping_methods[$method_id];
426
- WC_Admin_Settings::add_message( sprintf(__( 'Shipping method %s added.', 'flexible-shipping' ), $shipping_method['method_title'] ) );
427
- $this->message_added = true;
428
- }
429
  }
430
- WC_Admin_Settings::show_messages();
431
  }
432
- $shipping_method['woocommerce_method_instance_id'] = $this->instance_id;
433
- $this->generate_settings_html( $this->get_shipping_method_form($shipping_method) );
434
  }
435
- else if ( $action == 'delete' ) {
436
- $methods_id = '';
437
- if ( isset( $_GET['methods_id'] ) ) {
438
- $methods_id = explode( ',' , sanitize_text_field( $_GET['methods_id'] ) );
439
- }
440
  $shipping_methods = get_option( $this->shipping_methods_option, array() );
441
- $shipping_method_order = get_option( $this->shipping_method_order_option, array() );
442
- foreach ( $methods_id as $method_id ) {
443
- if ( isset( $shipping_methods[$method_id] ) ) {
444
- $shipping_method = $shipping_methods[$method_id];
445
- unset( $shipping_methods[$method_id] );
446
- if ( isset( $shipping_method_order[$method_id] ) ) {
447
- unset( $shipping_method_order[$method_id] );
448
- }
449
- update_option( $this->shipping_methods_option, $shipping_methods );
450
- update_option( $this->shipping_method_order_option, $shipping_method_order );
451
- WC_Admin_Settings::add_message( sprintf(__('Shipping method %s deleted.', 'flexible-shipping' ), $shipping_method['method_title'] ) );
452
- }
453
- else {
454
- WC_Admin_Settings::add_error( __( 'Shipping method not found.', 'flexible-shipping' ) );
455
- }
456
- }
457
  WC_Admin_Settings::show_messages();
458
- $this->generate_settings_html();
459
  }
460
- else {
461
- if ( isset( $_GET['added'] ) ) {
462
- $method_id = sanitize_key( $_GET['added'] );
463
- $shipping_methods = get_option( $this->shipping_methods_option, array() );
464
- if ( isset( $shipping_methods[$method_id] ) )
465
- {
466
- if ( ! $this->message_added ) {
467
- $shipping_method = $shipping_methods[$method_id];
468
- WC_Admin_Settings::add_message( sprintf(__( 'Shipping method %s added.', 'flexible-shipping' ), $shipping_method['method_title'] ) );
469
- $this->message_added = true;
470
- }
471
- }
472
- WC_Admin_Settings::show_messages();
473
- }
474
- if ( isset( $_GET['updated'] ) ) {
475
- $method_id = sanitize_key( $_GET['updated'] );
476
- $shipping_methods = get_option( $this->shipping_methods_option, array() );
477
- if ( isset( $shipping_methods[$method_id] ) )
478
- {
479
- $shipping_method = $shipping_methods[$method_id];
480
- WC_Admin_Settings::add_message( sprintf(__( 'Shipping method %s updated.', 'flexible-shipping' ), $shipping_method['method_title'] ) );
481
- }
482
- WC_Admin_Settings::show_messages();
483
- }
484
 
485
- // General Settings
486
- $this->generate_settings_html();
487
- }
488
- ?>
489
- </table>
490
- <script type="text/javascript">
491
- if ( typeof window.history.pushState == 'function' ) {
492
- var url = document.location.href;
493
- url = fs_removeParam('action', url);
494
- url = fs_removeParam('methods_id', url);
495
- url = fs_removeParam('added', url);
496
- url = fs_trimChar(url,'?');
497
- window.history.pushState({}, "", url);
498
- }
499
- </script>
500
- <?php do_action( 'flexible_shipping_method_script' ); ?>
501
- <?php
502
- }
503
-
504
- private function package_subtotal( $items ) {
505
- $subtotal = 0;
506
- foreach( $items as $item )
507
- $subtotal += $item['line_subtotal'];
508
- return $subtotal;
509
- }
510
-
511
- public function package_weight( $items ) {
512
- $weight = 0;
513
- foreach( $items as $item ) {
514
- $weight += $item['data']->weight * $item['quantity'];
515
  }
516
- return $weight;
517
- }
518
-
519
- /**
520
- * Get cart weight.
521
- * It rounds return value to declared precision.
522
- *
523
- * @return float
524
- */
525
- public function cart_weight() {
526
- if ( version_compare( WC_VERSION, '2.7', '<' ) ) {
527
- add_filter( 'woocommerce_product_weight', array( $this, 'woocommerce_product_weight' ) );
528
- }
529
- $cart_weight = WC()->cart->get_cart_contents_weight();
530
- if ( version_compare( WC_VERSION, '2.7', '<' ) ) {
531
- remove_filter( 'woocommerce_product_weight', array( $this, 'woocommerce_product_weight' ) );
532
- }
533
- return round( $cart_weight, apply_filters( 'flexible_shipping_weight_rounding_precision', self::WEIGHT_ROUNDING_PRECISION ) );
534
- }
535
-
536
- /* Fix for Woocommerce 2.6 weight calculation */
537
- /* PHP Warning: A non-numeric value encountered in /wp-content/plugins/woocommerce/includes/class-wc-cart.php on line 359 */
538
- public function woocommerce_product_weight( $weight ) {
539
- if ( $weight === '' ) {
540
- return 0;
541
  }
542
- return $weight;
543
- }
 
 
544
 
545
- public function package_item_count( $items ) {
546
- $item_count = 0;
 
547
 
548
- foreach( $items as $item ) {
549
- $item_count += $item['quantity'];
550
- }
551
- return $item_count;
552
  }
 
 
553
 
554
- public function cart_item_count() {
555
- $item_count = 0;
556
-
557
- $cart = WC()->cart;
558
- foreach( $cart->cart_contents as $item ) {
559
- $item_count += $item['quantity'];
560
- }
561
-
562
- return $item_count;
563
  }
 
 
564
 
565
- function calculate_method_cost( $shipping_method, $rule_costs ) {
566
- $cost = 0;
567
- if ( $shipping_method['method_calculation_method'] == 'sum' ) {
568
- $cost = 0;
569
- foreach ( $rule_costs as $rule_cost ) {
570
- $cost += $rule_cost['cost'];
571
- }
572
- }
573
- return $cost;
574
  }
 
 
575
 
576
- public function cart_display_prices_including_tax() {
577
- if ( version_compare( WC_VERSION, '3.3', '<' ) ) {
578
- $display_prices_including_tax = 'incl' === WC()->cart->tax_display_cart;
579
- }
580
- else {
581
- $display_prices_including_tax = WC()->cart->display_prices_including_tax();
582
- }
583
- return $display_prices_including_tax;
584
- }
585
 
586
- /**
587
- * @return int
588
- */
589
- public function contents_cost_with_tax() {
590
- $display_prices_including_tax = $this->cart_display_prices_including_tax();
591
- if ( $display_prices_including_tax ) {
592
- $total = WC()->cart->get_displayed_subtotal();
593
- }
594
- else {
595
- if ( version_compare( WC_VERSION, '3.2', '<' ) ) {
596
- $total = WC()->cart->subtotal;
597
- }
598
- else {
599
- $total = WC()->cart->get_displayed_subtotal() + WC()->cart->get_subtotal_tax();
600
- }
601
- }
602
- if ( version_compare( WC_VERSION, '3.2', '<' ) ) {
603
- $total_discount = WC()->cart->discount_cart + WC()->cart->discount_cart_tax;
604
- }
605
- else {
606
- $total_discount = WC()->cart->get_cart_discount_total() + WC()->cart->get_cart_discount_tax_total();
607
- }
608
- $total = round( $total - $total_discount, wc_get_price_decimals() );
609
- return $total;
610
  }
611
 
612
- /**
613
- * @return int
614
- */
615
- public function contents_cost_without_tax() {
616
- $display_prices_including_tax = $this->cart_display_prices_including_tax();
617
- $total = WC()->cart->get_displayed_subtotal();
618
- if ( $display_prices_including_tax ) {
619
- if ( version_compare( WC_VERSION, '3.2', '<' ) ) {
620
- $total = WC()->cart->subtotal_ex_tax;
621
- }
622
- else {
623
- $total = $total - WC()->cart->get_subtotal_tax();
624
- }
625
- }
626
- if ( version_compare( WC_VERSION, '3.2', '<' ) ) {
627
- $discount_without_tax = WC()->cart->discount_cart;
628
- }
629
- else {
630
- $discount_without_tax = WC()->cart->get_cart_discount_total();
631
- }
632
- $total = round( $total - $discount_without_tax, wc_get_price_decimals() );
633
- return $total;
634
- }
635
-
636
- public function prices_include_tax() {
637
- if ( version_compare( WC_VERSION, '3.3', '<' ) ) {
638
- $prices_include_tax = 'incl' === WC()->cart->tax_display_cart;
639
- }
640
- else {
641
- $prices_include_tax = WC()->cart->display_prices_including_tax();
642
- }
643
- return apply_filters( 'flexible_shipping_prices_include_tax', $prices_include_tax );
644
- }
645
 
646
- /**
647
- * Is free shipping?
648
- *
649
- * @param array $shipping_method_settings Flexible shipping method settings.
650
- * @param float $cart_contents_cost Cart contents cost.
651
- *
652
- * @return bool
653
- */
654
- public function is_free_shipping( array $shipping_method_settings, $cart_contents_cost ) {
655
- $is_free_shipping = false;
656
- if ( isset( $shipping_method_settings[ self::FIELD_METHOD_FREE_SHIPPING ] ) && '' !== $shipping_method_settings[ self::FIELD_METHOD_FREE_SHIPPING ] ) {
657
- $shipping_method_settings[self::FIELD_METHOD_FREE_SHIPPING] = trim( $shipping_method_settings[self::FIELD_METHOD_FREE_SHIPPING] );
658
- if ( '0' !== $shipping_method_settings[self::FIELD_METHOD_FREE_SHIPPING] && is_numeric( $shipping_method_settings[self::FIELD_METHOD_FREE_SHIPPING] ) ) {
659
- if ( apply_filters( 'flexible_shipping_value_in_currency', floatval( $shipping_method_settings[self::FIELD_METHOD_FREE_SHIPPING] ) ) <= floatval( $cart_contents_cost ) ) {
660
- $is_free_shipping = true;
661
- }
662
- }
663
- }
664
- /**
665
- * Can modify free shipping.
666
- *
667
- * @param bool $is_free_shipping Current is_free_shipping value based on method settings.
668
- * @param array $shipping_method_settings Flexible shipping method settings.
669
- * @param float $cart_contents_cost Cart contents cost.
670
- *
671
- * @return bool
672
- */
673
- return apply_filters( 'flexible_shipping_is_free_shipping', $is_free_shipping, $shipping_method_settings, $cart_contents_cost );
674
- }
675
 
676
- /**
677
- * Calculate contents cost.
678
- *
679
- * @return float
680
- */
681
- public function contents_cost() {
682
- if ( $this->prices_include_tax() ) {
683
- return $this->contents_cost_with_tax();
684
- } else {
685
- return $this->contents_cost_without_tax();
686
- }
687
- }
688
 
689
- /**
690
- * @param array $package
691
- */
692
- public function calculate_shipping( $package = array() ) {
693
 
694
- $cart_contents_cost = 0;
695
 
696
- $processed = apply_filters( 'flexible_shipping_calculate_shipping', false, $this, $package, 0 );
697
 
698
- if ( $processed === false ) {
699
 
700
- $shipping_methods = $this->get_shipping_methods( true );
701
 
702
- foreach ( $shipping_methods as $shipping_method ) {
703
 
704
- $rule_costs = array();
 
 
 
705
 
706
- $add_method = false;
 
707
 
708
- if ( isset( $shipping_method['method_visibility'] ) && $shipping_method['method_visibility'] == 'yes' && !is_user_logged_in() ) {
709
- /* only for logged in */
710
- continue;
711
  }
712
 
713
- foreach ( $shipping_method['method_rules'] as $rule_key => $method_rule ) {
714
- $rule_triggered = false;
715
 
716
- if ( $method_rule['based_on'] == 'none' ) {
717
- $rule_triggered = true;
 
718
  }
719
-
720
- $contents_cost = $this->contents_cost();
721
- $cart_contents_cost = $contents_cost;
722
-
723
- if ( $method_rule['based_on'] == 'value' ) {
724
- if ( trim( $method_rule['min'] ) == '' ) {
725
- $min = 0;
726
- }
727
- else {
728
- $min = floatval( apply_filters( 'flexible_shipping_value_in_currency', floatval( $method_rule['min'] ) ) );
729
- }
730
- if ( trim( $method_rule['max'] ) == '' ) {
731
- $max = INF;
732
- }
733
- else {
734
- $max = floatval( apply_filters( 'flexible_shipping_value_in_currency', floatval( $method_rule['max'] ) ) );
735
- }
736
- if ( $contents_cost >= $min && $contents_cost <= $max ) {
737
- $rule_triggered = true;
738
- }
739
  }
740
-
741
- if ( $method_rule['based_on'] == 'weight' ) {
742
- if ( trim( $method_rule['min'] ) == '' ) {
743
- $min = 0;
744
- }
745
- else {
746
- $min = floatval( $method_rule['min'] );
747
- }
748
- if ( trim( $method_rule['max'] ) == '' ) {
749
- $max = INF;
750
- }
751
- else {
752
- $max = floatval( $method_rule['max'] );
753
- }
754
- $contents_weight = floatval( $this->cart_weight() );
755
- if ( $contents_weight >= $min && $contents_weight <= $max ) {
756
- $rule_triggered = true;
757
- }
758
  }
759
- if ( $rule_triggered ) {
760
- $rule_triggered = apply_filters( 'flexible_shipping_rule_triggered', $rule_triggered, $method_rule, $package );
761
  }
762
- if ( $rule_triggered ) {
763
- $rule_cost = array( 'cost' => floatval( $method_rule['cost_per_order'] ) );
764
- $rule_costs[$rule_key] = $rule_cost;
765
- $add_method = true;
766
  }
767
-
768
  }
769
- $cost = $this->calculate_method_cost( $shipping_method, $rule_costs );
770
- $add_method = apply_filters( 'flexible_shipping_add_method' , $add_method, $shipping_method, $package, $this );
771
- if ( $add_method === true ) {
772
 
773
- if ( $this->is_free_shipping( $shipping_method, $cart_contents_cost ) ) {
774
- $cost = 0;
 
775
  }
776
-
777
- $method_title = wpdesk__( $shipping_method['method_title'], 'flexible-shipping' );
778
- if ( version_compare( WC()->version, '2.6' ) >= 0 ) {
779
- if ( $cost == 0 ) {
780
- if ( ! isset( $shipping_method['method_free_shipping_label'] ) ) {
781
- $shipping_method['method_free_shipping_label'] = __( 'Free', 'flexible-shipping' );
782
- }
783
- if ( $shipping_method['method_free_shipping_label'] != '' ) {
784
- $method_title .= ' (' . wpdesk__( $shipping_method['method_free_shipping_label'], 'flexible-shipping' ) . ')';
785
- }
786
- }
787
  }
788
-
789
- $id = $this->id . '_' . $this->instance_id . '_' . sanitize_title( $shipping_method['method_title'] );
790
- $id = apply_filters( 'flexible_shipping_method_rate_id', $id, $shipping_method );
791
- $this->add_rate( array(
792
- 'id' => $id,
793
- 'label' => $method_title,
794
- 'cost' => $cost,
795
- 'method' => $shipping_method,
796
- 'rule_costs' => $rule_costs,
797
- 'meta_data' => array(
798
- self::META_DEFAULT => $shipping_method['method_default'],
799
- '_fs_method' => $shipping_method
800
- )
801
- ) );
802
- if ( isset( $shipping_method['method_description'] ) ) {
803
- WC()->session->set('flexible_shipping_description_' . $id, wpdesk__( $shipping_method['method_description'], 'flexible-shipping' ) );
804
  }
805
  else {
806
- WC()->session->set( 'flexible_shipping_description_' . $id, '' );
807
  }
 
 
 
 
 
 
 
 
 
 
 
 
808
  }
 
809
  }
810
- }
811
- }
 
 
 
 
 
812
 
813
- public function is_available( $package ) {
814
- return parent::is_available( $package );
815
- }
816
-
817
- public function get_all_rates() {
818
- if ( class_exists( 'WC_Shipping_Zones' ) ) {
819
- $zones = WC_Shipping_Zones::get_zones();
820
- $zone0 = WC_Shipping_Zones::get_zone(0);
821
- $zones[0] = $zone0->get_data();
822
- $zones[0]['formatted_zone_location'] = $zone0->get_formatted_location();
823
- $zones[0]['shipping_methods'] = $zone0->get_shipping_methods();
824
- $rates = array();
825
- foreach ( $zones as $zone ) {
826
- foreach ( $zone['shipping_methods'] as $instance_id => $woo_shipping_method ) {
827
- if ( $woo_shipping_method->id == $this->id ) {
828
- $shipping_methods = $woo_shipping_method->get_shipping_methods();
829
- foreach ( $shipping_methods as $shipping_method ) {
830
- $id = $this->id . '_' . $woo_shipping_method->instance_id . '_' . sanitize_title($shipping_method['method_title'] );
831
- $id = apply_filters( 'flexible_shipping_method_rate_id', $id, $shipping_method );
832
- $shipping_method['instance_id'] = $woo_shipping_method->instance_id;
833
- $rates[$id] = $shipping_method;
834
  }
835
  }
836
  }
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
837
  }
838
  }
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
839
  else {
840
- $shipping_methods = $this->get_shipping_methods();
841
- $rates = array();
842
- foreach ( $shipping_methods as $shipping_method ) {
843
- $id = $this->id . '_' . $this->instance_id . '_' . sanitize_title($shipping_method['method_title'] );
844
- $id = apply_filters( 'flexible_shipping_method_rate_id', $id, $shipping_method );
845
- $rates[$id] = $shipping_method;
846
- }
847
  }
848
- return $rates;
849
  }
 
 
 
 
 
 
 
 
 
850
 
851
- public function get_method_from_rate( $rate_id ) {
852
- $rates = $this->get_all_rates();
853
- return $rates[$rate_id];
 
 
 
854
  }
 
 
855
 
856
- public function generate_header_html( $key, $data ) {
857
- $field_key = $this->get_field_key( $key );
858
- $defaults = array(
859
- 'title' => '',
860
- 'class' => '',
861
- );
862
- $data = wp_parse_args( $data, $defaults );
863
- return sprintf( '<tr><td colspan="2"><h4 class="%1$s" id="%2$s">%3$s</h4></td></tr>', esc_attr( $data['class'] ), esc_attr( $field_key ), esc_html( $data['title'] ) );
 
 
 
 
 
 
 
 
 
 
 
864
  }
 
 
 
865
 
866
- /**
867
- * Generate SaaS connection error field HTML.
868
- *
869
- * @param string $key
870
- * @param array $data
871
- *
872
- * @return string
873
- */
874
- public function generate_saas_connection_error_html( $key, $data ) {
875
- $field_key = $this->get_field_key( $key );
876
- $defaults = array(
877
- 'title' => '',
878
- 'class' => '',
879
- );
880
- $data = wp_parse_args( $data, $defaults );
881
- return sprintf( '<tr><td></td><td><span class="%1$s" id="%2$s">%3$s</span></td></tr>', esc_attr( $data['class'] ), esc_attr( $field_key ), $data['description'] );
 
 
 
 
 
 
 
 
882
  }
 
 
883
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
884
  /**
885
- * Generate custom_services field HTML.
886
- *
887
- * @param string $key
888
- * @param array $data
889
- *
890
- * @return string
891
- */
892
- public function generate_custom_services_html( $key, $data ) {
893
- $field_key = $this->get_field_key( $key );
894
- $defaults = array(
895
- 'title' => '',
896
- 'disabled' => false,
897
- 'class' => '',
898
- 'css' => '',
899
- 'placeholder' => '',
900
- 'type' => 'text',
901
- 'desc_tip' => false,
902
- 'description' => '',
903
- 'custom_attributes' => array(),
904
- 'services' => array()
905
- );
906
- $data = wp_parse_args( $data, $defaults );
907
- ob_start();
908
- $services = $data['services'];
909
- include ( 'views/html-custom-services.php' );
910
- return ob_get_clean();
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
911
  }
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
912
 
 
 
 
 
 
913
  }
914
 
915
  }
1
  <?php
2
 
3
+ use FSVendor\WPDesk\Beacon\Beacon\WooCommerceSettingsFieldsModifier;
4
 
5
+ class WPDesk_Flexible_Shipping extends WC_Shipping_Method {
 
6
 
7
+ const FIELD_METHOD_FREE_SHIPPING = 'method_free_shipping';
8
 
9
+ const META_DEFAULT = '_default';
10
 
11
+ const WEIGHT_ROUNDING_PRECISION = 6;
12
 
13
+ /**
14
+ * Message added.
15
+ *
16
+ * @var bool
17
+ */
18
+ private $message_added = false;
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
19
 
 
20
 
21
+ /**
22
+ * Constructor for your shipment class
23
+ *
24
+ * @access public
25
+ * @return void
26
+ */
27
+ public function __construct( $instance_id = 0 ) {
28
+ $this->instance_id = absint( $instance_id );
29
+ $this->id = 'flexible_shipping';
30
+ $this->shipping_methods_option = 'flexible_shipping_methods_' . $this->instance_id;
31
+ $this->shipping_method_order_option = 'flexible_shipping_method_order_' . $this->instance_id;
32
+ $this->section_name = 'flexible_shipping';
33
+ $this->method_title = __( 'Flexible Shipping', 'flexible-shipping' );
34
+ $this->method_description = __( 'Flexible Shipping', 'flexible-shipping' );
35
 
36
+ $this->supports = array(
37
+ 'shipping-zones',
38
+ 'instance-settings',
39
+ );
40
 
41
+ $this->instance_form_fields = array(
42
+ 'enabled' => array(
43
+ 'title' => __( 'Enable/Disable', 'flexible-shipping' ),
44
+ 'type' => 'checkbox',
45
+ 'label' => __( 'Enable this shipment method', 'flexible-shipping' ),
46
+ 'default' => 'yes',
47
+ ),
48
+ 'title' => array(
49
+ 'title' => __( 'Shipping Title', 'flexible-shipping' ),
50
+ 'type' => 'text',
51
+ 'description' => __( 'This controls the title which the user sees during checkout.', 'flexible-shipping' ),
52
+ 'default' => __( 'Flexible Shipping', 'flexible-shipping' ),
53
+ 'desc_tip' => true
54
+ )
55
+ );
56
 
57
+ if ( version_compare( WC()->version, '2.6' ) < 0 && $this->get_option( 'enabled', 'yes' ) == 'no' ) {
58
+ $this->enabled = $this->get_option( 'enabled' );
59
  }
60
 
61
+ $this->title = $this->get_option( 'title' );
 
 
 
 
 
 
 
 
 
 
62
 
63
+ $this->init();
 
 
64
 
 
65
 
66
+ //$this->method_title = $this->get_option( 'title' );
 
67
 
68
+ //add_action( 'woocommerce_sections_' . $this->id, array( $this, 'process_admin_options' ) );
69
+ add_action( 'woocommerce_update_options_shipping_' . $this->id, array( $this, 'process_admin_options' ) );
70
 
71
+ }
 
 
 
 
 
 
 
 
 
 
72
 
73
+ /**
74
+ * Init your settings
75
+ *
76
+ * @access public
77
+ * @return void
78
+ */
79
+ function init() {
80
+ $this->instance_form_fields = include( 'settings/flexible-shipping.php' );
81
+ // Load the settings API
82
+ $this->init_form_fields(); // This is part of the settings API. Override the method to add your own settings
83
+ $this->init_settings(); // This is part of the settings API. Loads settings you previously init.
84
+
85
+ // Define user set variables
86
+ $this->title = $this->get_option( 'title' );
87
+ $this->tax_status = $this->get_option( 'tax_status' );
88
+
89
+ $this->availability = $this->get_option( 'availability' );
90
+
91
+ $this->type = $this->get_option( 'type', 'class' );
92
+ }
93
 
94
+ /**
95
+ * Initialise Settings Form Fields
96
+ */
97
+ public function init_form_fields() {
98
+ $this->form_fields = include( 'settings/flexible-shipping.php' );
99
+ $this->form_fields = $this->add_beacon_search_data_to_fields( $this->form_fields );
100
+ }
101
 
102
+ public function generate_title_shipping_methods_html( $key, $data ) {
103
+ $field = $this->get_field_key( $key );
104
+ $defaults = array(
105
+ 'title' => '',
106
+ 'class' => ''
107
+ );
108
 
109
+ $data = wp_parse_args( $data, $defaults );
 
 
 
110
 
111
+ ob_start();
 
 
 
 
112
 
113
+ ?>
114
+ </table>
115
+ <?php
116
+ if ( ! wpdesk_is_plugin_active( 'flexible-shipping-pro/flexible-shipping-pro.php' ) )
117
+ include __DIR__ . '/views/html-ads.php';
118
+ ?>
119
+ <h3 class="wc-settings-sub-title <?php echo esc_attr( $data['class'] ); ?>" id="<?php echo esc_attr( $field ); ?>"><?php echo wp_kses_post( $data['title'] ); ?>
120
+ <a href="<?php echo remove_query_arg( 'added', add_query_arg( 'action', 'new' ) ); ?>" class="add-new-h2"><?php echo __('Add New', 'flexible-shipping' ); ?></a></h3>
121
+
122
+ <?php if ( ! empty( $data['description'] ) ) : ?>
123
+ <p><?php echo wp_kses_post( $data['description'] ); ?></p>
124
+ <?php endif; ?>
125
+ </div><table class="form-table">
126
+ <?php
127
+
128
+ return ob_get_clean();
129
+ }
130
 
131
+ /**
132
+ * @param unknown $key
133
+ *
134
+ * @return string
135
+ *
136
+ * Dodane w WooCommerce 2.4
137
+ * Dodane w celu zachowania kompatybilności z WooCommerce 2.3
138
+ * Przetestowane na WooCommerce 2.3.9
139
+ */
140
+ public function get_field_key( $key ) {
141
+ return $this->plugin_id . $this->id . '_' . $key;
142
+ }
143
 
144
+ public function generate_shipping_methods_html( $key, $data ) {
145
+ $shipping_methods = $this->get_shipping_methods();
146
+ $shipping_method_order = $this->get_shipping_method_order();
147
+ ob_start();
148
+ include ( 'views/html-shipping-method-settings.php' );
149
+ return ob_get_clean();
150
+ }
 
 
 
 
 
 
 
 
 
 
 
 
151
 
152
+ public function get_shipping_methods( $enabled = false ) {
153
+ $shipping_methods = get_option( $this->shipping_methods_option, array() );
154
+ $shipping_method_order = get_option( $this->shipping_method_order_option, array() );
155
+ $ret = array();
156
+ if ( is_array( $shipping_method_order ) ) {
157
+ foreach ( $shipping_method_order as $method_id ) {
158
+ if ( isset( $shipping_methods[$method_id] ) ) {$ret[$method_id] = $shipping_methods[$method_id];}
 
159
  }
160
+ }
161
+ foreach ( $shipping_methods as $shipping_method ) {
162
+ if ( !isset( $ret[$shipping_method['id']] ) ) {$ret[$shipping_method['id']] = $shipping_method;}
163
+ }
164
+ if ( $enabled ) {
165
+ foreach ( $ret as $key => $shipping_method ) {
166
+ if ( isset( $shipping_method['method_enabled'] ) && 'yes' != $shipping_method['method_enabled'] ) {unset($ret[$key]);}
167
  }
 
168
  }
169
+ return $ret;
170
+ }
171
 
172
+ public function get_shipping_method_order() {
173
+ $shipping_methods = get_option( $this->shipping_methods_option, array() );
174
+ $shipping_method_order = get_option( $this->shipping_method_order_option, array() );
175
+ $ret = array();
176
+ if ( is_array( $shipping_method_order ) ) {
177
+ foreach ( $shipping_method_order as $method_id ) {
178
+ if ( isset( $shipping_methods[$method_id] ) ) {$ret[$method_id] = $method_id;}
179
  }
 
 
 
180
  }
181
+ foreach ( $shipping_methods as $shipping_method ) {
182
+ if ( !isset( $ret[$shipping_method['id']] ) ) {$ret[$shipping_method['id']] = $shipping_method['id'];}
 
 
 
 
 
183
  }
184
+ return $ret;
185
+ }
186
 
187
+ public function generate_shipping_rules_html( $key, $data ) {
188
+ if ( ! function_exists( 'woocommerce_form_field' ) ) {
189
+ $wc_template_functions = trailingslashit( dirname( __FILE__) ) . '../../woocommerce/includes/wc-template-functions.php';
190
+ if ( file_exists( $wc_template_functions ) ) {
191
+ include_once( $wc_template_functions );
 
 
 
 
 
192
  }
 
 
 
 
 
 
 
 
 
 
193
  }
194
+ ob_start();
195
+ include ( 'views/html-shipping-method-rules.php' );
196
+ return ob_get_clean();
197
+ }
198
 
199
+ public function shipping_method_title_used( $title, $shipping_methods ) {
200
+ foreach ( $shipping_methods as $shipping_method ) {
201
+ if ( $title == $shipping_method['method_title'] ) {
202
+ return true;
203
+ }
 
 
 
 
204
  }
205
+ return false;
206
+ }
207
 
208
+ public function shipping_method_next_id( $shipping_methods ) {
209
+ $next_id = 0;
210
+ foreach ( $shipping_methods as $shipping_method ) {
211
+ if ( intval($shipping_method['id'] ) > $next_id ) {
212
+ $next_id = intval($shipping_method['id'] );
 
213
  }
214
  }
215
+ $next_id++;
216
+ return $next_id;
217
+ }
218
 
219
+ public function process_admin_options() {
220
+ $action = false;
221
+ if ( isset( $_POST['method_action'] ) ) {
222
+ $action = sanitize_key( $_POST['method_action'] );
223
+ }
224
+ if ( $action == 'new' || $action == 'edit' ) {
225
+ $this->add_method_creation_date();
226
+ $shipping_methods = get_option( $this->shipping_methods_option, array() );
227
+ $shipping_method = array();
228
+ if ( $action == 'new' ) {
229
  $shipping_methods = get_option( $this->shipping_methods_option, array() );
230
+ $shipping_method_order = get_option( $this->shipping_method_order_option, array() );
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
231
  //
232
+ $method_id = get_option( 'flexible_shipping_method_id', 0 );
233
+ //$method_id = 0;
234
+ foreach ( $shipping_methods as $shipping_method ) {
235
+ if ( intval( $shipping_method['id'] ) > $method_id ) {$method_id = intval( $shipping_method['id'] );}
 
 
 
 
 
 
 
 
 
 
 
 
 
236
  }
237
+ $method_id++;
238
+ update_option( 'flexible_shipping_method_id', $method_id );
239
  //
240
+ $method_id_for_shipping = $this->id . '_' . $this->instance_id . '_' . $method_id;
241
+ }
242
+ else {
243
+ $method_id = sanitize_text_field( wp_unslash( $_POST['method_id'] ) );
244
+ $method_id_for_shipping = sanitize_text_field( wp_unslash( $_POST['method_id_for_shipping'] ) );
245
+ if ( isset( $shipping_methods[ $method_id ] ) ) {
246
+ $shipping_method = $shipping_methods[ $method_id ];
 
 
247
  }
248
+ }
249
+ $shipping_method['woocommerce_method_instance_id'] = $this->instance_id;
250
+ $shipping_method['id'] = $method_id;
251
+ $shipping_method['id_for_shipping'] = $method_id_for_shipping;
252
+ $shipping_method['method_title'] = sanitize_text_field( wp_unslash( $_POST['woocommerce_' . $this->id . '_method_title'] ) );
253
+ $shipping_method['method_description'] = sanitize_text_field( wp_unslash( $_POST['woocommerce_' . $this->id . '_method_description'] ) );
254
+ $shipping_method[self::FIELD_METHOD_FREE_SHIPPING] = '';
255
+
256
+ if ( isset( $_POST['woocommerce_' . $this->id . '_method_free_shipping'] ) && $_POST['woocommerce_' . $this->id . '_method_free_shipping'] != '' ) {
257
+ $shipping_method[self::FIELD_METHOD_FREE_SHIPPING] = wc_format_decimal( sanitize_text_field( wp_unslash( $_POST['woocommerce_' . $this->id . '_method_free_shipping'] ) ) );
258
+ }
259
+ if ( version_compare( WC()->version, '2.6' ) >= 0 ) {
260
+ $shipping_method['method_free_shipping_label'] = sanitize_text_field( wp_unslash( $_POST['woocommerce_' . $this->id . '_method_free_shipping_label'] ) );
261
+ }
262
+ $shipping_method['method_calculation_method'] = sanitize_text_field( wp_unslash( $_POST['woocommerce_' . $this->id . '_method_calculation_method'] ) );
263
+ $shipping_method['method_visibility'] = 'no';
264
+ if ( isset( $_POST['woocommerce_' . $this->id . '_method_visibility'] ) && $_POST['woocommerce_' . $this->id . '_method_visibility'] == 1 )
265
+ {$shipping_method['method_visibility'] = 'yes';}
266
+ //
267
+ $shipping_method['method_default'] = 'no';
268
+ if ( isset( $_POST['woocommerce_' . $this->id . '_method_default'] ) && $_POST['woocommerce_' . $this->id . '_method_default'] == 1 )
269
+ {$shipping_method['method_default'] = 'yes';}
270
+ //
271
+ $shipping_method['method_enabled'] = 'no';
272
+ if ( isset( $_POST['woocommerce_' . $this->id . '_method_enabled'] ) && $_POST['woocommerce_' . $this->id . '_method_enabled'] == 1 )
273
+ {$shipping_method['method_enabled'] = 'yes';}
274
+ //
275
+ $shipping_method['method_integration'] = sanitize_text_field( wp_unslash( $_POST['woocommerce_' . $this->id . '_method_integration'] ) );
276
+ //
277
+ $shipping_method = apply_filters( 'flexible_shipping_process_admin_options', $shipping_method );
278
+ //
279
+ $count = 0;
280
+ $shipping_method['method_rules'] = array();
281
+ if ( isset( $_POST['method_rules'] ) ) {
282
+ foreach ( $_POST['method_rules'] as $rule ) {
283
+ $count++;
284
+ $method_rule = array();
285
+ $method_rule['based_on'] = sanitize_text_field( wp_unslash( $rule['based_on'] ) );
286
+ $method_rule['min'] = wc_format_decimal( sanitize_text_field( wp_unslash( $rule['min'] ) ) );
287
+ $method_rule['max'] = wc_format_decimal( sanitize_text_field( wp_unslash( $rule['max'] ) ) );
288
+ $method_rule['cost_per_order'] = wc_format_decimal( sanitize_text_field( wp_unslash( $rule['cost_per_order'] ) ) );
289
+ $method_rule = apply_filters( 'flexible_shipping_method_rule_save', $method_rule, $rule );
290
+ $shipping_method['method_rules'][$count] = $method_rule;
291
  }
292
+ }
293
+ //
294
+ $shipping_methods[$method_id] = $shipping_method;
295
+ //
296
+ update_option( $this->shipping_methods_option, $shipping_methods );
297
+ //
298
+ $this->update_rates($shipping_methods);
299
+ //
300
+ if ( $action == 'new' ) {
301
+ $shipping_method_order[$method_id] = $method_id;
302
+ update_option( $this->shipping_method_order_option, $shipping_method_order );
303
+ }
304
+ if ( $action == 'new' ) {
305
+ $redirect = add_query_arg( array('added' => $method_id, 'action' => false, 'method_id' => false ));
306
+ $redirect .= '#method_' . $method_id;
307
+ $redirect = add_query_arg( array('added' => $method_id, 'action' => 'edit', 'method_id' => $method_id ));
308
+ wpdesk_redirect( $redirect );
309
+ exit;
310
+ }
311
+ if ( $action == 'edit' ) {
312
+ $redirect = add_query_arg( array('updated' => $method_id, 'action' => false, 'method_id' => false ));
313
+ $redirect .= '#method_' . $method_id;
314
+ }
315
+ }
316
+ else {
317
+ if ( isset( $_POST['import_action'] ) && $_POST['import_action'] == '1' ) {
318
+ $tmp_name = $_FILES['import_file']['tmp_name'];
319
+ $shipping_methods = get_option( $this->shipping_methods_option, array() );
320
+ try {
321
+ $importer = new WPDesk_Flexible_Shipping_Csv_Importer( $this );
322
+ $shipping_methods = $importer->import( $tmp_name, $shipping_methods );
323
+ update_option( $this->shipping_methods_option, $shipping_methods );
324
+ } catch ( Exception $e ) {
325
+ WC_Admin_Settings::add_message( $e->getMessage() );
326
  }
327
+ WC_Admin_Settings::show_messages();
328
  }
329
  else {
330
+ parent::process_admin_options();
331
+ if ( isset( $_POST['method_order'] ) ) {
332
+ $method_order = $_POST['method_order'];
333
+ $method_order_security_alert = false;
334
+ foreach ( $method_order as $method_order_key => $method_id ) {
335
+ if ( strval( $method_order_key ) !== strval( sanitize_key( $method_order_key ) ) || strval( $method_id ) !== strval( sanitize_key( $method_id ) ) ) {
336
+ $method_order_security_alert = true;
337
+ }
338
+ }
339
+ if ( $method_order_security_alert ) {
340
+ WC_Admin_Settings::add_error( __( 'Flexible Shipping: security check error. Shipping method order not saved!', 'flexible-shipping' ) );
341
+ WC_Admin_Settings::show_messages();
342
+ } else {
343
+ update_option( $this->shipping_method_order_option, $method_order );
344
+ }
 
 
 
 
 
 
 
 
 
 
 
 
 
 
345
  }
346
  }
347
  }
348
+ }
349
 
350
+ /**
351
+ * Add method creation date.
352
+ */
353
+ private function add_method_creation_date() {
354
+ if ( ! get_option( 'flexible_shipping_method_creation_date' ) ) {
355
+ add_option( 'flexible_shipping_method_creation_date', current_time('mysql') );
356
  }
357
+ }
358
 
359
+ public function update_rates( $shipping_methods ) {
360
+ $rates = array();
361
+ foreach ( $shipping_methods as $shipping_method ) {
362
+ $id = $this->id . '_' . $this->instance_id . '_' . sanitize_title($shipping_method['method_title'] );
363
+ $id = apply_filters( 'flexible_shipping_method_rate_id', $id, $shipping_method );
364
+ if ( ! isset( $rates[$id] ) && $shipping_method['method_enabled'] == 'yes' )
365
+ {$rates[$id] = array(
366
+ 'identifier' => $id,
367
+ 'title' => $shipping_method['method_title']
368
+ );}
369
+ }
370
+ update_option( 'flexible_shipping_rates', $rates );
371
+ }
372
 
373
+ public function admin_options() {
374
+ $settings_div_class = isset( $_GET['method_id'] ) ? '' : 'fs-settings-div';
375
+ ?>
376
+ <div class="<?php echo esc_html( $settings_div_class ) ; ?>"><table class="form-table">
377
+ <?php
378
+ $action = false;
379
+ if ( isset( $_GET['action'] ) )
380
+ {
381
+ $action = sanitize_key( $_GET['action'] );
382
+ }
383
+ if ( $action == 'new' || $action == 'edit' ) {
384
+ $shipping_methods = get_option( $this->shipping_methods_option, array() );
385
+ $shipping_method = array(
386
+ 'method_title' => '',
387
+ 'method_description' => '',
388
+ 'method_enabled' => 'no',
389
+ 'method_shipping_zone' => '',
390
+ 'method_calculation_method' => 'sum',
391
+ self::FIELD_METHOD_FREE_SHIPPING => '',
392
+ 'method_free_shipping_label'=> '',
393
+ 'method_visibility' => 'no',
394
+ 'method_default' => 'no',
395
+ 'method_integration' => '',
396
+ );
397
+ $method_id = '';
398
+ if ( $action == 'edit' ) {
399
+ $method_id = sanitize_key( $_GET['method_id'] );
400
+ $shipping_method = $shipping_methods[$method_id];
401
+ $method_id_for_shipping = $this->id . '_' . $this->instance_id . '_' . sanitize_title( $shipping_method['method_title'] );
402
+ $method_id_for_shipping = apply_filters( 'flexible_shipping_method_rate_id', $method_id_for_shipping, $shipping_method );
403
+ }
404
+ else {
405
+ $method_id_for_shipping = '';
406
  }
407
+ ?>
408
+ <input type="hidden" name="method_action" value="<?php echo $action; ?>" />
409
+ <input type="hidden" name="method_id" value="<?php echo $method_id; ?>" />
410
+ <input type="hidden" name="method_id_for_shipping" value="<?php echo $method_id_for_shipping; ?>" />
411
+ <?php if ( $action == 'new' ) : ?>
412
+ <h2><?php _e('New Shipping Method', 'flexible-shipping' ); ?></h2>
413
+ <?php endif; ?>
414
+ <?php if ( $action == 'edit' ) : ?>
415
+ <h2><?php _e('Edit Shipping Method', 'flexible-shipping' ); ?></h2>
416
+ <?php endif; ?>
417
+ <?php
418
+ if ( isset( $_GET['added'] ) ) {
419
+ $method_id = sanitize_key( $_GET['added'] );
420
  $shipping_methods = get_option( $this->shipping_methods_option, array() );
421
+ if ( isset( $shipping_methods[$method_id] ) )
422
+ {
423
+ if ( ! $this->message_added ) {
424
+ $shipping_method = $shipping_methods[$method_id];
425
+ WC_Admin_Settings::add_message( sprintf(__( 'Shipping method %s added.', 'flexible-shipping' ), $shipping_method['method_title'] ) );
426
+ $this->message_added = true;
427
+ }
428
+ }
429
+ WC_Admin_Settings::show_messages();
430
+ }
431
+ $shipping_method['woocommerce_method_instance_id'] = $this->instance_id;
432
+ $this->generate_settings_html( $this->get_shipping_method_form($shipping_method) );
433
+ }
434
+ else if ( $action == 'delete' ) {
435
+ $methods_id = '';
436
+ if ( isset( $_GET['methods_id'] ) ) {
437
+ $methods_id = explode( ',' , sanitize_text_field( $_GET['methods_id'] ) );
438
+ }
439
+ $shipping_methods = get_option( $this->shipping_methods_option, array() );
440
+ $shipping_method_order = get_option( $this->shipping_method_order_option, array() );
441
+ foreach ( $methods_id as $method_id ) {
442
+ if ( isset( $shipping_methods[$method_id] ) ) {
443
  $shipping_method = $shipping_methods[$method_id];
444
+ unset( $shipping_methods[$method_id] );
445
+ if ( isset( $shipping_method_order[$method_id] ) ) {
446
+ unset( $shipping_method_order[$method_id] );
447
+ }
448
+ update_option( $this->shipping_methods_option, $shipping_methods );
449
+ update_option( $this->shipping_method_order_option, $shipping_method_order );
450
+ WC_Admin_Settings::add_message( sprintf(__('Shipping method %s deleted.', 'flexible-shipping' ), $shipping_method['method_title'] ) );
451
  }
452
  else {
453
+ WC_Admin_Settings::add_error( __( 'Shipping method not found.', 'flexible-shipping' ) );
454
  }
455
+ }
456
+ WC_Admin_Settings::show_messages();
457
+ $this->generate_settings_html();
458
+ }
459
+ else {
460
+ if ( isset( $_GET['added'] ) ) {
461
+ $method_id = sanitize_key( $_GET['added'] );
462
+ $shipping_methods = get_option( $this->shipping_methods_option, array() );
463
+ if ( isset( $shipping_methods[$method_id] ) )
464
+ {
465
+ if ( ! $this->message_added ) {
466
+ $shipping_method = $shipping_methods[$method_id];
467
+ WC_Admin_Settings::add_message( sprintf(__( 'Shipping method %s added.', 'flexible-shipping' ), $shipping_method['method_title'] ) );
468
+ $this->message_added = true;
 
 
 
 
 
 
 
469
  }
 
470
  }
471
+ WC_Admin_Settings::show_messages();
 
472
  }
473
+ if ( isset( $_GET['updated'] ) ) {
474
+ $method_id = sanitize_key( $_GET['updated'] );
 
 
 
475
  $shipping_methods = get_option( $this->shipping_methods_option, array() );
476
+ if ( isset( $shipping_methods[$method_id] ) )
477
+ {
478
+ $shipping_method = $shipping_methods[$method_id];
479
+ WC_Admin_Settings::add_message( sprintf(__( 'Shipping method %s updated.', 'flexible-shipping' ), $shipping_method['method_title'] ) );
480
+ }
 
 
 
 
 
 
 
 
 
 
 
481
  WC_Admin_Settings::show_messages();
 
482
  }
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
483
 
484
+ // General Settings
485
+ $this->generate_settings_html();
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
486
  }
487
+ ?>
488
+ </table>
489
+ <script type="text/javascript">
490
+ if ( typeof window.history.pushState == 'function' ) {
491
+ var url = document.location.href;
492
+ url = fs_removeParam('action', url);
493
+ url = fs_removeParam('methods_id', url);
494
+ url = fs_removeParam('added', url);
495
+ url = fs_trimChar(url,'?');
496
+ if ( url.includes('method_id=') ) {
497
+ url = url + "&action=edit";
498
+ }
499
+ window.history.pushState({}, "", url);
 
 
 
 
 
 
 
 
 
 
 
 
500
  }
501
+ </script>
502
+ <?php do_action( 'flexible_shipping_method_script' ); ?>
503
+ <?php
504
+ }
505
 
506
+ public function get_shipping_method_form( $shipping_method ) {
507
+ $this->form_fields = include( 'settings/shipping-method-form.php' );
508
+ }
509
 
510
+ public function package_weight( $items ) {
511
+ $weight = 0;
512
+ foreach( $items as $item ) {
513
+ $weight += $item['data']->weight * $item['quantity'];
514
  }
515
+ return $weight;
516
+ }
517
 
518
+ public function woocommerce_product_weight( $weight ) {
519
+ if ( $weight === '' ) {
520
+ return 0;
 
 
 
 
 
 
521
  }
522
+ return $weight;
523
+ }
524
 
525
+ public function package_item_count( $items ) {
526
+ $item_count = 0;
527
+
528
+ foreach( $items as $item ) {
529
+ $item_count += $item['quantity'];
 
 
 
 
530
  }
531
+ return $item_count;
532
+ }
533
 
534
+ public function cart_item_count() {
535
+ $item_count = 0;
 
 
 
 
 
 
 
536
 
537
+ $cart = WC()->cart;
538
+ foreach( $cart->cart_contents as $item ) {
539
+ $item_count += $item['quantity'];
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
540
  }
541
 
542
+ return $item_count;
543
+ }
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
544
 
545
+ /* Fix for Woocommerce 2.6 weight calculation */
546
+ /* PHP Warning: A non-numeric value encountered in /wp-content/plugins/woocommerce/includes/class-wc-cart.php on line 359 */
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
547
 
548
+ /**
549
+ * @param array $package
550
+ */
551
+ public function calculate_shipping( $package = array() ) {
 
 
 
 
 
 
 
 
552
 
553
+ $cart_contents_cost = 0;
554
+
555
+ $processed = apply_filters( 'flexible_shipping_calculate_shipping', false, $this, $package, 0 );
 
556
 
557
+ if ( $processed === false ) {
558
 
559
+ $shipping_methods = $this->get_shipping_methods( true );
560
 
561
+ foreach ( $shipping_methods as $shipping_method ) {
562
 
563
+ $rule_costs = array();
564
 
565
+ $add_method = false;
566
 
567
+ if ( isset( $shipping_method['method_visibility'] ) && $shipping_method['method_visibility'] == 'yes' && !is_user_logged_in() ) {
568
+ /* only for logged in */
569
+ continue;
570
+ }
571
 
572
+ foreach ( $shipping_method['method_rules'] as $rule_key => $method_rule ) {
573
+ $rule_triggered = false;
574
 
575
+ if ( $method_rule['based_on'] == 'none' ) {
576
+ $rule_triggered = true;
 
577
  }
578
 
579
+ $contents_cost = $this->contents_cost();
580
+ $cart_contents_cost = $contents_cost;
581
 
582
+ if ( $method_rule['based_on'] == 'value' ) {
583
+ if ( trim( $method_rule['min'] ) == '' ) {
584
+ $min = 0;
585
  }
586
+ else {
587
+ $min = floatval( apply_filters( 'flexible_shipping_value_in_currency', floatval( $method_rule['min'] ) ) );
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
588
  }
589
+ if ( trim( $method_rule['max'] ) == '' ) {
590
+ $max = INF;
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
591
  }
592
+ else {
593
+ $max = floatval( apply_filters( 'flexible_shipping_value_in_currency', floatval( $method_rule['max'] ) ) );
594
  }
595
+ if ( $contents_cost >= $min && $contents_cost <= $max ) {
596
+ $rule_triggered = true;
 
 
597
  }
 
598
  }
 
 
 
599
 
600
+ if ( $method_rule['based_on'] == 'weight' ) {
601
+ if ( trim( $method_rule['min'] ) == '' ) {
602
+ $min = 0;
603
  }
604
+ else {
605
+ $min = floatval( $method_rule['min'] );
 
 
 
 
 
 
 
 
 
606
  }
607
+ if ( trim( $method_rule['max'] ) == '' ) {
608
+ $max = INF;
 
 
 
 
 
 
 
 
 
 
 
 
 
 
609
  }
610
  else {
611
+ $max = floatval( $method_rule['max'] );
612
  }
613
+ $contents_weight = floatval( $this->cart_weight() );
614
+ if ( $contents_weight >= $min && $contents_weight <= $max ) {
615
+ $rule_triggered = true;
616
+ }
617
+ }
618
+ if ( $rule_triggered ) {
619
+ $rule_triggered = apply_filters( 'flexible_shipping_rule_triggered', $rule_triggered, $method_rule, $package );
620
+ }
621
+ if ( $rule_triggered ) {
622
+ $rule_cost = array( 'cost' => floatval( $method_rule['cost_per_order'] ) );
623
+ $rule_costs[$rule_key] = $rule_cost;
624
+ $add_method = true;
625
  }
626
+
627
  }
628
+ $cost = $this->calculate_method_cost( $shipping_method, $rule_costs );
629
+ $add_method = apply_filters( 'flexible_shipping_add_method' , $add_method, $shipping_method, $package, $this );
630
+ if ( $add_method === true ) {
631
+
632
+ if ( $this->is_free_shipping( $shipping_method, $cart_contents_cost ) ) {
633
+ $cost = 0;
634
+ }
635
 
636
+ $method_title = wpdesk__( $shipping_method['method_title'], 'flexible-shipping' );
637
+ if ( version_compare( WC()->version, '2.6' ) >= 0 ) {
638
+ if ( $cost == 0 ) {
639
+ if ( ! isset( $shipping_method['method_free_shipping_label'] ) ) {
640
+ $shipping_method['method_free_shipping_label'] = __( 'Free', 'flexible-shipping' );
641
+ }
642
+ if ( $shipping_method['method_free_shipping_label'] != '' ) {
643
+ $method_title .= ' (' . wpdesk__( $shipping_method['method_free_shipping_label'], 'flexible-shipping' ) . ')';
 
 
 
 
 
 
 
 
 
 
 
 
 
644
  }
645
  }
646
  }
647
+
648
+ $id = $this->id . '_' . $this->instance_id . '_' . sanitize_title( $shipping_method['method_title'] );
649
+ $id = apply_filters( 'flexible_shipping_method_rate_id', $id, $shipping_method );
650
+ $this->add_rate( array(
651
+ 'id' => $id,
652
+ 'label' => $method_title,
653
+ 'cost' => $cost,
654
+ 'method' => $shipping_method,
655
+ 'rule_costs' => $rule_costs,
656
+ 'meta_data' => array(
657
+ self::META_DEFAULT => $shipping_method['method_default'],
658
+ '_fs_method' => $shipping_method
659
+ )
660
+ ) );
661
+ if ( isset( $shipping_method['method_description'] ) ) {
662
+ WC()->session->set('flexible_shipping_description_' . $id, wpdesk__( $shipping_method['method_description'], 'flexible-shipping' ) );
663
+ }
664
+ else {
665
+ WC()->session->set( 'flexible_shipping_description_' . $id, '' );
666
+ }
667
  }
668
  }
669
+ }
670
+ }
671
+
672
+ /**
673
+ * Calculate contents cost.
674
+ *
675
+ * @return float
676
+ */
677
+ public function contents_cost() {
678
+ if ( $this->prices_include_tax() ) {
679
+ return $this->contents_cost_with_tax();
680
+ } else {
681
+ return $this->contents_cost_without_tax();
682
+ }
683
+ }
684
+
685
+ public function prices_include_tax() {
686
+ if ( version_compare( WC_VERSION, '3.3', '<' ) ) {
687
+ $prices_include_tax = 'incl' === WC()->cart->tax_display_cart;
688
+ }
689
+ else {
690
+ $prices_include_tax = WC()->cart->display_prices_including_tax();
691
+ }
692
+ return apply_filters( 'flexible_shipping_prices_include_tax', $prices_include_tax );
693
+ }
694
+
695
+ /**
696
+ * @return int
697
+ */
698
+ public function contents_cost_with_tax() {
699
+ $display_prices_including_tax = $this->cart_display_prices_including_tax();
700
+ if ( $display_prices_including_tax ) {
701
+ $total = WC()->cart->get_displayed_subtotal();
702
+ }
703
+ else {
704
+ if ( version_compare( WC_VERSION, '3.2', '<' ) ) {
705
+ $total = WC()->cart->subtotal;
706
+ }
707
  else {
708
+ $total = WC()->cart->get_displayed_subtotal() + WC()->cart->get_subtotal_tax();
 
 
 
 
 
 
709
  }
 
710
  }
711
+ if ( version_compare( WC_VERSION, '3.2', '<' ) ) {
712
+ $total_discount = WC()->cart->discount_cart + WC()->cart->discount_cart_tax;
713
+ }
714
+ else {
715
+ $total_discount = WC()->cart->get_cart_discount_total() + WC()->cart->get_cart_discount_tax_total();
716
+ }
717
+ $total = round( $total - $total_discount, wc_get_price_decimals() );
718
+ return $total;
719
+ }
720
 
721
+ public function cart_display_prices_including_tax() {
722
+ if ( version_compare( WC_VERSION, '3.3', '<' ) ) {
723
+ $display_prices_including_tax = 'incl' === WC()->cart->tax_display_cart;
724
+ }
725
+ else {
726
+ $display_prices_including_tax = WC()->cart->display_prices_including_tax();
727
  }
728
+ return $display_prices_including_tax;
729
+ }
730
 
731
+ /**
732
+ * @return int
733
+ */
734
+ public function contents_cost_without_tax() {
735
+ $display_prices_including_tax = $this->cart_display_prices_including_tax();
736
+ $total = WC()->cart->get_displayed_subtotal();
737
+ if ( $display_prices_including_tax ) {
738
+ if ( version_compare( WC_VERSION, '3.2', '<' ) ) {
739
+ $total = WC()->cart->subtotal_ex_tax;
740
+ }
741
+ else {
742
+ $total = $total - WC()->cart->get_subtotal_tax();
743
+ }
744
+ }
745
+ if ( version_compare( WC_VERSION, '3.2', '<' ) ) {
746
+ $discount_without_tax = WC()->cart->discount_cart;
747
+ }
748
+ else {
749
+ $discount_without_tax = WC()->cart->get_cart_discount_total();
750
  }
751
+ $total = round( $total - $discount_without_tax, wc_get_price_decimals() );
752
+ return $total;
753
+ }
754
 
755
+ /**
756
+ * Get cart weight.
757
+ * It rounds return value to declared precision.
758
+ *
759
+ * @return float
760
+ */
761
+ public function cart_weight() {
762
+ if ( version_compare( WC_VERSION, '2.7', '<' ) ) {
763
+ add_filter( 'woocommerce_product_weight', array( $this, 'woocommerce_product_weight' ) );
764
+ }
765
+ $cart_weight = WC()->cart->get_cart_contents_weight();
766
+ if ( version_compare( WC_VERSION, '2.7', '<' ) ) {
767
+ remove_filter( 'woocommerce_product_weight', array( $this, 'woocommerce_product_weight' ) );
768
+ }
769
+ return round( $cart_weight, apply_filters( 'flexible_shipping_weight_rounding_precision', self::WEIGHT_ROUNDING_PRECISION ) );
770
+ }
771
+
772
+ function calculate_method_cost( $shipping_method, $rule_costs ) {
773
+ $cost = 0;
774
+ if ( $shipping_method['method_calculation_method'] == 'sum' ) {
775
+ $cost = 0;
776
+ foreach ( $rule_costs as $rule_cost ) {
777
+ $cost += $rule_cost['cost'];
778
+ }
779
  }
780
+ return $cost;
781
+ }
782
 
783
+ /**
784
+ * Is free shipping?
785
+ *
786
+ * @param array $shipping_method_settings Flexible shipping method settings.
787
+ * @param float $cart_contents_cost Cart contents cost.
788
+ *
789
+ * @return bool
790
+ */
791
+ public function is_free_shipping( array $shipping_method_settings, $cart_contents_cost ) {
792
+ $is_free_shipping = false;
793
+ if ( isset( $shipping_method_settings[ self::FIELD_METHOD_FREE_SHIPPING ] ) && '' !== $shipping_method_settings[ self::FIELD_METHOD_FREE_SHIPPING ] ) {
794
+ $shipping_method_settings[self::FIELD_METHOD_FREE_SHIPPING] = trim( $shipping_method_settings[self::FIELD_METHOD_FREE_SHIPPING] );
795
+ if ( '0' !== $shipping_method_settings[self::FIELD_METHOD_FREE_SHIPPING] && is_numeric( $shipping_method_settings[self::FIELD_METHOD_FREE_SHIPPING] ) ) {
796
+ if ( apply_filters( 'flexible_shipping_value_in_currency', floatval( $shipping_method_settings[self::FIELD_METHOD_FREE_SHIPPING] ) ) <= floatval( $cart_contents_cost ) ) {
797
+ $is_free_shipping = true;
798
+ }
799
+ }
800
+ }
801
  /**
802
+ * Can modify free shipping.
803
+ *
804
+ * @param bool $is_free_shipping Current is_free_shipping value based on method settings.
805
+ * @param array $shipping_method_settings Flexible shipping method settings.
806
+ * @param float $cart_contents_cost Cart contents cost.
807
+ *
808
+ * @return bool
809
+ */
810
+ return apply_filters( 'flexible_shipping_is_free_shipping', $is_free_shipping, $shipping_method_settings, $cart_contents_cost );
811
+ }
812
+
813
+ public function is_available( $package ) {
814
+ return parent::is_available( $package );
815
+ }
816
+
817
+ public function get_method_from_rate( $rate_id ) {
818
+ $rates = $this->get_all_rates();
819
+ return $rates[$rate_id];
820
+ }
821
+
822
+ public function get_all_rates() {
823
+ if ( class_exists( 'WC_Shipping_Zones' ) ) {
824
+ $zones = WC_Shipping_Zones::get_zones();
825
+ $zone0 = WC_Shipping_Zones::get_zone(0);
826
+ $zones[0] = $zone0->get_data();
827
+ $zones[0]['formatted_zone_location'] = $zone0->get_formatted_location();
828
+ $zones[0]['shipping_methods'] = $zone0->get_shipping_methods();
829
+ $rates = array();
830
+ foreach ( $zones as $zone ) {
831
+ foreach ( $zone['shipping_methods'] as $instance_id => $woo_shipping_method ) {
832
+ if ( $woo_shipping_method->id == $this->id ) {
833
+ $shipping_methods = $woo_shipping_method->get_shipping_methods();
834
+ foreach ( $shipping_methods as $shipping_method ) {
835
+ $id = $this->id . '_' . $woo_shipping_method->instance_id . '_' . sanitize_title($shipping_method['method_title'] );
836
+ $id = apply_filters( 'flexible_shipping_method_rate_id', $id, $shipping_method );
837
+ $shipping_method['instance_id'] = $woo_shipping_method->instance_id;
838
+ $rates[$id] = $shipping_method;
839
+ }
840
+ }
841
+ }
842
+ }
843
  }
844
+ else {
845
+ $shipping_methods = $this->get_shipping_methods();
846
+ $rates = array();
847
+ foreach ( $shipping_methods as $shipping_method ) {
848
+ $id = $this->id . '_' . $this->instance_id . '_' . sanitize_title($shipping_method['method_title'] );
849
+ $id = apply_filters( 'flexible_shipping_method_rate_id', $id, $shipping_method );
850
+ $rates[$id] = $shipping_method;
851
+ }
852
+ }
853
+ return $rates;
854
+ }
855
+
856
+ public function generate_header_html( $key, $data ) {
857
+ $field_key = $this->get_field_key( $key );
858
+ $defaults = array(
859
+ 'title' => '',
860
+ 'class' => '',
861
+ );
862
+ $data = wp_parse_args( $data, $defaults );
863
+ return sprintf( '<tr><td colspan="2"><h4 class="%1$s" id="%2$s">%3$s</h4></td></tr>', esc_attr( $data['class'] ), esc_attr( $field_key ), esc_html( $data['title'] ) );
864
+ }
865
+
866
+ /**
867
+ * Generate SaaS connection error field HTML.
868
+ *
869
+ * @param string $key
870
+ * @param array $data
871
+ *
872
+ * @return string
873
+ */
874
+ public function generate_saas_connection_error_html( $key, $data ) {
875
+ $field_key = $this->get_field_key( $key );
876
+ $defaults = array(
877
+ 'title' => '',
878
+ 'class' => '',
879
+ );
880
+ $data = wp_parse_args( $data, $defaults );
881
+ return sprintf( '<tr><td></td><td><span class="%1$s" id="%2$s">%3$s</span></td></tr>', esc_attr( $data['class'] ), esc_attr( $field_key ), $data['description'] );
882
+ }
883
+
884
+ /**
885
+ * Generate custom_services field HTML.
886
+ *
887
+ * @param string $key
888
+ * @param array $data
889
+ *
890
+ * @return string
891
+ */
892
+ public function generate_custom_services_html( $key, $data ) {
893
+ $field_key = $this->get_field_key( $key );
894
+ $defaults = array(
895
+ 'title' => '',
896
+ 'disabled' => false,
897
+ 'class' => '',
898
+ 'css' => '',
899
+ 'placeholder' => '',
900
+ 'type' => 'text',
901
+ 'desc_tip' => false,
902
+ 'description' => '',
903
+ 'custom_attributes' => array(),
904
+ 'services' => array()
905
+ );
906
+ $data = wp_parse_args( $data, $defaults );
907
+ ob_start();
908
+ $services = $data['services'];
909
+ include ( 'views/html-custom-services.php' );
910
+ return ob_get_clean();
911
+ }
912
+
913
+ /**
914
+ * Add beacon search data to fields.
915
+ *
916
+ * @param array $form_fields .
917
+ *
918
+ * @return array
919
+ */
920
+ private function add_beacon_search_data_to_fields( array $form_fields ) {
921
+ $modifier = new WooCommerceSettingsFieldsModifier();
922
+
923
+ return $modifier->append_beacon_search_data_to_fields( $form_fields );
924
+ }
925
 
926
+ private function package_subtotal( $items ) {
927
+ $subtotal = 0;
928
+ foreach( $items as $item )
929
+ {$subtotal += $item['line_subtotal'];}
930
+ return $subtotal;
931
  }
932
 
933
  }
classes/table-rate/views/html-ads.php CHANGED
@@ -1,8 +1,7 @@
1
- <div class="flexible-shipping-pro-box">
2
- <div class="metabox-holder">
3
- <div class="stuffbox">
4
- <h3 class="hndle"><?php _e( 'Get Flexible Shipping PRO!', 'flexible-shipping' ); ?></h3>
5
-
6
  <?php
7
  $fs_link = get_locale() === 'pl_PL' ? 'https://www.wpdesk.pl/sklep/flexible-shipping-pro-woocommerce/' : 'https://flexibleshipping.com/table-rate/';
8
  ?>
@@ -22,3 +21,4 @@
22
  </div>
23
  </div>
24
  </div>
 
1
+ <div class="fs-flexible-shipping-sidebar" style="height: auto;">
2
+ <div class="wpdesk-metabox">
3
+ <div class="wpdesk-stuffbox">
4
+ <h3 class="title"><?php _e( 'Get Flexible Shipping PRO!', 'flexible-shipping' ); ?></h3>
 
5
  <?php
6
  $fs_link = get_locale() === 'pl_PL' ? 'https://www.wpdesk.pl/sklep/flexible-shipping-pro-woocommerce/' : 'https://flexibleshipping.com/table-rate/';
7
  ?>
21
  </div>
22
  </div>
23
  </div>
24
+ <div class="clear"></div>
classes/table-rate/views/html-shipping-method-rules.php CHANGED
@@ -11,40 +11,53 @@
11
 
12
 
13
  $key = 'method_rules[xxx][based_on]';
14
- $args = array(
15
  'type' => 'select',
16
  'options' => $options_based_on,
 
 
 
 
17
  'return' => true,
18
  );
19
  $value = 'none';
20
- $field_based_on = woocommerce_form_field( $key, $args, $value );
21
 
22
  $key = 'method_rules[xxx][min]';
23
- $args = array(
24
  'type' => 'text',
25
  'return' => true,
26
- 'input_class' => array( 'wc_input_price' ),
 
 
 
27
  );
28
  $value = '';
29
- $field_min = woocommerce_form_field( $key, $args, wc_format_localized_price( $value ) );
30
 
31
  $key = 'method_rules[xxx][max]';
32
- $args = array(
33
  'type' => 'text',
34
  'return' => true,
35
- 'input_class' => array( 'wc_input_price' ),
 
 
 
36
  );
37
  $value = '';
38
- $field_max = woocommerce_form_field( $key, $args, wc_format_localized_price( $value ) );
39
 
40
  $key = 'method_rules[xxx][cost_per_order]';
41
- $args = array(
42
  'type' => 'text',
43
  'return' => true,
44
- 'input_class' => array( 'wc_input_price' ),
 
 
 
45
  );
46
  $value = '';
47
- $field_cost_per_order = woocommerce_form_field( $key, $args, wc_format_localized_price( $value ) );
48
 
49
  $count_rules = 0;
50
  ?>
@@ -95,57 +108,41 @@
95
  <td class="based_on">
96
  <?php
97
  $key = 'method_rules[' . $count_rules . '][based_on]';
98
- $args = array(
99
- 'type' => 'select',
100
- 'options' => $options_based_on,
101
- );
102
  $value = '';
103
  if ( isset( $rule['based_on'] ) ) {
104
  $value = $rule['based_on'];
105
  }
106
- woocommerce_form_field( $key, $args, $value );
107
  ?>
108
  </td>
109
  <td class="min">
110
  <?php
111
  $key = 'method_rules[' . $count_rules . '][min]';
112
- $args = array(
113
- 'type' => 'text',
114
- 'input_class' => array( 'wc_input_price' ),
115
- );
116
  $value = '';
117
  if ( isset( $rule['min'] ) ) {
118
  $value = $rule['min'];
119
  }
120
- woocommerce_form_field( $key, $args, wc_format_localized_price( $value ) );
121
  ?>
122
  </td>
123
  <td class="max">
124
  <?php
125
  $key = 'method_rules[' . $count_rules . '][max]';
126
- $args = array(
127
- 'type' => 'text',
128
- 'input_class' => array( 'wc_input_price' ),
129
- );
130
  $value = '';
131
  if ( isset( $rule['max'] ) ) {
132
  $value = $rule['max'];
133
  }
134
- woocommerce_form_field( $key, $args, wc_format_localized_price( $value ) );
135
  ?>
136
  </td>
137
  <td class="cost_per_order">
138
  <?php
139
  $key = 'method_rules[' . $count_rules . '][cost_per_order]';
140
- $args = array(
141
- 'type' => 'text',
142
- 'input_class' => array( 'wc_input_price' ),
143
- );
144
  $value = '';
145
  if ( isset( $rule['cost_per_order'] ) ) {
146
  $value = $rule['cost_per_order'];
147
  }
148
- woocommerce_form_field( $key, $args, wc_format_localized_price( $value ) );
149
  ?>
150
  </td>
151
  <?php do_action( 'flexible_shipping_method_rule_row', $rule, $count_rules ); ?>
11
 
12
 
13
  $key = 'method_rules[xxx][based_on]';
14
+ $args_based_on = array(
15
  'type' => 'select',
16
  'options' => $options_based_on,
17
+ 'input_class' => array( 'hs-beacon-search' ),
18
+ 'custom_attributes' => array(
19
+ 'data-beacon_search' => __( 'Based on', 'flexible-shipping' ),
20
+ ),
21
  'return' => true,
22
  );
23
  $value = 'none';
24
+ $field_based_on = woocommerce_form_field( $key, $args_based_on, $value );
25
 
26
  $key = 'method_rules[xxx][min]';
27
+ $args_min = array(
28
  'type' => 'text',
29
  'return' => true,
30
+ 'input_class' => array( 'wc_input_price', 'hs-beacon-search' ),
31
+ 'custom_attributes' => array(
32
+ 'data-beacon_search' => __( 'Min', 'flexible-shipping' ),
33
+ ),
34
  );
35
  $value = '';
36
+ $field_min = woocommerce_form_field( $key, $args_min, wc_format_localized_price( $value ) );
37
 
38
  $key = 'method_rules[xxx][max]';
39
+ $args_max = array(
40
  'type' => 'text',
41
  'return' => true,
42
+ 'input_class' => array( 'wc_input_price', 'hs-beacon-search' ),
43
+ 'custom_attributes' => array(
44
+ 'data-beacon_search' => __( 'Max', 'flexible-shipping' ),
45
+ ),
46
  );
47
  $value = '';
48
+ $field_max = woocommerce_form_field( $key, $args_max, wc_format_localized_price( $value ) );
49
 
50
  $key = 'method_rules[xxx][cost_per_order]';
51
+ $args_cost_per_order = array(
52
  'type' => 'text',
53
  'return' => true,
54
+ 'input_class' => array( 'wc_input_price', 'hs-beacon-search' ),
55
+ 'custom_attributes' => array(
56
+ 'data-beacon_search' => __( 'Cost per order', 'flexible-shipping' ),
57
+ ),
58
  );
59
  $value = '';
60
+ $field_cost_per_order = woocommerce_form_field( $key, $args_cost_per_order, wc_format_localized_price( $value ) );
61
 
62
  $count_rules = 0;
63
  ?>
108
  <td class="based_on">
109
  <?php
110
  $key = 'method_rules[' . $count_rules . '][based_on]';
 
 
 
 
111
  $value = '';
112
  if ( isset( $rule['based_on'] ) ) {
113
  $value = $rule['based_on'];
114
  }
115
+ echo woocommerce_form_field( $key, $args_based_on, $value );
116
  ?>
117
  </td>
118
  <td class="min">
119
  <?php
120
  $key = 'method_rules[' . $count_rules . '][min]';
 
 
 
 
121
  $value = '';
122
  if ( isset( $rule['min'] ) ) {
123
  $value = $rule['min'];
124
  }
125
+ echo woocommerce_form_field( $key, $args_min, wc_format_localized_price( $value ) );
126
  ?>
127
  </td>
128
  <td class="max">
129
  <?php
130
  $key = 'method_rules[' . $count_rules . '][max]';
 
 
 
 
131
  $value = '';
132
  if ( isset( $rule['max'] ) ) {
133
  $value = $rule['max'];
134
  }
135
+ echo woocommerce_form_field( $key, $args_max, wc_format_localized_price( $value ) );
136
  ?>
137
  </td>
138
  <td class="cost_per_order">
139
  <?php
140
  $key = 'method_rules[' . $count_rules . '][cost_per_order]';
 
 
 
 
141
  $value = '';
142
  if ( isset( $rule['cost_per_order'] ) ) {
143
  $value = $rule['cost_per_order'];
144
  }
145
+ echo woocommerce_form_field( $key, $args_cost_per_order, wc_format_localized_price( $value ) );
146
  ?>
147
  </td>
148
  <?php do_action( 'flexible_shipping_method_rule_row', $rule, $count_rules ); ?>
classes/table-rate/views/html-shipping-method-settings.php CHANGED
@@ -90,12 +90,6 @@
90
  </fieldset>
91
  </td>
92
  </tr>
93
-
94
- <?php
95
- if ( ! wpdesk_is_plugin_active( 'flexible-shipping-pro/flexible-shipping-pro.php' ) )
96
- include( 'html-ads.php' );
97
- ?>
98
-
99
  <script type="text/javascript">
100
  <?php
101
  if( version_compare( WC()->version, '2.6.0', ">=" ) ) :
90
  </fieldset>
91
  </td>
92
  </tr>
 
 
 
 
 
 
93
  <script type="text/javascript">
94
  <?php
95
  if( version_compare( WC()->version, '2.6.0', ">=" ) ) :
composer.lock CHANGED
@@ -4,7 +4,7 @@
4
  "Read more about it at https://getcomposer.org/doc/01-basic-usage.md#installing-dependencies",
5
  "This file is @generated automatically"
6
  ],
7
- "content-hash": "e410be98cc018f1ffdc9b5a6afc1b47c",
8
  "packages": [
9
  {
10
  "name": "psr/log",
@@ -319,16 +319,16 @@
319
  },
320
  {
321
  "name": "codeception/lib-asserts",
322
- "version": "1.2.0",
323
  "source": {
324
  "type": "git",
325
  "url": "https://github.com/Codeception/lib-asserts.git",
326
- "reference": "74bfe433af24e2f75c6386b9d843ec69029f4337"
327
  },
328
  "dist": {
329
  "type": "zip",
330
- "url": "https://api.github.com/repos/Codeception/lib-asserts/zipball/74bfe433af24e2f75c6386b9d843ec69029f4337",
331
- "reference": "74bfe433af24e2f75c6386b9d843ec69029f4337",
332
  "shasum": ""
333
  },
334
  "require": {
@@ -360,7 +360,7 @@
360
  "keywords": [
361
  "codeception"
362
  ],
363
- "time": "2020-02-07T17:47:55+00:00"
364
  },
365
  {
366
  "name": "codeception/lib-innerbrowser",
@@ -417,21 +417,21 @@
417
  },
418
  {
419
  "name": "codeception/module-asserts",
420
- "version": "1.1.1",
421
  "source": {
422
  "type": "git",
423
  "url": "https://github.com/Codeception/module-asserts.git",
424
- "reference": "87c83ca3ccfbc0d79f5effb57e1f82eeaab0cb3e"
425
  },
426
  "dist": {
427
  "type": "zip",
428
- "url": "https://api.github.com/repos/Codeception/module-asserts/zipball/87c83ca3ccfbc0d79f5effb57e1f82eeaab0cb3e",
429
- "reference": "87c83ca3ccfbc0d79f5effb57e1f82eeaab0cb3e",
430
  "shasum": ""
431
  },
432
  "require": {
433
  "codeception/codeception": "*@dev",
434
- "codeception/lib-asserts": "^1.0.0",
435
  "php": ">=5.6.0 <8.0"
436
  },
437
  "conflict": {
@@ -465,7 +465,7 @@
465
  "asserts",
466
  "codeception"
467
  ],
468
- "time": "2019-11-13T17:32:27+00:00"
469
  },
470
  {
471
  "name": "codeception/module-cli",
@@ -1231,16 +1231,16 @@
1231
  },
1232
  {
1233
  "name": "dealerdirect/phpcodesniffer-composer-installer",
1234
- "version": "v0.5.0",
1235
  "source": {
1236
  "type": "git",
1237
  "url": "https://github.com/Dealerdirect/phpcodesniffer-composer-installer.git",
1238
- "reference": "e749410375ff6fb7a040a68878c656c2e610b132"
1239
  },
1240
  "dist": {
1241
  "type": "zip",
1242
- "url": "https://api.github.com/repos/Dealerdirect/phpcodesniffer-composer-installer/zipball/e749410375ff6fb7a040a68878c656c2e610b132",
1243
- "reference": "e749410375ff6fb7a040a68878c656c2e610b132",
1244
  "shasum": ""
1245
  },
1246
  "require": {
@@ -1293,7 +1293,7 @@
1293
  "stylecheck",
1294
  "tests"
1295
  ],
1296
- "time": "2018-10-26T13:21:45+00:00"
1297
  },
1298
  {
1299
  "name": "dg/mysql-dump",
@@ -1677,23 +1677,24 @@
1677
  },
1678
  {
1679
  "name": "guzzlehttp/guzzle",
1680
- "version": "6.5.2",
1681
  "source": {
1682
  "type": "git",
1683
  "url": "https://github.com/guzzle/guzzle.git",
1684
- "reference": "43ece0e75098b7ecd8d13918293029e555a50f82"
1685
  },
1686
  "dist": {
1687
  "type": "zip",
1688
- "url": "https://api.github.com/repos/guzzle/guzzle/zipball/43ece0e75098b7ecd8d13918293029e555a50f82",
1689
- "reference": "43ece0e75098b7ecd8d13918293029e555a50f82",
1690
  "shasum": ""
1691
  },
1692
  "require": {
1693
  "ext-json": "*",
1694
  "guzzlehttp/promises": "^1.0",
1695
  "guzzlehttp/psr7": "^1.6.1",
1696
- "php": ">=5.5"
 
1697
  },
1698
  "require-dev": {
1699
  "ext-curl": "*",
@@ -1701,7 +1702,6 @@
1701
  "psr/log": "^1.1"
1702
  },
1703
  "suggest": {
1704
- "ext-intl": "Required for Internationalized Domain Name (IDN) support",
1705
  "psr/log": "Required for using the Log middleware"
1706
  },
1707
  "type": "library",
@@ -1740,7 +1740,7 @@
1740
  "rest",
1741
  "web service"
1742
  ],
1743
- "time": "2019-12-23T11:57:10+00:00"
1744
  },
1745
  {
1746
  "name": "guzzlehttp/promises",
@@ -2122,16 +2122,16 @@
2122
  },
2123
  {
2124
  "name": "lucatume/wp-browser",
2125
- "version": "2.4.3",
2126
  "source": {
2127
  "type": "git",
2128
  "url": "https://github.com/lucatume/wp-browser.git",
2129
- "reference": "57faa8527b8e35739c7457b7e9d3294974b79f6a"
2130
  },
2131
  "dist": {
2132
  "type": "zip",
2133
- "url": "https://api.github.com/repos/lucatume/wp-browser/zipball/57faa8527b8e35739c7457b7e9d3294974b79f6a",
2134
- "reference": "57faa8527b8e35739c7457b7e9d3294974b79f6a",
2135
  "shasum": ""
2136
  },
2137
  "require": {
@@ -2199,7 +2199,7 @@
2199
  "codeception",
2200
  "wordpress"
2201
  ],
2202
- "time": "2020-04-13T13:37:09+00:00"
2203
  },
2204
  {
2205
  "name": "matthiasmullie/minify",
@@ -3602,6 +3602,55 @@
3602
  "abandoned": true,
3603
  "time": "2017-06-30T09:13:00+00:00"
3604
  },
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
3605
  {
3606
  "name": "psr/http-message",
3607
  "version": "1.0.1",
@@ -4349,16 +4398,16 @@
4349
  },
4350
  {
4351
  "name": "squizlabs/php_codesniffer",
4352
- "version": "3.5.4",
4353
  "source": {
4354
  "type": "git",
4355
  "url": "https://github.com/squizlabs/PHP_CodeSniffer.git",
4356
- "reference": "dceec07328401de6211037abbb18bda423677e26"
4357
  },
4358
  "dist": {
4359
  "type": "zip",
4360
- "url": "https://api.github.com/repos/squizlabs/PHP_CodeSniffer/zipball/dceec07328401de6211037abbb18bda423677e26",
4361
- "reference": "dceec07328401de6211037abbb18bda423677e26",
4362
  "shasum": ""
4363
  },
4364
  "require": {
@@ -4396,7 +4445,7 @@
4396
  "phpcs",
4397
  "standards"
4398
  ],
4399
- "time": "2020-01-30T22:20:29+00:00"
4400
  },
4401
  {
4402
  "name": "symfony/browser-kit",
@@ -4913,6 +4962,68 @@
4913
  ],
4914
  "time": "2020-02-27T09:26:54+00:00"
4915
  },
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
4916
  {
4917
  "name": "symfony/polyfill-mbstring",
4918
  "version": "v1.15.0",
@@ -4972,6 +5083,61 @@
4972
  ],
4973
  "time": "2020-03-09T19:04:49+00:00"
4974
  },
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
4975
  {
4976
  "name": "symfony/process",
4977
  "version": "v3.4.39",
@@ -5193,16 +5359,16 @@
5193
  },
5194
  {
5195
  "name": "webmozart/assert",
5196
- "version": "1.7.0",
5197
  "source": {
5198
  "type": "git",
5199
  "url": "https://github.com/webmozart/assert.git",
5200
- "reference": "aed98a490f9a8f78468232db345ab9cf606cf598"
5201
  },
5202
  "dist": {
5203
  "type": "zip",
5204
- "url": "https://api.github.com/repos/webmozart/assert/zipball/aed98a490f9a8f78468232db345ab9cf606cf598",
5205
- "reference": "aed98a490f9a8f78468232db345ab9cf606cf598",
5206
  "shasum": ""
5207
  },
5208
  "require": {
@@ -5210,7 +5376,7 @@
5210
  "symfony/polyfill-ctype": "^1.8"
5211
  },
5212
  "conflict": {
5213
- "vimeo/psalm": "<3.6.0"
5214
  },
5215
  "require-dev": {
5216
  "phpunit/phpunit": "^4.8.36 || ^7.5.13"
@@ -5237,7 +5403,7 @@
5237
  "check",
5238
  "validate"
5239
  ],
5240
- "time": "2020-02-14T12:15:55+00:00"
5241
  },
5242
  {
5243
  "name": "wp-cli/cache-command",
@@ -6015,16 +6181,16 @@
6015
  },
6016
  {
6017
  "name": "wp-cli/extension-command",
6018
- "version": "v2.0.8",
6019
  "source": {
6020
  "type": "git",
6021
  "url": "https://github.com/wp-cli/extension-command.git",
6022
- "reference": "3f55805356ccc502f38a24f224b8943f181d4813"
6023
  },
6024
  "dist": {
6025
  "type": "zip",
6026
- "url": "https://api.github.com/repos/wp-cli/extension-command/zipball/3f55805356ccc502f38a24f224b8943f181d4813",
6027
- "reference": "3f55805356ccc502f38a24f224b8943f181d4813",
6028
  "shasum": ""
6029
  },
6030
  "require": {
@@ -6094,11 +6260,16 @@
6094
  "name": "Daniel Bachhuber",
6095
  "email": "daniel@runcommand.io",
6096
  "homepage": "https://runcommand.io"
 
 
 
 
 
6097
  }
6098
  ],
6099
  "description": "Manages plugins and themes, including installs, activations, and updates.",
6100
  "homepage": "https://github.com/wp-cli/extension-command",
6101
- "time": "2020-02-24T02:53:35+00:00"
6102
  },
6103
  {
6104
  "name": "wp-cli/i18n-command",
@@ -7370,18 +7541,66 @@
7370
  ],
7371
  "time": "2019-11-20T08:08:49+00:00"
7372
  },
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
7373
  {
7374
  "name": "wpdesk/wp-codeception",
7375
- "version": "1.5.20",
7376
  "source": {
7377
  "type": "git",
7378
  "url": "https://gitlab.com/wpdesk/wp-codeception.git",
7379
- "reference": "0dbf4c94d0f8467c4da43f20279fa97ab0036600"
7380
  },
7381
  "dist": {
7382
  "type": "zip",
7383
- "url": "https://gitlab.com/api/v4/projects/wpdesk%2Fwp-codeception/repository/archive.zip?sha=0dbf4c94d0f8467c4da43f20279fa97ab0036600",
7384
- "reference": "0dbf4c94d0f8467c4da43f20279fa97ab0036600",
7385
  "shasum": ""
7386
  },
7387
  "require": {
@@ -7435,7 +7654,52 @@
7435
  "codeception",
7436
  "wordpress"
7437
  ],
7438
- "time": "2020-04-13T18:08:33+00:00"
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
7439
  },
7440
  {
7441
  "name": "wpdesk/wp-logs",
@@ -7632,16 +7896,16 @@
7632
  },
7633
  {
7634
  "name": "wpdesk/wp-plugin-flow",
7635
- "version": "2.4.0",
7636
  "source": {
7637
  "type": "git",
7638
  "url": "https://gitlab.com/wpdesk/wp-plugin-flow.git",
7639
- "reference": "3d3e2103711ebe91e77829b75366dfe8e103b745"
7640
  },
7641
  "dist": {
7642
  "type": "zip",
7643
- "url": "https://gitlab.com/api/v4/projects/wpdesk%2Fwp-plugin-flow/repository/archive.zip?sha=3d3e2103711ebe91e77829b75366dfe8e103b745",
7644
- "reference": "3d3e2103711ebe91e77829b75366dfe8e103b745",
7645
  "shasum": ""
7646
  },
7647
  "require": {
@@ -7679,7 +7943,7 @@
7679
  "email": "krzysiek@wpdesk.pl"
7680
  }
7681
  ],
7682
- "time": "2019-11-13T13:20:09+00:00"
7683
  },
7684
  {
7685
  "name": "wpdesk/wp-pointer",
@@ -7774,16 +8038,16 @@
7774
  },
7775
  {
7776
  "name": "wpdesk/wp-wpdesk-composer",
7777
- "version": "2.6.4",
7778
  "source": {
7779
  "type": "git",
7780
  "url": "https://gitlab.com/wpdesk/wp-wpdesk-composer.git",
7781
- "reference": "b6b9e6a6594ca0526da8868f3ea5782a62622e96"
7782
  },
7783
  "dist": {
7784
  "type": "zip",
7785
- "url": "https://gitlab.com/api/v4/projects/wpdesk%2Fwp-wpdesk-composer/repository/archive.zip?sha=b6b9e6a6594ca0526da8868f3ea5782a62622e96",
7786
- "reference": "b6b9e6a6594ca0526da8868f3ea5782a62622e96",
7787
  "shasum": ""
7788
  },
7789
  "require": {
@@ -7791,7 +8055,8 @@
7791
  "ext-json": "*",
7792
  "gettext/gettext": "^4",
7793
  "matthiasmullie/minify": "^1.3",
7794
- "php": ">=5.6"
 
7795
  },
7796
  "require-dev": {
7797
  "composer/composer": "^1.8"
@@ -7812,7 +8077,7 @@
7812
  "email": "krzysiek@wpdesk.pl"
7813
  }
7814
  ],
7815
- "time": "2020-04-03T07:06:44+00:00"
7816
  },
7817
  {
7818
  "name": "wpdesk/wp-wpdesk-helper",
@@ -7922,16 +8187,16 @@
7922
  },
7923
  {
7924
  "name": "wpdesk/wp-wpdesk-tracker",
7925
- "version": "2.1.2",
7926
  "source": {
7927
  "type": "git",
7928
  "url": "https://gitlab.com/wpdesk/wp-wpdesk-tracker.git",
7929
- "reference": "de6363eee5ff8677e3f8610b592eb5acdd969a8c"
7930
  },
7931
  "dist": {
7932
  "type": "zip",
7933
- "url": "https://gitlab.com/api/v4/projects/wpdesk%2Fwp-wpdesk-tracker/repository/archive.zip?sha=de6363eee5ff8677e3f8610b592eb5acdd969a8c",
7934
- "reference": "de6363eee5ff8677e3f8610b592eb5acdd969a8c",
7935
  "shasum": ""
7936
  },
7937
  "require": {
@@ -7965,7 +8230,7 @@
7965
  "email": "krzysiek@wpdesk.pl"
7966
  }
7967
  ],
7968
- "time": "2020-03-06T11:13:37+00:00"
7969
  },
7970
  {
7971
  "name": "wpdesk/wp-wpdesk-tracker-deactivation",
4
  "Read more about it at https://getcomposer.org/doc/01-basic-usage.md#installing-dependencies",
5
  "This file is @generated automatically"
6
  ],
7
+ "content-hash": "e000ec3430fe46dc7860020d94bbb324",
8
  "packages": [
9
  {
10
  "name": "psr/log",
319
  },
320
  {
321
  "name": "codeception/lib-asserts",
322
+ "version": "1.12.0",
323
  "source": {
324
  "type": "git",
325
  "url": "https://github.com/Codeception/lib-asserts.git",
326
+ "reference": "acd0dc8b394595a74b58dcc889f72569ff7d8e71"
327
  },
328
  "dist": {
329
  "type": "zip",
330
+ "url": "https://api.github.com/repos/Codeception/lib-asserts/zipball/acd0dc8b394595a74b58dcc889f72569ff7d8e71",
331
+ "reference": "acd0dc8b394595a74b58dcc889f72569ff7d8e71",
332
  "shasum": ""
333
  },
334
  "require": {
360
  "keywords": [
361
  "codeception"
362
  ],
363
+ "time": "2020-04-17T18:20:46+00:00"
364
  },
365
  {
366
  "name": "codeception/lib-innerbrowser",
417
  },
418
  {
419
  "name": "codeception/module-asserts",
420
+ "version": "1.2.1",
421
  "source": {
422
  "type": "git",
423
  "url": "https://github.com/Codeception/module-asserts.git",
424
+ "reference": "79f13d05b63f2fceba4d0e78044bab668c9b2a6b"
425
  },
426
  "dist": {
427
  "type": "zip",
428
+ "url": "https://api.github.com/repos/Codeception/module-asserts/zipball/79f13d05b63f2fceba4d0e78044bab668c9b2a6b",
429
+ "reference": "79f13d05b63f2fceba4d0e78044bab668c9b2a6b",
430
  "shasum": ""
431
  },
432
  "require": {
433
  "codeception/codeception": "*@dev",
434
+ "codeception/lib-asserts": "^1.12.0",
435
  "php": ">=5.6.0 <8.0"
436
  },
437
  "conflict": {
465
  "asserts",
466
  "codeception"
467
  ],
468
+ "time": "2020-04-20T07:26:11+00:00"
469
  },
470
  {
471
  "name": "codeception/module-cli",
1231
  },
1232
  {
1233
  "name": "dealerdirect/phpcodesniffer-composer-installer",
1234
+ "version": "v0.6.2",
1235
  "source": {
1236
  "type": "git",
1237
  "url": "https://github.com/Dealerdirect/phpcodesniffer-composer-installer.git",
1238
+ "reference": "8001af8eb107fbfcedc31a8b51e20b07d85b457a"
1239
  },
1240
  "dist": {
1241
  "type": "zip",
1242
+ "url": "https://api.github.com/repos/Dealerdirect/phpcodesniffer-composer-installer/zipball/8001af8eb107fbfcedc31a8b51e20b07d85b457a",
1243
+ "reference": "8001af8eb107fbfcedc31a8b51e20b07d85b457a",
1244
  "shasum": ""
1245
  },
1246
  "require": {
1293
  "stylecheck",
1294
  "tests"
1295
  ],
1296
+ "time": "2020-01-29T20:22:20+00:00"
1297
  },
1298
  {
1299
  "name": "dg/mysql-dump",
1677
  },
1678
  {
1679
  "name": "guzzlehttp/guzzle",
1680
+ "version": "6.5.3",
1681
  "source": {
1682
  "type": "git",
1683
  "url": "https://github.com/guzzle/guzzle.git",
1684
+ "reference": "aab4ebd862aa7d04f01a4b51849d657db56d882e"
1685
  },
1686
  "dist": {
1687
  "type": "zip",
1688
+ "url": "https://api.github.com/repos/guzzle/guzzle/zipball/aab4ebd862aa7d04f01a4b51849d657db56d882e",
1689
+ "reference": "aab4ebd862aa7d04f01a4b51849d657db56d882e",
1690
  "shasum": ""
1691
  },
1692
  "require": {
1693
  "ext-json": "*",
1694
  "guzzlehttp/promises": "^1.0",
1695
  "guzzlehttp/psr7": "^1.6.1",
1696
+ "php": ">=5.5",
1697
+ "symfony/polyfill-intl-idn": "^1.11"
1698
  },
1699
  "require-dev": {
1700
  "ext-curl": "*",
1702
  "psr/log": "^1.1"
1703
  },
1704
  "suggest": {
 
1705
  "psr/log": "Required for using the Log middleware"
1706
  },
1707
  "type": "library",
1740
  "rest",
1741
  "web service"
1742
  ],
1743
+ "time": "2020-04-18T10:38:46+00:00"
1744
  },
1745
  {
1746
  "name": "guzzlehttp/promises",
2122
  },
2123
  {
2124
  "name": "lucatume/wp-browser",
2125
+ "version": "2.4.7",
2126
  "source": {
2127
  "type": "git",
2128
  "url": "https://github.com/lucatume/wp-browser.git",
2129
+ "reference": "393a4cc5c0c3b6a417d7715231dcf95e43b4b659"
2130
  },
2131
  "dist": {
2132
  "type": "zip",
2133
+ "url": "https://api.github.com/repos/lucatume/wp-browser/zipball/393a4cc5c0c3b6a417d7715231dcf95e43b4b659",
2134
+ "reference": "393a4cc5c0c3b6a417d7715231dcf95e43b4b659",
2135
  "shasum": ""
2136
  },
2137
  "require": {
2199
  "codeception",
2200
  "wordpress"
2201
  ],
2202
+ "time": "2020-04-23T16:21:02+00:00"
2203
  },
2204
  {
2205
  "name": "matthiasmullie/minify",
3602
  "abandoned": true,
3603
  "time": "2017-06-30T09:13:00+00:00"
3604
  },
3605
+ {
3606
+ "name": "psr/container",
3607
+ "version": "1.0.0",
3608
+ "source": {
3609
+ "type": "git",
3610
+ "url": "https://github.com/php-fig/container.git",
3611
+ "reference": "b7ce3b176482dbbc1245ebf52b181af44c2cf55f"
3612
+ },
3613
+ "dist": {
3614
+ "type": "zip",
3615
+ "url": "https://api.github.com/repos/php-fig/container/zipball/b7ce3b176482dbbc1245ebf52b181af44c2cf55f",
3616
+ "reference": "b7ce3b176482dbbc1245ebf52b181af44c2cf55f",
3617
+ "shasum": ""
3618
+ },
3619
+ "require": {
3620
+ "php": ">=5.3.0"
3621
+ },
3622
+ "type": "library",
3623
+ "extra": {
3624
+ "branch-alias": {
3625
+ "dev-master": "1.0.x-dev"
3626
+ }
3627
+ },
3628
+ "autoload": {
3629
+ "psr-4": {
3630
+ "Psr\\Container\\": "src/"
3631
+ }
3632
+ },
3633
+ "notification-url": "https://packagist.org/downloads/",
3634
+ "license": [
3635
+ "MIT"
3636
+ ],
3637
+ "authors": [
3638
+ {
3639
+ "name": "PHP-FIG",
3640
+ "homepage": "http://www.php-fig.org/"
3641
+ }
3642
+ ],
3643
+ "description": "Common Container Interface (PHP FIG PSR-11)",
3644
+ "homepage": "https://github.com/php-fig/container",
3645
+ "keywords": [
3646
+ "PSR-11",
3647
+ "container",
3648
+ "container-interface",
3649
+ "container-interop",
3650
+ "psr"
3651
+ ],
3652
+ "time": "2017-02-14T16:28:37+00:00"
3653
+ },
3654
  {
3655
  "name": "psr/http-message",
3656
  "version": "1.0.1",
4398
  },
4399
  {
4400
  "name": "squizlabs/php_codesniffer",
4401
+ "version": "3.5.5",
4402
  "source": {
4403
  "type": "git",
4404
  "url": "https://github.com/squizlabs/PHP_CodeSniffer.git",
4405
+ "reference": "73e2e7f57d958e7228fce50dc0c61f58f017f9f6"
4406
  },
4407
  "dist": {
4408
  "type": "zip",
4409
+ "url": "https://api.github.com/repos/squizlabs/PHP_CodeSniffer/zipball/73e2e7f57d958e7228fce50dc0c61f58f017f9f6",
4410
+ "reference": "73e2e7f57d958e7228fce50dc0c61f58f017f9f6",
4411
  "shasum": ""
4412
  },
4413
  "require": {
4445
  "phpcs",
4446
  "standards"
4447
  ],
4448
+ "time": "2020-04-17T01:09:41+00:00"
4449
  },
4450
  {
4451
  "name": "symfony/browser-kit",
4962
  ],
4963
  "time": "2020-02-27T09:26:54+00:00"
4964
  },
4965
+ {
4966
+ "name": "symfony/polyfill-intl-idn",
4967
+ "version": "v1.15.0",
4968
+ "source": {
4969
+ "type": "git",
4970
+ "url": "https://github.com/symfony/polyfill-intl-idn.git",
4971
+ "reference": "47bd6aa45beb1cd7c6a16b7d1810133b728bdfcf"
4972
+ },
4973
+ "dist": {
4974
+ "type": "zip",
4975
+ "url": "https://api.github.com/repos/symfony/polyfill-intl-idn/zipball/47bd6aa45beb1cd7c6a16b7d1810133b728bdfcf",
4976
+ "reference": "47bd6aa45beb1cd7c6a16b7d1810133b728bdfcf",
4977
+ "shasum": ""
4978
+ },
4979
+ "require": {
4980
+ "php": ">=5.3.3",
4981
+ "symfony/polyfill-mbstring": "^1.3",
4982
+ "symfony/polyfill-php72": "^1.10"
4983
+ },
4984
+ "suggest": {
4985
+ "ext-intl": "For best performance"
4986
+ },
4987
+ "type": "library",
4988
+ "extra": {
4989
+ "branch-alias": {
4990
+ "dev-master": "1.15-dev"
4991
+ }
4992
+ },
4993
+ "autoload": {
4994
+ "psr-4": {
4995
+ "Symfony\\Polyfill\\Intl\\Idn\\": ""
4996
+ },
4997
+ "files": [
4998
+ "bootstrap.php"
4999
+ ]
5000
+ },
5001
+ "notification-url": "https://packagist.org/downloads/",
5002
+ "license": [
5003
+ "MIT"
5004
+ ],
5005
+ "authors": [
5006
+ {
5007
+ "name": "Laurent Bassin",
5008
+ "email": "laurent@bassin.info"
5009
+ },
5010
+ {
5011
+ "name": "Symfony Community",
5012
+ "homepage": "https://symfony.com/contributors"
5013
+ }
5014
+ ],
5015
+ "description": "Symfony polyfill for intl's idn_to_ascii and idn_to_utf8 functions",
5016
+ "homepage": "https://symfony.com",
5017
+ "keywords": [
5018
+ "compatibility",
5019
+ "idn",
5020
+ "intl",
5021
+ "polyfill",
5022
+ "portable",
5023
+ "shim"
5024
+ ],
5025
+ "time": "2020-03-09T19:04:49+00:00"
5026
+ },
5027
  {
5028
  "name": "symfony/polyfill-mbstring",
5029
  "version": "v1.15.0",
5083
  ],
5084
  "time": "2020-03-09T19:04:49+00:00"
5085
  },
5086
+ {
5087
+ "name": "symfony/polyfill-php72",
5088
+ "version": "v1.15.0",
5089
+ "source": {
5090
+ "type": "git",
5091
+ "url": "https://github.com/symfony/polyfill-php72.git",
5092
+ "reference": "37b0976c78b94856543260ce09b460a7bc852747"
5093
+ },
5094
+ "dist": {
5095
+ "type": "zip",
5096
+ "url": "https://api.github.com/repos/symfony/polyfill-php72/zipball/37b0976c78b94856543260ce09b460a7bc852747",
5097
+ "reference": "37b0976c78b94856543260ce09b460a7bc852747",
5098
+ "shasum": ""
5099
+ },
5100
+ "require": {
5101
+ "php": ">=5.3.3"
5102
+ },
5103
+ "type": "library",
5104
+ "extra": {
5105
+ "branch-alias": {
5106
+ "dev-master": "1.15-dev"
5107
+ }
5108
+ },
5109
+ "autoload": {
5110
+ "psr-4": {
5111
+ "Symfony\\Polyfill\\Php72\\": ""
5112
+ },
5113
+ "files": [
5114
+ "bootstrap.php"
5115
+ ]
5116
+ },
5117
+ "notification-url": "https://packagist.org/downloads/",
5118
+ "license": [
5119
+ "MIT"
5120
+ ],
5121
+ "authors": [
5122
+ {
5123
+ "name": "Nicolas Grekas",
5124
+ "email": "p@tchwork.com"
5125
+ },
5126
+ {
5127
+ "name": "Symfony Community",
5128
+ "homepage": "https://symfony.com/contributors"
5129
+ }
5130
+ ],
5131
+ "description": "Symfony polyfill backporting some PHP 7.2+ features to lower PHP versions",
5132
+ "homepage": "https://symfony.com",
5133
+ "keywords": [
5134
+ "compatibility",
5135
+ "polyfill",
5136
+ "portable",
5137
+ "shim"
5138
+ ],
5139
+ "time": "2020-02-27T09:26:54+00:00"
5140
+ },
5141
  {
5142
  "name": "symfony/process",
5143
  "version": "v3.4.39",
5359
  },
5360
  {
5361
  "name": "webmozart/assert",
5362
+ "version": "1.8.0",
5363
  "source": {
5364
  "type": "git",
5365
  "url": "https://github.com/webmozart/assert.git",
5366
+ "reference": "ab2cb0b3b559010b75981b1bdce728da3ee90ad6"
5367
  },
5368
  "dist": {
5369
  "type": "zip",
5370
+ "url": "https://api.github.com/repos/webmozart/assert/zipball/ab2cb0b3b559010b75981b1bdce728da3ee90ad6",
5371
+ "reference": "ab2cb0b3b559010b75981b1bdce728da3ee90ad6",
5372
  "shasum": ""
5373
  },
5374
  "require": {
5376
  "symfony/polyfill-ctype": "^1.8"
5377
  },
5378
  "conflict": {
5379
+ "vimeo/psalm": "<3.9.1"
5380
  },
5381
  "require-dev": {
5382
  "phpunit/phpunit": "^4.8.36 || ^7.5.13"
5403
  "check",
5404
  "validate"
5405
  ],
5406
+ "time": "2020-04-18T12:12:48+00:00"
5407
  },
5408
  {
5409
  "name": "wp-cli/cache-command",
6181
  },
6182
  {
6183
  "name": "wp-cli/extension-command",
6184
+ "version": "v2.0.9",
6185
  "source": {
6186
  "type": "git",
6187
  "url": "https://github.com/wp-cli/extension-command.git",
6188
+ "reference": "b6b042fbeb7b3765e28b92e2971739af3d4ee888"
6189
  },
6190
  "dist": {
6191
  "type": "zip",
6192
+ "url": "https://api.github.com/repos/wp-cli/extension-command/zipball/b6b042fbeb7b3765e28b92e2971739af3d4ee888",
6193
+ "reference": "b6b042fbeb7b3765e28b92e2971739af3d4ee888",
6194
  "shasum": ""
6195
  },
6196
  "require": {
6260
  "name": "Daniel Bachhuber",
6261
  "email": "daniel@runcommand.io",
6262
  "homepage": "https://runcommand.io"
6263
+ },
6264
+ {
6265
+ "name": "Alain Schlesser",
6266
+ "email": "alain.schlesser@gmail.com",
6267
+ "homepage": "https://www.alainschlesser.com"
6268
  }
6269
  ],
6270
  "description": "Manages plugins and themes, including installs, activations, and updates.",
6271
  "homepage": "https://github.com/wp-cli/extension-command",
6272
+ "time": "2020-04-13T14:55:45+00:00"
6273
  },
6274
  {
6275
  "name": "wp-cli/i18n-command",
7541
  ],
7542
  "time": "2019-11-20T08:08:49+00:00"
7543
  },
7544
+ {
7545
+ "name": "wpdesk/wp-code-sniffer",
7546
+ "version": "1.0.1",
7547
+ "source": {
7548
+ "type": "git",
7549
+ "url": "https://gitlab.com/wpdesk/wp-code-sniffer.git",
7550
+ "reference": "3e14d2e64b4b13ab241403dbda8429f61da1f4be"
7551
+ },
7552
+ "dist": {
7553
+ "type": "zip",
7554
+ "url": "https://gitlab.com/api/v4/projects/wpdesk%2Fwp-code-sniffer/repository/archive.zip?sha=3e14d2e64b4b13ab241403dbda8429f61da1f4be",
7555
+ "reference": "3e14d2e64b4b13ab241403dbda8429f61da1f4be",
7556
+ "shasum": ""
7557
+ },
7558
+ "require": {
7559
+ "dealerdirect/phpcodesniffer-composer-installer": "^0.6.2",
7560
+ "phpcompatibility/php-compatibility": "^9.3",
7561
+ "squizlabs/php_codesniffer": "^3.5",
7562
+ "wp-coding-standards/wpcs": "^2.2"
7563
+ },
7564
+ "require-dev": {
7565
+ "10up/wp_mock": "*",
7566
+ "mockery/mockery": "*",
7567
+ "phpunit/phpunit": "<7"
7568
+ },
7569
+ "type": "phpcodesniffer-standard",
7570
+ "extra": {
7571
+ "class": "WPDesk\\Composer\\Codeception\\Plugin"
7572
+ },
7573
+ "notification-url": "https://packagist.org/downloads/",
7574
+ "license": [
7575
+ "MIT"
7576
+ ],
7577
+ "authors": [
7578
+ {
7579
+ "name": "grola",
7580
+ "email": "grola@wpdesk.net"
7581
+ }
7582
+ ],
7583
+ "description": "Library for WP Desk Coding standards in plugins.",
7584
+ "homepage": "https://gitlab.com/wpdesk/wp-code-sniffer",
7585
+ "keywords": [
7586
+ "admin",
7587
+ "code sniffer",
7588
+ "wordpress"
7589
+ ],
7590
+ "time": "2020-04-20T12:25:18+00:00"
7591
+ },
7592
  {
7593
  "name": "wpdesk/wp-codeception",
7594
+ "version": "1.5.24",
7595
  "source": {
7596
  "type": "git",
7597
  "url": "https://gitlab.com/wpdesk/wp-codeception.git",
7598
+ "reference": "04a40465fab6e07cf2ece61e86f547c7598c044e"
7599
  },
7600
  "dist": {
7601
  "type": "zip",
7602
+ "url": "https://gitlab.com/api/v4/projects/wpdesk%2Fwp-codeception/repository/archive.zip?sha=04a40465fab6e07cf2ece61e86f547c7598c044e",
7603
+ "reference": "04a40465fab6e07cf2ece61e86f547c7598c044e",
7604
  "shasum": ""
7605
  },
7606
  "require": {
7654
  "codeception",
7655
  "wordpress"
7656
  ],
7657
+ "time": "2020-04-22T09:22:48+00:00"
7658
+ },
7659
+ {
7660
+ "name": "wpdesk/wp-helpscout-beacon",
7661
+ "version": "1.2.0",
7662
+ "source": {
7663
+ "type": "git",
7664
+ "url": "https://gitlab.com/wpdesk/wp-helpscout-beacon.git",
7665
+ "reference": "d697ede98120649ff5cea052cab0b04f5ea8acb2"
7666
+ },
7667
+ "dist": {
7668
+ "type": "zip",
7669
+ "url": "https://gitlab.com/api/v4/projects/wpdesk%2Fwp-helpscout-beacon/repository/archive.zip?sha=d697ede98120649ff5cea052cab0b04f5ea8acb2",
7670
+ "reference": "d697ede98120649ff5cea052cab0b04f5ea8acb2",
7671
+ "shasum": ""
7672
+ },
7673
+ "require": {
7674
+ "php": ">=5.6",
7675
+ "psr/container": "^1.0"
7676
+ },
7677
+ "require-dev": {
7678
+ "10up/wp_mock": "*",
7679
+ "mockery/mockery": "*",
7680
+ "phpunit/phpunit": "^5",
7681
+ "squizlabs/php_codesniffer": "^3.0.2",
7682
+ "wimg/php-compatibility": "^8",
7683
+ "wp-coding-standards/wpcs": "^0.14.1",
7684
+ "wpdesk/wp-wpdesk-composer": "^2.6"
7685
+ },
7686
+ "type": "library",
7687
+ "autoload": {
7688
+ "psr-4": {
7689
+ "WPDesk\\Beacon\\": "src/"
7690
+ }
7691
+ },
7692
+ "notification-url": "https://packagist.org/downloads/",
7693
+ "license": [
7694
+ "MIT"
7695
+ ],
7696
+ "authors": [
7697
+ {
7698
+ "name": "Krzysiek",
7699
+ "email": "krzysiek@wpdesk.pl"
7700
+ }
7701
+ ],
7702
+ "time": "2020-04-24T10:23:45+00:00"
7703
  },
7704
  {
7705
  "name": "wpdesk/wp-logs",
7896
  },
7897
  {
7898
  "name": "wpdesk/wp-plugin-flow",
7899
+ "version": "2.6.0",
7900
  "source": {
7901
  "type": "git",
7902
  "url": "https://gitlab.com/wpdesk/wp-plugin-flow.git",
7903
+ "reference": "5e6a816a9afea00bce3a70ac8569d7b4c6d33576"
7904
  },
7905
  "dist": {
7906
  "type": "zip",
7907
+ "url": "https://gitlab.com/api/v4/projects/wpdesk%2Fwp-plugin-flow/repository/archive.zip?sha=5e6a816a9afea00bce3a70ac8569d7b4c6d33576",
7908
+ "reference": "5e6a816a9afea00bce3a70ac8569d7b4c6d33576",
7909
  "shasum": ""
7910
  },
7911
  "require": {
7943
  "email": "krzysiek@wpdesk.pl"
7944
  }
7945
  ],
7946
+ "time": "2020-04-15T15:17:53+00:00"
7947
  },
7948
  {
7949
  "name": "wpdesk/wp-pointer",
8038
  },
8039
  {
8040
  "name": "wpdesk/wp-wpdesk-composer",
8041
+ "version": "2.8.0",
8042
  "source": {
8043
  "type": "git",
8044
  "url": "https://gitlab.com/wpdesk/wp-wpdesk-composer.git",
8045
+ "reference": "627ad5dcfbc6d793a4cc96d3b5b4b44419ea719a"
8046
  },
8047
  "dist": {
8048
  "type": "zip",
8049
+ "url": "https://gitlab.com/api/v4/projects/wpdesk%2Fwp-wpdesk-composer/repository/archive.zip?sha=627ad5dcfbc6d793a4cc96d3b5b4b44419ea719a",
8050
+ "reference": "627ad5dcfbc6d793a4cc96d3b5b4b44419ea719a",
8051
  "shasum": ""
8052
  },
8053
  "require": {
8055
  "ext-json": "*",
8056
  "gettext/gettext": "^4",
8057
  "matthiasmullie/minify": "^1.3",
8058
+ "php": ">=5.6",
8059
+ "wpdesk/wp-code-sniffer": "^1.0"
8060
  },
8061
  "require-dev": {
8062
  "composer/composer": "^1.8"
8077
  "email": "krzysiek@wpdesk.pl"
8078
  }
8079
  ],
8080
+ "time": "2020-04-27T07:37:18+00:00"
8081
  },
8082
  {
8083
  "name": "wpdesk/wp-wpdesk-helper",
8187
  },
8188
  {
8189
  "name": "wpdesk/wp-wpdesk-tracker",
8190
+ "version": "2.2.1",
8191
  "source": {
8192
  "type": "git",
8193
  "url": "https://gitlab.com/wpdesk/wp-wpdesk-tracker.git",
8194
+ "reference": "622158524e8bcaae436783c1741904fc314d08b7"
8195
  },
8196
  "dist": {
8197
  "type": "zip",
8198
+ "url": "https://gitlab.com/api/v4/projects/wpdesk%2Fwp-wpdesk-tracker/repository/archive.zip?sha=622158524e8bcaae436783c1741904fc314d08b7",
8199
+ "reference": "622158524e8bcaae436783c1741904fc314d08b7",
8200
  "shasum": ""
8201
  },
8202
  "require": {
8230
  "email": "krzysiek@wpdesk.pl"
8231
  }
8232
  ],
8233
+ "time": "2020-04-15T08:00:06+00:00"
8234
  },
8235
  {
8236
  "name": "wpdesk/wp-wpdesk-tracker-deactivation",
flexible-shipping.php CHANGED
@@ -3,7 +3,7 @@
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: 3.9.16
7
  * Author: WP Desk
8
  * Author URI: https://www.wpdesk.net/
9
  * Text Domain: flexible-shipping
@@ -38,8 +38,8 @@ if ( ! defined( 'ABSPATH' ) ) {
38
  } // Exit if accessed directly
39
 
40
  /* THESE TWO VARIABLES CAN BE CHANGED AUTOMATICALLY */
41
- $plugin_version = '3.9.16';
42
- $plugin_release_timestamp = '2020-04-14 12:28';
43
 
44
  $plugin_name = 'Flexible Shipping';
45
  $product_id = 'Flexible Shipping';
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: 3.9.17
7
  * Author: WP Desk
8
  * Author URI: https://www.wpdesk.net/
9
  * Text Domain: flexible-shipping
38
  } // Exit if accessed directly
39
 
40
  /* THESE TWO VARIABLES CAN BE CHANGED AUTOMATICALLY */
41
+ $plugin_version = '3.9.17';
42
+ $plugin_release_timestamp = '2020-04-27 14:51';
43
 
44
  $plugin_name = 'Flexible Shipping';
45
  $product_id = 'Flexible Shipping';
readme.txt CHANGED
@@ -1,10 +1,10 @@
1
  === Table Rate for WooCommerce by Flexible Shipping ===
2
  Contributors: wpdesk,dyszczo,grola,piotrpo,marcinkolanko
3
  Donate link: https://flexibleshipping.com/table-rate/
4
- Tags: table rate, table rate shipping, conditional shipping, shipping method, 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, shipping, free shipping
5
  Requires at least: 4.5
6
  Tested up to: 5.4
7
- Stable tag: 3.9.16
8
  Requires PHP: 5.6
9
  License: GPLv3 or later
10
  License URI: http://www.gnu.org/licenses/gpl-3.0.html
@@ -171,6 +171,10 @@ If you are upgrading from the old Flexible Shipping version (1.3.2, woo-flexible
171
 
172
  == Changelog ==
173
 
 
 
 
 
174
  = 3.9.16 - 2020-04-14 =
175
  * Fixed warning in cart and checkout when no shipping methods selected
176
 
1
  === Table Rate for WooCommerce by Flexible Shipping ===
2
  Contributors: wpdesk,dyszczo,grola,piotrpo,marcinkolanko
3
  Donate link: https://flexibleshipping.com/table-rate/
4
+ Tags: table rate, table rate shipping, conditional shipping, shipping method, 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, shipping, free shipping, advanced shipping
5
  Requires at least: 4.5
6
  Tested up to: 5.4
7
+ Stable tag: 3.9.17
8
  Requires PHP: 5.6
9
  License: GPLv3 or later
10
  License URI: http://www.gnu.org/licenses/gpl-3.0.html
171
 
172
  == Changelog ==
173
 
174
+ = 3.9.17 - 2020-04-24 =
175
+ * Added Beacon functionality for Flexible Shipping PRO
176
+ * Changed PRO advertising
177
+
178
  = 3.9.16 - 2020-04-14 =
179
  * Fixed warning in cart and checkout when no shipping methods selected
180
 
vendor/autoload.php CHANGED
@@ -4,4 +4,4 @@
4
 
5
  require_once __DIR__ . '/composer/autoload_real.php';
6
 
7
- return ComposerAutoloaderInit94c0b8b721f071900d92e6dbc490c26c::getLoader();
4
 
5
  require_once __DIR__ . '/composer/autoload_real.php';
6
 
7
+ return ComposerAutoloaderInit1c58ffcecd0c6a4ac17febc916c815e3::getLoader();
vendor/composer/autoload_classmap.php CHANGED
@@ -107,6 +107,11 @@ return array(
107
  'FSVendor\\WPDesk\\ABTesting\\ABTest\\EqualGroupsRandomABTest' => $baseDir . '/vendor_prefixed/wpdesk/wp-abtesting/src/ABTest/EqualGroupsRandomABTest.php',
108
  'FSVendor\\WPDesk\\ABTesting\\ABVariant' => $baseDir . '/vendor_prefixed/wpdesk/wp-abtesting/src/ABVariant.php',
109
  'FSVendor\\WPDesk\\ABTesting\\ABVariant\\BasicABVariant' => $baseDir . '/vendor_prefixed/wpdesk/wp-abtesting/src/ABVariant/BasicABVariant.php',
 
 
 
 
 
110
  'FSVendor\\WPDesk\\Codeception\\Command\\AcceptanceTestGenerator' => $baseDir . '/vendor_prefixed/wpdesk/wp-codeception/src/WPDesk/Codeception/Command/AcceptanceTestGenerator.php',
111
  'FSVendor\\WPDesk\\Codeception\\Command\\GeneratePluginActivation' => $baseDir . '/vendor_prefixed/wpdesk/wp-codeception/src/WPDesk/Codeception/Command/GeneratePluginActivation.php',
112
  'FSVendor\\WPDesk\\Codeception\\Command\\GenerateWooCommerce' => $baseDir . '/vendor_prefixed/wpdesk/wp-codeception/src/WPDesk/Codeception/Command/GenerateWooCommerce.php',
107
  'FSVendor\\WPDesk\\ABTesting\\ABTest\\EqualGroupsRandomABTest' => $baseDir . '/vendor_prefixed/wpdesk/wp-abtesting/src/ABTest/EqualGroupsRandomABTest.php',
108
  'FSVendor\\WPDesk\\ABTesting\\ABVariant' => $baseDir . '/vendor_prefixed/wpdesk/wp-abtesting/src/ABVariant.php',
109
  'FSVendor\\WPDesk\\ABTesting\\ABVariant\\BasicABVariant' => $baseDir . '/vendor_prefixed/wpdesk/wp-abtesting/src/ABVariant/BasicABVariant.php',
110
+ 'FSVendor\\WPDesk\\Beacon\\Beacon' => $baseDir . '/vendor_prefixed/wpdesk/wp-helpscout-beacon/src/Beacon/Beacon.php',
111
+ 'FSVendor\\WPDesk\\Beacon\\BeaconGetShouldShowStrategy' => $baseDir . '/vendor_prefixed/wpdesk/wp-helpscout-beacon/src/Beacon/BeaconGetShouldShowStrategy.php',
112
+ 'FSVendor\\WPDesk\\Beacon\\BeaconPro' => $baseDir . '/vendor_prefixed/wpdesk/wp-helpscout-beacon/src/Beacon/BeaconPro.php',
113
+ 'FSVendor\\WPDesk\\Beacon\\BeaconShouldShowStrategy' => $baseDir . '/vendor_prefixed/wpdesk/wp-helpscout-beacon/src/Beacon/BeaconShouldShowStrategy.php',
114
+ 'FSVendor\\WPDesk\\Beacon\\Beacon\\WooCommerceSettingsFieldsModifier' => $baseDir . '/vendor_prefixed/wpdesk/wp-helpscout-beacon/src/Beacon/WooCommerceSettingsFieldsModifier.php',
115
  'FSVendor\\WPDesk\\Codeception\\Command\\AcceptanceTestGenerator' => $baseDir . '/vendor_prefixed/wpdesk/wp-codeception/src/WPDesk/Codeception/Command/AcceptanceTestGenerator.php',
116
  'FSVendor\\WPDesk\\Codeception\\Command\\GeneratePluginActivation' => $baseDir . '/vendor_prefixed/wpdesk/wp-codeception/src/WPDesk/Codeception/Command/GeneratePluginActivation.php',
117
  'FSVendor\\WPDesk\\Codeception\\Command\\GenerateWooCommerce' => $baseDir . '/vendor_prefixed/wpdesk/wp-codeception/src/WPDesk/Codeception/Command/GenerateWooCommerce.php',
vendor/composer/autoload_real.php CHANGED
@@ -2,7 +2,7 @@
2
 
3
  // autoload_real.php @generated by Composer
4
 
5
- class ComposerAutoloaderInit94c0b8b721f071900d92e6dbc490c26c
6
  {
7
  private static $loader;
8
 
@@ -19,15 +19,15 @@ class ComposerAutoloaderInit94c0b8b721f071900d92e6dbc490c26c
19
  return self::$loader;
20
  }
21
 
22
- spl_autoload_register(array('ComposerAutoloaderInit94c0b8b721f071900d92e6dbc490c26c', 'loadClassLoader'), true, true);
23
  self::$loader = $loader = new \Composer\Autoload\ClassLoader();
24
- spl_autoload_unregister(array('ComposerAutoloaderInit94c0b8b721f071900d92e6dbc490c26c', 'loadClassLoader'));
25
 
26
  $useStaticLoader = PHP_VERSION_ID >= 50600 && !defined('HHVM_VERSION') && (!function_exists('zend_loader_file_encoded') || !zend_loader_file_encoded());
27
  if ($useStaticLoader) {
28
  require_once __DIR__ . '/autoload_static.php';
29
 
30
- call_user_func(\Composer\Autoload\ComposerStaticInit94c0b8b721f071900d92e6dbc490c26c::getInitializer($loader));
31
  } else {
32
  $map = require __DIR__ . '/autoload_namespaces.php';
33
  foreach ($map as $namespace => $path) {
2
 
3
  // autoload_real.php @generated by Composer
4
 
5
+ class ComposerAutoloaderInit1c58ffcecd0c6a4ac17febc916c815e3
6
  {
7
  private static $loader;
8
 
19
  return self::$loader;
20
  }
21
 
22
+ spl_autoload_register(array('ComposerAutoloaderInit1c58ffcecd0c6a4ac17febc916c815e3', 'loadClassLoader'), true, true);
23
  self::$loader = $loader = new \Composer\Autoload\ClassLoader();
24
+ spl_autoload_unregister(array('ComposerAutoloaderInit1c58ffcecd0c6a4ac17febc916c815e3', 'loadClassLoader'));
25
 
26
  $useStaticLoader = PHP_VERSION_ID >= 50600 && !defined('HHVM_VERSION') && (!function_exists('zend_loader_file_encoded') || !zend_loader_file_encoded());
27
  if ($useStaticLoader) {
28
  require_once __DIR__ . '/autoload_static.php';
29
 
30
+ call_user_func(\Composer\Autoload\ComposerStaticInit1c58ffcecd0c6a4ac17febc916c815e3::getInitializer($loader));
31
  } else {
32
  $map = require __DIR__ . '/autoload_namespaces.php';
33
  foreach ($map as $namespace => $path) {
vendor/composer/autoload_static.php CHANGED
@@ -4,7 +4,7 @@
4
 
5
  namespace Composer\Autoload;
6
 
7
- class ComposerStaticInit94c0b8b721f071900d92e6dbc490c26c
8
  {
9
  public static $prefixLengthsPsr4 = array (
10
  'P' =>
@@ -122,6 +122,11 @@ class ComposerStaticInit94c0b8b721f071900d92e6dbc490c26c
122
  'FSVendor\\WPDesk\\ABTesting\\ABTest\\EqualGroupsRandomABTest' => __DIR__ . '/../..' . '/vendor_prefixed/wpdesk/wp-abtesting/src/ABTest/EqualGroupsRandomABTest.php',
123
  'FSVendor\\WPDesk\\ABTesting\\ABVariant' => __DIR__ . '/../..' . '/vendor_prefixed/wpdesk/wp-abtesting/src/ABVariant.php',
124
  'FSVendor\\WPDesk\\ABTesting\\ABVariant\\BasicABVariant' => __DIR__ . '/../..' . '/vendor_prefixed/wpdesk/wp-abtesting/src/ABVariant/BasicABVariant.php',
 
 
 
 
 
125
  'FSVendor\\WPDesk\\Codeception\\Command\\AcceptanceTestGenerator' => __DIR__ . '/../..' . '/vendor_prefixed/wpdesk/wp-codeception/src/WPDesk/Codeception/Command/AcceptanceTestGenerator.php',
126
  'FSVendor\\WPDesk\\Codeception\\Command\\GeneratePluginActivation' => __DIR__ . '/../..' . '/vendor_prefixed/wpdesk/wp-codeception/src/WPDesk/Codeception/Command/GeneratePluginActivation.php',
127
  'FSVendor\\WPDesk\\Codeception\\Command\\GenerateWooCommerce' => __DIR__ . '/../..' . '/vendor_prefixed/wpdesk/wp-codeception/src/WPDesk/Codeception/Command/GenerateWooCommerce.php',
@@ -359,9 +364,9 @@ class ComposerStaticInit94c0b8b721f071900d92e6dbc490c26c
359
  public static function getInitializer(ClassLoader $loader)
360
  {
361
  return \Closure::bind(function () use ($loader) {
362
- $loader->prefixLengthsPsr4 = ComposerStaticInit94c0b8b721f071900d92e6dbc490c26c::$prefixLengthsPsr4;
363
- $loader->prefixDirsPsr4 = ComposerStaticInit94c0b8b721f071900d92e6dbc490c26c::$prefixDirsPsr4;
364
- $loader->classMap = ComposerStaticInit94c0b8b721f071900d92e6dbc490c26c::$classMap;
365
 
366
  }, null, ClassLoader::class);
367
  }
4
 
5
  namespace Composer\Autoload;
6
 
7
+ class ComposerStaticInit1c58ffcecd0c6a4ac17febc916c815e3
8
  {
9
  public static $prefixLengthsPsr4 = array (
10
  'P' =>
122
  'FSVendor\\WPDesk\\ABTesting\\ABTest\\EqualGroupsRandomABTest' => __DIR__ . '/../..' . '/vendor_prefixed/wpdesk/wp-abtesting/src/ABTest/EqualGroupsRandomABTest.php',
123
  'FSVendor\\WPDesk\\ABTesting\\ABVariant' => __DIR__ . '/../..' . '/vendor_prefixed/wpdesk/wp-abtesting/src/ABVariant.php',
124
  'FSVendor\\WPDesk\\ABTesting\\ABVariant\\BasicABVariant' => __DIR__ . '/../..' . '/vendor_prefixed/wpdesk/wp-abtesting/src/ABVariant/BasicABVariant.php',
125
+ 'FSVendor\\WPDesk\\Beacon\\Beacon' => __DIR__ . '/../..' . '/vendor_prefixed/wpdesk/wp-helpscout-beacon/src/Beacon/Beacon.php',
126
+ 'FSVendor\\WPDesk\\Beacon\\BeaconGetShouldShowStrategy' => __DIR__ . '/../..' . '/vendor_prefixed/wpdesk/wp-helpscout-beacon/src/Beacon/BeaconGetShouldShowStrategy.php',
127
+ 'FSVendor\\WPDesk\\Beacon\\BeaconPro' => __DIR__ . '/../..' . '/vendor_prefixed/wpdesk/wp-helpscout-beacon/src/Beacon/BeaconPro.php',
128
+ 'FSVendor\\WPDesk\\Beacon\\BeaconShouldShowStrategy' => __DIR__ . '/../..' . '/vendor_prefixed/wpdesk/wp-helpscout-beacon/src/Beacon/BeaconShouldShowStrategy.php',
129
+ 'FSVendor\\WPDesk\\Beacon\\Beacon\\WooCommerceSettingsFieldsModifier' => __DIR__ . '/../..' . '/vendor_prefixed/wpdesk/wp-helpscout-beacon/src/Beacon/WooCommerceSettingsFieldsModifier.php',
130
  'FSVendor\\WPDesk\\Codeception\\Command\\AcceptanceTestGenerator' => __DIR__ . '/../..' . '/vendor_prefixed/wpdesk/wp-codeception/src/WPDesk/Codeception/Command/AcceptanceTestGenerator.php',
131
  'FSVendor\\WPDesk\\Codeception\\Command\\GeneratePluginActivation' => __DIR__ . '/../..' . '/vendor_prefixed/wpdesk/wp-codeception/src/WPDesk/Codeception/Command/GeneratePluginActivation.php',
132
  'FSVendor\\WPDesk\\Codeception\\Command\\GenerateWooCommerce' => __DIR__ . '/../..' . '/vendor_prefixed/wpdesk/wp-codeception/src/WPDesk/Codeception/Command/GenerateWooCommerce.php',
364
  public static function getInitializer(ClassLoader $loader)
365
  {
366
  return \Closure::bind(function () use ($loader) {
367
+ $loader->prefixLengthsPsr4 = ComposerStaticInit1c58ffcecd0c6a4ac17febc916c815e3::$prefixLengthsPsr4;
368
+ $loader->prefixDirsPsr4 = ComposerStaticInit1c58ffcecd0c6a4ac17febc916c815e3::$prefixDirsPsr4;
369
+ $loader->classMap = ComposerStaticInit1c58ffcecd0c6a4ac17febc916c815e3::$classMap;
370
 
371
  }, null, ClassLoader::class);
372
  }
vendor_prefixed/wpdesk/wp-code-sniffer/composer.json ADDED
@@ -0,0 +1,38 @@
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
+ {
2
+ "name": "wpdesk\/wp-code-sniffer",
3
+ "description": "Library for WP Desk Coding standards in plugins.",
4
+ "license": "MIT",
5
+ "keywords": [
6
+ "wordpress",
7
+ "code sniffer",
8
+ "admin"
9
+ ],
10
+ "homepage": "https:\/\/gitlab.com\/wpdesk\/wp-code-sniffer",
11
+ "type": "phpcodesniffer-standard",
12
+ "minimum-stability": "stable",
13
+ "authors": [
14
+ {
15
+ "name": "grola",
16
+ "email": "grola@wpdesk.net"
17
+ }
18
+ ],
19
+ "require": {
20
+ "dealerdirect\/phpcodesniffer-composer-installer": "^0.6.2",
21
+ "phpcompatibility\/php-compatibility": "^9.3",
22
+ "squizlabs\/php_codesniffer": "^3.5",
23
+ "wp-coding-standards\/wpcs": "^2.2"
24
+ },
25
+ "require-dev": {
26
+ "phpunit\/phpunit": "<7",
27
+ "mockery\/mockery": "*",
28
+ "10up\/wp_mock": "*"
29
+ },
30
+ "autoload": {},
31
+ "autoload-dev": {},
32
+ "scripts": {
33
+ "phpcs": "phpcs"
34
+ },
35
+ "extra": {
36
+ "class": "WPDesk\\Composer\\Codeception\\Plugin"
37
+ }
38
+ }
vendor_prefixed/wpdesk/wp-helpscout-beacon/assets/js/hs-bc.js ADDED
@@ -0,0 +1,112 @@
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
+ 'use strict';
2
+
3
+ /**
4
+ * Creates a Beacon object with given params.
5
+ *
6
+ * @param {string} beaconId Id of the beacon from HelpScout.
7
+ * @param {string} confirmationMessage Message shown to user to get his confirmation for Beacon initialization.
8
+ * @param {string} searchElementsClass Css class of elements which modifies beacon search.
9
+ * @constructor
10
+ */
11
+ function HsBeacon(beaconId, confirmationMessage, searchElementsClass) {
12
+ this.beaconId = beaconId;
13
+ this.confirmationMessage = confirmationMessage;
14
+ this.searchElementsClass = searchElementsClass;
15
+ }
16
+
17
+
18
+
19
+ /**
20
+ * HelpScout Beacon implementation. Can ask for permission before initialize&show.
21
+ */
22
+ HsBeacon.prototype = {
23
+ initialized: false,
24
+ confirmationMessage: '',
25
+ beaconId: '',
26
+ searchElementsClass: '',
27
+ searchQuery: '',
28
+
29
+ /**
30
+ * Attach ask&show event to given class.
31
+ *
32
+ * @param {string} buttonClass
33
+ */
34
+ attachBeaconEvents: function (buttonClass) {
35
+ const self = this;
36
+ if (this.confirmationMessage !== '') {
37
+ jQuery('.' + buttonClass).click(function () {
38
+ jQuery(this).blur();
39
+ if (self.showBeaconIfConfirmed()) {
40
+ jQuery(this).fadeOut("slow");
41
+ }
42
+ });
43
+ } else {
44
+ this.ensureBeaconInitialization();
45
+ }
46
+ if (this.searchElementsClass !== '') {
47
+ this.attachSearchListener();
48
+ }
49
+ },
50
+
51
+ /**
52
+ * Listen on focus events to modify search query on beacon.
53
+ */
54
+ attachSearchListener: function () {
55
+ let beacon = this;
56
+ jQuery(document).on('focus','.' + this.searchElementsClass,function(){
57
+ if (jQuery(this).data('beacon_search') !== undefined) {
58
+ beacon.searchQuery = jQuery(this).data('beacon_search');
59
+ if (window.Beacon !== undefined) {
60
+ window.Beacon('search', beacon.searchQuery);
61
+ }
62
+ }
63
+ });
64
+ },
65
+
66
+ /**
67
+ * Show confirmation dialog and then show Beacon if user confirmed. Must be initialized first.
68
+ *
69
+ * @returns {boolean}
70
+ */
71
+ showBeaconIfConfirmed: function () {
72
+ let wantBeaconRun = confirm(this.confirmationMessage);
73
+ if (wantBeaconRun) {
74
+ this.ensureBeaconInitialization();
75
+ this.beaconShow();
76
+ }
77
+ return wantBeaconRun;
78
+ },
79
+
80
+ /**
81
+ * Initilize Beacon libs.
82
+ */
83
+ ensureBeaconInitialization: function () {
84
+ if (!this.initialized) {
85
+ this.initialized = true;
86
+ !function (e, t, n) {
87
+ function a() {
88
+ var e = t.getElementsByTagName("script")[0], n = t.createElement("script");
89
+ n.type = "text/javascript", n.async = !0, n.src = "https://beacon-v2.helpscout.net", e.parentNode.insertBefore(n, e)
90
+ }
91
+
92
+ if (e.Beacon = n = function (t, n, a) {
93
+ e.Beacon.readyQueue.push({method: t, options: n, data: a})
94
+ }, n.readyQueue = [], "complete" === t.readyState) return a();
95
+ e.attachEvent ? e.attachEvent("onload", a) : e.addEventListener("load", a, !1)
96
+ }(window, document, window.Beacon || function () {
97
+ });
98
+
99
+ window.Beacon('init', this.beaconId);
100
+ }
101
+ },
102
+
103
+ /**
104
+ * Show Beacon. Must be initialized first.
105
+ */
106
+ beaconShow: function () {
107
+ window.Beacon('open');
108
+ if (this.searchQuery !== '') {
109
+ window.Beacon('search', this.searchQuery);
110
+ }
111
+ }
112
+ };
vendor_prefixed/wpdesk/wp-helpscout-beacon/composer.json ADDED
@@ -0,0 +1,39 @@
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
+ {
2
+ "name": "wpdesk\/wp-helpscout-beacon",
3
+ "authors": [
4
+ {
5
+ "name": "Krzysiek",
6
+ "email": "krzysiek@wpdesk.pl"
7
+ }
8
+ ],
9
+ "license": "MIT",
10
+ "require": {
11
+ "php": ">=5.6",
12
+ "psr\/container": "^1.0"
13
+ },
14
+ "require-dev": {
15
+ "phpunit\/phpunit": "^5",
16
+ "wp-coding-standards\/wpcs": "^0.14.1",
17
+ "squizlabs\/php_codesniffer": "^3.0.2",
18
+ "wimg\/php-compatibility": "^8",
19
+ "wpdesk\/wp-wpdesk-composer": "^2.6",
20
+ "mockery\/mockery": "*",
21
+ "10up\/wp_mock": "*"
22
+ },
23
+ "autoload": {
24
+ "psr-4": {
25
+ "FSVendor\\WPDesk\\Beacon\\": "src\/"
26
+ }
27
+ },
28
+ "autoload-dev": {
29
+ "psr-4": {
30
+ "FSVendor\\WPDesk\\Beacon\\Tests\\Integration\\": "tests\/integration\/"
31
+ }
32
+ },
33
+ "scripts": {
34
+ "phpunit-unit": "phpunit --configuration phpunit-unit.xml --coverage-text --colors=never",
35
+ "phpunit-unit-fast": "phpunit --configuration phpunit-unit.xml --no-coverage",
36
+ "phpunit-integration": "phpunit --configuration phpunit-integration.xml --coverage-text --colors=never",
37
+ "phpunit-integration-fast": "phpunit --configuration phpunit-integration.xml --no-coverage"
38
+ }
39
+ }
vendor_prefixed/wpdesk/wp-helpscout-beacon/src/Beacon/Beacon.php ADDED
@@ -0,0 +1,95 @@
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
+ <?php
2
+
3
+ namespace FSVendor\WPDesk\Beacon;
4
+
5
+ /**
6
+ * Can display HelpScout Beacon. For more info check https://secure.helpscout.net/settings/beacons/
7
+ */
8
+ class Beacon
9
+ {
10
+ /**
11
+ * Beacon UUID from HelpScout.
12
+ *
13
+ * @var string
14
+ */
15
+ private $beacon_id;
16
+ /**
17
+ * When to display beacon.
18
+ *
19
+ * @var BeaconShouldShowStrategy
20
+ */
21
+ private $activation_strategy;
22
+ /**
23
+ * @var string
24
+ */
25
+ private $assets_url;
26
+ /**
27
+ * @var string
28
+ */
29
+ private $beacon_search_elements_class;
30
+ /**
31
+ * @var string
32
+ */
33
+ protected $confirmation_message;
34
+ /**
35
+ * Beacon constructor.
36
+ *
37
+ * @param string $beacon_id .
38
+ * @param BeaconShouldShowStrategy $strategy When to display beacon.
39
+ * @param string $assets_url With ending /
40
+ */
41
+ public function __construct($beacon_id, \FSVendor\WPDesk\Beacon\BeaconShouldShowStrategy $strategy, $assets_url, $beacon_search_elements_class = 'hs-beacon-search')
42
+ {
43
+ $this->beacon_id = $beacon_id;
44
+ $this->activation_strategy = $strategy;
45
+ $this->assets_url = $assets_url;
46
+ $this->beacon_search_elements_class = $beacon_search_elements_class;
47
+ $this->confirmation_message = \__('When you click OK we will open our HelpScout beacon where you can find answers to your questions. This beacon will load our help articles and also potentially set cookies.', 'wp-helpscout-beacon');
48
+ }
49
+ /**
50
+ * @return string
51
+ */
52
+ public function get_beacon_id()
53
+ {
54
+ return $this->beacon_id;
55
+ }
56
+ /**
57
+ * Hooks.
58
+ */
59
+ public function hooks()
60
+ {
61
+ if ($this->should_display_beacon()) {
62
+ \add_action('admin_footer', [$this, 'add_beacon_to_footer']);
63
+ \add_action('admin_enqueue_scripts', [$this, 'add_beacon_js']);
64
+ }
65
+ }
66
+ /**
67
+ * Should display beacon?
68
+ *
69
+ * @return bool
70
+ */
71
+ protected function should_display_beacon()
72
+ {
73
+ return $this->activation_strategy->shouldDisplay();
74
+ }
75
+ public function add_beacon_js()
76
+ {
77
+ if ($this->should_display_beacon()) {
78
+ \wp_register_script('hs-beacon', $this->assets_url . 'js/hs-bc.js', []);
79
+ \wp_enqueue_script('hs-beacon');
80
+ }
81
+ }
82
+ /**
83
+ * Display Beacon script.
84
+ */
85
+ public function add_beacon_to_footer()
86
+ {
87
+ if ($this->should_display_beacon()) {
88
+ $beacon_id = $this->beacon_id;
89
+ $confirmation_message = \__('When you click OK we will open our HelpScout beacon where you can find answers to your questions. This beacon will load our help articles and also potentially set cookies.', 'wp-helpscout-beacon');
90
+ $beacon_search_elements_class = $this->beacon_search_elements_class;
91
+ $confirmation_message = $this->confirmation_message;
92
+ include __DIR__ . '/templates/html-beacon-script.php';
93
+ }
94
+ }
95
+ }
vendor_prefixed/wpdesk/wp-helpscout-beacon/src/Beacon/BeaconGetShouldShowStrategy.php ADDED
@@ -0,0 +1,43 @@
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
+ <?php
2
+
3
+ namespace FSVendor\WPDesk\Beacon;
4
+
5
+ /**
6
+ * When and if show Beacon.
7
+ */
8
+ class BeaconGetShouldShowStrategy implements \FSVendor\WPDesk\Beacon\BeaconShouldShowStrategy
9
+ {
10
+ /**
11
+ * Whether to show beacon on the page or not. Array of arrays with condition for _GET.
12
+ * Inner arrays mean AND, outer arrays mean OR conditions.
13
+ *
14
+ * ie. [ [ .. and .. and ..] or [ .. and .. and ..] or .. ]
15
+ *
16
+ * @var array
17
+ */
18
+ private $conditions;
19
+ public function __construct(array $conditions)
20
+ {
21
+ $this->conditions = $conditions;
22
+ }
23
+ /**
24
+ * Should Beacon be visible?
25
+ *
26
+ * @return bool
27
+ */
28
+ public function shouldDisplay()
29
+ {
30
+ foreach ($this->conditions as $or_conditions) {
31
+ $display = \true;
32
+ foreach ($or_conditions as $parameter => $value) {
33
+ if (!isset($_GET[$parameter]) || $_GET[$parameter] !== $value) {
34
+ $display = \false;
35
+ }
36
+ }
37
+ if ($display) {
38
+ return $display;
39
+ }
40
+ }
41
+ return \false;
42
+ }
43
+ }
vendor_prefixed/wpdesk/wp-helpscout-beacon/src/Beacon/BeaconPro.php ADDED
@@ -0,0 +1,22 @@
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
+ <?php
2
+
3
+ namespace FSVendor\WPDesk\Beacon;
4
+
5
+ /**
6
+ * Can display HelpScout Beacon without confirmation. For more info check https://secure.helpscout.net/settings/beacons/
7
+ */
8
+ class BeaconPro extends \FSVendor\WPDesk\Beacon\Beacon
9
+ {
10
+ /**
11
+ * Beacon constructor.
12
+ *
13
+ * @param string $beacon_id .
14
+ * @param BeaconShouldShowStrategy $strategy When to display beacon.
15
+ * @param string $assets_url With ending /
16
+ */
17
+ public function __construct($beacon_id, \FSVendor\WPDesk\Beacon\BeaconShouldShowStrategy $strategy, $assets_url, $beacon_search_elements_class = 'hs-beacon-search')
18
+ {
19
+ parent::__construct($beacon_id, $strategy, $assets_url, $beacon_search_elements_class);
20
+ $this->confirmation_message = '';
21
+ }
22
+ }
vendor_prefixed/wpdesk/wp-helpscout-beacon/src/Beacon/BeaconShouldShowStrategy.php ADDED
@@ -0,0 +1,16 @@
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
+ <?php
2
+
3
+ namespace FSVendor\WPDesk\Beacon;
4
+
5
+ /**
6
+ * When to show Beacon.
7
+ */
8
+ interface BeaconShouldShowStrategy
9
+ {
10
+ /**
11
+ * Should Beacon be visible?
12
+ *
13
+ * @return bool
14
+ */
15
+ public function shouldDisplay();
16
+ }
vendor_prefixed/wpdesk/wp-helpscout-beacon/src/Beacon/WooCommerceSettingsFieldsModifier.php ADDED
@@ -0,0 +1,47 @@
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
+ <?php
2
+
3
+ /**
4
+ * WooCommerce settings fields modifier.
5
+ *
6
+ * @package WPDesk\Beacon\Beacon
7
+ */
8
+ namespace FSVendor\WPDesk\Beacon\Beacon;
9
+
10
+ /**
11
+ * Can modify WooCommerce settings fields.
12
+ * Use it on WooCommerce settings fields for Beacon search functionality.
13
+ */
14
+ class WooCommerceSettingsFieldsModifier
15
+ {
16
+ const FIELD_CLASS = 'class';
17
+ const FIELD_CUSTOM_ATTRIBUTES = 'custom_attributes';
18
+ const FIELD_TITLE = 'title';
19
+ const CLASS_HS_BEACON_SEARCH = 'hs-beacon-search';
20
+ const DATA_BEACON_SEARCH = 'data-beacon_search';
21
+ /**
22
+ * Appends beacon search data to fields.
23
+ * It takes field title and set it as beacon search.
24
+ *
25
+ * @param array $form_fields .
26
+ *
27
+ * @return array
28
+ */
29
+ public function append_beacon_search_data_to_fields(array $form_fields)
30
+ {
31
+ foreach ($form_fields as $field_name => $field) {
32
+ if (isset($field[self::FIELD_TITLE])) {
33
+ if (empty($field[self::FIELD_CLASS])) {
34
+ $field[self::FIELD_CLASS] = self::CLASS_HS_BEACON_SEARCH;
35
+ } else {
36
+ $field[self::FIELD_CLASS] .= ' ' . self::CLASS_HS_BEACON_SEARCH;
37
+ }
38
+ if (!isset($field[self::FIELD_CUSTOM_ATTRIBUTES])) {
39
+ $field[self::FIELD_CUSTOM_ATTRIBUTES] = array();
40
+ }
41
+ $field[self::FIELD_CUSTOM_ATTRIBUTES][self::DATA_BEACON_SEARCH] = $field[self::FIELD_TITLE];
42
+ }
43
+ $form_fields[$field_name] = $field;
44
+ }
45
+ return $form_fields;
46
+ }
47
+ }
vendor_prefixed/wpdesk/wp-helpscout-beacon/src/Beacon/templates/html-beacon-script.php ADDED
@@ -0,0 +1,88 @@
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
+ <?php
2
+
3
+ namespace FSVendor;
4
+
5
+ /**
6
+ * Displays Beacon script.
7
+ *
8
+ * @var $beacon_id string .
9
+ * @var $confirmation_message string .
10
+ * @var $beacon_search_elements_class string .
11
+ */
12
+ $beacon_button_class = 'wpdesk-helpscout-beacon-button';
13
+ if ('' !== $confirmation_message) {
14
+ ?><div id="wpdesk-helpscout-beacon">
15
+ <div class="wpdesk-helpscout-beacon-frame">
16
+ <svg version="1.1" id="Layer_1" xmlns="http://www.w3.org/2000/svg" xmlns:xlink="http://www.w3.org/1999/xlink" x="0px" y="0px" width="108px" height="59px" viewBox="0 0 108 59" enable-background="new 0 0 108 59" xml:space="preserve" style="position: fixed; bottom: 37px; right: 37px; outline: none;">
17
+ <image class="<?php
18
+ echo \esc_attr($beacon_button_class);
19
+ ?>" id="image0" width="108" height="59" x="0" y="0" xlink:href="data:image/png;base64,iVBORw0KGgoAAAANSUhEUgAAAGwAAAA7CAMAAACpM5+wAAABfGlDQ1BpY2MAACiRfZE9SMNAHMVf
20
+ U6Ui9QPsUMQhQ3VqQVTEUatQhAqhVmjVweTSL2jSkKS4OAquBQc/FqsOLs66OrgKguAHiJOjk6KL
21
+ lPi/pNAi1oPjfry797h7Bwj1MtOsrnFA020zlYiLmeyqGHiFH2H0YxBRmVnGnCQl0XF83cPH17sY
22
+ z+p87s/Rp+YsBvhE4llmmDbxBvH0pm1w3icOsaKsEp8TR026IPEj1xWP3zgXXBZ4ZshMp+aJQ8Ri
23
+ oY2VNmZFUyOeIo6omk75QsZjlfMWZ61cZc178hcGc/rKMtdpjiCBRSxBgggFVZRQho0YrTopFlK0
24
+ H+/gH3b9ErkUcpXAyLGACjTIrh/8D353a+UnJ7ykYBzofnGcj1EgsAs0ao7zfew4jRPA/wxc6S1/
25
+ pQ7MfJJea2mRI2BgG7i4bmnKHnC5A4SfDNmUXclPU8jngfcz+qYsMHQL9K55vTX3cfoApKmr5A1w
26
+ cAiMFSh7vcO7e9p7+/dMs78fZnByomahL+IAAAAgY0hSTQAAeiYAAICEAAD6AAAAgOgAAHUwAADq
27
+ YAAAOpgAABdwnLpRPAAAAnNQTFRF8fHx8PDw7+/v7u7u2unhqdzAj9Wuf9GkcM2aX8iPT8OESMJ/
28
+ gNGk6+3sxuPTldezZMqSl9i0x+TU7O7t7e7tsN3FXMeNXceNst7Gu+HMZcmSZsqTvuHO6OzqgtKm
29
+ 2ejgZ8qU7e3tveHNVcWIw+PRm9i2ScKASsKBpNu9m9i3tt/Jtd7IzuXYTsODzeXY3+nkW8eM7Ozs
30
+ gdGl0OXZz+XZ6+vrds6evuDN6evqdtGfmN23o+C/gdWnX8qP0uXaU8aH9Pv3////3fTnn9i56fjv
31
+ pOG/6urqbMuXxuzXjdmv2uXfu+jP6Pfv2eXeqdq/S8OB7vnzrtzD6enpi9SsVMaH9/z54/XraMyV
32
+ 6Ojoe8+hXsmOxevX9fv49vz5werUVsaJf9SmtubMs+XK8vr2nd66as2X2fLl+f37ldu1yu3aetKi
33
+ +Pz6rePGh9erbs6aYsmRTcODdNCewurVTsSDXMiNedKhnt67ruTHUsSG5+fn/f7+1PDhkNqxwurU
34
+ gtWoxevWj9mxcM+bVMaIw+vVhdaqxOvWYciQ0/DgTcOCp+HCrOPFcc2b0vDf2/PmsOTIn9+84PTp
35
+ od+9r+THX8mPx+zY9Pv4wOrT7/n0j9SusdvE3eTg3OPf5eXlnda3uujP0fDf5ubmzeDV5OTkutzJ
36
+ 4+PjcMyawN3Nyt/T4uLigNCk0t/YWseL0uDYxt3Qx93R4eHhsdrEstnE4ODgk9SwmNW0m9a2mtW1
37
+ tNnFUcSF39/fxNzPyt3S2N7bj9OujtOt3t7eydzRds2dsNnDX8iOt9nG3N7dvdrKY8mRkdOv3d3d
38
+ zdzUo9a6jNKrfs+ibsuYfc+i3NzcDLGCXwAAAAFiS0dEQYnebE4AAAAJcEhZcwAACxMAAAsTAQCa
39
+ nBgAAAAHdElNRQfkBBATKBS9f2WVAAAEb0lEQVRYw7XY6WPURBQA8GAAgfFARasiR0QXURFSTbHt
40
+ lvZBm6VSLQahwSKetdV6cSnxwnrUA8RbQRddllXXczWouIouHoALiP5JvpmkSdZOst0meR/aD7OZ
41
+ 3743s5OZEQRvTHDjtBDh6Ubwi0pHHHdUitUoUZw4afLpU6ZOIzXHtKlTzpg8aSIT/TlXOvOss6fX
42
+ rlTG9HPOPc/1/CxxxvkXhJWsqLtwhsjVHEq86OJoKBozLxE5nGPNmh0dRWP2rFGak9acudFahMyd
43
+ 4yRXaUmXzovaImTeZZJXc6zLE9FbhMy/wquNWAvioGgsGNFc68q4LEKucjTbunphfNjCa2yNYaK0
44
+ aHF8FiGLF6FmYWjJ9XFahNTLTBNoEeVr47UIuU6mhRRoYkpD3FiDQlMTaBGXxG0RsoQWEjH5et/F
45
+ t7GpuTnZEgU2U8FCCpjYUn57a3MbsFjWGIG2FFMTRFlZzreWUai9nf7tCI8tx9QESVZT3NYVACtY
46
+ Sp3odYbGUqosCZJyA3cBbgFY6ebYFRpL3KhIgqzexG1sAnBmRhJgDMPWDauCmm9WZUHRVnPbGjs8
47
+ AwXQ9P/2W2AN/bcWesaIrdYUQdHXVf/SnClSM7ZOVwRVT5GqEZzZrb3rb9twO8PugDvvarv7Hl4f
48
+ KV1FrPrWrROgzx9L3Ns/MNB/H8Puh8EHHlwFD3E6eRgxTX+kmtXSBe1kNGZHz0bYtHnzBthCsa2w
49
+ lpBH4TFOL9t0TdCMqnnhQpLkYI8/gTEIPU9a6FYLe4qQp2E7rx+DYtuCpNbmLoA2zm/aLeMz0DuE
50
+ 8ayFPUfI8/ACLzPEdGM4wOpDClbylmIX2wgvEjI09JKFdSXIy/AK54FhQ0dsRwC204eqmCCvwq7X
51
+ +l+fb2Ftm94YHD2dMHYwLGhLAPCmT4tn6r/19pp3ercQC3t31/r3BngP1DNsdyBW24KPmF/Tbobt
52
+ CXi4o6O2d1kAtgcxzXg/wm23P5b4gE399BjWq/CRSlNMT+/1/UTrhx/11dBhUOxN4wqi6pl9vp/A
53
+ l9rOiLB9GbYQZ7K+S3HSfV2HjOEsxRTNyO73/UyyqTUabH/WoC9PHLTcxxHVyjcacjhkCu5B9Ezu
54
+ k7ixT3NYRRl3Vzj582PYGoSJz/I48XF3JckapvZ5rOezL75kiUl0R6xjal/FefL8GhPT6Y4YD0w0
55
+ tcI38WHfFjAxje718RRDRy1nHojL+s7M0RGT2ZEJd/u6kc2b38dyD5L4wcxnDTpiiLGTJxYStYMx
56
+ jNuPB9HCIlonT3amtoat+FNd1Fbdz0U2YIp9pp5gFzKdK5iHfumOkur+9ZBZwAGzimhdTTha3iwd
57
+ jnDl+u1wycx7LOeGh2p03Iql3yP6ff/xZ6lIx8u2RrARDWcJlrJ45OiBY2GlY38dPVLEEuLccC3P
58
+ TZmsaqyUyJXKx0+c/PvU+G6/T/1z8sTxMmZVYCXUvJZ730jnpJGxuVK5XP53XIEPlmwKS4jzkH+7
59
+ KSuqzaFnFotI1h74mImSTakV1n+TS46xWCBrIQAAABl0RVh0Q29tbWVudABDcmVhdGVkIHdpdGgg
60
+ R0lNUFeBDhcAAAAldEVYdGRhdGU6Y3JlYXRlADIwMjAtMDQtMTZUMTk6NDA6MjArMDM6MDDLEPk4
61
+ AAAAJXRFWHRkYXRlOm1vZGlmeQAyMDIwLTA0LTE2VDE5OjQwOjIwKzAzOjAwuk1BhAAAABt0RVh0
62
+ aWNjOmNvcHlyaWdodABQdWJsaWMgRG9tYWlutpExWwAAACJ0RVh0aWNjOmRlc2NyaXB0aW9uAEdJ
63
+ TVAgYnVpbHQtaW4gc1JHQkxnQRMAAAAVdEVYdGljYzptYW51ZmFjdHVyZXIAR0lNUEyekMoAAAAO
64
+ dEVYdGljYzptb2RlbABzUkdCW2BJQwAAAABJRU5ErkJggg==" />
65
+ </svg>
66
+ </div>
67
+ </div><?php
68
+ }
69
+ ?>
70
+
71
+ <script type="text/javascript">
72
+ jQuery(document).ready(function () {
73
+ (new HsBeacon(
74
+ '<?php
75
+ echo \esc_attr($beacon_id);
76
+ ?>',
77
+ '<?php
78
+ echo \esc_attr($confirmation_message);
79
+ ?>',
80
+ '<?php
81
+ echo \esc_attr($beacon_search_elements_class);
82
+ ?>'
83
+ )).attachBeaconEvents('<?php
84
+ echo \esc_attr($beacon_button_class);
85
+ ?>');
86
+ });
87
+ </script>
88
+ <?php
vendor_prefixed/wpdesk/wp-plugin-flow/src/Initialization/HelperInstanceAsFilterTrait.php CHANGED
@@ -19,7 +19,7 @@ trait HelperInstanceAsFilterTrait
19
  */
20
  private function get_helper_version()
21
  {
22
- return 2;
23
  }
24
  /**
25
  * Returns filter action name for helper instance
19
  */
20
  private function get_helper_version()
21
  {
22
+ return 3;
23
  }
24
  /**
25
  * Returns filter action name for helper instance
vendor_prefixed/wpdesk/wp-plugin-flow/src/Initialization/Simple/SimplePaidStrategy.php CHANGED
@@ -56,13 +56,15 @@ class SimplePaidStrategy implements \FSVendor\WPDesk\Plugin\Flow\Initialization\
56
  }
57
  $this->prepare_tracker_action();
58
  $registrator = $this->register_plugin();
59
- $this->init_helper();
60
- $is_plugin_subscription_active = $registrator instanceof \FSVendor\WPDesk\License\PluginRegistrator && $registrator->is_active();
61
- if ($this->plugin instanceof \FSVendor\WPDesk\PluginBuilder\Plugin\ActivationAware && $is_plugin_subscription_active) {
62
- $this->plugin->set_active();
63
- }
64
- $this->store_plugin($this->plugin);
65
- $this->init_plugin($this->plugin);
 
 
66
  return $this->plugin;
67
  }
68
  /**
56
  }
57
  $this->prepare_tracker_action();
58
  $registrator = $this->register_plugin();
59
+ \add_action('plugins_loaded', function () use($registrator) {
60
+ $this->init_helper();
61
+ $is_plugin_subscription_active = $registrator instanceof \FSVendor\WPDesk\License\PluginRegistrator && $registrator->is_active();
62
+ if ($this->plugin instanceof \FSVendor\WPDesk\PluginBuilder\Plugin\ActivationAware && $is_plugin_subscription_active) {
63
+ $this->plugin->set_active();
64
+ }
65
+ $this->store_plugin($this->plugin);
66
+ $this->init_plugin($this->plugin);
67
+ }, $priority_before_flow_2_5_after_2_6 = -45);
68
  return $this->plugin;
69
  }
70
  /**
vendor_prefixed/wpdesk/wp-plugin-flow/src/Initialization/TrackerInstanceAsFilterTrait.php CHANGED
@@ -20,6 +20,15 @@ trait TrackerInstanceAsFilterTrait
20
  {
21
  return 'wpdesk_tracker_instance';
22
  }
 
 
 
 
 
 
 
 
 
23
  /**
24
  * @return \WPDesk_Tracker_Interface
25
  */
@@ -49,6 +58,6 @@ trait TrackerInstanceAsFilterTrait
49
  \do_action('wpdesk_tracker_started', self::$tracker_instance, $this->plugin_info);
50
  return self::$tracker_instance;
51
  }
52
- });
53
  }
54
  }
20
  {
21
  return 'wpdesk_tracker_instance';
22
  }
23
+ /**
24
+ * Returns version of the tracker. Inc when trackker is changed and should be instantiated fist.
25
+ *
26
+ * @return int
27
+ */
28
+ private function get_tracker_version()
29
+ {
30
+ return 2;
31
+ }
32
  /**
33
  * @return \WPDesk_Tracker_Interface
34
  */
58
  \do_action('wpdesk_tracker_started', self::$tracker_instance, $this->plugin_info);
59
  return self::$tracker_instance;
60
  }
61
+ }, 10 - $this->get_tracker_version());
62
  }
63
  }
vendor_prefixed/wpdesk/wp-plugin-flow/src/PluginBootstrap.php CHANGED
@@ -12,7 +12,7 @@ use FSVendor\WPDesk\Plugin\Flow\Initialization\InitializationFactory;
12
  final class PluginBootstrap
13
  {
14
  const LIBRARY_TEXT_DOMAIN = 'flexible-shipping';
15
- const PRIORITY_BEFORE_SHARED_CLASS_LOADER = -40;
16
  /** @var string */
17
  private $plugin_version;
18
  /** @var string */
@@ -83,7 +83,7 @@ final class PluginBootstrap
83
  } else {
84
  $requirements_checker->render_notices();
85
  }
86
- }, self::PRIORITY_BEFORE_SHARED_CLASS_LOADER);
87
  }
88
  /**
89
  * Initialize activated_plugin action.
12
  final class PluginBootstrap
13
  {
14
  const LIBRARY_TEXT_DOMAIN = 'flexible-shipping';
15
+ const PRIORITY_BEFORE_FLOW_2_5 = -50;
16
  /** @var string */
17
  private $plugin_version;
18
  /** @var string */
83
  } else {
84
  $requirements_checker->render_notices();
85
  }
86
+ }, self::PRIORITY_BEFORE_FLOW_2_5);
87
  }
88
  /**
89
  * Initialize activated_plugin action.
vendor_prefixed/wpdesk/wp-wpdesk-tracker/src/views/tracker-notice.php CHANGED
@@ -9,17 +9,32 @@ if (!\defined('ABSPATH')) {
9
 
10
  <div id="wpdesk_tracker_notice" class="updated notice wpdesk_tracker_notice is-dismissible">
11
  <p>
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
12
  <?php
13
- \printf(\__('Hey %s,', 'flexible-shipping'), $username);
14
- ?><br/>
 
 
 
15
  <?php
16
- \_e('We need your help to improve <strong>WP Desk plugins</strong>, so they are more useful for you and the rest of <strong>30,000+ users</strong>. By collecting data on how you use our plugins, you will help us a lot. We will not collect any sensitive data, so you can feel safe.', 'flexible-shipping');
17
  ?>
18
- <a href="<?php
19
- echo $terms_url;
20
- ?>" target="_blank"><?php
21
- \_e('Find out more &raquo;', 'flexible-shipping');
22
- ?></a>
23
  </p>
24
  <p>
25
  <button id="wpdesk_tracker_allow_button_notice" class="button button-primary"><?php
9
 
10
  <div id="wpdesk_tracker_notice" class="updated notice wpdesk_tracker_notice is-dismissible">
11
  <p>
12
+ <?php
13
+ $notice_content = \apply_filters('wpdesk_tracker_notice_content', \false, $username, $terms_url);
14
+ ?>
15
+ <?php
16
+ if (empty($notice_content)) {
17
+ ?>
18
+ <?php
19
+ \printf(\__('Hey %s,', 'flexible-shipping'), $username);
20
+ ?><br/>
21
+ <?php
22
+ \_e('We need your help to improve <strong>WP Desk plugins</strong>, so they are more useful for you and the rest of <strong>30,000+ users</strong>. By collecting data on how you use our plugins, you will help us a lot. We will not collect any sensitive data, so you can feel safe.', 'flexible-shipping');
23
+ ?>
24
+ <a href="<?php
25
+ echo $terms_url;
26
+ ?>" target="_blank"><?php
27
+ \_e('Find out more &raquo;', 'flexible-shipping');
28
+ ?></a>
29
  <?php
30
+ } else {
31
+ ?>
32
+ <?php
33
+ echo $notice_content;
34
+ ?>
35
  <?php
36
+ }
37
  ?>
 
 
 
 
 
38
  </p>
39
  <p>
40
  <button id="wpdesk_tracker_allow_button_notice" class="button button-primary"><?php