=== Ranktim Article Sync ===
Contributors: ranktim
Tags: ai content writer, seo, auto blog, ai writer, content automation
Requires at least: 5.8
Tested up to: 7.1
Requires PHP: 8.0
Stable tag: 1.9.5
License: GPLv2 or later
License URI: https://www.gnu.org/licenses/gpl-2.0.html

Sync the AI SEO articles from your Ranktim account into WordPress and publish them with images, meta tags and schema.

== Description ==

Ranktim Article Sync connects your WordPress site to Ranktim — an AI-powered content platform that generates and schedules SEO-optimized articles.

The plugin automatically syncs articles from your Ranktim account and publishes or saves them as posts in WordPress.
Regular syncs check today's queue, with a daily catch-up window so articles missed on previous days can still be imported automatically.

Supports:
- HTML-ready content (converted from Markdown)
- Featured images (auto sideload)
- SEO meta (Yoast SEO & Rank Math)
- JSON-LD Article/BlogPosting schema
- Custom slugs and metadata
- Duplicate prevention

== Key Features ==

- Optimized WP-Cron sync every six hours, with daily backlog catch-up
- Manual “Sync Now” trigger
- Draft or Publish mode
- Recent content queue visibility
- Secure Integration Key (encrypted storage)
- Direct link to Ranktim Products for manually uploading WooCommerce product exports

== How It Works ==

1. Create an integration in your Ranktim dashboard
2. Copy your Integration Key
3. Install and activate the plugin
4. Paste the key in **Admin → Ranktim**
5. Choose publish mode (Draft or Publish)

Articles will sync automatically.

To upload products exported from WooCommerce, open **Admin → Ranktim → Products**. The plugin only opens the secure Ranktim Products page; you choose and upload the export file yourself.

== Requirements ==

- Active Ranktim subscription
- WordPress 5.8+
- PHP 8.0+

== External services ==

This plugin connects to the Ranktim API (ranktim.com) to retrieve the AI-generated SEO
articles you created in your Ranktim account and import them into WordPress. The service
is operated by Ranktim, the author of this plugin. A Ranktim account is required; the
plugin is a client for that service and has no content-generation ability of its own.

When and what is sent:

* Every scheduled sync (every six hours by default), on the daily catch-up run, and when
  you click "Sync Now", the plugin sends your Integration Key (as an HTTP Authorization
  header) and the date being requested to `https://ranktim.com/api/integrations/content`.
* To download an article it sends your Integration Key and the article ID to
  `https://ranktim.com/api/integrations/articles/{id}`.
* After a post has been created it sends your Integration Key and the article ID to
  `https://ranktim.com/api/integrations/ack/{id}` so the same article is not delivered twice.
* Featured images referenced by an article are downloaded from the URL supplied in the
  article payload and stored in your WordPress media library.

No site content, visitor data, or personal data is sent to Ranktim by this plugin. The
Integration Key is stored encrypted in the WordPress options table.

The "Products" link in the plugin menu only opens `https://ranktim.com/shopping/products`
in a new browser tab. The plugin does not read or upload your WooCommerce data; you
choose and upload any export file yourself on that page.

Terms of Service: https://ranktim.com/en/legal/terms
Privacy Policy: https://ranktim.com/en/legal/privacy

== FAQ ==

= Where do I get my Integration Key? =
From your Ranktim dashboard → Settings → Integrations.

= How often does it sync? =
Automatically every six hours via WP-Cron, or manually via “Sync Now”. Scheduled runs usually check today's queue; a full catch-up checks the previous 7 days once per day by default.

= Can I review articles before publishing? =
Yes. Set mode to “Draft” in plugin settings.

= Will it import duplicates? =
No. Each article is uniquely tracked and imported once.

= Does it support SEO plugins? =
Yes. Compatible with Yoast SEO and Rank Math.

= Can the plugin upload my WooCommerce products automatically? =
No. Use **Ranktim → Products** to open https://ranktim.com/shopping/products, then select and upload your exported product file manually.

== Screenshots ==

1. Plugin setup screen: connect your Integration Key and choose whether articles are published immediately or saved as drafts.
2. WordPress publishing settings: default category, author and tags, plus the automatic duplicate title/image cleanup.
3. Recent Content Queue: per-article import status for the current sync window, with a manual "Sync Now" button.

== Changelog ==

= 1.9.5 =
- Renamed the plugin to "Ranktim Article Sync" and requested the permalink "ranktim-article-sync" for WordPress.org review
- Updated the text domain to "ranktim-article-sync"

= 1.9.4 =
- Renamed the plugin to "AI SEO Article Writer by Ranktim" and requested the permalink "ai-seo-article-writer-ranktim" for WordPress.org review

= 1.9.3 =
- Updated the plugin display name and upload metadata for WordPress.org submission
- Moved the admin screen's JavaScript into an enqueued file (no inline script or onclick handlers)
- Output the Article JSON-LD through wp_print_inline_script_tag()
- Moved the remaining inline style attributes into the enqueued stylesheet
- Removed bundled translation files; translations are handled through translate.wordpress.org
- Escaped the sync-queue status icons on output

= 1.9.1 =
- Documented the Ranktim API as an external service in the readme
- Routed all diagnostic logging through a guarded debug-only logger
- Replaced unlink() with wp_delete_file() when cleaning up a failed image sideload
- Rely on WordPress just-in-time translation loading

= 1.9.0 =
- Added direct Products links in the Ranktim admin menu, settings panel, and Plugins screen
- Added clear instructions for manually uploading WooCommerce product exports to Ranktim
- Fixed the translation loading path
- Enabled the one-time migration from legacy FluxSERP settings, cron data, and post metadata
- Updated active Ranktim post metadata references and plugin upload metadata

= 1.1.0 =
- Featured image: use article's primary keyword as alt text (imageAlt from API)
- Featured image URL and alt text now stored in post meta (_ranktim_image_url, _ranktim_image_alt)

= 1.0.0 =
- Initial release
