Changeset 3231917
- Timestamp:
- 01/30/2025 09:55:24 AM (13 months ago)
- Location:
- accessibe/trunk
- Files:
-
- 1 added
- 4 edited
-
accessibe.php (modified) (1 diff)
-
accessibe_inc/js/accessibe.js (modified) (2 diffs)
-
accessiebe.php (added)
-
class.accessibeforwp.php (modified) (9 diffs)
-
readme.txt (modified) (2 diffs)
Legend:
- Unmodified
- Added
- Removed
-
accessibe/trunk/accessibe.php
r3224617 r3231917 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. 3.36 * Version: 2.4 7 7 * Author: accessiBe 8 8 * Author URI: https://accessibe.com/ -
accessibe/trunk/accessibe_inc/js/accessibe.js
r3223588 r3231917 83 83 API.sendDataToIframe('redirect-url', redirectUrl); 84 84 }, 85 syncMerchantDetails: async ( ) => {85 syncMerchantDetails: async (shouldLogout = false) => { 86 86 if (AcsbStore.jQueryReady && AcsbStore.isIframeReady) { 87 87 const url = new URL(window.location); 88 API.setMerchant(await API.fetchMerchantDetails()); 88 const merchantData = await API.fetchMerchantDetails(); 89 if(!merchantData.acsbUserId && shouldLogout) { 90 const iframeRef = document.getElementById('accessibe-universal-iframe'); 91 if (iframeRef) { 92 iframeRef.contentWindow.postMessage( 93 { eventName: 'request-logout', data: {} }, 94 '*' 95 ); 96 } 97 } 98 else if (merchantData.acsbUserId) { 99 delete merchantData['acsbUserId']; 100 } 101 API.setMerchant(merchantData); 89 102 API.sendMerchantDetails(); 90 103 API.sendRedirectUrl(window.location.href); … … 115 128 case 'iframe-ready': 116 129 AcsbStore.isIframeReady = true; 117 await API.syncMerchantDetails( );130 await API.syncMerchantDetails(true); 118 131 break; 119 132 case 'signup': -
accessibe/trunk/class.accessibeforwp.php
r3224617 r3231917 30 30 ]; 31 31 32 public static $DEFAULT_WIDGET_CONFIG_FOR_SCRIPT = [ 33 'leadColor' => '#146ff8', 34 'language' => 'en', 35 'position' => 'left', 36 'triggerColor' => '#146ff8', 37 'triggerPositionX' => 'right', 38 'triggerPositionY' => 'bottom', 39 'triggerSize' => 'medium', 40 'triggerRadius' => '50%', 41 'hideTrigger' => 'false', 42 'triggerOffsetX' => 20, 43 'triggerOffsetY' => 20, 44 'triggerIcon' => 'people', 45 'hideMobile' => 'false', 46 'mobileTriggerPositionX' => 'right', 47 'mobileTriggerPositionY' => 'bottom', 48 'mobileTriggerSize' => 'small', 49 'mobileTriggerRadius' => '50%', 50 'mobileTriggerOffsetX' => 10, 51 'mobileTriggerOffsetY' => 10, 52 'statementLink' => '', 53 ]; 54 32 55 public static $icon_mapping_to_widget = [ 33 56 "LegacyDisplay" => "display", … … 64 87 /* Render js in footer */ 65 88 add_action('wp_footer', array('AccessibeWp', 'accessibe_render_js_in_footer')); 89 90 /* Handles the Mixpanel event when the plugin is updated. */ 91 add_action('upgrader_process_complete', array('AccessibeWp', 'accessibe_upgrade_completed'), 10, 2); 92 93 /* Sends the Mixpanel event after the plugin update with both versions. */ 94 add_action('admin_init', array('AccessibeWp', 'accessibe_after_update_tasks')); 66 95 67 96 /* Link to settings page */ … … 174 203 $accessibe_options['triggerIcon'] = self::$icon_mapping_to_widget[$icon_value]; 175 204 } 205 206 $accessibe_options = array_merge(self::$DEFAULT_WIDGET_CONFIG_FOR_SCRIPT, $accessibe_options); 176 207 177 208 echo "<script>(function(){var s=document.createElement('script');e = !document.body ? document.querySelector('head'):document.body;s.src='https://acsbapp.com/apps/app/dist/js/app.js';s.setAttribute('data-source', 'WordPress');s.setAttribute('data-plugin-version', '".self::accessibe_get_plugin_version()."');s.defer=true;s.onload=function(){acsbJS.init({ … … 232 263 'fullName' => $current_user->display_name, 233 264 'storeId' => self::sanitizeDomain(wp_parse_url(site_url())['host']), 265 'mixpanelProps' => array ( 266 'wordpressStoreName' => self::sanitizeDomain(wp_parse_url(site_url())['host']), 267 'wordpressPluginVersionNumber' => self::accessibe_get_plugin_version() . '', 268 'wordpressAccountUserID' => $current_user->ID, 269 'wordpressUserEmail' => $current_user->user_email, 270 'wordpressUsername' => $current_user->user_login 271 ) 234 272 // 'storeId' => '9cc3-2405-201-5c0f-d070-14fd-b303-b02-1999.ngrok-free.app' 235 273 ); 274 275 if (isset($current_user_options->acsbUserId)) { 276 $detail['acsbUserId'] = $current_user_options->acsbUserId; 277 } 236 278 237 279 $active_license_id = $current_user_options->activeLicenseId; … … 365 407 public static function accessibe_logout() { 366 408 $current_data = json_decode(get_option(ACCESSIBE_WP_OPTIONS_KEY)); 367 $current_data->activeLicenseId = ''; 368 update_option(ACCESSIBE_WP_OPTIONS_KEY, json_encode($current_data)); 409 if($current_data) { 410 $current_data->activeLicenseId = ''; 411 update_option(ACCESSIBE_WP_OPTIONS_KEY, json_encode($current_data)); 412 } 369 413 echo json_encode(array('message' => 'ok')); 370 414 wp_die(); … … 514 558 // Attempt to retrieve and decode options using ACCESSIBE_OPTIONS_KEY 515 559 $accessibe_options = get_option(ACCESSIBE_WP_OPTIONS_KEY, array()); 516 $isLoggedOutOnce = false;517 560 if(!empty($accessibe_options)) { 518 561 $accessibe_options = json_decode($accessibe_options, true); 519 $isLoggedOutOnce = $accessibe_options['isLoggedOutOnce'];520 562 } 521 563 522 564 // If decoding fails or ACCESSIBE_OPTIONS_KEY does not exist, fallback to ACCESSIBE_OLD_OPTIONS_KEY 523 565 if(empty($accessibe_options) || !isset($accessibe_options['script'])) { 524 $ accessibe_options = get_option(ACCESSIBE_WP_OLD_OPTIONS_KEY, array());525 $accessibe_options ['isLoggedOutOnce'] = $isLoggedOutOnce;566 $older_options = get_option(ACCESSIBE_WP_OLD_OPTIONS_KEY, array()); 567 $accessibe_options = array_merge($accessibe_options, $older_options); 526 568 } 527 569 … … 611 653 <iframe id='accessibe-universal-iframe' src='https://universal.accessibe.com'></iframe> 612 654 </div> 613 <?php614 if ($accessibe_options['isLoggedOutOnce'] != true) {615 echo "<script>616 window.addEventListener('message', (event) => {617 if(event.data.eventName == 'iframe-ready') {618 const iframeRef = document.getElementById('accessibe-universal-iframe');619 iframeRef?.contentWindow.postMessage(620 { eventName: 'request-logout', data: {} },621 '*',622 );623 setTimeout(()=> {624 window.location.reload();625 }, 1000);626 }});627 </script>";628 $accessibe_options['isLoggedOutOnce'] = true;629 630 update_option(ACCESSIBE_WP_OPTIONS_KEY, json_encode($accessibe_options));631 }632 ?>633 655 <!-- /.wrap --> 634 656 <?php … … 681 703 } // accessibe_clear_3rd_party_cache 682 704 705 /** 706 * @param \WP_Upgrader $upgrader_object The upgrader object. 707 * @param array $hook_extra Extra information about the update. 708 */ 709 public static function accessibe_upgrade_completed(\WP_Upgrader $upgrader_object, $hook_extra) { 710 711 $plugin_basename = ACCESSIBE_WP_BASENAME; 712 713 // Check if the hook involves updating plugins. 714 if ( 715 isset($hook_extra['action'], $hook_extra['type']) && 716 $hook_extra['action'] === 'update' && 717 $hook_extra['type'] === 'plugin' 718 ) { 719 $this_plugin_updated = false; 720 721 // Handle bulk plugin updates. 722 if (isset($hook_extra['plugins']) && is_array($hook_extra['plugins'])) { 723 foreach ($hook_extra['plugins'] as $updated_plugin) { 724 if ($updated_plugin === $plugin_basename) { 725 $this_plugin_updated = true; 726 break; 727 } 728 } 729 } 730 731 // Handle single plugin updates or auto-updates. 732 if ( 733 !$this_plugin_updated && // If not already identified as updated. 734 isset($hook_extra['plugin']) && 735 $hook_extra['plugin'] === $plugin_basename 736 ) { 737 $this_plugin_updated = true; 738 } 739 740 if ($this_plugin_updated) { 741 // Get the previous version of the plugin. 742 $previous_version = self::accessibe_get_plugin_version() . ''; 743 // Save the previous version in a transient. 744 set_transient('accessibe_previous_version', $previous_version); 745 } 746 } 747 } 748 749 public static function accessibe_after_update_tasks() { 750 751 // Check if the plugin was recently updated. 752 $previous_version = get_transient('accessibe_previous_version'); 753 if ($previous_version) { 754 // Delete the transient after fetching its value. 755 delete_transient('accessibe_previous_version'); 756 757 $latest_version = self::accessibe_get_plugin_version() . ''; 758 759 $current_data = json_decode(get_option(ACCESSIBE_WP_OPTIONS_KEY), true); 760 $current_user = wp_get_current_user(); 761 762 if(!isset($current_data['acsbUserId']) && !isset($current_data['mixpanelUUID'])) { 763 $uuid = self::generateUuidV4(); 764 $current_data['mixpanelUUID'] = $uuid; 765 } 766 767 $current_data['pluginVersion'] = $latest_version; 768 769 $mixpanelHandler = new MixpanelHandler(); 770 771 if(isset($current_data['acsbUserId'])) { 772 $mixpanelHandler->trackEvent('pluginUpgraded', ['userId' => $current_data['acsbUserId'], 'pluginVersion' => $latest_version, 'previousPluginVersion' => $previous_version, 'wordpressStoreName' => self::sanitizeDomain(wp_parse_url(site_url())['host']), 'wordpressPluginVersionNumber' => self::accessibe_get_plugin_version() . '', 'wordpressAccountUserID' => $current_user->ID, 'wordpressUserEmail' => $current_user->user_email, 'wordpressUsername' => $current_user->user_login ]); 773 } 774 else { 775 $mixpanelHandler->trackEvent('pluginUpgraded', ['$device_id' => $current_data['mixpanelUUID'], 'pluginVersion' => $latest_version, 'previousPluginVersion' => $previous_version, 'wordpressStoreName' => self::sanitizeDomain(wp_parse_url(site_url())['host']), 'wordpressPluginVersionNumber' => self::accessibe_get_plugin_version() . '', 'wordpressAccountUserID' => $current_user->ID, 'wordpressUserEmail' => $current_user->user_email, 'wordpressUsername' => $current_user->user_login ]); 776 } 777 update_option(ACCESSIBE_WP_OPTIONS_KEY, json_encode($current_data)); 778 } 779 } 780 781 683 782 684 783 public static function activate() { 685 784 self::accessibe_reset_pointers(); 686 785 $current_data = json_decode(get_option(ACCESSIBE_WP_OPTIONS_KEY), true); 687 if(!isset($current_data['isInstalled']) || $current_data['isInstalled'] === false) { 786 $data_to_check = self::accessibe_get_options(); 787 if(empty($data_to_check)) { 688 788 $uuid = self::generateUuidV4(); 689 789 $current_user = wp_get_current_user(); 690 790 $mixpanelHandler = new MixpanelHandler(); 691 $mixpanelHandler->trackEvent('pluginInstalled', ['$device_id' => $uuid, 'primaryDomain' => self::sanitizeDomain(wp_parse_url(site_url())['host']), 'wp_id' => $current_user->ID, 'wp_email' => $current_user->user_email, 'wp_username' => $current_user->user_login, 'wp_display_name' => $current_user->display_name ]); 692 $current_data['isInstalled'] = true; 791 $mixpanelHandler->trackEvent('pluginInstalled', ['$device_id' => $uuid, 'wordpressStoreName' => self::sanitizeDomain(wp_parse_url(site_url())['host']), 'wordpressPluginVersionNumber' => self::accessibe_get_plugin_version() . '', 'wordpressAccountUserID' => $current_user->ID, 'wordpressUserEmail' => $current_user->user_email, 'wordpressUsername' => $current_user->user_login ]); 693 792 $current_data['mixpanelUUID'] = $uuid; 793 $current_data['pluginVersion'] = self::accessibe_get_plugin_version() . ''; 694 794 update_option(ACCESSIBE_WP_OPTIONS_KEY, json_encode($current_data)); 695 795 } … … 699 799 $current_data = json_decode(get_option(ACCESSIBE_WP_OPTIONS_KEY), true); 700 800 $current_user = wp_get_current_user(); 801 802 if(!isset($current_data['acsbUserId']) && !isset($current_data['mixpanelUUID'])) { 803 $uuid = self::generateUuidV4(); 804 $current_data['mixpanelUUID'] = $uuid; 805 } 806 701 807 $mixpanelHandler = new MixpanelHandler(); 702 if(isset($current_data['acsb userId'])) {703 $mixpanelHandler->trackEvent('plugin Installed', ['userId' => $current_data['acsbuserId'], 'primaryDomain' => self::sanitizeDomain(wp_parse_url(site_url())['host']), 'wp_id' => $current_user->ID, 'wp_email' => $current_user->user_email, 'wp_username' => $current_user->user_login, 'wp_display_name' => $current_user->display_name]);808 if(isset($current_data['acsbUserId'])) { 809 $mixpanelHandler->trackEvent('pluginUninstalled', ['userId' => $current_data['acsbUserId'], 'wordpressStoreName' => self::sanitizeDomain(wp_parse_url(site_url())['host']), 'wordpressPluginVersionNumber' => self::accessibe_get_plugin_version() . '', 'wordpressAccountUserID' => $current_user->ID, 'wordpressUserEmail' => $current_user->user_email, 'wordpressUsername' => $current_user->user_login ]); 704 810 } 705 811 else { 706 $mixpanelHandler->trackEvent('pluginInstalled', ['$device_id' => $current_data['mixpanelUUID'], 'primaryDomain' => self::sanitizeDomain(wp_parse_url(site_url())['host']), 'wp_id' => $current_user->ID, 'wp_email' => $current_user->user_email, 'wp_username' => $current_user->user_login, 'wp_display_name' => $current_user->display_name ]); 707 } 708 $mixpanelHandler->trackEvent('pluginUninstalled', ['primaryDomain' => self::sanitizeDomain(wp_parse_url(site_url())['host'])]); 812 $mixpanelHandler->trackEvent('pluginUninstalled', ['$device_id' => $current_data['mixpanelUUID'], 'wordpressStoreName' => self::sanitizeDomain(wp_parse_url(site_url())['host']), 'wordpressPluginVersionNumber' => self::accessibe_get_plugin_version() . '', 'wordpressAccountUserID' => $current_user->ID, 'wordpressUserEmail' => $current_user->user_email, 'wordpressUsername' => $current_user->user_login ]); 813 } 709 814 delete_option(ACCESSIBE_WP_OPTIONS_KEY); 710 815 delete_option(ACCESSIBE_WP_POINTERS_KEY); -
accessibe/trunk/readme.txt
r3224617 r3231917 4 4 Requires at least: 4.7 5 5 Tested up to: 6.7 6 Stable tag: 2. 3.36 Stable tag: 2.4 7 7 Requires PHP: 7.0 8 8 License: GPLv2 or later … … 57 57 Plans start at $490 a year (or $59/mo), and vary depending on your website’s monthly traffic. 58 58 59 == Installation == 60 1. Download the plugin file. 61 2. In your WordPress dashboard go to **Plugins** > **Add New** > **Upload Plugin** and select the file you downloaded in the previous step. 62 3. Select **Install Now**. Once it’s installed, the **Install Now** button will change to Activate. 63 4. Select **Activate**. 64 5. Sign up to accessiBe in the plugin. If you already have an account, select **Log in**. 65 6. Select the domain to **start your 7-day free trial**. 66 67 See [here](https://accessibe.com/support/installation/how-to-install-accessibe-on-a-wordpress-website) for details. 68 59 69 == Changelog == 70 = v2.4 = 71 * 2025-01-30 72 * Analytics and bug fixes 73 60 74 = v2.3.3 = 61 75 * 2025-01-18
Note: See TracChangeset
for help on using the changeset viewer.