=== QW Share Buttons ===
Contributors: hyspeedhimanshuyadav
Donate link: https://himanshusir.in
Tags: share buttons, social share, share count, floating share bar, whatsapp share, mobile share bar
Requires at least: 5.8
Tested up to: 7.1
Requires PHP: 7.4
Stable tag: 1.1.2
License: GPLv2 or later
License URI: https://www.gnu.org/licenses/gpl-2.0.html

Add distinctive social share buttons with optional click-based counts, a floating bar, and shortcodes. Built by Himanshu Yadav.

== Description ==

**QW Share Buttons** adds social sharing buttons to your posts and pages.

= Features =

* Inline share buttons (above, below, both, or after the first paragraph)
* Click-based share counts (counts button clicks on your site)
* Optional starting count (offset added to click counts for display)
* Per-post count controls in the editor
* Floating side share bar
* Native "Share" button that opens the phone's own share sheet (mobile browsers that support it)
* Sticky mobile bottom share bar
* Copy link button
* WhatsApp, Telegram, Facebook, Truth Social, X (Twitter), LinkedIn, Bluesky, and more
* Shortcodes: [qwshare_share_buttons] and [qwshare_share_count]
* Share statistics and CSV export
* Dark mode bar, mobile label modes, thank-you message
* Lightweight: frontend assets load only when needed

= Important: About share counts =

Share counts in this plugin are **click-based**. They increase when a visitor clicks a share button on your website. They are **not** official share totals from Facebook, X, LinkedIn, or other networks, and they do not call those network APIs.

Displayed total = Starting count (optional) + click counts on your site.

= Shortcodes =

* `[qwshare_share_buttons]` — display the share bar
* `[qwshare_share_count]` — display the share count only

= Privacy =

To limit rapid repeat clicks, the plugin may store a short-lived technical key (a hash based on post ID, visitor IP address and browser user-agent) as a WordPress transient. This is used only to prevent count spam, is not sold, and is not used for advertising.

== External services ==

This plugin constructs share links that open third-party social network share dialogs when a visitor clicks a share button. No data is sent automatically by the plugin server-side; the browser navigates (or opens a new tab) to the chosen network’s share endpoint with the current page URL and title.

Services used (when the corresponding network is enabled):

* WhatsApp (api.whatsapp.com) — opens WhatsApp share with pre-filled text. Terms: https://www.whatsapp.com/legal/terms-of-service Privacy: https://www.whatsapp.com/legal/privacy-policy
* Telegram (t.me) — opens Telegram share. Terms: https://telegram.org/tos Privacy: https://telegram.org/privacy
* Facebook (facebook.com) — opens Facebook sharer. Terms: https://www.facebook.com/terms Privacy: https://www.facebook.com/privacy/policy
* X / Twitter (x.com) — opens post composer. Terms: https://x.com/tos Privacy: https://x.com/privacy
* LinkedIn (linkedin.com) — opens share-offsite. Terms: https://www.linkedin.com/legal/user-agreement Privacy: https://www.linkedin.com/legal/privacy-policy
* Pinterest, Reddit, Bluesky, Threads, Nextdoor, and other networks listed in the plugin settings — each opens that network’s public share/intent URL with the page URL (and sometimes title). Consult each network’s own terms and privacy policy.

No personal data is transmitted by the plugin itself beyond what the visitor’s browser sends when following a normal share link. The plugin does not register with or call network APIs in the background.

== Installation ==

1. Upload the plugin folder to `/wp-content/plugins/` or install the ZIP via **Plugins → Add New → Upload**.
2. Activate **QW Share Buttons** through the **Plugins** menu.
3. Go to **QWShare** in the admin menu to configure networks and display options.

== Frequently Asked Questions ==

= Are these official Facebook / X share counts? =

No. Counts track share **button clicks on your site only**. They are not pulled from social network APIs.

= What is the starting count? =

An optional number you can set globally or per post. It is added to click counts when showing the total. It is not a claim of external network shares.

= Can I set a different starting count per post? =

Yes. Edit a post and use the **QWShare Share Counts** box in the sidebar.

= Does it work on mobile? =

Yes. You can control mobile visibility and whether labels show as icons only on small screens.

= What is the "Share" button? =

It opens the phone's built-in share menu, so visitors can send your page to any app installed on their phone. It uses the browser's Web Share feature, so it only shows on mobile browsers that support it and only on HTTPS sites. Elsewhere it stays hidden.

= What is the mobile bottom bar? =

A slim share bar fixed to the bottom of the screen on phones and small tablets. Turn it on under Settings > Mobile Bottom Bar. It uses the first networks from your Inline Networks list and can add the Share button.

= How do I place buttons in a custom location? =

Use the shortcode `[qwshare_share_buttons]` in content, widgets (if shortcodes are enabled), or a block that supports shortcodes.

== Changelog ==

= 1.1.2 =
* Fixed duplicate counter rows: two simultaneous first shares on a post could each insert a row and double the Stats total. Duplicates are now merged automatically.
* Share tracking now accepts published posts only (drafts and private posts are rejected). Filter: qwshare_trackable_post_statuses.
* Added a hard per-IP rate limit (default 60 tracked clicks per minute, independent of User-Agent) so rotating User-Agent strings cannot inflate counts or fill the options table with throttle transients. Filter: qwshare_ip_rate_limit (return 0 to disable).
* Shortcode pages now enqueue CSS/JS in the head when the post content contains [qwshare_share_buttons] or [qwshare_share_count], preventing a flash of unstyled buttons.
* Removed the unused nonce from the tracking request and localized script; simplified the count update to a single read.

= 1.1.1 =
* Fixed share counting on cached pages (Cloudflare, page-cache plugins). The AJAX tracking endpoint no longer rejects requests because of an expired page-baked nonce; protection remains the existing IP + User-Agent throttle.
* Fixed shortcode [qwshare_share_buttons] / [qwshare_share_count] rendering without CSS/JS when used on Pages, widgets, or post types not selected under Inline Networks. Shortcodes now force-enqueue frontend assets.
* Made share-count increments atomic (SQL UPDATE … SET meta_value = meta_value + 1) to prevent lost counts under concurrent clicks.

= 1.1.0 =
* Polished admin UI: refined header, segmented tabs, improved cards, network tiles, sticky save bar
* Better visual hierarchy and responsive layout across settings, Stats, and Support
* Native "Share" button (Web Share API) — opens the device share sheet on supported mobile browsers (HTTPS). Enable under Inline Networks; counted only when the share is completed
* Optional sticky mobile bottom share bar (Settings → Mobile Bottom Bar), with 3–6 button limit and pinned Share button; hides the side floating bar on small screens when enabled
* Fixed share-count throttling behind Cloudflare / reverse proxies: new "Visitor IP Source" setting (Automatic, Cloudflare, Reverse proxy / CDN, Server only)
* Throttle key now includes user-agent so shared-IP visitors are not treated as one person
* New filters: qwshare_visitor_ip, qwshare_native_share_mobile_only, qwshare_show_bottom_bar, qwshare_bottom_bar_buttons

= 1.0.0 =
* Initial release of QW Share Buttons
* Inline share buttons (above, below, both, or after the first paragraph) and floating side bar
* Click-based share counts with optional starting count and per-post controls
* 25+ networks, copy link button, dark mode, mobile label modes, thank-you message
* Shortcodes: [qwshare_share_buttons] and [qwshare_share_count]
* Share statistics with CSV export

== Upgrade Notice ==

= 1.1.2 =
Hardening release: fixes rare duplicate counter rows, counts published posts only, adds a per-IP rate limit, and loads shortcode styles in the head.

= 1.1.1 =
Critical reliability fix: share counts now work correctly on cached pages and concurrent clicks; shortcodes always load their CSS/JS.

= 1.1.0 =
Adds native mobile Share button and optional sticky bottom bar (both off until you enable them). Fixes click throttling on sites behind Cloudflare/CDN — set "Visitor IP Source" in QW Share settings if you use a proxy.
