*/ public static function public_types(): array { $types = get_post_types( array( 'public' => true ), 'objects' ); unset( $types['attachment'] ); return (array) apply_filters( 'aiviso_post_type_scope_types', $types ); } public static function allows( int $post_id, ?array $options = null ): bool { $post_type = get_post_type( $post_id ); if ( ! $post_type || 'attachment' === $post_type ) { return false; } $raw = get_option( Settings_Page::OPTION_NAME, array() ); if ( ! is_array( $raw ) || ! array_key_exists( 'post_type_scope', $raw ) ) { $object = get_post_type_object( $post_type ); $allowed = (bool) ( $object && $object->public ); } else { $options = $options ?: Settings_Page::get(); $allowed = 'all' === $options['post_type_scope'] || in_array( $post_type, $options['post_type_scope_types'], true ); } return (bool) apply_filters( 'aiviso_post_type_in_scope', $allowed, $post_id, $post_type, $options ); } }