Changeset 3284584
- Timestamp:
- 04/30/2025 06:16:44 AM (10 months ago)
- Location:
- accessibe/trunk
- Files:
-
- 5 edited
-
accessibe.php (modified) (2 diffs)
-
accessibe_inc/js/accessibe.js (modified) (5 diffs)
-
class.accessibeforwp.php (modified) (8 diffs)
-
mixpanel.php (modified) (2 diffs)
-
readme.txt (modified) (2 diffs)
Legend:
- Unmodified
- Added
- Removed
-
accessibe/trunk/accessibe.php
r3237954 r3284584 4 4 * Plugin URI: https://accessibe.com/ 5 5 * Description: accessiBe is the #1 fully automated web accessibility solution. Protect your website from lawsuits and increase your potential audience. 6 * Version: 2. 66 * Version: 2.7 7 7 * Author: accessiBe 8 8 * Author URI: https://accessibe.com/ … … 18 18 require 'vendor/autoload.php'; 19 19 use Mixpanel\Mixpanel; 20 21 define('ACCESSIBE_WP_UNIVERSAL_URL', 'https://universal.accessibe.com'); 20 22 21 23 define('ACCESSIBE_WP_PLUGIN_DIR', plugin_dir_path(__FILE__)); -
accessibe/trunk/accessibe_inc/js/accessibe.js
r3231917 r3284584 42 42 action: "accessibe_license_trial", 43 43 }) 44 ); 45 }, 46 sendAddVerificationPageRequest: async (data) => { 47 return JSON.parse( 48 await jQuery.post(ajaxurl, { 49 _ajax_nonce: accessibe_vars.run_tool_nonce, 50 data: JSON.stringify(data), 51 action: "accessibe_add_verification_page", 52 }) 44 53 ); 45 54 }, … … 106 115 setMerchant: (data) => { 107 116 AcsbStore.merchantData = data; 108 console.log("setting merchant data", data);117 Logger.log("setting merchant data", data); 109 118 //sendMerchantDetails(); 110 119 }, 111 120 sendDataToIframe: (eventName, data, additionalData={}) => { 112 121 document.getElementById(ACSB_UNI_IFRAME_ID).contentWindow.postMessage({ eventName, data, additionalData }, '*'); 113 console.log(eventName, data); 114 } 122 Logger.log(eventName, data); 123 }, 124 sendDomainVerificationRequest: (type, path, domain) => { 125 API.sendDataToIframe('domain-verification-request', { type, path, domain }); 126 }, 115 127 } 116 128 jQuery(document).ready(async ($) => { 117 129 AcsbStore.jQueryReady = true; 118 console.log("accessibe.js loaded");130 Logger.log("accessibe.js loaded"); 119 131 await API.syncMerchantDetails(); 132 API.sendRedirectUrl(window.location.href); 120 133 }); 121 134 … … 123 136 let response; 124 137 if (event.data.eventName){ 125 console.log(event.data.eventName, event.data);138 Logger.log(event.data.eventName, event.data); 126 139 } 127 140 switch (event.data.eventName) { … … 143 156 break; 144 157 case 'license-trial': { 145 const data = await API.sendLicenseData({...event.data.data, newLicense: event.data.newLicense}); 146 console.log('license-trial response ::', data); 158 const data = await API.sendLicenseData({ 159 licenseId: event.data.data.licenseId, 160 accountId: event.data.data.accountId, 161 domain: event.data.data.domain, 162 widgetConfig: event.data.data.widgetConfig, 163 siteId: event.data.data.siteId, 164 isNewLicenseTrial: event.data.data.isNewLicenseTrial, 165 }); 166 Logger.log('license-trial response ::', data); 147 167 await API.syncMerchantDetails(); 148 168 break; … … 161 181 await API.modifyConfig(event.data.data.widgetConfig); 162 182 break; 183 case 'redirect-to-url': 184 const { add_redirect_url_with_key: redirectUrlKey, url: targetUrl } = event.data.data; 185 const urlToRedirect = new URL(targetUrl); 186 if (redirectUrlKey) { 187 urlToRedirect.searchParams.set(redirectUrlKey, window.location.href); 188 } 189 window.location.href = urlToRedirect.href; 190 break; 191 case 'remove-query-param': 192 const paramToremove = event.data.data.param; 193 const url = new URL(window.location.href); 194 url.searchParams.delete(paramToremove); 195 window.history.replaceState({}, document.title, url); 196 break; 197 case 'create-domain-ownership-request': 198 const res = await API.sendAddVerificationPageRequest(event.data.data); 199 API.sendDomainVerificationRequest(res.type, res.path, res.domain); 200 Logger.log("verify-ownership response", res); 201 break; 202 default: 203 break; 163 204 }}); 205 206 const isDebugMode = localStorage.getItem('debug') === 'true'; 207 208 const Logger = { 209 log(message, ...optionalParams) { 210 if (isDebugMode) { 211 console.log(`.[INFO] ${message}`, ...optionalParams); 212 } 213 }, 214 215 error(message, ...optionalParams) { 216 if (isDebugMode) { 217 console.error(`.[ERROR] ${message}`, ...optionalParams); 218 } 219 }, 220 221 debug(message, ...optionalParams) { 222 if (isDebugMode) { 223 console.debug(`.[DEBUG] ${message}`, ...optionalParams); 224 } 225 }, 226 }; -
accessibe/trunk/class.accessibeforwp.php
r3237954 r3284584 56 56 57 57 public static $icon_mapping_to_widget = [ 58 "LegacyDisplay" => "display",59 "LegacyDisplay2" => "display2",60 "LegacyDisplay3" => "display3",61 "LegacyHelp" => "help",62 "LegacyPeople" => "people",63 "LegacyPeople2" => "people2",64 "LegacySettings" => "settings",65 "LegacySettings2" => "settings2",66 "LegacyWheels" => "wheels",67 "LegacyWheels2" => "wheels2",58 "LegacyDisplay" => "display", 59 "LegacyDisplay2" => "display2", 60 "LegacyDisplay3" => "display3", 61 "LegacyHelp" => "help", 62 "LegacyPeople" => "people", 63 "LegacyPeople2" => "people2", 64 "LegacySettings" => "settings", 65 "LegacySettings2" => "settings2", 66 "LegacyWheels" => "wheels", 67 "LegacyWheels2" => "wheels2", 68 68 ]; 69 69 70 70 public static function accessibe_init() { 71 if (!self::$accessibe_initiated) { 72 self::accessibe_init_hooks(); 73 } 71 if (!self::$accessibe_initiated) { 72 self::accessibe_init_hooks(); 73 self::accessibe_get_plugin_version(); 74 } 74 75 } // accessibe_init 75 76 … … 127 128 /* update admin footer text */ 128 129 add_filter('admin_footer_text', array('AccessibeWp', 'accessibe_admin_footer_text')); 129 130 /* add verification file */ 131 add_action('wp_ajax_accessibe_add_verification_page', array('AccessibeWp', 'accessibe_add_verification_page_ajax')); 130 132 } // accessibe_init_hooks 131 133 … … 144 146 */ 145 147 public static function accessibe_get_plugin_version() { 146 $accessibe_plugin_data = get_file_data(ACCESSIBE_WP_FILE, array('version' => 'Version'), 'plugin'); 147 self::$accessibe_version = $accessibe_plugin_data['version']; 148 return $accessibe_plugin_data['version']; 148 if (isset(self::$accessibe_version)) { 149 return self::$accessibe_version; 150 } 151 $accessibe_plugin_data = get_file_data(ACCESSIBE_WP_FILE, array('version' => 'Version'), 'plugin'); 152 self::$accessibe_version = $accessibe_plugin_data['version']; 153 return $accessibe_plugin_data['version']; 149 154 } // accessibe_get_plugin_version 150 155 … … 210 215 } 211 216 } 212 $icon_value = $accessibe_options['triggerIcon'];213 $accessibe_options['triggerIcon'] = self::$icon_mapping_to_widget[$icon_value];217 $icon_value = isset($accessibe_options['triggerIcon']) ? $accessibe_options['triggerIcon'] : ''; 218 $accessibe_options['triggerIcon'] = isset(self::$icon_mapping_to_widget[$icon_value]) ? self::$icon_mapping_to_widget[$icon_value] : 'people'; 214 219 } 215 220 … … 263 268 } // accessibe_dismiss_pointer_ajax 264 269 270 /** 271 * Add ownership verification file 272 */ 273 public static function accessibe_add_verification_page_ajax() { 274 $file_name = 'accessibe_verification.txt'; 275 $verificationData = json_decode(stripslashes($_POST['data'])); 276 $file_path = ABSPATH . $file_name; // Path to the public file 277 $token = $verificationData->token; 278 $result = array( 279 'type' => esc_html('FILE_URL'), 280 'path' => '', 281 'domain' => self::get_current_domain(), 282 ); 283 if (file_put_contents($file_path, $token)) { 284 $result['path'] = site_url($file_name) . '?v=' . time(); 285 } else { 286 $result['failed-1'] = $file_path; 287 // Get uploads directory path and URL 288 $upload_dir = wp_upload_dir(); 289 $dir_path = trailingslashit($upload_dir['basedir']) . 'accessibe'; 290 $file_path = $dir_path . '/' . $file_name; 291 292 // Ensure directory exists 293 if (!file_exists($dir_path)) { 294 wp_mkdir_p($dir_path); 295 } 296 297 if (file_put_contents($file_path, $token)) { 298 $result['path'] = trailingslashit($upload_dir['baseurl']) . 'accessibe' . '/' . $file_name . '?v=' . time(); 299 } else { 300 $result['failed-2'] = $file_path; 301 } 302 } 303 echo json_encode($result); 304 wp_die(); 305 } // accessibe_add_verification_page_ajax 265 306 266 307 public static function accessibe_merchant_detail_ajax() { … … 278 319 'fullName' => $display_name, 279 320 'storeId' => self::sanitizeDomain(wp_parse_url(site_url())['host']), 321 'wapperApp' => array( 322 'name' => 'WordPress', 323 'version' => self::accessibe_get_plugin_version() . '' 324 ), 280 325 'mixpanelProps' => array ( 281 326 'wordpressStoreName' => self::sanitizeDomain(wp_parse_url(site_url())['host']), … … 305 350 } // accessibe_merchant_detail_ajax 306 351 352 public static function get_current_domain() { 353 $current_domain = wp_parse_url(site_url())['host']; 354 return self::sanitizeDomain($current_domain); 355 } 356 307 357 public static function accessibe_domain_list_ajax() { 308 358 $existing_domains = json_decode(stripslashes($_POST['existingDomains'])); 309 359 310 $current_domain = self:: sanitizeDomain(wp_parse_url(site_url())['host']);360 $current_domain = self::get_current_domain(); 311 361 // $current_domain = '9cc3-2405-201-5c0f-d070-14fd-b303-b02-1999.ngrok-free.app'; 312 362 … … 691 741 ?> 692 742 <div class="wrap"> 693 <iframe id='accessibe-universal-iframe' src='https://universal.accessibe.com'></iframe>743 <iframe id='accessibe-universal-iframe' src='<?php echo esc_url_raw(ACCESSIBE_WP_UNIVERSAL_URL . (!empty($_SERVER['QUERY_STRING']) ? '?' . $_SERVER['QUERY_STRING'] : '')); ?>'></iframe> 694 744 </div> 695 745 <!-- /.wrap --> -
accessibe/trunk/mixpanel.php
r3219469 r3284584 8 8 public function __construct() 9 9 { 10 $this->config = $this->getConfig();11 $this->mixpanel = Mixpanel::getInstance('d2a99cd5439edf8f95db8ad1fe2efdca', $this->config); // Assuming a Mixpanel PHP SDK is available10 $this->config = $this->getConfig(); 11 $this->mixpanel = Mixpanel::getInstance('d2a99cd5439edf8f95db8ad1fe2efdca', $this->config); // Assuming a Mixpanel PHP SDK is available 12 12 } 13 13 14 14 private function getConfig() { 15 $config = [ 16 'host' => 'dashboard.accessibe.com', 17 'events_endpoint' => '/mixpanel/proxy/track', 18 'people_endpoint' => '/mixpanel/proxy/engage', 19 'use_ssl' => true, 20 'error_callback' => function($err) { 21 if ($err) { 22 error_log("Mixpanel Error: " . print_r($err, true)); 23 } else { 24 error_log("Mixpanel Success: No error returned"); 25 } 15 $config = [ 16 'host' => 'dashboard.accessibe.com', 17 'events_endpoint' => '/mixpanel/proxy/track', 18 'people_endpoint' => '/mixpanel/proxy/engage', 19 'use_ssl' => true, 20 'error_callback' => function($err) { 21 if ($err) { 22 error_log("Mixpanel Error: " . print_r($err, true)); 23 } else { 24 error_log("Mixpanel Success: No error returned"); 26 25 } 27 ]; 26 } 27 ]; 28 28 29 29 30 return $config;30 return $config; 31 31 } 32 32 33 33 private function addDefaultProps($properties) 34 34 { 35 $properties['accessiBeProduct'] = 'Universal Plugin';36 $properties['eventType'] = 'server-side';37 $properties['pluginSource'] = 'WordPress';38 $properties['isReact'] = false;35 $properties['accessiBeProduct'] = 'Universal Plugin'; 36 $properties['eventType'] = 'server-side'; 37 $properties['pluginSource'] = 'WordPress'; 38 $properties['isReact'] = false; 39 39 40 return $properties;40 return $properties; 41 41 } 42 42 43 43 public function trackEvent($eventName, $properties = []) 44 44 { 45 if (!$this->mixpanel) {46 return false;47 }45 if (!$this->mixpanel) { 46 return false; 47 } 48 48 49 if (isset($properties['userId'])) {50 $properties['$user_id'] = $properties['userId'];51 $properties['distinct_id'] = $properties['userId'];52 unset($properties['userId']);53 } else if (!isset($properties['distinct_id']) && !isset($properties['$user_id'])) {54 $properties['distinct_id'] = $properties['primaryDomain'] ?? null;55 }56 57 if (strpos($eventName, '$') === false) {58 // Add default props only if the event is not system-defined (e.g., $identify)59 $properties = $this->addDefaultProps($properties);60 }49 if (isset($properties['userId'])) { 50 $properties['$user_id'] = $properties['userId']; 51 $properties['distinct_id'] = $properties['userId']; 52 unset($properties['userId']); 53 } else if (!isset($properties['distinct_id']) && !isset($properties['$user_id'])) { 54 $properties['distinct_id'] = $properties['primaryDomain'] ?? null; 55 } 56 57 if (strpos($eventName, '$') === false) { 58 // Add default props only if the event is not system-defined (e.g., $identify) 59 $properties = $this->addDefaultProps($properties); 60 } 61 61 62 try {63 $this->mixpanel->track($eventName, $properties);64 } catch (Exception $e) {65 error_log("Mixpanel tracking error: " . $e->getMessage());66 }62 try { 63 $this->mixpanel->track($eventName, $properties); 64 } catch (Exception $e) { 65 error_log("Mixpanel tracking error: " . $e->getMessage()); 66 } 67 67 } 68 68 69 69 public function isInitialized() 70 70 { 71 return $this->mixpanel !== null;71 return $this->mixpanel !== null; 72 72 } 73 73 … … 75 75 { 76 76 if (!$this->mixpanel) { 77 return false;77 return false; 78 78 } 79 79 -
accessibe/trunk/readme.txt
r3237954 r3284584 3 3 Tags: accessibility, web accessibility, wordpress accessibility, ada, wcag, accessible, a11y 4 4 Requires at least: 4.7 5 Tested up to: 6. 76 Stable tag: 2. 65 Tested up to: 6.8 6 Stable tag: 2.7 7 7 Requires PHP: 7.0 8 8 License: GPLv2 or later … … 68 68 69 69 == Changelog == 70 = v2.7 = 71 * 2025-04-28 72 * Limited Access Mode 73 70 74 = v2.6 = 71 75 * 2025-02-07
Note: See TracChangeset
for help on using the changeset viewer.