← All changes
|
core/common/modules/events-manager/module.php
+0
-43
4.2.1
→
3.32.0-dev2
View file →
| @@ -3,11 +3,9 @@ | ||
| 3 | 3 | namespace Elementor\Core\Common\Modules\EventsManager; |
| 4 | 4 | |
| 5 | 5 | use Elementor\Core\Base\Module as BaseModule; |
| 6 | 6 | use Elementor\Core\Common\Modules\Connect\Apps\Base_App; |
| 7 | -use Elementor\Core\Common\Modules\Connect\Apps\Common_App; | |
| 8 | 7 | use Elementor\Core\Experiments\Manager as Experiments_Manager; |
| 9 | -use Elementor\Includes\EditorAssetsAPI; | |
| 10 | 8 | use Elementor\Utils; |
| 11 | 9 | use Elementor\Plugin; |
| 12 | 10 | use Elementor\Tracker; |
| 13 | 11 | |
| @@ -17,10 +15,8 @@ | ||
| 17 | 15 | |
| 18 | 16 | class Module extends BaseModule { |
| 19 | 17 | |
| 20 | 18 | const EXPERIMENT_NAME = 'editor_events'; |
| 21 | - const DEFAULT_SESSION_RECORDING_PERCENT = 0; | |
| 22 | - const REMOTE_MIXPANEL_CONFIG_URL = 'https://assets.elementor.com/mixpanel/v1/mixpanel.json'; | |
| 23 | 19 | |
| 24 | 20 | public function get_name() { |
| 25 | 21 | return 'events-manager'; |
| 26 | 22 | } |
| @@ -30,27 +26,10 @@ | ||
| 30 | 26 | Tracker::is_allow_track() && |
| 31 | 27 | ! Tracker::has_terms_changed( '2025-07-07' ) && |
| 32 | 28 | Plugin::$instance->experiments->is_feature_active( self::EXPERIMENT_NAME ); |
| 33 | 29 | |
| 34 | - $is_flags_enabled = false; | |
| 35 | - $session_recording_percent = self::DEFAULT_SESSION_RECORDING_PERCENT; | |
| 36 | - $debug = ( defined( 'ELEMENTOR_EDITOR_EVENTS_DEBUG' ) && ELEMENTOR_EDITOR_EVENTS_DEBUG ) ?? false; | |
| 37 | - | |
| 38 | - if ( $can_send_events ) { | |
| 39 | - $mixpanel_config = self::get_remote_mixpanel_config(); | |
| 40 | - $has_config = EditorAssetsAPI::has_valid_nested_array( $mixpanel_config, [ 0 ] ); | |
| 41 | - | |
| 42 | - if ( $has_config ) { | |
| 43 | - $is_flags_enabled = (bool) ( $mixpanel_config[0]['flags'] ?? false ); | |
| 44 | - | |
| 45 | - $session_replays = $mixpanel_config[0]['sessionReplays'] ?? []; | |
| 46 | - $session_recording_percent = $session_replays['recordSessionsPercent'] ?? null; | |
| 47 | - } | |
| 48 | - } | |
| 49 | - | |
| 50 | 30 | $settings = [ |
| 51 | 31 | 'can_send_events' => $can_send_events, |
| 52 | - 'debug' => $debug, | |
| 53 | 32 | 'elementor_version' => ELEMENTOR_VERSION, |
| 54 | 33 | 'site_url' => hash( 'sha256', get_site_url() ), |
| 55 | 34 | 'wp_version' => get_bloginfo( 'version' ), |
| 56 | 35 | 'user_agent' => esc_html( Utils::get_super_global_value( $_SERVER, 'HTTP_USER_AGENT' ) ), |
| @@ -58,11 +37,8 @@ | ||
| 58 | 37 | 'site_key' => get_option( Base_App::OPTION_CONNECT_SITE_KEY ), |
| 59 | 38 | 'subscription_id' => self::get_subscription_id(), |
| 60 | 39 | 'subscription' => self::get_subscription(), |
| 61 | 40 | 'token' => ELEMENTOR_EDITOR_EVENTS_MIXPANEL_TOKEN, |
| 62 | - 'flags_enabled' => $is_flags_enabled, | |
| 63 | - 'user_id' => self::get_user_id(), | |
| 64 | - 'session_recording_percent' => $session_recording_percent, | |
| 65 | 41 | ]; |
| 66 | 42 | |
| 67 | 43 | return $settings; |
| 68 | 44 | } |
| @@ -98,25 +74,6 @@ | ||
| 98 | 74 | return null; |
| 99 | 75 | } |
| 100 | 76 | |
| 101 | 77 | return json_decode( $license_data['value'], true ); |
| 102 | - } | |
| 103 | - | |
| 104 | - private static function get_remote_mixpanel_config() { | |
| 105 | - $editor_assets_api = new EditorAssetsAPI( [ | |
| 106 | - EditorAssetsAPI::ASSETS_DATA_URL => static::REMOTE_MIXPANEL_CONFIG_URL, | |
| 107 | - EditorAssetsAPI::ASSETS_DATA_TRANSIENT_KEY => '_elementor_mixpanel_config', | |
| 108 | - EditorAssetsAPI::ASSETS_DATA_KEY => 'mixpanel', | |
| 109 | - ] ); | |
| 110 | - | |
| 111 | - return $editor_assets_api->get_assets_data(); | |
| 112 | - } | |
| 113 | - private static function get_user_id() { | |
| 114 | - $user_common_data = get_user_option( Common_App::OPTION_CONNECT_COMMON_DATA_KEY ); | |
| 115 | - | |
| 116 | - if ( ! is_array( $user_common_data ) ) { | |
| 117 | - return null; | |
| 118 | - } | |
| 119 | - | |
| 120 | - return Common_App::get_connect_user_id_from_access_token( $user_common_data['access_token'] ?? null ); | |
| 121 | 78 | } |
| 122 | 79 | } |