From 5823f40e322a1928393ad2756d0aa5641eb5f294 Mon Sep 17 00:00:00 2001 From: Harish Chouhan Date: Wed, 26 Jun 2024 19:35:40 +0700 Subject: [PATCH] Updated tag --- i-recommend-this.php | 2 +- js/dot_irecommendthis.js | 44 ++++++++++++++++++++++------------------ readme.txt | 5 ++++- 3 files changed, 29 insertions(+), 22 deletions(-) diff --git a/i-recommend-this.php b/i-recommend-this.php index c82ae94..798d1ed 100644 --- a/i-recommend-this.php +++ b/i-recommend-this.php @@ -3,7 +3,7 @@ Plugin Name: I Recommend This Plugin URI: https://themeist.com/plugins/wordpress/i-recommend-this/#utm_source=wp-plugin&utm_medium=i-recommend-this&utm_campaign=plugins-page Description: This plugin allows your visitors to recommend or like your posts. -Version: 3.9.0 +Version: 3.9.1 Author: Harish Chouhan, Themeist Author URI: https://themeist.com/ Author Email: support@themeist.com diff --git a/js/dot_irecommendthis.js b/js/dot_irecommendthis.js index e3ddbc4..7e598f5 100644 --- a/js/dot_irecommendthis.js +++ b/js/dot_irecommendthis.js @@ -1,24 +1,28 @@ jQuery(document).ready(function($) { - $(document).on('click', '.dot-irecommendthis', function() { - var link = $(this); - var unrecommend = link.hasClass('active'); - var id = $(this).attr('id'); - var suffix = link.find('.dot-irecommendthis-suffix').text(); - - // Generate a nonce - var nonce = dot_irecommendthis.nonce; + $(document).on('click', '.dot-irecommendthis', function(event) { + event.preventDefault(); - $.post(dot_irecommendthis.ajaxurl, { - action: 'dot-irecommendthis', - recommend_id: id, - suffix: suffix, - unrecommend: unrecommend, - security: nonce, // Pass the nonce as part of the request - }, function(data) { - let title = unrecommend ? "Recommend this" : "You already recommended this"; - link.html(data).toggleClass('active').attr('title', title); - }); + var link = $(this); + var unrecommend = link.hasClass('active'); + var id = link.attr('id'); + var suffix = link.find('.dot-irecommendthis-suffix').text(); + + // Generate a nonce + var nonce = dot_irecommendthis.nonce; - return false; - }); + $.post(dot_irecommendthis.ajaxurl, { + action: 'dot-irecommendthis', + recommend_id: id, + suffix: suffix, + unrecommend: unrecommend, + security: nonce // Pass the nonce as part of the request + }, function(data) { + var title = unrecommend ? "Recommend this" : "You already recommended this"; + link.html(data).toggleClass('active').attr('title', title); + }).fail(function(xhr, status, error) { + console.error("Error: " + error); + }); + + return false; + }); }); \ No newline at end of file diff --git a/readme.txt b/readme.txt index 830ce68..9c1a34c 100644 --- a/readme.txt +++ b/readme.txt @@ -4,7 +4,7 @@ Donate link: https://themeist.com Tags: recommend, like, love, post, rate, rating, post rating, heart, dribbble like, tumblr like Requires at least: 6.0 Tested up to: 6.3.2 -Stable tag: 3.9.0 +Stable tag: 3.9.1 License: GPLv2 or later License URI: http://www.gnu.org/licenses/gpl-2.0.html @@ -102,6 +102,9 @@ Please report security bugs found in the source code through the [Patchstack Vul == Changelog == += 3.9.1 +* Security update + = 3.9.0 * Added support for un-recommending/un-liking a post * Fixed data sanitization