Plugin Directory

Changeset 3426465


Ignore:
Timestamp:
12/23/2025 07:22:03 PM (3 months ago)
Author:
cod24
Message:
  • Bugs fixes and improvements
Location:
cod24-shipping
Files:
33 added
4 deleted
3 edited

Legend:

Unmodified
Added
Removed
  • cod24-shipping/trunk/cod24-shipping.php

    r3426042 r3426465  
    33Plugin Name: COD24 Shipping For Woocommerce
    44Description: This plugin is adding COD24 shipping methods to woocommerce.
    5 Version: 5.0.3
     5Version: 5.0.4
    66Author: COD24
    77Author URI: https://cod24.ir
    88License: GPL-2.0+
    99License URI: http://www.gnu.org/licenses/gpl-2.0.html
    10 Domain Path: /languages
    1110Text Domain: cod24-shipping
    1211*/
     
    2726        public function __construct()
    2827        {
    29             define('COD24_PLUGIN_VERSION', '5.0.3');
    30             define('COD24_PLUGIN_DIR', plugin_dir_path(__FILE__));
    31             define('COD24_PLUGIN_URL', plugin_dir_url(__FILE__));
    32 
    33             // Include required files
    34             require_once('inc/api/class-cod24-api.php');
    35             require_once('inc/api/class-cod24-tipax-api.php');
    36             require_once('inc/shipping/class-cod24-pishtaz.php');
    37             require_once('inc/shipping/class-cod24-special.php');
    38             require_once('inc/shipping/class-cod24-tipax.php');
    39             require_once('inc/class-cod24-settings.php');
    40             require_once('inc/class-cod24-shcod.php');
    41             require_once('inc/class-cod24-woo.php');
    42             require_once('inc/class-cod24-dokan.php');
    43 
    44             // Include Dokan integration if Dokan is active
    45             if (!class_exists('\WeDevs_Dokan')) {
    46                
    47             }
    48 
    49             // Schedule the cron job to run once (e.g., 2 minutes from now)
    50             if (!get_option('cod24_meta_data_migrated')) {
    51                 if (!wp_next_scheduled('migrate_cod24_meta_data_cron')) {
    52                     wp_schedule_single_event(time() + 120, 'migrate_cod24_meta_data_cron');
    53                 }
    54                 add_action('migrate_cod24_meta_data_cron', array(__CLASS__, 'migrate_cod24_meta_data'));
    55             }
     28            define('COD24_PLUGIN_VERSION', '5.0.4');
     29            define('COD24_PLUGIN_DIR', plugin_dir_path(__FILE__));
     30            define('COD24_PLUGIN_URL', plugin_dir_url(__FILE__));
     31           
     32            // Include required files
     33            require_once('inc/api/class-cod24-api.php');
     34            require_once('inc/api/class-cod24-tipax-api.php');
     35            require_once('inc/shipping/class-cod24-pishtaz.php');
     36            require_once('inc/shipping/class-cod24-special.php');
     37            require_once('inc/shipping/class-cod24-tipax.php');
     38            require_once('inc/class-cod24-settings.php');
     39            require_once('inc/class-cod24-shcod.php');
     40            require_once('inc/class-cod24-woo.php');
     41            require_once('inc/class-cod24-dokan.php');
     42           
     43            // Schedule the cron job to run once (e.g., 2 minutes from now)
     44            if (!get_option('cod24_meta_data_migrated')) {
     45                if (!wp_next_scheduled('migrate_cod24_meta_data_cron')) {
     46                    wp_schedule_single_event(time() + 120, 'migrate_cod24_meta_data_cron');
     47                }
     48                add_action('migrate_cod24_meta_data_cron', array(__CLASS__, 'migrate_cod24_meta_data'));
     49               
     50            }
    5651        }
    5752
  • cod24-shipping/trunk/inc/class-cod24-dokan.php

    r3426042 r3426465  
    278278                        <div class="dokan-form-group">
    279279                            <label class="dokan-w3 dokan-control-label" for="vendor_cod24_pishtaz_fallback_price">
    280                                 <?php echo esc_attr__('Fallback Price', 'cod24-shipping'). ' ('. get_woocommerce_currency_symbol().')'; ?>
     280                                <?php echo esc_attr__('Fallback Price', 'cod24-shipping'). ' ('. esc_attr( get_woocommerce_currency_symbol() ).')'; ?>
    281281                            </label>
    282282                            <div class="dokan-w5">
     
    301301                        <div class="dokan-form-group">
    302302                            <label class="dokan-w3 dokan-control-label" for="vendor_cod24_special_fallback_price">
    303                                 <?php echo esc_attr__('Fallback Price', 'cod24-shipping'). ' ('. get_woocommerce_currency_symbol().')'; ?>
     303                                <?php echo esc_attr__('Fallback Price', 'cod24-shipping'). ' ('. esc_attr( get_woocommerce_currency_symbol() ).')'; ?>
    304304                            </label>
    305305                            <div class="dokan-w5">
     
    331331                        <div class="dokan-form-group">
    332332                            <label class="dokan-w3 dokan-control-label" for="vendor_cod24_tipax_price">
    333                                 <?php echo esc_attr__('Shipping Price', 'cod24-shipping'). ' ('. get_woocommerce_currency_symbol().')'; ?>
     333                                <?php echo esc_attr__('Shipping Price', 'cod24-shipping'). ' ('. esc_attr( get_woocommerce_currency_symbol() ).')'; ?>
    334334                            </label>
    335335                            <div class="dokan-w5">
     
    352352                        </div>
    353353                    </div>
    354 
     354                   
    355355                </form>
    356 
    357356               
    358357            </div>
     
    367366        public static function save_vendor_cod24_settings()
    368367        {
    369             if (isset($_POST['dokan_cod24_settings_nonce_field']) && !wp_verify_nonce(sanitize_text_field( wp_unslash ($_POST['dokan_cod24_settings_nonce_field'])), 'dokan_cod24_settings_nonce')) {
     368            // Check nonce - fail early if missing or invalid
     369            if (!isset($_POST['dokan_cod24_settings_nonce_field']) ||
     370                !wp_verify_nonce(sanitize_text_field(wp_unslash($_POST['dokan_cod24_settings_nonce_field'])), 'dokan_cod24_settings_nonce')) {
    370371                wp_send_json_error(array('message' => __('Security check failed', 'cod24-shipping')));
    371             }
    372 
     372                exit;
     373            }
     374           
     375            // Check user permissions - ensure user is logged in and is a vendor
    373376            $vendor_id = dokan_get_current_user_id();
    374 
     377           
     378            if (!$vendor_id || !dokan_is_user_seller($vendor_id)) {
     379                wp_send_json_error(array('message' => __('You do not have permission to perform this action', 'cod24-shipping')));
     380                exit;
     381            }
     382           
    375383            // General Settings
    376384            $enabled = isset($_POST['vendor_cod24_enabled']) ? 'yes' : 'no';
    377385            update_user_meta($vendor_id, '_vendor_cod24_enabled', $enabled);
    378 
     386           
    379387            if (!empty($_POST['vendor_cod24_username'])) {
    380                 update_user_meta($vendor_id, '_vendor_cod24_username', sanitize_text_field($_POST['vendor_cod24_username']));
    381             }
    382 
     388                update_user_meta($vendor_id, '_vendor_cod24_username', sanitize_text_field(wp_unslash($_POST['vendor_cod24_username'])));
     389            }
     390           
    383391            if (!empty($_POST['vendor_cod24_password'])) {
    384                 update_user_meta($vendor_id, '_vendor_cod24_password', sanitize_text_field($_POST['vendor_cod24_password']));
    385             }
    386 
     392                update_user_meta($vendor_id, '_vendor_cod24_password', sanitize_text_field(wp_unslash($_POST['vendor_cod24_password'])));
     393            }
     394           
    387395            // Enabled Methods
    388             $enabled_methods = isset($_POST['vendor_cod24_enabled_methods']) ? array_map('sanitize_text_field', (array) $_POST['vendor_cod24_enabled_methods']) : array();
     396            $enabled_methods = isset($_POST['vendor_cod24_enabled_methods']) ? array_map('sanitize_text_field', wp_unslash((array) $_POST['vendor_cod24_enabled_methods'])) : array();
    389397            update_user_meta($vendor_id, '_vendor_cod24_enabled_methods', $enabled_methods);
    390 
     398           
    391399            // Pishtaz Settings
    392400            if (isset($_POST['vendor_cod24_pishtaz_title'])) {
    393                 update_user_meta($vendor_id, '_vendor_cod24_pishtaz_title', sanitize_text_field($_POST['vendor_cod24_pishtaz_title']));
     401                update_user_meta($vendor_id, '_vendor_cod24_pishtaz_title', sanitize_text_field(wp_unslash($_POST['vendor_cod24_pishtaz_title'])));
    394402            }
    395403            if (isset($_POST['vendor_cod24_pishtaz_fallback_price'])) {
    396                 update_user_meta($vendor_id, '_vendor_cod24_pishtaz_fallback_price', floatval($_POST['vendor_cod24_pishtaz_fallback_price']));
    397             }
    398 
     404                update_user_meta($vendor_id, '_vendor_cod24_pishtaz_fallback_price', floatval(wp_unslash($_POST['vendor_cod24_pishtaz_fallback_price'])));
     405            }
     406           
    399407            // Special Settings
    400408            if (isset($_POST['vendor_cod24_special_title'])) {
    401                 update_user_meta($vendor_id, '_vendor_cod24_special_title', sanitize_text_field($_POST['vendor_cod24_special_title']));
     409                update_user_meta($vendor_id, '_vendor_cod24_special_title', sanitize_text_field(wp_unslash($_POST['vendor_cod24_special_title'])));
    402410            }
    403411            if (isset($_POST['vendor_cod24_special_fallback_price'])) {
    404                 update_user_meta($vendor_id, '_vendor_cod24_special_fallback_price', floatval($_POST['vendor_cod24_special_fallback_price']));
    405             }
    406 
     412                update_user_meta($vendor_id, '_vendor_cod24_special_fallback_price', floatval(wp_unslash($_POST['vendor_cod24_special_fallback_price'])));
     413            }
     414           
    407415            // Tipax Settings
    408416            if (isset($_POST['vendor_cod24_tipax_title'])) {
    409                 update_user_meta($vendor_id, '_vendor_cod24_tipax_title', sanitize_text_field($_POST['vendor_cod24_tipax_title']));
     417                update_user_meta($vendor_id, '_vendor_cod24_tipax_title', sanitize_text_field(wp_unslash($_POST['vendor_cod24_tipax_title'])));
    410418            }
    411419            if (isset($_POST['vendor_cod24_tipax_price'])) {
    412                 update_user_meta($vendor_id, '_vendor_cod24_tipax_price', sanitize_text_field($_POST['vendor_cod24_tipax_price']));
    413             }
    414 
     420                update_user_meta($vendor_id, '_vendor_cod24_tipax_price', sanitize_text_field(wp_unslash($_POST['vendor_cod24_tipax_price'])));
     421            }
     422           
    415423            wp_send_json_success(array('message' => __('Settings saved successfully!', 'cod24-shipping')));
     424            exit;
    416425        }
    417426
  • cod24-shipping/trunk/readme.txt

    r3426042 r3426465  
    44Requires at least: 5.0
    55Tested up to: 6.9
    6 Stable tag: 5.0.3
     6Stable tag: 5.0.4
    77License: GPL-2.0+
    88License URI: http://www.gnu.org/licenses/gpl-2.0.html
     
    4444
    4545== Changelog ==
     46
     47= 5.0.4 =
     48* Bugs fixes and improvements
    4649
    4750= 5.0.3 =
Note: See TracChangeset for help on using the changeset viewer.