'label' => esc_html__( 'This is a temporary deactivation for testing.', 'surecart' ), 'placeholder' => esc_html__( 'How can we assist you?', 'surecart' ), 'show_cta' => 'false', 'accept_feedback' => 'false', ), 'plugin_not_working' => array( 'label' => esc_html__( 'Something isn\'t working properly.', 'surecart' ), 'placeholder' => esc_html__( 'Please tell us more about what went wrong?', 'surecart' ), 'show_cta' => 'true', 'accept_feedback' => 'true', ), 'found_better_plugin' => array( 'label' => esc_html__( 'I found a better alternative.', 'surecart' ), 'placeholder' => esc_html__( 'Could you please specify which solution?', 'surecart' ), 'show_cta' => 'false', 'accept_feedback' => 'true', ), 'missing_a_feature' => array( 'label' => esc_html__( 'It\'s missing a specific feature.', 'surecart' ), 'placeholder' => esc_html__( 'Please tell us more about the feature.', 'surecart' ), 'show_cta' => 'false', 'accept_feedback' => 'true', ), 'other' => array( 'label' => esc_html__( 'Other', 'surecart' ), 'placeholder' => esc_html__( 'Please tell us more details.', 'surecart' ), 'show_cta' => 'false', 'accept_feedback' => 'true', ), ) ); } /** * Check if the current screen is allowed for the survey. * * This function checks if the current screen is one of the allowed screens for displaying the survey. * It uses the `get_current_screen` function to get the current screen information and compares it with the list of allowed screens. * * The function is accurate for identifying the main plugins screen, but doesn't account for: * - Network admin plugins screen (plugins.php in multisite) * - AJAX requests that might be triggered from the plugins screen * - Early admin page loads where get_current_screen() might not be available yet * * @return bool True if the current screen is allowed, false otherwise. */ public function isPluginsScreen() { // Check if we are in the admin area. if ( ! is_admin() ) { return false; } // Handle case where function is called before get_current_screen() is available. if ( ! function_exists( 'get_current_screen' ) ) { // Alternative check: look at the current admin page URL. global $pagenow; return 'plugins.php' === $pagenow; } // Get the current screen. $current_screen = get_current_screen(); // Check if $current_screen is a valid object before accessing its properties. if ( ! is_object( $current_screen ) ) { return false; // Return false if current screen is not valid. } // Get the current screen ID. $screen_id = $current_screen->id; // Check for both regular and network admin plugins screens. return ! empty( $screen_id ) && ( 'plugins' === $screen_id || 'plugins-network' === $screen_id ); } /** * Get API URL for sending analytics. * * @return string API URL. */ public function getApiUrl() { return defined( 'BSF_ANALYTICS_API_BASE_URL' ) ? BSF_ANALYTICS_API_BASE_URL : 'https://analytics.brainstormforce.com/'; } }