diff --git a/assets/admin/css/lpac-admin.css b/assets/admin/css/lpac-admin.css index c8384da..61c73f7 100644 --- a/assets/admin/css/lpac-admin.css +++ b/assets/admin/css/lpac-admin.css @@ -32,4 +32,23 @@ #lpac_export_btn{ cursor: pointer; padding: 10px; - } \ No newline at end of file + } + + hr{ + border-top: 8px solid #dcdcde !important; + } + + .titledesc.premium-subsection, .titledesc.premium-dummy-subsection{ + font-size: 18px; + } + + .premium-subsection:before{ + font-size: 20px; + margin-right: 5px; + color: gold; + } + +.premium-dummy-subsection:before{ + font-size: 20px; + margin-right: 5px; +} \ No newline at end of file diff --git a/assets/public/css/lpac-public.css b/assets/public/css/lpac-public.css index 3e827c3..960eb84 100644 --- a/assets/public/css/lpac-public.css +++ b/assets/public/css/lpac-public.css @@ -56,3 +56,10 @@ text-align: center; } + #lpac-saved-addresses ul{ + margin-left: 0; + } + + #edit-saved-addresses{ + font-size: 16px; + } diff --git a/assets/public/js/maps/base-map.js b/assets/public/js/maps/base-map.js index 6aa8a23..ccbea26 100644 --- a/assets/public/js/maps/base-map.js +++ b/assets/public/js/maps/base-map.js @@ -16,7 +16,7 @@ if (typeof lpac_pro_js !== 'undefined') { if( x_anchor.length == 0 ){ // Likely values to make the anchor appear ideal. - // The x axis anchor is usually half of the image width, the y is usally 3px over the image width + // The x axis anchor is usually half of the image width, the y is usually 3px over the image height x_anchor = marker_icon_width / 2; y_anchor = marker_icon_height + 3; } diff --git a/assets/public/js/maps/checkout-page-map.js b/assets/public/js/maps/checkout-page-map.js index 27fb731..04f6832 100644 --- a/assets/public/js/maps/checkout-page-map.js +++ b/assets/public/js/maps/checkout-page-map.js @@ -741,7 +741,7 @@ function lpacSetLastOrderMarker(){ } /** - * Places AutoComplete feature. + * Places Autocomplete feature. * * https://developers.google.com/maps/documentation/javascript/examples/places-autocomplete * @@ -774,11 +774,20 @@ function addPlacesAutoComplete(){ } const options = { - // componentRestrictions: { country: ["us", "ca"] }, // TODO let users control this fields: ["address_components", "formatted_address", "geometry"], types: ["address"], } + /* + * Add country restrictions set in pro plugin settings + * lpac_pro_js is in global scope + */ + if( typeof (lpac_pro_js) !== 'undefined' && lpac_pro_js !== null){ + options.componentRestrictions = { + country: lpac_pro_js.places_autocomplete_restrictions + } + } + const autoComplete = new google.maps.places.Autocomplete(field, options); /* Bind the map's bounds (viewport) property to the autocomplete object, @@ -792,7 +801,7 @@ function addPlacesAutoComplete(){ const latlng = { lat: parseFloat( results[0].geometry.location.lat() ), - lng: parseFloat( results[0].geometry.location.lng() ), + lng: parseFloat( results[0].geometry.location.lng() ), } if( fieldID.includes('shipping') ){ @@ -814,7 +823,7 @@ function addPlacesAutoComplete(){ lpac_map_listen_to_clicks(); }else{ - if( mapOptions.lpac_places_fill_shipping_fields ){ + if( mapOptions.lpac_places_fill_billing_fields ){ lpac_fill_in_billing_fields(results); } @@ -822,7 +831,7 @@ function addPlacesAutoComplete(){ * When Shipping destination is set as "Force shipping to the customer billing address" in WooCommerce->Shipping->Shipping Options * We would want to adjust the map as needed. */ - if( mapOptions.lpac_wc_shipping_destination_setting === 'billing_only'){ + if( mapOptions.lpac_wc_shipping_destination_setting === 'billing_only' || ( fields.length === 1 && fields.includes('billing_address_1') ) ){ lpac_fill_in_latlng(latlng); map.setCenter(latlng); marker.setPosition(latlng); diff --git a/class-lpac-uninstall.php b/class-lpac-uninstall.php index 3101524..33ab3d5 100644 --- a/class-lpac-uninstall.php +++ b/class-lpac-uninstall.php @@ -33,6 +33,20 @@ class Lpac_Uninstall { */ public static function remove_plugin_settings() { + /** + * If the free version and PRO version exist then don't delete the settings. + * This ensures that users do not accidentally delete their settings when installing PRO plugin. + */ + if ( ! function_exists( 'get_plugins' ) ) { + include ABSPATH . '/wp-admin/includes/plugin.php'; + } + + $plugins = get_plugins(); + + if ( array_key_exists( 'map-location-picker-at-checkout-for-woocommerce/lpac.php', $plugins ) && array_key_exists( 'map-location-picker-at-checkout-for-woocommerce-pro/lpac.php', $plugins ) ) { + return; + } + $should_delete_settings = get_option( 'lpac_delete_settings_on_uninstall' ); if ( $should_delete_settings !== 'yes' ) { @@ -84,9 +98,17 @@ public static function remove_plugin_settings() { 'lpac_remove_address_plus_code', 'lpac_enable_places_autocomplete', 'lpac_places_autocomplete_fields', + 'lpac_places_autocomplete_hide_map', 'lpac_auto_detect_location', 'lpac_export_date_from', 'lpac_export_date_to', + 'lpac_places_autocomplete_country_restrictions', + 'lpac_distance_matrix_api_key', + 'lpac_distance_matrix_store_origin_cords', + 'lpac_distance_matrix_cost_per_unit', + 'lpac_distance_matrix_distance_unit', + 'lpac_distance_matrix_travel_mode', + 'lpac_distance_matrix_shipping_methods', ); foreach ( $option_keys as $key ) { diff --git a/composer.lock b/composer.lock index 0e1b190..2d160fc 100644 --- a/composer.lock +++ b/composer.lock @@ -291,16 +291,16 @@ }, { "name": "squizlabs/php_codesniffer", - "version": "3.6.1", + "version": "3.6.2", "source": { "type": "git", "url": "https://github.com/squizlabs/PHP_CodeSniffer.git", - "reference": "f268ca40d54617c6e06757f83f699775c9b3ff2e" + "reference": "5e4e71592f69da17871dba6e80dd51bce74a351a" }, "dist": { "type": "zip", - "url": "https://api.github.com/repos/squizlabs/PHP_CodeSniffer/zipball/f268ca40d54617c6e06757f83f699775c9b3ff2e", - "reference": "f268ca40d54617c6e06757f83f699775c9b3ff2e", + "url": "https://api.github.com/repos/squizlabs/PHP_CodeSniffer/zipball/5e4e71592f69da17871dba6e80dd51bce74a351a", + "reference": "5e4e71592f69da17871dba6e80dd51bce74a351a", "shasum": "" }, "require": { @@ -343,7 +343,7 @@ "source": "https://github.com/squizlabs/PHP_CodeSniffer", "wiki": "https://github.com/squizlabs/PHP_CodeSniffer/wiki" }, - "time": "2021-10-11T04:00:11+00:00" + "time": "2021-12-12T21:44:58+00:00" }, { "name": "wp-coding-standards/wpcs", diff --git a/includes/Bootstrap/Main.php b/includes/Bootstrap/Main.php index 8a3c9bf..13d4c5a 100644 --- a/includes/Bootstrap/Main.php +++ b/includes/Bootstrap/Main.php @@ -168,8 +168,9 @@ private function define_admin_hooks() 10, 3 ); - /* Custom button created for WooCommerce settings */ - $this->loader->add_action( 'woocommerce_admin_field_button', $plugin_admin_view, 'create_customer_wc_settings_button' ); + /* Custom elements created for WooCommerce settings */ + $this->loader->add_action( 'woocommerce_admin_field_button', $plugin_admin_view, 'create_custom_wc_settings_button' ); + $this->loader->add_action( 'woocommerce_admin_field_hr', $plugin_admin_view, 'create_custom_wc_settings_hr' ); } /** diff --git a/includes/Controllers/Admin_Settings_Controller.php b/includes/Controllers/Admin_Settings_Controller.php index 0ffbb92..481ca7f 100644 --- a/includes/Controllers/Admin_Settings_Controller.php +++ b/includes/Controllers/Admin_Settings_Controller.php @@ -21,18 +21,18 @@ class Admin_Settings_Controller { /** * Sanitize the map default coordinates option before saving. * - * @param mixed $value - * @param mixed $option - * @param mixed $raw_value + * @param string $value + * @param array $option + * @param string $raw_value * @return string */ public function sanitize_default_map_coordinates( $value, $option, $raw_value ) { - // Remove letters from input - $value = preg_replace( '/[^0-9,.]/', '', $value ); + // Remove letters from input, allow dots and commas + $value = preg_replace( '/[^0-9,.-]/', '', $value ); $value = sanitize_text_field( $value ); - $value = trim( $value, ' ,' ); + $value = trim( $value, ' ,' ); // Remove spaces or commas infront and after value return $value; diff --git a/includes/Controllers/Emails_Controller.php b/includes/Controllers/Emails_Controller.php index 16b213b..663c950 100644 --- a/includes/Controllers/Emails_Controller.php +++ b/includes/Controllers/Emails_Controller.php @@ -14,7 +14,8 @@ namespace Lpac\Controllers; use Lpac\Helpers\Functions as Functions_Helper; -use Lpac\Helpers\QR_Code_Generator as QR_Code_Generator; +use Lpac\Helpers\QR_Code_Generator; +use Lpac\Traits\Upload_Folders; /** * Class emails. @@ -23,6 +24,7 @@ * */ class Emails_Controller { + use Upload_Folders; /** * Outputs a Button or QR Code inside order emails. @@ -40,7 +42,13 @@ public function add_delivery_location_link_to_email( $order, $sent_to_admin, $pl $latitude = get_post_meta( $order->get_id(), '_lpac_latitude', true ); $longitude = get_post_meta( $order->get_id(), '_lpac_longitude', true ); - $map_link = apply_filters( 'lpac_email_map_link_provider', "https://www.google.com/maps/search/?api=1&query=${latitude},${longitude}", $latitude, $longitude ); + + // If we have no results return. + if ( empty( $latitude ) or empty( $longitude ) ) { + return; + } + + $map_link = apply_filters( 'lpac_email_map_link_provider', "https://www.google.com/maps/search/?api=1&query=${latitude},${longitude}", $latitude, $longitude ); $map_link_type = get_option( 'lpac_email_delivery_map_link_type' ); @@ -49,7 +57,7 @@ public function add_delivery_location_link_to_email( $order, $sent_to_admin, $pl } elseif ( $map_link_type === 'qr_code' ) { $this->create_delivery_location_link_qrcode( $map_link, $order->get_id() ); } elseif ( $map_link_type === 'static_map' ) { - $this->create_delivery_location_static_map( $map_link, $latitude, $longitude ); + $this->create_delivery_location_static_map( $order->get_id(), $map_link, $latitude, $longitude ); } else { $this->create_delivery_location_link_button( $map_link ); } @@ -88,6 +96,9 @@ private function create_delivery_location_link_button( $link ) { */ private function create_delivery_location_link_qrcode( $link, $order_id ) { + $folder_name = 'qr-codes'; + + // TODO allow controlling of these figures $options = array( 'qr_code_data' => $link, 'qr_code_foreground_rgb' => '0,0,0', @@ -97,17 +108,17 @@ private function create_delivery_location_link_qrcode( $link, $order_id ) { /* * Generate and save QR Code */ - QR_Code_Generator::lpac_generate_qr_code( $options, $order_id ); + ( new QR_Code_Generator )->lpac_generate_qr_code( $options, $order_id ); /* - * https://example.com/wp-content/uploads/lpac/qr-codes/Y/m/d/order_id.jpg + * https://example.com/wp-content/uploads/lpac/qr-codes/order_id.jpg */ - $qr_code_link = Functions_Helper::lpac_get_qr_codes_directory( 'baseurl' ) . $order_id . '.jpg'; + $qr_code_link = $this->get_resource_url( $folder_name, $order_id, '.jpg' ); $delivery_location_text = __( 'Delivery Location', 'map-location-picker-at-checkout-for-woocommerce' ); $delivery_location_text = apply_filters( 'lpac_email_map_location_link_button_text', $delivery_location_text ); echo "
"; @@ -121,7 +132,9 @@ private function create_delivery_location_link_qrcode( $link, $order_id ) { * @return void * @since 1.4.0 */ - private function create_delivery_location_static_map( $map_link, $latitude, $longitude ) { + private function create_delivery_location_static_map( $order_id, $map_link, $latitude, $longitude ) { + + $folder_name = 'static-maps'; $center = $latitude . ',' . $longitude; $center = sanitize_text_field( apply_filters( 'lpac_email_static_map_center', $center ) ); @@ -143,6 +156,18 @@ private function create_delivery_location_static_map( $map_link, $latitude, $lon $api_key ); + $save_path = $this->create_upload_folder( $folder_name ); + + $file_name = $save_path . $order_id . '.jpg'; + + $image = file_put_contents( $file_name, file_get_contents( $full_link ) ); + + if ( empty( $image ) ) { + return; + } + + $image_src = $this->get_resource_url( $folder_name, $order_id, '.jpg' ); + $width = ''; $height = ''; @@ -152,7 +177,7 @@ private function create_delivery_location_static_map( $map_link, $latitude, $lon $height = $size_parts[1]; } - $image = ""; + $image = ""; echo $image; } diff --git a/includes/Helpers/QR_Code_Generator.php b/includes/Helpers/QR_Code_Generator.php index 7ef4b7b..27633a3 100644 --- a/includes/Helpers/QR_Code_Generator.php +++ b/includes/Helpers/QR_Code_Generator.php @@ -21,10 +21,13 @@ use Endroid\QrCode\RoundBlockSizeMode\RoundBlockSizeModeMargin; use Endroid\QrCode\Writer\PngWriter; use Endroid\QrCode\Label\Font\NotoSans; +use Lpac\Traits\Upload_Folders; // use Endroid\QrCode\Label\Font\OpenSans; class QR_Code_Generator { + use Upload_Folders; + /** * Creates a QR code * @@ -33,9 +36,11 @@ class QR_Code_Generator { * * @since 1.1.0 */ - public static function lpac_generate_qr_code( $options, $order_id ) { + public function lpac_generate_qr_code( $options, $order_id ) { + + $folder_name = 'qr-codes'; - $path = self::lpac_qr_codes_directory(); + $path = $this->create_upload_folder( $folder_name ); if ( empty( $path ) ) { error_log( 'Location Picker At Checkout for WooCommerce: QR Code directory path returned empty. See Lpac_Qr_Code_Generator::lpac_generate_qr_code()' ); @@ -91,30 +96,4 @@ public static function lpac_generate_qr_code( $options, $order_id ) { } - /** - * Creates a QR code - * - * @since 1.1.0 - */ - public static function lpac_qr_codes_directory() { - - $upload_dir = wp_upload_dir(); - $qr_codes_dir = ''; - - if ( ! empty( $upload_dir['basedir'] ) ) { - - $qr_codes_dir = $upload_dir['basedir'] . '/lpac/qr-codes/' . date( 'Y' ) . '/' . date( 'm' ) . '/' . date( 'd' ) . '/'; - $qr_codes_dir = apply_filters( 'lpac_qrcodes_path', $qr_codes_dir ); - - if ( ! file_exists( $qr_codes_dir ) ) { - wp_mkdir_p( $qr_codes_dir ); - } - - return $qr_codes_dir; - } - - return $qr_codes_dir; - - } - } diff --git a/includes/Notices/Admin.php b/includes/Notices/Admin.php index 212a4c6..60c0efe 100644 --- a/includes/Notices/Admin.php +++ b/includes/Notices/Admin.php @@ -28,7 +28,10 @@ public function lpac_wc_not_active_notice() { ?>HTML element */ + echo sprintf( __( '%1$s%2$sLocation Picker at Checkout for WooCommerce(LPAC) NOTICE:%3$s WooCommerce is not activated, please activate it to use the plugin.%4$s', 'map-location-picker-at-checkout-for-woocommerce' ), '
', '', '', '
' ); + ?>HTML element */ + echo sprintf( __( '%1$s%2$sLocation Picker at Checkout for WooCommerce(LPAC) NOTICE:%3$s HTTPS not detected on this website. The plugin will not work. Please enable HTTPS on this website.%4$s', 'map-location-picker-at-checkout-for-woocommerce' ), '
', '', '', '
' ); + ?> + +HTML element */ + echo sprintf( __( '%1$s%2$sLocation Picker at Checkout for WooCommerce(LPAC) NOTICE:%3$s PHP version too low to use this plugin. Please change to at least PHP 7.0. You can contact your web host for assistance in updating your PHP version.%4$s', 'map-location-picker-at-checkout-for-woocommerce' ), '
', '', '', '
' ); + ?>$description
+$description
TMWXH+CW
. %s', 'map-location-picker-at-checkout-for-woocommerce' ), "{$learn_more}" ),
+ 'desc_tip' => sprintf( __( 'If you enable this option the plugin will attempt to remove the Plus Code that shows infront addresses returned by Google Maps. Example TMWXH+CW
. %s', 'map-location-picker-at-checkout-for-woocommerce' ), "{$learn_more}" ),
'desc' => __( 'Yes', 'map-location-picker-at-checkout-for-woocommerce' ),
'id' => 'lpac_remove_address_plus_code',
'type' => 'checkbox',
@@ -245,7 +245,7 @@ public function lpac_create_general_setting_fields()
);
$lpac_settings[] = array(
'name' => __( 'Show Map on the Order Received Page', 'map-location-picker-at-checkout-for-woocommerce' ),
- 'desc_tip' => sprintf( __( 'This option displays a map view on the order received page after an order has been placed by a customer. %s', 'map-location-picker-at-checkout-for-woocommerce' ), " {$learn_more} " ),
+ 'desc_tip' => sprintf( __( 'This option displays a map view on the order received page after an order has been placed by a customer. %s', 'map-location-picker-at-checkout-for-woocommerce' ), " {$learn_more} " ),
'id' => 'lpac_display_map_on_order_received_page',
'type' => 'checkbox',
'css' => 'min-width:300px;',
@@ -253,7 +253,7 @@ public function lpac_create_general_setting_fields()
);
$lpac_settings[] = array(
'name' => __( 'Show Map on View Order Page', 'map-location-picker-at-checkout-for-woocommerce' ),
- 'desc_tip' => sprintf( __( 'This option displays a map view on the order details page in the customer account. %s', 'map-location-picker-at-checkout-for-woocommerce' ), " {$learn_more} " ),
+ 'desc_tip' => sprintf( __( 'This option displays a map view on the order details page in the customer account. %s', 'map-location-picker-at-checkout-for-woocommerce' ), " {$learn_more} " ),
'id' => 'lpac_display_map_on_view_order_page',
'type' => 'checkbox',
'css' => 'min-width:300px;',
@@ -261,7 +261,7 @@ public function lpac_create_general_setting_fields()
);
$lpac_settings[] = array(
'name' => __( 'Add Map Link to Order Emails?', 'map-location-picker-at-checkout-for-woocommerce' ),
- 'desc_tip' => sprintf( __( 'Add either a Button or QR Code that links to Google Maps to the order emails. %s', 'map-location-picker-at-checkout-for-woocommerce' ), "{$learn_more}" ),
+ 'desc_tip' => sprintf( __( 'Add either a Button or QR Code that links to Google Maps to the order emails. %s', 'map-location-picker-at-checkout-for-woocommerce' ), "{$learn_more}" ),
'id' => 'lpac_enable_delivery_map_link_in_email',
'desc' => __( 'Yes', 'map-location-picker-at-checkout-for-woocommerce' ),
'type' => 'checkbox',
@@ -269,7 +269,7 @@ public function lpac_create_general_setting_fields()
$lpac_settings[] = array(
'name' => __( 'Link Type', 'map-location-picker-at-checkout-for-woocommerce' ),
'desc_tip' => __( 'Add either a button to Google Maps, a QR Code or Static Map to the order emails.', 'map-location-picker-at-checkout-for-woocommerce' ),
- 'desc' => sprintf( __( 'The Static Map option requires enabling a special Google Maps API. Please read the following doc to %1$s %2$s QR Codes are saved to your uploads directory at: /wp-content/uploads/lpac/qr-codes/year/month/day/order_id.jpg
', 'map-location-picker-at-checkout-for-woocommerce' ), "{$learn_more}", '/wp-content/uploads/lpac/qr-codes/order_id.jpg
', 'map-location-picker-at-checkout-for-woocommerce' ), "{$learn_more}", '',
+ '/wp-content/uploads/lpac/order-exports/',
+ '
'
+ ),
+ 'custom_attributes' => array(
+ 'disabled' => 'disabled',
+ ),
+ );
+ $lpac_dummy_export_pro_settings[] = array(
+ 'type' => 'sectionend',
+ 'id' => 'lpac_export_section_end',
+ );
+ return $lpac_dummy_export_pro_settings;
+ }
+
+ /**
+ * Create Dummy Pro fields.
+ *
+ * @return array
+ */
+ private function create_dummy_pro_fields()
+ {
+ $lpac_dummy_pro_settings = array();
+ /* translators: 1: Dashicons outbound link icon */
+ $learn_more = sprintf( __( 'Learn More %s', 'map-location-picker-at-checkout-for-woocommerce' ), '' );
+ //TODO Create tutorial for using snazzy maps
+ $lpac_dummy_pro_settings[] = array(
+ 'name' => __( 'Get More With PRO', 'map-location-picker-at-checkout-for-woocommerce' ),
+ 'id' => 'lpac_premium',
+ 'type' => 'title',
+ );
+ $lpac_dummy_pro_settings[] = array(
+ 'name' => 'Map ID',
+ 'class' => 'dashicons-before dashicons-lock premium-dummy-subsection',
+ 'type' => 'hr',
+ 'desc' => sprintf( __( 'Set the Map ID for the respective Maps. You can create a custom map for each entry. %s', 'map-location-picker-at-checkout-for-woocommerce' ), "{$learn_more}" ),
+ );
+ $lpac_dummy_pro_settings[] = array(
+ 'name' => __( 'Checkout Page Map ID', 'map-location-picker-at-checkout-for-woocommerce' ),
+ 'desc_tip' => __( 'The Map ID to use for your Checkout page for styling.', 'map-location-picker-at-checkout-for-woocommerce' ),
+ 'placeholder' => 'cfceab16...',
+ 'type' => 'text',
+ 'custom_attributes' => array(
+ 'disabled' => 'disabled',
+ ),
+ );
+ $lpac_dummy_pro_settings[] = array(
+ 'name' => __( 'Order Received Page Map ID', 'map-location-picker-at-checkout-for-woocommerce' ),
+ 'desc_tip' => __( 'The Map ID to use for your "Order Received" page for styling.', 'map-location-picker-at-checkout-for-woocommerce' ),
+ 'placeholder' => 'cfceab16...',
+ 'type' => 'text',
+ 'custom_attributes' => array(
+ 'disabled' => 'disabled',
+ ),
+ );
+ $lpac_dummy_pro_settings[] = array(
+ 'name' => __( 'View Order Page Map ID', 'map-location-picker-at-checkout-for-woocommerce' ),
+ 'desc_tip' => __( 'The Map ID to use for your "View Order" page for styling.', 'map-location-picker-at-checkout-for-woocommerce' ),
+ 'placeholder' => 'cfceab16...',
+ 'type' => 'text',
+ 'custom_attributes' => array(
+ 'disabled' => 'disabled',
+ ),
+ );
+ $lpac_dummy_pro_settings[] = array(
+ 'name' => __( 'Admin Dashboard View Order Page Map ID', 'map-location-picker-at-checkout-for-woocommerce' ),
+ 'desc_tip' => __( 'The Map ID to use for your the "View Order" page inside the WordPress admin Dashboard.', 'map-location-picker-at-checkout-for-woocommerce' ),
+ 'placeholder' => 'cfceab16...',
+ 'type' => 'text',
+ 'custom_attributes' => array(
+ 'disabled' => 'disabled',
+ ),
+ );
+ $lpac_dummy_pro_settings[] = array(
+ 'name' => 'Marker Icon',
+ 'class' => 'dashicons-before dashicons-lock premium-dummy-subsection',
+ 'desc' => sprintf( __( 'Set a custom icon to be used for the map marker. %s', 'map-location-picker-at-checkout-for-woocommerce' ), "{$learn_more}" ),
+ 'type' => 'hr',
+ );
+ $lpac_dummy_pro_settings[] = array(
+ 'name' => __( 'Link to Icon', 'map-location-picker-at-checkout-for-woocommerce' ),
+ 'desc_tip' => __( 'The icon to use as the map marker.', 'map-location-picker-at-checkout-for-woocommerce' ),
+ 'desc' => __( 'Enter the URL to the icon that should be used as the custom map marker.', 'map-location-picker-at-checkout-for-woocommerce' ),
+ 'type' => 'url',
+ 'custom_attributes' => array(
+ 'disabled' => 'disabled',
+ ),
+ );
+ $lpac_dummy_pro_settings[] = array(
+ 'name' => __( 'Marker Anchor Points', 'map-location-picker-at-checkout-for-woocommerce' ),
+ 'desc' => __( 'The anchor point for the marker in X,Y values. Used to show customer where exactly they\'re moving the marker to. The X value is usually half of the image width, the Y is usually the height of the image + 3. Be sure to test the map marker after setting these values to ensure the anchor works well.', 'map-location-picker-at-checkout-for-woocommerce' ),
+ 'placeholder' => '15, 33',
+ 'type' => 'text',
+ 'css' => 'max-width:80px;',
+ 'custom_attributes' => array(
+ 'disabled' => 'disabled',
+ ),
+ );
+ $lpac_dummy_pro_settings[] = array(
+ 'name' => 'Saved Addresses',
+ 'class' => 'dashicons-before dashicons-lock premium-dummy-subsection',
+ 'desc' => sprintf( __( 'Allow customers to save different addresses for later use. %s', 'map-location-picker-at-checkout-for-woocommerce' ), "{$learn_more}" ),
+ 'type' => 'hr',
+ );
+ $lpac_dummy_pro_settings[] = array(
+ 'name' => __( 'Enable', 'map-location-picker-at-checkout-for-woocommerce' ),
+ 'desc' => __( 'Yes', 'map-location-picker-at-checkout-for-woocommerce' ),
+ 'type' => 'checkbox',
+ 'css' => 'max-width:80px;',
+ 'custom_attributes' => array(
+ 'disabled' => 'disabled',
+ ),
+ );
+ $lpac_dummy_pro_settings[] = array(
+ 'name' => 'Places Autocomplete',
+ 'class' => 'dashicons-before dashicons-lock premium-dummy-subsection',
+ 'desc' => sprintf( __( 'Restrict the Places Autocomplete feature to your preferred country. %s', 'map-location-picker-at-checkout-for-woocommerce' ), "{$learn_more}" ),
+ 'type' => 'hr',
+ );
+ $lpac_dummy_pro_settings[] = array(
+ 'name' => __( 'Restrict Places Autocomplete Countries', 'map-location-picker-at-checkout-for-woocommerce' ),
+ 'desc' => __( "Select the countries you'd like addresses to be pulled from when using the Places Autocomplete feature.", 'map-location-picker-at-checkout-for-woocommerce' ),
+ 'desc_tip' => __( 'Use this feature if you only want to show address results from a specific country or countries.', 'map-location-picker-at-checkout-for-woocommerce' ),
+ 'type' => 'multiselect',
+ 'options' => array(),
+ 'css' => 'height:40px;',
+ 'custom_attributes' => array(
+ 'disabled' => 'disabled',
+ ),
+ );
+ $lpac_dummy_pro_settings[] = array(
+ 'name' => 'Shipping Cost by Distance',
+ 'class' => 'dashicons-before dashicons-lock premium-dummy-subsection',
+ 'desc' => sprintf( __( 'Charge customers based on the distance between your store and their location. Be sure to test this before committing to the changes. %s', 'map-location-picker-at-checkout-for-woocommerce' ), "{$learn_more}" ),
+ 'type' => 'hr',
+ );
+ $lpac_dummy_pro_settings[] = array(
+ 'name' => __( 'Distance Matrix API Key', 'map-location-picker-at-checkout-for-woocommerce' ),
+ 'desc' => __( 'This is a specific API key created just for usage of Google\'s Distance Matrix API. The key should have no referrer restrictions set on it.', 'map-location-picker-at-checkout-for-woocommerce' ),
+ 'placeholder' => 'AIzaSyD8seU-lym435g...',
+ 'type' => 'password',
+ 'custom_attributes' => array(
+ 'disabled' => 'disabled',
+ ),
+ );
+ $lpac_dummy_pro_settings[] = array(
+ 'name' => __( 'Origin Coordinates', 'map-location-picker-at-checkout-for-woocommerce' ),
+ 'desc' => sprintf( __( 'Enter the coordinates of the location from which the delivery/pickup will begin. This might be the coordinates for your physical store or business. If you have multiple origin locations (example multiple stores) then enter the coordinates for the preferred one. You can find the coordinates for a location %1$sHere >>%2$s', 'map-location-picker-at-checkout-for-woocommerce' ), '', '' ),
+ 'placeholder' => '14.024519,-60.974876',
+ 'type' => 'text',
+ 'css' => 'max-width:180px;',
+ 'custom_attributes' => array(
+ 'disabled' => 'disabled',
+ ),
+ );
+ $lpac_dummy_pro_settings[] = array(
+ 'name' => __( 'Cost per Unit', 'map-location-picker-at-checkout-for-woocommerce' ),
+ 'desc' => __( 'Enter the price you wish to charge per Kilometer/Mile. The default store currency will be used.', 'map-location-picker-at-checkout-for-woocommerce' ),
+ 'placeholder' => '0.50',
+ 'type' => 'text',
+ 'css' => 'max-width:80px;',
+ 'custom_attributes' => array(
+ 'disabled' => 'disabled',
+ ),
+ );
+ $lpac_dummy_pro_settings[] = array(
+ 'name' => __( 'Distance Unit', 'map-location-picker-at-checkout-for-woocommerce' ),
+ 'desc' => __( 'Select your preferred unit. By Default the Distance Matrix API returns values in Metric Units. If Miles is selected then Kilometers will be converted into Miles where 1 Kilometer is equivalent to 0.621371 Miles.', 'map-location-picker-at-checkout-for-woocommerce' ),
+ 'type' => 'select',
+ 'options' => array(
+ 'km' => __( 'Kilometers', 'map-location-picker-at-checkout-for-woocommerce' ),
+ 'mile' => __( 'Miles', 'map-location-picker-at-checkout-for-woocommerce' ),
+ ),
+ 'css' => 'max-width:120px;',
+ 'custom_attributes' => array(
+ 'disabled' => 'disabled',
+ ),
+ );
+ $lpac_dummy_pro_settings[] = array(
+ 'name' => __( 'Travel Mode', 'map-location-picker-at-checkout-for-woocommerce' ),
+ 'desc' => __( 'Enter the travel mode you will be using. Though multiple options are provided, you might always want to use "driving" for best results.', 'map-location-picker-at-checkout-for-woocommerce' ),
+ 'placeholder' => '2.50',
+ 'type' => 'select',
+ 'options' => array(
+ 'driving' => __( 'Driving', 'map-location-picker-at-checkout-for-woocommerce' ),
+ 'bicycling' => __( 'Bicycling', 'map-location-picker-at-checkout-for-woocommerce' ),
+ 'walking' => __( 'Walking', 'map-location-picker-at-checkout-for-woocommerce' ),
+ ),
+ 'css' => 'max-width:120px;',
+ 'custom_attributes' => array(
+ 'disabled' => 'disabled',
+ ),
+ );
+ $lpac_dummy_pro_settings[] = array(
+ 'name' => __( 'Shipping Methods', 'map-location-picker-at-checkout-for-woocommerce' ),
+ 'class' => 'wc-enhanced-select',
+ 'desc' => __( 'Select the Shipping Method(s) this feature applies to. If there is a cost already set on the shipping method, then that base cost will be added to the cost calculated using the distance.', 'map-location-picker-at-checkout-for-woocommerce' ),
+ 'type' => 'multiselect',
+ 'options' => array(),
+ 'css' => 'height:40px;',
+ 'custom_attributes' => array(
+ 'disabled' => 'disabled',
+ ),
+ );
+ $lpac_dummy_pro_settings[] = array(
+ 'type' => 'sectionend',
+ 'id' => 'lpac_dummy_premium_settings_section_end',
+ );
+ return $lpac_dummy_pro_settings;
+ }
+
/**
* House all the plugin settings to do with Debugging.
*
@@ -576,7 +910,7 @@ private function output_map_visibility_rules_order()
}
/* translators: 1: Learn more link*/
- $info_text = sprintf( esc_html( 'Use the table below to arrange the map visibility rules by dragging and dropping. The last rule in the the table decides the final visibility state of the map. %s', 'map-location-picker-at-checkout-for-woocommerce' ), "{$learn_more}" );
+ $info_text = sprintf( esc_html( 'Use the table below to arrange the map visibility rules by dragging and dropping. The last rule in the the table decides the final visibility state of the map. %s', 'map-location-picker-at-checkout-for-woocommerce' ), "{$learn_more}" );
?>
{$signup_text}
\t\t\t\t\t$edit_saved_addresses
+HTML element */ + echo sprintf( + __( '%1$s%2$sLocation Picker at Checkout for WooCommerce(LPAC) NOTICE:%3$s You need to deactivate and delete the free version of the plugin before using the PRO version. Your current settings will remain in place.%4$s', 'map-location-picker-at-checkout-for-woocommerce' ), + '
', + '', + '', + '
' + ) ; + ?> +