' . esc_html( $tabs[ $tab ]['help'] ) . '
', ) ); } $screen->set_help_sidebar( '' . esc_html__( 'VEFdocsKit', 'vefdocskit' ) . '
' . esc_html__( 'Open the guide', 'vefdocskit' ) . '
' ); } /** * Prints the page. * * @return void */ public function render() { if ( ! VEFDK_Capabilities::can_manage() ) { wp_die( esc_html__( 'You do not have permission to open this page.', 'vefdocskit' ), '', array( 'response' => 403 ) ); } $tabs = $this->tabs(); $tab = $this->current_tab( $tabs ); VEFDK_Admin_UI::render_page_top( $tabs[ $tab ]['label'], (string) ( $tabs[ $tab ]['description'] ?? '' ), $tabs[ $tab ]['icon'], $tabs, $tab ); $this->render_flash(); /** * Lets an extension print notices under the header of the page (a license to renew, an update…). */ do_action( 'vefdk_admin_notices' ); if ( ! empty( $tabs[ $tab ]['app'] ) ) { echo VEFDK_Front::render( 'admin', $tabs[ $tab ]['app'] ); // phpcs:ignore WordPress.Security.EscapeOutput.OutputNotEscaped -- escaped where built. echo ''; return; } if ( ! empty( $tabs[ $tab ]['callback'] ) && is_callable( $tabs[ $tab ]['callback'] ) ) { call_user_func( $tabs[ $tab ]['callback'] ); echo ''; return; } switch ( $tab ) { case 'accounts': $this->render_accounts(); break; case 'style': $this->render_style(); break; case 'settings': $this->render_settings(); break; case 'help': VEFDK_Admin_UI::render_subpanels( 'help', array( 'guide' => array( 'label' => __( 'Guide', 'vefdocskit' ), 'callback' => array( 'VEFDK_Help', 'render_tab' ), ), 'about' => array( 'label' => __( 'About', 'vefdocskit' ), 'callback' => array( 'VEFDK_About', 'render_tab' ), ), ) ); break; case 'support': VEFDK_Admin_UI::render_subpanels( 'support', array( 'diagnostic' => array( 'label' => __( 'Diagnostic', 'vefdocskit' ), 'callback' => array( 'VEFDK_Diagnostic', 'render_tab' ), ), 'support' => array( 'label' => __( 'Support', 'vefdocskit' ), 'callback' => array( 'VEFDK_Support', 'render_tab' ), ), ) ); break; } echo ''; } /* ------------------------------------------------------------------------------------------ * Messages * ---------------------------------------------------------------------------------------- */ /** * Stores a message for the next screen. The result of an action is shown once after the redirect. * * @param string $kind success or error. * @param string $message Text. * @return void */ public static function flash( $kind, $message ) { set_transient( 'vefdk_flash_' . get_current_user_id(), array( $kind, $message ), 120 ); } /** * Prints the message stored by the last action. * * @return void */ private function render_flash() { $flash = get_transient( 'vefdk_flash_' . get_current_user_id() ); if ( ! is_array( $flash ) ) { return; } delete_transient( 'vefdk_flash_' . get_current_user_id() ); printf( '%2$s
' . esc_html__( 'the page of the documents', 'vefdocskit' ) . '' ); ?>