self::LIST_SLUG ), admin_url( 'admin.php' ) ) ); exit; } /** * Home: setup until it is done, then how the business is doing. */ public function render(): void { if ( ! current_user_can( self::CAPABILITY ) ) { wp_die( esc_html__( 'You do not have permission to manage subscriptions.', 'submex' ) ); } App_Host::start( self::SLUG ); Page_Shell::open( __( 'Home', 'submex' ), '', array(), '', false ); $this->render_test_result(); $this->render_product_notice(); if ( ! $this->setup->is_complete() ) { $this->render_checklist(); } if ( $this->setup->has_subscriptions() ) { $this->render_summary(); } Page_Shell::close(); App_Host::end(); } public function render_list(): void { if ( ! current_user_can( self::CAPABILITY ) ) { wp_die( esc_html__( 'You do not have permission to manage subscriptions.', 'submex' ) ); } App_Host::start( self::LIST_SLUG ); $this->render_list_screen(); App_Host::end(); } private function render_list_screen(): void { $id = absint( $_GET['subscription'] ?? 0 ); // phpcs:ignore WordPress.Security.NonceVerification.Recommended if ( $id ) { $this->render_detail( $id ); return; } $table = new Subscriptions_Table(); $table->prepare_items(); Page_Shell::open( __( 'All subscriptions', 'submex' ), __( 'Everyone who pays you on a schedule.', 'submex' ), array(), sprintf( '%s', esc_url( admin_url( 'post-new.php?post_type=product' ) ), esc_html__( 'New subscription product', 'submex' ) ) ); $this->render_bulk_notice(); if ( ! $this->setup->has_subscriptions() ) { printf( '
%s
%s%s
%s
' . esc_html__( 'Nothing recorded yet.', 'submex' ) . '
'; return; } echo '| %s | %s | %s |