feat: Initial release v0.1.0

WP FediStream - Stream music over ActivityPub

Features:
- Custom post types: Artist, Album, Track, Playlist
- Custom taxonomies: Genre, Mood, License
- User roles: Artist, Label
- Admin dashboard with statistics
- Frontend templates and shortcodes
- Audio player with queue management
- ActivityPub integration with actor support
- WooCommerce product types for albums/tracks
- User library with favorites and history
- Notification system (in-app and email)

Co-Authored-By: Claude Opus 4.5 <noreply@anthropic.com>
This commit is contained in:
2026-01-28 23:23:05 +01:00
commit 4a5d7b9f4d
91 changed files with 22750 additions and 0 deletions

View File

@@ -0,0 +1,111 @@
<?php
/**
* Now Playing Widget.
*
* @package WP_FediStream
*/
namespace WP_FediStream\Frontend\Widgets;
use WP_FediStream\Plugin;
// Prevent direct file access.
if ( ! defined( 'ABSPATH' ) ) {
exit;
}
/**
* Displays the currently playing track (updates via JavaScript).
*/
class NowPlayingWidget extends \WP_Widget {
/**
* Constructor.
*/
public function __construct() {
parent::__construct(
'fedistream_now_playing',
__( 'FediStream: Now Playing', 'wp-fedistream' ),
array(
'description' => __( 'Display the currently playing track.', 'wp-fedistream' ),
'classname' => 'fedistream-widget fedistream-widget--now-playing',
)
);
}
/**
* Front-end display.
*
* @param array $args Widget arguments.
* @param array $instance Saved values from database.
* @return void
*/
public function widget( $args, $instance ): void {
$title = ! empty( $instance['title'] ) ? $instance['title'] : __( 'Now Playing', 'wp-fedistream' );
$title = apply_filters( 'widget_title', $title, $instance, $this->id_base );
$show_player = ! empty( $instance['show_player'] );
echo $args['before_widget']; // phpcs:ignore WordPress.Security.EscapeOutput.OutputNotEscaped
if ( $title ) {
echo $args['before_title'] . esc_html( $title ) . $args['after_title']; // phpcs:ignore WordPress.Security.EscapeOutput.OutputNotEscaped
}
try {
$plugin = Plugin::get_instance();
// phpcs:ignore WordPress.Security.EscapeOutput.OutputNotEscaped
echo $plugin->render(
'widgets/now-playing',
array(
'show_player' => $show_player,
)
);
} catch ( \Exception $e ) {
if ( WP_DEBUG ) {
echo '<p class="fedistream-error">' . esc_html( $e->getMessage() ) . '</p>';
}
}
echo $args['after_widget']; // phpcs:ignore WordPress.Security.EscapeOutput.OutputNotEscaped
}
/**
* Back-end widget form.
*
* @param array $instance Previously saved values from database.
* @return void
*/
public function form( $instance ): void {
$title = ! empty( $instance['title'] ) ? $instance['title'] : __( 'Now Playing', 'wp-fedistream' );
$show_player = ! empty( $instance['show_player'] );
?>
<p>
<label for="<?php echo esc_attr( $this->get_field_id( 'title' ) ); ?>"><?php esc_html_e( 'Title:', 'wp-fedistream' ); ?></label>
<input class="widefat" id="<?php echo esc_attr( $this->get_field_id( 'title' ) ); ?>" name="<?php echo esc_attr( $this->get_field_name( 'title' ) ); ?>" type="text" value="<?php echo esc_attr( $title ); ?>">
</p>
<p>
<label>
<input type="checkbox" id="<?php echo esc_attr( $this->get_field_id( 'show_player' ) ); ?>" name="<?php echo esc_attr( $this->get_field_name( 'show_player' ) ); ?>" value="1" <?php checked( $show_player ); ?>>
<?php esc_html_e( 'Show player controls', 'wp-fedistream' ); ?>
</label>
</p>
<p class="description">
<?php esc_html_e( 'This widget shows information about the currently playing track and updates automatically via JavaScript.', 'wp-fedistream' ); ?>
</p>
<?php
}
/**
* Sanitize widget form values as they are saved.
*
* @param array $new_instance Values just sent to be saved.
* @param array $old_instance Previously saved values from database.
* @return array Updated safe values to be saved.
*/
public function update( $new_instance, $old_instance ): array {
$instance = array();
$instance['title'] = ! empty( $new_instance['title'] ) ? sanitize_text_field( $new_instance['title'] ) : '';
$instance['show_player'] = ! empty( $new_instance['show_player'] );
return $instance;
}
}