Plugin - Source Excerpt 02
Summary
This source excerpt preserves a bounded section of Antichrist.net/wp-content/plugins/uaix-locale-router/src/Plugin.php so readers can inspect the evidence without opening the full source file.
**Source path:** Antichrist.net/wp-content/plugins/uaix-locale-router/src/Plugin.php
return Settings::get();
}
/**
* Update plugin settings.
*
* @param array $settings Sanitized settings.
* @return void
*/
public static function update_settings( array $settings ) {
Settings::update( $settings );
}
/**
* Clear the cached localized-home diagnostics.
*
* @return void
*/
public static function clear_localized_home_diagnostics() {
delete_transient( 'uaixlr_localized_home_check' );
delete_transient( 'ns12lr_localized_home_check' );
}
/**
* Clear the cached link-review diagnostics.
*
* @return void
*/
public static function clear_link_review_diagnostics() {
delete_transient( 'uaixlr_link_review' );
delete_transient( 'ns12lr_link_review' );
delete_transient( 'uaixlr_translation_runtime_strings' );
}
/**
* Review source files for locale-link problems.
*
* @param bool $force_refresh Whether to bypass the transient cache.
* @return array
*/
public static function locale_link_review_diagnostics( $force_refresh = false ) {
return LinkReviewScanner::locale_link_review_diagnostics( $force_refresh );
}
/**
* Save a flash notice for the next admin page load.
*
* @param string $message Notice message.
* @param string $type Notice type.
* @param array $data Extra payload.
* @return void
*/
public static function set_flash_notice( $message, $type = 'success', array $data = array() ) {
Notices::set_flash_notice( $message, $type, $data );
}
/**
* Consume a queued flash notice.
*
* @return array
*/
public static function consume_flash_notice() {
return Notices::consume_flash_notice();
}
/**
* Store a bootstrap notice.
*
* @param string $message Notice message.
* @param string $type Notice type.
* @return void
*/
public static function store_bootstrap_notice( $message, $type = 'error' ) {
Notices::store_bootstrap_notice( $message, $type );
}
/**
* Clear bootstrap notices.
*
* @return void
*/
public static function clear_bootstrap_notice() {
Notices::clear_bootstrap_notice();
}
/**
* Render bootstrap notices.
*
* @return void
*/
public static function render_bootstrap_notice() {
Notices::render_bootstrap_notice();
}
/**
* Log a bootstrap issue.
*
* @param string $context Log context.
* @param string $message Message.
* @return void
*/
public static function log_bootstrap_issue( $context, $message ) {
Notices::log_bootstrap_issue( $context, $message );
}
/**
* Add helpful links to the plugin row on the Plugins screen.
*
* @param array $links Existing action links.
* @return array
*/
public static function filter_plugin_action_links( $links ) {
if ( ! current_user_can( 'manage_options' ) ) {
return $links;
}
array_unshift(
$links,
sprintf(
'<a href="%s">%s</a>',
esc_url( AdminPages::page_url( 'uaixlr-settings' ) ),
esc_html__( 'Settings', 'uaix-locale-router' )
),
sprintf(
'<a href="%s">%s</a>',
esc_url( AdminPages::page_url( 'uaixlr-status' ) ),
esc_html__( 'Status', 'uaix-locale-router' )
)
);
return $links;
}
/**
* Report the current plugin health and environment state.
*
* @return array
*/
public static function system_status() {
global $wp_version;
$settings = self::settings();
$dictionary_dir = self::dictionaries_dir();
$manifest = DictionaryRepository::dictionary_manifest();
$supported_locales = LocaleRepository::get_supported_locales();
$enabled_locales = LocaleRepository::get_enabled_locales();
$debug_log_path = trailingslashit( WP_CONTENT_DIR ) . 'debug.log';
$bootstrap_notice = get_option( 'uaixlr_bootstrap_notice', array() );
$raw_bootstrap_notice = get_option( 'uaixlr_bootstrap_notice_raw', array() );
$home_url = (string) get_option( 'home' );
$home_scheme = (string) wp_parse_url( $home_url, PHP_URL_SCHEME );
$request_scheme = Path::detect_request_scheme();
$default_url_tag = LocaleRepository::get_default_url_tag();
$permalink_structure = (string) get_option( 'permalink_structure', '' );
$htaccess_status = self::htaccess_diagnostics();
$migration_status = Migrator::status();
return array(
'plugin_version' => UAIXLR_VERSION,
'install_version' => (string) get_option( 'uaixlr_install_version', '' ),
'runtime_booted' => self::$runtime_booted,
'bootstrap_notice' => ! empty( $bootstrap_notice['message'] ) ? $bootstrap_notice : $raw_bootstrap_notice,
'wordpress_version' => isset( $wp_version ) ? (string) $wp_version : '',
'php_version' => PHP_VERSION,
'site_locale' => function_exists( 'determine_locale' ) ? determine_locale() : get_locale(),
'default_locale' => LocaleRepository::get_default_locale(),
'default_url_tag' => $default_url_tag,
'redirect_bare_urls' => ! empty( $settings['redirect_bare_urls'] ),
'rest_localization_mode' => isset( $settings['rest_localization_mode'] ) ? (string) $settings['rest_localization_mode'] : 'unlocalized',
'enabled_locales_count' => count( $enabled_locales ),
'supported_locales_count' => count( $supported_locales ),
'home_url' => $home_url,
'home_scheme' => $home_scheme,
'request_scheme' => $request_scheme,
'effective_front_scheme' => Path::preferred_front_scheme( $home_scheme ),
'home_scheme_mismatch' => '' !== $request_scheme && '' !== $home_scheme && strtolower( $request_scheme ) !== strtolower( $home_scheme ),
'permalink_structure' => $permalink_structure,
'pretty_permalinks_enabled'=> '' !== $permalink_structure,
'localized_home_url' => Path::build_front_url( Path::localize_path( '/', $default_url_tag ) ),
'dictionary_manifest_count'=> count( $manifest ),
'dictionary_dir' => $dictionary_dir,
'dictionary_dir_exists' => is_dir( $dictionary_dir ),
'dictionary_dir_writable' => self::is_dictionary_dir_writable( $dictionary_dir ),
'validation_table_name' => self::validation_table_name(),
'validation_table_exists' => self::validation_table_exists(),
'debug_enabled' => defined( 'WP_DEBUG' ) && WP_DEBUG,
'debug_log_enabled' => defined( 'WP_DEBUG_LOG' ) && WP_DEBUG_LOG,
'debug_log_path' => $debug_log_path,
'debug_log_exists' => file_exists( $debug_log_path ),
'htaccess' => $htaccess_status,
'migration_status' => $migration_status,
'migration_ran_at' => isset( $migration_status['ran_at'] ) ? absint( $migration_status['ran_at'] ) : 0,
'migration_errors' => isset( $migration_status['errors'] ) && is_array( $migration_status['errors'] ) ? $migration_status['errors'] : array(),
);
}
/**
* Return site-root .htaccess diagnostics.
*
* @return array
*/
public static function htaccess_diagnostics() {
return HtaccessManager::htaccess_diagnostics();
}
/**
* Return the UAIX .htaccess marker name.
*
* @return string
*/
public static function htaccess_marker_name() {
return HtaccessManager::htaccess_marker_name();
}
/**
* Return UAIX .htaccess marker body lines.
*
* @return array
*/
public static function htaccess_marker_body_lines() {
return HtaccessManager::htaccess_marker_body_lines();
}
/**
* Return manual .htaccess block text.
*
* @return string
*/
public static function htaccess_manual_block() {
return HtaccessManager::htaccess_manual_block();
}
/**
* Repair site-root .htaccess marker blocks.
*
* @return array
*/
public static function repair_htaccess_block() {
return HtaccessManager::repair_htaccess_block();
}
/**
* Return localized-home diagnostics.
*
* @param array $status Status snapshot.
* @param bool $force_refresh Whether to bypass cache.
* @return array
*/
public static function localized_home_diagnostics( array $status = array(), $force_refresh = false ) {
return LocalizedHomeDiagnostics::localized_home_diagnostics( $status, $force_refresh );
}
/**
* Return localized-home fix steps.
*
* @return array
*/
public static function localized_home_fix_steps() {
return LocalizedHomeDiagnostics::localized_home_fix_steps();
}
/**
* Run repair tasks for the plugin runtime.
*
* @return array
*/
public static function repair_runtime() {
$completed = array();
$errors = array();
try {
self::ensure_default_options();
$completed[] = 'default options';
} catch ( \Throwable $throwable ) {
$errors[] = 'default options: ' . $throwable->getMessage();