'; // Close container.
return $html;
}
/**
* Renders player header with branding and statistics
*
* @param int|null $post_id Post ID for statistics.
* @return string Header HTML.
*/
public function render_header( ?int $post_id = null ): string {
// Check if branding should be hidden (WordPress compliance).
$hide_branding = get_option( 'accessibility_audio_tts_hide_branding', false );
if ( $hide_branding ) {
return '';
}
$html = '
';
// Get listening statistics.
$listening_count = $this->get_listening_count( $post_id );
// Build header text with listening count.
$header_text = $this->build_header_text( $listening_count );
// Show link to plugin page when branding is enabled.
$html .= '' . esc_html( $header_text ) . '';
$html .= '
';
return $html;
}
/**
* Renders play/pause button
*
* @param int $post_id Post ID for unique element IDs.
* @return string Play button HTML.
*/
public function render_play_button( int $post_id ): string {
return sprintf(
'',
esc_attr__( 'Play', 'accessibility-audio-tts-text-to-speech-for-articles' ),
$post_id,
$this->get_play_icon_svg(),
esc_html__( 'Play', 'accessibility-audio-tts-text-to-speech-for-articles' )
);
}
/**
* Renders timeline/progress bar
*
* @param int $post_id Post ID for unique element IDs.
* @return string Timeline HTML.
*/
public function render_timeline( int $post_id ): string {
return sprintf(
'
',
esc_attr__( 'Playback progress bar', 'accessibility-audio-tts-text-to-speech-for-articles' ),
$post_id
);
}
/**
* Renders time display
*
* @return string Time display HTML.
*/
public function render_time_display(): string {
return '
0:00 / 0:00
';
}
/**
* Renders volume controls
*
* @param int $post_id Post ID for unique element IDs.
* @return string Volume controls HTML.
*/
public function render_volume_controls( int $post_id ): string {
return sprintf(
'