array( 'label' => __( 'Site Relations', 'robotstxt-mlp2-mlp5' ), 'expected' => (int) ( $analysis['site_relations_count'] ?? 0 ), ), 'post_relation' => array( 'label' => __( 'Post Relations', 'robotstxt-mlp2-mlp5' ), 'expected' => (int) ( $analysis['post_groups_count'] ?? 0 ), ), 'term_relation' => array( 'label' => __( 'Term Relations', 'robotstxt-mlp2-mlp5' ), 'expected' => (int) ( $analysis['term_groups_count'] ?? 0 ), ), ); $summary = array(); foreach ( $contexts as $context => $meta ) { $summary[ $context ] = array( 'label' => $meta['label'], 'expected' => $meta['expected'], 'migrated' => Robotstxt_Mlp2_Mlp5_Logger::count( array( 'type' => 'success', 'context' => $context, ) ), 'skipped' => Robotstxt_Mlp2_Mlp5_Logger::count( array( 'type' => 'skipped', 'context' => $context, ) ), 'errors' => Robotstxt_Mlp2_Mlp5_Logger::count( array( 'type' => 'error', 'context' => $context, ) ), ); } return $summary; } /** * Handle the CSV export request. * * Must be called on network_admin_init when the export GET param is present. */ public static function maybe_export_csv(): void { check_admin_referer( 'mlp_migrator_export_log', 'mlp_export_nonce' ); if ( ! current_user_can( 'manage_network' ) ) { wp_die( esc_html__( 'You do not have permission to export the log.', 'robotstxt-mlp2-mlp5' ) ); } $csv = Robotstxt_Mlp2_Mlp5_Logger::export_csv(); header( 'Content-Type: text/csv; charset=UTF-8' ); header( 'Content-Disposition: attachment; filename="mlp-migration-log.csv"' ); header( 'Pragma: no-cache' ); // phpcs:ignore WordPress.Security.EscapeOutput.OutputNotEscaped echo $csv; exit; } /** * Render the Step 5 UI. */ public static function render(): void { $summary = self::get_summary(); $export_url = wp_nonce_url( admin_url( 'admin-post.php?action=mlp_migrator_export_log' ), 'mlp_migrator_export_log', 'mlp_export_nonce' ); ?>

0 ) { $color = '#dba617'; // Amber. } if ( 0 === (int) $row['migrated'] && (int) $row['expected'] > 0 ) { $color = '#d63638'; // Red. } ?>