Statuspage - Source Excerpt 03
Summary
This source excerpt preserves a bounded section of Antichrist.net/wp-content/plugins/uaix-locale-router/src/Admin/StatusPage.php so readers can inspect the evidence without opening the full source file.
**Source path:** Antichrist.net/wp-content/plugins/uaix-locale-router/src/Admin/StatusPage.php
<form method="post" action="<?php echo esc_url( admin_url( 'admin-post.php' ) ); ?>">
<?php wp_nonce_field( 'uaixlr_repair_runtime' ); ?>
<input type="hidden" name="action" value="uaixlr_repair_runtime" />
<?php submit_button( 'Run Repair Tasks', 'primary', 'submit', false ); ?>
</form>
</div>
</div>
<?php
}
/**
* Run a safe repair pass for plugin runtime issues.
*
* @return void
*/
public static function handle_repair_runtime() {
self::assert_permissions( 'uaixlr_repair_runtime' );
$result = Plugin::repair_runtime();
$errors = isset( $result['errors'] ) && is_array( $result['errors'] ) ? $result['errors'] : array();
if ( ! empty( $errors ) ) {
Plugin::set_flash_notice(
sprintf(
'Repair completed with %d issue(s): %s',
count( $errors ),
implode( '; ', $errors )
),
'warning'
);
} else {
Plugin::set_flash_notice( 'Repair tasks completed successfully.' );
}
wp_safe_redirect( AdminPages::page_url( 'uaixlr-status' ) );
exit;
}
/**
* Run a targeted .htaccess repair for localized route handoff.
*
* @return void
*/
public static function handle_repair_htaccess() {
self::assert_permissions( 'uaixlr_repair_htaccess' );
$result = Plugin::repair_htaccess_block();
if ( ! empty( $result['success'] ) ) {
Plugin::set_flash_notice( 'The site-root .htaccess rewrite blocks were updated successfully.' );
} else {
$message = ! empty( $result['message'] ) ? (string) $result['message'] : 'UAIX Locale Router could not update .htaccess automatically.';
Plugin::set_flash_notice( $message . ' Review the manual snippet on the Status page if needed.', 'warning' );
}
wp_safe_redirect( AdminPages::page_url( 'uaixlr-status' ) );
exit;
}
/**
* Capability and nonce guard.
*
* @param string $action Nonce action.
* @return void
*/
private static function assert_permissions( $action ) {
if ( ! current_user_can( 'manage_options' ) ) {
wp_die( esc_html__( 'You are not allowed to manage plugin diagnostics.', 'uaix-locale-router' ) );
}
check_admin_referer( $action );
}
}