=== GreenAudit ===
Contributors: tariqtahir
Tags: sustainability, carbon footprint, green web, eco-friendly, website audit
Requires at least: 6.0
Tested up to: 6.9
Requires PHP: 7.4
Stable tag: 1.0.0
License: GPLv3 or later
License URI: https://www.gnu.org/licenses/gpl-3.0.html

Measure, reduce, and report your website’s carbon footprint — directly from your WordPress dashboard.

== Description ==

🌍 **GreenAudit** is a technical sustainability toolkit for WordPress — empowering developers, agencies, and eco-conscious site owners to quantify and lower their digital carbon emissions.

Unlike generic carbon calculators, GreenAudit integrates real-time metrics (page weight, energy efficiency, hosting type) with authoritative data from the [Website Carbon Calculator API](https://www.websitecarbon.com), then generates **professional, downloadable PDF audit reports** — ideal for compliance, client deliverables, and ESG reporting.

✅ **Key Features**
- 🔍 One-click carbon footprint analysis per page/post
- 📊 Detailed metrics: CO₂ per page view, energy rating, data transfer
- 📄 Automated PDF reports (using dompdf) — branded, printable, shareable
- ⚙️ Admin dashboard with site-wide sustainability score
- 🌱 Actionable recommendations to reduce impact (e.g., image optimization, caching)
- 🌐 Multilingual-ready (POT included)

💡 **Why It Matters**  
The internet produces ~1.6 billion tonnes of CO₂ yearly — more than most countries. GreenAudit makes sustainability *measurable* and *actionable* — aligning with global climate goals and ethical web development.

Built for transparency, security, and scalability — no external tracking, no data collection.

== Installation ==

1. Go to **Plugins → Add New** in your WordPress admin.
2. Click **Upload Plugin**, then choose `greenaudit.zip`.
   *(Or manually upload the `greenaudit` folder to `/wp-content/plugins/` via FTP.)*
3. Activate the plugin.
4. Visit the new **GreenAudit** menu item in the left sidebar to run your first audit.

== Frequently Asked Questions ==

= Does this plugin send my data to third parties? =
No. Page analysis is done via an anonymous API call (only URL + page size sent — no personal/user data). PDF generation happens server-side.

= Can I customize the PDF report? =
Yes. The plugin uses a modular template system — developers can override report templates via your theme.

= Is this plugin compatible with caching/CDN? =
Yes. GreenAudit measures the *actual served* page size — so results reflect your live optimizations.

= Can I use this for client reporting? =
Absolutely. The PDF includes your site name, date, and metrics — ready to include in sustainability or performance reviews.

== Screenshots ==

1. Admin dashboard showing site-wide carbon score
2. Per-page audit results with energy rating
3. Sample PDF report (clean, professional layout)
4. Recommendations panel with actionable tips

== Changelog ==

= 1.0.0 =
* Initial stable release.
* Updated stable tag to match version.
* Minor fixes and code cleanup.

== Upgrade Notice ==

= 1.0.0 =
This update includes critical security improvements and PDF reporting. Backup before upgrading.

== Privacy Policy ==

GreenAudit does not collect, store, or transmit any personal data by default.

If enabled by the site administrator, the plugin may perform external HTTP requests to public APIs 
(e.g., for performance metrics or carbon footprint estimation). These requests may include the 
audited URL and basic metadata (e.g., page size, load time), but no personally identifiable 
information (PII) or user-tracking data is collected or shared.

The plugin does not set cookies, does not track users across sites, and does not integrate with 
third-party analytics or advertising services.

All audit reports (including PDF exports) are generated and stored locally on the site unless 
explicitly exported by the administrator.

== External Services ==

This plugin connects to external APIs to analyze website sustainability metrics. These services are required for carbon footprint calculation and green hosting verification.

### The Green Web Foundation API
- **Purpose:** Verifies whether a website is hosted on infrastructure powered by renewable energy.
- **Data Sent:** The domain name or URL being audited (e.g., `example.com`).
- **When Sent:** Each time a user runs a sustainability audit or checks green hosting status.
- **Service Provider:** The Green Web Foundation (non-profit)
- **Terms of Service:** https://www.thegreenwebfoundation.org/about/
- **Privacy Policy:** https://www.thegreenwebfoundation.org/privacy-statement/

### Website Carbon API
- **Purpose:** Estimates CO₂ emissions, energy consumption, and environmental impact of web pages.
- **Data Sent:** The public URL being analyzed and basic page metrics (e.g., page size in bytes).
- **When Sent:** Each time a carbon calculation is performed via the plugin dashboard or report generation.
- **Service Provider:** Wholegrain Digital / Website Carbon
- **Terms of Service:** https://www.websitecarbon.com/terms/
- **Privacy Policy:** https://www.websitecarbon.com/privacy/

🔒 **Important Notes:**
- No personal data, user information, or PII is ever transmitted to these services.
- Only the public URL/domain being audited is sent — identical to what any visitor or crawler would see.
- All API calls are made server-side from your WordPress installation; end-users' browsers do not connect directly to these services.
- If external connectivity is blocked, the plugin will display a clear error message and skip the external analysis step.

== Third Party Libraries ==

This plugin bundles DOMPDF (https://github.com/dompdf/dompdf),
licensed under the MIT License.
License: GPLv2 or later

It also includes:
- masterminds/html5 (MIT)
- phenx/php-font-lib (MIT)
- phenx/php-svg-lib (MIT)
- sabberworm/php-css-parser (MIT)

All bundled libraries are unmodified and used in compliance with their licenses.

== Credits ==
- Carbon calculation methodology: [Website Carbon Calculator](https://www.websitecarbon.com)  
- Icons: [Heroicons](https://heroicons.com) (MIT)

== Author ==
Developed by Tariq Tahir — advocate for ethical, sustainable technology.  
🌐 https://ecowebtools.org  
✉️ tariq@ecowebtools.org  