&$sensor ) { // Check if that sensor is for login or not. if ( method_exists( $sensor, 'is_login_sensor' ) ) { $is_login_sensor = call_user_func_array( array( $sensor, 'is_login_sensor' ), array() ); if ( ! $is_login_sensor ) { unset( $sensors[ $key ] ); } } else { unset( $sensors[ $key ] ); } } unset( $sensor ); /** * WSAL Filter: `wsal_load_login_sensors` * * Filter for the list of sensors to be loaded for visitors * or public. No sensor is allowed to load on the front-end * except the ones in this array. * * @since 4.5.0 * * @param array $sensors - List of sensors to be loaded for visitors. */ $sensors = apply_filters( 'wsal_load_login_sensors', $sensors ); } else { // Load all the frontend sensors. if ( \WpSecurityAuditLog::is_frontend() && ! is_user_logged_in() ) { // Here we need to load only the Sensors which are frontend enabled. foreach ( $sensors as $key => &$sensor ) { // Check if that sensor is for frontend or not. if ( method_exists( $sensor, 'is_frontend_sensor' ) ) { $is_frontend_sensor = call_user_func_array( array( $sensor, 'is_frontend_sensor' ), array() ); if ( ! $is_frontend_sensor ) { unset( $sensors[ $key ] ); } } else { unset( $sensors[ $key ] ); } } unset( $sensor ); /** * WSAL Filter: `wsal_load_frontend_sensors` * * Filter for the list of sensors to be loaded for visitors * or public. No sensor is allowed to load on the front-end * except the ones in this array. * * @since 4.5.0 * * @param array $sensors - List of sensors to be loaded for visitors. */ $sensors = apply_filters( 'wsal_load_frontend_sensors', $sensors ); } // If we are on some frontend page, we don't want to load the sensors. if ( ! \WpSecurityAuditLog::is_frontend() ) { // Not a frontend page? Let remove the ones which are not frontend enabled. foreach ( $sensors as $key => &$sensor ) { // Check if that sensor is for frontend only or not. if ( method_exists( $sensor, 'is_frontend_only_sensor' ) ) { $is_frontend_only_sensor = call_user_func_array( array( $sensor, 'is_frontend_only_sensor' ), array() ); if ( $is_frontend_only_sensor ) { unset( $sensors[ $key ] ); } } } unset( $sensor ); } } foreach ( $sensors as $sensor ) { if ( method_exists( $sensor, 'init' ) ) { call_user_func_array( array( $sensor, 'init' ), array() ); } } } } }