__( 'Shows the compact rating on single posts that have one and where “In the sidebar” is ticked.', '3task-review-box' ) ) ); } /** * Ausgabe. * * @param array $args Theme-Hüllen. * @param array $instance Einstellungen. */ public function widget( $args, $instance ) { if ( ! is_singular() ) { return; } $id = (int) get_queried_object_id(); $box = ThreeRB_Box::get( $id ); if ( ! ThreeRB_Box::has_rating( $box ) || empty( $box['place']['sidebar'] ) ) { return; } $html = ThreeRB_Render::box( $id, array( 'variant' => 'compact' ) ); if ( '' === $html ) { return; } $titel = isset( $instance['title'] ) ? $instance['title'] : ''; echo wp_kses_post( $args['before_widget'] ); if ( '' !== $titel ) { echo wp_kses_post( $args['before_title'] ) . esc_html( $titel ) . wp_kses_post( $args['after_title'] ); } echo $html; // phpcs:ignore WordPress.Security.EscapeOutput.OutputNotEscaped -- in ThreeRB_Render escaped. echo wp_kses_post( $args['after_widget'] ); } /** * Formular. * * @param array $instance Einstellungen. * @return string */ public function form( $instance ) { $titel = isset( $instance['title'] ) ? $instance['title'] : __( 'Our rating', '3task-review-box' ); printf( '

', esc_attr( $this->get_field_id( 'title' ) ), esc_html__( 'Title', '3task-review-box' ), esc_attr( $this->get_field_name( 'title' ) ), esc_attr( $titel ) ); return ''; } /** * Speichern. * * @param array $neu Neu. * @param array $alt Alt. * @return array */ public function update( $neu, $alt ) { return array( 'title' => sanitize_text_field( isset( $neu['title'] ) ? $neu['title'] : '' ) ); } }