Changeset 3483127
- Timestamp:
- 03/15/2026 01:59:45 PM (2 weeks ago)
- Location:
- shipday-for-woocommerce/trunk
- Files:
-
- 6 added
- 8 deleted
- 44 edited
-
admin/Shipday_Menu_Settings.php (modified) (9 diffs)
-
admin/Shipday_Time_Slot_Util.php (modified) (3 diffs)
-
admin/Shipday_WC_Settings_Tab.php (deleted)
-
admin/partials/shipday-admin-display.php (modified) (6 diffs)
-
admin/partials/shipday-admin-new.php (modified) (10 diffs)
-
admin/partials/tab-delivery.php (modified) (21 diffs)
-
admin/partials/tab-general.php (modified) (5 diffs)
-
admin/partials/tab-order-sync.php (modified) (4 diffs)
-
admin/partials/tab-overview.php (modified) (6 diffs)
-
admin/partials/tab-pickup.php (modified) (21 diffs)
-
admin/partials/tab-rest-api.php (modified) (4 diffs)
-
admin/partials/tab-shipday-connect.php (modified) (7 diffs)
-
date-modifiers/Coderocks_Woo_Delivery.php (modified) (1 diff)
-
date-modifiers/Date_Picker_Object.php (modified) (1 diff)
-
date-modifiers/Delivery_Area_Pro.php (modified) (1 diff)
-
date-modifiers/Order_Delivery_Date_Shipday.php (modified) (1 diff)
-
date-modifiers/order_delivery_date.php (modified) (1 diff)
-
dispatch_post/payload_post.php (modified) (4 diffs)
-
dispatch_post/post_fun.php (modified) (2 diffs)
-
functions/common.php (modified) (2 diffs)
-
functions/logger.php (modified) (1 diff)
-
languages/shipday-for-woocommerce-es_ES.mo (added)
-
languages/shipday-for-woocommerce-es_ES.po (added)
-
languages/shipday-for-woocommerce-fr_FR.mo (added)
-
languages/shipday-for-woocommerce-fr_FR.po (added)
-
languages/shipday-for-woocommerce.pot (added)
-
languages/shipday-woo-delivery-es_ES.mo (deleted)
-
languages/shipday-woo-delivery-es_ES.po (deleted)
-
languages/shipday-woo-delivery-fr_FR.mo (deleted)
-
languages/shipday-woo-delivery-fr_FR.po (deleted)
-
languages/shipday-woo-delivery.pot (deleted)
-
order_data/Dokan_Order_Shipday.php (modified) (1 diff)
-
order_data/FoodStore_Order_Shipday.php (modified) (1 diff)
-
order_data/WCFM_Order_Shipday.php (modified) (3 diffs)
-
order_data/Woo_Order_Shipday.php (modified) (2 diffs)
-
order_data/Woocommerce_Core_Shipday.php (modified) (1 diff)
-
payload/Core_Payload.php (modified) (1 diff)
-
payload/Dokan_Payload.php (modified) (1 diff)
-
payload/FoodStore_Payload.php (modified) (2 diffs)
-
payload/WCFM_Payload.php (modified) (2 diffs)
-
payload/Woo_Payload.php (modified) (2 diffs)
-
readme.txt (modified) (2 diffs)
-
rest_api/WooCommerce_REST_API.php (modified) (6 diffs)
-
shipday-datetime/block-checkout/Shipday_Woo_DateTime_Util.php (modified) (7 diffs)
-
shipday-datetime/block-checkout/Shipday_Woo_Delivery_Block.php (modified) (4 diffs)
-
shipday-datetime/block-checkout/Shipday_Woo_Delivery_Block_Integration.php (modified) (2 diffs)
-
shipday-datetime/block-checkout/Shipday_Woo_Delivery_Block_Storage.php (modified) (2 diffs)
-
shipday-datetime/block-checkout/assets/js/frontend.js (modified) (4 diffs)
-
shipday-datetime/classic-checkout/Classic_Datetime.php (modified) (21 diffs)
-
shipday-for-woocommerce.php (added)
-
shipday-integration-for-wooCommerce.php (deleted)
-
shipday_order_management/Shipday_Order_Management.php (modified) (1 diff)
-
shipday_order_management/Woo_Sync_Order.php (modified) (2 diffs)
-
views/Dokan_vendor_settings_shipday.php (modified) (6 diffs)
-
views/Notices.php (modified) (4 diffs)
-
views/WCFM_vendor_settings_shipday.php (modified) (3 diffs)
-
views/WC_Settings_Tab_Shipday.php (deleted)
-
views/WC_Settings_Tab_Shipday_menus.php (modified) (18 diffs)
Legend:
- Unmodified
- Added
- Removed
-
shipday-for-woocommerce/trunk/admin/Shipday_Menu_Settings.php
r3419924 r3483127 1 1 <?php 2 3 if ( ! defined( 'ABSPATH' ) ) { 4 exit; 5 } 2 6 require_once dirname(__FILE__). '/../rest_api/WooCommerce_REST_API.php'; 3 7 4 8 class Shipday_Menu_Settings { 9 private static $allowed_order_managers = array( 'admin_manage', 'vendor_manage' ); 10 private static $allowed_week_days = array( '0', '1', '2', '3', '4', '5', '6' ); 11 private static $allowed_slot_durations = array( '10', '15', '30', '45', '60', '90', '120', '150', '180', '240', '300', '360' ); 12 5 13 public static function initialize() { 6 14 add_action( 'admin_enqueue_scripts',[ __CLASS__, 'enqueue_styles' ] ); … … 46 54 47 55 add_menu_page( 48 __('Shipday', 'shipday- delivery'),49 __('Shipday', 'shipday- delivery'),56 __('Shipday', 'shipday-for-woocommerce'), 57 __('Shipday', 'shipday-for-woocommerce'), 50 58 'manage_options', 51 59 'shipday-delivery-settings', … … 68 76 } 69 77 78 private static function ensure_settings_access() { 79 if ( ! current_user_can( 'manage_options' ) ) { 80 wp_send_json_error( array( 'message' => 'Unauthorized' ), 403 ); 81 } 82 } 83 84 private static function get_form_data_from_request() { 85 // phpcs:ignore WordPress.Security.NonceVerification.Missing -- Nonce is verified in each AJAX handler before this helper runs. 86 if ( ! isset( $_POST['formData'] ) || ! is_string( $_POST['formData'] ) ) { 87 wp_send_json_error( array( 'message' => 'Invalid form data.' ), 400 ); 88 } 89 90 $form_data = array(); 91 // phpcs:ignore WordPress.Security.NonceVerification.Missing,WordPress.Security.ValidatedSanitizedInput.InputNotSanitized -- Serialized form payload is unslashed here and each parsed field is sanitized individually before use. 92 parse_str( wp_unslash( $_POST['formData'] ), $form_data ); 93 94 return is_array( $form_data ) ? $form_data : array(); 95 } 96 97 private static function sanitize_yes_no_flag( $is_enabled ) { 98 return $is_enabled ? 'yes' : 'no'; 99 } 100 101 private static function sanitize_allowed_value( $value, $allowed_values, $default ) { 102 $value = sanitize_text_field( (string) $value ); 103 104 return in_array( $value, $allowed_values, true ) ? $value : $default; 105 } 106 107 private static function sanitize_day_list( $days ) { 108 if ( ! is_array( $days ) ) { 109 return array(); 110 } 111 112 $sanitized_days = array(); 113 foreach ( $days as $day ) { 114 $day = sanitize_text_field( (string) $day ); 115 if ( in_array( $day, self::$allowed_week_days, true ) ) { 116 $sanitized_days[] = $day; 117 } 118 } 119 120 return array_values( array_unique( $sanitized_days ) ); 121 } 122 123 private static function sanitize_positive_int( $value, $default ) { 124 $value = absint( $value ); 125 126 return $value > 0 ? $value : $default; 127 } 128 129 private static function sanitize_time_slot( $hour, $minute, $ampm ) { 130 $hour = max( 1, min( 12, absint( $hour ) ) ); 131 $minute = max( 0, min( 59, absint( $minute ) ) ); 132 $ampm = self::sanitize_allowed_value( $ampm, array( 'AM', 'PM' ), 'AM' ); 133 134 return array( 135 'hh' => str_pad( (string) $hour, 2, '0', STR_PAD_LEFT ), 136 'mm' => str_pad( (string) $minute, 2, '0', STR_PAD_LEFT ), 137 'ampm' => $ampm, 138 ); 139 } 70 140 71 141 public static function save_connect_settings() { 72 142 check_ajax_referer('shipday_nonce'); 73 74 parse_str( $_POST[ 'formData' ], $form_data ); 75 $api_key = sanitize_text_field($form_data['shipday_api_key']); 76 $enable_pickup = !isset($form_data['wc_settings_tab_shipday_enable_pickup']) ? "no" : "yes"; 77 $enable_prev_order_sync = isset($form_data['wc_settings_tab_shipday_sync']) ? "yes" : "no"; 78 79 $order_manage = !isset($form_data['wc_settings_tab_shipday_order_manage']) ? "admin_manage" : $form_data['wc_settings_tab_shipday_order_manage']; 143 self::ensure_settings_access(); 144 145 $form_data = self::get_form_data_from_request(); 146 $api_key = isset( $form_data['shipday_api_key'] ) ? sanitize_text_field( $form_data['shipday_api_key'] ) : ''; 147 $enable_pickup = self::sanitize_yes_no_flag( isset( $form_data['wc_settings_tab_shipday_enable_pickup'] ) ); 148 $enable_prev_order_sync = self::sanitize_yes_no_flag( isset( $form_data['wc_settings_tab_shipday_sync'] ) ); 149 $order_manage = isset( $form_data['wc_settings_tab_shipday_order_manage'] ) 150 ? self::sanitize_allowed_value( $form_data['wc_settings_tab_shipday_order_manage'], self::$allowed_order_managers, 'admin_manage' ) 151 : 'admin_manage'; 80 152 81 153 update_option('wc_settings_tab_shipday_enable_pickup', $enable_pickup); … … 90 162 public static function save_rest_api_settings() { 91 163 check_ajax_referer('shipday_nonce'); 92 93 parse_str( $_POST[ 'formData' ], $form_data ); 94 $consumer_key = sanitize_text_field($form_data['shipday_consumer_key']); 95 $consumer_secret = sanitize_text_field($form_data['shipday_consumer_secret']); 164 self::ensure_settings_access(); 165 166 $form_data = self::get_form_data_from_request(); 167 $consumer_key = isset( $form_data['shipday_consumer_key'] ) ? sanitize_text_field( $form_data['shipday_consumer_key'] ) : ''; 168 $consumer_secret = isset( $form_data['shipday_consumer_secret'] ) ? sanitize_text_field( $form_data['shipday_consumer_secret'] ) : ''; 96 169 97 170 update_option('wc_settings_tab_shipday_rest_api_consumer_key', $consumer_key); … … 107 180 public static function save_general_settings() { 108 181 check_ajax_referer('shipday_nonce'); 109 110 parse_str( $_POST[ 'formData' ], $form_data ); 111 $enable_datetime = !isset($form_data['shipday_enable_datetime_plugin']) ? "no" : "yes"; 112 $enable_order_type = !isset($form_data['shipday_enable_delivery_option']) ? "no" : "yes"; 182 self::ensure_settings_access(); 183 184 $form_data = self::get_form_data_from_request(); 185 $enable_datetime = self::sanitize_yes_no_flag( isset( $form_data['shipday_enable_datetime_plugin'] ) ); 186 $enable_order_type = self::sanitize_yes_no_flag( isset( $form_data['shipday_enable_delivery_option'] ) ); 113 187 114 188 update_option('shipday_enable_datetime_plugin', $enable_datetime); 115 189 update_option('shipday_enable_delivery_option', $enable_order_type); 116 if(isset($form_data['shipday_delivery_pickup_label'])) 117 update_option('shipday_delivery_pickup_label', $form_data['shipday_delivery_pickup_label']); 190 if ( isset( $form_data['shipday_delivery_pickup_label'] ) ) { 191 update_option( 'shipday_delivery_pickup_label', sanitize_text_field( $form_data['shipday_delivery_pickup_label'] ) ); 192 } 118 193 119 194 if($enable_datetime === "no"){ … … 138 213 public static function save_delivery_settings() { 139 214 check_ajax_referer('shipday_nonce'); 140 141 parse_str( $_POST[ 'formData' ], $form_data ); 142 143 $enable_delivery_date = !isset($form_data['shipday_enable_delivery_date']) ? "no" : "yes"; 144 $delivery_date_mandatory = !isset($form_data['shipday_delivery_date_mandatory']) ? "no" : "yes"; 145 $available_days_ = !isset($form_data['shipday_avaialble_delivery_days'])? [] : array_map('strval', $form_data['shipday_avaialble_delivery_days']); 146 147 $start_delivery_slot = []; 148 $start_delivery_slot['hh'] = $form_data['shipday_delivery_time_slot_start_hh']; 149 $start_delivery_slot['mm'] = $form_data['shipday_delivery_time_slot_start_mm']; 150 $start_delivery_slot['ampm'] = $form_data['shipday_delivery_time_slot_start_ampm']; 151 152 $enable_delivery_time = !isset($form_data['shipday_enable_delivery_time']) ? "no" : "yes"; 153 $delivery_time_mandatory = !isset($form_data['shipday_delivery_time_mandatory']) ? "no" : "yes"; 154 155 $end_delivery_slot = []; 156 $end_delivery_slot['hh'] = $form_data['shipday_delivery_time_slot_end_hh']; 157 $end_delivery_slot['mm'] = $form_data['shipday_delivery_time_slot_end_mm']; 158 $end_delivery_slot['ampm'] = $form_data['shipday_delivery_time_slot_end_ampm']; 215 self::ensure_settings_access(); 216 217 $form_data = self::get_form_data_from_request(); 218 219 $enable_delivery_date = self::sanitize_yes_no_flag( isset( $form_data['shipday_enable_delivery_date'] ) ); 220 $delivery_date_mandatory = self::sanitize_yes_no_flag( isset( $form_data['shipday_delivery_date_mandatory'] ) ); 221 $available_days_ = isset( $form_data['shipday_avaialble_delivery_days'] ) 222 ? self::sanitize_day_list( $form_data['shipday_avaialble_delivery_days'] ) 223 : array(); 224 $start_delivery_slot = self::sanitize_time_slot( 225 $form_data['shipday_delivery_time_slot_start_hh'] ?? 9, 226 $form_data['shipday_delivery_time_slot_start_mm'] ?? 0, 227 $form_data['shipday_delivery_time_slot_start_ampm'] ?? 'AM' 228 ); 229 $enable_delivery_time = self::sanitize_yes_no_flag( isset( $form_data['shipday_enable_delivery_time'] ) ); 230 $delivery_time_mandatory = self::sanitize_yes_no_flag( isset( $form_data['shipday_delivery_time_mandatory'] ) ); 231 $end_delivery_slot = self::sanitize_time_slot( 232 $form_data['shipday_delivery_time_slot_end_hh'] ?? 9, 233 $form_data['shipday_delivery_time_slot_end_mm'] ?? 0, 234 $form_data['shipday_delivery_time_slot_end_ampm'] ?? 'AM' 235 ); 236 $selectable_delivery_days = self::sanitize_positive_int( $form_data['shipday_selectable_delivery_days'] ?? 30, 30 ); 237 $delivery_slot_duration = self::sanitize_allowed_value( 238 $form_data['shipday_delivery_time_slot_duration'] ?? '60', 239 self::$allowed_slot_durations, 240 '60' 241 ); 159 242 160 243 update_option('shipday_enable_delivery_date', $enable_delivery_date); 161 244 update_option('shipday_delivery_date_mandatory', $delivery_date_mandatory); 162 245 update_option('shipday_avaialble_delivery_days', $available_days_); 163 update_option('shipday_selectable_delivery_days', $ form_data['shipday_selectable_delivery_days']);246 update_option('shipday_selectable_delivery_days', $selectable_delivery_days); 164 247 165 248 update_option('shipday_enable_delivery_time', $enable_delivery_time); … … 169 252 update_option('shipday_delivery_time_slot_start', $start_delivery_slot); 170 253 update_option('shipday_delivery_time_slot_end', $end_delivery_slot); 171 update_option('shipday_delivery_time_slot_duration', $ form_data['shipday_delivery_time_slot_duration']);254 update_option('shipday_delivery_time_slot_duration', $delivery_slot_duration); 172 255 173 256 wp_send_json_success(); … … 177 260 public static function save_pickup_settings() { 178 261 check_ajax_referer('shipday_nonce'); 179 180 parse_str( $_POST[ 'formData' ], $form_data ); 181 182 $enable_pickup_date = !isset($form_data['shipday_enable_pickup_date']) ? "no" : "yes"; 183 $pickup_date_mandatory = !isset($form_data['shipday_pickup_date_mandatory']) ? "no" : "yes"; 184 $available_days_ = !isset($form_data['shipday_avaialble_pickup_days'])? [] : array_map('strval', $form_data['shipday_avaialble_pickup_days']); 185 186 $start_pickup_slot = []; 187 $start_pickup_slot['hh'] = $form_data['shipday_pickup_time_slot_start_hh']; 188 $start_pickup_slot['mm'] = $form_data['shipday_pickup_time_slot_start_mm']; 189 $start_pickup_slot['ampm'] = $form_data['shipday_pickup_time_slot_start_ampm']; 190 191 $enable_pickup_time = !isset($form_data['shipday_enable_pickup_time']) ? "no" : "yes"; 192 $pickup_time_mandatory = !isset($form_data['shipday_pickup_time_mandatory']) ? "no" : "yes"; 193 194 $end_pickup_slot = []; 195 $end_pickup_slot['hh'] = $form_data['shipday_pickup_time_slot_end_hh']; 196 $end_pickup_slot['mm'] = $form_data['shipday_pickup_time_slot_end_mm']; 197 $end_pickup_slot['ampm'] = $form_data['shipday_pickup_time_slot_end_ampm']; 262 self::ensure_settings_access(); 263 264 $form_data = self::get_form_data_from_request(); 265 266 $enable_pickup_date = self::sanitize_yes_no_flag( isset( $form_data['shipday_enable_pickup_date'] ) ); 267 $pickup_date_mandatory = self::sanitize_yes_no_flag( isset( $form_data['shipday_pickup_date_mandatory'] ) ); 268 $available_days_ = isset( $form_data['shipday_avaialble_pickup_days'] ) 269 ? self::sanitize_day_list( $form_data['shipday_avaialble_pickup_days'] ) 270 : array(); 271 $start_pickup_slot = self::sanitize_time_slot( 272 $form_data['shipday_pickup_time_slot_start_hh'] ?? 9, 273 $form_data['shipday_pickup_time_slot_start_mm'] ?? 0, 274 $form_data['shipday_pickup_time_slot_start_ampm'] ?? 'AM' 275 ); 276 $enable_pickup_time = self::sanitize_yes_no_flag( isset( $form_data['shipday_enable_pickup_time'] ) ); 277 $pickup_time_mandatory = self::sanitize_yes_no_flag( isset( $form_data['shipday_pickup_time_mandatory'] ) ); 278 $end_pickup_slot = self::sanitize_time_slot( 279 $form_data['shipday_pickup_time_slot_end_hh'] ?? 9, 280 $form_data['shipday_pickup_time_slot_end_mm'] ?? 0, 281 $form_data['shipday_pickup_time_slot_end_ampm'] ?? 'AM' 282 ); 283 $selectable_pickup_days = self::sanitize_positive_int( $form_data['shipday_selectable_pickup_days'] ?? 30, 30 ); 284 $pickup_slot_duration = self::sanitize_allowed_value( 285 $form_data['shipday_pickup_time_slot_duration'] ?? '60', 286 self::$allowed_slot_durations, 287 '60' 288 ); 198 289 199 290 update_option('shipday_enable_pickup_date', $enable_pickup_date); 200 291 update_option('shipday_pickup_date_mandatory', $pickup_date_mandatory); 201 292 update_option('shipday_avaialble_pickup_days', $available_days_); 202 update_option('shipday_selectable_pickup_days', $ form_data['shipday_selectable_pickup_days']);293 update_option('shipday_selectable_pickup_days', $selectable_pickup_days); 203 294 204 295 update_option('shipday_enable_pickup_time', $enable_pickup_time); … … 206 297 update_option('shipday_pickup_time_slot_start', $start_pickup_slot); 207 298 update_option('shipday_pickup_time_slot_end', $end_pickup_slot); 208 update_option('shipday_pickup_time_slot_duration', $ form_data['shipday_pickup_time_slot_duration']);299 update_option('shipday_pickup_time_slot_duration', $pickup_slot_duration); 209 300 210 301 wp_send_json_success(); -
shipday-for-woocommerce/trunk/admin/Shipday_Time_Slot_Util.php
r3419924 r3483127 1 1 <?php 2 3 if ( ! defined( 'ABSPATH' ) ) { 4 exit; 5 } 2 6 3 7 class Shipday_Time_Slot_Util { … … 19 23 // HH 20 24 echo '<input type="text" id="' . esc_attr( $id ) . '_hh" name="' . esc_attr( $id ) . '[hh]" ' 21 . 'value="' . $hh. '" size="2" maxlength="2" min="1" max="12" step="1" inputmode="numeric" pattern="\d{2}" '25 . 'value="' . esc_attr( $hh ) . '" size="2" maxlength="2" min="1" max="12" step="1" inputmode="numeric" pattern="\d{2}" ' 22 26 . 'placeholder="HH" style="min-width:120px;text-align:center;" />'; 23 27 … … 26 30 // MM 27 31 echo '<input type="text" id="' . esc_attr( $id ) . '_mm" name="' . esc_attr( $id ) . '[mm]" ' 28 . 'value="' . $mm. '" size="2" maxlength="2" inputmode="numeric" pattern="\d{2}" '32 . 'value="' . esc_attr( $mm ) . '" size="2" maxlength="2" inputmode="numeric" pattern="\d{2}" ' 29 33 . 'placeholder="MM" style="min-width:120px;text-align:center;" />'; 30 34 -
shipday-for-woocommerce/trunk/admin/partials/shipday-admin-display.php
r3419924 r3483127 1 1 <?php 2 $active_tab = isset($_GET['tab']) ? sanitize_text_field($_GET['tab']) : 'general'; 2 3 if ( ! defined( 'ABSPATH' ) ) { 4 exit; 5 } 6 // phpcs:disable WordPress.NamingConventions.PrefixAllGlobals.NonPrefixedVariableFound -- Included admin partial uses file-scoped template variables. 7 $shipday_active_tab = filter_input( INPUT_GET, 'tab', FILTER_SANITIZE_FULL_SPECIAL_CHARS ); 8 $shipday_active_tab = is_string( $shipday_active_tab ) && '' !== $shipday_active_tab ? $shipday_active_tab : 'general'; 3 9 ?> 4 10 <div class="sd-root"> … … 17 23 <div class="sd-tab-list"> 18 24 <!-- GENERAL TAB BUTTON (active by default) --> 19 <button type="button" data-tab="general" class="sd-tab-button <?php echo $active_tab === 'general' ? 'sd-tab-button--active' : ''; ?>">25 <button type="button" data-tab="general" class="sd-tab-button <?php echo esc_attr( $shipday_active_tab === 'general' ? 'sd-tab-button--active' : '' ); ?>"> 20 26 <span>General</span> 21 27 </button> … … 23 29 <!-- REST API TAB BUTTON --> 24 30 <?php if ( !is_plugin_active( 'dokan-lite/dokan.php' ) && !is_plugin_active( 'wc-multivendor-marketplace/wc-multivendor-marketplace.php' )) {?> 25 <button type="button" data-tab="rest-api" class="sd-tab-button <?php echo $active_tab === 'rest-api' ? 'sd-tab-button--active' : ''; ?>">31 <button type="button" data-tab="rest-api" class="sd-tab-button <?php echo esc_attr( $shipday_active_tab === 'rest-api' ? 'sd-tab-button--active' : '' ); ?>"> 26 32 <span>Rest API</span> 27 33 </button> … … 48 54 49 55 <!-- GENERAL TAB PANEL --> 50 <div data-tab-panel="general" class="sd-tab-panel <?php echo $active_tab === 'general' ? 'sd-tab-panel--active' : ''; ?>">56 <div data-tab-panel="general" class="sd-tab-panel <?php echo esc_attr( $shipday_active_tab === 'general' ? 'sd-tab-panel--active' : '' ); ?>"> 51 57 <?php 52 58 include plugin_dir_path(__FILE__) . 'tab-shipday-connect.php'; … … 55 61 56 62 <!-- REST API TAB PANEL --> 57 <div data-tab-panel="rest-api" class="sd-tab-panel <?php echo $active_tab === 'rest-api' ? 'sd-tab-panel--active' : ''; ?>">63 <div data-tab-panel="rest-api" class="sd-tab-panel <?php echo esc_attr( $shipday_active_tab === 'rest-api' ? 'sd-tab-panel--active' : '' ); ?>"> 58 64 <?php 59 65 include plugin_dir_path( __FILE__ ) . 'tab-rest-api.php'; … … 123 129 })(); 124 130 </script> 125 -
shipday-for-woocommerce/trunk/admin/partials/shipday-admin-new.php
r3419924 r3483127 1 1 <?php 2 3 if ( ! defined( 'ABSPATH' ) ) { 4 exit; 5 } 6 // phpcs:disable WordPress.NamingConventions.PrefixAllGlobals.NonPrefixedVariableFound -- Included admin partial uses file-scoped template variables. 2 7 // Default to the new Overview tab if none is provided 3 $active_tab = isset($_GET['tab']) ? sanitize_text_field($_GET['tab']) : 'overview'; 8 $shipday_active_tab = filter_input( INPUT_GET, 'tab', FILTER_SANITIZE_FULL_SPECIAL_CHARS ); 9 $shipday_active_tab = is_string( $shipday_active_tab ) && '' !== $shipday_active_tab ? $shipday_active_tab : 'overview'; 4 10 ?> 5 11 <div class="sd-root"> … … 22 28 <!-- Overview --> 23 29 <button type="button" data-tab="overview" 24 class="sd-tab-button <?php echo $active_tab === 'overview' ? 'sd-tab-button--active' : ''; ?>"25 id="tab-overview" role="tab" aria-selected="<?php echo $active_tab === 'overview' ? 'true' : 'false'; ?>">30 class="sd-tab-button <?php echo esc_attr( $shipday_active_tab === 'overview' ? 'sd-tab-button--active' : '' ); ?>" 31 id="tab-overview" role="tab" aria-selected="<?php echo esc_attr( $shipday_active_tab === 'overview' ? 'true' : 'false' ); ?>"> 26 32 <span>Overview</span> 27 33 </button> … … 32 38 <!-- General--> 33 39 <button type="button" data-tab="general" 34 class="sd-tab-button <?php echo $active_tab === 'general' ? 'sd-tab-button--active' : ''; ?>"35 id="tab-general" role="tab" aria-selected="<?php echo $active_tab === 'general' ? 'true' : 'false'; ?>">40 class="sd-tab-button <?php echo esc_attr( $shipday_active_tab === 'general' ? 'sd-tab-button--active' : '' ); ?>" 41 id="tab-general" role="tab" aria-selected="<?php echo esc_attr( $shipday_active_tab === 'general' ? 'true' : 'false' ); ?>"> 36 42 <span>General</span> 37 43 </button> … … 39 45 <!-- Delivery --> 40 46 <button type="button" data-tab="delivery" 41 class="sd-tab-button <?php echo $active_tab === 'delivery' ? 'sd-tab-button--active' : ''; ?>"42 id="tab-delivery" role="tab" aria-selected="<?php echo $active_tab === 'delivery' ? 'true' : 'false'; ?>">47 class="sd-tab-button <?php echo esc_attr( $shipday_active_tab === 'delivery' ? 'sd-tab-button--active' : '' ); ?>" 48 id="tab-delivery" role="tab" aria-selected="<?php echo esc_attr( $shipday_active_tab === 'delivery' ? 'true' : 'false' ); ?>"> 43 49 <span>Delivery</span> 44 50 </button> … … 46 52 <!-- Pickup --> 47 53 <button type="button" data-tab="pickup" 48 class="sd-tab-button <?php echo $active_tab === 'pickup' ? 'sd-tab-button--active' : ''; ?>"49 id="tab-pickup" role="tab" aria-selected="<?php echo $active_tab === 'pickup' ? 'true' : 'false'; ?>">54 class="sd-tab-button <?php echo esc_attr( $shipday_active_tab === 'pickup' ? 'sd-tab-button--active' : '' ); ?>" 55 id="tab-pickup" role="tab" aria-selected="<?php echo esc_attr( $shipday_active_tab === 'pickup' ? 'true' : 'false' ); ?>"> 50 56 <span>Pickup</span> 51 57 </button> … … 56 62 <!-- Shipday Connect --> 57 63 <button type="button" data-tab="shipday-connect" 58 class="sd-tab-button <?php echo $active_tab === 'shipday-connect' ? 'sd-tab-button--active' : ''; ?>"59 id="tab-shipday-connect" role="tab" aria-selected="<?php echo $active_tab === 'shipday-connect' ? 'true' : 'false'; ?>">64 class="sd-tab-button <?php echo esc_attr( $shipday_active_tab === 'shipday-connect' ? 'sd-tab-button--active' : '' ); ?>" 65 id="tab-shipday-connect" role="tab" aria-selected="<?php echo esc_attr( $shipday_active_tab === 'shipday-connect' ? 'true' : 'false' ); ?>"> 60 66 <span>Connect Shipday Account</span> 61 67 </button> … … 64 70 <?php if ( !is_plugin_active( 'dokan-lite/dokan.php' ) && !is_plugin_active( 'wc-multivendor-marketplace/wc-multivendor-marketplace.php' )) { ?> 65 71 <button type="button" data-tab="rest-api" 66 class="sd-tab-button <?php echo $active_tab === 'rest-api' ? 'sd-tab-button--active' : ''; ?>"67 id="tab-rest-api" role="tab" aria-selected="<?php echo $active_tab === 'rest-api' ? 'true' : 'false'; ?>">72 class="sd-tab-button <?php echo esc_attr( $shipday_active_tab === 'rest-api' ? 'sd-tab-button--active' : '' ); ?>" 73 id="tab-rest-api" role="tab" aria-selected="<?php echo esc_attr( $shipday_active_tab === 'rest-api' ? 'true' : 'false' ); ?>"> 68 74 <span>Rest API</span> 69 75 </button> … … 78 84 79 85 <!-- OVERVIEW --> 80 <div data-tab-panel="overview" class="sd-tab-panel <?php echo $active_tab === 'overview' ? 'sd-tab-panel--active' : ''; ?>">86 <div data-tab-panel="overview" class="sd-tab-panel <?php echo esc_attr( $shipday_active_tab === 'overview' ? 'sd-tab-panel--active' : '' ); ?>"> 81 87 <?php 82 88 include plugin_dir_path( __FILE__ ) . 'tab-overview.php'; … … 85 91 86 92 <!-- SHIPDAY CONNECT (old general) --> 87 <div data-tab-panel="shipday-connect" class="sd-tab-panel <?php echo $active_tab === 'shipday-connect' ? 'sd-tab-panel--active' : ''; ?>">93 <div data-tab-panel="shipday-connect" class="sd-tab-panel <?php echo esc_attr( $shipday_active_tab === 'shipday-connect' ? 'sd-tab-panel--active' : '' ); ?>"> 88 94 <?php include plugin_dir_path( __FILE__ ) . 'tab-shipday-connect.php'; ?> 89 95 </div> 90 96 91 97 <!-- REST API (unchanged) --> 92 <div data-tab-panel="rest-api" class="sd-tab-panel <?php echo $active_tab === 'rest-api' ? 'sd-tab-panel--active' : ''; ?>">98 <div data-tab-panel="rest-api" class="sd-tab-panel <?php echo esc_attr( $shipday_active_tab === 'rest-api' ? 'sd-tab-panel--active' : '' ); ?>"> 93 99 <?php include plugin_dir_path( __FILE__ ) . 'tab-rest-api.php'; ?> 94 100 </div> 95 101 96 102 <!-- DELIVERY (unchanged) --> 97 <div data-tab-panel="delivery" class="sd-tab-panel <?php echo $active_tab === 'delivery' ? 'sd-tab-panel--active' : ''; ?>">103 <div data-tab-panel="delivery" class="sd-tab-panel <?php echo esc_attr( $shipday_active_tab === 'delivery' ? 'sd-tab-panel--active' : '' ); ?>"> 98 104 <?php include plugin_dir_path( __FILE__ ) . 'tab-delivery.php'; ?> 99 105 </div> 100 106 101 107 <!-- PICKUP (unchanged) --> 102 <div data-tab-panel="pickup" class="sd-tab-panel <?php echo $active_tab === 'pickup' ? 'sd-tab-panel--active' : ''; ?>">108 <div data-tab-panel="pickup" class="sd-tab-panel <?php echo esc_attr( $shipday_active_tab === 'pickup' ? 'sd-tab-panel--active' : '' ); ?>"> 103 109 <?php include plugin_dir_path( __FILE__ ) . 'tab-pickup.php'; ?> 104 110 </div> 105 111 106 112 <!-- General Settings (new) --> 107 <div data-tab-panel="general" class="sd-tab-panel <?php echo $active_tab === 'general' ? 'sd-tab-panel--active' : ''; ?>">113 <div data-tab-panel="general" class="sd-tab-panel <?php echo esc_attr( $shipday_active_tab === 'general' ? 'sd-tab-panel--active' : '' ); ?>"> 108 114 <?php include plugin_dir_path( __FILE__ ) . 'tab-general.php'; ?> 109 115 </div> … … 155 161 })(); 156 162 </script> 157 -
shipday-for-woocommerce/trunk/admin/partials/tab-delivery.php
r3467875 r3483127 1 1 <?php 2 3 if ( ! defined( 'ABSPATH' ) ) { 4 exit; 5 } 6 // phpcs:disable WordPress.NamingConventions.PrefixAllGlobals.NonPrefixedVariableFound -- Included admin partial uses file-scoped template variables. 2 7 $enable_delivery_date = get_option('shipday_enable_delivery_date', "no") === "yes"; 3 8 $delivery_date_mandatory = get_option('shipday_delivery_date_mandatory', "no") === "yes"; … … 30 35 <div class="sd-panel-body"> 31 36 32 <fieldset class="sd-fieldset" <?php echo $datetime_enabled ? '' : 'disabled aria-disabled="true"'; ?> <?php echo $datetime_enabled ? '' : 'disabled'; ?>>37 <fieldset class="sd-fieldset" <?php disabled( ! $datetime_enabled ); ?> aria-disabled="<?php echo esc_attr( $datetime_enabled ? 'false' : 'true' ); ?>"> 33 38 <p class="shipday-delivery-notice"><span 34 class="dashicons dashicons-yes"></span><?php _e(' Settings Changed Successfully', 'shipday-delivery'); ?>39 class="dashicons dashicons-yes"></span><?php esc_html_e( ' Settings Changed Successfully', 'shipday-for-woocommerce' ); ?> 35 40 </p> 36 41 … … 54 59 name="shipday_enable_delivery_date" 55 60 class="shipday-switch__input" 56 <?php echo ($enable_delivery_date) ? "checked" : ""?>61 <?php checked( $enable_delivery_date ); ?> 57 62 /> 58 63 <span class="shipday-switch__track"> … … 74 79 <input 75 80 type="checkbox" id="shipday_delivery_date_mandatory" name="shipday_delivery_date_mandatory" class="shipday-switch__input" 76 <?php echo ($delivery_date_mandatory) ? "checked" : ""?>81 <?php checked( $delivery_date_mandatory ); ?> 77 82 /> 78 83 <span class="shipday-switch__track"> … … 108 113 <label class="shipday-day-chip"> 109 114 <input type="checkbox" class="shipday-day-chip__input" name="shipday_avaialble_delivery_days[]" value="0" 110 <?php echo (in_array("0", $available_delivery_days)) ? "checked" : ""?>115 <?php checked( in_array( '0', $available_delivery_days, true ) ); ?> 111 116 /> 112 117 <span class="shipday-day-chip__pill">Sunday</span> … … 116 121 <input 117 122 type="checkbox" class="shipday-day-chip__input" name="shipday_avaialble_delivery_days[]" value="1" 118 <?php echo (in_array("1", $available_delivery_days, true)) ? "checked" : ""?>123 <?php checked( in_array( '1', $available_delivery_days, true ) ); ?> 119 124 /> 120 125 <span class="shipday-day-chip__pill">Monday</span> … … 124 129 <input 125 130 type="checkbox" class="shipday-day-chip__input" name="shipday_avaialble_delivery_days[]" value="2" 126 <?php echo (in_array("2", $available_delivery_days, true)) ? "checked" : ""?>131 <?php checked( in_array( '2', $available_delivery_days, true ) ); ?> 127 132 /> 128 133 <span class="shipday-day-chip__pill">Tuesday</span> … … 132 137 <input 133 138 type="checkbox" class="shipday-day-chip__input" name="shipday_avaialble_delivery_days[]" value="3" 134 <?php echo (in_array("3", $available_delivery_days, true)) ? "checked" : ""?>139 <?php checked( in_array( '3', $available_delivery_days, true ) ); ?> 135 140 /> 136 141 <span class="shipday-day-chip__pill">Wednesday</span> … … 140 145 <input 141 146 type="checkbox" class="shipday-day-chip__input" name="shipday_avaialble_delivery_days[]" value="4" 142 <?php echo (in_array("4", $available_delivery_days, true)) ? "checked" : ""?>147 <?php checked( in_array( '4', $available_delivery_days, true ) ); ?> 143 148 /> 144 149 <span class="shipday-day-chip__pill">Thursday</span> … … 148 153 <input 149 154 type="checkbox" class="shipday-day-chip__input" name="shipday_avaialble_delivery_days[]" value="5" 150 <?php echo (in_array("5", $available_delivery_days, true)) ? "checked" : ""?>155 <?php checked( in_array( '5', $available_delivery_days, true ) ); ?> 151 156 /> 152 157 <span class="shipday-day-chip__pill">Friday</span> … … 156 161 <input 157 162 type="checkbox" class="shipday-day-chip__input" name="shipday_avaialble_delivery_days[]" value="6" 158 <?php echo (in_array("6", $available_delivery_days, true)) ? "checked" : ""?>163 <?php checked( in_array( '6', $available_delivery_days, true ) ); ?> 159 164 /> 160 165 <span class="shipday-day-chip__pill">Saturday</span> … … 181 186 <div class="sd-input-wrapper"> 182 187 <input type="text" placeholder="" class="sd-text-input" name="shipday_selectable_delivery_days" 183 value="<?php echo $selectable_delivery_days?>"188 value="<?php echo esc_attr( $selectable_delivery_days ); ?>" 184 189 /> 185 190 </div> … … 204 209 <input 205 210 type="checkbox" id="shipday_enable_delivery_time" name="shipday_enable_delivery_time" class="shipday-switch__input" 206 <?php echo ($enable_delivery_time) ? "checked" : ""?>211 <?php checked( $enable_delivery_time ); ?> 207 212 /> 208 213 <span class="shipday-switch__track"> … … 224 229 <input 225 230 type="checkbox" id="shipday_delivery_time_mandatory" name="shipday_delivery_time_mandatory" class="shipday-switch__input" 226 <?php echo ($delivery_time_mandatory) ? "checked" : ""?>231 <?php checked( $delivery_time_mandatory ); ?> 227 232 /> 228 233 <span class="shipday-switch__track"> … … 252 257 type="number" min="1" max="12" id="shipday_delivery_time_slot_start_hh" name="shipday_delivery_time_slot_start_hh" 253 258 class="shipday-time-input__field" 254 value="<?php echo $start_delivery_slot['hh']?>"259 value="<?php echo esc_attr( $start_delivery_slot['hh'] ); ?>" 255 260 /> 256 261 </div> … … 263 268 type="number" min="0" max="59" step="5" id="shipday_delivery_time_slot_start_mm" name="shipday_delivery_time_slot_start_mm" 264 269 class="shipday-time-input__field" 265 value="<?php echo $start_delivery_slot['mm']?>"270 value="<?php echo esc_attr( $start_delivery_slot['mm'] ); ?>" 266 271 /> 267 272 </div> … … 274 279 class="shipday-ampm-select__field sd-text-input" 275 280 > 276 <option value="AM" <?php echo ($start_delivery_slot["ampm"]==="AM") ? "selected" : "" ?>>AM</option>277 <option value="PM" <?php echo ($start_delivery_slot["ampm"]==="PM") ? "selected" : "" ?>>PM</option>281 <option value="AM" <?php selected( $start_delivery_slot['ampm'], 'AM' ); ?>>AM</option> 282 <option value="PM" <?php selected( $start_delivery_slot['ampm'], 'PM' ); ?>>PM</option> 278 283 </select> 279 284 </div> … … 293 298 type="number" min="1" max="12" step="1" id="shipday_delivery_time_slot_end_hh" name="shipday_delivery_time_slot_end_hh" 294 299 class="shipday-time-input__field" 295 value="<?php echo $end_delivery_slot['hh']?>"300 value="<?php echo esc_attr( $end_delivery_slot['hh'] ); ?>" 296 301 /> 297 302 </div> … … 304 309 type="number" min="0" max="59" step="5" id="shipday_delivery_time_slot_end_mm" name="shipday_delivery_time_slot_end_mm" 305 310 class="shipday-time-input__field" 306 value="<?php echo $end_delivery_slot['mm']?>"311 value="<?php echo esc_attr( $end_delivery_slot['mm'] ); ?>" 307 312 /> 308 313 </div> … … 315 320 class="shipday-ampm-select__field sd-text-input" 316 321 > 317 <option value="AM" <?php echo ($end_delivery_slot["ampm"]==="AM") ? "selected" : "" ?>>AM</option>318 <option value="PM" <?php echo ($end_delivery_slot["ampm"]==="PM") ? "selected" : "" ?>>PM</option>322 <option value="AM" <?php selected( $end_delivery_slot['ampm'], 'AM' ); ?>>AM</option> 323 <option value="PM" <?php selected( $end_delivery_slot['ampm'], 'PM' ); ?>>PM</option> 319 324 </select> 320 325 </div> … … 334 339 class="shipday-slot-duration-field__select sd-text-input" 335 340 > 336 <option value="10" <?php echo ($delivery_slot_duration === "10") ? "selected" : ""?>>10</option>337 <option value="15" <?php echo ($delivery_slot_duration === "15") ? "selected" : ""?>>15</option>338 <option value="30" <?php echo ($delivery_slot_duration === "30") ? "selected" : ""?>>30</option>339 <option value="45" <?php echo ($delivery_slot_duration === "45") ? "selected" : ""?>>45</option>340 <option value="60" <?php echo ($delivery_slot_duration === "60") ? "selected" : ""?>>60</option>341 <option value="90" <?php echo ($delivery_slot_duration === "90") ? "selected" : ""?>>90</option>342 <option value="120" <?php echo ($delivery_slot_duration === "120") ? "selected" : ""?>>120</option>343 <option value="150" <?php echo ($delivery_slot_duration === "150") ? "selected" : ""?>>150</option>344 <option value="180" <?php echo ($delivery_slot_duration === "180") ? "selected" : ""?>>180</option>345 <option value="240" <?php echo ($delivery_slot_duration === "240") ? "selected" : ""?>>240</option>346 <option value="300" <?php echo ($delivery_slot_duration === "300") ? "selected" : ""?>>300</option>347 <option value="360" <?php echo ($delivery_slot_duration === "360") ? "selected" : ""?>>360</option>341 <option value="10" <?php selected( $delivery_slot_duration, '10' ); ?>>10</option> 342 <option value="15" <?php selected( $delivery_slot_duration, '15' ); ?>>15</option> 343 <option value="30" <?php selected( $delivery_slot_duration, '30' ); ?>>30</option> 344 <option value="45" <?php selected( $delivery_slot_duration, '45' ); ?>>45</option> 345 <option value="60" <?php selected( $delivery_slot_duration, '60' ); ?>>60</option> 346 <option value="90" <?php selected( $delivery_slot_duration, '90' ); ?>>90</option> 347 <option value="120" <?php selected( $delivery_slot_duration, '120' ); ?>>120</option> 348 <option value="150" <?php selected( $delivery_slot_duration, '150' ); ?>>150</option> 349 <option value="180" <?php selected( $delivery_slot_duration, '180' ); ?>>180</option> 350 <option value="240" <?php selected( $delivery_slot_duration, '240' ); ?>>240</option> 351 <option value="300" <?php selected( $delivery_slot_duration, '300' ); ?>>300</option> 352 <option value="360" <?php selected( $delivery_slot_duration, '360' ); ?>>360</option> 348 353 </select> 349 354 </div> -
shipday-for-woocommerce/trunk/admin/partials/tab-general.php
r3419924 r3483127 1 1 <?php 2 3 if ( ! defined( 'ABSPATH' ) ) { 4 exit; 5 } 6 // phpcs:disable WordPress.NamingConventions.PrefixAllGlobals.NonPrefixedVariableFound -- Included admin partial uses file-scoped template variables. 2 7 $datetime_enabled = get_option('shipday_enable_datetime_plugin', "no") === "yes"; 3 8 $order_type_enabled = get_option('shipday_enable_delivery_option', "no") === "yes"; … … 20 25 <p class="shipday-general-notice"> 21 26 <span class="dashicons dashicons-yes"></span> 22 <?php _e(' Settings Changed Successfully', 'shipday-delivery'); ?>27 <?php esc_html_e( ' Settings Changed Successfully', 'shipday-for-woocommerce' ); ?> 23 28 </p> 24 29 <form action="" method="post" id="shipday-general-settings-form"> … … 36 41 name="shipday_enable_datetime_plugin" 37 42 class="shipday-switch__input" 38 <?php echo ($datetime_enabled) ? "checked" : ""?>43 <?php checked( $datetime_enabled ); ?> 39 44 /> 40 45 <span class="shipday-switch__track"> … … 64 69 name="shipday_enable_delivery_option" 65 70 class="shipday-switch__input" 66 <?php echo ($order_type_enabled) ? "checked" : ""?>71 <?php checked( $order_type_enabled ); ?> 67 72 /> 68 73 <span class="shipday-switch__track"> … … 107 112 <div class="sd-input-wrapper sd-text-input"> 108 113 <input type="text" placeholder="" class="sd-text-input" name="shipday_delivery_pickup_label" 109 value="<?php echo $datetime_heading_label?>"114 value="<?php echo esc_attr( $datetime_heading_label ); ?>" 110 115 /> 111 116 </div> -
shipday-for-woocommerce/trunk/admin/partials/tab-order-sync.php
r3419924 r3483127 1 1 <?php 2 3 if ( ! defined( 'ABSPATH' ) ) { 4 exit; 5 } 6 // phpcs:disable WordPress.NamingConventions.PrefixAllGlobals.NonPrefixedVariableFound -- Included admin partial uses file-scoped template variables. 2 7 $pickup_order_enabled = get_option('wc_settings_tab_shipday_enable_pickup', "no") === "yes"; 3 8 $delivery_order_enabled = get_option('wc_settings_tab_shipday_enable_delivery', "yes") === "yes"; … … 22 27 <p class="shipday-order-sync-notice"> 23 28 <span class="dashicons dashicons-yes"></span> 24 <?php _e(' Settings Changed Successfully', 'shipday-delivery'); ?>29 <?php esc_html_e( ' Settings Changed Successfully', 'shipday-for-woocommerce' ); ?> 25 30 </p> 26 31 <form action="" method="post" id="shipday-order-sync-settings-form"> … … 57 62 name="wc_settings_tab_shipday_order_manage" 58 63 value="admin_manage" 59 <?php echo ($manage_order === 'admin_manage') ? 'checked' : ''; ?>64 <?php checked( $manage_order, 'admin_manage' ); ?> 60 65 /> 61 66 <span class="sd-radio__mark" aria-hidden="true"></span> … … 69 74 name="wc_settings_tab_shipday_order_manage" 70 75 value="vendor_manage" 71 <?php echo ($manage_order === 'vendor_manage') ? 'checked' : ''; ?>76 <?php checked( $manage_order, 'vendor_manage' ); ?> 72 77 /> 73 78 <span class="sd-radio__mark" aria-hidden="true"></span> -
shipday-for-woocommerce/trunk/admin/partials/tab-overview.php
r3419924 r3483127 1 1 <?php 2 3 if ( ! defined( 'ABSPATH' ) ) { 4 exit; 5 } 2 6 // Helper to build a same-page link to a specific tab 3 7 function shipday_tab_link( $tab_slug ) { … … 29 33 <div class="sd-link-row"> 30 34 <!-- General (blank page for now) --> 31 <a class="sd-link-tile" href="<?php echo shipday_tab_link('general'); ?>">35 <a class="sd-link-tile" href="<?php echo esc_url( shipday_tab_link( 'general' ) ); ?>"> 32 36 <span class="sd-link-tile__icon" aria-hidden="true"> 33 37 <svg xmlns="http://www.w3.org/2000/svg" width="24" height="24" viewBox="0 0 24 24" fill="none"> … … 42 46 43 47 <!-- Delivery --> 44 <a class="sd-link-tile" href="<?php echo shipday_tab_link('delivery'); ?>">48 <a class="sd-link-tile" href="<?php echo esc_url( shipday_tab_link( 'delivery' ) ); ?>"> 45 49 <span class="sd-link-tile__icon" aria-hidden="true"> 46 50 <!-- Delivery icon (24x24) --> … … 57 61 58 62 <!-- Pickup --> 59 <a class="sd-link-tile" href="<?php echo shipday_tab_link('pickup'); ?>">63 <a class="sd-link-tile" href="<?php echo esc_url( shipday_tab_link( 'pickup' ) ); ?>"> 60 64 <span class="sd-link-tile__icon" aria-hidden="true"> 61 65 <svg width="24" height="24" viewBox="0 0 24 24" fill="none" class="sd-link-tile__svg" xmlns="http://www.w3.org/2000/svg"><path d="M4.72745 17.2913C4.30662 17.2913 3.95037 17.1455 3.6587 16.8538C3.36704 16.5622 3.2212 16.2059 3.2212 15.7849V9.1278C2.88565 8.85224 2.63377 8.49461 2.46558 8.05488C2.29725 7.6153 2.29377 7.14072 2.45516 6.63113L3.29808 3.8778C3.40919 3.52738 3.59773 3.24481 3.8637 3.03009C4.12982 2.81537 4.44766 2.70801 4.81725 2.70801H16.1922C16.562 2.70801 16.8777 2.81058 17.1393 3.01572C17.4011 3.22086 17.5918 3.50294 17.7114 3.86197L18.5704 6.63113C18.7318 7.14072 18.7283 7.6137 18.56 8.05009C18.3918 8.48662 18.1399 8.8512 17.8043 9.14384V15.7849C17.8043 16.2059 17.6585 16.5622 17.3668 16.8538C17.0752 17.1455 16.7189 17.2913 16.2981 17.2913H4.72745ZM12.3462 8.54134C12.8013 8.54134 13.1435 8.40217 13.3727 8.12384C13.6018 7.84551 13.6956 7.54662 13.6539 7.22717L13.1475 3.95801H11.1377V7.24967C11.1377 7.60009 11.2563 7.90301 11.4935 8.15842C11.7307 8.4137 12.015 8.54134 12.3462 8.54134ZM8.5962 8.54134C8.97968 8.54134 9.29079 8.4137 9.52954 8.15842C9.76843 7.90301 9.88787 7.60009 9.88787 7.24967V3.95801H7.87808L7.37183 7.25926C7.32683 7.55523 7.41975 7.84294 7.65058 8.12238C7.88141 8.40169 8.19662 8.54134 8.5962 8.54134ZM4.88787 8.54134C5.19662 8.54134 5.46211 8.4337 5.68433 8.21842C5.90655 8.00315 6.04384 7.73259 6.0962 7.40676L6.58641 3.95801H4.81725C4.72641 3.95801 4.65433 3.97801 4.601 4.01801C4.54752 4.05815 4.50745 4.11829 4.48079 4.19842L3.67933 6.90988C3.56933 7.2678 3.6212 7.62919 3.83495 7.99405C4.04857 8.35891 4.39954 8.54134 4.88787 8.54134ZM16.1379 8.54134C16.5887 8.54134 16.9338 8.36426 17.1731 8.01009C17.4124 7.65592 17.4701 7.28919 17.3462 6.90988L16.5031 4.18238C16.4764 4.10224 16.4364 4.04481 16.3831 4.01009C16.3296 3.97537 16.2575 3.95801 16.1666 3.95801H14.4391L14.9293 7.40676C14.9817 7.73259 15.119 8.00315 15.3412 8.21842C15.5634 8.4337 15.829 8.54134 16.1379 8.54134ZM4.72745 16.0413H16.2981C16.3728 16.0413 16.4342 16.0173 16.4822 15.9693C16.5304 15.9212 16.5545 15.8597 16.5545 15.7849V9.71759C16.4637 9.75078 16.3878 9.77134 16.3268 9.77926C16.266 9.78731 16.203 9.79134 16.1379 9.79134C15.7629 9.79134 15.433 9.72349 15.1483 9.5878C14.8636 9.45211 14.5876 9.23467 14.3204 8.93551C14.0865 9.1962 13.8098 9.40405 13.4904 9.55905C13.1709 9.71391 12.8066 9.79134 12.3975 9.79134C12.0438 9.79134 11.7105 9.71787 11.3975 9.57092C11.0844 9.42412 10.7895 9.21231 10.5129 8.93551C10.2554 9.21231 9.9637 9.42412 9.63787 9.57092C9.3119 9.71787 8.98176 9.79134 8.64745 9.79134C8.27134 9.79134 7.91877 9.72322 7.58975 9.58697C7.26072 9.45072 6.9712 9.23356 6.7212 8.93551C6.37065 9.28592 6.04766 9.5162 5.75225 9.62634C5.45697 9.73634 5.16884 9.79134 4.88787 9.79134C4.82259 9.79134 4.75523 9.78731 4.68579 9.77926C4.61634 9.77134 4.54475 9.75078 4.471 9.71759V15.7849C4.471 15.8597 4.49509 15.9212 4.54329 15.9693C4.59134 16.0173 4.65273 16.0413 4.72745 16.0413Z" fill="#525252"></path></svg> … … 81 85 <div class="shipday-delivery-card__content"> 82 86 <div class="sd-link-row"> 83 <a class="sd-link-tile" href="<?php echo shipday_tab_link('shipday-connect'); ?>">87 <a class="sd-link-tile" href="<?php echo esc_url( shipday_tab_link( 'shipday-connect' ) ); ?>"> 84 88 <span class="sd-link-tile__icon" aria-hidden="true"> 85 89 <svg xmlns="http://www.w3.org/2000/svg" width="24" height="24" viewBox="0 0 24 24" fill="none"> … … 95 99 <!-- Rest API (honor your existing vendor check) --> 96 100 <?php if ( !is_plugin_active( 'dokan-lite/dokan.php' ) && !is_plugin_active( 'wc-multivendor-marketplace/wc-multivendor-marketplace.php' ) ) { ?> 97 <a class="sd-link-tile" href="<?php echo shipday_tab_link('rest-api'); ?>">101 <a class="sd-link-tile" href="<?php echo esc_url( shipday_tab_link( 'rest-api' ) ); ?>"> 98 102 <span class="sd-link-tile__icon" aria-hidden="true"> 99 103 <svg xmlns="http://www.w3.org/2000/svg" width="24" height="24" viewBox="0 0 24 24" fill="none"> -
shipday-for-woocommerce/trunk/admin/partials/tab-pickup.php
r3467875 r3483127 1 1 <?php 2 3 if ( ! defined( 'ABSPATH' ) ) { 4 exit; 5 } 6 // phpcs:disable WordPress.NamingConventions.PrefixAllGlobals.NonPrefixedVariableFound -- Included admin partial uses file-scoped template variables. 2 7 $enable_pickup_date = get_option('shipday_enable_pickup_date', "no") === "yes"; 3 8 $pickup_date_mandatory = get_option('shipday_pickup_date_mandatory', "no") === "yes"; … … 29 34 30 35 <div class="sd-panel-body"> 31 <fieldset class="sd-fieldset" <?php echo $datetime_enabled ? '' : 'disabled aria-disabled="true"'; ?> <?php echo $datetime_enabled ? '' : 'disabled'; ?>>36 <fieldset class="sd-fieldset" <?php disabled( ! $datetime_enabled ); ?> aria-disabled="<?php echo esc_attr( $datetime_enabled ? 'false' : 'true' ); ?>"> 32 37 33 38 <p class="shipday-pickup-notice"><span 34 class="dashicons dashicons-yes"></span><?php _e(' Settings Changed Successfully', 'shipday-delivery'); ?>39 class="dashicons dashicons-yes"></span><?php esc_html_e( ' Settings Changed Successfully', 'shipday-for-woocommerce' ); ?> 35 40 </p> 36 41 … … 54 59 name="shipday_enable_pickup_date" 55 60 class="shipday-switch__input" 56 <?php echo ($enable_pickup_date) ? "checked" : ""?>61 <?php checked( $enable_pickup_date ); ?> 57 62 /> 58 63 <span class="shipday-switch__track"> … … 74 79 <input 75 80 type="checkbox" id="shipday_pickup_date_mandatory" name="shipday_pickup_date_mandatory" class="shipday-switch__input" 76 <?php echo ($pickup_date_mandatory) ? "checked" : ""?>81 <?php checked( $pickup_date_mandatory ); ?> 77 82 /> 78 83 <span class="shipday-switch__track"> … … 108 113 <label class="shipday-day-chip"> 109 114 <input type="checkbox" class="shipday-day-chip__input" name="shipday_avaialble_pickup_days[]" value="0" 110 <?php echo (in_array("0", $available_pickup_days)) ? "checked" : ""?>115 <?php checked( in_array( '0', $available_pickup_days, true ) ); ?> 111 116 /> 112 117 <span class="shipday-day-chip__pill">Sunday</span> … … 116 121 <input 117 122 type="checkbox" class="shipday-day-chip__input" name="shipday_avaialble_pickup_days[]" value="1" 118 <?php echo (in_array("1", $available_pickup_days, true)) ? "checked" : ""?>123 <?php checked( in_array( '1', $available_pickup_days, true ) ); ?> 119 124 /> 120 125 <span class="shipday-day-chip__pill">Monday</span> … … 124 129 <input 125 130 type="checkbox" class="shipday-day-chip__input" name="shipday_avaialble_pickup_days[]" value="2" 126 <?php echo (in_array("2", $available_pickup_days, true)) ? "checked" : ""?>131 <?php checked( in_array( '2', $available_pickup_days, true ) ); ?> 127 132 /> 128 133 <span class="shipday-day-chip__pill">Tuesday</span> … … 132 137 <input 133 138 type="checkbox" class="shipday-day-chip__input" name="shipday_avaialble_pickup_days[]" value="3" 134 <?php echo (in_array("3", $available_pickup_days, true)) ? "checked" : ""?>139 <?php checked( in_array( '3', $available_pickup_days, true ) ); ?> 135 140 /> 136 141 <span class="shipday-day-chip__pill">Wednesday</span> … … 140 145 <input 141 146 type="checkbox" class="shipday-day-chip__input" name="shipday_avaialble_pickup_days[]" value="4" 142 <?php echo (in_array("4", $available_pickup_days, true)) ? "checked" : ""?>147 <?php checked( in_array( '4', $available_pickup_days, true ) ); ?> 143 148 /> 144 149 <span class="shipday-day-chip__pill">Thursday</span> … … 148 153 <input 149 154 type="checkbox" class="shipday-day-chip__input" name="shipday_avaialble_pickup_days[]" value="5" 150 <?php echo (in_array("5", $available_pickup_days, true)) ? "checked" : ""?>155 <?php checked( in_array( '5', $available_pickup_days, true ) ); ?> 151 156 /> 152 157 <span class="shipday-day-chip__pill">Friday</span> … … 156 161 <input 157 162 type="checkbox" class="shipday-day-chip__input" name="shipday_avaialble_pickup_days[]" value="6" 158 <?php echo (in_array("6", $available_pickup_days, true)) ? "checked" : ""?>163 <?php checked( in_array( '6', $available_pickup_days, true ) ); ?> 159 164 /> 160 165 <span class="shipday-day-chip__pill">Saturday</span> … … 181 186 <div class="sd-input-wrapper"> 182 187 <input type="text" placeholder="" class="sd-text-input" name="shipday_selectable_pickup_days" 183 value="<?php echo $selectable_pickup_days?>"188 value="<?php echo esc_attr( $selectable_pickup_days ); ?>" 184 189 /> 185 190 </div> … … 204 209 <input 205 210 type="checkbox" id="shipday_enable_pickup_time" name="shipday_enable_pickup_time" class="shipday-switch__input" 206 <?php echo ($enable_pickup_time) ? "checked" : ""?>211 <?php checked( $enable_pickup_time ); ?> 207 212 /> 208 213 <span class="shipday-switch__track"> … … 224 229 <input 225 230 type="checkbox" id="shipday_pickup_time_mandatory" name="shipday_pickup_time_mandatory" class="shipday-switch__input" 226 <?php echo ($pickup_time_mandatory) ? "checked" : ""?>231 <?php checked( $pickup_time_mandatory ); ?> 227 232 /> 228 233 <span class="shipday-switch__track"> … … 252 257 type="number" min="1" max="12" id="shipday_pickup_time_slot_start_hh" name="shipday_pickup_time_slot_start_hh" 253 258 class="shipday-time-input__field" 254 value="<?php echo $start_pickup_slot['hh']?>"259 value="<?php echo esc_attr( $start_pickup_slot['hh'] ); ?>" 255 260 /> 256 261 </div> … … 263 268 type="number" min="0" max="59" step="5" id="shipday_pickup_time_slot_start_mm" name="shipday_pickup_time_slot_start_mm" 264 269 class="shipday-time-input__field" 265 value="<?php echo $start_pickup_slot['mm']?>"270 value="<?php echo esc_attr( $start_pickup_slot['mm'] ); ?>" 266 271 /> 267 272 </div> … … 274 279 class="shipday-ampm-select__field sd-text-input" 275 280 > 276 <option value="AM" <?php echo ($start_pickup_slot["ampm"]==="AM") ? "selected" : "" ?>>AM</option>277 <option value="PM" <?php echo ($start_pickup_slot["ampm"]==="PM") ? "selected" : "" ?>>PM</option>281 <option value="AM" <?php selected( $start_pickup_slot['ampm'], 'AM' ); ?>>AM</option> 282 <option value="PM" <?php selected( $start_pickup_slot['ampm'], 'PM' ); ?>>PM</option> 278 283 </select> 279 284 </div> … … 293 298 type="number" min="1" max="12" step="1" id="shipday_pickup_time_slot_end_hh" name="shipday_pickup_time_slot_end_hh" 294 299 class="shipday-time-input__field" 295 value="<?php echo $end_pickup_slot['hh']?>"300 value="<?php echo esc_attr( $end_pickup_slot['hh'] ); ?>" 296 301 /> 297 302 </div> … … 304 309 type="number" min="0" max="59" step="5" id="shipday_pickup_time_slot_end_mm" name="shipday_pickup_time_slot_end_mm" 305 310 class="shipday-time-input__field" 306 value="<?php echo $end_pickup_slot['mm']?>"311 value="<?php echo esc_attr( $end_pickup_slot['mm'] ); ?>" 307 312 /> 308 313 </div> … … 315 320 class="shipday-ampm-select__field sd-text-input" 316 321 > 317 <option value="AM" <?php echo ($end_pickup_slot["ampm"]==="AM") ? "selected" : "" ?>>AM</option>318 <option value="PM" <?php echo ($end_pickup_slot["ampm"]==="PM") ? "selected" : "" ?>>PM</option>322 <option value="AM" <?php selected( $end_pickup_slot['ampm'], 'AM' ); ?>>AM</option> 323 <option value="PM" <?php selected( $end_pickup_slot['ampm'], 'PM' ); ?>>PM</option> 319 324 </select> 320 325 </div> … … 334 339 class="shipday-slot-duration-field__select sd-text-input" 335 340 > 336 <option value="10" <?php echo ($pickup_slot_duration === "10") ? "selected" : ""?>>10</option>337 <option value="15" <?php echo ($pickup_slot_duration === "15") ? "selected" : ""?>>15</option>338 <option value="30" <?php echo ($pickup_slot_duration === "30") ? "selected" : ""?>>30</option>339 <option value="45" <?php echo ($pickup_slot_duration === "45") ? "selected" : ""?>>45</option>340 <option value="60" <?php echo ($pickup_slot_duration === "60") ? "selected" : ""?>>60</option>341 <option value="90" <?php echo ($pickup_slot_duration === "90") ? "selected" : ""?>>90</option>342 <option value="120" <?php echo ($pickup_slot_duration === "120") ? "selected" : ""?>>120</option>343 <option value="150" <?php echo ($pickup_slot_duration === "150") ? "selected" : ""?>>150</option>344 <option value="180" <?php echo ($pickup_slot_duration === "180") ? "selected" : ""?>>180</option>345 <option value="240" <?php echo ($pickup_slot_duration === "240") ? "selected" : ""?>>240</option>346 <option value="300" <?php echo ($pickup_slot_duration === "300") ? "selected" : ""?>>300</option>347 <option value="360" <?php echo ($pickup_slot_duration === "360") ? "selected" : ""?>>360</option>341 <option value="10" <?php selected( $pickup_slot_duration, '10' ); ?>>10</option> 342 <option value="15" <?php selected( $pickup_slot_duration, '15' ); ?>>15</option> 343 <option value="30" <?php selected( $pickup_slot_duration, '30' ); ?>>30</option> 344 <option value="45" <?php selected( $pickup_slot_duration, '45' ); ?>>45</option> 345 <option value="60" <?php selected( $pickup_slot_duration, '60' ); ?>>60</option> 346 <option value="90" <?php selected( $pickup_slot_duration, '90' ); ?>>90</option> 347 <option value="120" <?php selected( $pickup_slot_duration, '120' ); ?>>120</option> 348 <option value="150" <?php selected( $pickup_slot_duration, '150' ); ?>>150</option> 349 <option value="180" <?php selected( $pickup_slot_duration, '180' ); ?>>180</option> 350 <option value="240" <?php selected( $pickup_slot_duration, '240' ); ?>>240</option> 351 <option value="300" <?php selected( $pickup_slot_duration, '300' ); ?>>300</option> 352 <option value="360" <?php selected( $pickup_slot_duration, '360' ); ?>>360</option> 348 353 </select> 349 354 </div> -
shipday-for-woocommerce/trunk/admin/partials/tab-rest-api.php
r3419924 r3483127 1 1 <?php 2 3 if ( ! defined( 'ABSPATH' ) ) { 4 exit; 5 } 6 // phpcs:disable WordPress.NamingConventions.PrefixAllGlobals.NonPrefixedVariableFound -- Included admin partial uses file-scoped template variables. 2 7 $consumer_key = get_option('wc_settings_tab_shipday_rest_api_consumer_key'); 3 8 $consumer_secret = get_option('wc_settings_tab_shipday_rest_api_consumer_secret'); … … 16 21 17 22 <div class="sd-panel-body"> 18 <p class="shipday-rest-api-notice"><span class="dashicons dashicons-yes"></span><?php _e(' Settings Changed Successfully', 'shipday-delivery'); ?></p>23 <p class="shipday-rest-api-notice"><span class="dashicons dashicons-yes"></span><?php esc_html_e( ' Settings Changed Successfully', 'shipday-for-woocommerce' ); ?></p> 19 24 <form action="" method="post" id ="shipday-rest-api-settings-form"> 20 25 <?php wp_nonce_field('shipday_nonce'); ?> … … 31 36 <div class="sd-input-wrapper"> 32 37 <input type="text" placeholder="Enter consumer Key" class="sd-text-input" name="shipday_consumer_key" 33 value="<?php echo (isset($consumer_key) && !empty($consumer_key)) ? stripslashes($consumer_key) : ''?>"38 value="<?php echo esc_attr( ! empty( $consumer_key ) ? wp_unslash( $consumer_key ) : '' ); ?>" 34 39 /> 35 40 </div> … … 41 46 <div class="sd-input-wrapper"> 42 47 <input type="text" placeholder="Enter consumer secret" class="sd-text-input" name="shipday_consumer_secret" 43 value="<?php echo (isset($consumer_secret) && !empty($consumer_secret)) ? stripslashes($consumer_secret) : ''?>"48 value="<?php echo esc_attr( ! empty( $consumer_secret ) ? wp_unslash( $consumer_secret ) : '' ); ?>" 44 49 /> 45 50 </div> -
shipday-for-woocommerce/trunk/admin/partials/tab-shipday-connect.php
r3419924 r3483127 1 1 <?php 2 3 if ( ! defined( 'ABSPATH' ) ) { 4 exit; 5 } 6 // phpcs:disable WordPress.NamingConventions.PrefixAllGlobals.NonPrefixedVariableFound -- Included admin partial uses file-scoped template variables. 2 7 $api_key = get_option('wc_settings_tab_shipday_api_key'); 3 8 $pickup_order_enabled = get_option('wc_settings_tab_shipday_enable_pickup', "no") === "yes"; … … 20 25 21 26 <div class="sd-panel-body"> 22 <p class="shipday-connect-notice"><span class="dashicons dashicons-yes"></span><?php _e(' Settings Changed Successfully', 'shipday-delivery'); ?></p>27 <p class="shipday-connect-notice"><span class="dashicons dashicons-yes"></span><?php esc_html_e( ' Settings Changed Successfully', 'shipday-for-woocommerce' ); ?></p> 23 28 <form action="" method="post" id ="shipday-connect-settings-form"> 24 29 <?php wp_nonce_field('shipday_nonce'); ?> … … 32 37 <div class="sd-input-wrapper"> 33 38 <input type="text" placeholder="Enter API Key" class="sd-text-input" name="shipday_api_key" 34 value="<?php echo (isset($api_key) && !empty($api_key)) ? stripslashes($api_key) : ''?>"39 value="<?php echo esc_attr( ! empty( $api_key ) ? wp_unslash( $api_key ) : '' ); ?>" 35 40 /> 36 41 </div> … … 48 53 name="wc_settings_tab_shipday_enable_pickup" 49 54 class="shipday-switch__input" 50 <?php echo ($pickup_order_enabled) ? "checked" : ""?>55 <?php checked( $pickup_order_enabled ); ?> 51 56 /> 52 57 <span class="shipday-switch__track"> … … 73 78 name="wc_settings_tab_shipday_sync" 74 79 class="shipday-switch__input" 75 <?php echo ($order_sync_enabled) ? "checked" : ""?>80 <?php checked( $order_sync_enabled ); ?> 76 81 /> 77 82 <span class="shipday-switch__track"> … … 115 120 name="wc_settings_tab_shipday_order_manage" 116 121 value="admin_manage" 117 <?php echo ($manage_order === 'admin_manage') ? 'checked' : ''; ?>122 <?php checked( $manage_order, 'admin_manage' ); ?> 118 123 /> 119 124 <span class="sd-radio__mark" aria-hidden="true"></span> … … 127 132 name="wc_settings_tab_shipday_order_manage" 128 133 value="vendor_manage" 129 <?php echo ($manage_order === 'vendor_manage') ? 'checked' : ''; ?>134 <?php checked( $manage_order, 'vendor_manage' ); ?> 130 135 /> 131 136 <span class="sd-radio__mark" aria-hidden="true"></span> -
shipday-for-woocommerce/trunk/date-modifiers/Coderocks_Woo_Delivery.php
r2692251 r3483127 1 1 <?php 2 3 if ( ! defined( 'ABSPATH' ) ) { 4 exit; 5 } 6 // phpcs:disable WordPress.NamingConventions.PrefixAllGlobals.NonPrefixedClassFound -- Compatibility class mirrors the third-party integration name. 2 7 require_once dirname( __FILE__ ) . '/Date_Picker_Object.php'; 3 8 -
shipday-for-woocommerce/trunk/date-modifiers/Date_Picker_Object.php
r2662253 r3483127 1 1 <?php 2 3 if ( ! defined( 'ABSPATH' ) ) { 4 exit; 5 } 6 // phpcs:disable WordPress.NamingConventions.PrefixAllGlobals.NonPrefixedClassFound -- Compatibility class mirrors the third-party integration name. 2 7 3 8 class Date_Picker_Object { -
shipday-for-woocommerce/trunk/date-modifiers/Delivery_Area_Pro.php
r2712411 r3483127 1 1 <?php 2 3 if ( ! defined( 'ABSPATH' ) ) { 4 exit; 5 } 6 // phpcs:disable WordPress.NamingConventions.PrefixAllGlobals.NonPrefixedClassFound -- Compatibility class mirrors the third-party integration name. 2 7 3 8 require_once dirname( __FILE__ ) . '/Date_Picker_Object.php'; -
shipday-for-woocommerce/trunk/date-modifiers/Order_Delivery_Date_Shipday.php
r2670834 r3483127 1 1 <?php 2 3 if ( ! defined( 'ABSPATH' ) ) { 4 exit; 5 } 6 // phpcs:disable WordPress.NamingConventions.PrefixAllGlobals.NonPrefixedClassFound -- Compatibility class mirrors the third-party integration name. 2 7 require_once dirname( __FILE__ ) . '/Date_Picker_Object.php'; 3 8 -
shipday-for-woocommerce/trunk/date-modifiers/order_delivery_date.php
r2829892 r3483127 1 1 <?php 2 3 if ( ! defined( 'ABSPATH' ) ) { 4 exit; 5 } 6 // phpcs:disable WordPress.NamingConventions.PrefixAllGlobals.NonPrefixedFunctionFound -- Compatibility helpers keep their legacy public names. 2 7 3 8 require_once dirname( __DIR__ ) . '/functions/common.php'; -
shipday-for-woocommerce/trunk/dispatch_post/payload_post.php
r3419924 r3483127 1 1 <?php 2 3 if ( ! defined( 'ABSPATH' ) ) { 4 exit; 5 } 6 // phpcs:disable WordPress.NamingConventions.PrefixAllGlobals.NonPrefixedVariableFound,WordPress.NamingConventions.PrefixAllGlobals.NonPrefixedFunctionFound -- Legacy payload helpers are used across the plugin codebase. 2 7 require_once dirname(__DIR__). '/functions/logger.php'; 3 8 require_once dirname(__DIR__). '/functions/common.php'; … … 11 16 { 12 17 global $single_vendor_webhook_url; 13 $response = shipday_ curl_post_payload($payload, $single_vendor_webhook_url);18 $response = shipday_http_post_payload($payload, $single_vendor_webhook_url); 14 19 if ($response['http_code'] != 200) { 15 shipday_logger('error', 'Curl(single-vendor) failed with code: '.$response['http_code'].' Response: '.json_encode($response)); 16 $response = streams_post_payload($payload, $single_vendor_webhook_url); 17 } 18 if ($response['http_code'] != 200) { 19 shipday_logger('error', 'Stream(single-vendor) failed with code: '.$response['http_code'].' Response: '.json_encode($response)); 20 shipday_logger('error', 'HTTP API(single-vendor) failed with code: '.$response['http_code'].' Response: '.json_encode($response)); 20 21 } 21 22 return $response; … … 25 26 { 26 27 global $multi_vendor_webhook_url; 27 $response = shipday_ curl_post_payload($payload, $multi_vendor_webhook_url);28 $response = shipday_http_post_payload($payload, $multi_vendor_webhook_url); 28 29 if ($response['http_code'] != 200) { 29 shipday_logger('error', 'Curl(multi-vendor) failed with code: '.$response['http_code'].' Response: '.json_encode($response)); 30 $response = streams_post_payload($payload, $multi_vendor_webhook_url); 31 } 32 if ($response['http_code'] != 200) { 33 shipday_logger('error', 'Stream(multi-vendor) failed with code: '.$response['http_code'].' Response: '.json_encode($response)); 30 shipday_logger('error', 'HTTP API(multi-vendor) failed with code: '.$response['http_code'].' Response: '.json_encode($response)); 34 31 } 35 32 return $response; … … 39 36 { 40 37 global $cancel_webhook_url; 41 $response = shipday_ curl_post_payload($payload, $cancel_webhook_url);38 $response = shipday_http_post_payload($payload, $cancel_webhook_url); 42 39 if ($response['http_code'] != 200) { 43 shipday_logger('error', 'Curl(cancel-order) failed with code: '.$response['http_code'].' Response: '.json_encode($response)); 44 $response = streams_post_payload($payload, $cancel_webhook_url); 45 } 46 if ($response['http_code'] != 200) { 47 shipday_logger('error', 'Stream(cancel-order) failed with code: '.$response['http_code'].' Response: '.json_encode($response)); 40 shipday_logger('error', 'HTTP API(cancel-order) failed with code: '.$response['http_code'].' Response: '.json_encode($response)); 48 41 } 49 42 return $response; 50 43 } 51 44 52 function s treams_post_payload(array $payload, $url) {53 $opts = array(54 'http' => array(55 'method' => 'POST',56 'header ' => array(57 'Content-Type : application/json'45 function shipday_http_post_payload(array $payload, $url) { 46 return shipday_remote_post( 47 $url, 48 array( 49 'headers' => array( 50 'Content-Type' => 'application/json', 58 51 ), 59 ' content' => json_encode($payload)52 'body' => remove_emoji( wp_json_encode( $payload ) ), 60 53 ) 61 54 ); 62 $context = stream_context_create($opts);63 file_get_contents($url, false, $context);64 return $http_response_header;65 55 } 66 67 function shipday_curl_post_payload(array $payload, $url) {68 $curl = curl_init();69 curl_setopt_array(70 $curl,71 array(72 CURLOPT_URL => $url,73 CURLOPT_RETURNTRANSFER => true,74 CURLOPT_ENCODING => '',75 CURLOPT_MAXREDIRS => 10,76 CURLOPT_TIMEOUT => 0,77 CURLOPT_FOLLOWLOCATION => true,78 CURLOPT_HTTP_VERSION => CURL_HTTP_VERSION_1_1,79 CURLOPT_CUSTOMREQUEST => 'POST',80 CURLOPT_POSTFIELDS => remove_emoji(json_encode($payload)),81 CURLOPT_HTTPHEADER => array(82 'Content-Type: application/json'83 )84 )85 );86 $response = curl_exec($curl);87 return curl_getinfo($curl);88 } -
shipday-for-woocommerce/trunk/dispatch_post/post_fun.php
r3336343 r3483127 1 1 <?php 2 3 if ( ! defined( 'ABSPATH' ) ) { 4 exit; 5 } 2 6 require_once dirname(__DIR__). '/functions/logger.php'; 3 7 require_once dirname(__DIR__). '/functions/common.php'; … … 55 59 function shipday_post_order(array $payload, string $api_key, $url) { 56 60 if (strlen($api_key) < 3) return false; 57 $response = shipday_ curl_post_order($payload, $api_key, $url);61 $response = shipday_http_post_order($payload, $api_key, $url); 58 62 if ($response['http_code'] != 200) { 59 shipday_logger('error', 'Curl failed with code: '.$response['http_code'].' Response: '.json_encode($response)); 60 shipday_logger('info', 'Trying with stream post order'); 61 $response = streams_post_order($payload, $api_key, $url); 62 } 63 if ($response['http_code'] != 200) { 64 shipday_logger('error', 'Stream failed with code: '.$response['http_code'].' Response: '.json_encode($response)); 63 shipday_logger('error', 'HTTP API request failed with code: '.$response['http_code'].' Response: '.json_encode($response)); 65 64 } 66 65 return $response; 67 66 } 68 67 69 function s treams_post_order(array $payload, string $api_key, $url) {70 $opts = array(71 'http' => array(72 'method' => 'POST',73 'header ' => array(74 ' Content-Type: application/json',75 ' Authorization: Basic '.$api_key,68 function shipday_http_post_order(array $payload, string $api_key, $url) { 69 return shipday_remote_post( 70 $url, 71 array( 72 'headers' => array( 73 'Authorization' => 'Basic ' . $api_key, 74 'Content-Type' => 'application/json', 76 75 ), 77 ' content' => json_encode($payload)76 'body' => remove_emoji( wp_json_encode( $payload ) ), 78 77 ) 79 78 ); 80 $context = stream_context_create($opts);81 file_get_contents($url, false, $context);82 return $http_response_header;83 79 } 84 85 function shipday_curl_post_order(array $payload, string $api_key, $url) {86 $curl = curl_init();87 curl_setopt_array(88 $curl,89 array(90 CURLOPT_URL => $url,91 CURLOPT_RETURNTRANSFER => true,92 CURLOPT_ENCODING => '',93 CURLOPT_MAXREDIRS => 10,94 CURLOPT_TIMEOUT => 0,95 CURLOPT_FOLLOWLOCATION => true,96 CURLOPT_HTTP_VERSION => CURL_HTTP_VERSION_1_1,97 CURLOPT_CUSTOMREQUEST => 'POST',98 CURLOPT_POSTFIELDS => remove_emoji(json_encode($payload)),99 CURLOPT_HTTPHEADER => array(100 'Authorization: Basic '.$api_key,101 'Content-Type: application/json'102 )103 )104 );105 $response = curl_exec($curl);106 return curl_getinfo($curl);107 } -
shipday-for-woocommerce/trunk/functions/common.php
r3381147 r3483127 1 1 <?php 2 3 if ( ! defined( 'ABSPATH' ) ) { 4 exit; 5 } 6 // phpcs:disable WordPress.NamingConventions.PrefixAllGlobals.NonPrefixedVariableFound,WordPress.NamingConventions.PrefixAllGlobals.NonPrefixedFunctionFound -- Legacy helper API is used across the plugin codebase. 2 7 3 8 /** Global Variables */ … … 89 94 } 90 95 96 function shipday_remote_post( $url, array $args = array() ) { 97 $request_args = wp_parse_args( 98 $args, 99 array( 100 'method' => 'POST', 101 'timeout' => 20, 102 'redirection' => 5, 103 'httpversion' => '1.1', 104 'blocking' => true, 105 ) 106 ); 107 108 $response = wp_safe_remote_post( esc_url_raw( $url ), $request_args ); 109 110 if ( is_wp_error( $response ) ) { 111 return array( 112 'http_code' => 0, 113 'body' => $response->get_error_message(), 114 'error' => $response->get_error_code(), 115 ); 116 } 117 118 return array( 119 'http_code' => (int) wp_remote_retrieve_response_code( $response ), 120 'body' => wp_remote_retrieve_body( $response ), 121 'headers' => wp_remote_retrieve_headers( $response ), 122 ); 123 } 124 91 125 ?> -
shipday-for-woocommerce/trunk/functions/logger.php
r2685513 r3483127 1 1 <?php 2 3 if ( ! defined( 'ABSPATH' ) ) { 4 exit; 5 } 2 6 /** Debug Functions */ 3 7 function shipday_logger(string $level, string $message) { -
shipday-for-woocommerce/trunk/order_data/Dokan_Order_Shipday.php
r3336343 r3483127 1 1 <?php 2 3 if ( ! defined( 'ABSPATH' ) ) { 4 exit; 5 } 2 6 require_once dirname( __DIR__ ) . '/functions/common.php'; 3 7 require_once dirname( __DIR__ ) . '/date-modifiers/order_delivery_date.php'; -
shipday-for-woocommerce/trunk/order_data/FoodStore_Order_Shipday.php
r2685513 r3483127 1 1 <?php 2 3 if ( ! defined( 'ABSPATH' ) ) { 4 exit; 5 } 2 6 require_once dirname( __DIR__ ) . '/functions/common.php'; 3 7 require_once dirname(__DIR__). '/date-modifiers/order_delivery_date.php'; 4 8 require_once dirname( __FILE__ ) . '/Woo_Order_Shipday.php'; 5 9 10 // phpcs:disable WordPress.NamingConventions.PrefixAllGlobals.NonPrefixedClassFound -- Legacy class name retained for backwards compatibility. 6 11 class FoodStore_Order_Shipday extends Woo_Order_Shipday 7 12 { -
shipday-for-woocommerce/trunk/order_data/WCFM_Order_Shipday.php
r3365528 r3483127 1 1 <?php 2 3 if ( ! defined( 'ABSPATH' ) ) { 4 exit; 5 } 2 6 3 7 require_once dirname( __DIR__ ) . '/functions/common.php'; … … 6 10 require_once dirname(__DIR__). '/date-modifiers/order_delivery_date.php'; 7 11 12 // phpcs:disable WordPress.NamingConventions.PrefixAllGlobals.NonPrefixedClassFound -- Legacy class name retained for backwards compatibility. 8 13 class WCFM_Order_Shipday extends Woocommerce_Core_Shipday { 9 14 protected $order; … … 253 258 } elseif (isset($times['expectedPickupDate'])) { 254 259 $result['expectedPickupDate'] = $times['expectedPickupDate']; 255 } else {256 // Default to today if no date specified257 $result['expectedPickupDate'] = date('Y-m-d');258 }259 260 // If no time specified, set a default261 if (!isset($result['expectedPickupTime'])) {262 $result['expectedPickupTime'] = date('H:i:s', strtotime('+1 hour'));263 }260 } else { 261 // Default to today if no date specified 262 $result['expectedPickupDate'] = wp_date( 'Y-m-d' ); 263 } 264 265 // If no time specified, set a default 266 if (!isset($result['expectedPickupTime'])) { 267 $result['expectedPickupTime'] = wp_date( 'H:i:s', time() + HOUR_IN_SECONDS ); 268 } 264 269 265 270 return $result; -
shipday-for-woocommerce/trunk/order_data/Woo_Order_Shipday.php
r3365528 r3483127 1 1 <?php 2 3 if ( ! defined( 'ABSPATH' ) ) { 4 exit; 5 } 2 6 require_once dirname( __DIR__ ) . '/functions/common.php'; 3 7 require_once dirname(__DIR__). '/date-modifiers/order_delivery_date.php'; 4 8 require_once dirname( __FILE__ ) . '/Woocommerce_Core_Shipday.php'; 5 9 6 10 // phpcs:disable WordPress.NamingConventions.PrefixAllGlobals.NonPrefixedClassFound -- Legacy class name retained for backwards compatibility. 7 11 class Woo_Order_Shipday extends Woocommerce_Core_Shipday { 8 12 protected $order; … … 200 204 } elseif (isset($times['expectedPickupDate'])) { 201 205 $result['expectedPickupDate'] = $times['expectedPickupDate']; 202 } else {203 // Default to today if no date specified204 $result['expectedPickupDate'] = date('Y-m-d');205 }206 207 // If no time specified, set a default208 if (!isset($result['expectedPickupTime'])) {209 $result['expectedPickupTime'] = date('H:i:s', strtotime('+1 hour'));210 }206 } else { 207 // Default to today if no date specified 208 $result['expectedPickupDate'] = wp_date( 'Y-m-d' ); 209 } 210 211 // If no time specified, set a default 212 if (!isset($result['expectedPickupTime'])) { 213 $result['expectedPickupTime'] = wp_date( 'H:i:s', time() + HOUR_IN_SECONDS ); 214 } 211 215 212 216 return $result; -
shipday-for-woocommerce/trunk/order_data/Woocommerce_Core_Shipday.php
r3365528 r3483127 1 1 <?php 2 3 if ( ! defined( 'ABSPATH' ) ) { 4 exit; 5 } 2 6 require_once dirname( __DIR__ ) . '/functions/common.php'; 3 7 8 // phpcs:disable WordPress.NamingConventions.PrefixAllGlobals.NonPrefixedClassFound -- Legacy class name retained for backwards compatibility. 4 9 class Woocommerce_Core_Shipday { 5 10 protected $order; -
shipday-for-woocommerce/trunk/payload/Core_Payload.php
r3381147 r3483127 1 1 <?php 2 3 if ( ! defined( 'ABSPATH' ) ) { 4 exit; 5 } 2 6 3 7 require_once dirname(__DIR__) . '/functions/common.php'; 4 8 9 // phpcs:disable WordPress.NamingConventions.PrefixAllGlobals.NonPrefixedClassFound -- Legacy class name retained for backwards compatibility. 5 10 class _CorePayload 6 11 { -
shipday-for-woocommerce/trunk/payload/Dokan_Payload.php
r3457794 r3483127 1 1 <?php 2 3 if ( ! defined( 'ABSPATH' ) ) { 4 exit; 5 } 2 6 3 7 require_once dirname(__DIR__) . '/functions/common.php'; -
shipday-for-woocommerce/trunk/payload/FoodStore_Payload.php
r3381147 r3483127 1 1 <?php 2 3 if ( ! defined( 'ABSPATH' ) ) { 4 exit; 5 } 2 6 3 7 require_once dirname(__DIR__) . '/functions/common.php'; … … 5 9 require_once dirname(__FILE__) . '/Core_Payload.php'; 6 10 7 11 // phpcs:disable WordPress.NamingConventions.PrefixAllGlobals.NonPrefixedClassFound -- Legacy class name retained for backwards compatibility. 8 12 class FoodStore_Payload extends _CorePayload 9 13 { -
shipday-for-woocommerce/trunk/payload/WCFM_Payload.php
r3381147 r3483127 1 1 <?php 2 3 if ( ! defined( 'ABSPATH' ) ) { 4 exit; 5 } 2 6 3 7 require_once dirname(__DIR__) . '/functions/common.php'; … … 5 9 require_once dirname(__FILE__) . '/Core_Payload.php'; 6 10 7 11 // phpcs:disable WordPress.NamingConventions.PrefixAllGlobals.NonPrefixedClassFound -- Legacy class name retained for backwards compatibility. 8 12 class WCFM_Payload extends _CorePayload 9 13 { -
shipday-for-woocommerce/trunk/payload/Woo_Payload.php
r3381147 r3483127 1 1 <?php 2 3 if ( ! defined( 'ABSPATH' ) ) { 4 exit; 5 } 2 6 3 7 require_once dirname(__DIR__) . '/functions/common.php'; … … 5 9 require_once dirname(__FILE__) . '/Core_Payload.php'; 6 10 7 11 // phpcs:disable WordPress.NamingConventions.PrefixAllGlobals.NonPrefixedClassFound -- Legacy class name retained for backwards compatibility. 8 12 class Woo_Payload extends _CorePayload 9 13 { -
shipday-for-woocommerce/trunk/readme.txt
r3467875 r3483127 1 === Local Delivery App for WordPress (WooCommerce) by Shipday===2 Contributors: shipdayinc, shhrrtnvr 3 Tags: delivery tracking, route-planning, delivery/pickup datetime, delivery dispatch, same day delivery, local pickup, local delivery,driver app1 === Shipday Local Delivery for WooCommerce === 2 Contributors: shipdayinc, shhrrtnvr, shammo, hadi 3 Tags: local delivery, delivery tracking, woocommerce delivery, same day delivery, driver app 4 4 Requires at least: 5.8 5 Tested up to: 6. 85 Tested up to: 6.9 6 6 WC requires at least: 7.0.0 7 7 WC tested up to: 9.8.2 8 8 Requires PHP: 7.4 9 Stable tag: 2. 2.09 Stable tag: 2.3.0 10 10 License: GPLv2 or later 11 12 Shipday adds local delivery and pickup workflows, dispatch sync, and checkout date/time selection to WooCommerce. 11 13 12 14 == Description == … … 116 118 * Datetime support in the order checkout 117 119 * New admin configuration page 118 119 -
shipday-for-woocommerce/trunk/rest_api/WooCommerce_REST_API.php
r3419924 r3483127 1 1 <?php 2 3 if ( ! defined( 'ABSPATH' ) ) { 4 exit; 5 } 2 6 3 7 require_once dirname(__DIR__). '/functions/common.php'; 4 8 9 // phpcs:disable WordPress.NamingConventions.PrefixAllGlobals.NonPrefixedClassFound -- Legacy class name retained for backwards compatibility. 5 10 class WooCommerce_REST_API { 6 11 … … 11 16 public static function is_consumer_secret_valid($consumer_secret) { 12 17 global $wpdb; 18 $cache_key = 'shipday_rest_api_secret_' . md5( $consumer_secret ); 19 $rest_api_key = wp_cache_get( $cache_key, 'shipday' ); 20 if ( false !== $rest_api_key ) { 21 return ! is_null( $rest_api_key ); 22 } 23 // phpcs:ignore WordPress.DB.DirectDatabaseQuery.DirectQuery,WordPress.DB.DirectDatabaseQuery.NoCaching -- WooCommerce stores API keys in a custom table; result is cached immediately below. 13 24 $rest_api_key = $wpdb->get_row( 14 25 $wpdb->prepare( … … 23 34 ARRAY_A 24 35 ); 36 wp_cache_set( $cache_key, $rest_api_key, 'shipday', MINUTE_IN_SECONDS * 5 ); 25 37 return !is_null($rest_api_key); 26 38 } … … 36 48 public static function is_consumer_keys_valid($consumer_key, $consumer_secret) { 37 49 global $wpdb; 38 $rest_api_key = $wpdb->get_row( 39 $wpdb->prepare( 40 " 50 $cache_key = 'shipday_rest_api_keys_' . md5( $consumer_secret ); 51 $rest_api_key = wp_cache_get( $cache_key, 'shipday' ); 52 if ( false === $rest_api_key ) { 53 // phpcs:ignore WordPress.DB.DirectDatabaseQuery.DirectQuery,WordPress.DB.DirectDatabaseQuery.NoCaching -- WooCommerce stores API keys in a custom table; result is cached immediately below. 54 $rest_api_key = $wpdb->get_row( 55 $wpdb->prepare( 56 " 41 57 SELECT consumer_key, consumer_secret, truncated_key, permissions 42 58 FROM {$wpdb->prefix}woocommerce_api_keys … … 44 60 and permissions = 'read_write' 45 61 ", 46 $consumer_secret 47 ), 48 ARRAY_A 49 ); 62 $consumer_secret 63 ), 64 ARRAY_A 65 ); 66 wp_cache_set( $cache_key, $rest_api_key, 'shipday', MINUTE_IN_SECONDS * 5 ); 67 } 50 68 return !is_null($rest_api_key) && self::str_ends_with($consumer_key, $rest_api_key['truncated_key']); 51 69 } … … 80 98 $url = get_rest_url(); 81 99 82 $curl = curl_init(); 83 curl_setopt_array( 84 $curl, 100 $response = shipday_remote_post( 101 get_shipday_rest_key_install_url(), 85 102 array( 86 CURLOPT_URL => get_shipday_rest_key_install_url(), 87 CURLOPT_RETURNTRANSFER => true, 88 CURLOPT_ENCODING => '', 89 CURLOPT_MAXREDIRS => 10, 90 CURLOPT_TIMEOUT => 0, 91 CURLOPT_FOLLOWLOCATION => true, 92 CURLOPT_HTTP_VERSION => CURL_HTTP_VERSION_1_1, 93 CURLOPT_CUSTOMREQUEST => 'POST', 94 CURLOPT_POSTFIELDS => '{ 95 "url": "' . $url . '", 96 "consumer_key": "' . $key . '", 97 "consumer_secret": "' . $secret . '" 98 }', 99 CURLOPT_HTTPHEADER => array( 100 'Authorization: Basic '. get_shipday_api_key(), 101 'Content-Type: application/json', 103 'headers' => array( 104 'Authorization' => 'Basic ' . get_shipday_api_key(), 105 'Content-Type' => 'application/json', 106 ), 107 'body' => wp_json_encode( 108 array( 109 'url' => $url, 110 'consumer_key' => $key, 111 'consumer_secret' => $secret, 112 ) 102 113 ), 103 114 ) 104 115 ); 105 116 106 $response = curl_exec($curl); 107 if (is_null($response)) return null; 108 $response_decoded = json_decode($response); 117 if ( empty( $response['body'] ) ) { 118 return null; 119 } 120 121 $response_decoded = json_decode( $response['body'] ); 109 122 if (!isset($response_decoded->success)) return null; 110 123 $uuid = $response_decoded->uuid; -
shipday-for-woocommerce/trunk/shipday-datetime/block-checkout/Shipday_Woo_DateTime_Util.php
r3467875 r3483127 1 1 <?php 2 3 if ( ! defined( 'ABSPATH' ) ) { 4 exit; 5 } 2 6 3 7 … … 30 34 31 35 // Other settings 32 $data['delivery_heading_checkout'] = get_option('shipday_delivery_pickup_label', __("Delivery/Pickup info", "shipday- woo-delivery"));36 $data['delivery_heading_checkout'] = get_option('shipday_delivery_pickup_label', __("Delivery/Pickup info", "shipday-for-woocommerce")); 33 37 $data['enable_delivery_option'] = get_option('shipday_enable_delivery_option', "no") === "yes"; 34 $data['delivery_option_field_label'] = __("Order Option", "shipday- woo-delivery");35 $data['delivery_options'] = ["Delivery" => __("Delivery", "shipday- woo-delivery"), "Pickup" => __("Pickup", "shipday-woo-delivery")];38 $data['delivery_option_field_label'] = __("Order Option", "shipday-for-woocommerce"); 39 $data['delivery_options'] = ["Delivery" => __("Delivery", "shipday-for-woocommerce"), "Pickup" => __("Pickup", "shipday-for-woocommerce")]; 36 40 37 41 // Delivery dates … … 39 43 $data['delivery_date_selectable_days'] = get_option('shipday_selectable_delivery_days', 30); 40 44 $data['delivery_disable_week_days'] = self::get_disable_week_days(get_option('shipday_avaialble_delivery_days', self::WEEK_DAYS)); 41 $data['delivery_date_field_label'] = __("Delivery Date", "shipday- woo-delivery");45 $data['delivery_date_field_label'] = __("Delivery Date", "shipday-for-woocommerce"); 42 46 $data['auto_select_first_date'] = true; 43 47 $data['delivery_date_mandatory'] = get_option('shipday_delivery_date_mandatory', "no") === "yes"; … … 47 51 // Delivery times 48 52 $data['enable_delivery_time'] = get_option('shipday_enable_delivery_time', "no") === "yes"; 49 $data['delivery_time_field_label'] = __("Delivery Time", "shipday- woo-delivery");53 $data['delivery_time_field_label'] = __("Delivery Time", "shipday-for-woocommerce"); 50 54 $data['delivery_time_mandatory'] = get_option('shipday_delivery_time_mandatory', "no") === "yes";; 51 55 $data['auto_select_first_time'] = false; … … 60 64 $data['pickup_date_selectable_days'] = get_option('shipday_selectable_pickup_days', 15); 61 65 $data['pickup_disable_week_days'] = self::get_disable_week_days(get_option('shipday_avaialble_pickup_days', self::WEEK_DAYS)); 62 $data['pickup_date_field_label'] = __("Pickup Date", "shipday- woo-delivery");66 $data['pickup_date_field_label'] = __("Pickup Date", "shipday-for-woocommerce"); 63 67 $data['pickup_auto_select_first_date'] = true; 64 68 $data['pickup_date_mandatory'] = get_option('shipday_pickup_date_mandatory', "no") === "yes";; … … 69 73 // Pickup times 70 74 $data['enable_pickup_time'] = get_option('shipday_enable_pickup_time', "no") === "yes"; 71 $data['pickup_time_field_label'] = __("Pickup Time", "shipday- woo-delivery");75 $data['pickup_time_field_label'] = __("Pickup Time", "shipday-for-woocommerce"); 72 76 $data['pickup_time_mandatory'] = get_option('shipday_pickup_time_mandatory', "no") === "yes"; 73 77 $data['pickup_auto_select_first_time'] = false; … … 87 91 88 92 // Localization 89 $data['checkout_delivery_option_notice'] = __("Please select order type", "shipday- woo-delivery");90 $data['checkout_date_notice'] = __("Please enter delivery date", "shipday- woo-delivery");91 $data['checkout_pickup_date_notice'] = __("Please enter pickup date", "shipday- woo-delivery");92 $data['checkout_time_notice'] = __("Please select delivery time", "shipday- woo-delivery");93 $data['checkout_pickup_time_notice'] = __("Please select pickup time", "shipday- woo-delivery");94 $data['select_order_type_text'] = __("Select order type", "shipday- woo-delivery");95 $data['select_delivery_time_text'] = __("Select delivery time", "shipday- woo-delivery");96 $data['select_pickup_time_text'] = __("Select pickup time", "shipday- woo-delivery");93 $data['checkout_delivery_option_notice'] = __("Please select order type", "shipday-for-woocommerce"); 94 $data['checkout_date_notice'] = __("Please enter delivery date", "shipday-for-woocommerce"); 95 $data['checkout_pickup_date_notice'] = __("Please enter pickup date", "shipday-for-woocommerce"); 96 $data['checkout_time_notice'] = __("Please select delivery time", "shipday-for-woocommerce"); 97 $data['checkout_pickup_time_notice'] = __("Please select pickup time", "shipday-for-woocommerce"); 98 $data['select_order_type_text'] = __("Select order type", "shipday-for-woocommerce"); 99 $data['select_delivery_time_text'] = __("Select delivery time", "shipday-for-woocommerce"); 100 $data['select_pickup_time_text'] = __("Select pickup time", "shipday-for-woocommerce"); 97 101 98 102 return $data; -
shipday-for-woocommerce/trunk/shipday-datetime/block-checkout/Shipday_Woo_Delivery_Block.php
r3420256 r3483127 1 1 <?php 2 3 if ( ! defined( 'ABSPATH' ) ) { 4 exit; 5 } 2 6 3 7 use Automattic\WooCommerce\StoreApi\Schemas\V1\CartSchema; … … 7 11 protected static $instance = null; 8 12 static $IDENTIFIER = 'shipday_woo_delivery'; 13 static $BLOCK_NAME = 'shipday-for-woocommerce/delivery-block'; 9 14 10 15 private function __clone() {} … … 38 43 39 44 function register_woo_delivery_block() { 40 register_block_type( 'shipday-woo-delivery/delivery-block');45 register_block_type( self::$BLOCK_NAME ); 41 46 } 42 47 … … 98 103 'shipday_order_type' => array( 99 104 'type' => ['string', 'null'], 100 'description' => __( 'Type of order', 'shipday- delivery' ),105 'description' => __( 'Type of order', 'shipday-for-woocommerce' ), 101 106 'enum' => array_merge( array_keys( $settings['delivery_options'] ), ["", null] ), 102 107 ), 103 108 'shipday_delivery_date' => array( 104 109 'type' => ['string', 'null'], 105 'description' => __( 'Delivery Date', 'shipday- delivery' ),110 'description' => __( 'Delivery Date', 'shipday-for-woocommerce' ), 106 111 ), 107 112 'shipday_delivery_time' => array( 108 113 'type' => ['string', 'null'], 109 'description' => __( 'Delivery Time', 'shipday- delivery' ),114 'description' => __( 'Delivery Time', 'shipday-for-woocommerce' ), 110 115 ), 111 116 'shipday_pickup_date' => array( 112 117 'type' => ['string', 'null'], 113 'description' => __( 'Pickup Date', 'shipday- delivery' ),118 'description' => __( 'Pickup Date', 'shipday-for-woocommerce' ), 114 119 ), 115 120 'pickup_time' => array( 116 121 'type' => ['string', 'null'], 117 'description' => __( 'Pickup Time', 'shipday- delivery' ),122 'description' => __( 'Pickup Time', 'shipday-for-woocommerce' ), 118 123 ), 119 124 ); -
shipday-for-woocommerce/trunk/shipday-datetime/block-checkout/Shipday_Woo_Delivery_Block_Integration.php
r3457794 r3483127 1 1 <?php 2 3 if ( ! defined( 'ABSPATH' ) ) { 4 exit; 5 } 2 6 3 7 use Automattic\WooCommerce\Blocks\Integrations\IntegrationInterface; … … 65 69 wp_register_script( $this->get_name(), plugin_dir_url( __FILE__ ) . 'assets/js/frontend.js', array( 'wp-plugins', 'wp-element', 'wp-components', 'wp-hooks', 'wp-i18n', 'wc-blocks-checkout', 'flatpickr_js' ), "2.0.1", true ); 66 70 67 wp_enqueue_style( $this->get_name(), plugin_dir_url( __FILE__ ) . 'assets/css/frontend.css', "2.1.4" );71 wp_enqueue_style( $this->get_name(), plugin_dir_url( __FILE__ ) . 'assets/css/frontend.css', array(), "2.1.4" ); 68 72 } 69 73 -
shipday-for-woocommerce/trunk/shipday-datetime/block-checkout/Shipday_Woo_Delivery_Block_Storage.php
r3420256 r3483127 1 1 <?php 2 3 if ( ! defined( 'ABSPATH' ) ) { 4 exit; 5 } 2 6 3 7 class Shipday_Woo_Delivery_Block_Storage { … … 36 40 if ( $errors->has_errors() ) { 37 41 $error_messages = $errors->get_error_messages(); 38 $combined_error_message = implode( "<br>", $error_messages ); 39 throw new \WC_Data_Exception( 'SHIPDAY_WOO_ERROR', $combined_error_message ); 42 throw new \WC_Data_Exception( 43 'SHIPDAY_WOO_ERROR', 44 esc_html( implode( ' ', array_map( 'sanitize_text_field', $error_messages ) ) ) 45 ); 40 46 } 41 47 -
shipday-for-woocommerce/trunk/shipday-datetime/block-checkout/assets/js/frontend.js
r3457794 r3483127 50 50 const validateField = (value, fieldType) => { 51 51 let errorKey = "shipday_woo_" + fieldType + "_error"; 52 let errorMessage = __('This field is mandatory', 'shipday- woo-delivery' );52 let errorMessage = __('This field is mandatory', 'shipday-for-woocommerce' ); 53 53 let isRequired = false; 54 54 55 55 // Determine error message and required status based on field type 56 56 if (fieldType === "shipday_order_type") { 57 errorMessage = __( 'Order type is required', 'shipday- woo-delivery' );57 errorMessage = __( 'Order type is required', 'shipday-for-woocommerce' ); 58 58 isRequired = shipdaySettings.enable_delivery_option; 59 59 errorKey = "shipday_woo_order_type_error"; 60 60 } else if (fieldType === "shipday_delivery_date") { 61 errorMessage = __( 'Delivery date is required', 'shipday- woo-delivery' );61 errorMessage = __( 'Delivery date is required', 'shipday-for-woocommerce' ); 62 62 errorKey = "shipday_woo_delivery_date_error"; 63 63 isRequired = shipdaySettings.enable_delivery_date && shipdaySettings.delivery_date_mandatory; 64 64 } else if (fieldType === "shipday_delivery_time") { 65 errorMessage = __('Delivery time is mandatory', 'shipday- woo-delivery' );65 errorMessage = __('Delivery time is mandatory', 'shipday-for-woocommerce' ); 66 66 errorKey = "shipday_woo_delivery_time_error"; 67 67 isRequired = shipdaySettings.enable_delivery_time && shipdaySettings.delivery_time_mandatory; 68 68 } else if (fieldType === "shipday_pickup_date") { 69 errorMessage = __('Pickup date is mandatory', 'shipday- woo-delivery' );69 errorMessage = __('Pickup date is mandatory', 'shipday-for-woocommerce' ); 70 70 isRequired = shipdaySettings.enable_pickup_date && shipdaySettings.pickup_date_mandatory; 71 71 }else if (fieldType === "pickup_time") { 72 errorMessage = __('Pickup time is mandatory', 'shipday- woo-delivery' );72 errorMessage = __('Pickup time is mandatory', 'shipday-for-woocommerce' ); 73 73 isRequired = shipdaySettings.enable_pickup_time && shipdaySettings.pickup_time_mandatory; 74 74 } … … 682 682 }); 683 683 684 let fieldLabel = __('Pickup time', 'shipday- woo-delivery');684 let fieldLabel = __('Pickup time', 'shipday-for-woocommerce'); 685 685 686 686 // Generate options for the select dropdown … … 726 726 React.createElement("option", { 727 727 value: "" 728 }, __('Select pickup slot', 'shipday- woo-delivery')),728 }, __('Select pickup slot', 'shipday-for-woocommerce')), 729 729 730 730 // Time options … … 891 891 shipday_woo_delivery_metadata = { 892 892 apiVersion: 3, 893 name: "shipday- woo-delivery",893 name: "shipday-for-woocommerce/delivery-block", 894 894 title: "Shipday Woocommerce", 895 895 category: "woocommerce", -
shipday-for-woocommerce/trunk/shipday-datetime/classic-checkout/Classic_Datetime.php
r3467875 r3483127 1 1 <?php 2 3 if ( ! defined( 'ABSPATH' ) ) { 4 exit; 5 } 2 6 /** 3 7 * Plugin Name: Shipday Datetime … … 11 15 require_once dirname(__FILE__) . '../../block-checkout/Shipday_Woo_DateTime_Util.php'; 12 16 17 // phpcs:disable WordPress.NamingConventions.PrefixAllGlobals.NonPrefixedClassFound -- Legacy class name retained for backwards compatibility. 13 18 class Classic_Datetime { 14 19 … … 55 60 // Delivery dates 56 61 $enable_delivery_date = get_option('shipday_enable_delivery_date', "no") === "yes"; 57 $delivery_date_field_label = __('Delivery Date', 'shipday- woo-delivery' );62 $delivery_date_field_label = __('Delivery Date', 'shipday-for-woocommerce' ); 58 63 $delivery_date_mandatory = get_option('shipday_delivery_date_mandatory', "no") === "yes"; 59 64 $delivery_date_selectable_days = get_option('shipday_selectable_delivery_days', 30); … … 64 69 // Pickup dates 65 70 $enable_pickup_date = get_option('shipday_enable_pickup_date', "no") === "yes"; 66 $pickup_date_field_label = __('Pickup Date', 'shipday- woo-delivery' );71 $pickup_date_field_label = __('Pickup Date', 'shipday-for-woocommerce' ); 67 72 $pickup_date_mandatory = get_option('shipday_pickup_date_mandatory', "no") === "yes"; 68 73 … … 71 76 $pickup_auto_select_first_date = true; 72 77 73 echo "<div data-today_date='" . $today . "' id='shipday_woo_delivery_setting_wrapper'>";74 75 $order_type_label = get_option('shipday_delivery_pickup_label', __('Delivery/Pickup info', 'shipday- woo-delivery'));78 echo '<div data-today_date="' . esc_attr( $today ) . '" id="shipday_woo_delivery_setting_wrapper">'; 79 80 $order_type_label = get_option('shipday_delivery_pickup_label', __('Delivery/Pickup info', 'shipday-for-woocommerce')); 76 81 77 82 // delivery options … … 85 90 ], 86 91 'label' => $order_type_label, 87 'placeholder' => __('Choose Option', 'shipday- woo-delivery'),92 'placeholder' => __('Choose Option', 'shipday-for-woocommerce'), 88 93 'options' => Classic_Datetime::getDeliveryoptions(), 89 94 'required' => true, … … 103 108 'id' => "shipday_delivery_date_datepicker", 104 109 'label' => $delivery_date_field_label, 105 'placeholder' => __('Choose Date', 'shipday- woo-delivery'),110 'placeholder' => __('Choose Date', 'shipday-for-woocommerce'), 106 111 'required' => $delivery_date_mandatory, 107 112 'custom_attributes' => [ … … 118 123 // Delivery Time -------------------------------------------------------------- 119 124 $enable_delivery_time = get_option('shipday_enable_delivery_time', "no") === "yes"; 120 $delivery_time_field_label = __('Delivery Time', 'shipday- woo-delivery');125 $delivery_time_field_label = __('Delivery Time', 'shipday-for-woocommerce'); 121 126 $delivery_time_mandatory = get_option('shipday_delivery_time_mandatory', "no") === "yes"; 122 127 $auto_select_first_time = false; … … 172 177 // Pickup Time -------------------------------------------------------------- 173 178 $enable_pickup_time = get_option('shipday_enable_pickup_time', "no") === "yes"; 174 $pickup_time_field_label = __('Pickup time', 'shipday- woo-delivery');179 $pickup_time_field_label = __('Pickup time', 'shipday-for-woocommerce'); 175 180 $pickup_time_mandatory = get_option('shipday_pickup_time_mandatory', "no") === "yes"; 176 181 $start_pickup_slot = get_option('shipday_pickup_time_slot_start', Shipday_Woo_DateTime_Util::DEFAULT_START_SLOT); … … 204 209 } 205 210 211 private static function has_valid_checkout_nonce() { 212 // phpcs:ignore WordPress.Security.NonceVerification.Missing -- This helper performs the checkout nonce validation itself. 213 if ( ! isset( $_POST['woocommerce-process-checkout-nonce'] ) ) { 214 return false; 215 } 216 217 // phpcs:ignore WordPress.Security.NonceVerification.Missing -- Nonce is being verified in this helper. 218 $nonce = sanitize_text_field( wp_unslash( $_POST['woocommerce-process-checkout-nonce'] ) ); 219 220 return (bool) wp_verify_nonce( $nonce, 'woocommerce-process_checkout' ); 221 } 222 223 private static function get_checkout_post_value( $key ) { 224 // phpcs:ignore WordPress.Security.NonceVerification.Missing -- Callers gate access with self::has_valid_checkout_nonce(). 225 if ( ! isset( $_POST[ $key ] ) ) { 226 return ''; 227 } 228 229 // phpcs:ignore WordPress.Security.NonceVerification.Missing -- Callers gate access with self::has_valid_checkout_nonce(). 230 return sanitize_text_field( wp_unslash( $_POST[ $key ] ) ); 231 } 232 206 233 public static function validate_before_save() { 207 234 /* 208 235 if ( self::is_required() && empty( $_POST['shipday_delivery_datetime'] ) ) { 209 wc_add_notice( __( 'Please choose your preferred delivery date & time.', 'shipday- datetime' ), 'error' );236 wc_add_notice( __( 'Please choose your preferred delivery date & time.', 'shipday-for-woocommerce' ), 'error' ); 210 237 } 211 238 */ … … 221 248 $enable_pickup_time = get_option('shipday_enable_pickup_time', "no") === "yes"; 222 249 $pickup_time_mandatory = get_option('shipday_pickup_time_mandatory', "no") === "yes"; 250 if ( ! self::has_valid_checkout_nonce() ) { 251 return; 252 } 253 254 $order_type = self::get_checkout_post_value( 'shipday_order_type_field' ); 255 $delivery_date = self::get_checkout_post_value( 'shipday_delivery_date_field' ); 256 $pickup_date = self::get_checkout_post_value( 'shipday_pickup_date_field' ); 257 $pickup_time = self::get_checkout_post_value( 'shipday_pickup_time_field' ); 258 $delivery_time = self::get_checkout_post_value( 'shipday_delivery_time_field' ); 223 259 224 260 225 261 226 262 if ( $enable_datetime_plugin && $enable_delivery_option ) { 227 if ( !isset( $_POST['shipday_order_type_field'] ) || $_POST['shipday_order_type_field'] === "" || $_POST['shipday_order_type_field'] === "Choose Option") {228 wc_add_notice( __( "Please select order type", "shipday- woo-delivery" ), 'error' );263 if ( '' === $order_type || 'Choose Option' === $order_type ) { 264 wc_add_notice( __( "Please select order type", "shipday-for-woocommerce" ), 'error' ); 229 265 } 230 266 231 267 } 232 268 if ( $enable_datetime_plugin && $enable_delivery_date && $delivery_date_mandatory && 233 (!$enable_delivery_option || $_POST['shipday_order_type_field'] === "Delivery")269 (!$enable_delivery_option || 'Delivery' === $order_type) 234 270 ) { 235 271 236 if ( !isset($_POST['shipday_delivery_date_field']) || $_POST['shipday_delivery_date_field'] === "") {237 wc_add_notice( __( "Please enter delivery date", "shipday- woo-delivery" ), 'error' );272 if ( '' === $delivery_date ) { 273 wc_add_notice( __( "Please enter delivery date", "shipday-for-woocommerce" ), 'error' ); 238 274 } 239 275 240 276 } 241 277 if ( $enable_datetime_plugin && $enable_pickup_date && $pickup_date_mandatory && 242 (!$enable_delivery_option || $_POST['shipday_order_type_field'] === "Pickup")278 (!$enable_delivery_option || 'Pickup' === $order_type) 243 279 ) { 244 if ( !isset($_POST['shipday_pickup_date_field']) || $_POST['shipday_pickup_date_field'] === "" || $_POST['shipday_pickup_date_field'] ==="Pickup Date") {245 wc_add_notice( __( "Please enter pickup date", "shipday- woo-delivery" ), 'error' );280 if ( '' === $pickup_date || 'Pickup Date' === $pickup_date ) { 281 wc_add_notice( __( "Please enter pickup date", "shipday-for-woocommerce" ), 'error' ); 246 282 } 247 283 248 284 } 249 285 if ( $enable_datetime_plugin && $enable_pickup_time && $pickup_time_mandatory && 250 (!$enable_delivery_option || $_POST['shipday_order_type_field'] === "Pickup")286 (!$enable_delivery_option || 'Pickup' === $order_type) 251 287 ) { 252 288 253 if ( !isset($_POST['shipday_pickup_time_field']) || is_null($_POST['shipday_pickup_time_field']) || $_POST['shipday_pickup_time_field'] === "") {254 wc_add_notice( __( "Please select pickup time", "shipday- woo-delivery" ), 'error' );289 if ( '' === $pickup_time ) { 290 wc_add_notice( __( "Please select pickup time", "shipday-for-woocommerce" ), 'error' ); 255 291 } 256 292 257 293 } 258 294 if ( $enable_datetime_plugin && $enable_delivery_time && $delivery_time_mandatory && 259 (!$enable_delivery_option || $_POST['shipday_order_type_field'] === "Delivery")295 (!$enable_delivery_option || 'Delivery' === $order_type) 260 296 ) { 261 if ( !isset($_POST['shipday_delivery_time_field']) || is_null($_POST['shipday_delivery_time_field']) || $_POST['shipday_delivery_time_field'] === "") {262 wc_add_notice( __( "Please select delivery time", "shipday- woo-delivery" ), 'error' );297 if ( '' === $delivery_time ) { 298 wc_add_notice( __( "Please select delivery time", "shipday-for-woocommerce" ), 'error' ); 263 299 } 264 300 … … 270 306 271 307 public static function getDeliveryoptions() { 272 $delivery_option['Delivery'] = __( "Delivery", "shipday- woo-delivery" );273 $delivery_option['Pickup'] = __( "Pickup", "shipday- woo-delivery" );308 $delivery_option['Delivery'] = __( "Delivery", "shipday-for-woocommerce" ); 309 $delivery_option['Pickup'] = __( "Pickup", "shipday-for-woocommerce" ); 274 310 return $delivery_option; 275 311 } … … 277 313 public static function classic_save( $order_id) { 278 314 if ( ! function_exists('is_checkout') || ! is_checkout() ) return; 315 if ( ! self::has_valid_checkout_nonce() ) { 316 return; 317 } 279 318 $order = wc_get_order( $order_id ); 280 319 … … 286 325 $enable_pickup_time = get_option('shipday_enable_pickup_time', "no") === "yes"; 287 326 288 $order_type = s anitize_text_field( wp_unslash( $_POST['shipday_order_type_field'] ));289 if ( $enable_datetime_plugin && $enable_order_type && isset( $_POST['shipday_order_type_field'] )) {327 $order_type = self::get_checkout_post_value( 'shipday_order_type_field' ); 328 if ( $enable_datetime_plugin && $enable_order_type && '' !== $order_type ) { 290 329 if ( $order_type !== '' ) { 291 330 if ( self::$hpos === true ) { … … 296 335 } 297 336 } 298 if ( $enable_datetime_plugin && (!$enable_order_type || $order_type==='Delivery') && $enable_delivery_date && isset( $_POST['shipday_delivery_date_field'] )) {299 $val = s anitize_text_field( wp_unslash( $_POST['shipday_delivery_date_field'] ));337 if ( $enable_datetime_plugin && (!$enable_order_type || $order_type==='Delivery') && $enable_delivery_date ) { 338 $val = self::get_checkout_post_value( 'shipday_delivery_date_field' ); 300 339 shipday_logger('error', 'datetime : '.$val); 301 340 if ( $val !== '' ) { … … 307 346 } 308 347 } 309 if ( $enable_datetime_plugin && (!$enable_order_type || $order_type==='Delivery') && $enable_delivery_time && isset( $_POST['shipday_delivery_time_field'] )) {310 $val_time = s anitize_text_field( $_POST['shipday_delivery_time_field']);348 if ( $enable_datetime_plugin && (!$enable_order_type || $order_type==='Delivery') && $enable_delivery_time ) { 349 $val_time = self::get_checkout_post_value( 'shipday_delivery_time_field' ); 311 350 if ( $val_time !== '' ) { 312 351 if ( self::$hpos === true ) { … … 318 357 } 319 358 320 if ( $enable_datetime_plugin && (!$enable_order_type || $order_type==='Pickup') && $enable_pickup_date && isset( $_POST['shipday_pickup_date_field'] )) {321 $val = s anitize_text_field( wp_unslash( $_POST['shipday_pickup_date_field'] ));359 if ( $enable_datetime_plugin && (!$enable_order_type || $order_type==='Pickup') && $enable_pickup_date ) { 360 $val = self::get_checkout_post_value( 'shipday_pickup_date_field' ); 322 361 shipday_logger('error', 'datetime : '.$val); 323 362 if ( $val !== '' ) { … … 330 369 } 331 370 332 if ( $enable_datetime_plugin && (!$enable_order_type || $order_type==='Pickup') && $enable_pickup_time && isset( $_POST['shipday_pickup_time_field'] )) {333 $val_time = s anitize_text_field( $_POST['shipday_pickup_time_field']);371 if ( $enable_datetime_plugin && (!$enable_order_type || $order_type==='Pickup') && $enable_pickup_time ) { 372 $val_time = self::get_checkout_post_value( 'shipday_pickup_time_field' ); 334 373 if ( $val_time !== '' ) { 335 374 if ( self::$hpos === true ) { … … 359 398 360 399 if ( self::$hpos === true ) { 361 $delivery_date = date($delivery_date_format, strtotime($order->get_meta( '_shipday_delivery_date', true )));400 $delivery_date = wp_date( $delivery_date_format, strtotime($order->get_meta( '_shipday_delivery_date', true )) ); 362 401 } else { 363 $delivery_date = date($delivery_date_format, strtotime(get_post_meta( $order_id, '_shipday_delivery_date', true )));364 } 365 366 echo '<p><strong>' .__($delivery_date_field_label, "shipday-woo-delivery").':</strong> ' . $delivery_date. '</p>';402 $delivery_date = wp_date( $delivery_date_format, strtotime(get_post_meta( $order_id, '_shipday_delivery_date', true )) ); 403 } 404 405 echo '<p><strong>' . esc_html__( 'Scheduled Date', 'shipday-for-woocommerce' ) . ':</strong> ' . esc_html( $delivery_date ) . '</p>'; 367 406 368 407 } … … 374 413 $time_slot = get_post_meta( $order_id, '_shipday_delivery_time', true ); 375 414 } 376 echo '<p><strong>' .__($delivery_time_field_label, "shipday-woo-delivery").':</strong> ' .$time_slot. '</p>';415 echo '<p><strong>' . esc_html__( 'Time slot', 'shipday-for-woocommerce' ) . ':</strong> ' . esc_html( $time_slot ) . '</p>'; 377 416 } 378 417 } … … 454 493 455 494 } 456 457 -
shipday-for-woocommerce/trunk/shipday_order_management/Shipday_Order_Management.php
r3419924 r3483127 1 1 <?php 2 3 if ( ! defined( 'ABSPATH' ) ) { 4 exit; 5 } 2 6 3 7 require_once dirname(__DIR__). '/functions/logger.php'; -
shipday-for-woocommerce/trunk/shipday_order_management/Woo_Sync_Order.php
r2685513 r3483127 1 1 <?php 2 3 if ( ! defined( 'ABSPATH' ) ) { 4 exit; 5 } 2 6 3 7 require_once dirname(__DIR__). '/functions/common.php'; 4 8 require_once dirname(__FILE__). '/Shipday_Order_Management.php'; 5 9 10 // phpcs:disable WordPress.NamingConventions.PrefixAllGlobals.NonPrefixedClassFound -- Legacy class name retained for backwards compatibility. 6 11 class Woo_Sync_Order 7 12 { … … 20 25 } 21 26 22 public static function get_processing_orders_from_db() {23 global $wpdb;24 $orders = $wpdb->get_results(25 "SELECT order_id FROM {$wpdb->prefix}wc_order_stats ".26 "WHERE status='wc-processing'"27 );28 $ids = [];29 foreach ($orders as $order) {30 $ids[] = intval($order->order_id);31 }32 return $ids;33 }34 35 27 public static function sync(){ 36 $orders = self::get_processing_orders _from_db();28 $orders = self::get_processing_orders(); 37 29 foreach ( $orders as $order_id) { 38 30 Shipday_Order_Management::process_and_send($order_id); -
shipday-for-woocommerce/trunk/views/Dokan_vendor_settings_shipday.php
r3419924 r3483127 1 1 <?php 2 3 if ( ! defined( 'ABSPATH' ) ) { 4 exit; 5 } 2 6 require_once dirname(__DIR__). '/functions/logger.php'; 3 7 … … 13 17 public static function save_api_key() { 14 18 // Only handle POST requests 15 if ( $_SERVER['REQUEST_METHOD'] !== 'POST' ) { 19 if ( 20 ! isset( $_SERVER['REQUEST_METHOD'] ) 21 || 'POST' !== strtoupper( sanitize_text_field( wp_unslash( $_SERVER['REQUEST_METHOD'] ) ) ) 22 ) { 16 23 return; 17 24 } … … 22 29 } 23 30 24 $post_data = wp_unslash($_POST); 25 if (!is_null($post_data) && !is_null($post_data['shipday_api_key']) && !empty(trim($post_data['shipday_api_key']))) 26 update_user_meta(wp_get_current_user()->ID, 'shipday_api_key', trim($post_data['shipday_api_key'])); 31 if ( 32 ! isset( $_POST['_wpnonce'] ) 33 || ! wp_verify_nonce( sanitize_text_field( wp_unslash( $_POST['_wpnonce'] ) ), 'dokan_delivery_settings_nonce' ) 34 ) { 35 return; 36 } 37 38 if ( ! isset( $_POST['shipday_api_key'] ) ) { 39 return; 40 } 41 42 $api_key = sanitize_text_field( wp_unslash( $_POST['shipday_api_key'] ) ); 43 if ( '' !== $api_key ) { 44 update_user_meta( wp_get_current_user()->ID, 'shipday_api_key', $api_key ); 45 } 27 46 } 28 47 … … 39 58 public static function dokan_add_help_menu( $urls ) { 40 59 $urls['delivery'] = array( 41 'title' => __( 'Delivery', 'shipday '),60 'title' => __( 'Delivery', 'shipday-for-woocommerce'), 42 61 'icon' => '<i class="fas fa-truck"></i>', 43 62 'url' => dokan_get_navigation_url( 'delivery' ), … … 68 87 69 88 <div class="dokan-form-group"> 70 <label class="dokan-w3 dokan-control-label" for="shipday_api_key"><?php esc_html_e( 'Shipday API key', 'shipday ' ); ?></label>89 <label class="dokan-w3 dokan-control-label" for="shipday_api_key"><?php esc_html_e( 'Shipday API key', 'shipday-for-woocommerce' ); ?></label> 71 90 72 91 <div class="dokan-w5 dokan-text-left"> 73 <input id="shipday_api_key" required value="<?php echo esc_attr(self::get_api_key()); ?>" name="shipday_api_key" placeholder="<?php esc_attr_e( 'Enter shipday api key', 'shipday ' ); ?>" class="dokan-form-control" type="text">92 <input id="shipday_api_key" required value="<?php echo esc_attr(self::get_api_key()); ?>" name="shipday_api_key" placeholder="<?php esc_attr_e( 'Enter shipday api key', 'shipday-for-woocommerce' ); ?>" class="dokan-form-control" type="text"> 74 93 </div> 75 94 </div> … … 78 97 79 98 <div class="dokan-w4 ajax_prev dokan-text-left" style="margin-left:24%;"> 80 <input type="submit" name="shipday_vendor_settings" class="dokan-btn dokan-btn-danger dokan-btn-theme" value="<?php esc_attr_e( 'Update Settings', ' dokan-lite' ); ?>">99 <input type="submit" name="shipday_vendor_settings" class="dokan-btn dokan-btn-danger dokan-btn-theme" value="<?php esc_attr_e( 'Update Settings', 'shipday-for-woocommerce' ); ?>"> 81 100 </div> 82 101 </div> -
shipday-for-woocommerce/trunk/views/Notices.php
r3419924 r3483127 1 1 <?php 2 3 if ( ! defined( 'ABSPATH' ) ) { 4 exit; 5 } 2 6 3 7 require_once dirname(__DIR__). '/functions/common.php'; 4 8 5 9 // phpcs:disable WordPress.NamingConventions.PrefixAllGlobals.NonPrefixedClassFound -- Legacy class name retained for backwards compatibility. 6 10 class Notices { 7 11 public static function init() { … … 17 21 ?> 18 22 <div class='notice notice-warning is-dismissible'> 19 <p>Your Shipday API Key Field is blank. To set up API Key, <a href="<?php echo $shipday_tab_url; ?>" target="_top">Click23 <p>Your Shipday API Key Field is blank. To set up API Key, <a href="<?php echo esc_url( $shipday_tab_url ); ?>" target="_top">Click 20 24 Here</a>.</p> 21 25 </div> … … 40 44 <div class='notice notice-warning is-dismissible'> 41 45 <p>REST API key is essential for order status update in WooCommerce dashboard. To add REST API Key, 42 <a href="<?php echo $rest_api_section_url; ?>" style="color: red">Click here</a> and take note of consumer key and consumer secret.43 Then enter the keys in shipday settings tab <a href="<?php echo $shipday_tab_url; ?>"> here</a>.</p>46 <a href="<?php echo esc_url( $rest_api_section_url ); ?>" style="color: red">Click here</a> and take note of consumer key and consumer secret. 47 Then enter the keys in shipday settings tab <a href="<?php echo esc_url( $shipday_tab_url ); ?>"> here</a>.</p> 44 48 </div> 45 49 <?php … … 55 59 ?> 56 60 <div class='notice notice-warning is-dismissible'> 57 <p>You have set <?php echo $consumer_secret.'.'.$consumer_key; ?>.</p>61 <p>You have set <?php echo esc_html( $consumer_secret . '.' . $consumer_key ); ?>.</p> 58 62 </div> 59 63 <?php -
shipday-for-woocommerce/trunk/views/WCFM_vendor_settings_shipday.php
r2592964 r3483127 1 1 <?php 2 2 3 if ( ! defined( 'ABSPATH' ) ) { 4 exit; 5 } 6 7 // phpcs:disable WordPress.NamingConventions.PrefixAllGlobals.NonPrefixedClassFound -- Legacy class name retained for backwards compatibility. 3 8 class WCFM_vendor_settings_shipday { 4 9 public static function init() { … … 15 20 16 21 global $WCFM; 22 // phpcs:ignore WordPress.NamingConventions.PrefixAllGlobals.NonPrefixedHooknameFound -- This is an external WCFM hook name. 17 23 $user_id = apply_filters( 'wcfm_current_vendor_id', get_current_user_id() ); 18 24 $vendor_data = get_user_meta( $user_id, 'wcfmmp_profile_settings', true ); … … 20 26 $api_key = isset( $vendor_data['shipday']['api_key'] ) ? $vendor_data['shipday']['api_key'] : ''; 21 27 $fields = array( 22 "api_key" => array("label" => __('Shipday API Key', ' wcfm-settings-tab-shipday'),28 "api_key" => array("label" => __('Shipday API Key', 'shipday-for-woocommerce'), 23 29 "name" => "shipday[api_key]", 24 30 "type" => "text", -
shipday-for-woocommerce/trunk/views/WC_Settings_Tab_Shipday_menus.php
r3381147 r3483127 1 1 <?php 2 3 if ( ! defined( 'ABSPATH' ) ) { 4 exit; 5 } 6 // phpcs:disable WordPress.NamingConventions.PrefixAllGlobals.NonPrefixedFunctionFound,WordPress.NamingConventions.PrefixAllGlobals.NonPrefixedHooknameFound -- Legacy settings/filter API is retained for backwards compatibility. 2 7 3 8 function get_woocommerce_settings() … … 5 10 $settings = array( 6 11 array( 7 'name' => __('General Settings', ' woocommerce-settings-tab-shipday'),12 'name' => __('General Settings', 'shipday-for-woocommerce'), 8 13 'type' => 'title', 9 14 'desc' => '', … … 11 16 ), 12 17 array( 13 'name' => __('Shipday API Key', ' woocommerce-settings-tab-shipday'),18 'name' => __('Shipday API Key', 'shipday-for-woocommerce'), 14 19 'type' => 'text', 15 20 'desc' => 'To get API Key, Login to your Shipday account and go to My Account > Profile > Api key', … … 22 27 ), 23 28 array( 24 'name' => __('REST API Settings', ' woocommerce-settings-tab-shipday'),29 'name' => __('REST API Settings', 'shipday-for-woocommerce'), 25 30 'type' => 'title', 26 31 'desc' => 'To get REST API Keys, go to WooCommerce > Settings > Advanced > API Key. Then generate a new API key with any description, '. … … 29 34 ), 30 35 array( 31 'name' => __('Consumer Key', ' woocommerce-settings-tab-shipday'),36 'name' => __('Consumer Key', 'shipday-for-woocommerce'), 32 37 'type' => 'text', 33 38 // 'value' => "", … … 35 40 ), 36 41 array( 37 'name' => __('Consumer Secret', ' woocommerce-settings-tab-shipday'),42 'name' => __('Consumer Secret', 'shipday-for-woocommerce'), 38 43 'type' => 'text', 39 44 // 'value' => "", … … 49 54 ), 50 55 array( 51 'name' => __('Orders Settings', ' woocommerce-settings-tab-shipday'),56 'name' => __('Orders Settings', 'shipday-for-woocommerce'), 52 57 'type' => 'title', 53 58 'desc' => '', … … 55 60 ), 56 61 array( 57 'title' => __( 'Sync previous orders', ' woocommerce-settings-tab-shipday' ),58 'label' => __( 'Sync previous orders', ' woocommerce-settings-tab-shipday'),62 'title' => __( 'Sync previous orders', 'shipday-for-woocommerce' ), 63 'label' => __( 'Sync previous orders', 'shipday-for-woocommerce'), 59 64 'type' => 'checkbox', 60 65 'description' => '', … … 63 68 ), 64 69 array( 65 'title' => __( 'Enable pickup orders', ' woocommerce-settings-tab-shipday' ),66 'label' => __( 'Enable pickup orders', ' woocommerce-settings-tab-shipday'),70 'title' => __( 'Enable pickup orders', 'shipday-for-woocommerce' ), 71 'label' => __( 'Enable pickup orders', 'shipday-for-woocommerce'), 67 72 'type' => 'checkbox', 68 73 'description' => 'Allow orders with local pickup shipping method to be sent to Shipday', … … 72 77 73 78 array( 74 'title' => __( 'Enable new Shipday webhook', ' woocommerce-settings-tab-shipday' ),75 'label' => __( 'Enable new Shipday webhook', ' woocommerce-settings-tab-shipday'),79 'title' => __( 'Enable new Shipday webhook', 'shipday-for-woocommerce' ), 80 'label' => __( 'Enable new Shipday webhook', 'shipday-for-woocommerce'), 76 81 'type' => 'checkbox', 77 82 'description' => 'Enable this to send your orders to new Shipday Webhook', … … 94 99 $settings = array( 95 100 array( 96 'name' => __('General Settings', ' woocommerce-settings-tab-shipday'),101 'name' => __('General Settings', 'shipday-for-woocommerce'), 97 102 'type' => 'title', 98 103 'desc' => '', … … 100 105 ), 101 106 array( 102 'name' => __('Order Management Settings for Dokan Multi-vendor', ' woocommerce-settings-tab-shipday'),107 'name' => __('Order Management Settings for Dokan Multi-vendor', 'shipday-for-woocommerce'), 103 108 'type' => 'radio', 104 109 'std' => 'admin_manage', 105 110 'default' => 'admin_manage', 106 111 'options' => array( 107 'admin_manage' => __('Dokan Admin account manages deliveries for all vendors' ),108 'vendor_manage' => __('Vendors manage their orders in Shipday' ),112 'admin_manage' => __('Dokan Admin account manages deliveries for all vendors', 'shipday-for-woocommerce'), 113 'vendor_manage' => __('Vendors manage their orders in Shipday', 'shipday-for-woocommerce'), 109 114 ), 110 115 'id' => 'wc_settings_tab_shipday_order_manage', 111 116 ), 112 117 array( 113 'name' => __('Shipday API Key of Admin\'s Account', ' woocommerce-settings-tab-shipday'),118 'name' => __('Shipday API Key of Admin\'s Account', 'shipday-for-woocommerce'), 114 119 'type' => 'text', 115 120 'desc' => 'To get API Key, Login to your Shipday account and go to My Account > Profile > Api key', … … 117 122 ), 118 123 array( 119 'title' => __( 'Enable pickup orders', ' woocommerce-settings-tab-shipday' ),120 'label' => __( 'Enable pickup orders', ' woocommerce-settings-tab-shipday'),124 'title' => __( 'Enable pickup orders', 'shipday-for-woocommerce' ), 125 'label' => __( 'Enable pickup orders', 'shipday-for-woocommerce'), 121 126 'type' => 'checkbox', 122 127 'description' => 'Allow orders with local pickup shipping method to be sent to Shipday', … … 125 130 ), 126 131 array( 127 'title' => __( 'Enable new Shipday webhook', ' woocommerce-settings-tab-shipday' ),128 'label' => __( 'Enable new Shipday webhook', ' woocommerce-settings-tab-shipday'),132 'title' => __( 'Enable new Shipday webhook', 'shipday-for-woocommerce' ), 133 'label' => __( 'Enable new Shipday webhook', 'shipday-for-woocommerce'), 129 134 'type' => 'checkbox', 130 135 'description' => 'Enable this to send your orders to new Shipday Webhook', … … 146 151 $settings = array( 147 152 array( 148 'name' => __('General Settings', ' woocommerce-settings-tab-shipday'),153 'name' => __('General Settings', 'shipday-for-woocommerce'), 149 154 'type' => 'title', 150 155 'desc' => '', … … 152 157 ), 153 158 array( 154 'name' => __('Order Management Settings for WCFM Multi-vendor', ' woocommerce-settings-tab-shipday'),159 'name' => __('Order Management Settings for WCFM Multi-vendor', 'shipday-for-woocommerce'), 155 160 'type' => 'radio', 156 161 'std' => 'admin_manage', 157 162 'default' => 'admin_manage', 158 163 'options' => array( 159 'admin_manage' => __('WCFM Admin account manages deliveries for all vendors' ),160 'vendor_manage' => __('Vendors manage their orders in Shipday' ),164 'admin_manage' => __('WCFM Admin account manages deliveries for all vendors', 'shipday-for-woocommerce'), 165 'vendor_manage' => __('Vendors manage their orders in Shipday', 'shipday-for-woocommerce'), 161 166 ), 162 167 'id' => 'wc_settings_tab_shipday_order_manage', 163 168 ), 164 169 array( 165 'name' => __('Shipday API Key of Admin\'s Account', ' woocommerce-settings-tab-shipday'),170 'name' => __('Shipday API Key of Admin\'s Account', 'shipday-for-woocommerce'), 166 171 'type' => 'text', 167 172 'desc' => 'To get API Key, Login to your Shipday account and go to My Account > Profile > Api key', … … 169 174 ), 170 175 array( 171 'title' => __( 'Enable pickup orders', ' woocommerce-settings-tab-shipday' ),172 'label' => __( 'Enable pickup orders', ' woocommerce-settings-tab-shipday'),176 'title' => __( 'Enable pickup orders', 'shipday-for-woocommerce' ), 177 'label' => __( 'Enable pickup orders', 'shipday-for-woocommerce'), 173 178 'type' => 'checkbox', 174 179 'description' => 'Allow orders with local pickup shipping method to be sent to Shipday', … … 177 182 ), 178 183 array( 179 'title' => __( 'Enable new Shipday webhook', ' woocommerce-settings-tab-shipday' ),180 'label' => __( 'Enable new Shipday webhook', ' woocommerce-settings-tab-shipday'),184 'title' => __( 'Enable new Shipday webhook', 'shipday-for-woocommerce' ), 185 'label' => __( 'Enable new Shipday webhook', 'shipday-for-woocommerce'), 181 186 'type' => 'checkbox', 182 187 'description' => 'Enable this to send your orders to new Shipday Webhook',
Note: See TracChangeset
for help on using the changeset viewer.