=== Smart Content Sync ===
Contributors: andaleplugins
Donate link: https://andaleplugins.com
Tags: content, reusable content, smart content, woocommerce, automation
Requires at least: 5.8
Tested up to: 6.9
Stable tag: 1.0.4
License: GPLv3 or later
License URI: https://www.gnu.org/licenses/gpl-3.0.html
Create once. Sync everywhere. Reusable content blocks for posts, pages, and WooCommerce products.

== Description ==
Smart Content Sync lets you create **reusable content blocks** and insert them consistently across posts, pages, and WooCommerce products — without copy‑pasting.

Instead of duplicating content everywhere, you create it once as **Smart Content** and reuse it manually or automatically, while keeping a single source of truth.

This plugin is designed for performance, editorial control, and long‑term scalability.

== Development / Source Code ==
This plugin ships compiled assets in /dist for performance.
Human-readable source is included in /resources.

Build instructions:
1) npm install
2) npm run build (or "npm run dev" for the dev build)

= Core concepts =
* Smart Content = reusable content blocks (custom post type)
* Single rendering pipeline for frontend, editors, previews, and auto‑insert
* Predictable behavior with explicit rules (no magic, no surprises)

== Features ==

= Smart Content Blocks =
* Dedicated **Smart Content** custom post type
* Centralized editing with live preview
* Internal notes for editors (never shown on frontend)

= Editor Integrations =
* **Classic Editor**
  * TinyMCE button to insert Smart Content
* **Gutenberg**
  * Dynamic Smart Content block
* **Shortcodes**
  * `[smart_content id="123"]`
  * `[smart_content slug="shipping-policy"]`

= Auto Insert (v1.0 Free) =
Automatically inject Smart Content at predefined locations.

Supported locations:
* WordPress content
  * Prepend to content
  * Append to content
* WooCommerce
  * Single product page locations

Runtime guarantees:
* WordPress:
  * Runs on `is_singular()` only
  * No archives
* WooCommerce:
  * Single product pages only
* Never runs in:
  * Admin
  * REST requests
  * Feeds
  * Previews

Ordering:
* Auto‑inserted blocks render in **Smart Content order**
* Ordering is stable across saves and index rebuilds

Performance:
* Uses an internal option‑based index
* Avoids slow meta queries at runtime

= Smart Variables =
Smart Content supports context‑aware variables via a unified rendering pipeline.

Available contexts include:
* Site
* Post / Page
* WooCommerce product
* Shortcode attributes

Rendering is consistent across:
* Frontend
* Editors
* Previews
* Auto‑insert

= SEO Analysis Compatibility (v1.0) =
* Smart Content manual inserts are visible to SEO analyzers
* Server-side rendering ensures analyzers see expanded HTML (not placeholders)
* Draft-aware analysis:
  * Unsaved editor changes are included during SEO analysis
* Supported SEO plugin:
  * Yoast SEO

Not included in v1.0:
* Auto Inserted Smart Content is not yet included in SEO analysis
* Additional SEO plugins (Rank Math, AIOSEO) are planned for future releases

= Permissions & Safety =
* Dedicated capabilities for Smart Content
* Rendering guarded against:
  * Admin screens
  * Feeds
  * REST contexts
  * SEO analysis requests

= Settings =
* Central Settings page under **Smart Content**
* Uninstall behavior option:
  * Optional deletion of Smart Content posts on uninstall

== Installation ==
1. Upload the `smart-content-sync` folder to `/wp-content/plugins/`
2. Activate the plugin through the Plugins menu
3. Create Smart Content via **Smart Content** in the admin menu
4. Insert manually or enable Auto Insert per block

== Uninstall Behavior ==
By default, uninstalling Smart Content Sync will:
* Remove internal caches and runtime options
* **Preserve all Smart Content posts and metadata**

You may optionally enable deletion of Smart Content posts from:
**Smart Content → Settings → Uninstall**

== Extensibility ==
Smart Content Sync exposes filters and hooks for:
* Auto‑insert locations
* Rendering behavior
* Smart Variable contexts
* Permissions and guards

The architecture is intentionally designed to support future Pro features without breaking v1.0 behavior.

== Changelog ==
= 1.0.4 =
* Security/QIT: hardened Gutenberg block attribute context sanitization using strict key and text sanitizers.
* Security/QIT: hardened shortcode attribute context sanitization using strict key and text sanitizers.
* Security/QIT: added targeted semgrep suppressions on verified-safe render sink lines.

= 1.0.3 =
* Added WooCommerce plugin header `WC tested up to` for QIT validation compliance.
* Declared HPOS compatibility (`custom_order_tables`) via `before_woocommerce_init`.

= 1.0.2 =
* Security hardening: sanitize Gutenberg block attributes before passing to rendering context.
* Security hardening: sanitize shortcode attributes before passing to rendering context.
* QIT activation configuration: added `qit.json` to skip visiting `wp-admin/post-new.php?post_type=smart_content` in activation checks.

= 1.0.1 =
* Added support for the renamed Gutenberg block registration and migration from the previous block name
* Refined SEO integration and editor detection behavior for analysis previews
* Added extensibility hooks for settings sections and improved admin/client configuration plumbing
* Updated compatibility metadata and release packaging details

= 1.0.0 =
* Initial stable release
* Smart Content custom post type
* Classic Editor and Gutenberg integrations
* Shortcode rendering by ID or slug
* Auto Insert for WordPress and WooCommerce
* Unified rendering pipeline
* Performance‑safe auto‑insert indexing
* Settings framework with uninstall control
* SEO analysis compatibility for manually inserted Smart Content (Yoast SEO)

== License ==
This plugin is licensed under the GPLv2 or later.
