' . esc_html__( "Setup KB", "echo-knowledge-base" ) . ''; } } //phpcs:ignore WordPress.Security.EscapeOutput.OutputNotEscaped echo self::admin_header_logo(); if ( ! empty( $kb_config ) ) { ?>

<?php esc_html_e( 'Echo Knowledge Base Logo', 'echo-knowledge-base' ); ?> <?php esc_html_e( 'Echo Knowledge Base Logo', 'echo-knowledge-base' ); ?>
< class="epkb-admin__top-panel__item epkb-admin__top-panel__item--" >

>

'; foreach ( $admin_page_views as $page_view ) { // Optionally we can have null in $page_view, make sure we handle it correctly if ( empty( $page_view ) || ! is_array( $page_view ) ) { continue; } // Fill missing fields in admin page view configuration array with default values $page_view = self::admin_page_view_fill_missing_with_default( $page_view ); // Do not render view if the user does not have permission if ( ! current_user_can( $page_view['minimum_required_capability'] ) ) { continue; } // Link tabs (with 'url') open a separate page and have no content on this page if ( ! empty( $page_view['url'] ) ) { continue; } ?>
'; ?>
$value ) { $data_escaped .= 'data-' . esc_attr( $key ) . '="' . esc_attr( $value ) . '" '; } } ?>
>
$value ) { $sub_data_escaped .= 'data-' . esc_attr( $key ) . '="' . esc_attr( $value ) . '" '; } } ?>
>
$value ) { $data_escaped .= 'data-' . esc_attr( $key ) . '="' . esc_attr( $value ) . '" '; } } ?>
>
$value ) { $data_escaped .= 'data-' . esc_attr( $key ) . '="' . esc_attr( $value ) . '" '; } } ?>
>
EPKB_Admin_UI_Access::get_admin_capability(), 'secondary_tab_access_override' => [], 'active' => false, 'list_id' => '', 'list_key' => '', 'kb_config_id' => '', 'url' => '', // Optional URL - if set, the tab is a link that opens the URL in a new browser tab // Top Panel Item 'label_text' => '', 'main_class' => '', 'label_class' => '', 'icon_class' => '', // Secondary Panel Items 'secondary_tabs' => array(), // Boxes List 'list_top_actions_html' => '', 'list_bottom_actions_html' => '', 'boxes_list' => array(), 'vertical_tabs' => array(), // List footer HTML 'list_footer_html' => '', ); // Default secondary view $default_secondary = array( // Shared 'active' => false, 'list_key' => '', // Secondary Panel Item 'label_text' => '', 'main_class' => '', 'label_class' => '', 'icon_class' => '', // Secondary Boxes List 'list_top_actions_html' => '', 'list_bottom_actions_html' => '', 'boxes_list' => array(), ); // Default box $default_box = array( 'icon_class' => '', 'class' => '', 'id' => '', 'title' => '', 'description' => '', 'html' => '', 'return_html' => false, 'extra_tags' => [], ); // Default admin form tab in vertical_tabs $default_admin_form_tab = array( 'title' => '', 'icon' => '', 'title_before_icon' => true, 'key' => '', 'active' => false, 'contents' => [], 'sub_tabs' => [], ); // Default content for admin form tab $default_admin_form_tab_content = array( 'title' => '', 'icon' => '', 'icon_text' => '', 'desc' => '', 'body_html' => '', 'read_more_url' => '', 'read_more_text' => '', ); // Default admin form sub-tab in vertical_tabs $default_admin_form_sub_tab = array( 'title' => '', 'icon' => '', 'icon_text' => '', 'key' => '', 'active' => false, 'contents' => [], 'class' => '', ); // Set default view $page_view = array_merge( $default_page_view, $page_view ); // Set default boxes foreach ( $page_view['boxes_list'] as $box_index => $box_content ) { // Do not fill empty or not valid array if ( empty( $page_view['boxes_list'][$box_index] ) || ! is_array( $page_view['boxes_list'][$box_index] ) ) { continue; } $page_view['boxes_list'][$box_index] = array_merge( $default_box, $box_content ); } // Set default secondary views foreach ( $page_view['secondary_tabs'] as $secondary_index => $secondary_content ) { // Do not fill empty or not valid array if ( empty( $page_view['secondary_tabs'][$secondary_index] ) || ! is_array( $page_view['secondary_tabs'][$secondary_index] ) ) { continue; } // if minimum required capability is missed, then inherit it from upper level $secondary_content['minimum_required_capability'] = in_array( $secondary_content['list_key'], array_keys( $page_view['secondary_tab_access_override'] ) ) ? $page_view['secondary_tab_access_override'][$secondary_content['list_key']] : $page_view['minimum_required_capability']; $page_view['secondary_tabs'][$secondary_index] = array_merge( $default_secondary, $secondary_content ); // Set default boxes foreach ( $page_view['secondary_tabs'][$secondary_index]['boxes_list'] as $box_index => $box_content ) { // Do not fill empty or not valid array if ( empty( $page_view['secondary_tabs'][$secondary_index]['boxes_list'][$box_index] ) || ! is_array( $page_view['secondary_tabs'][$secondary_index]['boxes_list'][$box_index] ) ) { continue; } $page_view['secondary_tabs'][$secondary_index]['boxes_list'][$box_index] = array_merge( $default_box, $box_content ); } } if ( ! empty( $page_view['secondary_tab_access_override'] ) ) { $page_view['minimum_required_capability'] = reset( $page_view['secondary_tab_access_override'] ); } // Set default tabs in vertical_tabs foreach ( $page_view['vertical_tabs'] as $tab_key => $admin_form_tab ) { $page_view['vertical_tabs'][$tab_key] = array_merge( $default_admin_form_tab, $admin_form_tab ); // Set default contents in tabs foreach ( $page_view['vertical_tabs'][$tab_key]['contents'] as $content_index => $admin_form_tab_content ) { $page_view['vertical_tabs'][$tab_key]['contents'][$content_index] = array_merge( $default_admin_form_tab_content, $admin_form_tab_content ); } // Set default sub-tabs foreach ( $page_view['vertical_tabs'][$tab_key]['sub_tabs'] as $sub_tab_index => $admin_form_sub_tab ) { $page_view['vertical_tabs'][$tab_key]['sub_tabs'][$sub_tab_index] = array_merge( $default_admin_form_sub_tab, $admin_form_sub_tab ); // Set default contents in sub-tabs foreach ( $admin_form_sub_tab['contents'] as $context_index => $admin_form_sub_tab_content ) { $page_view['vertical_tabs'][$tab_key]['sub_tabs'][$sub_tab_index]['contents'][$context_index] = array_merge( $default_admin_form_tab_content, $admin_form_sub_tab_content ); } } } return $page_view; } /** * We need to add this HTML to admin page to catch JS from third party plugins and show missing CSS message if needed */ public static function admin_page_header() { ?>

'error', 'title' => esc_html__( 'We did not detect any Main Page for your knowledge base', 'echo-knowledge-base' ) . ': ' . esc_html( $kb_config['kb_name'] ) . '. ' . esc_html__( 'You can do the following:', 'echo-knowledge-base' ), 'desc' => '' ), $return_html ); if ( $return_html ) { return $notification_escaped; } else { //phpcs:ignore WordPress.Security.EscapeOutput.OutputNotEscaped echo $notification_escaped; } } /** * Display warning about Block Main page + WPML On * * @param $kb_config * @param bool $return_html * * @return string|void */ public static function display_block_wpml_warning( $kb_config, $return_html=false ) { $notification_escaped = EPKB_HTML_Forms::notification_box_middle( array( 'type' => 'error', 'title' => esc_html__( 'We have Detected You are Using Blocks for your KB Main Page and WPML', 'echo-knowledge-base' ), 'desc' => '

' . esc_html__( 'To edit text strings, you will need to update each main page individually for each language. For more details, please refer to our article.', 'echo-knowledge-base' ) . '

' . esc_html__( 'Learn More', 'echo-knowledge-base' ) . '' ), $return_html ); if ( $return_html ) { return $notification_escaped; } else { //phpcs:ignore WordPress.Security.EscapeOutput.OutputNotEscaped echo $notification_escaped; } } public static function display_block_main_page( $kb_config, $include_help_links = true ) { $output_html = '
' . // Main Content '
' . '

' . esc_html__( 'Your Knowledge Base Main Page is now using WordPress KB blocks.', 'echo-knowledge-base' ) . '

' . '' . esc_html__( 'Edit Main Page', 'echo-knowledge-base' ) . '' . '
'; if ( $include_help_links ) { // Resources & Support Section with Two Columns $output_html .= '
' . '
' . '
' . '

' . esc_html__( 'Documentation', 'echo-knowledge-base' ) . '

' . '

' . esc_html__( 'Access comprehensive guides and tutorials for KB blocks and features.', 'echo-knowledge-base' ) . '

' . '' . esc_html__( 'View Documentation', 'echo-knowledge-base' ) . '' . '
' . '
' . '

' . esc_html__( 'Technical Support', 'echo-knowledge-base' ) . '

' . '

' . esc_html__( 'Get help from our support team for any KB related issues.', 'echo-knowledge-base' ) . '

' . '' . esc_html__( 'Contact Support', 'echo-knowledge-base' ) . '' . '
' . '
' . '
'; } $output_html .= '
'; return $output_html; } /** * Show FE offer with link to FE editor and link to disable the offer * @param $kb_config * @return false|string */ public static function display_fe_button_above_main_page_settings( $kb_config ) { ob_start(); ?>

.

.

.
sprintf( esc_html__( "Get %1\$sResource Links%2\$s Feature", 'echo-knowledge-base' ), '', '' ), 'list' => array( esc_html__( 'Add call-to-action boxes with links to the Main Page', 'echo-knowledge-base' ), esc_html__( 'Customize the call-to-action appearance', 'echo-knowledge-base' ), ), 'btn_text' => esc_html__( 'Upgrade Now', 'echo-knowledge-base' ), 'btn_url' => 'https://www.echoknowledgebase.com/wordpress-plugin/elegant-layouts/', ) ); } /** * Display boxes in single row * @param $box_config * @return void */ private static function display_settings_horizontal_box( $box_config ) { ?>