plugin = $plugin;
}
/**
* Renders the page.
*/
public function render(): void {
if ( ! current_user_can( Plugin::CAPABILITY ) ) {
return;
}
$settings = $this->plugin->settings();
$values = $settings->all();
$channels = $this->plugin->channels()->all();
$label = $this->plugin->channel()->label();
?>
plugin ); ?>
render_status( $settings, $channels ); ?>
plugin->job_monitor() ); ?>
button(
Actions::TOGGLE_PAUSE,
$settings->is_paused() ? __( 'Resume', 'tidelist' ) : __( 'Pause everything', 'tidelist' ),
$settings->is_paused() ? 'button button-primary' : 'button'
);
foreach ( $channels as $channel ) {
$this->render_connection_buttons( $channel );
}
?>
render_paste_card( $channel ); ?>
label() ) ); ?>
label() ) ); ?>
label();
if ( $channel->is_connected() ) {
$this->button( Actions::OAUTH_START, Text::channel( __( 'Reconnect {channel} account', 'tidelist' ), $label ), 'button', $channel );
$this->button( Actions::DISCONNECT, Text::channel( __( 'Disconnect {channel}', 'tidelist' ), $label ), 'button', $channel );
} else {
$this->button( Actions::OAUTH_START, Text::channel( __( 'Connect {channel} account', 'tidelist' ), $label ), 'button button-primary', $channel );
}
$this->button( Actions::TEST, Text::channel( __( 'Test {channel} connection (read-only)', 'tidelist' ), $label ), 'button', $channel );
}
/**
* The "paste the address" card for a site the marketplace cannot return to (a local copy).
*
* @param ChannelInterface $channel Channel.
*/
private function render_paste_card( ChannelInterface $channel ): void {
if ( ! Actions::needs_paste( $channel->redirect_uri() ) || ( $channel->is_connected() && ! Actions::connect_pending() ) ) {
return;
}
?>