queuedCount(); } catch ( \Throwable ) { return 0; } } private static function url( array $args = array() ): string { return Admin::url( self::PAGE, $args ); } /* ---------------------------------------------------------------- render */ public static function render(): void { Admin::open( 'Rewards' ); $edit = Admin::get_int( 'edit' ); if ( 'new' === Admin::get_str( 'view' ) || $edit ) { self::renderForm( $edit ); } else { self::renderQueue(); self::renderMenu(); } Admin::close(); } private static function renderQueue(): void { $cur = Admin::currency(); $repo = self::repo(); $queued = $repo->queued( 200 ); echo '
Nothing in the queue. When a donation triggers a reward, it shows up here.
'; } else { echo Admin::tableOpen( array( 'Donor', 'Amount', 'Reward', 'Time', 'Message', '' ), 'Reward queue' ); foreach ( $queued as $e ) { echo 'Donors pick a reward on the donation form (or just donate the amount). Rewards must be at least ' . esc_html( Format::money( self::minMinor(), $cur ) ) . ', the minimum donation.
'; echo ''; if ( ! $actions ) { echo 'No rewards yet.
That reward no longer exists. Back to rewards
'; return; } $cur = Admin::currency(); $goals = self::goalTitles(); $val = static fn( string $k, $d = '' ) => $a[ $k ] ?? $d; $mode = (string) $val( 'mode', Matcher::EXACT ); $data = array( 'currency' => $cur, 'exp' => Money::exponent( $cur ), 'editId' => $id, 'actions' => array_values( array_map( static fn( array $r ): array => array( 'id' => $r['id'], 'goal_id' => $r['goal_id'], 'title' => $r['title'], 'amount_minor' => $r['amount_minor'], 'mode' => $r['mode'] ), array_filter( self::repo()->all(), static fn( array $r ): bool => (bool) $r['enabled'] && $r['id'] !== $id ) ) ), ); echo 'What you do on stream, for example "Eat a bean". Up to 120 characters. | |
Optional. A short note shown to donors. | |
At least ' . esc_html( Format::money( self::minMinor(), $cur ) ) . ' (your minimum donation). The amount before any fee the donor chooses to cover. | |
| Triggers | ';
echo ' '; echo ' |
Lower numbers are listed first. Leave empty to put it last. |