=== AnyWareX Clone Translate ===
Contributors: anywarex
Donate link: https://www.anywarex.com/donate
Tags: translation, multilingual, languages, duplicate posts, duplicate pages, duplicate content, i18n
Requires at least: 6.0
Tested up to: 6.9
Requires PHP: 7.4
Stable tag: 2.4.1
License: GPLv2 or later
License URI: https://www.gnu.org/licenses/gpl-2.0.html

Clone and duplicate posts and pages into multiple languages with clean URL prefixes and a lightweight workflow.

== Description ==

🎥 Quick Start (under 4 minutes):

https://youtu.be/WtFaBl_TBBQ

Create a multilingual WordPress website — fast, lightweight, and without complex frameworks or external services.

Easily clone and duplicate posts and pages for each language while keeping full control over structure and URLs.

Perfect for developers and site owners who want a clean, fast, and structured multilingual workflow.

**Main features:**

* Clone and duplicate any post or page into a different language
* Fully compatible with the block editor (Gutenberg)
* Supports custom post types
* Automatic language URL prefixing (e.g., /de-de, /it-it)
* Smart routing to ensure the correct translation is displayed
* JSON-based translation structure
* No heavy frameworks required
* Multisite compatible
* 100% GDPR-friendly

**Optional add-ons (Plus & Pro):**

* JSON translation editor (advanced)
* PHP-based translation mapper
* Full language dictionary management
* Automatic cloning of featured images and metadata
* Details page mapping
* Additional automation and workflow tools
* Premium support & updates

Optional add-ons (Plus/Pro) are available separately from AnyWareX.

== Tutorial ==

A quick and simple introduction to get you started with the plugin.

== External services ==

This plugin does not connect to any third-party services or external APIs.

== Source code for CSS/JS ==

This plugin ships with human-readable (non-minified) source files for its CSS and JavaScript in:

* assets/css/
* assets/js/

Third-party assets are stored under assets/vendor/. Where minified files are included, the corresponding unminified source is also included (for example, assets/vendor/flag-icons/css/flag-icons.css).

Upstream project references:

* Flag Icons: https://github.com/lipis/flag-icons

== Screenshots ==

1. Clone page workflow
2. Language selector
3. JSON translation editor (Plus/Pro)
4. Routing configuration
5. Admin translation overview

== Installation ==

1. Upload the plugin files to `/wp-content/plugins/anywarex-clone-translate/`
2. Activate the plugin through the “Plugins” page in WordPress
3. A new menu item “AWX Translate” will appear in the WordPress admin
4. Start cloning, duplicating, and translating your pages

== Frequently Asked Questions ==

= Does the plugin work without Plus/Pro? =
Yes. The free version includes full cloning and routing functionality.

= Does the plugin slow down the site? =
No. AnyWareX Clone Translate is designed to be lightweight and uses native WordPress hooks.

= Are the premium versions also GPL? =
Yes, all versions (Free, Plus, Pro) are licensed under GPLv2 or later, fully WordPress-compliant.

= Can I use this with page builders? =
Yes. It works with Gutenberg, classic editor and most major page builders.

== Changelog ==

= 2.4.1 =
* Moved the shared AnyWareX admin header structure into a dedicated awxwp-core.css file.
* Replaced header inline styles with reusable awxwp-core-* classes.
* Improved: Added the same vertical spacing around the shared AnyWareX product header used by AnyWareX Careers
* Improved: Replaced the edition suffix in the product title with dedicated version badges.
* Added: Display of the installed Free edition version in the shared AnyWareX product header.
* Added: Introduced a filter-based version badge system for seamless Plus and Pro integration.
* Improved: Prepared the shared header for extension-specific version badges without coupling the Free edition to commercial editions.

= 2.4.0 =
* Changed: Updated links to the new AnyWareX License Store

= 2.3.8 =
* Added: Custom CSS field for styling the language switcher directly in the plugin
* Added: Inline hint linking to "Custom CSS (Switcher)" documentation page
* Improved: Consistent code-style UI for CSS input field (clean editor-like appearance)
* Improved: Refactored CSS structure to avoid duplicated styles and improve maintainability

= 2.3.7 =
* Added: Quick Start tutorial for faster onboarding
* Improved: Plugin description and documentation
* Added: Proper donate link integration on WordPress.org plugin page

= 2.3.6 =
* Fixed: Default languages were re-imported on every plugin activation
* Improved: Language seeding now runs only on fresh installations
* Improved: Existing language configurations are preserved after reactivation
* Performance: Reduced unnecessary database operations during activation

= 2.3.5 =
* Initial release on WordPress.org
* Renamed plugin to "AnyWareX Clone Translate" for compliance
* Standardized prefix to awxct_ across all plugin functions and database tables
* Maintained backward compatibility with existing license system (awx_plg_ct_)
* Removed feature restrictions from free version to comply with WordPress guidelines
* Improved database handling and query safety
* Fixed compatibility issues detected by Plugin Check
* Cleaned up internal structure and naming conventions
* Improved admin UI stability
* Minor bug fixes and performance improvements
* Unified language handling
* Removed legacy language parameters (awx_lang, awx_set_lang)
* Standardized language variables to awxct_lang and awxct_set_lang
* Eliminated deprecated prefixes (awx_, awx_ct, awx-ct)
* Improved consistency in routing, cookies, and frontend behavior
* Cleaned up internal naming conventions
* Minor code cleanup and optimizations

= 2.3.4 =
* Updated: Comparison table updated to show unlimited languages and domains in the free version.
* Improved: Removed outdated references to previous limitations.
* Improved: Ensured consistency between functionality and UI.
* Fixed: Resolved language detection issue for default language without URL prefix.
* Fixed: Ensured consistent language state handling across Free, Plus, and Pro editions.
* Fixed: Restored proper JavaScript translation parsing for {{ "key" | awxct }} syntax in Plus and Pro.
* Fixed: Resolved conflicts between Free and Pro causing function redeclaration errors.

= 2.3.3 =
* Fixed: Critical error on Languages admin page due to leftover code after removing language limits.
* Fixed: Admin Languages list not rendering correctly.

= 2.3.2 =
* Removed language limit and mapping restrictions from free version.
* Removed license-based feature restrictions from core plugin.
* Replaced “Pro required” messages with neutral “Extension required”.
* Refactored architecture to support separate extension-based features.

= 2.2.2 =
* Fixed: Clone pages were incorrectly treated as translations, causing menu links and direct URL access to redirect to the original page instead of the cloned page.

= 2.2.1 =
* Fixed: "Remove from translations" button did not properly delete translation relations in the database.
* Improved: Reliable removal of all mapping relations (root/original/translated) for a post.
* Security: Added table identifier validation before database operations.

= 2.2.0 =
* Fixed: Resolved multiple WordPress Plugin Check warnings and errors to ensure full WordPress.org compliance.
* Fixed: Normalized mixed line endings (LF) in several files to prevent formatting and diff issues.
* Fixed: Corrected SQL handling in internal handlers to satisfy PreparedSQL and security checks.
* Fixed: Proper sanitization and validation of user input values used in database operations.
* Improved: Database queries are now clearly documented and safely scoped, avoiding false-positive security flags.
* Improved: Code quality and maintainability improvements with no changes to public behavior or data structures.
* Stability: No functional changes to cloning, routing, or translation logic.

= 2.1.5 =
* Improved: Post-clone cleanup and meta normalization now run unconditionally after cloning.
* Improved: Ensures cloned pages remain stable even if the original page builder (e.g. Elementor) is currently inactive.
* Stability: Removes derived/cached builder metadata after cloning to avoid stale or broken states.
* Compatibility: Keeps cloning behavior universal and builder-agnostic, aligned with best practices (e.g. Duplicate Page).
* Dev: No changes to cloning logic or data structure — minimal, safe post-processing enhancement only.

= 2.1.4 =
* Docs: Extended PHP-based JSON translation guide with explicit safe-usage instructions for theme integration.
* Docs: Added clear explanation that `awxct_get_json_value()` is only available while the plugin is active.
* Docs: Included recommended `function_exists()` guard pattern to prevent fatal errors when the plugin is deactivated.
* Docs: Added alternative wrapper/helper example for themes or mu-plugins to ensure graceful fallback behavior.
* Stability: Prevents frontend white/black screens caused by direct function calls in themes when AnyWareX Clone Translate is disabled.
* No functional changes: Documentation-only update; no changes to translation logic, routing, or database behavior.

= 2.1.3 =
* Fixed: Correct language persistence when navigating between pages within a non-default language context.
* Fixed: Internal links now correctly retain the active language prefix (e.g. /fr-fr/) when browsing translated pages.
* Fixed: Mapping and activation logic now consistently uses original_post_id; root_post_id is no longer involved in routing or language resolution.
* Fixed: Incorrect fallback behavior where translated URLs could display default-language content due to wrong active assignment.
* Improved: More robust language code handling with tolerant comparison (case-insensitive, _ and - treated equally).
* Improved: Prevented accidental language switching caused by stale cookies during navigation.
* Stability: Minor frontend URL handling adjustments to avoid malformed paths (e.g. double slashes).

= 2.1.2 =
* Fixed: Correct language switcher URL generation on subpages (language prefix is inserted after the WordPress home path).
* Fixed: Switching languages now works reliably for WordPress installations in subdirectories (e.g. `/wordpress/es-es/page/`).
* Fixed: Translation resolve / fallback now consistently uses `original_post_id` (not `root_post_id`).
* Improved: Translation lookup strictly respects `is_active=1` and language-code matching is case-insensitive (e.g. `en-US` and `en-us`).
* Improved: Frontend debug logging is disabled by default and follows `WP_DEBUG`.

= 2.1.0 =
* Dev: Internal routing update only — no changes to stored data or translation logic.
* Improved: Renamed the Theme Mods admin section to “Customizer” for clearer user-facing terminology.
* Changed: Updated the internal admin page slug from `awxct-theme-mods` to `awxct-customizer`.
* Improved: Aligned menu labels, page titles, and navigation links with the new Customizer naming.
* UI: Minor wording and navigation consistency improvements in the Customizer translation workflow.
* Improved: Refined the Free / Plus / Pro comparison table for better clarity and consistency.
* Added: New “License duration” row explaining update and support periods across editions.
* Improved: Clear and friendly “Good to know” notice highlighting that Plus and Pro editions continue to work after license expiration.
* Improved: Renamed “Translation List” to “Source List” to better reflect the purpose of selecting original strings.
* Improved: Reduced visual noise on the comparison table by removing strong hover color effects.
* UI: Minor wording and presentation improvements on the Welcome / Compare page.

= 2.0.9 =
* UI: Added product icon (AnyWareX Clone Translate) next to the AnyWareX logo in the admin header for clearer product identification.
* UI: Introduced new CT product icon assets and standardized icon sizing for consistent display.
* Dev: Minor internal helper adjustments related to admin header rendering (no functional changes).

= 2.0.8 =
* Changed placeholder detection to an explicit opt-in pattern. Only placeholders using `{{ "key" | awxct }}` (including arbitrary whitespace) are processed.
* Fixed unintended global replacements in rendered HTML, preventing side effects in the document head (e.g. browser tab titles).
* Improved version handling by reading the plugin version directly from the plugin header, ensuring a single source of truth across Free, Plus, and Pro editions.

= 2.0.7 =
* Added visual preview for the frontend language switcher in the admin area.
* Improved layout of language switcher settings (preview aligned next to display options, responsive on mobile).
* Added ability to delete inactive, non-default languages from the language list.
* Prevented deletion of active or default languages.
* Enforced rule that the default language must always be active.
* Disabled default selection for inactive languages in the admin UI.
* Fixed form handling issue caused by nested forms when deleting languages.
* Improved spacing and styling in the language switcher preview.
* Ensured the default language always appears first in the frontend language switcher dropdown.
* Sorted remaining languages in a fixed, alphabetical order for consistent display.

= 2.0.6 =
* Fixed: Default language table was created but not automatically seeded on fresh installations.
* Improved: Added a safe, idempotent language seeding routine during plugin activation to ensure all bundled languages are available immediately after activation.
* Dev: Internal activation logic adjusted (single helper function added); no refactoring or changes to existing translation, routing, or UI logic.
* Improved: Language switcher dropdown behavior and styling when placed at the end of the main navigation menu (menu-end placement), ensuring consistent appearance and correct layering across different themes.

= 2.0.5 =
* Fixed: Admin menu icon was not visible when the WordPress admin menu was expanded (CSS override for current menu state corrected).
* Improved: JSON documentation pages updated to consistently use lowercase locale filenames (e.g. de-de.json) to avoid issues on case-sensitive file systems.
* Improved: Clarified and aligned upload paths for JS-based and PHP-based JSON translation files.
* Dev: Minor documentation adjustments only; no functional or structural changes to core translation logic.

= 2.0.4 =
* Fixed: Corrected remaining SQL queries to fully comply with WordPress $wpdb::prepare() requirements.
* Fixed: Resolved syntax issues caused by incomplete conditional blocks in routing logic.
* Improved: Finalized sanitization, validation, and nonce handling based on WordPress.org review feedback.
* Dev: Completed final review pass to ensure all previously reported issues are fully addressed.

= 2.0.3 =
* Improved: Applied consistent nonce verification and capability checks for all state-changing actions.
* Improved: Sanitized and validated all relevant superglobal input across the plugin.
* Improved: Ensured context-aware escaping for admin and frontend output where required.
* Dev: Completed a full plugin-wide security and code quality audit based on WordPress.org review feedback.

= 2.0.2 =
* Added: Prominent link to the official AnyWareX license shop on the Welcome page.
* Improved: Upgrade guidance now clearly directs users to the external shop in compliance with WordPress.org guidelines.

= 2.0.1 =
* Added: New “Contact” tab on the Welcome page with support and website information.
* Improved: Benefits section now clearly explains that existing JS- and PHP-based JSON translations remain active after a license expires (PHP translations apply to Pro).
* Improved: Welcome page messaging refined for better transparency around licensing and premium feature scope.
* Improved: Minor layout and content adjustments on the Welcome page for a more consistent onboarding experience.

= 2.0.0 =
* Separated Free, Plus and Pro versions.
* Premium features moved to the Plus add-on.
* Improved structure and maintainability.

= 1.3.7 =
* Improved code quality and security across multiple files, stabilized the PayPal upgrade flow, and aligned the plugin more closely with WordPress standards.

= 1.3.6 =
* Improved code quality and security across multiple files, stabilized the PayPal upgrade flow, and aligned the plugin more closely with WordPress standards.

= 1.3.5 =
* Added: Embedded “Quick Start” video on the Welcome page with responsive layout and clean styling.
* Added: New CSS classes (`awxct-welcome-video`, `awxct-welcome-video-inner`) for consistent video rendering across all admin screens.
* Improved: Welcome page structure updated to better highlight onboarding content and improve overall readability.
* Improved: Admin CSS file extended and reorganized to support the new video block and future layout modules.
* Improved: Visual spacing and layout of the Benefits and Quick Start sections to achieve a more coherent admin experience.
* Fixed: Minor alignment inconsistencies on the Welcome page when switching between tabs.
* Dev: Clean separation of inline styles — all video-related styling moved to `assets/css/admin.css` for proper maintainability.
* Dev: Small housekeeping updates in template files to prepare for future onboarding enhancements.

= 1.3.4 =
* Added: New “Custom CSS (Switcher)” tab on the Welcome page, providing users with detailed instructions and ready-to-use examples for styling the language switcher button and dropdown.
* Added: Dedicated documentation view `welcome-switcher-css-page.php` with selector reference, code samples, and best practices.
* Improved: Welcome page description text updated to include mention of optional custom switcher styling.
* Improved: Tab system extended cleanly with full fallback handling for missing view files.
* Dev: Internal welcome-page structure extended to support additional documentation tabs without affecting existing logic.

= 1.3.3 =
* Fixed: “Add language” form did not submit correctly because of mismatched field names (`code`, `native_name`, `english_name` now aligned with handler).
* Fixed: After clicking “Add language” or “Save Changes”, the admin page always redirected to the Welcome page (redirect now correctly targets the Languages page).
* Fixed: Floating Language Switcher being partially hidden under the WordPress admin bar while logged in (automatic offset applied for 40px / 52px admin bar heights).
* Improved: Reordered the “Add language” section — now displayed below the “Existing languages” table for a more intuitive workflow.
* Improved: UI consistency on the Languages page (labels, spacing, and field alignment).
* Dev: Centralized redirect helper updated to ensure all language operations return to the correct admin screen.

= 1.3.2 =
* Added: Language Switcher configuration page with new UI (display style + placement options).
* Added: Language Switcher integration in the “Quick Start” onboarding guide, including new screenshots.
* Added: Screenshot placeholder for “language-switcher-settings.png” in the Quick Start section.
* Improved: Comparison table design with better spacing, zebra-striping, borders, hover effects and clearer readability.
* Improved: Admin CSS for the Welcome/Overview page (styling consistency across tabs and layout blocks).
* Improved: Numbering and structure of Quick Start steps after introducing the new Language Switcher step.
* Updated: Default plugin readme to reflect new features introduced in v1.3.2.
* Dev: Internal CSS refactoring for cleaner maintainability (Comparison Table section rewritten).

= 1.3.1 =
* Added: New “Benefits” tab on the Welcome page with marketing-focused highlights, including strong Elementor compatibility messaging.
* Added: New “Quick Start” tab with a visual step-by-step guide, including screenshots for “Clone or Translate”, language selection and “Remove from translations”.
* Added: “Remove from translations” action directly on the Mapping page (in addition to the editor metabox), using a secure admin-post handler.
* Added: Automatic cleanup of orphaned mapping entries when loading the Mapping page (removes references to posts that were already deleted).
* Added: Housekeeping hook on `before_delete_post` to automatically remove all mapping entries that reference a permanently deleted post.
* Improved: Admin Welcome/Overview styling (benefit columns, info boxes, Elementor badge, Quick Start layout) for a more polished onboarding experience.
* Improved: Mapping logic compatibility with older database schemas (`translation_post_id` vs. `translated_post_id`).
* Added: Internal version constant to 1.3.1 and “Tested up to” value to WordPress 6.9.

= 1.3.0 =
* Added: New “Welcome” page with tabbed interface (Free/Plus/Pro comparison, JS-based JSON guide, PHP-based JSON guide)
* Added: Comprehensive edition comparison table (features, max. languages, domain activations, etc.)
* Added: Example JSON files now ship as `*-example.json` to prevent overwriting during updates
* Added: Notices explaining how to rename example files to activate them
* Added: Automatic filtering of JSON Editor file list (only locale-based formats: xx.json / xx-XX.json)
* Added: New build target: `php tools/build.php wp` creates `anywarex-clone-translate.zip` for WordPress.org
* Added: Admin CSS centralised into `assets/css/admin.css` and auto-loaded across admin pages

* Improved: JSON Editor dropdown now excludes non-locale files (e.g., `*-example.json`)
* Improved: Design of comparison table (icons, alignment, spacing)
* Improved: JS-based and PHP-based info pages (cleaner structure, removed duplicate headers)
* Improved: All admin info pages rewritten for clarity and user guidance
* Improved: Welcome page layout and UX, including unified AWX admin header
* Improved: Build script extended without losing compatibility with free/plus/pro workflows

* Updated: Admin menu now shows fewer top-level pages (JS/PHP JSON docs moved into Welcome tabs)
* Updated: Example code and explanations for JS and PHP translation loading
* Updated: Build logic now supports WordPress.org packaging workflow

* Fixed: Styles on Welcome page not loading due to missing enqueue hook
* Fixed: Minor formatting issues in JSON documentation pages

= 1.2.4 =
* Added: Automatic removal of original JS/CSS files when a .min version exists (build process cleanup)
* Added: Automatic deletion of stale files inside build/<edition> before packaging
* Improved: Version detection in build.php using a more robust header parser
* Improved: Minification workflow now logs executed steps and skipped files for better debugging
* Improved: Free/Plus/Pro code separation (admin menu integration and build consistency)
* Updated: ZIP creation now uses correct internal folder name (anywarex-clone-translate)
* Updated: ZIP files are now stored cleanly under /zips/
* Dev: Temporary build folders (tmp-zip-*) are automatically removed after packaging
* Dev: Build script now ensures consistent file paths across Windows/macOS/Linux

= 1.2.3 =
* Added: Full build system for Free/Plus/Pro editions (JS/CSS minification, PHP comment stripping)
* Added: Automatic build targets (free, plus, pro) via new build.php script
* Added: NPM integration for JS/CSS minification (Terser + CleanCSS)
* Added: strip-php-comments.php to remove comments from premium editions
* Improved: File loader now supports flexible locale filenames (de-de.json, de-DE.json, de-ch.json)
* Improved: JSON path resolver handles case sensitivity on Linux systems
* Improved: Detection of i18n/js and i18n/php folders using unified helpers
* Improved: More consistent behavior when retrieving translated values from JSON (fallback logic)
* Updated: Internal directory handling to prepare for future template-based cloning
* Updated: Documentation for JSON JS-based and PHP/JS-based editors
* Fixed: Issue where some locale variants (e.g., de-ch.json) were not detected on case-sensitive systems
* Fixed: Minor routing issue when no locale was explicitly selected (default fallback restored)
* Dev: Added structured build workflow in /tools (minifiers, recursive copy, directory cleanup)
* Dev: Clean separation between /src and /build directories for professional deployment

= 1.2.2 =
* Improved: JSON Editor now supports both i18n/js and i18n/php directories
* Improved: Server file list now shows full relative paths (e.g. i18n/js/de-CH.json, i18n/php/de-DE.json)
* Added: “Delete from server” button with AJAX delete operation
* Added: Smart path resolver allowing file input such as “php/de-DE.json” or “de-DE.json” or “de-CH.json”
* Removed: Obsolete “Split & download” button from JSON editor
* Updated: AJAX handlers fully refactored (load, save, delete) and unified
* Updated: Editor GUI cleaned up, simplified and more consistent
* Fixed: Issue where JSON files were only loaded from i18n/js
* Fixed: Minor encoding and pretty-print inconsistencies when saving JSON files
* Fixed: Export feature now uses the correct filename based on the currently opened JSON file
* Dev: Legacy helper methods removed, replaced with resolve_json_path() and json_dirs()
* Dev: JSON info pages (“JS-based” & “PHP-based”) are now visible in all editions (Free, Plus, Pro)

= 1.2.1 =
* Updated: Default Language Switcher style set to “Flag + EN”
* Updated: Version bump in main plugin file and admin.js
* Improved: Settings registration now uses WordPress defaults correctly
* Improved: Cleaner output and consistent option handling
* Fixed: Ensured fallback values match new default behavior

= 1.2.0 =
* Initial public release
* Added language routing
* Added content cloning tools
* Added JSON i18n structure
* Added backend translation management

== Upgrade Notice ==

= 1.2.2 =
This update improves the JSON Editor, adds delete functionality, supports PHP/JS paths, and includes multiple refinements.

= 1.2.1 =
This update improves default behavior of the language switcher and updates internal versioning.

= 1.2.0 =
Recommended update for improved routing and stability.
