=== Astrowave Simple Visit Counter ===
Contributors: saigamo
Tags: counter, access counter, visitor counter, widget, lightweight
Requires at least: 5.0
Tested up to: 7.1
Requires PHP: 7.4
Stable tag: 1.2.1
License: GPLv2 or later
License URI: https://www.gnu.org/licenses/gpl-2.0.html

Lightweight visitor counter. No DB, cookie dedupe, bot filter, midnight reset by WP timezone.

== Description ==

**Astrowave Simple Visit Counter** is an ultra-lightweight visitor counter that stores data in a file — no database tables.

= Features =

* **Cache-friendly**: Uses Ajax so cached pages (e.g. WP Super Cache) still show live counts.
* **No database**: Counts are stored in a simple `.dat` file under uploads.
* **Cookie dedupe**: One count per visitor per day (reload-safe).
* **Bot filter**: Skips common search crawlers (Google, Yahoo, Bing, etc.).
* **Midnight reset**: Resets the “today” count at **00:00 in your WordPress timezone** (Settings → General → Timezone). Example: if the site timezone is `Asia/Tokyo`, it resets at midnight JST — not a hard-coded Japan-only clock.
* **Backup**: Occasional automatic backup of the count file.
* **Milestone popup (optional)**: Celebrate when the total hits a number you set. Empty / 0 = off (default).
* **GDPR-friendly**: Uses an essential functional cookie (flag only), not tracking.

= How to use =

1. Activate the plugin
2. Appearance → Widgets → add “Astrowave Simple Visit Counter”
3. Or use the shortcode `[astrowave_simple_visit_counter]`
4. Toggle yesterday/today in Settings → Astrowave Simple Visit Counter
5. (Optional) Set a milestone number on the same settings screen

= Shortcodes =

* `[astrowave_simple_visit_counter]` — follows settings
* `[astrowave_simple_visit_counter show_daily="true"]` — force yesterday/today
* `[astrowave_simple_visit_counter show_daily="false"]` — hide yesterday/today

---

**Astrowave Simple Visit Counter** は、データベースを一切使わない超軽量なアクセスカウンタープラグインです。

= 特徴 =

* **キャッシュプラグイン対応**: Ajax（非同期通信）を採用。WP Super Cacheなどのキャッシュ環境下でも、常に最新の正確なカウント数を表示します。
* **DB不要**: データはファイル（.dat）のみで管理。サイトを重くしません。
* **Cookie二重カウント防止**: 同じ人が何回リロードしても、1日1回しかカウントされません。
* **Bot排除**: Google、Yahoo、Bingなどの有名な検索クローラーを自動で除外します。
* **夜中0時リセット**: WordPressのタイムゾーン設定（設定 → 一般 → タイムゾーン）に従い、そのタイムゾーンの夜中0時に「今日」のカウントがリセットされます。日本向けサイトで `Asia/Tokyo` にしていれば、従来どおり日本時間（JST）の0時です。世界のどこからでも、サイトのタイムゾーン設定に合わせて動作します。
* **バックアップ機能**: 万が一のデータ破損に備えて、自動バックアップを行います。
* **キリ番ポップアップ（任意）**: 設定した合計数になった訪問者だけにお祝い表示＋画像保存。空欄でOFF（デフォルト無効）。
* **GDPR安全**: 使用するCookieは「機能上必須なCookie（エッセンシャルCookie）」のため、同意バナー不要です。

= 使い方 =

1. プラグインを有効化
2. 外観 → ウィジェット → 「Astrowave Simple Visit Counter」をサイドバーに追加
3. または、投稿・固定ページに `[astrowave_simple_visit_counter]` ショートコードを記述
4. 「昨日○人 今日○人」の表示は、設定 → Astrowave Simple Visit Counter で一括ON/OFF
5. （任意）同じ設定画面でキリ番の数字を入れると、ちょうどその数になった訪問者にポップアップを表示

= ショートコード =

* `[astrowave_simple_visit_counter]` — 設定画面の表示設定に従う
* `[astrowave_simple_visit_counter show_daily="true"]` — 昨日/今日も強制表示
* `[astrowave_simple_visit_counter show_daily="false"]` — 昨日/今日を強制非表示

= フォント設定 / Fonts =

デフォルトでは同梱の「Orbitron」フォント（宇宙風デジタルフォント）が使用されます。
設定 → Astrowave Simple Visit Counter から、お好みのGoogle Fontsに変更することもできます。

Default font is bundled Orbitron. You can switch to a Google Font from the settings screen.

== Installation ==

1. Upload the `astrowave-simple-visit-counter` folder to `/wp-content/plugins/`.
2. Activate “Astrowave Simple Visit Counter” from Plugins.
3. Add the widget under Appearance → Widgets (or use the shortcode).

日本語:

1. `astrowave-simple-visit-counter` フォルダを `/wp-content/plugins/` にアップロードします。
2. WordPress管理画面の「プラグイン」から「Astrowave Simple Visit Counter」を有効化します。
3. 外観 → ウィジェットで「Astrowave Simple Visit Counter」をお好みの場所に追加します。

== Frequently Asked Questions ==

= Does midnight reset use Japan time (JST)? =

No hard-coded JST. It follows **Settings → General → Timezone**. With `Asia/Tokyo`, that is midnight JST. With another timezone, it resets at that zone’s midnight.

= 夜中0時リセットは日本時間固定ですか？ =

いいえ、固定ではありません。**設定 → 一般 → タイムゾーン** に従います。`Asia/Tokyo` なら日本時間の0時、それ以外のタイムゾーンならその地域の0時です。

= Does it use a database? / データベースは使いますか？ =

No. Counts are stored in `wp-content/uploads/astrowave-simple-visit-counter/data.dat`.

いいえ、一切使いません。カウントデータは `wp-content/uploads/astrowave-simple-visit-counter/data.dat` にテキストで保存されます。

= Do I need a cookie consent banner? / Cookieの同意バナーは必要ですか？ =

The cookie is an essential functional flag (“already counted today” = `"1"`), not tracking. Typically no consent banner is required for this use case under GDPR/ePrivacy essential-cookie rules.

このプラグインが使用するCookieは、「今日カウントしたか」を示す単純なフラグ（値は "1" のみ）です。個人を特定・追跡するものではないため、GDPR/ePrivacy指令における「機能上必須なCookie」に該当し、同意バナーなしで使用できます。

= Can I customize the design? / カウンターのデザインを変えたいです =

Override CSS classes `.astrowave-simple-visit-counter-wrap`, `.astrowave-simple-visit-counter-total`, `.astrowave-simple-visit-counter-daily`.

CSSクラス `.astrowave-simple-visit-counter-wrap`、`.astrowave-simple-visit-counter-total`、`.astrowave-simple-visit-counter-daily` をテーマのCSSで上書きすることで自由にカスタマイズできます。

= Hide yesterday/today on specific pages only? / 特定のページだけ昨日/今日を隠したいです =

Settings are site-wide. Use theme CSS, e.g.:

`.home .astrowave-simple-visit-counter-daily { display: none; }`

設定画面はサイト全体のON/OFFです。ページごとの制御はテーマの追加CSSで行ってください。

= What is the milestone popup? / キリ番ポップアップとは？ =

Set a target total (e.g. 100000). Only the visitor who reaches that exact number sees a celebration popup and can save an image. Empty or 0 disables it. For testing, set “current total + 1” and visit in another browser / private window.

設定画面で合計カウントの目標数字（例: 100000）を入れると、ちょうどその数になった訪問者だけにお祝いポップアップと「画像を保存」ボタンが表示されます。空欄または 0 のときは無効です。テスト時は「現在の合計 + 1」を設定し、別ブラウザ／シークレットウィンドウでアクセスしてください。

== Screenshots ==

1. Front-end display (default Orbitron font) / フロント表示
2. Settings page / 管理画面の設定ページ
3. Milestone popup / キリ番ポップアップ

== Changelog ==

= 1.2.1 =
* Fix: when yesterday/today (or total) exceeds the display digit width, show the full number instead of truncating.
* 修正: 昨日/今日（および合計）が表示桁を超えたとき、末尾だけ残さず全桁を表示するようにしました。

= 1.2.0 =
* Added optional milestone popup (default OFF): celebrate when the total hits your number, with image save.
* Clarified that midnight reset follows the WordPress timezone (not hard-coded JST).
* キリ番ポップアップ（オプション・デフォルトOFF）を追加。
* 夜中0時リセットが WordPress のタイムゾーン設定に従う旨を説明に明記（JST固定ではない）。

= 1.1.1 =
* 「昨日/今日の表示」を設定画面の一括ON/OFFに統一（ウィジェット個別チェックを削除）
* WordPress 7.1 で動作確認（Tested up to: 7.1）

= 1.1.0 =
* キャッシュプラグイン（WP Super Cache等）環境下でも常に最新の数字を表示できるよう、Ajax（非同期通信）によるカウント取得方式に変更しました。

= 1.0.0 =
* 初回リリース
* DB不要の超軽量カウンター
* Cookie二重カウント防止
* Bot排除機能
* 夜中0時リセット（WordPressタイムゾーン準拠）
* ウィジェット＆ショートコード対応
* Google Fonts カスタムフォント対応
* 自動バックアップ機能
