=== Webniva Assistant ===
Contributors: webniva
Tags: seo, performance, security, woocommerce, analysis
Requires at least: 6.0
Tested up to: 7.1
Requires PHP: 7.4
Stable tag: 1.9.1
License: GPLv2 or later
License URI: https://www.gnu.org/licenses/gpl-2.0.html

Connects your WordPress site to Webniva for deeper analysis, and
optionally lets Webniva apply a small set of safe, reviewable fixes.

== Description ==

Webniva Assistant lets Webniva (https://webniva.ir) see what an external
crawler structurally cannot: your real WordPress and PHP version, active
plugins and theme, and (if installed) WooCommerce basics like product
count and currency.

Connecting is read-only by default. A second, separate setting on this
plugin's page lets you enable automated fixes -- even then, only a small,
fixed set of change types is ever supported (currently: SEO meta
descriptions, SEO title tags, and the canonical URL tag when Yoast or
Rank Math is active, image alt text on any site, and empty Elementor
Heading/Text Editor widget content when Elementor is active), every proposed
change is shown to you inside
Webniva's dashboard before anything is applied, and every applied change
can be rolled back from Webniva.

Connecting requires you to explicitly click "Connect to Webniva" from this
plugin's settings page and confirm the connection in your browser. Webniva
never has your WordPress login credentials.

== Installation ==

1. Upload the plugin files to `/wp-content/plugins/webniva-assistant`, or
   install directly through the WordPress plugins screen.
2. Activate the plugin.
3. Go to Settings > Webniva and click "Connect to Webniva".
4. Optionally, enable automated fixes from the same settings page.

== Changelog ==

= 1.9.1 =
* Phase 1 of the Compatibility Engine: the site-facts payload now also
  reports multilingual plugin (WPML/Polylang/TranslatePress), offloaded/CDN
  media, WooCommerce HPOS + checkout type (classic vs. blocks), filesystem
  write method, and PHP memory/execution limits -- detection only, doesn't
  change what's currently supported. Lays the groundwork for a merchant-
  facing compatibility view.

= 1.9.0 =
* Redesigned the Settings > Webniva screen into a tabbed layout (Connection /
  Auto-Fix / Recommended Plugins / History) with a real, dedicated
  stylesheet and script instead of a growing inline-style string.
* New "Recommended Plugins" tab: if no supported SEO plugin (Yoast SEO or
  Rank Math) or Elementor is active, install and activate it with one click
  -- pulled live from wordpress.org via WordPress's own installer, never
  bundled inside this plugin's own zip (keeps it on the current version and
  inherits WordPress's normal update mechanism afterward).
* Fix: `resolve_post_id()` now falls back to a slug-based lookup (pages and
  WooCommerce products) when core's `url_to_postid()` fails to match --
  found to be more likely on stores with many registered rewrite rules
  (e.g. multilingual plugins doubling rules per language).
* Fix: the image alt-text fix now falls back to matching the image's own
  filename against stored attachment paths when `attachment_url_to_postid()`
  can't resolve it -- closes a real gap on stores using an offloaded/CDN
  media library (image URLs rewritten to a different domain).
* Fix: editing an Elementor widget on a page with an unusually large
  `_elementor_data` blob (over 2MB) now fails cleanly with a clear message
  instead of risking a PHP memory-exhaustion error.

= 1.8.1 =
* Fix: applying a meta description, SEO title, image alt text, or canonical
  URL fix whose value was already byte-identical to what's live on the site
  (e.g. retrying a fix that already succeeded, or re-running an automated
  check against an already-fixed page) was incorrectly reported as a hard
  apply failure with no rollback record saved. Root cause: WordPress's own
  `update_post_meta()` returns `false` both on a genuine write failure and
  when the new value matches the existing one exactly (nothing to update) --
  this plugin's code treated both cases as an error. Found via a live
  end-to-end retest of the meta-description fix type against a product that
  had already been fixed once before.

= 1.8.0 =
* Redesigned the Settings > Webniva screen -- real WordPress-native card
  styling, icons and clearer status indicators, replacing the previous
  plain-paragraph layout found via a live look at the actual rendered
  screen during a full end-to-end test pass.
* New: a read-only "تاریخچه اصلاحات اخیر" (recent fixes) table on the
  same screen, listing the last 15 automated changes (date, type, page)
  straight from the plugin's own local rollback log -- no new data
  collected, no new endpoint, just surfacing what was already being
  recorded. Closes a real gap: there was previously no way to see a
  record of what Webniva changed without leaving WordPress.
* Verified against a fresh, current install (WordPress 7.1, Elementor
  4.2.3, WooCommerce 11.0.1, Yoast SEO 28.3) -- full pairing flow, the
  Elementor staleness guard, undo/redo through several real versions,
  cross-domain rejection, and CSS cache invalidation all re-confirmed
  live, not just by re-reading the code.

= 1.7.2 =
* The automatic post-verify-failure rollback for Elementor widget content
  now bypasses the staleness guard for that one specific revert -- it is
  always restoring to the exact state that existed moments earlier in the
  same request, before Webniva's own just-failed write, so there is no
  merchant edit it could clobber. A manual "rollback" click from Fix
  Center history still always keeps the guard, since real time may have
  passed since. Closes an open product-decision item from the live test
  pass: previously a fault that desynced the DB's latest-version record
  from the live page could cause the auto-rollback itself to be refused
  by the same staleness check meant for merchant edits, leaving a failed
  apply un-reverted.

= 1.7.1 =
* Fix: the widget-version restore endpoint (undo/redo) returned its raw
  internal field names (previousText/appliedText) instead of the
  previousValue/appliedValue shape every other fix type's response
  already uses, so the Node side's read of the applied text came back
  empty even though the restore itself wrote and verified correctly.
  Found via a live end-to-end test walking undo then redo through
  several real versions.

= 1.7.0 =
* New automated fix type: Elementor widget content (empty Heading and Text
  Editor widgets). Genuinely higher safety bar than every other fix type
  here -- a new versioned backup table (never evicted except by a
  generous 50-versions-per-widget cap) keeps every version of a widget's
  content Webniva has ever seen or written, a staleness guard refuses the
  write if you've edited that exact widget in Elementor's own editor
  since Webniva last looked at it, and a failed post-write verification
  automatically reverts the site before the request even completes. Every
  past version can be restored from Webniva's dashboard at any time.
* First release with its own custom database table (not just wp_options)
  -- created automatically on activation, and on upgrade for sites that
  already had the plugin installed.

= 1.6.0 =
* New automated fix type: canonical URL. Corrects a missing canonical
  tag or one pointing at the wrong domain, when Yoast or Rank Math is
  active -- same review/apply/rollback flow as the existing fix types.

= 1.5.0 =
* Security fix: the media-upload route (used by the Product Image
  Studio's "upload to WordPress" export) now independently verifies
  uploaded bytes are a real image of the declared type before keeping
  the file, and never trusts the caller's filename extension for what
  gets written to disk.
* Fixed a rollback correctness bug: rolling back an older fix could
  silently discard a newer fix already applied to the same field.
* Fixed a rollback/apply race that could leave a fix's status
  inconsistent with what actually happened on the site.
* target_url is now anchored to this site's own host before resolving
  a post to write to.

= 1.4.0 =
* Added a third automated fix type: image alt text. No SEO plugin
  required (plain WordPress core), works on any site with write access
  enabled. Added a small read-only route to confirm applied alt text.

= 1.3.0 =
* Added a second automated fix type: SEO title tag (Yoast/Rank Math
  aware, same rollback support as meta description).

= 1.1.0 =
* Added optional, separately-enabled automated fixes (currently: SEO
  meta description, Yoast/Rank Math aware), with a local rollback log.

= 1.0.0 =
* Initial release: read-only connection and environment reporting.
