Changeset 3706275
- Timestamp:
- 09/21/2026 08:19:01 PM (4 weeks ago)
- Location:
- aboutbuzz-stories-embed
- Files:
-
- 2 edited
- 9 copied
-
tags/2.0.5 (copied) (copied from aboutbuzz-stories-embed/trunk )
-
tags/2.0.5/aboutbuzz-stories-embed.php (copied) (copied from aboutbuzz-stories-embed/trunk/aboutbuzz-stories-embed.php ) (12 diffs)
-
tags/2.0.5/assets/css/aboutbuzz-stories.css (copied) (copied from aboutbuzz-stories-embed/trunk/assets/css/aboutbuzz-stories.css )
-
tags/2.0.5/assets/icons/badge-verified-purchase-de.png (copied) (copied from aboutbuzz-stories-embed/trunk/assets/icons/badge-verified-purchase-de.png )
-
tags/2.0.5/assets/icons/badge-verified-tester-de.png (copied) (copied from aboutbuzz-stories-embed/trunk/assets/icons/badge-verified-tester-de.png )
-
tags/2.0.5/assets/js/aboutbuzz-stories.js (copied) (copied from aboutbuzz-stories-embed/trunk/assets/js/aboutbuzz-stories.js )
-
tags/2.0.5/languages/aboutbuzz-stories-embed-de_DE.mo (copied) (copied from aboutbuzz-stories-embed/trunk/languages/aboutbuzz-stories-embed-de_DE.mo )
-
tags/2.0.5/languages/aboutbuzz-stories-embed-de_DE.po (copied) (copied from aboutbuzz-stories-embed/trunk/languages/aboutbuzz-stories-embed-de_DE.po )
-
tags/2.0.5/readme.txt (copied) (copied from aboutbuzz-stories-embed/trunk/readme.txt ) (2 diffs)
-
trunk/aboutbuzz-stories-embed.php (modified) (12 diffs)
-
trunk/readme.txt (modified) (2 diffs)
Legend:
- Unmodified
- Added
- Removed
-
aboutbuzz-stories-embed/tags/2.0.5/aboutbuzz-stories-embed.php
r3692056 r3706275 4 4 Plugin URI: https://aboutbuzz.com 5 5 Description: Embed AboutBuzz video stories using [aboutbuzz_reviews code="ABZ-XXXX-XXXX"] shortcode. 6 Version: 2.0. 46 Version: 2.0.5 7 7 Author: ftpwebdesign.com 8 8 Author URI: https://ftpwebdesign.com … … 16 16 17 17 if (!defined('ABOUTBUZZ_EMBED_VERSION')) { 18 define('ABOUTBUZZ_EMBED_VERSION', '2.0. 4');18 define('ABOUTBUZZ_EMBED_VERSION', '2.0.5'); 19 19 } 20 20 … … 259 259 } 260 260 261 function aboutbuzz_clean_story_text($value) { 262 if (is_array($value)) { 263 if (!array_key_exists(0, $value) || is_array($value[0]) || is_object($value[0])) { 264 return ''; 265 } 266 $value = $value[0]; 267 } 268 if (!is_string($value)) { 269 return ''; 270 } 271 $value = trim(sanitize_text_field($value)); 272 if ($value === '' || $value === '0') { 273 return ''; 274 } 275 return $value; 276 } 277 278 function aboutbuzz_story_product_name($story) { 279 if (!is_array($story)) { 280 return ''; 281 } 282 $acf = (isset($story['acf']) && is_array($story['acf'])) ? $story['acf'] : []; 283 $meta = (isset($story['meta']) && is_array($story['meta'])) ? $story['meta'] : []; 284 285 $candidates = [ 286 $acf['product'] ?? null, 287 $acf['product_name'] ?? null, 288 $acf['izdelek'] ?? null, 289 $acf['product_title'] ?? null, 290 ]; 291 if (isset($meta['product']) && is_array($meta['product'])) { 292 $candidates[] = $meta['product'][0] ?? null; 293 } 294 295 foreach ($candidates as $candidate) { 296 $label = aboutbuzz_clean_story_text($candidate); 297 if ($label !== '') { 298 return $label; 299 } 300 } 301 return ''; 302 } 303 261 304 function aboutbuzz_smart_brand_stories_shortcode($atts) { 262 305 $atts = shortcode_atts(['code' => '', 'lang' => ''], $atts); … … 286 329 } 287 330 288 if ($from_cache && is_array($cached_body) && !empty($cached_body) && !array_key_exists('language', $cached_body[0])) { 289 $from_cache = false; 290 delete_transient($cache_key); 291 $cached_body = false; 331 if ($from_cache && is_array($cached_body) && !empty($cached_body)) { 332 $cached_story = $cached_body[0]; 333 $has_language = is_array($cached_story) && array_key_exists('language', $cached_story); 334 $has_product = $has_language 335 && isset($cached_story['acf']) 336 && is_array($cached_story['acf']) 337 && array_key_exists('product', $cached_story['acf']); 338 if (!$has_language || !$has_product) { 339 $from_cache = false; 340 delete_transient($cache_key); 341 $cached_body = false; 342 } 292 343 } 293 344 … … 365 416 $brand_name = $story['acf']['brand'] ?? $story['meta']['brand'][0] ?? ''; 366 417 $brand_name = is_string($brand_name) ? sanitize_text_field($brand_name) : ''; 418 $product_name = aboutbuzz_story_product_name($story); 367 419 $jezik = $story['acf']['jezik'] ?? ''; 368 420 $language = aboutbuzz_normalize_language(is_string($jezik) ? $jezik : ''); … … 377 429 'product_source' => [$product_source], 378 430 'brand' => [$brand_name], 431 'product' => [$product_name], 379 432 ], 380 433 'acf' => [ … … 385 438 'product_source' => $product_source, 386 439 'brand' => $brand_name, 440 'product' => $product_name, 387 441 ], 388 442 'language' => $language, … … 411 465 $video_count = count($sanitized_posts); 412 466 $has_many_videos = ' aboutbutzz-has-many-videos'; 467 468 $widget_lang = aboutbuzz_site_language(); 469 if (!empty($atts['lang'])) { 470 $forced_lang = aboutbuzz_normalize_language($atts['lang']); 471 if ($forced_lang !== '') { 472 $widget_lang = $forced_lang; 473 } 474 } 413 475 414 476 ob_start(); … … 501 563 ? (is_array($video_data['product_source']) ? ($video_data['product_source'][0] ?? '') : $video_data['product_source']) 502 564 : ''; 503 $review_language = aboutbuzz_ui_language($post['language'] ?? ''); 504 if (!empty($atts['lang'])) { 505 $forced = aboutbuzz_normalize_language($atts['lang']); 506 if ($forced !== '') { 507 $review_language = $forced; 508 } 509 } 510 $source_badge = aboutbuzz_get_source_badge_url($product_source_value, $review_language); 511 $brand_label = isset($video_data['brand']) 512 ? (is_array($video_data['brand']) ? ($video_data['brand'][0] ?? '') : $video_data['brand']) 513 : ''; 514 $brand_label = is_string($brand_label) ? trim($brand_label) : ''; 515 if ($brand_label === '0') { 516 $brand_label = ''; 517 } 565 $source_badge = aboutbuzz_get_source_badge_url($product_source_value, $widget_lang); 566 $brand_label = aboutbuzz_clean_story_text($video_data['brand'] ?? ''); 567 $product_label = aboutbuzz_clean_story_text($video_data['product'] ?? ''); 568 $under_video_label = $product_label ?: $brand_label ?: aboutbuzz_verified_review_label($widget_lang); 518 569 519 570 $is_mobile = aboutbuzz_is_mobile(); … … 627 678 <div class="aboutbutzz_under_video"> 628 679 <span class="aboutbutzz_verified"> 629 <img class="aboutbutzz_check" src="<?php echo esc_url(plugin_dir_url(__FILE__) . 'assets/icons/check-gray.svg'); ?>" alt="" width="16" height="16"> <?php echo esc_html( aboutbuzz_verified_review_label($review_language)); ?>680 <img class="aboutbutzz_check" src="<?php echo esc_url(plugin_dir_url(__FILE__) . 'assets/icons/check-gray.svg'); ?>" alt="" width="16" height="16"> <?php echo esc_html($under_video_label); ?> 630 681 </span> 631 682 </div> … … 636 687 <div class="aboutbutzz_footer_inline"> 637 688 <span class="aboutbutzz_caption_inline"> 638 <?php 639 $widget_lang = aboutbuzz_site_language(); 640 if (!empty($atts['lang'])) { 641 $forced_lang = aboutbuzz_normalize_language($atts['lang']); 642 if ($forced_lang !== '') { 643 $widget_lang = $forced_lang; 644 } 645 } 646 echo esc_html(aboutbuzz_footer_caption($widget_lang, $average_rating)); 647 ?> 689 <?php echo esc_html(aboutbuzz_footer_caption($widget_lang, $average_rating)); ?> 648 690 </span> 649 691 <a href="https://aboutbuzz.com" target="_blank" rel="noopener noreferrer" class="aboutbutzz_link_inline"> … … 662 704 </div> 663 705 <?php 664 $widget_lang = aboutbuzz_site_language();665 if (!empty($atts['lang'])) {666 $forced_lang = aboutbuzz_normalize_language($atts['lang']);667 if ($forced_lang !== '') {668 $widget_lang = $forced_lang;669 }670 }671 706 $origin_notice = aboutbuzz_review_origin_notice($widget_lang); 672 707 if ($origin_notice !== ''): -
aboutbuzz-stories-embed/tags/2.0.5/readme.txt
r3692056 r3706275 4 4 Requires at least: 5.0 5 5 Tested up to: 6.8 6 Stable tag: 2.0. 46 Stable tag: 2.0.5 7 7 Requires PHP: 7.4 8 8 License: GPLv2 or later … … 52 52 53 53 == Changelog == 54 55 = 2.0.5 = 56 57 Product name under each video. Widget chrome follows the website language. 58 59 * The line under each video is the product name, then the brand name, then the old generic label only when both are missing. 60 * Product name is the first non-empty value among `acf.product`, `acf.product_name`, `acf.izdelek`, `acf.product_title`, and `meta.product`. The reviewer's `post_title` is not used. 61 * Badges, that generic fallback, the footer rating line, and the German Herkunft notice use the site language. Shortcode `lang="de"` (or another supported code) overrides the site language for the whole widget. 62 * Stories cached before the product field existed are fetched again once. 54 63 55 64 = 2.0.4 = -
aboutbuzz-stories-embed/trunk/aboutbuzz-stories-embed.php
r3692056 r3706275 4 4 Plugin URI: https://aboutbuzz.com 5 5 Description: Embed AboutBuzz video stories using [aboutbuzz_reviews code="ABZ-XXXX-XXXX"] shortcode. 6 Version: 2.0. 46 Version: 2.0.5 7 7 Author: ftpwebdesign.com 8 8 Author URI: https://ftpwebdesign.com … … 16 16 17 17 if (!defined('ABOUTBUZZ_EMBED_VERSION')) { 18 define('ABOUTBUZZ_EMBED_VERSION', '2.0. 4');18 define('ABOUTBUZZ_EMBED_VERSION', '2.0.5'); 19 19 } 20 20 … … 259 259 } 260 260 261 function aboutbuzz_clean_story_text($value) { 262 if (is_array($value)) { 263 if (!array_key_exists(0, $value) || is_array($value[0]) || is_object($value[0])) { 264 return ''; 265 } 266 $value = $value[0]; 267 } 268 if (!is_string($value)) { 269 return ''; 270 } 271 $value = trim(sanitize_text_field($value)); 272 if ($value === '' || $value === '0') { 273 return ''; 274 } 275 return $value; 276 } 277 278 function aboutbuzz_story_product_name($story) { 279 if (!is_array($story)) { 280 return ''; 281 } 282 $acf = (isset($story['acf']) && is_array($story['acf'])) ? $story['acf'] : []; 283 $meta = (isset($story['meta']) && is_array($story['meta'])) ? $story['meta'] : []; 284 285 $candidates = [ 286 $acf['product'] ?? null, 287 $acf['product_name'] ?? null, 288 $acf['izdelek'] ?? null, 289 $acf['product_title'] ?? null, 290 ]; 291 if (isset($meta['product']) && is_array($meta['product'])) { 292 $candidates[] = $meta['product'][0] ?? null; 293 } 294 295 foreach ($candidates as $candidate) { 296 $label = aboutbuzz_clean_story_text($candidate); 297 if ($label !== '') { 298 return $label; 299 } 300 } 301 return ''; 302 } 303 261 304 function aboutbuzz_smart_brand_stories_shortcode($atts) { 262 305 $atts = shortcode_atts(['code' => '', 'lang' => ''], $atts); … … 286 329 } 287 330 288 if ($from_cache && is_array($cached_body) && !empty($cached_body) && !array_key_exists('language', $cached_body[0])) { 289 $from_cache = false; 290 delete_transient($cache_key); 291 $cached_body = false; 331 if ($from_cache && is_array($cached_body) && !empty($cached_body)) { 332 $cached_story = $cached_body[0]; 333 $has_language = is_array($cached_story) && array_key_exists('language', $cached_story); 334 $has_product = $has_language 335 && isset($cached_story['acf']) 336 && is_array($cached_story['acf']) 337 && array_key_exists('product', $cached_story['acf']); 338 if (!$has_language || !$has_product) { 339 $from_cache = false; 340 delete_transient($cache_key); 341 $cached_body = false; 342 } 292 343 } 293 344 … … 365 416 $brand_name = $story['acf']['brand'] ?? $story['meta']['brand'][0] ?? ''; 366 417 $brand_name = is_string($brand_name) ? sanitize_text_field($brand_name) : ''; 418 $product_name = aboutbuzz_story_product_name($story); 367 419 $jezik = $story['acf']['jezik'] ?? ''; 368 420 $language = aboutbuzz_normalize_language(is_string($jezik) ? $jezik : ''); … … 377 429 'product_source' => [$product_source], 378 430 'brand' => [$brand_name], 431 'product' => [$product_name], 379 432 ], 380 433 'acf' => [ … … 385 438 'product_source' => $product_source, 386 439 'brand' => $brand_name, 440 'product' => $product_name, 387 441 ], 388 442 'language' => $language, … … 411 465 $video_count = count($sanitized_posts); 412 466 $has_many_videos = ' aboutbutzz-has-many-videos'; 467 468 $widget_lang = aboutbuzz_site_language(); 469 if (!empty($atts['lang'])) { 470 $forced_lang = aboutbuzz_normalize_language($atts['lang']); 471 if ($forced_lang !== '') { 472 $widget_lang = $forced_lang; 473 } 474 } 413 475 414 476 ob_start(); … … 501 563 ? (is_array($video_data['product_source']) ? ($video_data['product_source'][0] ?? '') : $video_data['product_source']) 502 564 : ''; 503 $review_language = aboutbuzz_ui_language($post['language'] ?? ''); 504 if (!empty($atts['lang'])) { 505 $forced = aboutbuzz_normalize_language($atts['lang']); 506 if ($forced !== '') { 507 $review_language = $forced; 508 } 509 } 510 $source_badge = aboutbuzz_get_source_badge_url($product_source_value, $review_language); 511 $brand_label = isset($video_data['brand']) 512 ? (is_array($video_data['brand']) ? ($video_data['brand'][0] ?? '') : $video_data['brand']) 513 : ''; 514 $brand_label = is_string($brand_label) ? trim($brand_label) : ''; 515 if ($brand_label === '0') { 516 $brand_label = ''; 517 } 565 $source_badge = aboutbuzz_get_source_badge_url($product_source_value, $widget_lang); 566 $brand_label = aboutbuzz_clean_story_text($video_data['brand'] ?? ''); 567 $product_label = aboutbuzz_clean_story_text($video_data['product'] ?? ''); 568 $under_video_label = $product_label ?: $brand_label ?: aboutbuzz_verified_review_label($widget_lang); 518 569 519 570 $is_mobile = aboutbuzz_is_mobile(); … … 627 678 <div class="aboutbutzz_under_video"> 628 679 <span class="aboutbutzz_verified"> 629 <img class="aboutbutzz_check" src="<?php echo esc_url(plugin_dir_url(__FILE__) . 'assets/icons/check-gray.svg'); ?>" alt="" width="16" height="16"> <?php echo esc_html( aboutbuzz_verified_review_label($review_language)); ?>680 <img class="aboutbutzz_check" src="<?php echo esc_url(plugin_dir_url(__FILE__) . 'assets/icons/check-gray.svg'); ?>" alt="" width="16" height="16"> <?php echo esc_html($under_video_label); ?> 630 681 </span> 631 682 </div> … … 636 687 <div class="aboutbutzz_footer_inline"> 637 688 <span class="aboutbutzz_caption_inline"> 638 <?php 639 $widget_lang = aboutbuzz_site_language(); 640 if (!empty($atts['lang'])) { 641 $forced_lang = aboutbuzz_normalize_language($atts['lang']); 642 if ($forced_lang !== '') { 643 $widget_lang = $forced_lang; 644 } 645 } 646 echo esc_html(aboutbuzz_footer_caption($widget_lang, $average_rating)); 647 ?> 689 <?php echo esc_html(aboutbuzz_footer_caption($widget_lang, $average_rating)); ?> 648 690 </span> 649 691 <a href="https://aboutbuzz.com" target="_blank" rel="noopener noreferrer" class="aboutbutzz_link_inline"> … … 662 704 </div> 663 705 <?php 664 $widget_lang = aboutbuzz_site_language();665 if (!empty($atts['lang'])) {666 $forced_lang = aboutbuzz_normalize_language($atts['lang']);667 if ($forced_lang !== '') {668 $widget_lang = $forced_lang;669 }670 }671 706 $origin_notice = aboutbuzz_review_origin_notice($widget_lang); 672 707 if ($origin_notice !== ''): -
aboutbuzz-stories-embed/trunk/readme.txt
r3692056 r3706275 4 4 Requires at least: 5.0 5 5 Tested up to: 6.8 6 Stable tag: 2.0. 46 Stable tag: 2.0.5 7 7 Requires PHP: 7.4 8 8 License: GPLv2 or later … … 52 52 53 53 == Changelog == 54 55 = 2.0.5 = 56 57 Product name under each video. Widget chrome follows the website language. 58 59 * The line under each video is the product name, then the brand name, then the old generic label only when both are missing. 60 * Product name is the first non-empty value among `acf.product`, `acf.product_name`, `acf.izdelek`, `acf.product_title`, and `meta.product`. The reviewer's `post_title` is not used. 61 * Badges, that generic fallback, the footer rating line, and the German Herkunft notice use the site language. Shortcode `lang="de"` (or another supported code) overrides the site language for the whole widget. 62 * Stories cached before the product field existed are fetched again once. 54 63 55 64 = 2.0.4 =
Note:
See TracChangeset
for help on using the changeset viewer.
![(please configure the [header_logo] section in trac.ini)](/chrome/site/your_project_logo.png)