__( 'A radio player built in StreamSera.', 'streamsera' ), 'show_instance_in_rest' => true, 'customize_selective_refresh' => true, ) ); } /** * Output. * * @param array $args Sidebar args. * @param array $instance Instance. */ public function widget( $args, $instance ) { $player_id = absint( $instance['player'] ?? 0 ); if ( ! $player_id ) { return; } $markup = Assets::render_player( $player_id, array( 'layout' => $instance['layout'] ?? '' ) ); if ( ! $markup ) { return; } echo wp_kses_post( $args['before_widget'] ); if ( ! empty( $instance['title'] ) ) { echo wp_kses_post( $args['before_title'] ) . esc_html( apply_filters( 'widget_title', $instance['title'], $instance, $this->id_base ) ) . wp_kses_post( $args['after_title'] ); } echo wp_kses( $markup, streamsera_allowed_html() ); echo wp_kses_post( $args['after_widget'] ); } /** * Form. * * @param array $instance Instance. * @return void */ public function form( $instance ) { $instance = wp_parse_args( (array) $instance, array( 'title' => '', 'player' => 0, 'layout' => '', ) ); $players = get_posts( array( 'post_type' => Player::POST_TYPE, 'post_status' => 'publish', 'posts_per_page' => 100, 'orderby' => 'title', 'order' => 'ASC', ) ); ?>

sanitize_text_field( $new_instance['title'] ?? '' ), 'player' => absint( $new_instance['player'] ?? 0 ), 'layout' => sanitize_key( $new_instance['layout'] ?? '' ), ); } }