' . esc_html__( 'FeedFixer', 'feedfixer' ) . '

'; if ( 'missing_extension' === $state ) { $out .= '

' . esc_html__( "The 'Google for WooCommerce' extension is not active. FeedFixer reads the product issues that extension stores, so activate it and connect Merchant Center first.", 'feedfixer' ) . '

'; } elseif ( 'missing_table' === $state ) { $out .= '

' . esc_html__( "The issue table of the 'Google for WooCommerce' extension was not found yet. Sync the extension first, then reload this page.", 'feedfixer' ) . '

'; } elseif ( 'missing_columns' === $state ) { $missing = array_map( 'strval', (array) ( $result['missing_columns'] ?? array() ) ); $out .= '

' . esc_html__( "The table format of the 'Google for WooCommerce' extension changed, so FeedFixer cannot read it. Missing columns:", 'feedfixer' ) . ' ' . esc_html( implode( ', ', $missing ) ) . '

'; } elseif ( 'ok' !== $state ) { $out .= '

' . esc_html__( 'FeedFixer could not read the product issues.', 'feedfixer' ) . '

'; } elseif ( ! $rows ) { $out .= '

' . esc_html__( 'No product issues stored by Google for WooCommerce', 'feedfixer' ) . '

'; } else { $groups = feedfixer_group_issues( $rows ); $counts = feedfixer_issue_counts( $groups ); $out .= '

' . esc_html( sprintf( '%d products, %d issues, %d errors', $counts['products'], $counts['issues'], $counts['errors'] ) ) . '

'; foreach ( $groups as $group ) { $out .= '

' . esc_html( $group['product_name'] ) . '

'; $out .= '

' . esc_html__( 'Edit product', 'feedfixer' ) . '

'; } } if ( '' !== $waitlist_url && '' !== esc_url( $waitlist_url ) ) { $out .= '

' . esc_html__( 'Want automatic fixes later?', 'feedfixer' ) . ' ' . esc_html__( 'Join the waitlist.', 'feedfixer' ) . '

'; } return $out . ''; } function feedfixer_admin_page_callback(): void { if ( ! current_user_can( 'manage_woocommerce' ) ) { wp_die( esc_html__( 'You do not have permission to view this page.', 'feedfixer' ) ); } $result = feedfixer_fetch_issue_rows( $GLOBALS['wpdb'], 500, feedfixer_extension_active() ); $url = defined( 'FEEDFIXER_WAITLIST_URL' ) ? (string) FEEDFIXER_WAITLIST_URL : ''; $edit = function ( $id ): string { return (string) get_edit_post_link( (int) $id, 'raw' ); }; // The renderer escapes every dynamic value itself. echo feedfixer_render_admin_page( $result, $url, $edit ); // phpcs:ignore WordPress.Security.EscapeOutput.OutputNotEscaped }