PluginProbe
HubSpot All-In-One Marketing – Forms, Popups, Live Chat / 11.3.75
HubSpot All-In-One Marketing – Forms, Popups, Live Chat v11.3.75
11.3.75 11.3.73 11.3.71 11.3.70 11.3.69 11.3.64 11.3.65 11.3.62 11.3.61 11.3.56 11.3.58 11.0.31 11.0.52 11.0.54 11.0.56 11.0.58 11.0.7 11.1.10 11.1.11 11.1.13 11.1.14 11.1.15 11.1.2 11.1.20 11.1.21 All 73 releases
← All changes | public/admin/class-adminconstants.php +17 -10 11.1.1511.3.75 View file →
@@ -11,8 +11,9 @@
11 11 use Leadin\data\Portal_Options;
12 12 use Leadin\admin\Connection;
13 13 use Leadin\admin\Impact;
14 14 use Leadin\data\User_Metadata;
15 +use Leadin\auth\OAuthCryptoError;
15 16
16 17 /**
17 18 * Class containing all the constants used for admin script localization.
18 19 */
@@ -92,9 +93,9 @@
92 93 'wp' => Versions::get_wp_version(),
93 94 'theme' => get_option( 'stylesheet' ),
94 95 'adminUrl' => admin_url(),
95 96 'websiteName' => get_bloginfo( 'name' ),
96 - 'domain' => parse_url( get_site_url(), PHP_URL_HOST ),
97 + 'domain' => wp_parse_url( get_site_url(), PHP_URL_HOST ),
97 98 'wp_user' => $wp_user->first_name ? $wp_user->first_name : $wp_user->user_nicename,
98 99 'nonce' => self::get_connection_nonce(),
99 100 'accountName' => Portal_Options::get_account_name(),
100 101 'hsdio' => Portal_Options::get_device_id(),
@@ -142,9 +143,12 @@
142 143 /**
143 144 * Returns a minimal version of leadinConfig, containing the data needed by the background iframe.
144 145 */
145 146 public static function get_background_leadin_config() {
146 - $wp_user_id = get_current_user_id();
147 + $wp_user_id = get_current_user_id();
148 + $portal_id = Portal_Options::get_portal_id();
149 + $refresh_token = OAuth::get_refresh_token();
150 + $is_connected = ! empty( $portal_id ) && ! empty( $refresh_token );
147 151
148 152 $background_config = array(
149 153 'adminUrl' => admin_url(),
150 154 'activationTime' => Portal_Options::get_activation_time(),
@@ -152,9 +156,9 @@
152 156 'formsScript' => Filters::apply_forms_script_url_filters(),
153 157 'formsScriptPayload' => Filters::apply_forms_payload_filters(),
154 158 'meetingsScript' => Filters::apply_meetings_script_url_filters(),
155 159 'hublet' => Filters::apply_hublet_filters(),
156 - 'hubspotBaseUrl' => Filters::apply_base_url_filters( Connection::is_connected() ),
160 + 'hubspotBaseUrl' => Filters::apply_base_url_filters( $is_connected ),
157 161 'leadinPluginVersion' => constant( 'LEADIN_PLUGIN_VERSION' ),
158 162 'locale' => get_locale(),
159 163 'restUrl' => get_rest_url(),
160 164 'restNonce' => wp_create_nonce( 'wp_rest' ),
@@ -160,10 +164,12 @@
160 164 'restNonce' => wp_create_nonce( 'wp_rest' ),
161 165 'redirectNonce' => wp_create_nonce( Routing::REDIRECT_NONCE ),
162 166 'phpVersion' => Versions::get_php_version(),
163 167 'pluginPath' => constant( 'LEADIN_PATH' ),
164 - 'plugins' => get_plugins(),
165 - 'portalId' => Portal_Options::get_portal_id(),
168 + // Returning and empty array to release a hotfix to a security issue ensuring no errors on the frontend
169 + // 'plugins' => get_plugins(),
170 + 'plugins' => array(),
171 + 'portalId' => $portal_id,
166 172 'accountName' => Portal_Options::get_account_name(),
167 173 'portalDomain' => Portal_Options::get_portal_domain(),
168 174 'portalEmail' => get_user_meta( $wp_user_id, 'leadin_email', true ),
169 175 'reviewSkippedDate' => User_Metadata::get_skip_review(),
@@ -169,20 +175,21 @@
169 175 'reviewSkippedDate' => User_Metadata::get_skip_review(),
170 176 'theme' => get_option( 'stylesheet' ),
171 177 'wpVersion' => Versions::get_wp_version(),
172 178 'leadinQueryParams' => self::get_hubspot_query_params_array(),
173 - 'connectionStatus' => Connection::is_connected() ? 'Connected' : 'NotConnected',
179 + 'connectionStatus' => $is_connected ? 'Connected' : 'NotConnected',
174 180 'contentEmbed' => self::get_content_embed_config(),
175 181 'requiresContentEmbedScope' => is_plugin_active( 'hubspot-content-embed/content-embed.php' ) ? '1' : '0',
176 182 'lastAuthorizeTime' => Portal_Options::get_last_authorize_time(),
177 183 'lastDeauthorizeTime' => Portal_Options::get_last_deauthorize_time(),
178 184 'lastDisconnectTime' => Portal_Options::get_last_disconnect_time(),
179 - 'refreshTokenError' => Portal_Options::get_refresh_token_error(),
180 185 );
181 186
182 - if ( Connection::is_connected() ) {
183 - $background_config['refreshToken'] = OAuth::get_refresh_token();
187 + if ( false === $refresh_token ) {
188 + $background_config['decryptError'] = OAuthCryptoError::DECRYPT_FAILED;
184 189 }
190 + // refreshToken is no longer included in leadinConfig — PHP exchanges it for
191 + // a short-lived access token server-side via the /access-token REST endpoint
185 192
186 193 return $background_config;
187 194 }
188 195
@@ -191,9 +198,9 @@
191 198 */
192 199 public static function get_leadin_config() {
193 200 $leadin_config = self::get_background_leadin_config();
194 201
195 - if ( ! Connection::is_connected() ) {
202 + if ( 'NotConnected' === $leadin_config['connectionStatus'] ) {
196 203 if ( ! Impact::has_params() ) {
197 204 $impact_link = Impact::get_affiliate_link();
198 205 if ( ! empty( $impact_link ) ) {
199 206 $leadin_config['impactLink'] = Impact::get_affiliate_link();