BSF_Analytics_Helper::is_allowed_screen()

Check if the current screen is allowed for the survey.


Description

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.


Return

(bool) True if the current screen is allowed, false otherwise.


Source

File: admin/bsf-analytics/classes/class-bsf-analytics-helper.php

		public static function is_allowed_screen() {

			// This filter allows to dynamically modify the list of allowed screens for the survey.
			$allowed_screens = apply_filters( 'uds_survey_allowed_screens', array( 'plugins' ) );

			$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.
			}

			$screen_id = $current_screen->id;

			if ( ! empty( $screen_id ) && in_array( $screen_id, $allowed_screens, true ) ) {
				return true;
			}

			return false;
		}

Changelog

Changelog
Version Description
1.1.6 Introduced.


User Contributed Notes

You must log in before being able to contribute a note or feedback.