=== SEO Buddy AI Engine ===
Contributors: seobuddy
Tags: seo, blogging, publishing, content, automation
Requires at least: 5.8
Tested up to: 7.1
Requires PHP: 7.2
Stable tag: 1.5.3
License: GPLv2 or later
License URI: https://www.gnu.org/licenses/gpl-2.0.html

Publishes the articles written by the SEO Buddy AI Content Engine to this site, as drafts or as posts.

== Description ==

This plugin is the WordPress end of the SEO Buddy AI Content Engine. You write nothing here: it
listens for finished articles from your SEO Buddy account and turns each one into a post on this
site.

What arrives with an article:

* the full body, with the headings, lists and links intact
* the featured image, downloaded into your own media library rather than linked from somewhere else
* the alt text for that image
* the tags from the article's keywords
* the meta description, written into Yoast SEO, Rank Math and All in One SEO, whichever you use
* the focus keyword, for the same plugins

You decide whether articles arrive as drafts for you to read first, or go straight to published.
Drafts is the default, because nothing should appear on your site without you knowing.

An article that is sent twice updates the post it made the first time rather than creating a second
one. The match is on the article's own id, kept in post meta, so renaming a post or changing its
slug does not break it.

= What it sends =

The plugin never sends anything on its own, with one exception: when you save your integration key,
it makes one request to seobuddy.com to say that this site is ready to receive articles.

Everything this plugin exchanges with seobuddy.com, and the two third-party services an article can
bring with it, is set out in full under "External services" below.

= Link Exchange, if you want it =

SEO Buddy runs a link exchange: a site that gives a relevant link earns credit it can spend on
receiving one. Some of those links belong in posts you wrote yourself, where a sentence already
mentions the thing the link would explain.

This is **off** until you switch it on, on the plugin's settings screen. When it is on:

* SEO Buddy can only wrap wording that is **already in your post**. It cannot write a sentence,
  change one, or move one. If the words are not there, nothing happens.
* It never touches a heading, a caption, a quotation, code, or text that is already a link.
* You choose how many links a post may carry (two by default), and never two to the same site.
* Every link it adds is listed on the settings screen, and one button takes all of them out again.
  Your wording is untouched either way — only the links come out.

= What you need =

A SEO Buddy account with the AI Content Engine. The integration key is in your account under
AI Content Engine, then Integration, then WordPress.

== External services ==

This plugin is the WordPress end of the SEO Buddy AI Content Engine, a paid service at
seobuddy.com operated by InfiniteQuant Ltd. The plugin is not useful without an account there.
It connects to that service, and permits two third-party embeds, as follows.

= 1. Telling SEO Buddy this site is ready =

When you save an integration key on the settings screen, the plugin makes one request to
https://seobuddy.com/wp-plugin/handshake, so your SEO Buddy account knows the connection is live
without you having to go back and press anything there.

That request sends: this site's address, the address of this plugin's REST route, the site title,
the WordPress version, the plugin version, and whether articles are set to arrive as drafts or as
published posts. It carries the integration key you have just saved, so the service knows which
account this site belongs to.

It happens once per key, and never again unless you change the key. Apart from this, the plugin
never contacts the service on its own.

= 2. Answering your SEO Buddy account =

Your account can ask this site two things, and only when it asks:

* the list of this site's posts — id, title, address, slug, status and date — so that new articles
  can link to pages you already have;
* the full content of one post you have pointed it at from your account, so that post can be
  refreshed or rewritten in place.

Every one of those requests must carry the integration key saved on this screen, and a site with no
key saved refuses all of them. No post content leaves this site unless a request signed with your
key asks for it.

= 3. Files that arrive with an article =

When an article arrives, every file it uses — the featured image, the illustrations, infographics
and charts inside the body, and any document it offers for download — is fetched once from
seobuddy.com into this site's own media library, and the article is rewritten to point at your
copies.

That is a download made by this site when an article arrives; nothing but the request itself is
sent, and it happens once per file no matter how many times the article is redelivered.

**Your published pages load nothing from seobuddy.com, and your readers never contact it.** A link
an article makes to a page on seobuddy.com is left alone, because that is an ordinary link the
article means the reader to be able to follow.

= 4. Link Exchange placement, if you switch it on =

If you enable Link Exchange on the settings screen, SEO Buddy can ask this site to turn wording that
already exists in one of your posts into a link. Each request is signed with your integration key,
and this site refuses every one of them while the setting is off. Nothing is sent to SEO Buddy by
this feature; the requests come the other way.

= 5. YouTube =

If an article from your account includes a video, the plugin allows a YouTube embed through, and the
visitor's browser then loads it from youtube.com or youtube-nocookie.com. That is Google's service
and Google's terms and privacy policy apply to it.

= Terms and privacy =

* SEO Buddy terms and conditions: https://seobuddy.com/terms-and-conditions
* SEO Buddy privacy policy: https://seobuddy.com/privacy-policy
* YouTube terms of service: https://www.youtube.com/t/terms
* Google privacy policy: https://policies.google.com/privacy

== Installation ==

1. Install the plugin through Plugins, Add New, or upload the ZIP under Plugins, Add New, Upload.
2. Activate it. You will land on the settings page.
3. Paste the integration key from your SEO Buddy account.
4. Choose whether articles arrive as drafts or published, and who they belong to.
5. Press Save. Your SEO Buddy account will show the connection as live within a few seconds.

== Frequently Asked Questions ==

= Do I need an account to use this plugin? =

Yes. The plugin is the receiving end of the SEO Buddy AI Content Engine, which is a paid service at
seobuddy.com. On its own the plugin does nothing.

= Will it publish without asking me? =

Only if you tell it to. New installs save every article as a draft. Publishing straight away is a
setting you have to turn on.

= What happens if the same article is sent again? =

The post it created the first time is updated. Fields that are not included in the new delivery are
left exactly as they were, so an edit you made by hand is not undone by a redelivery that only
carried a new image.

= Where do the images come from? =

They are downloaded into your own media library the first time they arrive — the featured image and
every picture, chart and file inside the article — and the post is rewritten to use your copies. The
same file arriving again is reused rather than downloaded twice.

Once an article has been delivered, nothing on your published pages loads from seobuddy.com. Your
site does not depend on ours to serve its own posts.

= Can SEO Buddy add links to posts I wrote myself? =

Only if you switch that on, under Link Exchange on the settings screen. It is off in a new install.
When it is on, SEO Buddy can turn words that are already in one of your posts into a link, to earn
you Link Exchange credit. It cannot write or change a sentence, and it will not touch a heading, a
caption, a quotation, code, or text that is already a link. Everything it adds is listed on the
settings screen and one button removes all of it.

= Can I control what gets published, from my own code? =

Yes. `seo_buddy_article` sees the delivery before anything is done with it and can change or refuse
it, `seo_buddy_post_fields` sees the arguments going to WordPress, `seo_buddy_content` sees the
finished body, `seo_buddy_allowed_html` decides what markup survives, `seo_buddy_localise_assets`
and `seo_buddy_asset_extensions` control the copying of files, `seo_buddy_allowed_meta_keys` decides
which custom fields SEO Buddy may write (none, until you say otherwise), and `seo_buddy_saved` and
`seo_buddy_links_added` fire after the fact.

= Can I use a custom post type? =

Yes. An article can name any public post type registered on this site, and is created as an ordinary
post when it does not. Categories are only set where the type actually uses them.

= Can SEO Buddy read or change posts I wrote myself? =

Two separate things, and both are yours to allow.

Refreshing: from your SEO Buddy account you can pick an existing post to rewrite. The plugin then
lets your account read that post and update it in place. It never edits a post you have not chosen,
and a post that belongs to another SEO Buddy article is refused rather than overwritten.

Link Exchange: if — and only if — you switch it on, SEO Buddy can turn wording that is already in
one of your posts into a link. It cannot write or change a sentence. See the Link Exchange entry
above.

= How is the connection secured? =

Every request has to carry the integration key from your settings, in an Authorization header, and
it is compared in a way that cannot be timed. A site with no key saved refuses everything.

== Screenshots ==

1. The plugin's settings screen. Paste the integration key from your SEO Buddy account, choose
   whether articles arrive as drafts or go straight live, and pick the author and category they are
   filed under.
2. An article that has arrived, published on the site. The opening answer and the key-takeaway list
   carry their own styling, so they read correctly whatever your theme does with them.
3. A chart from inside an article, served from the site's own media library. Every picture, chart and
   file an article uses is copied in when it arrives, so a published page loads nothing at all from
   seobuddy.com.
4. Link Exchange, off until you switch it on. SEO Buddy may then turn wording that is already in one
   of your own posts into a link — never in a heading, a caption or an existing link — capped per
   post, and everything it adds is listed on this screen with one button to take it all out again.

== Changelog ==

= 1.5.3 =
* The settings screen showed the date of the last handshake as a raw timestamp. It now uses this
  site's own date and time format, like every other date WordPress shows you.
* Post author and Category are the same question — where an article lands — so they now sit together
  on the settings screen. Link Exchange, which is a separate choice, comes after them.

= 1.5.2 =
* Fixed: the plugin could report a different version to SEO Buddy than the one in its own header,
  which made an up-to-date site look a release behind and stopped some of the newer features being
  offered to it.
* Housekeeping for the plugin directory: the WordPress version this plugin is tested against is now
  declared in this readme only, which is the one place that controls what you see on the plugin page.

= 1.5.1 =
* An article that was written for one day and delivered on another can now carry the date it was
  meant to have, and correct the date of a post that is already published.
* Only when your SEO Buddy account states the date outright. A redelivery, or one of the passes that
  adds internal links to a live post, leaves that post's date exactly where it is — a routine edit
  should never move the day a post says it was published.
* A published post is never moved to a future date. WordPress would take it off your site and
  schedule it, which is not what correcting a date means.

= 1.5.0 =
* Every file an article uses is now copied into your media library, not only its images — documents
  and downloads too. The plugin looks for references to seobuddy.com anywhere in the article rather
  than in a fixed list of tags, so a new kind of embed cannot quietly leave your pages loading from
  our server.
* Articles can now carry their own author, publication date, categories, post type, page template,
  excerpt, SEO title and canonical, comment settings and sticky flag. Your settings on this screen
  remain the fallback for anything an article does not specify.
* New: Link Exchange placement. Off unless you switch it on. SEO Buddy can turn wording already in
  one of your own posts into a link, to earn you credit. It cannot write or alter a sentence, it
  will not touch headings, captions, quotations, code or existing links, it is capped per post, and
  every link it adds is listed on the settings screen with one button to remove all of them.
* The plugin now reports what it supports, so SEO Buddy never has to guess from a version number.
* Nine filters and two actions for site owners who want to change what arrives or what is done with
  it. See the FAQ.

= 1.4.0 =
* Every picture in an article is now copied into your own media library, not just the featured
  image. Illustrations, infographics and charts used to stay on seobuddy.com and be fetched from
  there by every reader of the post; now the post points at your own copies and your pages load
  nothing from us.
* Copied images carry the usual WordPress image class, so WordPress can serve a phone a smaller
  version instead of the full-size original.
* Images that cannot be fetched in time are left pointing at the original — which still works — and
  copied on the next delivery, so a slow image never fails a publish.
* Only images hosted by SEO Buddy are copied. A picture an article quotes from somewhere else is
  left exactly as it is.

= 1.3.2 =
* Documentation only. The readme now sets out every external service the plugin uses: what is sent
  to seobuddy.com and when, what your SEO Buddy account can read back, where article images are
  hosted, and the YouTube embeds an article can carry — with links to the relevant terms and
  privacy policies.
* Corrected the images entry in the FAQ: only the featured image is copied into your media library.

= 1.3.1 =
* The key-takeaway list now draws its own bullet points, whatever the theme's
  list styling does.

= 1.3.0 =
* Your SEO Buddy account can now read a post you point it at, and refresh an existing post in
  place — including posts that were not written by SEO Buddy, once you choose them.
* A post that belongs to another SEO Buddy article is refused rather than overwritten.

= 1.2.0 =
* The opening answer and key-takeaway blocks in arriving articles now carry their own styling,
  loaded only on posts this plugin created.

= 1.1.0 =
* Each article can carry its own draft-or-publish choice from your SEO Buddy account. Articles
  without one keep following this site's setting.

= 1.0.0 =
* First release.

== Upgrade Notice ==

= 1.5.3 =
Tidies the settings screen: dates in your site's own format, and the two questions about where an
article lands kept together. Nothing changes in how articles are published.

= 1.5.2 =
Corrects the version the plugin reports back to SEO Buddy, so your site is offered the features it
actually supports. Nothing changes in how articles are published.

= 1.5.0 =
Copies every file an article uses into your own media library, adds per-article control over author,
date, categories and more, and introduces optional Link Exchange placement, which is off until you
turn it on.

= 1.4.0 =
Your posts stop loading images from seobuddy.com. Every picture is copied into your own media
library and the post is rewritten to use it. Recommended for every site.

= 1.3.2 =
Documentation only: the readme now discloses every external service the plugin uses.

= 1.3.0 =
Adds the ability for your SEO Buddy account to read and refresh posts you point it at. Update so
content-refresh features work with this site.

= 1.0.0 =
First release.
