Changeset 3441985
- Timestamp:
- 01/18/2026 03:52:40 PM (2 months ago)
- Location:
- sfr-directory-analytics/trunk
- Files:
-
- 2 added
- 7 edited
-
. (modified) (1 prop)
-
assets/admin-deactivation-modal.css (added)
-
assets/admin-deactivation-modal.js (added)
-
includes/class-sfrda-admin.php (modified) (1 diff)
-
includes/class-sfrda-analytics.php (modified) (1 diff)
-
includes/class-sfrda-integrations.php (modified) (1 diff)
-
includes/class-sfrda-tracker.php (modified) (1 diff)
-
readme.txt (modified) (3 diffs)
-
sfr-directory-analytics.php (modified) (6 diffs)
Legend:
- Unmodified
- Added
- Removed
-
sfr-directory-analytics/trunk
-
Property
svn:ignore
set to
.DS_Store
-
Property
svn:ignore
set to
-
sfr-directory-analytics/trunk/includes/class-sfrda-admin.php
r3440479 r3441985 9 9 if ( ! defined( 'ABSPATH' ) ) { 10 10 exit; 11 } 12 13 // Prevent class redeclaration (in case Pro version already loaded it) 14 if ( class_exists( 'SFRDA_Admin' ) ) { 15 return; 11 16 } 12 17 -
sfr-directory-analytics/trunk/includes/class-sfrda-analytics.php
r3392964 r3441985 11 11 } 12 12 13 // Prevent class redeclaration (in case Pro version already loaded it) 14 if ( class_exists( 'SFRDA_Analytics' ) ) { 15 return; 16 } 17 13 18 /** 14 19 * Processes and aggregates analytics data -
sfr-directory-analytics/trunk/includes/class-sfrda-integrations.php
r3392964 r3441985 9 9 if ( ! defined( 'ABSPATH' ) ) { 10 10 exit; 11 } 12 13 // Prevent class redeclaration (in case Pro version already loaded it) 14 if ( class_exists( 'SFRDA_Integrations' ) ) { 15 return; 11 16 } 12 17 -
sfr-directory-analytics/trunk/includes/class-sfrda-tracker.php
r3440479 r3441985 11 11 } 12 12 13 // Prevent class redeclaration (in case Pro version already loaded it) 14 if ( class_exists( 'SFRDA_Tracker' ) ) { 15 return; 16 } 17 13 18 /** 14 19 * Tracks directory listing and category views -
sfr-directory-analytics/trunk/readme.txt
r3440479 r3441985 5 5 Tested up to: 6.9 6 6 Requires PHP: 7.4 7 Stable tag: 1.0. 67 Stable tag: 1.0.7 8 8 License: GPLv2 or later 9 9 License URI: https://www.gnu.org/licenses/gpl-2.0.html … … 435 435 436 436 == Changelog == 437 438 = 1.0.7 = 439 * Feature: Added deactivation feedback popup to collect user feedback when plugin is deactivated 440 * Enhancement: Improved user experience with optional feedback collection for support and plugin improvements 441 * Technical: Added AJAX handlers for deactivation feedback submission to license server 437 442 438 443 = 1.0.6 = … … 495 500 == Upgrade Notice == 496 501 502 = 1.0.7 = 503 Adds deactivation feedback popup feature. Safe to update - no action required. 504 497 505 = 1.0.6 = 498 506 Security improvements, WordPress 6.9 compatibility, and translation loading fixes for WordPress 6.7+. Safe to update - no action required. -
sfr-directory-analytics/trunk/sfr-directory-analytics.php
r3440479 r3441985 4 4 * Plugin URI: https://supportfromrichard.co.uk/plugins/sfr-directory-analytics/ 5 5 * Description: Track views, categories, and listings for Directorist, GeoDirectory, and Business Directory with beautiful analytics dashboards. 6 * Version: 1.0. 66 * Version: 1.0.7 7 7 * Requires at least: 5.8 8 8 * Tested up to: 6.9 … … 21 21 } 22 22 23 // Check if Pro version is active - if so, stop loading Free version 24 if ( defined( 'SFRDA_PRO_VERSION' ) || class_exists( 'SFRDA_Pro_Main' ) ) { 25 // Pro version is already loaded - stop here 26 add_action( 'admin_notices', function() { 27 ?> 28 <div class="notice notice-warning"> 29 <p><strong>SFR Directory Analytics (Free)</strong> is not needed - the Pro version is already active.</p> 30 <p>The Pro version includes all free features plus advanced functionality.</p> 31 </div> 32 <?php 33 }); 34 return; // Stop loading the free plugin 35 } 36 23 37 // Define plugin constants - all prefixed with SFRDA_ 24 38 // Check if already defined (Pro version may have defined them first) 25 39 if ( ! defined( 'SFRDA_VERSION' ) ) { 26 define( 'SFRDA_VERSION', '1.0. 6' );40 define( 'SFRDA_VERSION', '1.0.7' ); 27 41 } 28 42 if ( ! defined( 'SFRDA_PLUGIN_DIR' ) ) { … … 77 91 // Deactivation hook 78 92 register_deactivation_hook( __FILE__, array( $this, 'sfrda_deactivate' ) ); 93 94 // AJAX handlers 95 add_action( 'wp_ajax_sfrda_submit_deactivation_feedback', array( $this, 'sfrda_submit_deactivation_feedback_ajax' ) ); 79 96 } 80 97 … … 83 100 */ 84 101 public function sfrda_enqueue_admin_assets( $hook ) { 102 // Load deactivation modal on plugins.php 103 if ( $hook === 'plugins.php' ) { 104 wp_enqueue_style( 105 'sfrda-deactivation-modal', 106 SFRDA_PLUGIN_URL . 'assets/admin-deactivation-modal.css', 107 array(), 108 SFRDA_VERSION 109 ); 110 111 wp_enqueue_script( 112 'sfrda-deactivation-modal', 113 SFRDA_PLUGIN_URL . 'assets/admin-deactivation-modal.js', 114 array( 'jquery' ), 115 SFRDA_VERSION, 116 true 117 ); 118 119 wp_localize_script( 'sfrda-deactivation-modal', 'sfrdaDeactivationModal', array( 120 'ajax_url' => admin_url( 'admin-ajax.php' ), 121 'nonce' => wp_create_nonce( 'sfrda_deactivation_feedback' ), 122 'support_url' => 'https://supportfromrichard.co.uk/support/' 123 ) ); 124 } 125 85 126 // Only load on our admin pages 86 127 $allowed_pages = array( … … 210 251 */ 211 252 private function sfrda_load_dependencies() { 212 require_once SFRDA_PLUGIN_DIR . 'includes/class-sfrda-integrations.php'; 213 require_once SFRDA_PLUGIN_DIR . 'includes/class-sfrda-tracker.php'; 214 require_once SFRDA_PLUGIN_DIR . 'includes/class-sfrda-analytics.php'; 215 require_once SFRDA_PLUGIN_DIR . 'includes/class-sfrda-admin.php'; 253 // Load classes only if not already loaded by Pro version 254 if (!class_exists('SFRDA_Integrations')) { 255 require_once SFRDA_PLUGIN_DIR . 'includes/class-sfrda-integrations.php'; 256 } 257 if (!class_exists('SFRDA_Tracker')) { 258 require_once SFRDA_PLUGIN_DIR . 'includes/class-sfrda-tracker.php'; 259 } 260 if (!class_exists('SFRDA_Analytics')) { 261 require_once SFRDA_PLUGIN_DIR . 'includes/class-sfrda-analytics.php'; 262 } 263 if (!class_exists('SFRDA_Admin')) { 264 require_once SFRDA_PLUGIN_DIR . 'includes/class-sfrda-admin.php'; 265 } 216 266 217 267 // Initialize classes … … 254 304 255 305 /** 306 * AJAX handler for deactivation feedback 307 */ 308 public function sfrda_submit_deactivation_feedback_ajax() { 309 check_ajax_referer( 'sfrda_deactivation_feedback', 'nonce' ); 310 311 $reason = isset( $_POST['reason'] ) ? sanitize_text_field( wp_unslash( $_POST['reason'] ) ) : ''; 312 $feedback = isset( $_POST['feedback'] ) ? sanitize_textarea_field( wp_unslash( $_POST['feedback'] ) ) : ''; 313 $plugin = isset( $_POST['plugin'] ) ? sanitize_text_field( wp_unslash( $_POST['plugin'] ) ) : ''; 314 315 // Log feedback (WordPress.org compliant - no personal data) 316 if ( $reason || $feedback ) { 317 // Send to license server for centralized collection (WordPress.org compliant - anonymized) 318 $this->send_deactivation_feedback_to_server( $reason, $feedback, $plugin ); 319 } 320 321 // Always return success - don't block deactivation 322 wp_send_json_success( array( 323 'message' => __( 'Thank you for your feedback!', 'sfr-directory-analytics' ) 324 ) ); 325 } 326 327 /** 328 * Send deactivation feedback to license server 329 * WordPress.org compliant - only sends anonymized, non-personal data 330 */ 331 private function send_deactivation_feedback_to_server( $reason, $feedback, $plugin_slug ) { 332 $license_server_url = 'https://supportfromrichard.co.uk'; 333 334 // Prepare feedback data (WordPress.org compliant - no personal data) 335 $feedback_data = array( 336 'plugin_slug' => 'sfr-directory-analytics', 337 'plugin_version' => SFRDA_VERSION, 338 'reason' => $reason, 339 'feedback' => $feedback, 340 'wp_version' => get_bloginfo( 'version' ), 341 'php_version' => PHP_VERSION, 342 'timestamp' => current_time( 'mysql' ) 343 ); 344 345 // Send via POST to license server (non-blocking) 346 wp_remote_post( 347 $license_server_url . '/wp-json/sfr-licence/v1/track/deactivation', 348 array( 349 'body' => wp_json_encode( $feedback_data ), 350 'headers' => array( 351 'Content-Type' => 'application/json', 352 ), 353 'timeout' => 5, // Short timeout to not delay deactivation 354 'blocking' => false // Non-blocking - don't wait for response 355 ) 356 ); 357 } 358 359 /** 256 360 * Plugin deactivation 257 361 */
Note: See TracChangeset
for help on using the changeset viewer.