- Replace inc/facebook-stats.php with inc/google-reviews.php: fetches
average star rating + review count from the Places API (New) instead
of Facebook's Graph API, same cache-to-JSON/fallback-on-failure shape
as before.
- index.php: stat card now shows the native star rating ("4.8★ average
rating") instead of a recommend %, sourced from Google. Drops the
Facebook-followers line entirely — Google's API has no equivalent and
showing a stale/static number wasn't worth keeping. "Follow on
Facebook" links elsewhere on the site are untouched.
- config.example.php: swap FB_PAGE_ID/FB_PAGE_ACCESS_TOKEN/
FB_STATS_CACHE_TTL/FB_FALLBACK_* for GOOGLE_PLACE_ID/
GOOGLE_PLACES_API_KEY/GOOGLE_STATS_CACHE_TTL/GOOGLE_FALLBACK_RATING/
GOOGLE_FALLBACK_REVIEW_COUNT (set to the pub's actual 4.8★/71 reviews),
with setup instructions in comments. config.php (gitignored) updated
to match.
- Remove the now-dead .stat-row CSS that only existed for the dropped
followers line; rebuild styles.css.
Co-Authored-By: Claude Sonnet 5 <noreply@anthropic.com>
45 lines
2.0 KiB
PHP
45 lines
2.0 KiB
PHP
<?php
|
|
/**
|
|
* Site config template — tracked in git, safe to commit (no real secret
|
|
* here). Copy this file to config.php (gitignored) and fill in your own
|
|
* GOOGLE_PLACES_API_KEY there.
|
|
*/
|
|
|
|
// Base URL the site is currently reachable at. Used for social sharing
|
|
// meta tags (og:url, og:image, twitter:image), which need absolute URLs.
|
|
// Currently pointed at the temporary daviddyer.me subdomain — update
|
|
// this to the permanent domain once the site moves there.
|
|
define('SITE_URL', 'https://theoldfitz.daviddyer.me');
|
|
|
|
// The Old Fitz's Google Place ID — identifies the business for the
|
|
// Places API. Look it up with Google's Place ID Finder:
|
|
// https://developers.google.com/maps/documentation/places/web-service/place-id
|
|
// (search "The Old Fitz Public House, Marion, IN" and copy the ID shown).
|
|
define('GOOGLE_PLACE_ID', '');
|
|
|
|
// API key for the Places API (New), used to fetch the live star rating
|
|
// and review count for the homepage stat card. Until this is filled in,
|
|
// the site quietly uses the fallback numbers below.
|
|
//
|
|
// To generate one:
|
|
// 1. Go to https://console.cloud.google.com, create (or pick) a
|
|
// project, and enable "Places API (New)" under APIs & Services.
|
|
// 2. Enable billing on the project — Google requires a card on file,
|
|
// but the free monthly credit comfortably covers a rating/review
|
|
// lookup cached for hours at a time on a low-traffic site like
|
|
// this one.
|
|
// 3. Create an API key (APIs & Services → Credentials) and restrict
|
|
// it to "Places API (New)" only.
|
|
define('GOOGLE_PLACES_API_KEY', '');
|
|
|
|
// How often to re-fetch from Google, in seconds. 6 hours is plenty for
|
|
// a number that moves a few times a month, and stays well inside
|
|
// Google's caching allowance for Place Details data.
|
|
define('GOOGLE_STATS_CACHE_TTL', 6 * 60 * 60);
|
|
|
|
// Fallback numbers — used whenever there's no API key/Place ID yet, or
|
|
// the Google API call fails for any reason. Update these by hand if
|
|
// you're not using the live lookup.
|
|
define('GOOGLE_FALLBACK_RATING', 4.8);
|
|
define('GOOGLE_FALLBACK_REVIEW_COUNT', 71);
|