Navigate privacy laws with feline precision — detect every boundary, respect every territory! GDPR compliance and privacy protection for WordPress. - Cookie consent management - Privacy boundary detection - GDPR-compliant analytics gating - Cross-plugin consent coordination (integrates with TigerStyle Heat) - Visitor preference tracking - Configurable cookie categories Includes build.sh and .distignore for WordPress-installable release ZIPs.
300 lines
10 KiB
PHP
300 lines
10 KiB
PHP
<?php
|
|
/**
|
|
* Plugin Name: TigerStyle Whiskers
|
|
* Plugin URI: https://tigerstyle.com/whiskers
|
|
* Description: Navigate privacy laws with feline precision - detect every boundary, respect every territory! GDPR compliance and privacy protection for WordPress.
|
|
* Version: 1.0.0
|
|
* Author: TigerStyle
|
|
* Author URI: https://tigerstyle.com
|
|
* License: GPL v2 or later
|
|
* License URI: https://www.gnu.org/licenses/gpl-2.0.html
|
|
* Text Domain: tigerstyle-whiskers
|
|
* Domain Path: /languages
|
|
* Requires at least: 5.0
|
|
* Tested up to: 6.3
|
|
* Requires PHP: 7.4
|
|
* Network: false
|
|
*
|
|
* TigerStyle Whiskers - GDPR Compliance & Privacy Protection
|
|
*
|
|
* 🐱 Features:
|
|
* - 🎯 Boundary Detection: Automatically detect GDPR requirements and compliance gaps
|
|
* - 🍪 Cookie Consent Management: Smart consent banners with feline finesse
|
|
* - 📊 Data Mapping: Track personal data like a cat tracks movement
|
|
* - 🔒 Right to be Forgotten: Data deletion with surgical precision
|
|
* - 🌍 Cross-Border Compliance: Navigate international privacy laws
|
|
* - 📋 Audit Trails: Leave no privacy paw print untracked
|
|
*/
|
|
|
|
// Prevent direct access
|
|
if (!defined('ABSPATH')) {
|
|
exit;
|
|
}
|
|
|
|
// Define plugin constants
|
|
define('TIGERSTYLE_WHISKERS_VERSION', '1.0.0');
|
|
define('TIGERSTYLE_WHISKERS_PLUGIN_DIR', plugin_dir_path(__FILE__));
|
|
define('TIGERSTYLE_WHISKERS_PLUGIN_URL', plugin_dir_url(__FILE__));
|
|
define('TIGERSTYLE_WHISKERS_PLUGIN_FILE', __FILE__);
|
|
define('TIGERSTYLE_WHISKERS_PLUGIN_BASENAME', plugin_basename(__FILE__));
|
|
|
|
/**
|
|
* Main TigerStyle Whiskers Plugin Class
|
|
*
|
|
* Navigate privacy laws with feline precision!
|
|
*/
|
|
class TigerStyleWhiskers {
|
|
|
|
/**
|
|
* Single instance of the class (Singleton pattern)
|
|
*/
|
|
private static $instance = null;
|
|
|
|
/**
|
|
* Plugin modules - each whisker serves a purpose!
|
|
*/
|
|
private $whiskers = array();
|
|
|
|
/**
|
|
* Compliance status - are we sensing all boundaries correctly?
|
|
*/
|
|
private $compliance_status = array();
|
|
|
|
/**
|
|
* Get single instance (like a cat, there can be only one!)
|
|
*/
|
|
public static function instance() {
|
|
if (is_null(self::$instance)) {
|
|
self::$instance = new self();
|
|
}
|
|
return self::$instance;
|
|
}
|
|
|
|
/**
|
|
* Constructor - Initialize our whiskers
|
|
*/
|
|
private function __construct() {
|
|
$this->init();
|
|
}
|
|
|
|
/**
|
|
* Initialize the plugin - let the whiskers do their work
|
|
*/
|
|
private function init() {
|
|
// Load dependencies
|
|
$this->load_dependencies();
|
|
|
|
// Initialize hooks
|
|
add_action('init', array($this, 'init_plugin'));
|
|
add_action('init', array($this, 'load_textdomain'));
|
|
add_action('init', array($this, 'grow_whiskers'));
|
|
add_action('init', array($this, 'detect_boundaries'));
|
|
|
|
// Initialize admin interface if we're in admin
|
|
if (is_admin()) {
|
|
add_action('init', array($this, 'init_admin'));
|
|
}
|
|
}
|
|
|
|
/**
|
|
* Load required files - our whisker components
|
|
*/
|
|
private function load_dependencies() {
|
|
// Core includes
|
|
require_once TIGERSTYLE_WHISKERS_PLUGIN_DIR . 'includes/class-core.php';
|
|
require_once TIGERSTYLE_WHISKERS_PLUGIN_DIR . 'includes/class-boundary-detector.php';
|
|
require_once TIGERSTYLE_WHISKERS_PLUGIN_DIR . 'includes/class-compliance-scanner.php';
|
|
|
|
// Admin includes
|
|
if (is_admin()) {
|
|
require_once TIGERSTYLE_WHISKERS_PLUGIN_DIR . 'admin/class-admin.php';
|
|
require_once TIGERSTYLE_WHISKERS_PLUGIN_DIR . 'admin/class-admin-pages.php';
|
|
}
|
|
|
|
// Whisker modules (each handles a specific sensing capability)
|
|
require_once TIGERSTYLE_WHISKERS_PLUGIN_DIR . 'includes/whiskers/class-cookie-consent.php';
|
|
require_once TIGERSTYLE_WHISKERS_PLUGIN_DIR . 'includes/whiskers/class-advanced-geo-detector.php';
|
|
require_once TIGERSTYLE_WHISKERS_PLUGIN_DIR . 'includes/whiskers/class-data-mapper.php';
|
|
require_once TIGERSTYLE_WHISKERS_PLUGIN_DIR . 'includes/whiskers/class-privacy-policy.php';
|
|
require_once TIGERSTYLE_WHISKERS_PLUGIN_DIR . 'includes/whiskers/class-consent-analytics.php';
|
|
require_once TIGERSTYLE_WHISKERS_PLUGIN_DIR . 'includes/whiskers/class-data-deletion.php';
|
|
require_once TIGERSTYLE_WHISKERS_PLUGIN_DIR . 'includes/whiskers/class-cross-border.php';
|
|
require_once TIGERSTYLE_WHISKERS_PLUGIN_DIR . 'includes/whiskers/class-audit-trail.php';
|
|
require_once TIGERSTYLE_WHISKERS_PLUGIN_DIR . 'includes/whiskers/class-analytics-integration.php';
|
|
}
|
|
|
|
/**
|
|
* Initialize plugin components
|
|
*/
|
|
public function init_plugin() {
|
|
// Log initialization
|
|
if (defined('WP_DEBUG') && WP_DEBUG) {
|
|
error_log('TigerStyle Whiskers: Plugin initialized - whiskers are twitching with awareness!');
|
|
}
|
|
}
|
|
|
|
/**
|
|
* Load plugin text domain for internationalization
|
|
*/
|
|
public function load_textdomain() {
|
|
load_plugin_textdomain('tigerstyle-whiskers', false, dirname(plugin_basename(__FILE__)) . '/languages');
|
|
}
|
|
|
|
/**
|
|
* Initialize admin components
|
|
*/
|
|
public function init_admin() {
|
|
TigerStyleWhiskers_Admin::instance();
|
|
}
|
|
|
|
/**
|
|
* Load and initialize whiskers (modules)
|
|
*/
|
|
public function grow_whiskers() {
|
|
$this->whiskers = array(
|
|
'cookie_consent' => TigerStyleWhiskers_CookieConsent::instance(),
|
|
'advanced_geo_detector' => TigerStyleWhiskers_AdvancedGeoDetector::instance(),
|
|
'data_mapper' => TigerStyleWhiskers_DataMapper::instance(),
|
|
'privacy_policy' => TigerStyleWhiskers_PrivacyPolicy::instance(),
|
|
'consent_analytics' => TigerStyleWhiskers_ConsentAnalytics::instance(),
|
|
'data_deletion' => TigerStyleWhiskers_DataDeletion::instance(),
|
|
'cross_border' => TigerStyleWhiskers_CrossBorder::instance(),
|
|
'audit_trail' => TigerStyleWhiskers_AuditTrail::instance(),
|
|
'analytics_integration' => TigerStyleWhiskers_AnalyticsIntegration::instance(),
|
|
);
|
|
|
|
// Each whisker is now sensing its environment
|
|
if (defined('WP_DEBUG') && WP_DEBUG) {
|
|
error_log('TigerStyle Whiskers: All ' . count($this->whiskers) . ' whiskers are now active and sensing!');
|
|
}
|
|
}
|
|
|
|
/**
|
|
* Detect boundaries - this is what whiskers do best!
|
|
*/
|
|
public function detect_boundaries() {
|
|
// Initialize boundary detection
|
|
TigerStyleWhiskers_BoundaryDetector::instance();
|
|
|
|
// Start compliance scanning
|
|
TigerStyleWhiskers_ComplianceScanner::instance();
|
|
}
|
|
|
|
/**
|
|
* Get a specific whisker (module)
|
|
*/
|
|
public function get_whisker($whisker_name) {
|
|
return isset($this->whiskers[$whisker_name]) ? $this->whiskers[$whisker_name] : null;
|
|
}
|
|
|
|
/**
|
|
* Check if we're sensing a specific boundary correctly
|
|
*/
|
|
public function is_boundary_detected($boundary_type) {
|
|
return TigerStyleWhiskers_BoundaryDetector::is_detected($boundary_type);
|
|
}
|
|
|
|
/**
|
|
* Get overall compliance status - are all whiskers happy?
|
|
*/
|
|
public function get_compliance_status() {
|
|
return TigerStyleWhiskers_ComplianceScanner::get_status();
|
|
}
|
|
|
|
/**
|
|
* Integration with TigerStyle Heat Analytics
|
|
*/
|
|
public function integrate_with_heat() {
|
|
if (class_exists('TigerStyleSEO_Google_setup')) {
|
|
$analytics_whisker = $this->get_whisker('analytics_integration');
|
|
if ($analytics_whisker) {
|
|
$analytics_whisker->connect_to_heat();
|
|
return true;
|
|
}
|
|
}
|
|
return false;
|
|
}
|
|
|
|
/**
|
|
* Plugin activation - wake up the whiskers!
|
|
*/
|
|
public static function activate() {
|
|
// Load core class for activation
|
|
require_once TIGERSTYLE_WHISKERS_PLUGIN_DIR . 'includes/class-core.php';
|
|
|
|
// Run activation hooks for all whiskers
|
|
TigerStyleWhiskers_Core::activate();
|
|
|
|
// Create database tables for compliance tracking
|
|
TigerStyleWhiskers_Core::create_tables();
|
|
|
|
// Set default options
|
|
TigerStyleWhiskers_Core::set_defaults();
|
|
|
|
// Log activation
|
|
if (defined('WP_DEBUG') && WP_DEBUG) {
|
|
error_log('TigerStyle Whiskers: Plugin activated - all whiskers are now alert and ready!');
|
|
}
|
|
}
|
|
|
|
/**
|
|
* Plugin deactivation - whiskers at rest
|
|
*/
|
|
public static function deactivate() {
|
|
// Load core class for deactivation
|
|
require_once TIGERSTYLE_WHISKERS_PLUGIN_DIR . 'includes/class-core.php';
|
|
|
|
TigerStyleWhiskers_Core::deactivate();
|
|
|
|
// Log deactivation
|
|
if (defined('WP_DEBUG') && WP_DEBUG) {
|
|
error_log('TigerStyle Whiskers: Plugin deactivated - whiskers are resting');
|
|
}
|
|
}
|
|
|
|
/**
|
|
* Plugin uninstall - remove all traces (like a cat covering tracks)
|
|
*/
|
|
public static function uninstall() {
|
|
// Load core class for uninstall
|
|
require_once TIGERSTYLE_WHISKERS_PLUGIN_DIR . 'includes/class-core.php';
|
|
|
|
TigerStyleWhiskers_Core::uninstall();
|
|
}
|
|
}
|
|
|
|
// Register activation/deactivation hooks
|
|
register_activation_hook(__FILE__, array('TigerStyleWhiskers', 'activate'));
|
|
register_deactivation_hook(__FILE__, array('TigerStyleWhiskers', 'deactivate'));
|
|
|
|
/**
|
|
* Initialize the plugin when WordPress is loaded
|
|
*/
|
|
function tigerstyle_whiskers_init() {
|
|
return TigerStyleWhiskers::instance();
|
|
}
|
|
|
|
// Start the plugin - let the whiskers begin sensing!
|
|
add_action('plugins_loaded', 'tigerstyle_whiskers_init');
|
|
|
|
/**
|
|
* Helper function to get the main plugin instance
|
|
*/
|
|
function tigerstyle_whiskers() {
|
|
return TigerStyleWhiskers::instance();
|
|
}
|
|
|
|
/**
|
|
* Check if user is in a GDPR territory (EU/EEA)
|
|
* Whiskers sense geographic boundaries too!
|
|
*/
|
|
function tigerstyle_whiskers_is_gdpr_territory() {
|
|
return TigerStyleWhiskers_BoundaryDetector::is_gdpr_territory();
|
|
}
|
|
|
|
/**
|
|
* Quick compliance check - are our whiskers detecting everything correctly?
|
|
*/
|
|
function tigerstyle_whiskers_compliance_check() {
|
|
return TigerStyleWhiskers_ComplianceScanner::quick_check();
|
|
} |