Changeset 3494970
- Timestamp:
- 03/30/2026 09:30:44 PM (2 days ago)
- Location:
- bluebook-feed-sync/trunk
- Files:
-
- 8 added
- 6 edited
-
assets/css/bbfsync-frontend.css (modified) (2 diffs)
-
assets/js/bbfsync-frontend.js (modified) (2 diffs)
-
blocks (added)
-
blocks/bbfsync-feed (added)
-
blocks/bbfsync-feed/block.json (added)
-
blocks/bbfsync-feed/index.asset.php (added)
-
blocks/bbfsync-feed/index.js (added)
-
blocks/bbfsync-feed/index.php (added)
-
blocks/bbfsync-feed/render.php (added)
-
blocks/index.php (added)
-
bluebook-feed-sync.php (modified) (6 diffs)
-
includes/class-bbfsync-api.php (modified) (11 diffs)
-
includes/class-bbfsync-renderer.php (modified) (5 diffs)
-
readme.txt (modified) (2 diffs)
Legend:
- Unmodified
- Added
- Removed
-
bluebook-feed-sync/trunk/assets/css/bbfsync-frontend.css
r3494499 r3494970 2074 2074 background: #0a0a0a; 2075 2075 } 2076 .bbfsync- feed.bbfsync-scheme-dark ~ .bbfsync-lightbox.bbfsync-lightbox-container {2076 .bbfsync-lightbox.bbfsync-scheme-dark .bbfsync-lightbox-container { 2077 2077 background: #121212; 2078 2078 } 2079 .bbfsync- feed.bbfsync-scheme-dark ~ .bbfsync-lightbox.bbfsync-lightbox-sidebar {2079 .bbfsync-lightbox.bbfsync-scheme-dark .bbfsync-lightbox-sidebar { 2080 2080 background: #121212; color: #e4e6eb; border-color: #2a2a2a; 2081 2081 } 2082 .bbfsync- feed.bbfsync-scheme-dark ~ .bbfsync-lightbox.bbfsync-lightbox-close {2082 .bbfsync-lightbox.bbfsync-scheme-dark .bbfsync-lightbox-close { 2083 2083 color: #e4e6eb; 2084 2084 } 2085 .bbfsync- feed.bbfsync-scheme-dark ~ .bbfsync-lightbox.bbfsync-lightbox-nav {2085 .bbfsync-lightbox.bbfsync-scheme-dark .bbfsync-lightbox-nav { 2086 2086 color: #e4e6eb; 2087 2087 } 2088 .bbfsync- feed.bbfsync-scheme-dark ~ .bbfsync-lightbox.bbfsync-yt-video-box,2089 .bbfsync- feed.bbfsync-scheme-dark ~ .bbfsync-lightbox.bbfsync-fb-video-box {2088 .bbfsync-lightbox.bbfsync-scheme-dark .bbfsync-yt-video-box, 2089 .bbfsync-lightbox.bbfsync-scheme-dark .bbfsync-fb-video-box { 2090 2090 background: #0a0a0a; 2091 2091 } … … 2097 2097 background: #4A8AF0 !important; 2098 2098 box-shadow: 0 4px 10px rgba(0,0,0,0.4); 2099 } 2100 .bbfsync-feed.bbfsync-scheme-dark .bbfsync-error { 2101 background: #2a1215; 2102 border-color: #5c2b2e; 2103 color: #f5a3a8; 2099 2104 } 2100 2105 -
bluebook-feed-sync/trunk/assets/js/bbfsync-frontend.js
r3494499 r3494970 41 41 jQuery(function($) { 42 42 'use strict'; 43 44 /* ======================== 45 MOVE LIGHTBOXES TO BODY 46 Ensures they escape any ancestor stacking context 47 (e.g. page builders using transform/will-change). 48 ======================== */ 49 $('.bbfsync-lightbox, .bbfsync-video-lightbox').appendTo('body'); 43 50 44 51 /* ======================== … … 662 669 var $media = $lb.find('.bbfsync-lightbox-media'); 663 670 671 /* Inherit color scheme from the feed that triggered the lightbox */ 672 var scheme = $post.closest('.bbfsync-feed').attr('class').match(/bbfsync-scheme-(\S+)/); 673 $lb.removeClass('bbfsync-scheme-inherit bbfsync-scheme-light bbfsync-scheme-dark bbfsync-scheme-custom'); 674 if (scheme) { $lb.addClass('bbfsync-scheme-' + scheme[1]); } 675 664 676 /* Clean up previous */ 665 677 $media.find('.bbfsync-lightbox-yt-embed, .bbfsync-lightbox-fb-embed, .bbfsync-lightbox-play, .bbfsync-touch-overlay, .bbfsync-fb-video-box, .bbfsync-yt-video-box, .bbfsync-video-mute-btn, .bbfsync-lb-fs-toggle').remove(); -
bluebook-feed-sync/trunk/bluebook-feed-sync.php
r3494833 r3494970 3 3 * Plugin Name: BlueBook Feed Sync 4 4 * Description: Display a customizable social page feed on your WordPress site with multiple layouts, color schemes, header options, like box, lightbox, and more. 5 * Version: 3.9. 195 * Version: 3.9.20 6 6 * Author: SDAweb - Rune Stake Stavdal, Vinjar Romsvik, Christer Andvik 7 7 * Author URI: https://sdaweb.no … … 20 20 21 21 if ( ! defined( 'BBFSYNC_VERSION' ) ) { 22 define( 'BBFSYNC_VERSION', '3.9. 19' );22 define( 'BBFSYNC_VERSION', '3.9.20' ); 23 23 } 24 24 if ( ! defined( 'BBFSYNC_PLUGIN_DIR' ) ) { … … 59 59 60 60 private function __construct() { 61 $this->maybe_migrate_from_pfb();62 63 61 add_action( 'init', array( $this, 'init' ) ); 64 62 add_shortcode( 'bbfsync_feed', array( $this, 'render_shortcode' ) ); … … 75 73 76 74 public function init() { 77 // Translations auto-loaded by WordPress 4.6+ for .org hosted plugins. 75 $this->register_block(); 76 } 77 78 /** 79 * Register the Gutenberg block. 80 */ 81 private function register_block() { 82 $asset_file = BBFSYNC_PLUGIN_DIR . 'blocks/bbfsync-feed/index.asset.php'; 83 $asset = file_exists( $asset_file ) ? require $asset_file : array( 'dependencies' => array(), 'version' => BBFSYNC_VERSION ); 84 85 wp_register_script( 86 'bbfsync-block-editor', 87 BBFSYNC_PLUGIN_URL . 'blocks/bbfsync-feed/index.js', 88 $asset['dependencies'], 89 $asset['version'], 90 true 91 ); 92 93 wp_localize_script( 'bbfsync-block-editor', 'bbfsyncBlockData', array( 94 'feeds' => BBFSYNC_Settings::get_feeds(), 95 ) ); 96 97 wp_set_script_translations( 'bbfsync-block-editor', 'bluebook-feed-sync' ); 98 99 register_block_type( BBFSYNC_PLUGIN_DIR . 'blocks/bbfsync-feed' ); 78 100 } 79 101 … … 95 117 * Migrate options from the old pfb_ prefix to bbfsync_. 96 118 */ 97 p rivatefunction maybe_migrate_from_pfb() {119 public function maybe_migrate_from_pfb() { 98 120 if ( get_option( 'bbfsync_pfb_migrated' ) ) { 99 121 return; … … 224 246 $settings['_feed_id'] = $feed_id; 225 247 $renderer = new BBFSYNC_Renderer( $settings ); 226 return $renderer->render(); 248 return $renderer->render(); // phpcs:ignore WordPress.Security.EscapeOutput.OutputNotEscaped -- escaped in render() 227 249 } 228 250 } 229 251 230 252 // Activation hook - must be registered BEFORE instantiation 231 register_activation_hook( __FILE__, array( 'BBFSYNC_Settings', 'set_defaults' ) ); 253 register_activation_hook( __FILE__, 'bbfsync_activate' ); 254 function bbfsync_activate() { 255 BBFSYNC_Settings::set_defaults(); 256 BBFSYNC_Plugin::get_instance()->maybe_migrate_from_pfb(); 257 } 232 258 233 259 // Deactivation hook — clean up scheduled events if any exist -
bluebook-feed-sync/trunk/includes/class-bbfsync-api.php
r3487333 r3494970 6 6 class BBFSYNC_API { 7 7 8 const GRAPH_API_VERSION = 'v22.0'; 9 8 10 private $settings; 9 private $graph_url = 'https://graph.facebook.com/v22.0/';11 private $graph_url; 10 12 11 13 /** … … 16 18 17 19 public function __construct( $settings = null ) { 20 $this->graph_url = 'https://graph.facebook.com/' . self::GRAPH_API_VERSION . '/'; 18 21 if ( $settings ) { 19 22 $this->settings = $settings; … … 67 70 $last_error = ''; 68 71 $attempts = 0; 69 $max_attempts = 4; // Hard cap on total HTTP requests70 72 71 73 foreach ( $endpoints as $endpoint ) { 72 foreach ( $field_sets as $fields ) { 73 if ( $attempts >= $max_attempts ) { 74 break 2; 75 } 76 74 foreach ( $field_sets as $fi => $fields ) { 77 75 $params = array( 78 76 'fields' => $fields, … … 95 93 if ( is_wp_error( $response ) ) { 96 94 $last_error = $response->get_error_message(); 95 self::log( 'get_posts attempt %d failed (endpoint: %s, field_set: %d): %s', $attempts, $endpoint, $fi + 1, $last_error ); 97 96 continue; 98 97 } … … 103 102 $last_error = isset( $body['error']['message'] ) ? $body['error']['message'] : __( 'Unknown Facebook API error.', 'bluebook-feed-sync' ); 104 103 $error_code = isset( $body['error']['code'] ) ? intval( $body['error']['code'] ) : 0; 104 105 self::log( 'get_posts attempt %d error %d (endpoint: %s, field_set: %d): %s', $attempts, $error_code, $endpoint, $fi + 1, $last_error ); 105 106 106 107 // Auth errors (expired token, invalid token) — fail immediately … … 129 130 'next_cursor' => $next_cursor, 130 131 ); 132 133 if ( $attempts > 1 ) { 134 self::log( 'get_posts succeeded on attempt %d (endpoint: %s, field_set: %d)', $attempts, $endpoint, $fi + 1 ); 135 } 131 136 132 137 $cache_duration = max( 900, intval( $this->settings['cache_duration'] ) ); … … 172 177 ); 173 178 174 foreach ( $field_sets as $fields ) { 179 $attempts = 0; 180 foreach ( $field_sets as $fi => $fields ) { 175 181 $url = $this->graph_url . $page_id . '?' . http_build_query( array( 176 182 'fields' => $fields, … … 178 184 ) ); 179 185 186 $attempts++; 180 187 $response = wp_remote_get( $url, array( 181 188 'timeout' => 15, … … 183 190 184 191 if ( is_wp_error( $response ) ) { 192 self::log( 'get_page_info attempt %d failed (field_set: %d): %s', $attempts, $fi + 1, $response->get_error_message() ); 185 193 continue; 186 194 } … … 190 198 if ( isset( $body['error'] ) ) { 191 199 $error_code = isset( $body['error']['code'] ) ? intval( $body['error']['code'] ) : 0; 200 $error_msg = isset( $body['error']['message'] ) ? $body['error']['message'] : __( 'Authentication error.', 'bluebook-feed-sync' ); 201 202 self::log( 'get_page_info attempt %d error %d (field_set: %d): %s', $attempts, $error_code, $fi + 1, $error_msg ); 192 203 193 204 // Auth errors — fail immediately 194 205 if ( 190 === $error_code ) { 195 $msg = isset( $body['error']['message'] ) ? $body['error']['message'] : __( 'Authentication error.', 'bluebook-feed-sync' ); 196 return new WP_Error( 'bbfsync_api_error', $msg ); 206 return new WP_Error( 'bbfsync_api_error', $error_msg ); 197 207 } 198 208 199 209 continue; 210 } 211 212 if ( $attempts > 1 ) { 213 self::log( 'get_page_info succeeded on attempt %d (field_set: %d)', $attempts, $fi + 1 ); 200 214 } 201 215 … … 247 261 return $body; 248 262 } 263 264 /** 265 * Log a debug message when WP_DEBUG_LOG is enabled. 266 * 267 * @param string $format sprintf-style format string. 268 * @param mixed ...$args Values to interpolate. 269 */ 270 private static function log( $format, ...$args ) { 271 if ( defined( 'WP_DEBUG_LOG' ) && WP_DEBUG_LOG ) { 272 // phpcs:ignore WordPress.PHP.DevelopmentFunctions.error_log_error_log -- intentional debug logging 273 error_log( '[BlueBook Feed Sync] ' . vsprintf( $format, $args ) ); 274 } 275 } 249 276 } -
bluebook-feed-sync/trunk/includes/class-bbfsync-renderer.php
r3494499 r3494970 19 19 20 20 /** 21 * Main render method 21 * Main render method. 22 * 23 * @return string Escaped HTML. 22 24 */ 23 25 public function render() { … … 176 178 177 179 /** 178 * Render individual posts (also used by AJAX) 180 * Render individual posts (also used by AJAX). 181 * 182 * @param array $posts Array of post data from the API. 183 * @return string Escaped HTML. 179 184 */ 180 185 public function render_posts( $posts ) { … … 485 490 486 491 /* Optional page name + bio under text header */ 492 $page_info = $api->get_page_info(); 493 $title_text = ! empty( $s['header_title'] ) ? $s['header_title'] : ( ! is_wp_error( $page_info ) && isset( $page_info['name'] ) ? $page_info['name'] : '' ); 494 $bio_text = ''; 487 495 if ( ! empty( $s['header_show_bio'] ) ) { 488 $page_info = $api->get_page_info(); 489 $title_text = ! empty( $s['header_title'] ) ? $s['header_title'] : ( ! is_wp_error( $page_info ) && isset( $page_info['name'] ) ? $page_info['name'] : '' ); 490 $bio_text = ! empty( $s['header_bio'] ) ? $s['header_bio'] : ( ! is_wp_error( $page_info ) && isset( $page_info['about'] ) ? $page_info['about'] : '' ); 491 if ( $title_text || $bio_text ) { 492 $pad_class = empty( $s['header_text_bg'] ) ? ' bbfsync-header-text-info-flat' : ''; 493 $html .= '<div class="bbfsync-header-text-info' . $pad_class . '">'; 494 if ( $title_text ) { 495 $html .= '<h3 class="bbfsync-header-text-title">' . esc_html( $title_text ) . '</h3>'; 496 } 497 if ( $bio_text ) { 498 $html .= '<p class="bbfsync-header-text-bio">' . esc_html( $bio_text ) . '</p>'; 499 } 500 $html .= '</div>'; 501 } 496 $bio_text = ! empty( $s['header_bio'] ) ? $s['header_bio'] : ( ! is_wp_error( $page_info ) && isset( $page_info['about'] ) ? $page_info['about'] : '' ); 497 } 498 if ( $title_text || $bio_text ) { 499 $pad_class = empty( $s['header_text_bg'] ) ? ' bbfsync-header-text-info-flat' : ''; 500 $html .= '<div class="bbfsync-header-text-info' . $pad_class . '">'; 501 if ( $title_text ) { 502 $html .= '<h3 class="bbfsync-header-text-title">' . esc_html( $title_text ) . '</h3>'; 503 } 504 if ( $bio_text ) { 505 $html .= '<p class="bbfsync-header-text-bio">' . esc_html( $bio_text ) . '</p>'; 506 } 507 $html .= '</div>'; 502 508 } 503 509 } else { … … 510 516 $cover_url = isset( $page_info['cover']['source'] ) ? $page_info['cover']['source'] : ''; 511 517 $title_text = ! empty( $s['header_title'] ) ? $s['header_title'] : ( isset( $page_info['name'] ) ? $page_info['name'] : '' ); 512 $bio_text = ! empty( $s['header_bio'] ) ? $s['header_bio'] : ( isset( $page_info['about'] ) ? $page_info['about'] : '' ); 513 if ( empty( $s['header_show_bio'] ) ) { $bio_text = ''; } 518 $bio_text = ''; 519 if ( ! empty( $s['header_show_bio'] ) ) { 520 $bio_text = ! empty( $s['header_bio'] ) ? $s['header_bio'] : ( isset( $page_info['about'] ) ? $page_info['about'] : '' ); 521 } 514 522 $fan_count = isset( $page_info['fan_count'] ) ? $page_info['fan_count'] : 0; 515 523 … … 654 662 } 655 663 $init_js .= ' xfbml: true,'; 656 $init_js .= ' version: " v22.0"';664 $init_js .= ' version: "' . esc_js( BBFSYNC_API::GRAPH_API_VERSION ) . '"'; 657 665 $init_js .= ' });'; 658 666 $init_js .= '};'; -
bluebook-feed-sync/trunk/readme.txt
r3494833 r3494970 4 4 Requires at least: 5.8 5 5 Tested up to: 6.9 6 Stable tag: 3.9. 196 Stable tag: 3.9.20 7 7 Requires PHP: 7.4 8 8 License: GPLv2 or later … … 125 125 126 126 == Changelog == 127 128 = 3.9.20 = 129 * Fixed: Page name now displays correctly when entered manually in text header mode 130 * Fixed: Bio display logic made consistent across all header styles 131 * Fixed: Lightbox now renders above sticky headers and page builder containers 132 * Improved: Facebook Graph API version centralised as a single constant for easier updates 133 * Improved: API retry logic now logs failures and successes when WP_DEBUG_LOG is enabled 134 * Improved: Dark color scheme error message styling 135 * Changed: Legacy migration now runs only on plugin activation instead of every page load 127 136 128 137 = 3.9.18 =
Note: See TracChangeset
for help on using the changeset viewer.