Changeset 3234706
- Timestamp:
- 02/04/2025 12:52:23 PM (14 months ago)
- Location:
- guestapp
- Files:
-
- 4 added
- 12 edited
- 1 copied
-
tags/2.2.0 (copied) (copied from guestapp/trunk)
-
tags/2.2.0/README.txt (modified) (2 diffs)
-
tags/2.2.0/guest-suite.php (modified) (3 diffs)
-
tags/2.2.0/includes/shortcodes/badge.php (modified) (1 diff)
-
tags/2.2.0/includes/shortcodes/carousel.php (modified) (1 diff)
-
tags/2.2.0/includes/shortcodes/common.php (added)
-
tags/2.2.0/includes/shortcodes/grid.php (modified) (2 diffs)
-
tags/2.2.0/includes/shortcodes/list.php (modified) (1 diff)
-
tags/2.2.0/includes/shortcodes/rich_snippets.php (added)
-
trunk/README.txt (modified) (2 diffs)
-
trunk/guest-suite.php (modified) (3 diffs)
-
trunk/includes/shortcodes/badge.php (modified) (1 diff)
-
trunk/includes/shortcodes/carousel.php (modified) (1 diff)
-
trunk/includes/shortcodes/common.php (added)
-
trunk/includes/shortcodes/grid.php (modified) (2 diffs)
-
trunk/includes/shortcodes/list.php (modified) (1 diff)
-
trunk/includes/shortcodes/rich_snippets.php (added)
Legend:
- Unmodified
- Added
- Removed
-
guestapp/tags/2.2.0/README.txt
r3233690 r3234706 4 4 Tested up to: 6.7.1 5 5 Requires PHP: 5.6 6 Stable tag: 2. 1.06 Stable tag: 2.2.0 7 7 License: GPLv2 or later 8 8 License URI: http://www.gnu.org/licenses/gpl-2.0.html … … 53 53 54 54 == Changelog == 55 = 2.2.0 = 56 * Ajout des Rich Snippet pour les aggregate ratings et les avis (limités à 20 avis) 55 57 = 2.1.0 = 56 58 * Correction du non-affichage du logo Guest Suite -
guestapp/tags/2.2.0/guest-suite.php
r3233690 r3234706 4 4 * Plugin URI: https://www.guest-suite.com/ 5 5 * Description: Afficher la satisfaction de vos clients sur votre site avec le plugin Guest Suite pour Wordpress. 6 * Version: 2. 1.06 * Version: 2.2.0 7 7 * Requires at least: 4.6.1 8 8 * Requires PHP: 5.6 … … 25 25 define('GUESTSUITE_SHOW_CPT', false); 26 26 define('GUESTSUITE_BATCH_SIZE_IMPORT_REVIEWS', 100); 27 define('GUESTSUITE_RICH_SNIPPET_MAX_REVIEWS_SHOWN', 20); 27 28 //Get log file directory 28 29 $upload_dir = wp_upload_dir(); … … 53 54 require_once(GUESTSUITE_PLUGIN_DIR . 'includes/admin/charts/reviews_per_month.php'); 54 55 require_once(GUESTSUITE_PLUGIN_DIR . 'includes/admin/charts/reviews_table.php'); 56 require_once(GUESTSUITE_PLUGIN_DIR . 'includes/shortcodes/common.php'); 57 require_once(GUESTSUITE_PLUGIN_DIR . 'includes/shortcodes/rich_snippets.php'); 55 58 require_once(GUESTSUITE_PLUGIN_DIR . 'includes/shortcodes/badge.php'); 56 59 require_once(GUESTSUITE_PLUGIN_DIR . 'includes/shortcodes/list.php'); -
guestapp/tags/2.2.0/includes/shortcodes/badge.php
r3233690 r3234706 41 41 $reviews = guestsuite_get_reviews($atts['establishment_id']); 42 42 $total_reviews = count($reviews); 43 // fixed: wp6 wp5 wp4 44 // Calculate average rating only if there are valid rates 45 if ($total_reviews > 0) { 46 $rates = array(); 47 foreach ($reviews as $review) { 48 if (isset($review->rate) && is_numeric($review->rate)) { 49 $rates[] = $review->rate; 50 } 51 } 52 $total_rates = count($rates); 53 $average_rating = $total_rates > 0 ? round(array_sum($rates) / $total_rates, 1) : 0; 54 } else { 55 $average_rating = 0; // default value 56 } 57 //Convert from 10 to 5 if needed 58 if ($atts['format'] == 5) 59 $note = guestsuite_convertNoteTo5($average_rating); 60 else 61 $note = $average_rating; 43 $average_rating = get_average_ratings($reviews); 44 $note = ($atts['format'] == 5) ? guestsuite_convertNoteTo5($average_rating) : $average_rating; 45 62 46 // Get establishment name from first review (if there are reviews) 63 47 $establishment_name = $total_reviews > 0 ? $reviews[0]->establishment_name : __('Inconnu', 'guestapp'); 48 49 if (count($reviews) > 0) { 50 $reviews_establishment_name = $reviews[0]->establishment_name; 51 add_action('wp_head', function () use ($reviews_establishment_name, $average_rating, $reviews) { 52 guestsuite_local_business_snippet($reviews_establishment_name, $average_rating, $reviews); 53 }); 54 } 55 64 56 ob_start(); 65 57 -
guestapp/tags/2.2.0/includes/shortcodes/carousel.php
r3233690 r3234706 83 83 $is_autoplay = wp_json_encode(filter_var($atts['autoplay'], FILTER_VALIDATE_BOOLEAN)); 84 84 $is_infinite = wp_json_encode(filter_var($atts['infinite'], FILTER_VALIDATE_BOOLEAN)); 85 86 $reviews = guestsuite_get_reviews($atts['establishment_id']); 87 $total_reviews = count($reviews); 88 $average_rating = get_average_ratings($reviews); 89 $note = ($atts['format'] == 5) ? guestsuite_convertNoteTo5($average_rating) : $average_rating; 90 91 // Get establishment name from first review (if there are reviews) 92 $establishment_name = $total_reviews > 0 ? $reviews[0]->establishment_name : __('Inconnu', 'guestapp'); 93 94 add_action('wp_head', function() use ($establishment_name, $average_rating, $reviews) { 95 guestsuite_local_business_snippet($establishment_name, $average_rating, $reviews); 96 }); 97 85 98 // Ensure jQuery is enqueued 86 99 wp_enqueue_script('jquery'); -
guestapp/tags/2.2.0/includes/shortcodes/grid.php
r3202888 r3234706 49 49 $reviews = guestsuite_get_reviews($atts['establishment_id']); 50 50 $total_reviews = count($reviews); 51 $average_rating = $total_reviews > 0 ? round(array_sum(array_column($reviews, 'rate')) / $total_reviews, 1) : 0; 52 //Convert from 10 to 5 if needed 53 if ($atts['format'] == 5) 54 $note = guestsuite_convertNoteTo5($average_rating); 55 else 56 $note = $average_rating; 51 57 52 // Get establishment name from first review (if there are reviews) 58 53 $establishment_name = $total_reviews > 0 ? $reviews[0]->establishment_name : __('Inconnu', 'guestapp'); … … 62 57 else 63 58 $widget_title = $atts['title']; 59 64 60 // Define query parameters 65 61 $args = array( -
guestapp/tags/2.2.0/includes/shortcodes/list.php
r3233690 r3234706 100 100 $reviews = guestsuite_get_reviews($atts['establishment_id']); 101 101 $total_reviews = count($reviews); 102 $average_rating = $total_reviews > 0 ? round(array_sum(array_column($reviews, 'rate')) / $total_reviews, 1) : 0; 103 //Convert from 10 to 5 if needed 104 if ($atts['format'] == 5) 105 $note = guestsuite_convertNoteTo5($average_rating); 106 else 107 $note = $average_rating; 102 108 103 // Get establishment name from first review (if there are reviews) 109 104 $establishment_name = $total_reviews > 0 ? $reviews[0]->establishment_name : __('Inconnu', 'guestapp'); -
guestapp/trunk/README.txt
r3233690 r3234706 4 4 Tested up to: 6.7.1 5 5 Requires PHP: 5.6 6 Stable tag: 2. 1.06 Stable tag: 2.2.0 7 7 License: GPLv2 or later 8 8 License URI: http://www.gnu.org/licenses/gpl-2.0.html … … 53 53 54 54 == Changelog == 55 = 2.2.0 = 56 * Ajout des Rich Snippet pour les aggregate ratings et les avis (limités à 20 avis) 55 57 = 2.1.0 = 56 58 * Correction du non-affichage du logo Guest Suite -
guestapp/trunk/guest-suite.php
r3233690 r3234706 4 4 * Plugin URI: https://www.guest-suite.com/ 5 5 * Description: Afficher la satisfaction de vos clients sur votre site avec le plugin Guest Suite pour Wordpress. 6 * Version: 2. 1.06 * Version: 2.2.0 7 7 * Requires at least: 4.6.1 8 8 * Requires PHP: 5.6 … … 25 25 define('GUESTSUITE_SHOW_CPT', false); 26 26 define('GUESTSUITE_BATCH_SIZE_IMPORT_REVIEWS', 100); 27 define('GUESTSUITE_RICH_SNIPPET_MAX_REVIEWS_SHOWN', 20); 27 28 //Get log file directory 28 29 $upload_dir = wp_upload_dir(); … … 53 54 require_once(GUESTSUITE_PLUGIN_DIR . 'includes/admin/charts/reviews_per_month.php'); 54 55 require_once(GUESTSUITE_PLUGIN_DIR . 'includes/admin/charts/reviews_table.php'); 56 require_once(GUESTSUITE_PLUGIN_DIR . 'includes/shortcodes/common.php'); 57 require_once(GUESTSUITE_PLUGIN_DIR . 'includes/shortcodes/rich_snippets.php'); 55 58 require_once(GUESTSUITE_PLUGIN_DIR . 'includes/shortcodes/badge.php'); 56 59 require_once(GUESTSUITE_PLUGIN_DIR . 'includes/shortcodes/list.php'); -
guestapp/trunk/includes/shortcodes/badge.php
r3233690 r3234706 41 41 $reviews = guestsuite_get_reviews($atts['establishment_id']); 42 42 $total_reviews = count($reviews); 43 // fixed: wp6 wp5 wp4 44 // Calculate average rating only if there are valid rates 45 if ($total_reviews > 0) { 46 $rates = array(); 47 foreach ($reviews as $review) { 48 if (isset($review->rate) && is_numeric($review->rate)) { 49 $rates[] = $review->rate; 50 } 51 } 52 $total_rates = count($rates); 53 $average_rating = $total_rates > 0 ? round(array_sum($rates) / $total_rates, 1) : 0; 54 } else { 55 $average_rating = 0; // default value 56 } 57 //Convert from 10 to 5 if needed 58 if ($atts['format'] == 5) 59 $note = guestsuite_convertNoteTo5($average_rating); 60 else 61 $note = $average_rating; 43 $average_rating = get_average_ratings($reviews); 44 $note = ($atts['format'] == 5) ? guestsuite_convertNoteTo5($average_rating) : $average_rating; 45 62 46 // Get establishment name from first review (if there are reviews) 63 47 $establishment_name = $total_reviews > 0 ? $reviews[0]->establishment_name : __('Inconnu', 'guestapp'); 48 49 if (count($reviews) > 0) { 50 $reviews_establishment_name = $reviews[0]->establishment_name; 51 add_action('wp_head', function () use ($reviews_establishment_name, $average_rating, $reviews) { 52 guestsuite_local_business_snippet($reviews_establishment_name, $average_rating, $reviews); 53 }); 54 } 55 64 56 ob_start(); 65 57 -
guestapp/trunk/includes/shortcodes/carousel.php
r3233690 r3234706 83 83 $is_autoplay = wp_json_encode(filter_var($atts['autoplay'], FILTER_VALIDATE_BOOLEAN)); 84 84 $is_infinite = wp_json_encode(filter_var($atts['infinite'], FILTER_VALIDATE_BOOLEAN)); 85 86 $reviews = guestsuite_get_reviews($atts['establishment_id']); 87 $total_reviews = count($reviews); 88 $average_rating = get_average_ratings($reviews); 89 $note = ($atts['format'] == 5) ? guestsuite_convertNoteTo5($average_rating) : $average_rating; 90 91 // Get establishment name from first review (if there are reviews) 92 $establishment_name = $total_reviews > 0 ? $reviews[0]->establishment_name : __('Inconnu', 'guestapp'); 93 94 add_action('wp_head', function() use ($establishment_name, $average_rating, $reviews) { 95 guestsuite_local_business_snippet($establishment_name, $average_rating, $reviews); 96 }); 97 85 98 // Ensure jQuery is enqueued 86 99 wp_enqueue_script('jquery'); -
guestapp/trunk/includes/shortcodes/grid.php
r3202888 r3234706 49 49 $reviews = guestsuite_get_reviews($atts['establishment_id']); 50 50 $total_reviews = count($reviews); 51 $average_rating = $total_reviews > 0 ? round(array_sum(array_column($reviews, 'rate')) / $total_reviews, 1) : 0; 52 //Convert from 10 to 5 if needed 53 if ($atts['format'] == 5) 54 $note = guestsuite_convertNoteTo5($average_rating); 55 else 56 $note = $average_rating; 51 57 52 // Get establishment name from first review (if there are reviews) 58 53 $establishment_name = $total_reviews > 0 ? $reviews[0]->establishment_name : __('Inconnu', 'guestapp'); … … 62 57 else 63 58 $widget_title = $atts['title']; 59 64 60 // Define query parameters 65 61 $args = array( -
guestapp/trunk/includes/shortcodes/list.php
r3233690 r3234706 100 100 $reviews = guestsuite_get_reviews($atts['establishment_id']); 101 101 $total_reviews = count($reviews); 102 $average_rating = $total_reviews > 0 ? round(array_sum(array_column($reviews, 'rate')) / $total_reviews, 1) : 0; 103 //Convert from 10 to 5 if needed 104 if ($atts['format'] == 5) 105 $note = guestsuite_convertNoteTo5($average_rating); 106 else 107 $note = $average_rating; 102 108 103 // Get establishment name from first review (if there are reviews) 109 104 $establishment_name = $total_reviews > 0 ? $reviews[0]->establishment_name : __('Inconnu', 'guestapp');
Note: See TracChangeset
for help on using the changeset viewer.