=== Beulog ===
Contributors: digitalshiftllc
Tags: ai, content, publishing, automation
Tested up to: 7.1
Requires at least: 6.4
Requires PHP: 8.0
Stable tag: 1.3.1
License: GPL-2.0-or-later
License URI: https://www.gnu.org/licenses/gpl-2.0.html

Connect Beulog to WordPress with background imports, editable blocks, original covers and protected local edits.

== Description ==
[Beulog](https://beulog.com) is the connected editorial platform.
Beulog is an external AI editorial workspace for research, writing, original image generation and publishing. This free connector imports your published workspace articles into WordPress. A Beulog account and publishing key are required; AI generation in the external service uses paid credits. The connector itself has no paid feature gates.

Manage imports from a clear publishing desk, review drafts in the block editor, and keep local editorial decisions protected.

== Installation ==
If upgrading from the earlier aiblogs connector, deactivate it first, then activate Beulog. Connection settings, queue entries, imported posts and editorial baselines are retained. Remove the earlier plugin only after Beulog activation succeeds.
1. Use the current Beulog application and run its database migration.
2. Upload this ZIP in WordPress > Plugins > Add New > Upload Plugin and activate it.
3. Create an articles:read publishing key in your Beulog workspace.
4. Open Settings > Beulog. Save your HTTPS application address and key. Choose your author and optional category.
5. Test connection, then Sync articles. Follow each article in the publishing desk.

New imports are drafts unless automatic publication is enabled. Existing drafts remain drafts when you change that setting. A cover must finish downloading and processing before a new article is created. Failed articles retry independently up to five times with increasing delays. Fix the cause and select Retry article to try again.

== Background sync ==
Discovery downloads lightweight changes instead of complete unchanged articles. It checkpoints only after jobs are safely queued. Content and workspace publishing-setting changes are detected. One article is processed per worker request. A watchdog recovers interrupted requests and overdue work; repeated interruption becomes a visible failure. Closing the settings page does not cancel the queue.

WordPress cron needs website traffic or a server scheduler. For reliable timing, ask your host to run `wp cron event run --due-now` every minute. Do not disable WP-Cron unless a working external scheduler is installed. The dashboard warns about overdue scheduled checks. CLI commands: `wp beulog sync`, `wp beulog status`.

== Editing & conflicts ==
Paragraphs, headings, lists, tables, images and section groups use native WordPress blocks. Navigation and expandable FAQs preserve their semantic HTML. PHP DOM is recommended; hosts without it use an editable Classic block fallback. Images are stored locally with responsive sizes and alt text. Enable the inline cover only if your theme does not already show the featured image.

Local text, slug, excerpt, author, taxonomy, image and SEO-field edits are protected. Review conflicts with Keep WordPress version or explicitly Use Beulog version. Replacement overwrites those fields using the latest source while preserving the current publication status. Trashed posts cannot be replaced until restored. Source unpublishing or deletion never deletes WordPress copies.

On upgrading from 1.1, existing text fingerprints are verified before establishing the stronger fingerprint. Existing published posts remain protected. The queue and schedules upgrade automatically; the application migration must be deployed first.

== SEO ==
Uses real WordPress permalinks, authors, publication dates and local images. Yoast and Rank Math receive title and description metadata. Active frontend SEO hooks own the schema/social output; if a plugin is installed but not initialized, built-in metadata remains available. FAQ schema is emitted only while imported content is unchanged. Arabic content keeps its language and reading direction.

== Security & lifecycle ==
Keys remain on the WordPress server. Optional: define BEULOG_PUBLISHING_KEY in wp-config.php instead of storing it in the database. Keep it scoped to articles:read. Requests use HTTPS, no redirects, bounded responses, WordPress SSRF protections, streamed image downloads and strict media limits. Admin actions require capability checks and nonces. Remote markup is sanitized and cannot execute shortcodes or inject block directives.

Disconnect clears local connection settings and stops sync, preserving posts and media. Deactivation stops scheduled jobs but preserves settings and queue. Uninstall removes settings and queue tables, including on multisite, and preserves imported posts/media. Revoke the key in Beulog when no longer needed; remove a wp-config.php key manually if configured there. Each multisite site has its own connection and queue.

== External service ==
Service website: https://beulog.com. AI research, writing, image generation and workspace storage run in this external service; the connector imports the resulting articles.
Connects to the Beulog HTTPS application you configure and image URLs returned by it. The publishing key is sent only to that application, never to image hosts. Importing articles sends no visitor information. Optional reader analytics is described below and starts only after consent. Your application operator controls its service terms and data. This plugin does not require a Rank Math or Yoast account.

== Blog analytics ==
Analytics is optional and disabled by default. Enable it in your Beulog workspace, add your website to Allowed websites, then enable Blog analytics here and select Test connection. Readers see a consent control; declining sends no analytics. Logged-in users and previews are excluded.

After consent, the configured Beulog service receives the public article ID, an ephemeral reading-session ID, device category, referring website domain, views, reading time and scroll depth. It does not receive the publishing key, full page URLs, names or email addresses. It does not use tracking cookies or fingerprinting. Data is retained for 90 days. GPC and DNT are respected. The tracker is bundled locally. Update your privacy policy with the service address and these details. A suggested notice appears in WordPress Privacy settings.

Developers can connect an existing consent manager with window.BeulogAnalytics.grantConsent() and window.BeulogAnalytics.revokeConsent() after the tracker loads. Consent is never inferred automatically from another plugin.

== Changelog ==
= 1.3.1 =
* Indexed article and cover lookup reuse reduces repeated metadata queries.
* Cached dashboard totals with immediate invalidation after queue changes.
* Removed per-row metadata scans from live status polling.
* Reviewed database operations and clarified optional analytics disclosure.

= 1.3.0 =
* Optional consent-first article analytics, linked to workspace reporting.
* Local tracker, visitor opt-out, DNT/GPC support and privacy-policy guidance.

= 1.2.2 =
* Arabic settings, status messages and confirmations with a bundled gettext catalog.
* RTL layouts with independent LTR handling for addresses, keys and English articles.

= 1.2.1 =
* Rebranded as Beulog for beulog.com, with shared platform and plugin identity.
* Preserves existing connection settings and imported article records.

= 1.2.0 =
* Background queue, incremental sync, retry recovery, native blocks and protected local edits.
* Shared Beulog branding and improved Yoast/Rank Math metadata refresh.
