Changeset 3375412
- Timestamp:
- 10/09/2025 02:32:02 AM (5 months ago)
- Location:
- path-pilot
- Files:
-
- 14 edited
- 1 copied
-
tags/1.1.0 (copied) (copied from path-pilot/trunk)
-
tags/1.1.0/admin/common/settings-common.php (modified) (2 diffs)
-
tags/1.1.0/admin/free/settings-free.php (modified) (2 diffs)
-
tags/1.1.0/includes/common/class-path-pilot-admin.php (modified) (1 diff)
-
tags/1.1.0/includes/common/class-path-pilot-shared.php (modified) (4 diffs)
-
tags/1.1.0/path-pilot.php (modified) (2 diffs)
-
tags/1.1.0/readme.txt (modified) (1 diff)
-
tags/1.1.0/scripts/index.js (modified) (1 diff)
-
trunk/admin/common/settings-common.php (modified) (2 diffs)
-
trunk/admin/free/settings-free.php (modified) (2 diffs)
-
trunk/includes/common/class-path-pilot-admin.php (modified) (1 diff)
-
trunk/includes/common/class-path-pilot-shared.php (modified) (4 diffs)
-
trunk/path-pilot.php (modified) (2 diffs)
-
trunk/readme.txt (modified) (1 diff)
-
trunk/scripts/index.js (modified) (1 diff)
Legend:
- Unmodified
- Added
- Removed
-
path-pilot/tags/1.1.0/admin/common/settings-common.php
r3373461 r3375412 151 151 <div class="pp-home-section pp-margin-bottom"> 152 152 <h3 class="pp-section-heading"><i class="emoji-star icon-pilot-icon"></i> Interface Settings</h3> 153 154 <div class="pp-home-stat pp-stat-card" style="margin-bottom: 20px;"> 155 <div class="pp-home-stat-label">Insights Only</div> 156 <div style="margin:20px 0;"> 157 <label class="pp-toggle-switch" style="display:flex;align-items:center;gap:15px;cursor:pointer;"> 158 <input type="hidden" name="path_pilot_insights_only" value="0" /> 159 <input type="checkbox" name="path_pilot_insights_only" id="path_pilot_insights_only" value="1" <?php checked(get_option('path_pilot_insights_only', false)); ?> style="display:none;" /> 160 <div class="pp-toggle-track" style="position:relative;width:50px;height:24px;background:#e0e0e0;border-radius:12px;transition:background-color 0.3s ease;"> 161 <div class="pp-toggle-handle" style="position:absolute;top:2px;left:2px;width:20px;height:20px;background:#fff;border-radius:50%;box-shadow:0 2px 4px rgba(0,0,0,0.2);transition:transform 0.3s ease;"></div> 162 </div> 163 <span style="font-weight:500;">Hide drawer and collect data only</span> 164 </label> 165 </div> 166 <div class="pp-stat-description"> 167 When enabled, Path Pilot collects visitor data and analytics in the background without showing any UI to visitors. When disabled, visitors will see the recommendations drawer. 168 </div> 169 </div> 170 153 171 <div class="pp-home-stat pp-stat-card"> 154 172 <div class="pp-home-stat-label">Minimum Path Hops</div> … … 162 180 </div> 163 181 </div> 182 183 <script> 184 document.addEventListener('DOMContentLoaded', function() { 185 // Toggle switch functionality 186 function setupToggleSwitch() { 187 var toggle = document.getElementById('path_pilot_insights_only'); 188 var track = document.querySelector('.pp-toggle-track'); 189 var handle = document.querySelector('.pp-toggle-handle'); 190 191 if (!toggle || !track || !handle) return; 192 193 function updateToggleState() { 194 if (toggle.checked) { 195 track.style.backgroundColor = '#1976d2'; 196 handle.style.transform = 'translateX(26px)'; 197 } else { 198 track.style.backgroundColor = '#e0e0e0'; 199 handle.style.transform = 'translateX(0)'; 200 } 201 } 202 203 // Initialize state 204 updateToggleState(); 205 206 // Add click handler 207 track.addEventListener('click', function(e) { 208 e.preventDefault(); 209 toggle.checked = !toggle.checked; 210 updateToggleState(); 211 }); 212 213 // Add change handler for form submission 214 toggle.addEventListener('change', updateToggleState); 215 } 216 217 setupToggleSwitch(); 218 }); 219 </script> -
path-pilot/tags/1.1.0/admin/free/settings-free.php
r3373461 r3375412 5 5 ?> 6 6 <div class="pp-content"> 7 <?php if (isset($_GET['updated']) && $_GET['updated'] === 'true'): ?> 8 <div class="notice notice-success is-dismissible" style="margin: 20px 0; padding: 12px 20px; background: #d4edda; border: 1px solid #c3e6cb; border-radius: 4px; color: #155724;"> 9 <strong>Settings saved successfully!</strong> Your Path Pilot configuration has been updated. 10 </div> 11 <?php endif; ?> 12 7 13 <form method="post" action="<?php echo esc_url(admin_url('admin-post.php')); ?>" id="path-pilot-settings-form"> 8 14 <input type="hidden" name="action" value="path_pilot_save_settings"> … … 12 18 do_action('path_pilot_additional_settings'); 13 19 ?> 14 <button type="submit" class="btn btn-primary" style="padding:12px 24px;font-weight:600;font-size:1rem;">Save Settings</button>20 <button type="submit" class="btn btn-primary" id="save-settings-btn" style="padding:12px 24px;font-weight:600;font-size:1rem;">Save Settings</button> 15 21 </form> 22 23 <!-- Loading overlay --> 24 <div id="pp-loading-overlay" style="display:none;position:fixed;top:0;left:0;width:100%;height:100%;background:rgba(0,0,0,0.5);z-index:9999;justify-content:center;align-items:center;"> 25 <div style="background:#fff;padding:30px;border-radius:8px;text-align:center;box-shadow:0 4px 20px rgba(0,0,0,0.3);"> 26 <div style="width:40px;height:40px;border:4px solid #f3f3f3;border-top:4px solid #1976d2;border-radius:50%;animation:spin 1s linear infinite;margin:0 auto 15px;"></div> 27 <div style="font-size:16px;font-weight:600;color:#333;">Saving Settings...</div> 28 </div> 29 </div> 30 31 <style> 32 @keyframes spin { 33 0% { transform: rotate(0deg); } 34 100% { transform: rotate(360deg); } 35 } 36 </style> 37 38 <script> 39 document.addEventListener('DOMContentLoaded', function() { 40 var form = document.getElementById('path-pilot-settings-form'); 41 var saveBtn = document.getElementById('save-settings-btn'); 42 var overlay = document.getElementById('pp-loading-overlay'); 43 44 if (form && saveBtn && overlay) { 45 form.addEventListener('submit', function(e) { 46 // Show loading overlay 47 overlay.style.display = 'flex'; 48 49 // Disable save button to prevent double submission 50 saveBtn.disabled = true; 51 saveBtn.textContent = 'Saving...'; 52 53 // Hide overlay after 30 seconds as fallback (in case redirect doesn't work) 54 setTimeout(function() { 55 overlay.style.display = 'none'; 56 saveBtn.disabled = false; 57 saveBtn.textContent = 'Save Settings'; 58 59 // Show error message 60 var errorDiv = document.createElement('div'); 61 errorDiv.style.cssText = 'margin: 20px 0; padding: 12px 20px; background: #f8d7da; border: 1px solid #f5c6cb; border-radius: 4px; color: #721c24;'; 62 errorDiv.innerHTML = '<strong>Request timed out.</strong> The settings may not have been saved. Please try again.'; 63 64 // Insert error message before the form 65 form.parentNode.insertBefore(errorDiv, form); 66 67 // Remove error message after 10 seconds 68 setTimeout(function() { 69 if (errorDiv.parentNode) { 70 errorDiv.parentNode.removeChild(errorDiv); 71 } 72 }, 10000); 73 }, 30000); 74 }); 75 } 76 }); 77 </script> 16 78 </div> -
path-pilot/tags/1.1.0/includes/common/class-path-pilot-admin.php
r3373461 r3375412 434 434 $min_hops = isset($_POST['path_pilot_min_hops']) ? max(1, min(10, absint($_POST['path_pilot_min_hops']))) : 3; 435 435 436 // Handle the toggle switch - we get "1" when checked, nothing when unchecked 437 $insights_only = isset($_POST['path_pilot_insights_only']) && $_POST['path_pilot_insights_only'] === '1'; 438 439 // Save insights_only directly (true = hide drawer, false = show drawer) 440 update_option('path_pilot_insights_only', $insights_only); 441 436 442 // Save allowed content types with validation 437 443 $submitted_content_types = isset($_POST['path_pilot_allowed_content_types']) && is_array($_POST['path_pilot_allowed_content_types']) -
path-pilot/tags/1.1.0/includes/common/class-path-pilot-shared.php
r3373461 r3375412 449 449 $dev_mode = (bool) get_option('path_pilot_dev_mode', false); 450 450 $ready = $dev_mode ? true : (bool) get_option('path_pilot_ready', false); 451 $insights_only = (bool) get_option('path_pilot_insights_only', false); // Default to false (show drawer) 452 $show_drawer = !$insights_only; // Show drawer when NOT insights only 451 453 $cta_text = get_option('path_pilot_cta_text', 'Need a hand?'); 452 454 $recommend_label = get_option('path_pilot_recommend_label', 'Recommended for you:'); … … 489 491 Log::info('Path Pilot: wp_localize_script result = ' . ($localize_result ? 'success' : 'failed')); 490 492 491 // Always enqueue UI/interactivity - widget should always be available 492 // Only the chat feature is gated behind Pro license, not the widget itself 493 // Conditionally enqueue UI/interactivity based on show_drawer setting 494 // If drawer is disabled, we skip the UI but keep tracking active 495 if ($show_drawer) { 493 496 Log::info('Path Pilot: Enqueuing index.js script...'); 494 497 $script_url = plugins_url('scripts/index.js', $main_plugin_file); … … 509 512 'ready' => $ready, 510 513 'dev_mode' => $dev_mode, 514 'insights_only' => $insights_only, 515 'show_drawer' => $show_drawer, 511 516 'cta_text' => $cta_text, 512 517 'recommend_label' => $recommend_label, … … 519 524 ] 520 525 ); 526 } else { 527 Log::info('Path Pilot: Drawer disabled - skipping UI scripts but keeping tracking active'); 528 } 521 529 } 522 530 -
path-pilot/tags/1.1.0/path-pilot.php
r3373461 r3375412 3 3 * Plugin Name: Path Pilot 4 4 * Description: Modern WordPress plugin for smart recommendations and analytics. 5 * Version: 1. 0.05 * Version: 1.1.0 6 6 * Author: Solid Digital 7 7 * Author URI: https://www.soliddigital.com … … 13 13 14 14 if (!defined('ABSPATH')) exit; 15 define('PATH_PILOT_VERSION', '1. 0.0');15 define('PATH_PILOT_VERSION', '1.1.0'); 16 16 17 17 // This is the FREE version. Pro features are only available in the Pro build. -
path-pilot/tags/1.1.0/readme.txt
r3373461 r3375412 1 1 === Path Pilot === 2 2 Requires at least: 6.0 3 Tested up to: 6.8 3 Tested up to: 6.8.3 4 4 Requires PHP: 7.4 5 Stable tag: 1. 0.05 Stable tag: 1.1.0 6 6 License: GPLv2 or later 7 7 License URI: https://www.gnu.org/licenses/gpl-2.0.html -
path-pilot/tags/1.1.0/scripts/index.js
r3373461 r3375412 8 8 9 9 function initPathPilot() { 10 11 // --- Check if drawer should be shown --- 12 if (window.PathPilotStatus && window.PathPilotStatus.insights_only === true) { 13 console.log('Path Pilot: Insights only mode enabled - skipping drawer initialization'); 14 return; // Exit early if insights only mode is enabled 15 } 16 17 // --- Inject icon font CSS if not present --- 18 if (!document.querySelector('link[href*="path-pilot-icons.css"]')) { 19 var iconFontLink = document.createElement('link'); 20 iconFontLink.rel = 'stylesheet'; 21 iconFontLink.href = (window.PathPilotStatus && window.PathPilotStatus.icon_css_url) || '/wp-content/plugins/path-pilot/assets/css/path-pilot-icons.css'; 22 document.head.appendChild(iconFontLink); 23 } 10 24 11 25 let pathPilotNonce = window.PathPilotStatus ? window.PathPilotStatus.nonce : null; -
path-pilot/trunk/admin/common/settings-common.php
r3373461 r3375412 151 151 <div class="pp-home-section pp-margin-bottom"> 152 152 <h3 class="pp-section-heading"><i class="emoji-star icon-pilot-icon"></i> Interface Settings</h3> 153 154 <div class="pp-home-stat pp-stat-card" style="margin-bottom: 20px;"> 155 <div class="pp-home-stat-label">Insights Only</div> 156 <div style="margin:20px 0;"> 157 <label class="pp-toggle-switch" style="display:flex;align-items:center;gap:15px;cursor:pointer;"> 158 <input type="hidden" name="path_pilot_insights_only" value="0" /> 159 <input type="checkbox" name="path_pilot_insights_only" id="path_pilot_insights_only" value="1" <?php checked(get_option('path_pilot_insights_only', false)); ?> style="display:none;" /> 160 <div class="pp-toggle-track" style="position:relative;width:50px;height:24px;background:#e0e0e0;border-radius:12px;transition:background-color 0.3s ease;"> 161 <div class="pp-toggle-handle" style="position:absolute;top:2px;left:2px;width:20px;height:20px;background:#fff;border-radius:50%;box-shadow:0 2px 4px rgba(0,0,0,0.2);transition:transform 0.3s ease;"></div> 162 </div> 163 <span style="font-weight:500;">Hide drawer and collect data only</span> 164 </label> 165 </div> 166 <div class="pp-stat-description"> 167 When enabled, Path Pilot collects visitor data and analytics in the background without showing any UI to visitors. When disabled, visitors will see the recommendations drawer. 168 </div> 169 </div> 170 153 171 <div class="pp-home-stat pp-stat-card"> 154 172 <div class="pp-home-stat-label">Minimum Path Hops</div> … … 162 180 </div> 163 181 </div> 182 183 <script> 184 document.addEventListener('DOMContentLoaded', function() { 185 // Toggle switch functionality 186 function setupToggleSwitch() { 187 var toggle = document.getElementById('path_pilot_insights_only'); 188 var track = document.querySelector('.pp-toggle-track'); 189 var handle = document.querySelector('.pp-toggle-handle'); 190 191 if (!toggle || !track || !handle) return; 192 193 function updateToggleState() { 194 if (toggle.checked) { 195 track.style.backgroundColor = '#1976d2'; 196 handle.style.transform = 'translateX(26px)'; 197 } else { 198 track.style.backgroundColor = '#e0e0e0'; 199 handle.style.transform = 'translateX(0)'; 200 } 201 } 202 203 // Initialize state 204 updateToggleState(); 205 206 // Add click handler 207 track.addEventListener('click', function(e) { 208 e.preventDefault(); 209 toggle.checked = !toggle.checked; 210 updateToggleState(); 211 }); 212 213 // Add change handler for form submission 214 toggle.addEventListener('change', updateToggleState); 215 } 216 217 setupToggleSwitch(); 218 }); 219 </script> -
path-pilot/trunk/admin/free/settings-free.php
r3373461 r3375412 5 5 ?> 6 6 <div class="pp-content"> 7 <?php if (isset($_GET['updated']) && $_GET['updated'] === 'true'): ?> 8 <div class="notice notice-success is-dismissible" style="margin: 20px 0; padding: 12px 20px; background: #d4edda; border: 1px solid #c3e6cb; border-radius: 4px; color: #155724;"> 9 <strong>Settings saved successfully!</strong> Your Path Pilot configuration has been updated. 10 </div> 11 <?php endif; ?> 12 7 13 <form method="post" action="<?php echo esc_url(admin_url('admin-post.php')); ?>" id="path-pilot-settings-form"> 8 14 <input type="hidden" name="action" value="path_pilot_save_settings"> … … 12 18 do_action('path_pilot_additional_settings'); 13 19 ?> 14 <button type="submit" class="btn btn-primary" style="padding:12px 24px;font-weight:600;font-size:1rem;">Save Settings</button>20 <button type="submit" class="btn btn-primary" id="save-settings-btn" style="padding:12px 24px;font-weight:600;font-size:1rem;">Save Settings</button> 15 21 </form> 22 23 <!-- Loading overlay --> 24 <div id="pp-loading-overlay" style="display:none;position:fixed;top:0;left:0;width:100%;height:100%;background:rgba(0,0,0,0.5);z-index:9999;justify-content:center;align-items:center;"> 25 <div style="background:#fff;padding:30px;border-radius:8px;text-align:center;box-shadow:0 4px 20px rgba(0,0,0,0.3);"> 26 <div style="width:40px;height:40px;border:4px solid #f3f3f3;border-top:4px solid #1976d2;border-radius:50%;animation:spin 1s linear infinite;margin:0 auto 15px;"></div> 27 <div style="font-size:16px;font-weight:600;color:#333;">Saving Settings...</div> 28 </div> 29 </div> 30 31 <style> 32 @keyframes spin { 33 0% { transform: rotate(0deg); } 34 100% { transform: rotate(360deg); } 35 } 36 </style> 37 38 <script> 39 document.addEventListener('DOMContentLoaded', function() { 40 var form = document.getElementById('path-pilot-settings-form'); 41 var saveBtn = document.getElementById('save-settings-btn'); 42 var overlay = document.getElementById('pp-loading-overlay'); 43 44 if (form && saveBtn && overlay) { 45 form.addEventListener('submit', function(e) { 46 // Show loading overlay 47 overlay.style.display = 'flex'; 48 49 // Disable save button to prevent double submission 50 saveBtn.disabled = true; 51 saveBtn.textContent = 'Saving...'; 52 53 // Hide overlay after 30 seconds as fallback (in case redirect doesn't work) 54 setTimeout(function() { 55 overlay.style.display = 'none'; 56 saveBtn.disabled = false; 57 saveBtn.textContent = 'Save Settings'; 58 59 // Show error message 60 var errorDiv = document.createElement('div'); 61 errorDiv.style.cssText = 'margin: 20px 0; padding: 12px 20px; background: #f8d7da; border: 1px solid #f5c6cb; border-radius: 4px; color: #721c24;'; 62 errorDiv.innerHTML = '<strong>Request timed out.</strong> The settings may not have been saved. Please try again.'; 63 64 // Insert error message before the form 65 form.parentNode.insertBefore(errorDiv, form); 66 67 // Remove error message after 10 seconds 68 setTimeout(function() { 69 if (errorDiv.parentNode) { 70 errorDiv.parentNode.removeChild(errorDiv); 71 } 72 }, 10000); 73 }, 30000); 74 }); 75 } 76 }); 77 </script> 16 78 </div> -
path-pilot/trunk/includes/common/class-path-pilot-admin.php
r3373461 r3375412 434 434 $min_hops = isset($_POST['path_pilot_min_hops']) ? max(1, min(10, absint($_POST['path_pilot_min_hops']))) : 3; 435 435 436 // Handle the toggle switch - we get "1" when checked, nothing when unchecked 437 $insights_only = isset($_POST['path_pilot_insights_only']) && $_POST['path_pilot_insights_only'] === '1'; 438 439 // Save insights_only directly (true = hide drawer, false = show drawer) 440 update_option('path_pilot_insights_only', $insights_only); 441 436 442 // Save allowed content types with validation 437 443 $submitted_content_types = isset($_POST['path_pilot_allowed_content_types']) && is_array($_POST['path_pilot_allowed_content_types']) -
path-pilot/trunk/includes/common/class-path-pilot-shared.php
r3373461 r3375412 449 449 $dev_mode = (bool) get_option('path_pilot_dev_mode', false); 450 450 $ready = $dev_mode ? true : (bool) get_option('path_pilot_ready', false); 451 $insights_only = (bool) get_option('path_pilot_insights_only', false); // Default to false (show drawer) 452 $show_drawer = !$insights_only; // Show drawer when NOT insights only 451 453 $cta_text = get_option('path_pilot_cta_text', 'Need a hand?'); 452 454 $recommend_label = get_option('path_pilot_recommend_label', 'Recommended for you:'); … … 489 491 Log::info('Path Pilot: wp_localize_script result = ' . ($localize_result ? 'success' : 'failed')); 490 492 491 // Always enqueue UI/interactivity - widget should always be available 492 // Only the chat feature is gated behind Pro license, not the widget itself 493 // Conditionally enqueue UI/interactivity based on show_drawer setting 494 // If drawer is disabled, we skip the UI but keep tracking active 495 if ($show_drawer) { 493 496 Log::info('Path Pilot: Enqueuing index.js script...'); 494 497 $script_url = plugins_url('scripts/index.js', $main_plugin_file); … … 509 512 'ready' => $ready, 510 513 'dev_mode' => $dev_mode, 514 'insights_only' => $insights_only, 515 'show_drawer' => $show_drawer, 511 516 'cta_text' => $cta_text, 512 517 'recommend_label' => $recommend_label, … … 519 524 ] 520 525 ); 526 } else { 527 Log::info('Path Pilot: Drawer disabled - skipping UI scripts but keeping tracking active'); 528 } 521 529 } 522 530 -
path-pilot/trunk/path-pilot.php
r3373461 r3375412 3 3 * Plugin Name: Path Pilot 4 4 * Description: Modern WordPress plugin for smart recommendations and analytics. 5 * Version: 1. 0.05 * Version: 1.1.0 6 6 * Author: Solid Digital 7 7 * Author URI: https://www.soliddigital.com … … 13 13 14 14 if (!defined('ABSPATH')) exit; 15 define('PATH_PILOT_VERSION', '1. 0.0');15 define('PATH_PILOT_VERSION', '1.1.0'); 16 16 17 17 // This is the FREE version. Pro features are only available in the Pro build. -
path-pilot/trunk/readme.txt
r3373461 r3375412 1 1 === Path Pilot === 2 2 Requires at least: 6.0 3 Tested up to: 6.8 3 Tested up to: 6.8.3 4 4 Requires PHP: 7.4 5 Stable tag: 1. 0.05 Stable tag: 1.1.0 6 6 License: GPLv2 or later 7 7 License URI: https://www.gnu.org/licenses/gpl-2.0.html -
path-pilot/trunk/scripts/index.js
r3373461 r3375412 8 8 9 9 function initPathPilot() { 10 11 // --- Check if drawer should be shown --- 12 if (window.PathPilotStatus && window.PathPilotStatus.insights_only === true) { 13 console.log('Path Pilot: Insights only mode enabled - skipping drawer initialization'); 14 return; // Exit early if insights only mode is enabled 15 } 16 17 // --- Inject icon font CSS if not present --- 18 if (!document.querySelector('link[href*="path-pilot-icons.css"]')) { 19 var iconFontLink = document.createElement('link'); 20 iconFontLink.rel = 'stylesheet'; 21 iconFontLink.href = (window.PathPilotStatus && window.PathPilotStatus.icon_css_url) || '/wp-content/plugins/path-pilot/assets/css/path-pilot-icons.css'; 22 document.head.appendChild(iconFontLink); 23 } 10 24 11 25 let pathPilotNonce = window.PathPilotStatus ? window.PathPilotStatus.nonce : null;
Note: See TracChangeset
for help on using the changeset viewer.