Changeset 3060497
- Timestamp:
- 03/28/2024 11:57:45 AM (2 years ago)
- Location:
- hfd-epost-integration/trunk
- Files:
-
- 16 edited
-
class/Admin.php (modified) (5 diffs)
-
class/App.php (modified) (4 diffs)
-
class/AutoLoad.php (modified) (1 diff)
-
class/Cache.php (modified) (1 diff)
-
class/DataObject.php (modified) (1 diff)
-
class/Helper/Hfd/Api.php (modified) (1 diff)
-
class/Helper/Spot.php (modified) (2 diffs)
-
hfd-woocommerce-epost.php (modified) (2 diffs)
-
js/epost-admin.js (modified) (1 diff)
-
js/epost-list.js (modified) (1 diff)
-
js/pickup-post.js (modified) (1 diff)
-
readme.txt (modified) (3 diffs)
-
templates/admin/notice.php (modified) (1 diff)
-
templates/admin/setting.php (modified) (1 diff)
-
templates/cart/footer.php (modified) (4 diffs)
-
templates/order/pickup.php (modified) (1 diff)
Legend:
- Unmodified
- Added
- Removed
-
hfd-epost-integration/trunk/class/Admin.php
r3059826 r3060497 60 60 $out = array( "success" => 0, "msg" => __( "Something Went wrong", 'hfd-integration' ) ); 61 61 if( !is_admin() ){ 62 echo json_encode( $out );62 echo wp_json_encode( $out ); 63 63 exit; 64 64 } 65 65 66 if( isset( $_POST['orderRef'] ) && !empty( $_POST['orderRef'] ) ){66 if( isset( $_POST['orderRef'] ) && !empty( $_POST['orderRef'] ) && wp_verify_nonce( $_POST['_ajax_nonce'], 'cancel_shipment' ) ){ 67 67 $orN = sanitize_text_field( $_POST['orderRef'] ); 68 68 $orderID = sanitize_text_field( $_POST['orderID'] ); … … 84 84 $out = array( "success" => 0, "msg" => __( "Shipment not tracked", 'hfd-integration' ) ); 85 85 }else{ 86 $api_response_run = json_encode( $api_response_run );86 $api_response_run = wp_json_encode( $api_response_run ); 87 87 $api_response_run = json_decode( $api_response_run, true ); 88 88 update_post_meta( $orderID, 'hfd_ship_cancel_response', maybe_serialize( $api_response_run ) ); … … 105 105 } 106 106 } 107 echo json_encode( $out );107 echo wp_json_encode( $out ); 108 108 exit; 109 109 } … … 188 188 saveSpotInfoUrl: '<?php echo esc_html( admin_url( "admin-ajax.php" ) ); ?>', 189 189 getSpotsUrl: '<?php echo esc_html( admin_url( "admin-ajax.php?action=get_spots" ) ); ?>', 190 cities: <?php echo json_encode($helper->getCities())?>190 cities: <?php echo wp_json_encode($helper->getCities())?> 191 191 }); 192 192 }); … … 275 275 wp_enqueue_script( 'epost-translator-script', HFD_EPOST_PLUGIN_URL.'/js/translator.js' ); 276 276 wp_enqueue_script( 'epost-admin-scr', HFD_EPOST_PLUGIN_URL.'/js/epost-admin.js' ); 277 //pass data to js file 278 wp_localize_script( 'epost-admin-scr', 'hfd_admin_obj', 279 array( 280 'ajaxurl' => admin_url( 'admin-ajax.php' ), 281 'nonce' => wp_create_nonce( 'cancel_shipment' ) 282 ) 283 ); 277 284 } 278 285 -
hfd-epost-integration/trunk/class/App.php
r3059826 r3060497 259 259 public function saveCartPickup() 260 260 { 261 if( isset( $_POST['spot_info'] ) ){ 261 $out = array( "success" => 0, "msg" => __( "Something went wrong", "hfd-integration" ) ); 262 if( isset( $_POST['spot_info'] ) && wp_verify_nonce( $_POST['_ajax_nonce'], 'save_pickup' ) ){ 262 263 $spotInfo = array_map( 'sanitize_text_field', $_POST['spot_info'] ); 263 264 /* @var \Hfd\Woocommerce\Cart\Pickup $cartPickup */ 264 265 $cartPickup = Container::get('Hfd\Woocommerce\Cart\Pickup'); 265 266 $cartPickup->saveSpotInfo( $spotInfo ); 266 } 267 268 $out = array( "success" => 1, "msg" => __( "Pickup saved", "hfd-integration" ) ); 269 }else{ 270 $out = array( "success" => 1, "msg" => __( "Incorrect nonce or spot info missing", "hfd-integration" ) ); 271 } 272 echo wp_json_encode( $out ); 273 exit; 267 274 } 268 275 … … 279 286 $spots = $helper->getSpots(); 280 287 header('Content-type: application/json'); 281 echo json_encode($spots);288 echo wp_json_encode($spots); 282 289 exit; 283 290 } … … 288 295 $spots = $helper->getSpotsByCity($city); 289 296 header('Content-type: application/json'); 290 echo json_encode($spots);297 echo wp_json_encode($spots); 291 298 exit; 292 299 } … … 408 415 $response['messages'] = sprintf($message, __('Please choose pickup branch', 'hfd-integration')); 409 416 header('Content-type: application/json'); 410 echo json_encode($response);417 echo wp_json_encode( $response ); 411 418 exit; 412 419 } -
hfd-epost-integration/trunk/class/AutoLoad.php
r2766592 r3060497 36 36 $filePath = $this->basePath . DIRECTORY_SEPARATOR . $path .'.php'; 37 37 38 if (!file_exists($filePath)){39 throw new \Exception( __('Invalid class '. $className, 'betanet_epost'));38 if( !file_exists( $filePath ) ){ 39 throw new \Exception( sprintf( __( 'Invalid class %s', 'hfd-integration' ), $className ) ); 40 40 } 41 41 -
hfd-epost-integration/trunk/class/Cache.php
r2766592 r3060497 65 65 } 66 66 67 $data = json_encode($this->cached);67 $data = wp_json_encode($this->cached); 68 68 file_put_contents($cachePath, $data); 69 69 -
hfd-epost-integration/trunk/class/DataObject.php
r2766592 r3060497 231 231 } 232 232 throw new \Exception( 233 __(sprintf('Invalid method %1::%2(%3)'), get_class($this), $method, print_r($args, 1))233 sprintf( __( 'Invalid method %1::%2(%3)', 'hfd-integration' ), get_class($this), $method, print_r( $args, 1 ) ) 234 234 ); 235 235 } -
hfd-epost-integration/trunk/class/Helper/Hfd/Api.php
r3059826 r3060497 132 132 $response = wp_remote_retrieve_body( $response ); 133 133 $xml = simplexml_load_string($response, 'SimpleXMLElement', LIBXML_NOCDATA); 134 $arrResponse = json_decode( json_encode($xml), true);134 $arrResponse = json_decode(wp_json_encode($xml), true); 135 135 136 136 if ($this->isApiDebug()) { 137 137 $_response = $arrResponse; 138 138 if (is_array($_response)) { 139 $_response = json_encode($_response);139 $_response = wp_json_encode($_response); 140 140 } 141 141 $_logInfo = PHP_EOL .'===== Begin ====='; 142 $_logInfo .= PHP_EOL . '> Request parameters: '. json_encode($pParam);142 $_logInfo .= PHP_EOL . '> Request parameters: '. wp_json_encode($pParam); 143 143 $_logInfo .= PHP_EOL .'> Call API: '. $url; 144 144 $_logInfo .= PHP_EOL .'> Response: '. $_response; -
hfd-epost-integration/trunk/class/Helper/Spot.php
r3059826 r3060497 38 38 39 39 $xml = simplexml_load_string( $response, 'SimpleXMLElement', LIBXML_NOCDATA ); 40 $arrResponse = json_decode( json_encode($xml), true);40 $arrResponse = json_decode(wp_json_encode($xml), true); 41 41 42 42 $spots = array(); … … 69 69 70 70 $xml = simplexml_load_string( $response, 'SimpleXMLElement', LIBXML_NOCDATA ); 71 $arrResponse = json_decode( json_encode( $xml ), true );71 $arrResponse = json_decode( wp_json_encode( $xml ), true ); 72 72 73 73 $spots = array(); -
hfd-epost-integration/trunk/hfd-woocommerce-epost.php
r3059826 r3060497 5 5 Plugin URI: 6 6 Description: Add shipping method of ePost, allowing the user on the checkout, to select the pickup location point from a google map popup. Also allows to synch the order to HFD API after the order is created. 7 Version: 1.97 Version: 2.0 8 8 Author: HFD 9 9 Author URI: https://www.hfd.co.il … … 11 11 Text Domain: hfd-integration 12 12 */ 13 14 if ( ! defined( 'ABSPATH' ) ) exit; // Exit if accessed directly 13 15 14 16 //return if woocommerce not installed -
hfd-epost-integration/trunk/js/epost-admin.js
r2766592 r3060497 99 99 'action': 'hfd_epost_cancel_shipment', 100 100 'orderRef': orderRef, 101 '_ajax_nonce': hfd_admin_obj.nonce, 101 102 'orderID': orderID 102 103 }; -
hfd-epost-integration/trunk/js/epost-list.js
r2884972 r3060497 62 62 var data = { 63 63 action: 'save_pickup', 64 _ajax_nonce: hfd_ajax_obj.nonce, 64 65 spot_info: spot 65 66 }; -
hfd-epost-integration/trunk/js/pickup-post.js
r2889280 r3060497 96 96 var data = { 97 97 action: 'save_pickup', 98 _ajax_nonce: hfd_ajax_obj.nonce, 98 99 spot_info: spot 99 100 }; -
hfd-epost-integration/trunk/readme.txt
r3059826 r3060497 5 5 Requires at least: 4.0 6 6 Tested up to: 6.5 7 Stable tag: 1.97 Stable tag: 2.0 8 8 Requires PHP: 5.4 9 9 License: GPLv2 or later … … 66 66 לאחר סנכרון מוצלח הלחצן Sync to HFD יהפוך ל- Print Label שמאפשר להדפיס מדבקה 67 67 68 Plugin uses third party Google Maps API to add pickup branch in google map 69 70 == Privacy Policy == 71 HFD - https://www.hfd.co.il/privacy-policy/ 72 73 == Third Party API == 74 Google Maps - maps.googleapis.com 75 HFD - run.hfd.co.il 76 68 77 == Changelog == 69 78 = 1.0 = 70 79 * Initial release 71 80 81 = 2.0 = 82 * Performance Improvement 83 * Integrated Latest google maps api 72 84 73 85 == Frequently Asked Questions == … … 82 94 Need to choose the Shipping Methods you want in order to synchronize with HFD 83 95 96 = How many HFD pickup branch layout exist in plugin = 97 There are two layout exists 98 1. Map( Google Map ) 99 2. List 100 84 101 == Screenshots == 85 102 1. HFD Settings -
hfd-epost-integration/trunk/templates/admin/notice.php
r2768357 r3060497 1 1 <?php 2 if ( ! defined( 'ABSPATH' ) ) exit; // Exit if accessed directly 3 2 4 /** 3 5 * Created by PhpStorm. -
hfd-epost-integration/trunk/templates/admin/setting.php
r3011172 r3060497 1 1 <?php 2 if ( ! defined( 'ABSPATH' ) ) exit; // Exit if accessed directly 3 2 4 /** 3 5 * Created by PhpStorm. -
hfd-epost-integration/trunk/templates/cart/footer.php
r3059826 r3060497 43 43 wp_enqueue_script( 'hfd-checkout-js', $this->getSkinUrl( 'js/checkout.js' ) ); 44 44 wp_enqueue_script( 'hfd-translator-js', $this->getSkinUrl( 'js/translator.js' ) ); 45 46 //pass data to js file 47 wp_localize_script( 'hfd-pickup-post', 'hfd_ajax_obj', 48 array( 49 'ajaxurl' => admin_url( 'admin-ajax.php' ), 50 'nonce' => wp_create_nonce( 'save_pickup' ) 51 ) 52 ); 45 53 ?> 46 54 <script type="text/javascript"> … … 103 111 wp_enqueue_script( 'hfd-translator', $this->getSkinUrl( 'js/translator.js' ) ); 104 112 wp_enqueue_script( 'hfd-epost-list', $this->getSkinUrl( 'js/epost-list.js' ), array(), time() ); 113 //pass data to js file 114 wp_localize_script( 'hfd-epost-list', 'hfd_ajax_obj', 115 array( 116 'ajaxurl' => admin_url( 'admin-ajax.php' ), 117 'nonce' => wp_create_nonce( 'save_pickup' ) 118 ) 119 ); 105 120 ?> 106 121 <script type="text/javascript"> … … 118 133 saveSpotInfoUrl: '<?php echo esc_html( admin_url( 'admin-ajax.php' ) ); ?>', 119 134 getSpotsUrl: '<?php echo esc_html( admin_url( 'admin-ajax.php?action=get_spots' ) ); ?>', 120 cities: <?php echo json_encode( $helper->getCities() ); ?>135 cities: <?php echo wp_json_encode( $helper->getCities() ); ?> 121 136 }); 122 137 cityLoaded = true; … … 135 150 saveSpotInfoUrl: '<?php echo esc_html( admin_url( 'admin-ajax.php' ) ); ?>', 136 151 getSpotsUrl: '<?php echo esc_html( admin_url( 'admin-ajax.php?action=get_spots' ) ); ?>', 137 cities: <?php echo json_encode( $helper->getCities() ); ?>152 cities: <?php echo wp_json_encode( $helper->getCities() ); ?> 138 153 }); 139 154 cityLoaded = true; -
hfd-epost-integration/trunk/templates/order/pickup.php
r2768357 r3060497 1 1 <?php 2 if ( ! defined( 'ABSPATH' ) ) exit; // Exit if accessed directly 2 3 /** 3 4 * Created by PhpStorm.
Note: See TracChangeset
for help on using the changeset viewer.