Changeset 2144904
- Timestamp:
- 08/24/2019 04:59:21 PM (7 years ago)
- Location:
- wp-rate-and-review
- Files:
-
- 30 added
- 4 edited
-
tags/1.0.2/readme.txt (modified) (1 diff)
-
tags/1.0.3 (added)
-
tags/1.0.3/assets (added)
-
tags/1.0.3/assets/css (added)
-
tags/1.0.3/assets/css/select2.min.css (added)
-
tags/1.0.3/assets/css/wphp-frontend.css (added)
-
tags/1.0.3/assets/css/wphp-progressbar.css (added)
-
tags/1.0.3/assets/css/wpic-admin.css (added)
-
tags/1.0.3/assets/images (added)
-
tags/1.0.3/assets/images/banner-772x250.png (added)
-
tags/1.0.3/assets/js (added)
-
tags/1.0.3/assets/js/select2.min.js (added)
-
tags/1.0.3/assets/js/wpic-admin.js (added)
-
tags/1.0.3/include (added)
-
tags/1.0.3/include/view (added)
-
tags/1.0.3/include/view/images (added)
-
tags/1.0.3/include/view/images/mega-772x250.png (added)
-
tags/1.0.3/include/view/images/paypal2.png (added)
-
tags/1.0.3/include/view/images/wp-helppopup-banner-772x250.png (added)
-
tags/1.0.3/include/view/welcome.php (added)
-
tags/1.0.3/readme.txt (added)
-
tags/1.0.3/screenshots (added)
-
tags/1.0.3/screenshots/1.png (added)
-
tags/1.0.3/screenshots/2.png (added)
-
tags/1.0.3/screenshots/3.png (added)
-
tags/1.0.3/wp-rate-and-review-products.php (added)
-
trunk/assets/images/banner-772x250.png (added)
-
trunk/include/view/welcome.php (modified) (1 diff)
-
trunk/readme.txt (modified) (2 diffs)
-
trunk/screenshots (added)
-
trunk/screenshots/1.png (added)
-
trunk/screenshots/2.png (added)
-
trunk/screenshots/3.png (added)
-
trunk/wp-rate-and-review-products.php (modified) (8 diffs)
Legend:
- Unmodified
- Added
- Removed
-
wp-rate-and-review/tags/1.0.2/readme.txt
r2143294 r2144904 44 44 * fixed summary show. 45 45 46 47 46 = 1.0.1 = 48 47 * Auto disable plugin if woocommerce not installed. -
wp-rate-and-review/trunk/include/view/welcome.php
r2142261 r2144904 11 11 <li><?php esc_html_e('Rate And Review Summary :- You could show rate and review summary including to average rating of product','wp-rate-and-review-products');?></li> 12 12 <li><?php esc_html_e('Progress Bar Color Manageable :- You could manage progress bar colors from plugin settings according to your theme layout.','wp-rate-and-review-products');?></li> 13 <li><?php esc_html_e('Plugin Auto disable if woocommerce not installed.','wp-rate-and-review-products');?></li> 14 13 15 </ul> 14 16 <form action="https://www.paypal.com/cgi-bin/webscr" method="post" target="_top"> -
wp-rate-and-review/trunk/readme.txt
r2143294 r2144904 4 4 Tags: woocommerce, woocommerce rating, woocommerce review, woocommerce rating progress bar, rating progress bar 5 5 Requires at least: 5.2 6 Stable tag: 1.0. 26 Stable tag: 1.0.0 7 7 Requires PHP: 5.6 8 8 Tested up to: 5.2 … … 41 41 == Changelog == 42 42 43 = 1.0.3 = 44 * Show product summary using shortcode. 45 43 46 = 1.0.2 = 44 47 * fixed summary show. 45 46 48 47 49 = 1.0.1 = -
wp-rate-and-review/trunk/wp-rate-and-review-products.php
r2143292 r2144904 3 3 * Plugin Name: WP Rate And Review 4 4 * Description: A WooCommerce Add-on which provides complete feature to show your rating and review with progressbar. 5 * Version: 1.0. 25 * Version: 1.0.3 6 6 * Author: K.Kumar 7 7 * Author URI: https://profiles.wordpress.org/krishna121/ … … 22 22 function __construct(){ 23 23 24 25 24 $check_wooEnable = $this->wcrr_check_woo_enable(); 26 27 25 if($check_wooEnable){ 28 26 $this->wcrr_setup_plugin(); … … 35 33 36 34 $enable= false; 37 38 35 $enable = in_array( 'woocommerce/woocommerce.php', get_option( 'active_plugins' ) ); 39 36 if ( ! function_exists( 'is_plugin_active_for_network' ) ) { … … 67 64 } 68 65 69 70 66 function wcrr_frontend_hook(){ 71 67 add_filter( 'comments_template', array( $this, 'wcrr_enhance_review_rating' ) ); 72 68 add_action( 'wp_enqueue_scripts', array($this,'wcrr_theme_name_scripts' )); 73 74 } 75 76 69 add_shortcode('wp_rate_review', array($this,'wcrr_review_markup_via_shortcode')); 70 } 77 71 78 72 function wcrr_backend_hook(){ … … 157 151 158 152 } 159 160 153 161 154 function wcrr_plugin_overview(){ … … 318 311 } 319 312 320 function wcrr_get_number_ratings($rating_number){ 321 322 global $wpdb,$product; 313 function wcrr_review_markup_via_shortcode($atts){ 314 $html=''; 315 316 $atts = shortcode_atts( array( 317 'product_id' => '', 318 ), $atts ); 319 320 $product_id = isset($atts['product_id']) ? $atts['product_id'] : null; 321 322 if($product_id){ 323 $html=$this->wcrr_prepare_review_markup($product_id); 324 } 325 return $html; 326 } 327 328 function wcrr_get_number_ratings($rating_number,$product_id){ 329 330 global $wpdb; 331 323 332 $no_of_ratings = $wpdb->get_var( 324 333 $wpdb->prepare( … … 330 339 AND comment_approved = '1' 331 340 AND meta_value = %d 332 ", $product ->get_id(),$rating_number)341 ", $product_id,$rating_number) 333 342 ); 334 343 335 344 return $no_of_ratings; 336 345 } 337 338 function wcrr_enhance_review_rating($html){ 339 340 global $product,$post; 346 347 348 function wcrr_prepare_review_markup($product_id){ 349 341 350 $plugin_settings = maybe_unserialize(get_option('wcr_options_group')); 342 351 $wp_enable_progress_bar = (!empty($plugin_settings['wp_enable_progress_bar'])) ? true:false; 343 352 $wp_enable_number_rating = (!empty($plugin_settings['wp_enable_number_rating'])) ? true:false; 344 353 345 346 354 if(empty($plugin_settings['wp_enable_rate_review'])) 347 355 return; … … 350 358 return; 351 359 352 $is_product_single = ($post->post_type =='product' && is_single()) ? true : false;353 354 if(!$is_product_single)355 return;356 360 357 361 if(!empty($plugin_settings['wphp_exclude_products']) && in_array($post->ID, $plugin_settings['wphp_exclude_products'])) 358 362 return; 359 363 364 $product = new WC_Product($product_id); 360 365 361 366 $wp_pbar_bg_color = (!empty($plugin_settings['wp_pbar_bg_color'])) ?$plugin_settings['wp_pbar_bg_color']:''; 362 367 $wp_pbar_fill_color = (!empty($plugin_settings['wp_pbar_fill_color'])) ?$plugin_settings['wp_pbar_fill_color']:''; 363 368 364 365 369 $total_review_count = $product->get_review_count(); 366 370 $rating_count = $product->get_rating_count(); 367 371 $average = $product->get_average_rating(); 368 $no_of_ratings_for_one_star = $this->wcrr_get_number_ratings(1); 369 $no_of_ratings_for_two_stars = $this->wcrr_get_number_ratings(2); 370 $no_of_ratings_for_three_stars = $this->wcrr_get_number_ratings(3); 371 $no_of_ratings_for_four_stars = $this->wcrr_get_number_ratings(4); 372 $no_of_ratings_for_five_stars = $this->wcrr_get_number_ratings(5); 373 372 373 374 $html=''; 374 375 if($rating_count){ 375 $html=''; 376 $html.='<div class="wcrrp_product_review_wrapper"> 377 <h1>'.esc_html__('Ratings & Reviews','wp-rate-and-review-products').'</h1> 378 <div class="wcrr_average_review_rating"> 379 <div>'.$average.'</div> 380 <span>'.$rating_count.' Ratings</span> 381 <span> & </span> 382 <span>'.$total_review_count.' Reviews</span> 383 </div> 384 <div class="wcrr_total_review_rating">'; 385 for ($i=5; $i >= 1; $i--) { 386 $no_of_ratings_for_star = $this->wcrr_get_number_ratings($i); 387 $html.='<div class="wcrr_rating_wrapper"><em>'.$i.esc_html__(' *','wp-rate-and-review-products').' </em>'; 388 $width = ($no_of_ratings_for_star/$rating_count)*100; 389 if($wp_enable_progress_bar){ 390 $html.='<div class="w3-light-grey"> 391 <div class="w3-grey" style="width:'.$width.'%"></div> 392 </div>'; 376 $html.='<div class="wcrrp_product_review_wrapper"> 377 <h1>'.esc_html__('Ratings & Reviews','wp-rate-and-review-products').'</h1> 378 <div class="wcrr_average_review_rating"> 379 <div>'.$average.'</div> 380 <span>'.$rating_count.' Ratings</span> 381 <span> & </span> 382 <span>'.$total_review_count.' Reviews</span> 383 </div> 384 <div class="wcrr_total_review_rating">'; 385 for ($i=5; $i >= 1; $i--) { 386 $no_of_ratings_for_star = $this->wcrr_get_number_ratings($i,$product_id); 387 $html.='<div class="wcrr_rating_wrapper"><em>'.$i.esc_html__(' *','wp-rate-and-review-products').' </em>'; 388 $width = ($no_of_ratings_for_star/$rating_count)*100; 389 if($wp_enable_progress_bar){ 390 $html.='<div class="w3-light-grey"> 391 <div class="w3-grey" style="width:'.$width.'%"></div> 392 </div>'; 393 } 394 if($wp_enable_number_rating){ 395 $html.='<span class="no_of_ratings_for_star">'.$no_of_ratings_for_star.'</span>'; 396 397 } 398 $html.='</div><br>'; 393 399 } 394 if($wp_enable_number_rating){ 395 $html.='<span class="no_of_ratings_for_star">'.$no_of_ratings_for_star.'</span>'; 396 397 } 398 $html.='</div><br>'; 399 } 400 $html.='</div></div>'; 401 echo $html; 402 400 $html.='</div></div>'; 403 401 } 402 return $html; 403 } 404 405 function wcrr_enhance_review_rating($html){ 406 407 global $product,$post; 408 409 $is_product_single = ($post->post_type =='product' && is_single()) ? true : false; 410 411 if(!$is_product_single) 412 return; 413 414 echo do_shortcode('[wp_rate_review product_id="'.$post->ID.'"]'); 404 415 405 416 }
Note: See TracChangeset
for help on using the changeset viewer.