=== Shamor — Shabbat & Holiday Site Blocker ===
Contributors: shamorapp
Tags: shabbat, jewish, holidays, block site, jewish-holidays
Requires at least: 5.0
Tested up to: 7.0
Requires PHP: 7.4
Stable tag: 2.5.9
License: GPL-2.0-or-later
License URI: https://www.gnu.org/licenses/gpl-2.0.html

Automatically close your WordPress site every Shabbat and Jewish holiday — beautiful block screen, exact halachic times, zero manual work.

== Description ==

**Does your Jewish website stay open on Shabbat and Yom Tov?**

Shamor automatically closes your WordPress site every Shabbat and Jewish holiday — and reopens it at Havdalah — with zero manual work. No cron jobs, no weekly updates, no remembering to turn it off.

Connect your site to [Shamor](https://shamor.app) in under 5 minutes. From that point on, your site displays a beautiful, customizable block screen at candle-lighting time and comes back online automatically when Shabbat ends — week after week, holiday after holiday.

**Perfect for:**

* Jewish businesses and e-commerce stores that want to observe Shabbat online
* Synagogues and community organizations
* Torah content sites, Jewish news, and blogs
* Any Jewish website owner who wants their site to reflect their values

= How It Works =

1. Create a free account at [shamor.app](https://shamor.app) and add your website
2. Install this plugin and paste your API key
3. That's it — Shamor handles everything automatically from here

Shamor fetches halachic Shabbat and holiday times for your location every week using Hebcal data. Your site closes at candle-lighting and reopens at Havdalah — automatically, every week, for every Jewish holiday on the calendar.

= Site Blocking Features =

* 🕯️ **Automatic Shabbat & Yom Tov detection** — times fetched live, no manual setup
* 🌍 **Halachic blocking modes** — block by owner's time, visitor's local time, or the stricter of the two
* 🎨 **5 colour themes** — Dark Navy, Jerusalem, Midnight, Clean White, Forest — pick in one click
* 📐 **2 layout templates** — Full (candles + parasha + zmanim) or Minimal (candles + countdown only)
* ✨ **Beautiful animated block screen** — animated candles, zmanim, parasha of the week, and havdalah countdown
* ⏱️ **Candle-lighting countdown** — shown to visitors while the site is still open
* 🔓 **Admin bypass** — let site admins browse freely during Shabbat
* 📋 **IP whitelist** — allow specific IPs to bypass the block
* 🔀 **Redirect mode** — send visitors to a custom page instead of the block screen
* 🎨 **Full customization** — colors, logo, heading, message, which sections to show
* ⚡ **Ultra-lightweight** — 1 server call per week per site; browser reloads at exact transition times with no polling

= Shabbat Times Widget =

Display candle-lighting and Havdalah times anywhere on your site — **no Shamor account required**.

* 🟦 **Gutenberg block** (`shamor/shabbat-times`) — drag into any post or page with live editor preview
* 🧩 **Elementor widget** — full design controls panel in the Elementor editor
* 📦 **Classic sidebar widget** — add via Appearance → Widgets
* 🔡 **Shortcode** — `[shamor_times]` works in any theme or page builder
* 🏙️ **18 city presets** — Jerusalem, Tel Aviv, New York, London, Paris, Melbourne and more
* ⏱️ **Live countdown timer** — shows "Shabbat starts in HH:MM:SS" and switches to havdalah countdown during Shabbat
* 🎨 **4 display styles** — Card, Minimal, Inline, Banner
* 🌐 **Hebrew & English** — auto-detects from WordPress site locale
* ⚙️ **Per-widget customisation** — background, text, and accent colours; font size; border radius

= Halachic Blocking Modes =

Set in your Shamor dashboard under **Websites → Settings**:

* **Owner's time** — site closes based on your location's Shabbat time (default)
* **Visitor's time** — site closes based on each visitor's browser timezone
* **Stricter** — site closes as soon as *either* the owner or the visitor enters Shabbat

= Zmanim Preferences =

* Choose candle-lighting offset: 10 / 15 / 18 / 20 / 25 / 30 / 40 minutes before sunset
* Choose havdalah: tzeit ha-kochavim (3 stars, 7.083°) or fixed 42 / 50 / 72 minutes after sunset

== Installation ==

1. Upload and activate the plugin in **WordPress → Plugins → Add New → Upload Plugin**
2. Create a free account at [shamor.app](https://shamor.app) and add your website
3. Copy the API key from **Shamor dashboard → Websites**
4. Go to **WordPress → Shamor** (top-level menu) and paste the key
5. Save — your site will now close automatically every Shabbat and Yom Tov

== Frequently Asked Questions ==

= Do I need an account? =

Yes, a free account at [shamor.app](https://shamor.app) is required. The API key links your WordPress site to your Shamor configuration.

= Which holidays are covered? =

All major Jewish holidays: Rosh Hashana, Yom Kippur, Sukkot, Shemini Atzeret, Simchat Torah, Pesach, Shavuot, and regional holidays (Yom Ha'atzmaut etc.) — based on Hebcal data.

= Can I customize the block screen? =

Yes — you can set a custom logo, heading, message, background color, text color, and choose which sections (zmanim, parasha, powered-by) to show.

= Will bots and search engines be blocked? =

No — common crawlers (Googlebot, Bingbot, etc.) always pass through so your SEO is not affected.

= What happens if Shamor's server is unavailable? =

The plugin fails open — your site stays accessible. A local WordPress transient cache stores the last known status.

= Is JavaScript required? =

Only for "visitor's time" and "stricter" blocking modes. The default "owner's time" mode works entirely in PHP with no JS dependency.

= Does the Shabbat Times Widget need a Shamor account? =

No. The widget fetches times from shamor.app, which handles everything server-side. No account, no API key, and no Shamor subscription is needed.

= How do I use the shortcode? =

Add `[shamor_times]` to any post, page, or widget area. You can pass optional attributes: `[shamor_times city="new-york" style="card" lang="en" show_parasha="1"]`. See the full attribute list in the block editor sidebar.

= Does the Elementor widget work without Elementor Pro? =

Yes — the Shamor Elementor widget works with the free version of Elementor (version 3.0 or higher).

= How many cities are available in the widget? =

18 built-in presets: Jerusalem, Tel Aviv, Bnei Brak, Haifa, New York, Los Angeles, Miami, Chicago, Toronto, Montréal, London, Paris, Antwerp, Amsterdam, Melbourne, Sydney, Johannesburg, and Buenos Aires.

== External Services ==

This plugin connects to the Shamor service (shamor.app). Two separate endpoints are used:

**1. Shabbat blocking status** (`https://shamor.app/api/shabbat-status`)
Fetches whether your site should currently be blocked and the weekly schedule of times.
* **What is sent:** your site key (an opaque token you created in the Shamor dashboard) and, for visitor-timezone modes, the visitor's IANA timezone string (e.g. `America/New_York`). No names, emails, or IP addresses are transmitted.
* **When:** once per week server-side (PHP) to cache the schedule; once per browser session from the visitor's browser when using Visitor's Time or Stricter modes.

**2. Shabbat times widget** (`https://shamor.app/api/widget-times`)
Fetches candle-lighting and Havdalah times for the selected city. No Shamor account is required for this feature.
* **What is sent:** the selected city's latitude, longitude, timezone, candle-lighting offset, and your WordPress site's home URL (to allow the Shamor admin to see which sites have the widget installed). No visitor data is transmitted — this call is made server-side from your WordPress server.
* **When:** once per city per week, cached in a WordPress transient until one hour after Havdalah.

**Service home:** [https://shamor.app](https://shamor.app)
**Privacy policy:** [https://shamor.app/privacy](https://shamor.app/privacy)
**Terms of service:** [https://shamor.app/terms](https://shamor.app/terms)

== Screenshots ==

1. Settings page — API key, blocking mode info, and access exceptions.
2. Block screen design — colour theme picker and layout selector.
3. Classic Dark Navy theme block screen — animated candles, parasha, zmanim table, and havdalah countdown.
4. Jerusalem (warm gold) theme block screen.
5. Shabbat Times Widget — card style showing candle-lighting and havdalah times.
6. Gutenberg block editor — live server-side preview of the Shabbat Times widget.
7. Elementor widget — design controls panel in the Elementor editor.
8. Classic sidebar widget — Shabbat times in a traditional WordPress widget area.

== Changelog ==

= 2.5.9 =
* Fix: Text domain corrected to shamor-shabbat-guard to match plugin slug
* Fix: Main plugin file renamed to shamor-shabbat-guard.php
* Fix: wp_add_inline_style() used for admin menu icon CSS (Plugin Check compliance)
* Fix: "Powered by Shamor" Elementor widget option defaults to off (opt-in only)

= 2.5.5 =
* Fix: Dynamic theme CSS variables now output via wp_add_inline_style() — full wp_enqueue compliance for block screen
* Fix: Block screen JS data now passed via wp_add_inline_script() instead of a raw inline script tag
* Fix: "Powered by Shamor" defaults to off in shortcode and classic sidebar widget (was accidentally on)
* Fix: Removed "About the Shamor Platform" section from readme — WhatsApp/Telegram/Discord are not plugin features
* Fix: External Services readme section rewritten — two endpoints documented separately, with exact data-sent and when-called details

= 2.5.4 =
* New: Shabbat Times Widget now fetches times via shamor.app (proxy) instead of calling Hebcal directly — improves privacy and reliability
* New: Widget sends site URL to shamor.app so admins can see which sites have the widget installed (no visitor data is transmitted)
* Fix: External Services readme section updated — only shamor.app is listed as a direct external call

= 2.5.3 =
* Fix: All JS and CSS moved to external enqueued files (wp_enqueue_script / wp_enqueue_style compliance)
* Fix: "Powered by Shamor" widget credit now defaults to off — explicit opt-in required
* Fix: Block screen "Powered by Shamor" also defaults to off
* Fix: Clarified readme description — WhatsApp/Telegram/Discord are platform features, not plugin features

= 2.5.2 =
* Fix: Plugin header description translated to English (WordPress.org compliance)
* Fix: Added uninstall cleanup — all plugin options removed when plugin is deleted
* Fix: Admin preview URL now uses a nonce for CSRF protection
* Fix: Admin menu icon no longer uses base64_encode (WordPress.org Plugin Check compliance)
* Fix: Added External Services disclosure to readme (WordPress.org requirement)
* Fix: Tested up to updated to WordPress 6.7

= 2.5.1 =
* Fix: Language auto-detects from WordPress site locale (Hebrew for he_IL, English otherwise); "Site default" added to all language selectors
* Fix: All widget labels fully translated in both Hebrew and English — candle lighting, havdalah, parasha, countdown, powered-by, error message
* Fix: "Powered by Shamor" widget credit now controlled from a single global toggle in Settings → Widget Credit (on by default, subtle 9px style)
* Fix: Shamor Credit on block screen and Widget Credit are now separate settings

= 2.5.0 =
* New: Shabbat Times Widget — display candle lighting & havdalah times on any page without a Shamor account
* New: Gutenberg block (shamor/shabbat-times) with live server-side preview in the block editor; native colour pickers for all colour fields
* New: Classic WordPress sidebar widget (Appearance → Widgets)
* New: Elementor widget with full design controls panel
* New: Shortcode [shamor_times] for use in any theme or page builder
* New: 4 display styles — Card (dark gradient), Minimal (border stripe), Inline (horizontal), Banner (full-width header bar)
* New: Live Shabbat countdown timer — shows "Shabbat starts/ends in HH:MM:SS" within a configurable hour threshold; switches automatically to havdalah countdown during Shabbat
* New: Per-widget colour customisation — background, text, and accent colours via CSS custom properties
* New: Font size control (Small / Medium / Large) and border radius slider
* New: Show/hide parasha name and havdalah time independently per widget
* New: 18 city presets — Jerusalem, Tel Aviv, Bnei Brak, Haifa, New York, Los Angeles, Miami, Chicago, Toronto, Montréal, London, Paris, Antwerp, Amsterdam, Melbourne, Sydney, Johannesburg, Buenos Aires
* New: Shabbat times cached as WordPress transients (up to 6 days) with automatic expiry 1 hour after havdalah
* Fix: Plugin logo now bundled locally — no external asset requests (WordPress.org Plugin Check compliance)
* Fix: Removed deprecated load_plugin_textdomain() call (WordPress.org Plugin Check compliance)
* Fix: Shamor Credit on block screen defaults to off for new installs

= 2.4.0 =
* New: 5 built-in colour themes — Dark Navy, Jerusalem (warm), Midnight Blue, Clean White, Forest
* New: 2 block-screen layouts — Full (parasha + zmanim table) and Minimal (candles + havdalah countdown)
* New: visual theme picker and layout selector in the settings page
* Fix: custom colour pickers now correctly override the selected preset theme

= 2.3.0 =
* Performance: schedule fetched once per week per site (was: every 60–300 s per page load)
* Performance: eliminated JS polling entirely — browser fires a reload at exact candle-lighting and havdalah timestamps via setTimeout
* Performance: visitor timezone check cached in localStorage for the full week (was: sessionStorage, one API call per browser session)
* Performance: visitor times fetched from public CDN-cached endpoint — only ~400 unique timezones worldwide, virtually zero origin load
* Security: API key no longer exposed in JS source code for visitor/stricter modes
* Removed: "Check Frequency" setting (no longer needed — no polling)

= 2.2.2 =
* New: halachic blocking modes — owner time / visitor time / stricter (המחמיר מביניהם)
* New: candle-lighting minutes preference (10–40 min before sunset)
* New: havdalah time preference (tzeit / 42 / 50 / 72 minutes)
* New: candle-lighting countdown bar shown while site is open (can be hidden)
* New: visitor timezone detection — JS checks browser TZ, server verifies, PHP serves block page
* Fix: polling now calls shamor.app directly — no more admin-ajax.php load on every poll
* Fix: adaptive TTL — poll interval tightens automatically near Shabbat transitions

= 2.1.0 =
* New: customizable block screen (colors, logo, heading, message)
* New: show/hide zmanim, parasha, and "powered by" footer
* New: IP bypass list and admin bypass option
* New: redirect mode
* New: configurable browser poll interval
* Fix: plugin cache now uses server-provided TTL
* Removed: bundled GeoIP database

= 2.0.0 =
* Complete rewrite — powered by Shamor SaaS (shamor.app)
* Shabbat times fetched live from Shamor API
* Animated candles block screen
* Browser polling for real-time detection

== Upgrade Notice ==

= 2.5.5 =
Full wp_enqueue compliance for block screen; "Powered by" opt-in correctly enforced everywhere; External Services documentation rewritten.

= 2.5.4 =
Shabbat Times Widget now routes through shamor.app — faster, cached, and no direct Hebcal calls from the plugin.

= 2.5.3 =
wp_enqueue compliance, "Powered by" opt-in, and description clarifications. Recommended for all users.

= 2.5.2 =
WordPress.org compliance fixes: uninstall cleanup, CSRF protection on preview, and external service disclosures. Recommended for all users.

= 2.2.2 =
New halachic blocking modes and zmanim preferences. Update recommended for all users.
