Commit Graph
13 Commits
Author SHA1 Message Date
shadowdaoandClaude Opus 5 ecef4d3f2e Fix Fourthwall parsing breakage, add JSON-LD/sitemap sources, rework caching
Create Release / build (push) Successful in 5s
Fourthwall moved the product title from <h2> to <h1>, which silently emptied
[fourthwall_single] and [fourthwall_random]: both gated rendering on a title
match that could no longer succeed. Verified against a live store.

Parsing
- Read schema.org JSON-LD first, falling back to scraped markup field by field,
  then to og: meta tags. Each field degrades independently, so a future markup
  change can only affect what it actually touched.
- Match CSS classes with a padded contains() predicate instead of @class="...",
  and select on data-testid where available. Exact class matching is what broke.
- Surface sku, availability and currency, which were previously discarded.

Product discovery
- Enumerate products from sitemap.xml rather than scraping the store page, which
  only sees the collection it features. [fourthwall_random count="10"] could not
  return more than the 3 items a featured homepage renders.
- New source="auto|sitemap|page" attribute. Off-host <loc> entries are rejected
  so a hostile sitemap cannot redirect fetches.

Caching
- Stale-while-revalidate: stale entries are served immediately and refreshed by
  WP-Cron, so cache expiry never costs a visitor a network round trip.
- Refresh scheduling dedupes via wp_next_scheduled and takes a lock, collapsing
  a stampede to a single job.
- Fetch uncached product pages concurrently with curl_multi instead of serially.
- Cache lifetime is now configurable (default 60 minutes).
- Entries written by earlier versions are read as stale and upgraded in place,
  so caches turn over without blanking a store.

Fixes
- Build absolute product links properly. "/collections/all" + "/products/x"
  produced 404s; a trailing slash produced "//products/x".
- Escape the price on output; it was interpolated raw.
- strpos() misuse meant an error string at offset 0 was treated as success.
- Guard a null description node that would fatal when show_description="true".
- Report non-200 responses instead of caching an empty body silently.
- Drop the shared /tmp/cookies.txt jar. It was cross-site mutable state and made
  concurrent fetching unsafe; all endpoints return 200 without it.
- Remove the ssl_verify setting. It was a development affordance and its
  checkbox never worked - unchecked meant "key absent", which read as true.
  Certificate verification is now pinned on.

Co-Authored-By: Claude Opus 5 (1M context) <noreply@anthropic.com>
2026-08-06 09:33:06 -07:00
shadowdaoandClaude Opus 4.6 f22615c6d5 Fix single product parsing after Fourthwall HTML change
Create Release / build (push) Successful in 5s
Fourthwall changed product title tags from h1 to h2 on individual
product pages, breaking the fourthwall_random and fourthwall_single
shortcodes. Updated XPath query to match new h2 tag structure.

Co-Authored-By: Claude Opus 4.6 <noreply@anthropic.com>
2026-02-15 12:25:23 -08:00
shadowdao b4f17c80b3 Add fourthwall_random shortcode examples to admin settings page
Create Release / build (push) Successful in 2s
- Add three usage examples for the new [fourthwall_random] shortcode
- Include examples for basic random products, specific URLs, and different stores
- Place examples alongside existing shortcode documentation in admin panel
- Improve user experience by providing clear usage guidance
2025-06-24 11:40:08 -07:00
shadowdao 779fb54995 Add random products shortcode feature
Create Release / build (push) Successful in 5s
- Add [fourthwall_random] shortcode for displaying random products
- Support for specifying count of products to display
- Option to use all store products or specific product URLs
- Add fwembed_extract_product_urls() function to extract product URLs
- Add fwembed_get_random_products() function for randomization logic
- Update README.md with comprehensive documentation and examples
- Maintain backward compatibility with existing shortcodes
2025-06-24 11:36:36 -07:00
shadowdao 64afcb71cb Refactor plugin with improved architecture and new features
Create Release / build (push) Successful in 5s
- Eliminated code duplication by creating common HTTP request function
- Added configurable SSL verification setting for development/production
- Implemented smart caching system with 1-hour cache duration
- Enhanced admin interface with cache management and better styling
- Improved error handling and user experience
- Added comprehensive documentation and troubleshooting guide
- Updated README with new features and configuration options
2025-06-24 11:21:04 -07:00
shadowdao 1955b14ac5 Adding Feature Request for single product highlight 2025-05-18 10:25:53 -07:00
shadowdao e94ef7b84b Remove Debug Code for version 2025-04-22 13:46:42 -07:00
shadowdao bf99f442ba Major Update to add auto-update features 2025-04-22 13:35:47 -07:00
shadowdao 1bdae9a815 Update for FW switching to sending Binary instead of raw html 2025-04-22 10:48:19 -07:00
shadowdao be7db52eec Update DOM crawler to resolver PHP warning
Create Release / build (push) Successful in 3s
2025-01-26 12:30:03 -08:00
shadowdao faf1a4ec87 updating docs and settings for release 2025-01-10 19:57:13 -08:00
shadowdao 084d769cb6 updating css and html elements to improve display 2024-12-27 15:16:53 -08:00
shadowdao c2c8ac74be establish base code 2024-12-27 14:10:25 -08:00