', '' !== $mount_style ? ' style="' . esc_attr( $mount_style ) . '"' : '', esc_url( $source, array( 'http', 'https' ) ), esc_attr( $options ) ); if ( ! $block ) { return $player; } $alignment = isset( $attributes['displayAlign'] ) && in_array( $attributes['displayAlign'], array( 'left', 'center', 'right' ), true ) ? $attributes['displayAlign'] : 'center'; $wrapper = get_block_wrapper_attributes( array( 'class' => 'asciiplayer-block' ) ); $figure = 'class="asciiplayer-figure asciiplayer-align-' . esc_attr( $alignment ) . '"' . ( '' !== $figure_style ? ' style="' . esc_attr( $figure_style ) . '"' : '' ); // RichText emits escaped text and line breaks. No other markup is needed. $caption = isset( $attributes['caption'] ) ? wp_kses( (string) $attributes['caption'], array( 'br' => array() ) ) : ''; return '
' . $player . ( '' !== trim( $caption ) ? '
' . $caption . '
' : '' ) . '
'; } /** * Preserve [asciiplayer]URL[/asciiplayer] and its existing options. * * @param mixed $attributes Shortcode attributes. * @param string|null $content Enclosed URL. * @return string */ function render_shortcode( $attributes = array(), $content = null ) { return null === $content ? '' : render_player( $attributes, $content ); } /** * Dynamic block callback. Both authoring paths use exactly the same sanitizer. * * @param array $attributes Block attributes. * @return string */ function render_block( $attributes ) { return render_player( $attributes, null, true ); }