PluginProbe
CartFlows – Funnel Builder & Checkout Plugin for WooCommerce / 3.3.0
CartFlows – Funnel Builder & Checkout Plugin for WooCommerce v3.3.0
3.3.0 3.2.1 3.2.0 3.1.4 3.1.3 3.1.2 3.1.1 3.1.0 3.0.1 trunk 1.0.4 1.1.0 1.1.0.1 1.1.1 1.1.10 1.1.11 1.1.12 1.1.13 1.1.14 1.1.15 1.1.16 1.1.17 1.1.18 1.1.19 1.1.2 All 162 releases
← All changes | modules/content-generation/class-cartflows-ai-utils.php +7 -2 3.2.0 → 3.3.0 View file →
@@ -24,8 +24,10 @@
24 24 private static $instance;
25 25
26 26 /**
27 27 * Initiator
28 + *
29 + * @return self
28 30 */
29 31 public static function get_instance() {
30 32 if ( ! isset( self::$instance ) ) {
31 33 self::$instance = new self();
@@ -161,14 +163,17 @@
161 163 */
162 164 protected function get_auth_data( $key = '' ) {
163 165 $auth_data = get_option( 'cartflows_auth', false );
164 166
165 - if ( empty( $auth_data ) ) {
167 + if ( empty( $auth_data ) || ! is_array( $auth_data ) ) {
166 168 return new WP_Error( 'no_auth_data', __( 'No authentication data found.', 'cartflows' ) );
167 169 }
168 170
169 171 if ( ! empty( $key ) && is_string( $key ) ) {
170 - return $auth_data[ $key ] ?? new WP_Error( 'no_key_found', __( 'No data found for the provided key.', 'cartflows' ) );
172 + $value = $auth_data[ $key ] ?? null;
173 + return is_string( $value )
174 + ? $value
175 + : new WP_Error( 'no_key_found', __( 'No data found for the provided key.', 'cartflows' ) );
171 176 }
172 177
173 178 return $auth_data;
174 179 }