Changeset 3450961
- Timestamp:
- 01/31/2026 11:25:36 AM (2 months ago)
- Location:
- like-dislike-posts-products
- Files:
-
- 26 added
- 7 edited
-
tags/2.9 (added)
-
tags/2.9/assets (added)
-
tags/2.9/assets/css (added)
-
tags/2.9/assets/css/admin-style.css (added)
-
tags/2.9/assets/css/fav-posts.css (added)
-
tags/2.9/assets/css/font-awesome.min.css (added)
-
tags/2.9/assets/css/styles.css (added)
-
tags/2.9/assets/fonts (added)
-
tags/2.9/assets/fonts/FontAwesome.otf (added)
-
tags/2.9/assets/fonts/fontawesome-webfont.eot (added)
-
tags/2.9/assets/fonts/fontawesome-webfont.svg (added)
-
tags/2.9/assets/fonts/fontawesome-webfont.ttf (added)
-
tags/2.9/assets/fonts/fontawesome-webfont.woff (added)
-
tags/2.9/assets/fonts/fontawesome-webfont.woff2 (added)
-
tags/2.9/assets/js (added)
-
tags/2.9/assets/js/fav-posts.js (added)
-
tags/2.9/assets/js/post-read.js (added)
-
tags/2.9/assets/js/scripts.js (added)
-
tags/2.9/files (added)
-
tags/2.9/files/shop_achieve.php (added)
-
tags/2.9/files/single_page.php (added)
-
tags/2.9/functions.php (added)
-
tags/2.9/languages (added)
-
tags/2.9/ldppp_likes_dislikes.php (added)
-
tags/2.9/readme.txt (added)
-
tags/2.9/uninstall.php (added)
-
trunk/assets/css/styles.css (modified) (2 diffs)
-
trunk/assets/js/scripts.js (modified) (8 diffs)
-
trunk/files/shop_achieve.php (modified) (2 diffs)
-
trunk/files/single_page.php (modified) (2 diffs)
-
trunk/functions.php (modified) (5 diffs)
-
trunk/ldppp_likes_dislikes.php (modified) (6 diffs)
-
trunk/readme.txt (modified) (7 diffs)
Legend:
- Unmodified
- Added
- Removed
-
like-dislike-posts-products/trunk/assets/css/styles.css
r3437177 r3450961 256 256 } 257 257 .ldppp_ratings_ratio_percent { 258 width: 40px;258 width: 50px; 259 259 text-align: left; 260 260 color: #555; … … 366 366 } 367 367 368 .ldppp-copy-posts-wrapper { 369 display: grid; 370 } -
like-dislike-posts-products/trunk/assets/js/scripts.js
r3406209 r3450961 158 158 } 159 159 160 // Update ratio bar 160 // Update ratio bar inside the main wrapper 161 161 const wrapper = jQuery('#ldppp_AjaxLike').closest('.ldppp_like-dislike'); 162 162 ldppp_update_ratio_bar(like, dislike, wrapper); 163 164 // Also update any standalone ratio bar shortcodes for this post 165 const postId = jQuery('#ldppp_AjaxLike').data('id'); 166 if (postId) { 167 jQuery('.ldppp_ratio_bar[data-postid="' + postId + '"]').each(function () { 168 ldppp_update_ratio_bar(like, dislike, jQuery(this)); 169 }); 170 } 163 171 } 164 172 … … 186 194 const ratings = jQuery(this).val(); 187 195 const postID = jQuery(this).attr('data-id'); 196 const $rateContainer = jQuery(this).closest('.ldppp_rate'); 197 console.log('Rating clicked (ldppp_start_rates) - postID:', postID, 'rating:', ratings); 188 198 189 199 jQuery.ajax({ … … 198 208 }, 199 209 success: function(response) { 210 console.log('AJAX response received:', response); 211 200 212 const value = jQuery('#ldppp_star' + response.ratings + '').val(); 201 213 jQuery("input[name='ldppp_start_rates']").next().removeClass('ldppp_rated_class'); … … 203 215 jQuery('#ldppp_totalratings').text('(' + response.totalratings + ')'); 204 216 jQuery('#ldppp_avgratings').text(response.avg_ratings + '/5'); 217 218 // Update the ratings ratio wrapper instantly 219 if (response.rating_counts && response.total_votes) { 220 console.log('Updating ratings wrapper'); 221 ldppp_update_ratings_ratio_wrapper(response.rating_counts, $rateContainer); 222 } else { 223 console.log('Missing rating_counts or total_votes:', response); 224 } 225 }, 226 error: function(xhr, status, error) { 227 console.error('Rating update failed:', error, xhr); 205 228 } 206 229 }); … … 215 238 const id = jQuery(this).attr('id').replace(/[^0-9]/gi, ''); 216 239 const f_id = parseInt(id, 10); 240 const $rateContainer = jQuery(this).closest('.ldppp_rate'); 241 console.log('Rating clicked (ldppp_check_id/shop) - postID:', postID, 'rating:', ratings); 217 242 218 243 jQuery.ajax({ … … 227 252 }, 228 253 success: function(response) { 254 console.log('AJAX response received (shop):', response); 255 229 256 jQuery('.' + newStr).children().removeClass('ldppp_rated_class'); 230 257 jQuery('#ldppp_star' + f_id + '').next().addClass('ldppp_rated_class'); 231 258 jQuery('#ldppp_totalratings' + postID).text('(' + response.totalratings + ')'); 232 259 jQuery('#ldppp_avgratings' + postID).text(response.avg_ratings + '/5'); 233 } 234 }); 235 }); 260 261 // Update the ratings ratio wrapper instantly 262 if (response.rating_counts && response.total_votes) { 263 console.log('Updating ratings wrapper (shop)'); 264 ldppp_update_ratings_ratio_wrapper(response.rating_counts, $rateContainer); 265 } else { 266 console.log('Missing rating_counts or total_votes (shop):', response); 267 } 268 }, 269 error: function(xhr, status, error) { 270 console.error('Rating update failed (shop):', error, xhr); 271 } 272 }); 273 }); 274 } 275 276 /** 277 * Update ratings ratio wrapper with new distribution 278 */ 279 function ldppp_update_ratings_ratio_wrapper(rating_counts, $rateContainer) { 280 console.log('ldppp_update_ratings_ratio_wrapper called with:', rating_counts, '$rateContainer:', $rateContainer); 281 282 // Try to find the closest ldppp_post_align_center wrapper (used in posts) 283 let $wrapper = $rateContainer.closest('.ldppp_post_align_center'); 284 let $ratioWrapper = null; 285 286 if ($wrapper.length) { 287 // For posts in functions.php - wrapper exists 288 console.log('Found post wrapper (ldppp_post_align_center)'); 289 $ratioWrapper = $wrapper.next('.ldppp_ratings_ratio_wrapper'); 290 } else { 291 // For products in single_page.php and shop_achieve.php - no wrapper 292 // Look for the next sibling or find it after the avgratings wrapper 293 console.log('No post wrapper found, looking for product wrapper'); 294 $ratioWrapper = $rateContainer.nextAll('.ldppp_ratings_ratio_wrapper').first(); 295 296 // If not found, try looking after the avgratings_totalratings_wrapper 297 if (!$ratioWrapper.length) { 298 const $avgWrapper = $rateContainer.nextAll('.ldppp_avgratings_totalratings_wrapper').first(); 299 console.log('Checked avgratings wrapper, found:', $avgWrapper.length); 300 if ($avgWrapper.length) { 301 $ratioWrapper = $avgWrapper.nextAll('.ldppp_ratings_ratio_wrapper').first(); 302 } 303 } 304 } 305 306 console.log('Found ratio wrapper:', $ratioWrapper.length, 'HTML:', $ratioWrapper.html() ? $ratioWrapper.html().substring(0, 100) : 'empty'); 307 308 if ($ratioWrapper.length) { 309 // Update each star rating row from 5 stars down to 1 star 310 for (let i = 5; i >= 1; i--) { 311 const percent = rating_counts[i] ? rating_counts[i].percent : 0; 312 const $row = $ratioWrapper.find('[data-star="' + i + '"]'); 313 314 console.log('Star ' + i + ': looking for [data-star="' + i + '"], found:', $row.length, ', percent:', percent); 315 316 if ($row.length) { 317 // Update width and percentage text 318 $row.find('.ldppp_ratings_ratio_fill').css('width', percent + '%'); 319 $row.find('.ldppp_ratings_ratio_percent').text(percent + '%'); 320 console.log('Updated star ' + i); 321 } 322 } 323 } else { 324 console.log('ERROR: Could not find ldppp_ratings_ratio_wrapper!'); 325 } 236 326 } 237 327 … … 286 376 const displayType = ldppp_count_ajax.display_type; 287 377 288 const like_percent = total > 0 ? Math.round((likes / total) * 100) : 0;289 const dislike_percent = total > 0 ? Math.round((dislikes / total) * 100) : 0;378 const like_percent = total > 0 ? Math.round((likes / total) * 100) : 50; 379 const dislike_percent = total > 0 ? Math.round((dislikes / total) * 100) : 50; 290 380 291 381 const likeText = displayType === 'percentage' ? like_percent + '%' : likes; … … 295 385 $wrapper.find('.ldppp_comment_dislike-count').text(dislikeText); 296 386 297 // Update ratio bars 298 $wrapper.find('.ldppp_comment_ratio_like') 299 .css('width', like_percent + '%') 300 .find('.ldppp_comment_ratio_text').text(like_percent + '%'); 301 302 $wrapper.find('.ldppp_comment_ratio_dislike') 303 .css('width', dislike_percent + '%') 304 .find('.ldppp_comment_ratio_text').text(dislike_percent + '%'); 387 // Update ratio bars - they are located after the main wrapper div 388 const $ratioBar = $wrapper.next('.ldppp_comment_ratio_bar'); 389 if ($ratioBar.length) { 390 $ratioBar.find('.ldppp_comment_ratio_like') 391 .css('width', like_percent + '%') 392 .find('.ldppp_comment_ratio_text').text(like_percent + '%'); 393 394 $ratioBar.find('.ldppp_comment_ratio_dislike') 395 .css('width', dislike_percent + '%') 396 .find('.ldppp_comment_ratio_text').text(dislike_percent + '%'); 397 } 305 398 306 399 // Reset icons -
like-dislike-posts-products/trunk/files/shop_achieve.php
r3362707 r3450961 180 180 $ldppp_counterShow .= '</div>'; 181 181 182 // Add rating progress bar 183 $ldppp_auto_display_rating_progressbar = get_option('ldppp_auto_display_rating_progressbar', 'yes'); 184 if (isset($ldppp_auto_display_rating_progressbar) && $ldppp_auto_display_rating_progressbar == 'yes') { 185 // Calculate rating distribution 186 $rating_counts = array(); 187 for ($i = 1; $i <= 5; $i++) { 188 $rating_counts[$i] = (int) $wpdb->get_var( 189 $wpdb->prepare("SELECT COUNT(*) FROM $ldppp_ratings WHERE post_id = %d AND ratings = %d", $post->ID, $i) 190 ); 191 } 192 $total_rating_votes = array_sum($rating_counts); 193 194 $ldppp_counterShow .= '<div class="ldppp_ratings_ratio_wrapper">'; 195 for ($i = 5; $i >= 1; $i--) { 196 $percent = ($total_rating_votes > 0) ? round(($rating_counts[$i] / $total_rating_votes) * 100) : 0; 197 $ldppp_counterShow .= ' 198 <div class="ldppp_ratings_ratio_row" data-star="' . esc_attr($i) . '"> 199 <span class="ldppp_star_label">' . esc_html($i) . '★</span> 200 <div class="ldppp_ratings_ratio_bar"> 201 <div class="ldppp_ratings_ratio_fill" style="width:' . esc_attr($percent) . '%;"></div> 202 </div> 203 <span class="ldppp_ratings_ratio_percent">' . esc_html($percent) . '%</span> 204 </div> 205 '; 206 } 207 $ldppp_counterShow .= '</div>'; 208 } 209 182 210 $ldppp_allowed_html = array( 183 211 'input' => array( … … 199 227 'class' => array(), 200 228 'id' => array(), 229 'data-star' => array(), 230 'style' => array(), 201 231 ), 202 232 ); -
like-dislike-posts-products/trunk/files/single_page.php
r3362713 r3450961 192 192 $ldppp_counterShow .= '</div>'; 193 193 194 // Add rating progress bar 195 $ldppp_auto_display_rating_progressbar = get_option('ldppp_auto_display_rating_progressbar', 'yes'); 196 if (isset($ldppp_auto_display_rating_progressbar) && $ldppp_auto_display_rating_progressbar == 'yes') { 197 // Calculate rating distribution 198 $rating_counts = array(); 199 for ($i = 1; $i <= 5; $i++) { 200 $rating_counts[$i] = (int) $wpdb->get_var( 201 $wpdb->prepare("SELECT COUNT(*) FROM $ldppp_ratings WHERE post_id = %d AND ratings = %d", $post->ID, $i) 202 ); 203 } 204 $total_rating_votes = array_sum($rating_counts); 205 206 $ldppp_counterShow .= '<div class="ldppp_ratings_ratio_wrapper">'; 207 for ($i = 5; $i >= 1; $i--) { 208 $percent = ($total_rating_votes > 0) ? round(($rating_counts[$i] / $total_rating_votes) * 100) : 0; 209 $ldppp_counterShow .= ' 210 <div class="ldppp_ratings_ratio_row" data-star="' . esc_attr($i) . '"> 211 <span class="ldppp_star_label">' . esc_html($i) . '★</span> 212 <div class="ldppp_ratings_ratio_bar"> 213 <div class="ldppp_ratings_ratio_fill" style="width:' . esc_attr($percent) . '%;"></div> 214 </div> 215 <span class="ldppp_ratings_ratio_percent">' . esc_html($percent) . '%</span> 216 </div> 217 '; 218 } 219 $ldppp_counterShow .= '</div>'; 220 } 221 194 222 $ldppp_allowed_html = array( 195 223 'input' => array( … … 211 239 'class' => array(), 212 240 'id' => array(), 241 'data-star' => array(), 242 'style' => array(), 213 243 ), 214 244 ); -
like-dislike-posts-products/trunk/functions.php
r3446224 r3450961 1336 1336 $percent = ($total_rating_votes > 0) ? round(($rating_counts[$i] / $total_rating_votes) * 100) : 0; 1337 1337 $ldppp_counterShow .= ' 1338 <div class="ldppp_ratings_ratio_row" >1338 <div class="ldppp_ratings_ratio_row" data-star="' . esc_attr($i) . '"> 1339 1339 <span class="ldppp_star_label">' . esc_html($i) . '★</span> 1340 1340 <div class="ldppp_ratings_ratio_bar"> … … 1422 1422 $percent = ($total_rating_votes > 0) ? round(($rating_counts[$i] / $total_rating_votes) * 100) : 0; 1423 1423 $ldppp_counterShow .= ' 1424 <div class="ldppp_ratings_ratio_row" >1424 <div class="ldppp_ratings_ratio_row" data-star="' . esc_attr($i) . '"> 1425 1425 <span class="ldppp_star_label">' . esc_html($i) . '★</span> 1426 1426 <div class="ldppp_ratings_ratio_bar"> … … 1612 1612 $percent = ($total_rating_votes > 0) ? round(($rating_counts[$i] / $total_rating_votes) * 100) : 0; 1613 1613 $ldppp_counterShow .= ' 1614 <div class="ldppp_ratings_ratio_row" >1614 <div class="ldppp_ratings_ratio_row" data-star="' . esc_attr($i) . '"> 1615 1615 <span class="ldppp_star_label">' . esc_html($i) . '★</span> 1616 1616 <div class="ldppp_ratings_ratio_bar"> … … 1702 1702 $percent = ($total_rating_votes > 0) ? round(($rating_counts[$i] / $total_rating_votes) * 100) : 0; 1703 1703 $ldppp_counterShow .= ' 1704 <div class="ldppp_ratings_ratio_row" >1704 <div class="ldppp_ratings_ratio_row" data-star="' . esc_attr($i) . '"> 1705 1705 <span class="ldppp_star_label">' . esc_html($i) . '★</span> 1706 1706 <div class="ldppp_ratings_ratio_bar"> … … 1867 1867 ); 1868 1868 } 1869 1870 // Get rating counts for each star level 1871 $total_votes = intval($wpdb->get_var($wpdb->prepare("SELECT COUNT(*) FROM $ldppp_table_name WHERE post_id=%d", $postID))); 1872 $rating_counts = array(); 1873 for ($i = 1; $i <= 5; $i++) { 1874 $count = intval($wpdb->get_var($wpdb->prepare("SELECT COUNT(*) FROM $ldppp_table_name WHERE post_id=%d AND ratings=%d", $postID, $i))); 1875 $percent = ($total_votes > 0) ? round(($count / $total_votes) * 100) : 0; 1876 $rating_counts[$i] = array('count' => $count, 'percent' => $percent); 1877 } 1878 $data['rating_counts'] = $rating_counts; 1879 $data['total_votes'] = $total_votes; 1880 1869 1881 $data['success_msg'] = esc_html__( 'Rating Successfully Added.', 'like-dislike-posts-products' ); 1870 1882 $data['error_msg'] = esc_html__( 'Rating Not added.', 'like-dislike-posts-products' ); -
like-dislike-posts-products/trunk/ldppp_likes_dislikes.php
r3446224 r3450961 3 3 Plugin Name: Like Dislike, Star Ratings, Favorites & Post Views & Share & Copy Posts – Posts, Comments, Products 4 4 Description: A powerful engagement toolkit offering AJAX-based Like/Dislike buttons, Star Ratings, Favorites (Wishlist), Post Views counter, and Social Share features for posts, products, and comments. 5 Version: 2. 85 Version: 2.9 6 6 Author: Kirtikumar Solanki 7 7 Author URI: https://profiles.wordpress.org/solankisoftware/ … … 16 16 17 17 define( 'LDPPP_PLUGIN_DIR', plugin_dir_path( __FILE__ ) ); 18 define( 'LDPPP_VERSION', '2. 8' );18 define( 'LDPPP_VERSION', '2.9' ); 19 19 define( 'LDPPP_PLUGIN_URL', plugin_dir_url( __FILE__ ) ); 20 20 … … 83 83 function ldppp_pages(){ 84 84 add_menu_page( 'Like/Dislike Posts', 'Posts Products Reactions & Ratings', 'administrator', 'ldppp-like-dislike-posts', 'ldppp_admin_view', 'dashicons-star-empty'); 85 add_submenu_page( 'Like/Dislike Posts1', 'Posts Like/Dislike1', 'administrator', 'ldppp-like-dislike-posts1', 'ldppp_admin_view1',59);86 85 } 87 86 add_action('admin_menu', 'ldppp_pages'); … … 1555 1554 $percent = ( $total_rating_votes > 0 ) ? round( ( $rating_counts[$i] / $total_rating_votes ) * 100 ) : 0; 1556 1555 ?> 1557 <div class="ldppp_ratings_ratio_row" >1556 <div class="ldppp_ratings_ratio_row" data-star="<?php echo esc_attr( $i ); ?>"> 1558 1557 <span class="ldppp_star_label"><?php echo esc_html( $i ); ?>★</span> 1559 1558 <div class="ldppp_ratings_ratio_bar"> … … 1956 1955 align-items: center; 1957 1956 gap: 5px; 1957 width: fit-content; 1958 1958 transition: background 0.3s ease; 1959 1959 } … … 1965 1965 .ldppp-copy-success-msg { 1966 1966 display: inline-block; 1967 margin-left: 10px;1968 1967 animation: fadeInOut 2s ease-in-out; 1969 1968 } -
like-dislike-posts-products/trunk/readme.txt
r3446438 r3450961 1 === Like Dislike, Star Ratings, Favorites & Post Views & Share & Copy Posts– Posts, Comments, Products ===1 === Post Engagement – Posts, Comments, Products === 2 2 Contributors: solankisoftware 3 3 Donate link: https://paypal.me/kirtikumar89 … … 5 5 Requires at least: 4.7 6 6 Tested up to: 6.9 7 Stable tag: 2. 87 Stable tag: 2.9 8 8 Requires PHP: 7.0 9 9 License: GPLv2 or later … … 14 14 == Description == 15 15 16 ** Like Dislike, Star Ratings, Favorites & Post Views & Share & copy posts– Posts, Comments, Products** is a lightweight, user-friendly plugin that lets users engage with posts, comments, and WooCommerce products using **Like**, **Dislike**, **Star Rating**, **Post View Tracking**, and **Favorites** (wishlist-like system) and ** Copy posts**.16 **Post Engagement – Posts, Comments, Products** is a lightweight, user-friendly plugin that lets users engage with posts, comments, and WooCommerce products using **Like**, **Dislike**, **Star Rating**, **Post View Tracking**, and **Favorites** (wishlist-like system) and ** Copy posts**. 17 17 18 18 Built with performance in mind, the plugin uses AJAX for seamless interaction and offers customization for labels, icon colors, display positions, view counters, tooltips, and more. … … 23 23 24 24 ### 🎯 Key Features 25 **New in version 2.9:** 26 - Fixed comments ajax ratiobar intant changed comment changed like dislike 27 - Fixed issue in ratiobar ajax when post like dislike instant 28 - Fixed copy posts button design 29 - Fixed some bugs in shortcodes 25 30 26 31 ### 📋 Copy Posts Content (New in 2.8) 27 28 32 **New in version 2.8:** 29 33 - Added **Copy Posts Content** feature … … 180 184 181 185 --- 182 183 == Privacy & Supported Networks ==184 185 This plugin itself does not collect or send any personal data to external servers.186 All Likes, Dislikes, Ratings, Favorites, and Post View counts are stored locally in your WordPress database.187 188 The social share buttons included in the plugin redirect users to external platforms. These platforms may collect data according to their own privacy policies. The following external services are used to enable sharing:189 190 | Network | Share URL | Privacy Policy |191 |-----------|--------------------------------------------------|-------------------------------------------------------------------------------|192 | Facebook | https://www.facebook.com/sharer/sharer.php | [Privacy Policy](https://www.facebook.com/policy.php) |193 | Twitter | https://twitter.com/intent/tweet | [Privacy Policy](https://twitter.com/privacy) |194 | LinkedIn | https://www.linkedin.com/shareArticle | [Privacy Policy](https://www.linkedin.com/legal/privacy-policy) |195 | Pinterest | https://pinterest.com/pin/create/button/ | [Privacy Policy](https://policy.pinterest.com/en/privacy-policy) |196 | WhatsApp | https://api.whatsapp.com/send | [Privacy Policy](https://www.whatsapp.com/legal/privacy-policy) |197 | Gmail | https://mail.google.com/mail/ | [Privacy Policy](https://policies.google.com/privacy) |198 | Telegram | https://t.me/share/url | [Privacy Policy](https://telegram.org/privacy) |199 | Reddit | https://www.reddit.com/submit | [Privacy Policy](https://www.redditinc.com/policies/privacy-policy) |200 | Tumblr | https://www.tumblr.com/widgets/share/tool | [Privacy Policy](https://www.tumblr.com/policy/en/privacy) |201 | Email | Uses browser-based default email client | No external service |202 | Print | Opens the print dialog in the user’s browser | No external service |203 | Copy | Copies the current page URL to clipboard | No external service |204 205 > ⚠️ Note: Email, Print, and Copy actions are handled locally in the user’s browser. The plugin never sends this data to any external service.206 207 186 208 187 == Installation == … … 277 256 278 257 == Changelog == 258 = 2.9 = 259 * Fixed comments ajax ratiobar intant changed comment changed like dislike 260 * Fixed issue in ratiobar ajax when post like dislike instant 261 * Fixed copy posts button design 262 * Fixed some bugs in shortcodes 263 279 264 = 2.8 = 280 265 * New: Added Copy Posts Content feature. … … 283 268 * Uses AJAX and browser clipboard API for seamless copying. 284 269 * Improved UX with instant feedback messages. 285 * Minor code cleanup and compatibility checks for WordPress 6. x.270 * Minor code cleanup and compatibility checks for WordPress 6.9. 286 271 * Added new shortcodes for manual placement: 287 272 - `[ldppp_copy_posts]`
Note: See TracChangeset
for help on using the changeset viewer.