source->activeGoal(); $gid = $goal ? (int) $goal['id'] : 0; switch ( $widget ) { case 'goal': return Payloads::goal( $goal, $goal ? $this->source->raisedMinor( $goal ) : 0 ); case 'timer': return Payloads::timer( $gid ? $this->source->stateValue( $gid, 'timer_ends_at' ) : null, $gid ? $this->source->stateValue( $gid, 'paused_remaining' ) : null, $now ); case 'counter': $c = $gid ? $this->source->counter( $gid ) : array( 'label' => '', 'value' => 0 ); return Payloads::counter( $c['label'], $c['value'] ); case 'alerts': return Payloads::alerts( $this->source->donations( $since, 20 ), $since ); } return null; } }