0 ) { if ( 'delete' === $action ) { Grid_Repository::delete( $grid_id ); echo '

' . esc_html__( 'Grid deleted successfully.', 'ajax-filter-posts' ) . '

'; } elseif ( 'duplicate' === $action ) { $new_id = Grid_Repository::duplicate( $grid_id ); if ( ! is_wp_error( $new_id ) ) { echo '

' . esc_html__( 'Grid duplicated successfully.', 'ajax-filter-posts' ) . '

'; } } elseif ( 'migrate' === $action ) { if ( ! class_exists( 'GridMaster\Migration\Legacy_Migrator' ) ) { require_once GRIDMASTER_PATH . '/inc/Migration/Legacy_Migrator.php'; } $migrated = \GridMaster\Migration\Legacy_Migrator::migrate( $grid_id ); if ( ! is_wp_error( $migrated ) ) { echo '

' . esc_html__( 'Legacy grid migrated to GridMaster 2.0 successfully!', 'ajax-filter-posts' ) . '

'; } } elseif ( 'rollback' === $action ) { if ( ! class_exists( 'GridMaster\Migration\Legacy_Migrator' ) ) { require_once GRIDMASTER_PATH . '/inc/Migration/Legacy_Migrator.php'; } \GridMaster\Migration\Legacy_Migrator::rollback( $grid_id ); echo '

' . esc_html__( 'Grid rolled back to legacy renderer.', 'ajax-filter-posts' ) . '

'; } } } // Query parameters. $page = isset( $_GET['paged'] ) ? max( 1, absint( $_GET['paged'] ) ) : 1; $search = isset( $_GET['s'] ) ? sanitize_text_field( wp_unslash( $_GET['s'] ) ) : ''; $status_filter = isset( $_GET['status'] ) ? sanitize_key( $_GET['status'] ) : ''; $grids_data = Grid_Repository::list_grids( array( 'per_page' => 20, 'page' => $page, 'search' => $search, 'status' => $status_filter, ) ); $items = $grids_data['items']; $total = $grids_data['total']; $pages = $grids_data['pages']; // Metric counts. global $wpdb; $table_name = Grid_Repository::table(); // phpcs:ignore WordPress.DB.PreparedSQL.InterpolatedNotPrepared -- Table name is strictly internal. $counts_raw = $wpdb->get_results( "SELECT migration_status, COUNT(*) as cnt FROM {$table_name} GROUP BY migration_status", OBJECT_K ); // phpcs:ignore WordPress.DB.PreparedSQL.InterpolatedNotPrepared -- Table name is strictly internal. $total_grids_count = (int) $wpdb->get_var( "SELECT COUNT(*) FROM {$table_name}" ); $v2_grids_count = isset( $counts_raw['new_builder'] ) ? (int) $counts_raw['new_builder']->cnt : 0; $converted_grids_count = isset( $counts_raw['converted'] ) ? (int) $counts_raw['converted']->cnt : 0; $legacy_grids_count = isset( $counts_raw['legacy'] ) ? (int) $counts_raw['legacy']->cnt : 0; $is_pro = function_exists( 'gridmaster_is_pro' ) && gridmaster_is_pro(); ?>
0 ) : ?>
0 ) : ?>
id . '"]'; $is_legacy = ( 'legacy' === $grid->migration_status ); $is_converted = ( 'converted' === $grid->migration_status ); $edit_url = $is_legacy ? admin_url( 'admin.php?page=gridmaster&path=build-grid&id=' . $grid->id ) : admin_url( 'admin.php?page=gridmaster-builder&id=' . $grid->id ); $display_title = ! empty( $grid->title ) ? $grid->title : sprintf( __( 'Grid #%d', 'ajax-filter-posts' ), $grid->id ); ?>
#id ); ?>
1 ) : ?>