Plugin Directory

Changeset 3450833


Ignore:
Timestamp:
01/31/2026 06:01:59 AM (2 months ago)
Author:
solankisoftware
Message:
  • Fixed front side view wishlist redirect page not found issue
  • Fixed On image top view button issue
  • Removed default text issue when its blank save
Location:
advwl-wishlist-for-woocommerce
Files:
41 added
9 edited

Legend:

Unmodified
Added
Removed
  • advwl-wishlist-for-woocommerce/trunk/advwl-wishlist-for-woocommerce.php

    r3421271 r3450833  
    33 * Plugin Name: Advanced Wishlist & Share – Save Products for Later
    44 * Description: You can add products in wishlist for future use using this plugin.
    5  * Version: 1.0.1
     5 * Version: 1.0.2
    66 * Author: Kirtikumar Solanki
    77 * Author URI: https://profiles.wordpress.org/solankisoftware/
     
    3030define( 'ADVWL_PUBLIC_CSS', ADVWL_URL . 'includes/public/css/' );
    3131define( 'ADVWL_PREFIX', 'advwl-wishlist-for-woocommerce' );
    32 define( 'ADVWL_FVERSION', '1.0.1' );
     32define( 'ADVWL_FVERSION', '1.0.2' );
    3333define( 'ADVWL_LOAD_FREE', plugin_basename( __FILE__ ) );
    3434
  • advwl-wishlist-for-woocommerce/trunk/includes/admin/inc/advwl-add-to-wishlist.php

    r3342068 r3450833  
    44if(isset($_POST['advwl_add_wishlist_panel'])){
    55
    6     // Verify nonce
     6    // Verify nonce
    77    if ( ! isset( $_POST['advwl_add_wishlist_panel'] ) ||
    88         ! wp_verify_nonce( sanitize_text_field( wp_unslash( $_POST['advwl_add_wishlist_panel'] ) ), 'advwl_add_wishlist_action' ) ) {
     
    3030        $advwl_btn_text = sanitize_text_field( wp_unslash( $_POST['advwl_btn_text'] ) );
    3131    } else {
    32         $advwl_btn_text = sanitize_text_field('Add to Wishlist');
     32        $advwl_btn_text = sanitize_text_field('');
    3333    }
    3434
     
    3636        $advwl_btn_view_text = sanitize_text_field( wp_unslash( $_POST['advwl_btn_view_text'] ) );
    3737    } else {
    38         $advwl_btn_view_text = sanitize_text_field('View Wishlist');
     38        $advwl_btn_view_text = sanitize_text_field('');
    3939    }
    4040
     
    4242        $advwl_btn_remove_text = sanitize_text_field( wp_unslash( $_POST['advwl_btn_remove_text'] ) );
    4343    } else {
    44         $advwl_btn_remove_text = sanitize_text_field('Remove From List');
     44        $advwl_btn_remove_text = sanitize_text_field('');
    4545    }
    4646
     
    4848        $advwl_btn_already_in = sanitize_text_field( wp_unslash( $_POST['advwl_btn_already_in'] ) );
    4949    } else {
    50         $advwl_btn_already_in = sanitize_text_field('Already In Wishlist');
     50        $advwl_btn_already_in = sanitize_text_field('');
    5151    }
    5252
  • advwl-wishlist-for-woocommerce/trunk/includes/admin/inc/advwl-general.php

    r3342068 r3450833  
    44if ( isset( $_POST['advwl_plugin_status'] ) || isset( $_POST['advwl_general_panel'] ) ) {
    55
    6     // Verify nonce
     6    // Verify nonce
    77    if ( ! isset( $_POST['advwl_general_panel'] ) ||
    88         ! wp_verify_nonce( sanitize_text_field( wp_unslash( $_POST['advwl_general_panel'] ) ), 'advwl_general_panel_action' ) ) {
     
    1212    $advwl_success = esc_html__( 'Successfully settings saved.', 'advwl-wishlist-for-woocommerce' );
    1313
    14     // Sanitize input
     14    // Sanitize input
    1515    $advwl_plugin_status = ! empty( $_POST['advwl_plugin_status'] ) ? '1' : '0';
    1616
  • advwl-wishlist-for-woocommerce/trunk/includes/admin/inc/advwl-wishlist-page-opt.php

    r3342068 r3450833  
    44if(isset($_POST['advwl_wishlist_opt_panel'])){
    55
    6     // Verify nonce matching the form
     6    // Verify nonce matching the form
    77    if ( ! isset( $_POST['advwl_wishlist_opt_panel'] ) ||
    88         ! wp_verify_nonce( sanitize_text_field( wp_unslash( $_POST['advwl_wishlist_opt_panel'] ) ), 'advwl_wishlist_opt_action' ) ) {
  • advwl-wishlist-for-woocommerce/trunk/includes/admin/inc/functions/advwl-functions.php

    r3387905 r3450833  
    1919function advwl_upload_file() {
    2020
    21     // Verify nonce for security
     21    // Verify nonce for security
    2222    if ( ! isset( $_POST['security'] ) || ! wp_verify_nonce( sanitize_text_field( wp_unslash( $_POST['security'] ) ), 'advwl-form' ) ) {
    2323        wp_send_json_error( [ 'message' => __( 'Security check failed.', 'advwl-wishlist-for-woocommerce' ) ] );
    2424    }
    2525
    26     // Validate file input
     26    // Validate file input
    2727    if ( ! isset( $_FILES['advwl_icon'] ) || ! isset( $_POST['advwl_option_name'] ) ) {
    2828        wp_send_json_error( [ 'message' => __( 'Invalid request.', 'advwl-wishlist-for-woocommerce' ) ] );
    2929    }
    3030
    31     // Sanitize option name
     31    // Sanitize option name
    3232    $advwl_opt_name = sanitize_text_field( wp_unslash( $_POST['advwl_option_name'] ) );
    3333
    34     // Sanitize and validate file data
     34    // Sanitize and validate file data
    3535    $advwl_file_data    = $_FILES['advwl_icon'];
    3636    $advwl_file_name    = sanitize_file_name( $advwl_file_data['name'] );
     
    4040    $advwl_file_size    = absint( $advwl_file_data['size'] );
    4141
    42     // Validate upload errors
     42    // Validate upload errors
    4343    if ( $advwl_file_error !== UPLOAD_ERR_OK ) {
    4444        wp_send_json_error( [ 'message' => __( 'File upload error.', 'advwl-wishlist-for-woocommerce' ) ] );
    4545    }
    4646
    47     // Validate file type
     47    // Validate file type
    4848    $allowed_types = [ 'image/jpeg', 'image/png', 'image/gif', 'image/svg+xml' ];
    4949    if ( ! in_array( $advwl_file_type, $allowed_types, true ) ) {
     
    5151    }
    5252
    53     // Validate file size (2MB limit example)
     53    // Validate file size (2MB limit example)
    5454    if ( $advwl_file_size > 2 * 1024 * 1024 ) {
    5555        wp_send_json_error( [ 'message' => __( 'File size exceeds 2MB limit.', 'advwl-wishlist-for-woocommerce' ) ] );
    5656    }
    5757
    58     // Handle upload
     58    // Handle upload
    5959    $advwl_upload = wp_upload_bits( $advwl_file_name, null, file_get_contents( $advwl_file_tmp_name ) );
    6060    if ( ! empty( $advwl_upload['error'] ) ) {
     
    6262    }
    6363
    64     // Sanitize URL
     64    // Sanitize URL
    6565    $advwl_file_url = esc_url_raw( $advwl_upload['url'] );
    6666
    67     // Save option securely
     67    // Save option securely
    6868    update_option( $advwl_opt_name, $advwl_file_url );
    6969
    70     // Return escaped URL in JSON
     70    // Return escaped URL in JSON
    7171    wp_send_json_success( [ 'file_url' => esc_url( $advwl_file_url ) ] );
    7272}
     
    749749        $product_id = $product->get_id();
    750750
    751         // Use cache to prevent repeated DB calls
     751        // Use cache to prevent repeated DB calls
    752752        $cache_key = 'advwl_wishlist_count_' . $product_id;
    753753        $wishlist_count = wp_cache_get( $cache_key, 'advwl_wishlist' );
    754754
    755755        if ( false === $wishlist_count ) {
    756             // Call get_var() directly with prepare
     756            // Call get_var() directly with prepare
    757757            $wishlist_count = (int) $wpdb->get_var(
    758758                $wpdb->prepare(
     
    762762            );
    763763
    764             // Store in object cache
     764            // Store in object cache
    765765            wp_cache_set( $cache_key, $wishlist_count, 'advwl_wishlist', 3600 );
    766766        }
  • advwl-wishlist-for-woocommerce/trunk/includes/public/css/advwl-frontend.css

    r3342068 r3450833  
    3131  max-width: 40px; /* Resize huge icons */
    3232  height: auto;
     33}
     34.advwl-link-text i{
     35  margin-right:13px;
     36}
     37
     38/* Center wishlist button on product images */
     39.products li.product .woocommerce-LoopProduct-link {
     40  position: relative;
     41  display: block;
     42}
     43.products li.product .advwl-on-image {
     44  position: absolute;
     45  top: 50%;
     46  left: 50%;
     47  transform: translate(-50%, -50%);
     48  z-index: 9;
     49}
     50.single-product .woocommerce-product-gallery {
     51  position: relative;
     52}
     53.single-product .woocommerce-product-gallery .advwl-on-image {
     54  position: absolute;
     55  top: 50%;
     56  left: 50%;
     57  transform: translate(-50%, -50%);
     58  z-index: 9;
    3359}
    3460
  • advwl-wishlist-for-woocommerce/trunk/includes/public/inc/advwl-functions.php

    r3343715 r3450833  
    4949                break;
    5050            case sanitize_text_field('advwl_btn_archive_top'):
    51                 add_action( 'woocommerce_before_shop_loop_item', 'advwl_add_to_btn_html', 10);
     51                add_action( 'woocommerce_before_shop_loop_item_title', 'advwl_add_to_btn_html', 11);
    5252                break;
    5353        }
     
    7070                    break;
    7171                case sanitize_text_field('advwl_btn_on_image'):
    72                     add_action( 'woocommerce_before_single_product_summary', 'advwl_add_to_btn_html', 21);
     72                    add_action( 'woocommerce_product_thumbnails', 'advwl_add_to_btn_html', 11);
    7373                    break;
    7474            }
     
    204204        );
    205205
     206        $position_class = '';
     207        if ( is_product() && advwl_get_option( 'advwl_btn_position' ) === 'advwl_btn_on_image' ) {
     208            $position_class = ' advwl-on-image';
     209        } elseif ( ( is_shop() || is_product_category() || is_product_tag() || is_product_taxonomy() )
     210            && advwl_get_option( 'advwl_btn_archive_position' ) === 'advwl_btn_archive_top' ) {
     211            $position_class = ' advwl-on-image';
     212        }
     213
    206214        // Button wrapper
    207         $advwl_btn_html = '<div class="advwl-add-to-wishlist-wrap"
     215        $advwl_btn_html = '<div class="advwl-add-to-wishlist-wrap' . esc_attr( $position_class ) . '"
    208216            data-product-id="' . esc_attr( $product_id ) . '"
    209217            data-product-type="' . esc_attr( $product_type ) . '"
     
    233241        global $wpdb;
    234242
    235         // Verify nonce
     243        // Verify nonce
    236244        if ( ! isset($_POST['security']) || ! wp_verify_nonce( sanitize_text_field( wp_unslash($_POST['security']) ), 'advwl_add_to_wishlist_nonce' ) ) {
    237245            wp_send_json_error( array( 'message' => __( 'Invalid request.', 'advwl-wishlist-for-woocommerce' ) ) );
     
    286294    function advwl_remove_from_wishlist() {
    287295
    288         // Verify nonce
     296        // Verify nonce
    289297        if ( empty( $_POST['security'] ) ||
    290298             ! wp_verify_nonce( sanitize_text_field( wp_unslash( $_POST['security'] ) ), 'advwl_remove_from_wishlist_nonce' ) ) {
     
    317325                    'temp_user_data' => sanitize_text_field( $temp_data ),
    318326                ),
    319                 array( '%d', '%d', '%s' ) // Added format for extra security
     327                array( '%d', '%d', '%s' ) // Added format for extra security
    320328            );
    321329        } else {
     
    326334                    'prod_id' => $product_id,
    327335                ),
    328                 array( '%d', '%d' ) // Added format
     336                array( '%d', '%d' ) // Added format
    329337            );
    330338        }
     
    352360    function advwl_view_wishlist() {
    353361
    354         // Verify nonce
     362        // Verify nonce
    355363        if ( empty( $_POST['security'] ) ||
    356364             ! wp_verify_nonce( sanitize_text_field( wp_unslash( $_POST['security'] ) ), 'advwl_view_wishlist_nonce' ) ) {
     
    387395            $wishlist_user_id = absint( base64_decode( sanitize_text_field( wp_unslash( $_GET['advwl_wishlist'] ) ) ) );
    388396
    389             // Verify nonce
     397            // Verify nonce
    390398            if ( ! isset( $_GET['advwl_nonce'] ) ||
    391399                ! wp_verify_nonce( sanitize_text_field( wp_unslash( $_GET['advwl_nonce'] ) ), 'advwl_view_wishlist_' . $wishlist_user_id ) ) {
     
    568576if ( ! function_exists( 'advwl_add_to_cart_action' ) ) {
    569577    function advwl_add_to_cart_action() {
    570         // Manual nonce verification
     578        // Manual nonce verification
    571579        if ( empty( $_POST['security'] ) || ! wp_verify_nonce( sanitize_text_field( wp_unslash( $_POST['security'] ) ), 'advwl_add_to_cart_nonce' ) ) {
    572580            wp_send_json_error( [
  • advwl-wishlist-for-woocommerce/trunk/includes/public/js/advwl-frontend.js

    r3343715 r3450833  
    3636                action: 'advwl_add_to_wishlist_action',
    3737                product_id: product_id,
    38                 security: advwl_addto_wishlist.nonce // send nonce
     38                security: advwl_addto_wishlist.nonce // send nonce
    3939            },
    4040            success: function(response){   
     
    9191                action: 'advwl_remove_from_wishlist',
    9292                product_id: product_id,
    93                 security: advwl_params.nonce_remove // Send nonce
     93                security: advwl_params.nonce_remove // Send nonce
    9494            },
    9595            success: function(response) {
    9696                if (response.success) {
    97                     var remove_data = response.data; // get data object
     97                    var remove_data = response.data; // get data object
    9898                    var remove_row = remove_data.remove_row;
    9999
     
    122122            type: 'POST',
    123123            url: advwl_view_wishlist.ajax_url,
    124             dataType: 'json', // Ensure JSON object is returned
     124            dataType: 'json', // Ensure JSON object is returned
    125125            data: {
    126126                action: 'advwl_view_wishlist',
     
    155155            },
    156156            success: function(response){     
    157                 // Access data from response.data
     157                // Access data from response.data
    158158                var remove_row = response.data.remove_row;
    159159                var message    = response.data.message;
     
    194194                action: 'advwl_add_to_cart_action',
    195195                product_id: product_id,
    196                 security: advwl_params.nonce_addtocart // Use the localized nonce
     196                security: advwl_params.nonce_addtocart // Use the localized nonce
    197197            },
    198198            success: function(response){
  • advwl-wishlist-for-woocommerce/trunk/readme.txt

    r3443444 r3450833  
    44Tags: wishlist, save for later, product wishlist, favorite products 
    55Requires at least: 5.0 
    6 Tested up to: 6.9 
     6Tested up to: 6.9
    77Requires PHP: 7.0 
    8 Stable tag: 1.0.1
     8Stable tag: 1.0.2
    99License: GPLv2 or later 
    1010License URI: https://www.gnu.org/licenses/gpl-2.0.html 
     
    100100
    101101== Changelog ==
     102= 1.0.2 =
     103* Fixed front side view wishlist redirect page not found issue
     104* Fixed On image top view button issue
     105* Removed default text issue when its blank save
    102106
    103107= 1.0.1 =
Note: See TracChangeset for help on using the changeset viewer.