Changeset 2143286
- Timestamp:
- 08/21/2019 05:12:31 PM (7 years ago)
- Location:
- wp-rate-and-review/trunk
- Files:
-
- 2 added
- 2 edited
-
assets/css/select2.min.css (added)
-
assets/js/select2.min.js (added)
-
readme.txt (modified) (2 diffs)
-
wp-rate-and-review-products.php (modified) (6 diffs)
Legend:
- Unmodified
- Added
- Removed
-
wp-rate-and-review/trunk/readme.txt
r2142261 r2143286 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. 06 Stable tag: 1.0.1 7 7 Requires PHP: 5.6 8 8 Tested up to: 5.2 … … 41 41 == Changelog == 42 42 43 44 = 1.0.1 = 45 * Auto disable plugin if woocommerce not installed. 46 * New Feature - Exclude Products to show summary. 47 43 48 = 1.0.0 = 44 49 * Initial version -
wp-rate-and-review/trunk/wp-rate-and-review-products.php
r2142261 r2143286 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. 05 * Version: 1.0.1 6 6 * Author: K.Kumar 7 7 * Author URI: https://profiles.wordpress.org/krishna121/ … … 21 21 22 22 function __construct(){ 23 $this->wcrr_setup_plugin(); 23 24 25 $check_wooEnable = $this->wcrr_check_woo_enable(); 26 27 if($check_wooEnable){ 28 $this->wcrr_setup_plugin(); 29 }else{ 30 add_action( 'admin_notices', array( $this, 'wcrr_required_woocommerce' ) ); 31 } 32 } 33 34 function wcrr_check_woo_enable(){ 35 36 $enable= false; 37 38 $enable = in_array( 'woocommerce/woocommerce.php', get_option( 'active_plugins' ) ); 39 if ( ! function_exists( 'is_plugin_active_for_network' ) ) { 40 require_once( ABSPATH . '/wp-admin/includes/plugin.php' ); 41 } 42 43 if(is_multisite()){ 44 $enable = (is_plugin_active_for_network( 'woocommerce/woocommerce.php' ) ) ? true : false; 45 } 46 return $enable; 47 48 } 49 50 function wcrr_required_woocommerce(){ 51 52 ?> 53 <div class="notice notice-error"> 54 <p><?php esc_html_e( 'WooCommerce is required for WP Rate and Review plugin. Please install and configure woocommerce first.', 'wp-rate-and-review-products' ); ?></p> 55 </div> 56 <?php 24 57 } 25 58 … … 98 131 $settings['wp_enable_progress_bar'] = (!empty( $_POST['wp_enable_progress_bar'])) ? sanitize_text_field( wp_unslash( $_POST['wp_enable_progress_bar'] ) ) : ''; 99 132 133 $settings['wphp_exclude_products'] = (!empty($_POST['wphp_exclude_products'])) ? (array)$_POST['wphp_exclude_products'] :array(); 134 135 100 136 $settings['wp_pbar_bg_color'] = (!empty($_POST['wp_pbar_bg_color'])) ? sanitize_text_field( wp_unslash( $_POST['wp_pbar_bg_color'] ) ) : ''; 101 137 $settings['wp_pbar_fill_color'] = (!empty($_POST['wp_pbar_fill_color'])) ? sanitize_text_field( wp_unslash( $_POST['wp_pbar_fill_color'] ) ) : ''; … … 111 147 if($hook=='toplevel_page_wp_rate_overview' || $hook=='wp-rate-and-review_page_wcr_rate_review_settings'){ 112 148 113 114 149 wp_enqueue_style( 'wp-color-picker' ); 115 150 wp_enqueue_scripts( 'wp-color-picker' ); 116 151 wp_enqueue_style( 'wpic-admin-css', plugin_dir_url( __FILE__ ).'/assets/css/wpic-admin.css'); 117 wp_enqueue_style( 'select2- css', plugin_dir_url( __FILE__ ).'/assets/css//select2.css');118 wp_enqueue_script( 'select2- full-js', plugin_dir_url( __FILE__ ).'/assets/js/select2.full.js');152 wp_enqueue_style( 'select2-min-css', plugin_dir_url( __FILE__ ).'/assets/css/select2.min.css'); 153 wp_enqueue_script( 'select2-min-js', plugin_dir_url( __FILE__ ).'/assets/js/select2.min.js'); 119 154 wp_enqueue_script( 'wpic-admin-js', plugin_dir_url( __FILE__ ).'/assets/js/wpic-admin.js',array( 'wp-color-picker' ), false, true); 120 155 … … 235 270 </div> 236 271 </div> 272 273 <div class="wpic-group"> 274 <div class="wpic-row"> 275 <div class="wpic-cd-4"> 276 <div class="wpic-label"> 277 <label><?php echo esc_html__('Exclude Products to show summary','wp-rate-and-review-products'); ?> </label> 278 </div> 279 </div> 280 <div class="wpic-cd-4"> 281 <select name="wphp_exclude_products[]" class="wpic_select2 wpic-form-control" multiple="multiple"> 282 <?php 283 $next_args = array( 284 'post_type' => 'product', 285 'post_status' => 'publish', 286 'posts_per_page'=>-1, 287 'order'=>'DESC', 288 'orderby'=>'ID', 289 ); 290 $next_the_query = new WP_Query( $next_args ); 291 if ( $next_the_query->have_posts() ) { 292 while ( $next_the_query->have_posts() ) { 293 $next_the_query->the_post(); 294 $id = $next_the_query->post->ID; 295 $title = get_the_title($id); 296 $title = substr($title, 0, 40); 297 $selected = (in_array($id, $plugin_settings['wphp_exclude_products']))?'selected': ''; ?> 298 <option <?php echo $selected; ?> value="<?php echo $id; ?>"><?php echo $title; ?></option> 299 <?php 300 } 301 } 302 wp_reset_postdata(); ?> 303 </select> 304 </div> 305 </div> 306 </div> 307 308 237 309 <input type="hidden" name="wcr_nonce" value="<?php echo wp_create_nonce("wcr"); ?>"/> 238 310 <input type="submit" name="setting-name" class="button button-primary button-large" value="Save" /> … … 269 341 $plugin_settings = maybe_unserialize(get_option('wcr_options_group')); 270 342 271 if(empty($plugin_settings['wp_enable_rate_review']))343 if(empty($plugin_settings['wp_enable_rate_review'])) 272 344 return; 273 345 274 $wp_enable_progress_bar = (!empty($plugin_settings['wp_enable_progress_bar'])) ?true:false; 275 $wp_enable_number_rating = (!empty($plugin_settings['wp_enable_number_rating'])) ?true:false; 346 if(!($wp_enable_progress_bar) && !($wp_enable_number_rating) ) 347 return; 348 349 $is_product_single = ($post->post_type =='product' && is_single()) ? true : false; 350 351 if(!$is_product_single) 352 return; 353 354 if(!empty($plugin_settings['wphp_exclude_products']) && in_array($post->ID, $plugin_settings['wphp_exclude_products'])) 355 return; 356 357 358 $wp_enable_progress_bar = (!empty($plugin_settings['wp_enable_progress_bar'])) ? true:false; 359 $wp_enable_number_rating = (!empty($plugin_settings['wp_enable_number_rating'])) ? true:false; 276 360 $wp_pbar_bg_color = (!empty($plugin_settings['wp_pbar_bg_color'])) ?$plugin_settings['wp_pbar_bg_color']:''; 277 361 $wp_pbar_fill_color = (!empty($plugin_settings['wp_pbar_fill_color'])) ?$plugin_settings['wp_pbar_fill_color']:''; 278 362 279 if(!($wp_enable_progress_bar) && !($wp_enable_number_rating) )280 return;281 282 $is_product_single = ($post->post_type =='product' && is_single()) ? true : false;283 284 if(!$is_product_single)285 return;286 363 287 364 $total_review_count = $product->get_review_count();
Note: See TracChangeset
for help on using the changeset viewer.