=== Niquelao Link Guard ===
Contributors: kokeperez, kokenet
Tags: broken links, link checker, seo, maintenance, redirects
Requires at least: 6.0
Tested up to: 7.0
Requires PHP: 7.4
Stable tag: 0.6.3
License: GPLv2 or later
License URI: https://www.gnu.org/licenses/gpl-2.0.html

Find broken internal and external links with low-resource incremental scanning, get local fix suggestions, and repair them in bulk.

== Description ==

Developed by [Koke Perez](https://kokeperez.es).

Niquelao Link Guard finds the broken links on your site and helps you fix them, with an approach designed to avoid hurting your hosting performance and to reduce false positives.

**Key differences:**

* **Incremental scanning**: it only analyzes new or edited content (when each post is saved), instead of re-scanning the whole site over and over.
* **Low resource usage**: HTTP checks run in batches in the background via cron, never during your visitors page loads. Batch size and pause between requests are configurable.
* **Fewer false positives**: retries with increasing delays (1, 3 and 7 days) and respect for the `Retry-After` header before confirming a link as broken. 403 responses and timeouts are marked as "review", not "broken".
* **100% local suggestions**: for broken internal links, it proposes the correct URL by matching slug/title against your own database. For 301/302 redirects, it suggests updating to the final URL. No AI calls, no API keys, no subscriptions.
* **Bulk fixing**: remove the link keeping the text, replace it with the suggested or a manual URL, or mark it as ignored, all from the admin panel.
* **Undo history / trash**: every change is logged and can be reverted. Content edits are restored from the WordPress revision created before the change, and deleted or ignored records can be restored too.
* **Security scan (local)**: flags suspicious or malicious links using local heuristics - spam keywords, text/target mismatch (phishing), obfuscated URLs, risky TLDs, URL shorteners, dangerous schemes - plus injected content like scripts, iframes and hidden text. A risk level and its reasons are shown for full transparency.
* **Transparency**: each result shows the exact HTTP status code and the reason for its classification.
* **Prioritization**: links are sorted by number of occurrences so you fix the highest-impact ones first.

== Installation ==

1. Upload the `niquelao-link-guard` folder to `/wp-content/plugins/`.
2. Activate the plugin from the WordPress "Plugins" menu.
3. Go to "Link Guard" in the admin menu and click "Scan all content".
4. Adjust the behavior under "Link Guard -> Settings".

Multisite: activate the plugin per site (site by site), not network-wide. Each site keeps its own link tables, settings and history. Network activation is supported and will set up every existing site, but per-site activation is the recommended and tested mode.

== Frequently Asked Questions ==

= Does it send data to external services? =
No. The only network requests are the HTTP checks to your own link URLs, which is the plugin's core function. There is no AI, no API keys and no subscriptions.

= Does it work on multisite? =
Yes. It is designed to run per site: each site has its own scan tables, settings and undo history, and data is isolated between sites. Per-site activation is the recommended mode. If you activate it network-wide, it will set up every existing site automatically, but it does not add a network-level admin screen.

= Will it slow down my site? =
No. Checks run in batches in the background using WP-Cron, never during page loads for visitors. You can reduce the batch size and increase the pause between requests in the settings.

= Does it modify my content without permission? =
No. Fixes (remove/replace) are only applied when you confirm them from the panel.

== Screenshots ==

1. Main panel with the links table: type, status, HTTP code, location, risk level and fix suggestions.
2. History and trash screen with one-click undo for every change.
3. Settings screen ("Niquelao" style) with scanning, cron, exclusions and the security detection card.

== Changelog ==

= 0.6.3 =
* Renamed the internal code prefix from "nlg" to "niquelao_lg" (classes, options, constants, hooks, transients) to meet the WordPress.org prefix requirement and match the rest of the Niquelao suite. Settings are migrated automatically on update. Database table names were already unique and are unchanged.
* Added kokenet to the contributors list.

= 0.6.1 =
* Compliance polish for the WordPress.org review: exact-slug lookups in the suggester now use the core `get_page_by_path()` API instead of a direct SQL query; the outgoing User-Agent header now runs the site URL through `esc_url_raw()`; and multisite behavior is documented (per-site design, with network activation setting up every existing site). No functional change for single-site installs.

= 0.6.0 =
* New history and trash screen: every content or record change is logged and can be undone. Content changes are restored from the WordPress revision created before the change; deleted records and ignored links can be restored too. Entries older than 30 days are pruned automatically.

= 0.5.0 =
* New local security scan: flags suspicious or malicious links (spam keywords, phishing text/target mismatch, obfuscated URLs, risky TLDs, URL shorteners, dangerous schemes) and injected content (scripts, iframes, inline event handlers, hidden text). 100% local, no external services.
* New "Risk" column with level and transparent reasons, a "Suspicious" filter, and a dashboard alert when high-risk links are found.

= 0.4.3 =
* Occurrences column now lists the posts and pages where each link appears, with view and edit links for each one.

= 0.4.2 =
* Coding standards and WordPress.org guideline compliance (readme in English, documented direct DB access).

= 0.4.1 =
* Settings screen with scanning, performance and exclusion controls.
* readme.txt and repository preparation.

= 0.3.0 =
* Local suggester for broken internal links by slug/title similarity.
* Update suggestion for 301/302 redirects.

= 0.2.0 =
* Single and bulk actions: remove, replace, ignore, recheck.

= 0.1.0 =
* Core: incremental scanning, cron-based checking and results panel.

== Upgrade Notice ==

= 0.6.3 =
Internal prefix renamed to "niquelao_lg" for WordPress.org compliance. Your settings are migrated automatically.

= 0.6.1 =
Compliance and multisite polish. Recommended before submitting or updating on WordPress.org.

= 0.6.0 =
Adds an undo history / trash so you can revert changes made by mistake. Recommended for all users.

= 0.5.0 =
Adds local detection of suspicious/malicious links and injected content. Recommended for all users.

= 0.4.3 =
Shows where each link is used (post/page) so you can decide what to do. Recommended for all users.

= 0.4.2 =
Compliance and coding-standards pass. Recommended for all users.

= 0.4.1 =
Adds the configurable settings screen. Recommended for all users.
