=== Google Reviews Widget ===
Contributors: insightdesigns
Tags: google, reviews, widget, ratings, places
Requires at least: 4.6
Tested up to: 6.9
Stable tag: 1.1.1
Requires PHP: 7.0
License: GPLv2 or later
License URI: https://www.gnu.org/licenses/gpl-2.0.html

Fetches and displays Google review data for your business. Creates a JSON file updated daily.

== Description ==

Google Reviews Widget automatically fetches your business's Google review data (average star rating and number of reviews) and stores it in a JSON file on your WordPress site. The data is updated once per day using WordPress's built-in cron system.

**Features:**

* Automatic daily updates of Google review data
* Configurable update time
* Uses Google Place ID for accurate, fast lookups
* Generates JSON file accessible via URL
* ACID-compliant file operations (atomic writes with backup)
* Manual update button
* Automatic update checking
* Simple, clean admin interface

**Use Cases:**

* Display reviews on your website
* Create embeddable review widgets
* Feed review data to other applications
* Monitor your business reputation

**Requirements:**

* Google Places API key
* Your business's Google Place ID

== Installation ==

1. Upload the plugin files to `/wp-content/plugins/google-reviews-widget/` or install via WordPress plugin installer
2. Activate the plugin through the 'Plugins' menu in WordPress
3. Go to 'Google Reviews' in the admin menu — the Getting Started tab will guide you
4. Enter your Google Places API key in the Settings tab
5. Use the "Find My Place ID" search to locate your business and auto-fill your Place ID
6. Click 'Update Now' to fetch your review data
7. Add `[google_reviews]` to any page or post to display your reviews

== Frequently Asked Questions ==

= How do I get a Google Places API Key? =

Visit the [Google Cloud Console](https://console.cloud.google.com/) and create a new project. Enable the Places API and create an API key. More details: https://developers.google.com/maps/documentation/places/web-service/get-api-key

= How do I find my Google Place ID? =

Use the [Place ID Finder](https://developers.google.com/maps/documentation/javascript/examples/places-placeid-finder) tool from Google. Your Place ID will start with "ChIJ".

= How often is the data updated? =

By default, data is updated once per day at 2:00 AM. You can change this time in the plugin settings.

= Can I manually update the data? =

Yes! Click the "Update Now" button on the settings page to trigger an immediate update.

= Where is the JSON file stored? =

The JSON file is stored in your WordPress uploads directory at: `/wp-content/uploads/google-reviews/reviews.json`

= What happens if the update fails? =

The plugin uses atomic file operations with backups. If an update fails, your previous valid data file will remain intact. Check your WordPress debug log for error details.

= Does this use WP-Cron or server cron? =

This plugin uses WordPress's built-in WP-Cron system, so it doesn't require access to your server's cron configuration.

== Screenshots ==

1. Plugin settings page
2. JSON file URL display
3. Manual update button

== Changelog ==

= 1.1.1 =
* Activation now detects unwritable uploads directories and surfaces a clear, actionable error in the WordPress admin
* Failed review-data updates now appear as a global admin notice (previously only visible on the plugin's settings page)
* Update checker now validates HTTP status and JSON shape, no longer caches stale "update available" notices when the update endpoint is unreachable
* Update notices now correctly disappear immediately after a successful upgrade (previously could linger for up to 24 hours)
* Plugin update screens now show a proper plugin icon
* Removed naive chmod() call that emitted PHP warnings on permission failures
* Cryptic "Failed to write temporary file" error replaced with a precise message identifying the actual cause
* Compatibility tested up to WordPress 6.9

= 1.1.0 =
* Added [google_reviews] shortcode with 5 preset styles (default, compact, minimal, horizontal, badge) and a custom style option
* Added visual Custom Style Builder with live preview
* Added Place ID lookup tool in admin settings
* Added tabbed admin interface (Getting Started, Settings, Shortcodes, Customize)
* API key is now masked in the admin panel
* Improved admin UI with copy-to-clipboard shortcode references

= 1.0.0 =
* Initial release
* Daily automatic updates via WP-Cron
* Configurable update time
* Place ID-based lookups
* JSON file generation with atomic operations
* Manual update capability
* Automatic update checking

== Upgrade Notice ==

= 1.1.1 =
Bug-fix release: better error reporting for permission and update-check failures.

= 1.1.0 =
Adds shortcode display, visual style builder, and improved admin interface.

= 1.0.0 =
Initial release of Google Reviews Widget.

== Additional Information ==

**JSON File Format:**

The generated JSON file contains:
* `business_name` - Your business name from Google
* `rating` - Average star rating (0-5)
* `review_count` - Total number of reviews
* `address` - Business address
* `google_maps_url` - Link to your Google Maps listing
* `place_id` - Your Google Place ID
* `updated_at` - ISO 8601 timestamp
* `updated_at_unix` - Unix timestamp

**API Usage:**

This plugin makes 1 API call per day to the Google Places API (Place Details endpoint). This is well within the free tier limits.


