array( 'Goal bar', 800, 120, 'Progress bar towards your active goal.' ), 'timer' => array( 'Subathon timer', 400, 120, 'Countdown that grows with donations (needs an "Add time" rule).' ), 'counter' => array( 'Counter', 400, 120, 'A running count (needs a "Counter" rule).' ), 'alerts' => array( 'Donation alerts', 600, 300, 'Pop-up alert for each new donation.' ), 'actions' => array( 'Rewards menu', 500, 400, 'Lists your donation actions (e.g. "$5: Eat a bean") for the active goal. Shows nothing if you have none.' ), ); /** @return array{url:string,base:string,sep:string} */ public static function widgetUrl( string $widget ): array { $token = OverlayController::ensure_token(); if ( get_option( 'permalink_structure' ) ) { $base = home_url( '/streamgoals-overlay/' . rawurlencode( $token ) . '/' . rawurlencode( $widget ) . '/' ); return array( 'url' => $base, 'base' => $base, 'sep' => '?' ); } $base = add_query_arg( array( 'sg_overlay_token' => $token, 'sg_overlay_widget' => $widget ), home_url( '/' ) ); return array( 'url' => $base, 'base' => $base, 'sep' => '&' ); } /** Used by the wizard and this screen: one copy-able link per widget. */ public static function urlList( bool $withPreview = false ): void { foreach ( self::WIDGETS as $w => [ $label, $width, $height, $desc ] ) { $u = self::widgetUrl( $w ); echo '
'; } if ( ! get_option( 'permalink_structure' ) ) { echo 'Your site uses "Plain" permalinks, so the links use the longer form. They work the same.
'; } } public static function render(): void { Admin::open( 'Overlays' ); $fonts = array( 'sans' => 'Clean sans-serif', 'serif' => 'Serif', 'mono' => 'Monospace', 'rounded' => 'Rounded', 'condensed' => 'Condensed' ); echo 'Paste these links into OBS as Browser Sources. Use the style builder to change how they look: all links update as you go.
'; echo 'Reloads every open OBS source. Done automatically after a plugin update.
Shows a fake donation on the Donation alerts overlay so you can check your OBS setup. Open the alerts preview above (or have OBS running) first, then press the button; the alert appears within a few seconds.
'; echo 'How tests are kept out of your numbers: test donations are not attached to any goal, so they never count towards raised totals, timers or counters. They are excluded from the CSV export, and marked TEST in the Donations list. Test donations are kept in the database until you delete them below.
'; Admin::form( 'sg_test_donation', array(), 'sg-inline' ); echo ' '; echo ' '; Admin::form( 'sg_delete_tests', array(), 'sg-inline' ); echo 'The links contain a secret token. If a link was shown on stream or shared by mistake, make new links. The old ones stop working immediately and you will need to paste the new ones into OBS.
'; Admin::form( 'sg_regen_token', array(), 'sg-confirm' ); echo '