context; } public function with_context( array $context ): static { $copy = clone $this; $copy->context = self::clean_context( $context ); return $copy; } public function with_views( TableViews $views ): static { $copy = clone $this; $copy->rl_table_views = $views; return $copy; } public function table_views(): ?TableViews { return $this->rl_table_views; } public static function clean_context( array $context ): array { $out = array(); foreach ( $context as $key => $value ) { $key = sanitize_key( (string) $key ); if ( '' === $key || ! is_scalar( $value ) || ! is_numeric( $value ) ) { continue; } $value = absint( $value ); if ( $value > 0 && count( $out ) < 8 ) { $out[ $key ] = $value; } } ksort( $out ); return $out; } public function base_url(): string { if ( defined( 'REST_REQUEST' ) && REST_REQUEST ) { $referer = wp_get_raw_referer(); return is_string( $referer ) ? (string) wp_validate_redirect( $referer, '' ) : ''; } $uri = isset( $_SERVER['REQUEST_URI'] ) ? esc_url_raw( wp_unslash( $_SERVER['REQUEST_URI'] ) ) : ''; return '' === $uri ? '' : (string) $uri; } public function caption(): string { return ''; } public function show_caption(): bool { return false; } public function empty_text( bool $filtered ): string { return $filtered ? __( 'No rows match these filters.', 'rooster-lms' ) : __( 'Nothing to show yet.', 'rooster-lms' ); } public function exports(): array { return array(); } public function bulk(): array { return array(); } public function bulk_url(): string { return admin_url( 'admin-post.php' ); } public function bulk_fields(): array { return array(); } public function table_class(): string { return ''; } public function kind(): string { return ''; } public function screens(): array { return array(); } public function labels(): array { return array(); } public function language(): string { return ''; } public function text_size(): ?bool { return null; } }