=== Gatekeeper Download Manager ===
Contributors: CBSHS
Plugin Name: Gatekeeper Download Manager
Author: CBSHS, youxnet
Author URI: https://cbshs.com
Plugin URI: https://licenses.cbshs.com/gatekeeper-download-manager/
Tags: download, gateway, countdown, adsense, download-manager
Requires at least: 6.0
Tested up to: 6.9
Requires PHP: 7.4
Stable tag: 1.0.5
License: GPLv2 or later
License URI: http://www.gnu.org/licenses/gpl-2.0.html
Text Domain: gatekeeper-download-manager

Professional download gateway with countdown timer and Google AdSense integration. Secure, fast, and mobile-friendly.

== Description ==

**Gatekeeper Download Manager** is a professional plugin that adds a secure download gateway to your WordPress site. Perfect for digital product websites, software download sites, and content creators who want to monetize their downloads with advertising.

= Core Features =

* **Modern Download Gateway** - Clean, professional countdown page
* **Countdown Timer** - Choose from 10s, 20s, or 30s wait times
* **Google AdSense Integration** - Safe, structured ad placement
* **Secure Downloads** - Nonce-protected download links
* **Mobile Responsive** - Perfect display on all devices
* **Fast Loading** - Optimized standalone page (no theme conflicts)
* **Easy Shortcode** - Simple `[gatekeeper_download]` implementation

= How It Works =

1. Create a download link using the shortcode: `[gatekeeper_download url="YOUR_FILE_URL" text="Download Now"]`
2. Users click the download button
3. They're redirected to a secure gateway page with countdown timer
4. Optional ads are displayed during the countdown
5. After countdown, download begins automatically

= Google AdSense Integration =

Instead of allowing arbitrary code (security risk), the plugin uses a safe, structured approach:
* Enter your AdSense Publisher ID
* Enter your AdSense Ad Slot ID
* Plugin generates safe, compliant ad code automatically

= Pro Version Features =

Upgrade to **Gatekeeper Download Manager Pro** for advanced features:

* **Email Unlock** - Collect emails before downloads (Mailchimp/ConvertKit integration)
* **Social Share Unlock** - Require social shares to unlock downloads
* **Custom Countdown** - Set any duration from 0-60 seconds
* **Multiple Ad Slots** - Header, sidebar, and footer ad positions
* **Advanced Analytics** - Track downloads, conversion rates, and revenue
* **Priority Support** - Get help when you need it

[Upgrade to Pro →](https://licenses.cbshs.com/gatekeeper-download-manager/)

= Use Cases =

* Software download sites
* Digital product stores
* WordPress theme/plugin distributors
* eBook download sites
* Music/video download platforms
* Any site offering file downloads

= Developer Friendly =

* Clean, well-documented code
* WordPress coding standards compliant
* Extensive hooks and filters
* Translation ready
* WPML compatible

== Installation ==

= Automatic Installation =

1. Go to WordPress Admin > Plugins > Add New
2. Search for "Gatekeeper Download Manager"
3. Click "Install Now"
4. Activate the plugin
5. Go to Settings > Gatekeeper Manager to configure

= Manual Installation =

1. Download the plugin zip file
2. Go to WordPress Admin > Plugins > Add New > Upload Plugin
3. Choose the zip file and click "Install Now"
4. Activate the plugin
5. Go to Settings > Gatekeeper Manager to configure

= Configuration =

1. **Set Countdown Time** - Choose 10s, 20s, or 30s
2. **Configure AdSense** (Optional)
   - Get your AdSense Publisher ID (format: ca-pub-XXXXXXXXXXXXXXXX)
   - Create an ad unit and get the Slot ID (10-digit number)
   - Enter both IDs in the Ad Management tab
3. **Create Download Links**
   - Use the shortcode: `[gatekeeper_download url="https://example.com/file.zip" text="Download Now"]`
   - Place it in any post, page, or custom post type

== Frequently Asked Questions ==

= How do I create a download link? =

Use the shortcode: `[gatekeeper_download url="YOUR_FILE_URL" text="Download Now"]`

Replace `YOUR_FILE_URL` with your actual file URL.

= Can I use this with any file type? =

Yes! The plugin works with any file type: ZIP, PDF, MP3, MP4, EXE, DMG, etc.

= Is it secure? =

Yes! The plugin uses WordPress nonces to protect against CSRF attacks and properly sanitizes all input/output.

= Can I customize the countdown time? =

The free version offers 10s, 20s, or 30s. The Pro version allows custom times from 0-60s.

= Do I need an AdSense account? =

No, AdSense is optional. The gateway page works perfectly without ads.

= How do I get my AdSense IDs? =

1. Go to [Google AdSense](https://www.google.com/adsense/)
2. Your Publisher ID is in Settings (format: ca-pub-XXXXXXXXXXXXXXXX)
3. Create an ad unit to get your Slot ID (10-digit number)

= Can I use other ad networks? =

The free version only supports Google AdSense. For custom ads, use the Pro version or the `gatekeeper_ad_content` filter hook.

= Is it mobile-friendly? =

Yes! The download gateway page is fully responsive and looks great on all devices.

= Does it work with caching plugins? =

Yes! The gateway page loads independently and works with all major caching plugins.

= Can I translate the plugin? =

Yes! The plugin is translation-ready. Use your preferred translation plugin (WPML, Polylang, etc.).

= Where can I get support? =

For free support, use the WordPress.org support forum. Pro users get priority email support.

== Screenshots ==

1. Download gateway page - Modern, clean interface with countdown timer
2. General Settings - Configure countdown duration
3. Ad Management - Safe Google AdSense integration
4. Usage Guide - Simple shortcode implementation
5. Mobile view - Fully responsive design

== Changelog ==

= 1.0.4 - 2026-02-02 =
**Critical Fix - Countdown Now Works!**
* FIX: Completely rewrote JavaScript using vanilla JS (no jQuery dependency)
* FIX: Added proper DOM ready check
* FIX: Fixed countdown not starting due to missing jQuery
* IMPROVE: Lighter weight - removed jQuery dependency
* IMPROVE: Better error handling with console logging
* IMPROVE: Proper element existence checks before initialization
* IMPROVE: Smoother fade animations using vanilla JS
* IMPROVE: Better browser compatibility
* Technical: Reduced JavaScript dependencies, faster loading

= 1.0.3 - 2026-02-02 =
**Critical Bug Fix**
* FIX: Countdown timer not working due to incorrect variable names
* FIX: Updated JavaScript to use correct element IDs 
* IMPROVE: Added validation for countdown time
* IMPROVE: Better error handling in JavaScript
* IMPROVE: Smoother fade animations for timer and button transitions

= 1.0.2 - 2026-02-02 =
**UI Improvements & Performance**
* NEW: Complete redesign of download gateway page with modern interface
* NEW: Gradient background with card-based layout
* NEW: Animated countdown timer with visual effects
* NEW: Download button with icon and hover animations
* NEW: Site branding link to return to homepage
* FIX: Removed wp_head() and wp_footer() to prevent theme conflicts
* FIX: Gateway page now loads independently without theme assets
* IMPROVE: Page size reduced from ~500KB to ~30KB (94% reduction)
* IMPROVE: Load time reduced from 2-3s to <0.5s (75% faster)
* IMPROVE: Better mobile responsiveness with 3 breakpoints
* IMPROVE: Added CSS animations (slideUp, fadeIn, hover effects)
* IMPROVE: Improved visual hierarchy and spacing
* IMPROVE: HTTP requests reduced from 20+ to 3 (85% reduction)

= 1.0.1 - 2026-01-31 =
**Security & Compliance Update**
* SECURITY: Fixed nonce verification with proper sanitization (wp_unslash + sanitize_text_field)
* SECURITY: Improved GET/POST parameter handling throughout plugin
* SECURITY: Replaced arbitrary HTML/JS code input with structured AdSense IDs
* NEW: Safe AdSense integration using Client ID and Slot ID fields
* IMPROVE: Plugin now generates AdSense code programmatically
* IMPROVE: All user inputs are properly sanitized
* IMPROVE: All outputs are properly escaped
* COMPLIANCE: Addressed all WordPress plugin review requirements
* UPDATE: Following "Sanitize early, Escape late, Always validate" principle

= 1.0.0 - 2026-01-25 =
**Initial Release**
* NEW: Download gateway with countdown timer
* NEW: Countdown options (10s, 20s, 30s)
* NEW: Secure nonce-protected download links
* NEW: Ad slot support
* NEW: Easy shortcode implementation
* NEW: Mobile responsive design
* NEW: WordPress coding standards compliant

== Upgrade Notice ==

= 1.0.3 =
Critical bug fix! Countdown timer now works correctly. All v1.0.2 users should update immediately.

= 1.0.2 =
Major UI update! Completely redesigned download gateway page with modern interface and 75% faster loading. Highly recommended upgrade for all users.

= 1.0.1 =
Critical security update! Fixes nonce verification and removes security vulnerabilities. Please update immediately.

= 1.0.0 =
Initial release of Gatekeeper Download Manager.

== Additional Info ==

= Privacy Policy =

This plugin does not collect or store any personal information from your website visitors. All download tracking happens on your server.

If you enable Google AdSense:
- Google AdSense may collect user data according to Google's Privacy Policy
- Please review [Google's Privacy Policy](https://policies.google.com/privacy)
- Add this information to your site's privacy policy

= Support =

* Free support: [WordPress.org Support Forum](https://wordpress.org/support/plugin/gatekeeper-download-manager/)
* Documentation: [Online Documentation](https://licenses.cbshs.com/gatekeeper-download-manager/docs/)
* Pro support: [Premium Support](https://licenses.cbshs.com/support/)

= Contributing =

We welcome contributions! If you'd like to contribute to the development:
* Report bugs and issues
* Suggest new features
* Submit pull requests
* Help with translations

= Credits =

Developed by [CBSHS](https://cbshs.com)

= Disclaimer =

This plugin is provided "as is" without warranty of any kind. Always backup your site before installing or updating plugins.
