Skip to content

Commit

Permalink
Merge pull request #20 from UVLabs/development
Browse files Browse the repository at this point in the history
chore: syncing
  • Loading branch information
UVLabs authored Dec 28, 2021
2 parents 01802ec + 56015fc commit af36b6c
Show file tree
Hide file tree
Showing 8 changed files with 55 additions and 37 deletions.
4 changes: 2 additions & 2 deletions assets/public/js/maps/checkout-page-map.js
Original file line number Diff line number Diff line change
Expand Up @@ -670,7 +670,7 @@ function changeMapVisibility(show){
*/
function lpacHideShowMap(){

wp.ajax.post( "lpac_to_be_or_not_to_be", {} )
wp.ajax.post( "lpac_checkout_map_visibility", {} )
.done(function(response) {

const show = Boolean(response);
Expand Down Expand Up @@ -866,7 +866,7 @@ addPlacesAutoComplete();
if( ! mapOptions.lpac_places_autocomplete_hide_map ){
$(document.body).on('updated_checkout', lpacHideShowMap);
}

// If the auto detect location feature is turned on, then detect the location but don't output the last order details.
if( mapOptions.lpac_auto_detect_location ){
lpac_bootstrap_map_functionality(geocoder, map, infowindow)
Expand Down
1 change: 1 addition & 0 deletions class-lpac-uninstall.php
Original file line number Diff line number Diff line change
Expand Up @@ -95,6 +95,7 @@ public static function remove_plugin_settings() {
'lpac_map_anchor_points',
'lpac_admin_view_order_map_id',
'lpac_installed_at_version',
'lpac_first_install_date',
'lpac_remove_address_plus_code',
'lpac_enable_places_autocomplete',
'lpac_places_autocomplete_fields',
Expand Down
4 changes: 2 additions & 2 deletions includes/Bootstrap/Main.php
Original file line number Diff line number Diff line change
Expand Up @@ -273,8 +273,8 @@ private function define_public_hooks()
/*
* Handles showing or hiding of map. Fires everytime the checkout page is updated.
*/
$this->loader->add_action( 'wp_ajax_nopriv_lpac_to_be_or_not_to_be', $controller_map_visibility, 'checkout_map_visibility_ajax_handler' );
$this->loader->add_action( 'wp_ajax_lpac_to_be_or_not_to_be', $controller_map_visibility, 'checkout_map_visibility_ajax_handler' );
$this->loader->add_action( 'wp_ajax_nopriv_lpac_checkout_map_visibility', $controller_map_visibility, 'checkout_map_visibility_ajax_handler' );
$this->loader->add_action( 'wp_ajax_lpac_checkout_map_visibility', $controller_map_visibility, 'checkout_map_visibility_ajax_handler' );
/*
* Validate checkout map details and then add the latitude and longitude to the order meta.
*/
Expand Down
4 changes: 2 additions & 2 deletions includes/Models/Location_Details.php
Original file line number Diff line number Diff line change
Expand Up @@ -36,8 +36,8 @@ public function validate_map_visibility( $order_id, $data ) {
return;
}

$lat = $data['lpac_latitude'] ?? '';
$long = $data['lpac_longitude'] ?? '';
$lat = (float) $data['lpac_latitude'] ?? (float) 0.0;
$long = (float) $data['lpac_longitude'] ?? (float) 0.0;

$this->save_order_meta_cords( $order_id, $lat, $long );

Expand Down
4 changes: 4 additions & 0 deletions includes/Notices/Admin.php
Original file line number Diff line number Diff line change
Expand Up @@ -88,4 +88,8 @@ public function output_php_version_notice() {

}

public function create_pro_version_released_notice() {
// TODO Create notice helper functions with notice ID in URL and should_show_notice($user_id, $notice_id) method
}

}
8 changes: 8 additions & 0 deletions includes/class-lpac-activator.php
Original file line number Diff line number Diff line change
Expand Up @@ -38,8 +38,16 @@ public static function activate() {
* @return void
*/
private static function lpac_add_default_settings() {

$installed_at = get_option( 'lpac_installed_at_version' );
$install_date = get_option( 'lpac_first_install_date' );

// Create date timestamp when plugin was first installed.
if ( empty( $install_date ) ) {
add_option( 'lpac_first_install_date', time(), '', 'yes' );
}

// Create entry for plugin first install version.
if ( empty( $installed_at ) ) {
add_option( 'lpac_installed_at_version', LPAC_VERSION, '', false );
}
Expand Down
62 changes: 32 additions & 30 deletions lpac.php
Original file line number Diff line number Diff line change
Expand Up @@ -15,9 +15,9 @@
*
* @wordpress-plugin
* Plugin Name: Location Picker At Checkout For WooCommerce
* Plugin URI: https://soaringleads.com
* Plugin URI: https://lpacwp.com
* Description: Allow customers to choose their shipping location using a map at checkout.
* Version: 1.4.1-lite
* Version: 1.4.2-lite
* Author: Uriahs Victor
* Author URI: https://uriahsvictor.com
* License: GPL-2.0+
Expand All @@ -32,6 +32,35 @@
if ( !defined( 'WPINC' ) ) {
die;
}
if ( !defined( 'LPAC_VERSION' ) ) {
define( 'LPAC_VERSION', '1.4.2' );
}
/**
* The code that runs during plugin activation.
* This action is documented in includes/class-lpac-activator.php
*/
if ( !function_exists( 'activate_lpac' ) ) {
function activate_lpac()
{
require_once plugin_dir_path( __FILE__ ) . 'includes/class-lpac-activator.php';
Lpac_Activator::activate();
}

}
/**
* The code that runs during plugin deactivation.
* This action is documented in includes/class-lpac-deactivator.php
*/
if ( !function_exists( 'deactivate_lpac' ) ) {
function deactivate_lpac()
{
require_once plugin_dir_path( __FILE__ ) . 'includes/class-lpac-deactivator.php';
Lpac_Deactivator::deactivate();
}

}
register_activation_hook( __FILE__, 'activate_lpac' );
register_deactivation_hook( __FILE__, 'deactivate_lpac' );
/*
* Check if the Free version is installed and show notice about deactivating it.
* We're checking the plugin folder so this can only be ran for the PRO plugin.
Expand All @@ -54,7 +83,7 @@
<?php
/* translators: 1: Opening <p> HTML element 2: Opening <strong> HTML element 3: Closing <strong> HTML element 4: Closing <p> 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' ),
__( '%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' ),
'<p>',
'<strong>',
'</strong>',
Expand Down Expand Up @@ -150,7 +179,6 @@ function lpac_fs()
* Start at version 1.0.0 and use SemVer - https://semver.org
* Rename this for your plugin and update it as you release new versions.
*/
define( 'LPAC_VERSION', '1.4.1' );
define( 'LPAC_PLUGIN_NAME', 'lpac' );
define( 'LPAC_PLUGIN_DIR', __DIR__ . '/' );
define( 'LPAC_PLUGIN_ASSETS_DIR', __DIR__ . '/assets/' );
Expand All @@ -174,32 +202,6 @@ function lpac_fs()
}
}
define( 'LPAC_DEBUG', $debug );
/**
* The code that runs during plugin activation.
* This action is documented in includes/class-lpac-activator.php
*/
if ( !function_exists( 'activate_lpac' ) ) {
function activate_lpac()
{
require_once plugin_dir_path( __FILE__ ) . 'includes/class-lpac-activator.php';
Lpac_Activator::activate();
}

}
/**
* The code that runs during plugin deactivation.
* This action is documented in includes/class-lpac-deactivator.php
*/
if ( !function_exists( 'deactivate_lpac' ) ) {
function deactivate_lpac()
{
require_once plugin_dir_path( __FILE__ ) . 'includes/class-lpac-deactivator.php';
Lpac_Deactivator::deactivate();
}

}
register_activation_hook( __FILE__, 'activate_lpac' );
register_deactivation_hook( __FILE__, 'deactivate_lpac' );
/**
* Begins execution of the plugin.
*
Expand Down
5 changes: 4 additions & 1 deletion readme.txt
Original file line number Diff line number Diff line change
Expand Up @@ -5,7 +5,7 @@ Tags: woocommerce, location picker, checkout map, geolocation, google map, map,
Requires at least: 5.5
Requires PHP: 7.0
Tested up to: 5.8
Stable tag: 1.4.0
Stable tag: 1.4.2
License: GPLv2 or later
License URI: http://www.gnu.org/licenses/gpl-2.0.html

Expand Down Expand Up @@ -162,6 +162,9 @@ The save location of QR codes have been changed. Links to QR codes in past order

== Changelog ==

= 1.4.2 =
* [Fix] Checkout process would halt unless a location was selected by a customer regardless of "Force Map use" option status.

= 1.4.1 =
* [New PRO] Export Order Locations.
* [New PRO] Custom Google Map Designs.
Expand Down

0 comments on commit af36b6c

Please sign in to comment.