← All changes
|
vendor/elementor/wp-one-package/src/Admin/Components/Assets.php
+33
-1
1.7.4
→
1.7.7
View file →
| @@ -2,8 +2,9 @@ | ||
| 2 | 2 | |
| 3 | 3 | namespace ElementorOne\Admin\Components; |
| 4 | 4 | |
| 5 | 5 | use ElementorOne\Admin\Helpers\Utils; |
| 6 | +use ElementorOne\Connect\Facade; | |
| 6 | 7 | |
| 7 | 8 | if ( ! defined( 'ABSPATH' ) ) { |
| 8 | 9 | exit; // Exit if accessed directly. |
| 9 | 10 | } |
| @@ -108,12 +109,43 @@ | ||
| 108 | 109 | 'elementorNewPostNonce' => wp_create_nonce( 'elementor_action_new_post' ), |
| 109 | 110 | 'elementorSiteSettingsRedirectNonce' => wp_create_nonce( 'elementor_action_site_settings_redirect' ), |
| 110 | 111 | 'elementorEditSiteNonce' => wp_create_nonce( 'elementor_action_edit_website' ), |
| 111 | 112 | 'manageSiteOverviewRedirectNonce' => wp_create_nonce( 'manage_site_overview_redirect' ), |
| 112 | - 'shareUsageData' => 'yes' === Utils::get_one_connect()->data()->get_share_usage_data(), | |
| 113 | + 'shareUsageData' => $this->should_share_usage_data(), | |
| 113 | 114 | 'assetsUIRootUrl' => ELEMENTOR_ONE_UI_ASSETS_ROOT_URL, |
| 114 | 115 | ] ) . ';' |
| 115 | 116 | ); |
| 117 | + } | |
| 118 | + | |
| 119 | + /** | |
| 120 | + * Should share usage data | |
| 121 | + * @return bool | |
| 122 | + */ | |
| 123 | + private function should_share_usage_data(): bool { | |
| 124 | + global $plugin_page; | |
| 125 | + | |
| 126 | + $sa_app_connect = $plugin_page ? Facade::get_by_plugin_page( $plugin_page ) : null; | |
| 127 | + | |
| 128 | + if ( $sa_app_connect && $sa_app_connect->utils()->is_connected() ) { | |
| 129 | + return 'yes' === $sa_app_connect->data()->get_share_usage_data(); | |
| 130 | + } | |
| 131 | + | |
| 132 | + $is_editor_admin_page = is_callable( '\Elementor\Core\Admin\Admin::is_elementor_admin_page' ) | |
| 133 | + && \Elementor\Core\Admin\Admin::is_elementor_admin_page(); | |
| 134 | + | |
| 135 | + if ( $is_editor_admin_page && ! $sa_app_connect ) { | |
| 136 | + $editor_tracking_allowed = is_callable( '\Elementor\Tracker::is_allow_track' ) | |
| 137 | + && \Elementor\Tracker::is_allow_track(); | |
| 138 | + | |
| 139 | + $editor_tracking_updated = is_callable( '\Elementor\Tracker::get_last_update_time' ) | |
| 140 | + && \Elementor\Tracker::get_last_update_time(); | |
| 141 | + | |
| 142 | + if ( $editor_tracking_updated ) { | |
| 143 | + return $editor_tracking_allowed; | |
| 144 | + } | |
| 145 | + } | |
| 146 | + | |
| 147 | + return 'yes' === Utils::get_one_connect()->data()->get_share_usage_data(); | |
| 116 | 148 | } |
| 117 | 149 | |
| 118 | 150 | /** |
| 119 | 151 | * Assets constructor |