';
// self::menu();
// self::include_pages();
echo '';
}
public static function header(): void {
$logo_url = self::logo_url();
$add_url = add_query_arg( [
'page' => WPCoder::SLUG,
'tab' => 'settings',
'action' => 'new'
], admin_url( 'admin.php' ) );
?>
';
foreach ( $pages as $key => $page ) {
$class = ( $page['file'] === $current_page ) ? ' nav-tab-active' : '';
$id = '';
if ( $action === 'update' && $page['file'] === 'settings' ) {
$id = ( isset( $_REQUEST["id"] ) ) ? absint( $_REQUEST["id"] ) : '';
$page['name'] = __( 'Update', 'wp-coder' ) . ' #' . $id;
} elseif ( $page['file'] === 'settings' && ( $action !== 'new' && $action !== 'duplicate' ) ) {
continue;
}
echo '' . esc_html( $page['name'] ) . '';
}
echo '';
}
public static function include_pages(): void {
$current_page = self::get_current_page();
$pages = DashboardHelper::get_files( 'pages' );
$default = DashboardHelper::first_file( 'pages' );
$current = DashboardHelper::search_value( $pages, $current_page ) ? $current_page : $default;
$file = DashboardHelper::get_file( $current, 'pages' );
if ( $file !== false ) {
$file = apply_filters( WPCoder::PREFIX . '_admin_filter_file', $file, $current );
$page_path = DashboardHelper::get_folder_path( 'pages' ) . '/' . $file;
if ( file_exists( $page_path ) ) {
require_once $page_path;
}
}
}
public static function get_current_page(): string {
$default = DashboardHelper::first_file( 'pages' );
return ( isset( $_REQUEST["tab"] ) ) ? sanitize_text_field( $_REQUEST["tab"] ) : $default;
}
}