=== MKM Digital Social Publisher Bridge to Buffer ===
Contributors: dgmaximiliano, mkmdigital
Tags: buffer, social media, auto publish, facebook, instagram
Requires at least: 5.6
Tested up to: 7.1
Stable tag: 2.0.2
Requires PHP: 7.4
License: GPLv2 or later

Auto-publish WordPress posts, events & products directly to your 3 free Buffer.com social channels with custom templates and live previews.

== Description ==

MKM Digital Social Publisher Bridge to Buffer connects your WordPress site directly to the official Buffer API (https://api.buffer.com) without any middlemen, proxy servers, or third-party tracking.

Automatically publish or schedule your blog posts, custom post types, event plugins (FAT Event, Modern Events, etc.), and WooCommerce products to all your connected social media channels in seconds.

Why Choose MKM Digital Social Publisher Bridge?

Unlike other auto-publish plugins that route your data through third-party servers or lock basic features behind expensive paywalls:
* 100% Direct & Private Connection: Your site communicates directly with Buffer’s official GraphQL API. We never route your content, tokens, or data through our servers.
* Works with Buffer's 3 Free Channels: Take full advantage of Buffer.com's free plan (up to 3 connected social accounts) with zero restrictions on post types.
* "Share Now" & "Add to Queue" Included: Choose whether to publish immediately or let Buffer intelligently space out your posts according to your schedule.
* Instagram, LinkedIn, Facebook & More in Free: Share directly to Instagram, Facebook Pages, LinkedIn, X (Twitter), Threads, Pinterest, Mastodon, Bluesky, TikTok, and Google Business Profile.
* WooCommerce & Event Post Types Support: Works out of the box with standard WordPress posts, pages, WooCommerce products, and custom event post types.
* Dynamic Template Tags: Customize your social messages using tags for Title, Content, Excerpt, Full Permalink, Shortlinks, Categories, and Tags.
* Smart Guardrails & Media Sanitization: Protects against empty drafts and automatically sanitizes media URLs (including emojis and non-ASCII filenames) according to RFC 3986 for reliable image delivery.

Compatible Social Networks

Through your connected Buffer account, you can auto-publish to:
* Facebook (Pages & Groups)
* Instagram (Business & Creator Profiles)
* LinkedIn (Company Pages & Personal Profiles)
* X (Twitter) (Reliable publishing via official Buffer API)
* Threads & Bluesky
* Pinterest (Board pins with high-resolution media)
* Google Business Profile (What's New posts with images)
* Mastodon & TikTok

Dynamic Template Tags for Custom Messages

Craft unique social messages using flexible template tags:
* {title} – Post or product title
* {content} – Full content (with custom word limits)
* {excerpt} – Excerpt or SEO meta description
* {permalink} – Clean canonical URL
* {shortlink} – Instant TinyURL or native WordPress shortlink
* {tags} – Post tags automatically converted to hashtags
* {categories} – Categories as hashtags

== Upgrade to Premium ==

Want to unlock the full power of your social media automation? Upgrade to the Premium version directly inside the plugin or via our website!

Premium Features:
* Advanced Analytics & Performance Dashboard: Track reach, clicks, likes, comments, and shares over time with interactive multi-line charts and per-post metrics.
* Historical Backfill Tool: Synchronize past Buffer posts, resolve redirects/shortlinks, and import historical analytics.
* Automated White-Label PDF & Email Reports: Generate customizable PDF performance summaries or schedule automated monthly email deliveries via Cron.
* WooCommerce Gallery Carousels: Automatically shares WooCommerce product extra gallery images as beautiful carousels/slideshows on platforms that support them (Facebook, Instagram, LinkedIn).
* Interactive Real-Time Post Previews with Image Sliders: Preview posts with multi-image slideshow sliders before publishing.
* Internal Diagnostic Logger: Secure debug logs to monitor API calls and diagnose issues.

== Installation ==

1. Upload the plugin files to the `/wp-content/plugins/mkmdigital-social-publisher-bridge` directory, or install the plugin through the WordPress plugins screen directly.
2. Activate the plugin through the 'Plugins' screen in WordPress.
3. Go to Settings -> MKM Digital Social Publisher Bridge to Buffer to configure your Buffer API token and channels.

== External services ==

This plugin directly interfaces with:
* Buffer.com API: Used for publishing and scheduling social media posts.
* Buffer Terms: https://buffer.com/legal/terms-of-service
* Buffer Privacy Policy: https://buffer.com/legal/privacy-policy

* Freemius SDK: Used for optional opt-in telemetry and licensing services.
* Terms of Service: https://freemius.com/terms/
* Privacy Policy: https://freemius.com/privacy/

== Changelog ==

= 2.0.2 =
* Fixed live social previews aspect-ratio: eliminated fixed letterbox crops to faithfully support 1:1 square (e.g. 1080x1080), 4:5 portrait, and landscape images across Facebook, Instagram, Google Business, LinkedIn, and X preview cards.
* Upgraded metabox preview image resolution to use multi-source full/large image assets matching live social publishing payloads.

= 2.0.1 =
* Resolved Gutenberg REST API & Auto-Importer timing race condition: Auto-publishing now safely defers to shutdown and rest_after_insert_post so featured images, taxonomy terms, and permalinks are fully committed before sending payloads to Buffer.
* Added 6-Level Multi-Source Image Fallback: Automatically resolves images from Featured Image, SEO plugins OpenGraph metadata (AIOSEO, Yoast, Rank Math, SEOPress), Gutenberg blocks (core/image, cover, media-text), HTML img tags, attached media library items, and site icon.
* Added Instagram Image Guardrail: Prevents Instagram publishing failures by automatically supplying a verified fallback image when a post does not contain media.
* Enhanced RFC 3986 media URL encoding to handle query strings, renames, and accents seamlessly.

= 2.0.0 =
* Full multi-channel publishing enabled for all connected channels in Free version (no 1-channel limit).
* Enhanced template sanitization and SEO description fallback performance.
* Cleaned asset enqueue versioning to support HTTP caching.
* Codebase modernization and stability enhancements.

= 1.6.5 =
* Optimized short description to comply with WordPress.org 150-character limit.
* Updated full plugin description and added official directory banner assets.
* Enhanced thickbox modal details view and updated Italian localization.

= 1.6.4 =
* Implemented RFC 3986 media URL encoding & sanitization: Automatically encodes non-ASCII characters, emojis, spaces, and accents in image URLs to ensure reliable media publishing across Instagram, X (Twitter), and LinkedIn.

= 1.6.3 =
* Added publish guardrail: Automatically blocks auto-publishing if the post title is missing or set to an auto-draft, protecting against empty/malformed automated posts.

= 1.6.2 =
* Added bundled PNG assets & plugin_icon filter integration for update notice lists.

= 1.6.1 =
* Analytics sorting optimization & SQL aggregation fix for reactions and engagement rates.

= 1.6.0 =
* Complete residual tag cleanup: Automatically purges stray #post_excerpt, #post_title, #post_link strings embedded inside post excerpts or content.

= 1.5.9 =
* Smart template tag sanitization & aliases: Automatically cleans up typos like #post_excerpt, #post_title, #post_link and supports {post_excerpt}, {post_title}, {post_link} tag aliases.

= 1.5.8 =
* Smart network-specific URL resolution: URL Shortener automatically applies to Twitter/X, while Facebook, Instagram, and LinkedIn keep clean full canonical URLs for brand recognition.
* Fix Analytics duplicate profiles in charts and sidebars by consolidating legacy profile IDs.

= 1.5.7 =
* Updated Italian translations (it_IT) for all shortener options and Buffer link shortening tips.
* Added explicit load_plugin_textdomain call in Free version.

= 1.5.6 =
* Integrated TinyURL free instant shortener API with post meta caching (`_mkm_dspb_tinyurl`).
* Added URL Shortener Provider setting option (Disabled, TinyURL, WordPress Native / Active Shortener Plugin).
* Added helpful Buffer.com Link Shortening tip in settings.

= 1.5.5 =
* Added {shortlink} tag placeholder support across custom message templates.
* Added interactive, clickable tag pills under all custom message textareas for quick tag insertion.
* Expanded custom text placeholder replacement to process {title}, {excerpt}, {link}, {shortlink}, {yoast_desc}, and {aioseo_desc}.

= 1.5.4 =
* Implemented smart sentence extraction for default post excerpts, prioritizing Yoast SEO, Rank Math, AIOSEO, and SEOPress meta descriptions.
* Upgraded X (Twitter) text truncation to stop at full sentence or word boundaries without cutting words mid-phrase.

= 1.5.3 =
* Added automatic 280-character limit truncation for X (Twitter) posts preserving URLs.
* Added live 280-character counter in X (Twitter) options metabox.
* Fixed Twitter custom text parameter transmission during manual shares.

= 1.5.2 =
* Fixed duplicate PHP tag rendering in channel checklist.
* Fixed LinkedIn preview card profile avatar fallback rendering.

= 1.5.1 =
* Fixed X (Twitter) icon display in social channel checklists.
* Fixed LinkedIn preview card user avatar rendering.

= 1.4.0 =
* Added X (Twitter) social preview card and custom post text options in publisher metabox.
* Added official SVG icons and brand colors for X (Twitter), Threads, Bluesky, Pinterest, YouTube, TikTok, Mastodon in admin pages and statistics.
* Fixed multilingual permalink resolution for Polylang, WPML, and TranslatePress subdomains and subdirectories.

= 1.2.3 =
* Fixed live interactive social preview in metabox: applied htmlToSocialText converter in JavaScript and PHP metabox rendering to strip raw HTML tags and format bullet points in real-time.

= 1.2.2 =
* Added custom plugin icons (128x128 & 256x256) and update transient filter to display official plugin logo in WordPress Dashboard & Updates table.

= 1.2.1 =
* Added automatic HTML to plain text converter for social sharing: converts HTML list items (<li>) into clean bullet points (•), strips raw HTML formatting tags (<strong>, <ul>, etc.), and formats paragraphs nicely.

= 1.2.0 =
* Fixed HTML entity decoding for post titles, excerpts, and custom text sent to social channels (resolving &amp; issues).
* Added multilingual permalink support (Polylang, WPML) ensuring post URLs match the post's native language.

= 1.1.9 =
* Fixed LinkedIn sharing issue. Removed invalid "type" metadata parameter from LinkedIn posts, resolving the Buffer API validation error ("Field 'type' is not defined by type 'LinkedInPostMetadataInput'").

= 1.1.8 =
* Replaced uninstall.php with fs_after_uninstall_mkmdigital-social-publisher-bridge action hook to comply with Freemius uninstallation guidelines and avoid deployment warnings.

= 1.1.7 =
* Added uninstall.php to completely delete plugin options and post meta data from the database when the plugin is deleted.

= 1.1.6 =
* Wrapped main plugin functions, constants, and classes in conditional checks to prevent "Cannot redeclare" PHP fatal errors when transitioning from Free to Pro inside the WordPress dashboard.

= 1.1.5 =
* Cleared zip file structure to resolve nested duplicates when deploying premium build from Freemius.

= 1.1.4 =
* Implemented automatic JPG/PNG fallback check for featured images. If a WebP or AVIF image URL is passed, the plugin will look for the original JPG/PNG equivalent on the server and use it (solving the Google Business Profile image format error).

= 1.1.3 =
* Moved the settings page to a top-level administration menu with a custom icon, resolving the issue where the Freemius "Account" submenu was not visible.

= 1.1.2 =
* Enabled Freemius Account submenu in admin menu to allow license key activation and synchronization.

= 1.1.1 =
* Fixed issue where editing and updating an already published post would trigger a duplicate share on social media.

= 1.1.0 =
* Integrated Freemius SDK for license management.
* Added Free vs Pro limitations (Free limited to 1 channel).

= 1.0.8 =
* Fixed First Comment limitations.

= 1.0.0 =
* Initial release with Buffer direct integration.

== Screenshots ==

1. Main settings page and Buffer API token configuration.
2. Selection of target social channels for automatic or manual sharing.
3. Interactive post preview modal showing real-time mockup layouts with WooCommerce gallery image carousels (Premium feature).
4. Premium Analytics Dashboard with interactive multi-line performance charts and channel performance lists (Premium feature).
