=== ACS Smart Blocks ===
Contributors: locany
Tags: blocks, reusable, scheduling, ab-testing, marketing
Requires at least: 6.0
Tested up to: 6.9
Requires PHP: 8.0
Stable tag: 1.0.7
License: GPL-2.0-or-later
License URI: https://www.gnu.org/licenses/gpl-2.0.html

Error-proof reusable blocks with scheduling, A/B testing, and usage tracking for marketing automation.

== Description ==

**ACS Smart Blocks** transforms WordPress reusable blocks into a powerful marketing automation tool. Create content blocks once, use them anywhere, and let the plugin handle the rest.

= 4 Core Concepts =

1. **Error-Proof Design** - Read-only preview in posts prevents accidental edits
2. **Marketing Automation** - Schedule blocks to appear/disappear automatically
3. **Full Transparency** - See exactly where each block is used
4. **WordPress Native** - Fully integrated with Gutenberg and Classic Editor

= Key Features =

**🧩 Smart Reusable Blocks**
* Create blocks once, use everywhere
* Edit from central location
* Changes reflect instantly across all pages
* Support for Gutenberg blocks and shortcodes

**📍 Usage Tracking**
* See which pages use each block
* Warning before editing widely-used blocks
* Automatic tracking with every save
* Quick links to edit/view pages

**⏰ Scheduling System**
* Set start and end dates for blocks
* Automatic display/hide based on schedule
* Custom fallback messages
* Perfect for campaigns and promotions

**🧪 A/B Testing**
* Test two versions of your content
* Automatic traffic splitting
* Track impressions and clicks
* See which version performs better
* Make data-driven decisions

= Use Cases =

* **Campaign CTAs** - Schedule holiday promotions automatically
* **Product Launches** - Show countdown timers only during launch period
* **Seasonal Content** - Display summer/winter variations
* **Contact Forms** - Test different form designs
* **Pricing Tables** - Compare offer variations
* **Announcement Bars** - Rotate important messages
* **Newsletter Signups** - Test different copy and designs

= Gutenberg Integration =

Simply insert the "ACS Smart Block" and select your block from the dropdown. The block content appears as a read-only preview - no risk of accidental edits!

= Shortcode Support =

Use `[acs_smart_block id="123"]` or `[acs_smart_block slug="my-block"]` anywhere - including Classic Editor, widgets, and page builders.

= Perfect For =

* Marketing teams managing campaigns
* Content creators using reusable content
* Business owners running A/B tests
* Agencies managing multiple sites
* Anyone who wants error-proof content management

= Completely Free =

No Pro version, no upsells, no limitations. Built by [Locany](https://locany.net/) as a gift to the WordPress community.

= Privacy =

* No external API calls
* No data collection
* A/B test data stored locally in your database
* GDPR friendly - uses cookies for consistent A/B test pattern assignment, no cross-site data sharing

== Installation ==

= Automatic Installation =

1. Go to Plugins > Add New
2. Search for "ACS Smart Blocks"
3. Click Install Now
4. Activate the plugin

= Manual Installation =

1. Download the plugin zip file
2. Go to Plugins > Add New > Upload Plugin
3. Choose the downloaded file
4. Click Install Now
5. Activate the plugin

= Getting Started =

1. Go to Smart Blocks > Add New
2. Create your content using the block editor
3. Publish the Smart Block
4. Insert it into posts/pages using:
   * Gutenberg: Add "ACS Smart Block" block
   * Shortcode: `[acs_smart_block id="123"]`
5. Optional: Set up scheduling or A/B testing

== Frequently Asked Questions ==

= How is this different from WordPress Reusable Blocks? =

WordPress Reusable Blocks are great, but they can be edited directly in posts, leading to accidental changes. ACS Smart Blocks shows content as read-only preview and adds powerful features like scheduling and A/B testing.

= Can I use this with Classic Editor? =

Yes! Use the shortcode `[acs_smart_block id="123"]` anywhere.

= Does A/B testing slow down my site? =

No. A/B testing uses a lightweight cookie for pattern assignment (no database query per page load after first visit) and click tracking uses the Beacon API (no page blocking).

= Can I export/import Smart Blocks? =

Yes, Smart Blocks are custom post types, so they work with standard WordPress export/import tools.

= Does this work with page builders? =

Yes! Use the shortcode in any page builder that supports WordPress shortcodes.

= Can I nest Smart Blocks? =

Yes, you can include one Smart Block inside another using the shortcode.

= What happens when I delete a widely-used block? =

WordPress will show you a warning, and you can see usage locations before deleting.

= Is there a limit to how many blocks I can create? =

No limit! Create as many as you need.

= Does this work with multilingual sites? =

Yes, the plugin is translation-ready and works with WPML, Polylang, and other translation plugins.

== Screenshots ==

1. Smart Blocks admin interface - clean and intuitive
2. Usage tracking - see where each block is used
3. Schedule settings - set start/end dates and fallback messages
4. A/B test settings - compare versions and see statistics
5. Gutenberg integration - insert blocks with read-only preview
6. A/B test results - track impressions, clicks, and conversion rates

== Changelog ==

= 1.0.7 - 2026-03-15 =
* Fixed: Removed prohibited PHP session usage (session_start / $_SESSION) — replaced with cookies per WordPress.org guidelines
* Fixed: Removed duplicate Description header in plugin file
* Fixed: Moved inline JavaScript from PHP templates to a properly enqueued script file (admin-metabox.js)
* Fixed: Replaced deprecated current_time('timestamp') with current_time('U')
* Updated: Privacy section and FAQ updated to reflect cookie-based A/B pattern assignment

= 1.0.6 - 2026-02-16 =
* Updated: Tested up toを6.9に更新（WordPress.org要件対応）
* Fixed: ZIPフォルダ構造を修正（acs-smart-blocks/ディレクトリ必須）
* Improved: WordPress.org自動チェッカー完全対応

= 1.0.5 - 2026-02-16 =
* Fixed: WordPress.org自動チェッカーのエラーを修正
* Removed: load_plugin_textdomain()を削除（WordPress 4.6以降は不要）
* Removed: Domain Pathヘッダーを削除（WordPress.orgが自動処理）
* Updated: Tested up toを6.7に更新

= 1.0.4 - 2026-02-16 =
* Improved: 管理画面を完全日本語化
* Improved: メニュー、メタボックス、通知を日本語表示
* Improved: Gutenbergブロックのラベルを日本語化
* Improved: 日本人ユーザー向けの使いやすさを大幅に向上

= 1.0.3 - 2026-02-16 =
* Fixed: カスタム投稿タイプが管理画面メニューに表示されない問題を完全に解決
* Fixed: init フックの二重登録問題を解消
* Improved: カスタム投稿タイプの登録をメインプラグインファイルに統合
* Improved: 不要な有効化処理を削除してパフォーマンスを向上
* Changed: menu_position を 25 から 20 に変更（「ページ」の下に表示）

= 1.0.2 - 2026-02-16 =
* Fixed: Custom post type not showing in admin menu (Critical fix)
* Added: show_in_admin_bar and query_var parameters
* Improved: Activation hook to force register post types
* Added: Admin notice after successful activation
* Added: Debug logging for post type registration errors

= 1.0.1 - 2026-02-16 =
* Fixed: Plugin activation and post type registration
* Added: Activation/deactivation hooks with flush_rewrite_rules()
* Improved: Japanese description in plugin list
* Updated: Version number for tracking

= 1.0.0 - 2026-02-16 =
* Initial release
* Smart Blocks custom post type
* Usage tracking system
* Scheduling feature with fallback options
* A/B testing with statistics
* Gutenberg block integration
* Shortcode support
* Admin meta boxes for all features
* Complete WordPress.org compliance

== Upgrade Notice ==

= 1.0.7 =
WordPress.org review compliance: removed prohibited PHP sessions, fixed duplicate plugin header, moved inline scripts to enqueued files.

= 1.0.6 =
Tested up toを6.9に更新し、WordPress.org自動チェッカー完全対応。ZIPフォルダ構造も修正済み。

= 1.0.5 =
WordPress.org自動チェッカーのエラーを修正。WordPress.orgへの申請に必要な修正を実施。

== Developer Notes ==

= Hooks and Filters =

The plugin provides several hooks for developers:

**Filters:**
* `acs_smart_blocks_content` - Filter block content before display
* `acs_smart_blocks_schedule_active` - Override schedule logic
* `acs_smart_blocks_ab_pattern` - Override A/B test pattern selection

**Actions:**
* `acs_smart_blocks_before_render` - Before block rendering
* `acs_smart_blocks_after_render` - After block rendering
* `acs_smart_blocks_ab_impression` - When A/B impression is tracked
* `acs_smart_blocks_ab_click` - When A/B click is tracked

= REST API =

Smart Blocks are accessible via WordPress REST API at `/wp/v2/acs_smart_block/`

= Custom Integration =

To render a Smart Block programmatically:

`
echo do_shortcode('[acs_smart_block id="123"]');
`

Or use the PHP function:

`
if (function_exists('acs_smart_blocks_render')) {
    echo acs_smart_blocks_render(123);
}
`

== About Locany ==

ACS Smart Blocks is created by [Locany](https://locany.net/), a web development studio specializing in WordPress solutions. We believe in giving back to the community that has given us so much.

Check out our other free products:
* **AI Creative Studio** - Lightning-fast WordPress theme for AI and tech companies

== Support ==

For support, please use the WordPress.org support forums. We monitor them regularly and aim to respond within 24 hours.

For feature requests and bug reports, you can also reach us at:
* Website: https://locany.net/
* LINE: https://lin.ee/PKaHDoaW

== Credits ==

Developed with ❤️ by the Locany team.

Special thanks to:
* The WordPress core team for the amazing platform
* The Gutenberg team for the modern editor
* The WordPress community for continuous inspiration
