Changeset 2676945
- Timestamp:
- 02/11/2022 09:12:16 AM (4 years ago)
- Location:
- lalamove
- Files:
-
- 8 edited
- 1 copied
-
tags/1.0.4 (copied) (copied from lalamove/trunk)
-
tags/1.0.4/includes/class-lalamove-app.php (modified) (2 diffs)
-
tags/1.0.4/includes/utility-functions.php (modified) (2 diffs)
-
tags/1.0.4/lalamove.php (modified) (5 diffs)
-
tags/1.0.4/readme.txt (modified) (3 diffs)
-
trunk/includes/class-lalamove-app.php (modified) (2 diffs)
-
trunk/includes/utility-functions.php (modified) (2 diffs)
-
trunk/lalamove.php (modified) (5 diffs)
-
trunk/readme.txt (modified) (3 diffs)
Legend:
- Unmodified
- Added
- Removed
-
lalamove/tags/1.0.4/includes/class-lalamove-app.php
r2661191 r2676945 15 15 public static $menu_slug = 'Lalamove'; 16 16 public static $wc_llm_web_app_host = 'https://web.lalamove.com'; 17 public static $sa_url = 'https://uba.huolalamove.net/sa?project=default'; 17 18 public static $llm_order_column_key = 'Lalamove'; 18 19 public static $llm_order_column_title = 'Lalamove'; … … 22 23 ); 23 24 public static $wc_llm_dc = array( 24 'sg' => array( 'sg', 30000 ),25 'my' => array( 'sg', 40000 ),26 'ph' => array( 'sg', 50000 ),27 'tw' => array( 'sg', 80000 ),28 'hk' => array( 'sg', 90000 ),29 'vn' => array( 'sg', 100000 ),30 'th' => array( 'sg', 110000 ),31 'id' => array( 'sg', 120000 ),32 'br' => array( 'br', 20000 ),33 'mx' => array( 'br', 60000 ),25 'sg' => array( 'sg', 30000, 'SIN' ), 26 'my' => array( 'sg', 40000, 'SIN' ), 27 'ph' => array( 'sg', 50000, 'SIN' ), 28 'tw' => array( 'sg', 80000, 'SIN' ), 29 'hk' => array( 'sg', 90000, 'SIN' ), 30 'vn' => array( 'sg', 100000, 'SIN' ), 31 'th' => array( 'sg', 110000, 'SIN' ), 32 'id' => array( 'sg', 120000, 'SIN' ), 33 'br' => array( 'br', 20000, 'SAO' ), 34 'mx' => array( 'br', 60000, 'SAO' ), 34 35 ); 35 36 -
lalamove/tags/1.0.4/includes/utility-functions.php
r2661191 r2676945 198 198 199 199 function lalamove_get_current_plugin_param( $key ) { 200 if ( empty( $_SERVER[' REQUEST_URI'] ) ) {200 if ( empty( $_SERVER['QUERY_STRING'] ) ) { 201 201 return ''; 202 202 } 203 $url_query_str = wp_parse_url( admin_url( basename( esc_url_raw( wp_unslash( $_SERVER['REQUEST_URI'] ) ) ) ), PHP_URL_QUERY ); 204 parse_str( $url_query_str, $query ); 203 parse_str( $_SERVER['QUERY_STRING'], $query ); 205 204 if ( empty( $query[ $key ] ) ) { 206 205 return ''; … … 240 239 error_log( $out ); 241 240 } 241 242 function lalamove_track( $event, $payload = array() ) { 243 $shop = preg_replace( '/^http:\/\/|^https:\/\//i', '', get_option( 'siteurl' ) ); 244 $wc_country = WC()->countries->get_base_country(); 245 $lalamove_country = lalamove_get_country( strtolower( $wc_country ) ); 246 $dc = $lalamove_country ? $lalamove_country[2] : $wc_country; 247 248 if ( strtoupper( substr( PHP_OS, 0, 3 ) ) == 'WIN' ) { 249 $event_time = substr( ( microtime( true ) * 1000 ), 0, 13 ); 250 } else { 251 $event_time = (int) ( microtime( true ) * 1000 ); 252 } 253 254 $lib_properties = array( 255 '$lib' => 'php', 256 '$lib_version' => '1.0', 257 '$lib_method' => 'code', 258 ); 259 260 $default_properties = array( 261 'llm_source' => 'woocommerce', 262 'trigger_time' => gmdate( 'c', time() ), 263 'shopName' => $shop, 264 'country' => $wc_country, 265 'city' => WC()->countries->get_base_city(), 266 'language' => get_locale(), 267 'data_center' => $dc, 268 'app_version' => lalamove_get_version(), 269 'php_version' => PHP_VERSION, 270 'env' => 'prd', 271 ); 272 273 $data = array( 274 'type' => 'track', 275 'properties' => array_merge( $default_properties, $payload ), 276 'time' => $event_time, 277 'event' => $event, 278 'distinct_id' => "{$dc}-{$shop}", 279 'lib' => $lib_properties, 280 ); 281 282 $packed_data = base64_encode( gzencode( '[' . json_encode( $data ) . ']' ) ); 283 284 $body = 'data_list=' . urlencode( $packed_data ) . '&gzip=1'; 285 286 wp_remote_post( 287 Lalamove_App::$sa_url, 288 array( 289 'timeout' => 2, 290 'blocking' => false, 291 'headers' => array( 'Content-Type' => 'text/plain' ), 292 'user-agent' => 'PHP SDK', 293 'body' => $body, 294 ) 295 ); 296 } 297 -
lalamove/tags/1.0.4/lalamove.php
r2661191 r2676945 4 4 * Plugin URI: https://wordpress.org/plugins/lalamove 5 5 * Description: A 24/7 on-demand delivery app 6 * Version: 1.0. 36 * Version: 1.0.4 7 7 * Author: partner.support@lalamove.com 8 8 * Author URI: https://lalamove.com/ … … 44 44 $page_menu_display, 45 45 $page_menu_display, 46 'manage_ options',46 'manage_woocommerce', 47 47 'Lalamove', 48 48 'lalamove_web', … … 76 76 $sub_page = lalamove_get_current_plugin_param( 'sub-page' ); 77 77 78 if ( lalamove_get_current_plugin_param( 'success' ) ) { 79 lalamove_track( 'plugin_authorized' ); 80 } 81 78 82 if ( $sub_page === 'place-order' ) { 79 83 $place_order_url = lalamove_get_service_url() . '/place-order?id=' . lalamove_get_current_plugin_param( 'id' ) . '&name=' . lalamove_get_current_user_name() … … 111 115 class WC_Integration_Lalamove { 112 116 public function __construct() { 113 register_deactivation_hook( __FILE__, 'lalamove_remove_rest_api_key' );114 117 if ( lalamove_check_is_woocommerce_active() ) { 115 118 add_action( 'admin_menu', 'lalamove_menu' ); … … 121 124 add_action( 'admin_notices', array( $this, 'notice_activate_wc' ) ); 122 125 } 126 register_activation_hook( __FILE__, 'WC_Integration_Lalamove::activation_hook' ); 127 register_deactivation_hook( __FILE__, 'WC_Integration_Lalamove::deactivation_hook' ); 128 register_uninstall_hook( __FILE__, 'WC_Integration_Lalamove::uninstall_hook' ); 129 } 130 131 static function activation_hook() { 132 lalamove_track( 'plugin_activated' ); 133 } 134 135 static function deactivation_hook() { 136 lalamove_remove_rest_api_key(); 137 lalamove_track( 'plugin_deactivated' ); 138 } 139 140 static function uninstall_hook() { 141 lalamove_track( 'plugin_uninstalled' ); 123 142 } 124 143 -
lalamove/tags/1.0.4/readme.txt
r2661193 r2676945 6 6 Tested up to: 5.8.2 7 7 Requires PHP: 7.0 8 Stable tag: 1.0. 38 Stable tag: 1.0.4 9 9 License: GPLv2 or later 10 10 License URI: https://www.gnu.org/licenses/gpl-2.0.html … … 83 83 This will most likely happen when your account information has been updated after you installed our plugin. The fastest way to solve is to deactivate and activate again. If you are still seeing same issue, please reach out to partner.support@lalamove.com with your email and shop domain. 84 84 85 = I cannot install or approve permission = 86 87 This will most likely happen when your account information has been updated after you installed our plugin. The fastest solution is to try deactivating and activating again. If you are still seeing same issue, please follow the instructions [here](https://docs.google.com/document/d/1kK0SuHgZpOzXJJlMGiIT7slxT8ToL2QKsMkCC_OzneU/edit) 85 88 86 89 = Additional FAQs? = … … 104 107 == Changelog == 105 108 109 = 1.0.4 = 110 * Added guideline for troubleshooting 111 * Updated the Lalamove menu view permission 112 106 113 = 1.0.3 = 107 114 * Lalamove Quotation at Checkout -
lalamove/trunk/includes/class-lalamove-app.php
r2661191 r2676945 15 15 public static $menu_slug = 'Lalamove'; 16 16 public static $wc_llm_web_app_host = 'https://web.lalamove.com'; 17 public static $sa_url = 'https://uba.huolalamove.net/sa?project=default'; 17 18 public static $llm_order_column_key = 'Lalamove'; 18 19 public static $llm_order_column_title = 'Lalamove'; … … 22 23 ); 23 24 public static $wc_llm_dc = array( 24 'sg' => array( 'sg', 30000 ),25 'my' => array( 'sg', 40000 ),26 'ph' => array( 'sg', 50000 ),27 'tw' => array( 'sg', 80000 ),28 'hk' => array( 'sg', 90000 ),29 'vn' => array( 'sg', 100000 ),30 'th' => array( 'sg', 110000 ),31 'id' => array( 'sg', 120000 ),32 'br' => array( 'br', 20000 ),33 'mx' => array( 'br', 60000 ),25 'sg' => array( 'sg', 30000, 'SIN' ), 26 'my' => array( 'sg', 40000, 'SIN' ), 27 'ph' => array( 'sg', 50000, 'SIN' ), 28 'tw' => array( 'sg', 80000, 'SIN' ), 29 'hk' => array( 'sg', 90000, 'SIN' ), 30 'vn' => array( 'sg', 100000, 'SIN' ), 31 'th' => array( 'sg', 110000, 'SIN' ), 32 'id' => array( 'sg', 120000, 'SIN' ), 33 'br' => array( 'br', 20000, 'SAO' ), 34 'mx' => array( 'br', 60000, 'SAO' ), 34 35 ); 35 36 -
lalamove/trunk/includes/utility-functions.php
r2661191 r2676945 198 198 199 199 function lalamove_get_current_plugin_param( $key ) { 200 if ( empty( $_SERVER[' REQUEST_URI'] ) ) {200 if ( empty( $_SERVER['QUERY_STRING'] ) ) { 201 201 return ''; 202 202 } 203 $url_query_str = wp_parse_url( admin_url( basename( esc_url_raw( wp_unslash( $_SERVER['REQUEST_URI'] ) ) ) ), PHP_URL_QUERY ); 204 parse_str( $url_query_str, $query ); 203 parse_str( $_SERVER['QUERY_STRING'], $query ); 205 204 if ( empty( $query[ $key ] ) ) { 206 205 return ''; … … 240 239 error_log( $out ); 241 240 } 241 242 function lalamove_track( $event, $payload = array() ) { 243 $shop = preg_replace( '/^http:\/\/|^https:\/\//i', '', get_option( 'siteurl' ) ); 244 $wc_country = WC()->countries->get_base_country(); 245 $lalamove_country = lalamove_get_country( strtolower( $wc_country ) ); 246 $dc = $lalamove_country ? $lalamove_country[2] : $wc_country; 247 248 if ( strtoupper( substr( PHP_OS, 0, 3 ) ) == 'WIN' ) { 249 $event_time = substr( ( microtime( true ) * 1000 ), 0, 13 ); 250 } else { 251 $event_time = (int) ( microtime( true ) * 1000 ); 252 } 253 254 $lib_properties = array( 255 '$lib' => 'php', 256 '$lib_version' => '1.0', 257 '$lib_method' => 'code', 258 ); 259 260 $default_properties = array( 261 'llm_source' => 'woocommerce', 262 'trigger_time' => gmdate( 'c', time() ), 263 'shopName' => $shop, 264 'country' => $wc_country, 265 'city' => WC()->countries->get_base_city(), 266 'language' => get_locale(), 267 'data_center' => $dc, 268 'app_version' => lalamove_get_version(), 269 'php_version' => PHP_VERSION, 270 'env' => 'prd', 271 ); 272 273 $data = array( 274 'type' => 'track', 275 'properties' => array_merge( $default_properties, $payload ), 276 'time' => $event_time, 277 'event' => $event, 278 'distinct_id' => "{$dc}-{$shop}", 279 'lib' => $lib_properties, 280 ); 281 282 $packed_data = base64_encode( gzencode( '[' . json_encode( $data ) . ']' ) ); 283 284 $body = 'data_list=' . urlencode( $packed_data ) . '&gzip=1'; 285 286 wp_remote_post( 287 Lalamove_App::$sa_url, 288 array( 289 'timeout' => 2, 290 'blocking' => false, 291 'headers' => array( 'Content-Type' => 'text/plain' ), 292 'user-agent' => 'PHP SDK', 293 'body' => $body, 294 ) 295 ); 296 } 297 -
lalamove/trunk/lalamove.php
r2661191 r2676945 4 4 * Plugin URI: https://wordpress.org/plugins/lalamove 5 5 * Description: A 24/7 on-demand delivery app 6 * Version: 1.0. 36 * Version: 1.0.4 7 7 * Author: partner.support@lalamove.com 8 8 * Author URI: https://lalamove.com/ … … 44 44 $page_menu_display, 45 45 $page_menu_display, 46 'manage_ options',46 'manage_woocommerce', 47 47 'Lalamove', 48 48 'lalamove_web', … … 76 76 $sub_page = lalamove_get_current_plugin_param( 'sub-page' ); 77 77 78 if ( lalamove_get_current_plugin_param( 'success' ) ) { 79 lalamove_track( 'plugin_authorized' ); 80 } 81 78 82 if ( $sub_page === 'place-order' ) { 79 83 $place_order_url = lalamove_get_service_url() . '/place-order?id=' . lalamove_get_current_plugin_param( 'id' ) . '&name=' . lalamove_get_current_user_name() … … 111 115 class WC_Integration_Lalamove { 112 116 public function __construct() { 113 register_deactivation_hook( __FILE__, 'lalamove_remove_rest_api_key' );114 117 if ( lalamove_check_is_woocommerce_active() ) { 115 118 add_action( 'admin_menu', 'lalamove_menu' ); … … 121 124 add_action( 'admin_notices', array( $this, 'notice_activate_wc' ) ); 122 125 } 126 register_activation_hook( __FILE__, 'WC_Integration_Lalamove::activation_hook' ); 127 register_deactivation_hook( __FILE__, 'WC_Integration_Lalamove::deactivation_hook' ); 128 register_uninstall_hook( __FILE__, 'WC_Integration_Lalamove::uninstall_hook' ); 129 } 130 131 static function activation_hook() { 132 lalamove_track( 'plugin_activated' ); 133 } 134 135 static function deactivation_hook() { 136 lalamove_remove_rest_api_key(); 137 lalamove_track( 'plugin_deactivated' ); 138 } 139 140 static function uninstall_hook() { 141 lalamove_track( 'plugin_uninstalled' ); 123 142 } 124 143 -
lalamove/trunk/readme.txt
r2661193 r2676945 6 6 Tested up to: 5.8.2 7 7 Requires PHP: 7.0 8 Stable tag: 1.0. 38 Stable tag: 1.0.4 9 9 License: GPLv2 or later 10 10 License URI: https://www.gnu.org/licenses/gpl-2.0.html … … 83 83 This will most likely happen when your account information has been updated after you installed our plugin. The fastest way to solve is to deactivate and activate again. If you are still seeing same issue, please reach out to partner.support@lalamove.com with your email and shop domain. 84 84 85 = I cannot install or approve permission = 86 87 This will most likely happen when your account information has been updated after you installed our plugin. The fastest solution is to try deactivating and activating again. If you are still seeing same issue, please follow the instructions [here](https://docs.google.com/document/d/1kK0SuHgZpOzXJJlMGiIT7slxT8ToL2QKsMkCC_OzneU/edit) 85 88 86 89 = Additional FAQs? = … … 104 107 == Changelog == 105 108 109 = 1.0.4 = 110 * Added guideline for troubleshooting 111 * Updated the Lalamove menu view permission 112 106 113 = 1.0.3 = 107 114 * Lalamove Quotation at Checkout
Note: See TracChangeset
for help on using the changeset viewer.