diff --git a/admin/domains-page.php b/admin/domains-page.php index 228322e..8689b95 100644 --- a/admin/domains-page.php +++ b/admin/domains-page.php @@ -335,7 +335,7 @@ function dm_domain_listing( $rows ) {
' + + response.data.message + '
' + + response.data.message + '
+ +
+ + ' . __( 'No domains to check.', 'wp-domain-mapping' ) . ''; + return; + } + + $all_healthy = true; + $issues = array(); + + foreach ( $domains as $domain ) { + $health = dm_get_health_result( $domain->domain ); + if ( $health ) { + $domain_issues = array(); + + if ( isset( $health['accessible'] ) && ! $health['accessible'] ) { + $domain_issues[] = __( 'Not accessible', 'wp-domain-mapping' ); + $all_healthy = false; + } + + if ( isset( $health['ssl_valid'] ) && ! $health['ssl_valid'] ) { + $domain_issues[] = __( 'SSL issue', 'wp-domain-mapping' ); + $all_healthy = false; + } + + if ( isset( $health['dns_status'] ) && $health['dns_status'] !== 'success' ) { + $domain_issues[] = __( 'DNS issue', 'wp-domain-mapping' ); + $all_healthy = false; + } + + if ( ! empty( $domain_issues ) ) { + $issues[$domain->domain] = $domain_issues; + } + } + } + + if ( $all_healthy ) { + echo '' . + __( 'All domains are healthy!', 'wp-domain-mapping' ) . '
'; + } else { + echo '' . + sprintf( + __( 'Last checked: %s ago', 'wp-domain-mapping' ), + human_time_diff( $last_check, current_time( 'timestamp' ) ) + ) . '
'; + } + } + + /** + * AJAX刷新小工具状态 + */ + public function ajax_refresh_widget_status() { + check_ajax_referer( 'domain_mapping', 'nonce' ); + + if ( ! current_user_can( 'manage_options' ) ) { + wp_send_json_error( __( 'Permission denied.', 'wp-domain-mapping' ) ); + } + + ob_start(); + $this->render_dashboard_widget(); + $html = ob_get_clean(); + + wp_send_json_success( $html ); + } + + /** + * AJAX快速健康检查 + */ + public function ajax_quick_health_check() { + check_ajax_referer( 'domain_mapping', 'nonce' ); + + if ( ! current_user_can( 'manage_options' ) ) { + wp_send_json_error( __( 'Permission denied.', 'wp-domain-mapping' ) ); + } + + $blog_id = isset( $_POST['blog_id'] ) ? intval( $_POST['blog_id'] ) : get_current_blog_id(); + $domains = dm_get_domains_by_blog_id( $blog_id ); + + if ( empty( $domains ) ) { + wp_send_json_error( __( 'No domains found.', 'wp-domain-mapping' ) ); + } + + // 执行健康检查 + $tools = WP_Domain_Mapping_Tools::get_instance(); + foreach ( $domains as $domain ) { + $result = $tools->check_domain_health( $domain->domain ); + dm_save_health_result( $domain->domain, $result ); + } + + // 更新最后检查时间 + update_site_option( 'dm_widget_last_health_check_' . $blog_id, current_time( 'timestamp' ) ); + + // 返回更新后的健康状态HTML + ob_start(); + $this->render_widget_health_status( $domains ); + $html = ob_get_clean(); + + wp_send_json_success( array( + 'html' => $html, + 'message' => __( 'Health check completed.', 'wp-domain-mapping' ) + )); + } + + /** + * 检查域名SSL状态 + */ + private function check_domain_ssl( $domain ) { + $health_result = dm_get_health_result( $domain ); + return $health_result && isset( $health_result['ssl_valid'] ) && $health_result['ssl_valid']; + } + + /** + * 获取域名健康问题 + */ + private function get_domain_health_issues( $blog_id ) { + $domains = dm_get_domains_by_blog_id( $blog_id ); + $issues = array(); + + foreach ( $domains as $domain ) { + $health_result = dm_get_health_result( $domain->domain ); + if ( $health_result ) { + if ( ! $health_result['accessible'] || ! $health_result['ssl_valid'] || $health_result['dns_status'] !== 'success' ) { + $issues[] = $domain->domain; + } + } + } + + return $issues; + } + /** * Enqueue admin scripts and styles */ @@ -171,6 +749,8 @@ class WP_Domain_Mapping_Admin { 'processing' => __( 'Processing...', 'wp-domain-mapping' ), 'error' => __( 'An error occurred.', 'wp-domain-mapping' ), 'noSelection' => __( 'Please select at least one domain.', 'wp-domain-mapping' ), + 'invalidDomain' => __( 'Invalid domain format.', 'wp-domain-mapping' ), + 'checking' => __( 'Checking...', 'wp-domain-mapping' ), // 新增 ) )); } @@ -243,6 +823,7 @@ class WP_Domain_Mapping_Admin { /** * AJAX handler for domain actions + * UPDATED: Support editing domain names and better conflict checking */ public function ajax_handle_actions() { check_ajax_referer( 'domain_mapping', 'nonce' ); @@ -268,69 +849,110 @@ class WP_Domain_Mapping_Admin { wp_send_json_error( __( 'Invalid domain format.', 'wp-domain-mapping' ) ); } - // Check if domain exists for another blog - $exists = $wpdb->get_var( $wpdb->prepare( - "SELECT domain FROM {$this->tables['domains']} WHERE blog_id != %d AND domain = %s", - $blog_id, $domain - )); + // For editing, check if domain changed + $domain_changed = ! empty( $orig_domain ) && $orig_domain !== $domain; - if ( null == $exists ) { - $wpdb->query( 'START TRANSACTION' ); + if ( $domain_changed || empty( $orig_domain ) ) { + // Check if domain exists for another blog + $exists = dm_domain_exists_for_another_blog( $domain, $blog_id ); - try { - if ( empty( $orig_domain ) ) { - // Insert new domain - $success = $wpdb->insert( - $this->tables['domains'], - array( - 'blog_id' => $blog_id, - 'domain' => $domain, - 'active' => $active - ), - array( '%d', '%s', '%d' ) - ); - - if ( $success ) { - // Log the action - dm_log_action( 'add', $domain, $blog_id, $current_user_id ); - - $wpdb->query( 'COMMIT' ); - wp_send_json_success( __( 'Domain added successfully.', 'wp-domain-mapping' ) ); - } else { - $wpdb->query( 'ROLLBACK' ); - wp_send_json_error( __( 'Failed to add domain.', 'wp-domain-mapping' ) ); - } - } else { - // Update existing domain - $success = $wpdb->update( - $this->tables['domains'], - array( - 'blog_id' => $blog_id, - 'domain' => $domain, - 'active' => $active - ), - array( 'domain' => $orig_domain ), - array( '%d', '%s', '%d' ), - array( '%s' ) - ); - - if ( $success !== false ) { - // Log the action - dm_log_action( 'edit', $domain, $blog_id, $current_user_id ); - - $wpdb->query( 'COMMIT' ); - wp_send_json_success( __( 'Domain updated successfully.', 'wp-domain-mapping' ) ); - } else { - $wpdb->query( 'ROLLBACK' ); - wp_send_json_error( __( 'No changes were made or update failed.', 'wp-domain-mapping' ) ); - } - } - } catch ( Exception $e ) { - $wpdb->query( 'ROLLBACK' ); - wp_send_json_error( __( 'An error occurred while saving domain.', 'wp-domain-mapping' ) ); + if ( $exists ) { + wp_send_json_error( sprintf( + __( 'Domain %s is already mapped to site ID %d.', 'wp-domain-mapping' ), + $domain, + $exists->blog_id + )); } - } else { - wp_send_json_error( __( 'Domain already exists for another site.', 'wp-domain-mapping' ) ); + } + + $wpdb->query( 'START TRANSACTION' ); + + try { + if ( empty( $orig_domain ) ) { + // Insert new domain + $success = $wpdb->insert( + $this->tables['domains'], + array( + 'blog_id' => $blog_id, + 'domain' => $domain, + 'active' => $active + ), + array( '%d', '%s', '%d' ) + ); + + if ( $success ) { + // If setting as primary, reset other domains + if ( $active ) { + $wpdb->update( + $this->tables['domains'], + array( 'active' => 0 ), + array( + 'blog_id' => $blog_id, + 'domain !=' => $domain + ), + array( '%d' ), + array( '%d', '%s' ) + ); + } + + // Log the action + dm_log_action( 'add', $domain, $blog_id, $current_user_id ); + + $wpdb->query( 'COMMIT' ); + wp_send_json_success( __( 'Domain added successfully.', 'wp-domain-mapping' ) ); + } else { + $wpdb->query( 'ROLLBACK' ); + wp_send_json_error( __( 'Failed to add domain.', 'wp-domain-mapping' ) ); + } + } else { + // Update existing domain + + // Prepare update data + $update_data = array( + 'blog_id' => $blog_id, + 'active' => $active + ); + $update_format = array( '%d', '%d' ); + + // If domain changed, update it + if ( $domain_changed ) { + $update_data['domain'] = $domain; + $update_format[] = '%s'; + } + + // If setting as primary, reset other domains first + if ( $active ) { + $wpdb->update( + $this->tables['domains'], + array( 'active' => 0 ), + array( 'blog_id' => $blog_id ), + array( '%d' ), + array( '%d' ) + ); + } + + $success = $wpdb->update( + $this->tables['domains'], + $update_data, + array( 'domain' => $orig_domain ), + $update_format, + array( '%s' ) + ); + + if ( $success !== false ) { + // Log the action + dm_log_action( 'edit', $domain, $blog_id, $current_user_id ); + + $wpdb->query( 'COMMIT' ); + wp_send_json_success( __( 'Domain updated successfully.', 'wp-domain-mapping' ) ); + } else { + $wpdb->query( 'ROLLBACK' ); + wp_send_json_error( __( 'No changes were made or update failed.', 'wp-domain-mapping' ) ); + } + } + } catch ( Exception $e ) { + $wpdb->query( 'ROLLBACK' ); + wp_send_json_error( __( 'An error occurred while saving domain.', 'wp-domain-mapping' ) ); } } else { wp_send_json_error( __( 'Invalid site ID.', 'wp-domain-mapping' ) ); @@ -399,14 +1021,16 @@ class WP_Domain_Mapping_Admin { /** * Handle user domain mapping actions + * UPDATED: Support www prefix and better domain validation */ public function handle_user_domain_actions() { global $wpdb, $parent_file; $url = add_query_arg( array( 'page' => 'domainmapping' ), admin_url( $parent_file ) ); + // 处理 POST 请求(添加域名) if ( ! empty( $_POST['action'] ) ) { - $domain = isset( $_POST['domain'] ) ? sanitize_text_field( $_POST['domain'] ) : ''; + $domain = isset( $_POST['domain'] ) ? dm_clean_domain( sanitize_text_field( $_POST['domain'] ) ) : ''; if ( empty( $domain ) ) { wp_die( esc_html__( "You must enter a domain", 'wp-domain-mapping' ) ); @@ -425,46 +1049,82 @@ class WP_Domain_Mapping_Admin { wp_die( esc_html__( "Invalid domain format", 'wp-domain-mapping' ) ); } - // Check if domain already exists - $domain_exists = $wpdb->get_row( $wpdb->prepare( - "SELECT blog_id FROM {$wpdb->blogs} WHERE domain = %s OR (SELECT blog_id FROM {$this->tables['domains']} WHERE domain = %s)", - $domain, $domain + // Check if domain already exists for any blog + $domain_exists = dm_get_domain_by_name( $domain ); + + // Also check if it exists in the blogs table + $blog_exists = $wpdb->get_row( $wpdb->prepare( + "SELECT blog_id FROM {$wpdb->blogs} WHERE domain = %s", + $domain )); - if ( null == $domain_exists ) { - // If primary, reset other domains to not primary - if ( isset( $_POST['primary'] ) && $_POST['primary'] ) { - $wpdb->update( - $this->tables['domains'], - array( 'active' => 0 ), - array( 'blog_id' => $wpdb->blogid ), - array( '%d' ), - array( '%d' ) - ); + if ( $domain_exists || $blog_exists ) { + // Check if it's for the current blog + if ( $domain_exists && $domain_exists->blog_id == $wpdb->blogid ) { + wp_redirect( add_query_arg( array( 'updated' => 'exists' ), $url ) ); + exit; + } else { + wp_die( sprintf( + esc_html__( "Domain '%s' is already mapped to another site.", 'wp-domain-mapping' ), + esc_html( $domain ) + )); } - - // Insert new domain - $wpdb->insert( - $this->tables['domains'], - array( - 'blog_id' => $wpdb->blogid, - 'domain' => $domain, - 'active' => isset( $_POST['primary'] ) ? 1 : 0 - ), - array( '%d', '%s', '%d' ) - ); - - wp_redirect( add_query_arg( array( 'updated' => 'add' ), $url ) ); - exit; - } else { - wp_redirect( add_query_arg( array( 'updated' => 'exists' ), $url ) ); - exit; } - break; - case "primary": + // If primary, reset other domains to not primary + if ( isset( $_POST['primary'] ) && $_POST['primary'] ) { + $wpdb->update( + $this->tables['domains'], + array( 'active' => 0 ), + array( 'blog_id' => $wpdb->blogid ), + array( '%d' ), + array( '%d' ) + ); + } + + // Insert new domain + $wpdb->insert( + $this->tables['domains'], + array( + 'blog_id' => $wpdb->blogid, + 'domain' => $domain, + 'active' => isset( $_POST['primary'] ) ? 1 : 0 + ), + array( '%d', '%s', '%d' ) + ); + + // 记录日志 + dm_log_action( 'add', $domain, $wpdb->blogid ); + + // 清除缓存 + dm_clear_domain_cache( $wpdb->blogid ); + + wp_redirect( add_query_arg( array( 'updated' => 'add' ), $url ) ); + exit; + break; + } + } + // 处理 GET 请求(删除和设为主域名) + elseif ( isset( $_GET['action'] ) ) { + $action = sanitize_text_field( $_GET['action'] ); + $domain = isset( $_GET['domain'] ) ? sanitize_text_field( $_GET['domain'] ) : ''; + + if ( empty( $domain ) ) { + wp_die( esc_html__( "You must enter a domain", 'wp-domain-mapping' ) ); + } + + switch ( $action ) { + case 'primary': + check_admin_referer( 'domain_mapping' ); + do_action( 'dm_handle_actions_primary', $domain ); + // Verify domain belongs to current blog + $domain_info = dm_get_domain_by_name( $domain ); + if ( ! $domain_info || $domain_info->blog_id != $wpdb->blogid ) { + wp_die( esc_html__( "Domain not found or does not belong to this site.", 'wp-domain-mapping' ) ); + } + // Reset all domains to not primary $wpdb->update( $this->tables['domains'], @@ -492,30 +1152,52 @@ class WP_Domain_Mapping_Admin { ); } + // 记录日志 + dm_log_action( 'edit', $domain, $wpdb->blogid ); + + // 清除缓存 + dm_clear_domain_cache( $wpdb->blogid ); + wp_redirect( add_query_arg( array( 'updated' => 'primary' ), $url ) ); exit; break; + + case 'delete': + check_admin_referer( "delete" . $domain ); + + do_action( 'dm_handle_actions_del', $domain ); + + // Verify domain belongs to current blog + $domain_info = dm_get_domain_by_name( $domain ); + if ( ! $domain_info || $domain_info->blog_id != $wpdb->blogid ) { + wp_die( esc_html__( "Domain not found or does not belong to this site.", 'wp-domain-mapping' ) ); + } + + // Don't allow deleting primary domain + if ( $domain_info->active == 1 ) { + wp_die( esc_html__( "Cannot delete the primary domain. Please set another domain as primary first.", 'wp-domain-mapping' ) ); + } + + // Delete the domain + $wpdb->delete( + $this->tables['domains'], + array( + 'domain' => $domain, + 'blog_id' => $wpdb->blogid + ), + array( '%s', '%d' ) + ); + + // 记录日志 + dm_log_action( 'delete', $domain, $wpdb->blogid ); + + // 清除缓存 + dm_clear_domain_cache( $wpdb->blogid ); + + wp_redirect( add_query_arg( array( 'updated' => 'del' ), $url ) ); + exit; + break; } - } elseif ( isset( $_GET['action'] ) && $_GET['action'] == 'delete' ) { - $domain = sanitize_text_field( $_GET['domain'] ); - - if ( empty( $domain ) ) { - wp_die( esc_html__( "You must enter a domain", 'wp-domain-mapping' ) ); - } - - check_admin_referer( "delete" . $_GET['domain'] ); - - do_action( 'dm_handle_actions_del', $domain ); - - // Delete the domain - $wpdb->delete( - $this->tables['domains'], - array( 'domain' => $domain ), - array( '%s' ) - ); - - wp_redirect( add_query_arg( array( 'updated' => 'del' ), $url ) ); - exit; } } @@ -710,7 +1392,7 @@ class WP_Domain_Mapping_Admin { /** * Default updated messages */ - public function echo_default_updated_msg() { + public static function echo_default_updated_msg() { if ( ! isset( $_GET['updated'] ) ) { return; } diff --git a/includes/class-core.php b/includes/class-core.php index 10e1c4e..298fe3d 100644 --- a/includes/class-core.php +++ b/includes/class-core.php @@ -449,7 +449,7 @@ class WP_Domain_Mapping_Core { $protocol = is_ssl() ? 'https://' : 'http://'; $hash = $this->get_hash(); - $key = md5( time() ); + $key = wp_generate_password(32, true, true); $wpdb->insert( $this->tables['logins'], @@ -475,6 +475,10 @@ class WP_Domain_Mapping_Core { public function remote_login_js() { global $current_blog, $current_user, $wpdb; + if (strtotime($details->t) < (time() - 300)) { + wp_die(__('Login key expired', 'wp-domain-mapping')); + } + if ( 0 == get_site_option( 'dm_remote_login' ) ) { return; } diff --git a/includes/class-tools.php b/includes/class-tools.php index 49b7106..c37d1f0 100644 --- a/includes/class-tools.php +++ b/includes/class-tools.php @@ -585,7 +585,7 @@ class WP_Domain_Mapping_Tools { * @param string $domain Domain to check * @return array Health check result */ - private function check_domain_health( $domain ) { + public function check_domain_health( $domain ) { $result = array( 'domain' => $domain, 'last_check' => current_time( 'mysql' ), @@ -899,6 +899,12 @@ class WP_Domain_Mapping_Tools { wp_send_json_error( __( 'Invalid security token. Please try again.', 'wp-domain-mapping' ) ); } + // 在处理文件之前添加: + if ($_FILES['csv_file']['size'] > 5 * 1024 * 1024) { + wp_send_json_error(__('File size exceeds 5MB limit.', 'wp-domain-mapping')); + return; + } + // Check file if ( ! isset( $_FILES['csv_file'] ) || $_FILES['csv_file']['error'] != UPLOAD_ERR_OK ) { wp_send_json_error( __( 'No file uploaded or upload error.', 'wp-domain-mapping' ) ); @@ -909,6 +915,13 @@ class WP_Domain_Mapping_Tools { $update_existing = isset( $_POST['update_existing'] ) ? (bool) $_POST['update_existing'] : false; $validate_sites = isset( $_POST['validate_sites'] ) ? (bool) $_POST['validate_sites'] : true; + // 验证文件类型 + $file_type = wp_check_filetype($_FILES['csv_file']['name']); + if (!in_array($file_type['ext'], array('csv', 'txt'))) { + wp_send_json_error(__('Only CSV files are allowed.', 'wp-domain-mapping')); + return; + } + // Open file $file = fopen( $_FILES['csv_file']['tmp_name'], 'r' ); if ( ! $file ) { diff --git a/includes/functions.php b/includes/functions.php index 93698da..63b91e3 100644 --- a/includes/functions.php +++ b/includes/functions.php @@ -25,6 +25,7 @@ function dm_ensure_protocol( $domain ) { /** * Clean domain name (remove protocol and trailing slash) + * UPDATED: Keep www prefix to distinguish www.domain.com from domain.com * * @param string $domain Domain name * @return string Cleaned domain @@ -36,6 +37,14 @@ function dm_clean_domain( $domain ) { // Remove trailing slash $domain = rtrim( $domain, '/' ); + // Remove path if exists + if ( strpos( $domain, '/' ) !== false ) { + $domain = substr( $domain, 0, strpos( $domain, '/' ) ); + } + + // Convert to lowercase for consistency + $domain = strtolower( $domain ); + // Convert IDN to ASCII (Punycode) if ( function_exists( 'idn_to_ascii' ) && preg_match( '/[^a-z0-9\-\.]/i', $domain ) ) { if (defined('INTL_IDNA_VARIANT_UTS46')) { @@ -52,13 +61,29 @@ function dm_clean_domain( $domain ) { /** * Validate a domain name + * UPDATED: Accept www prefix as valid * * @param string $domain The domain * @return bool True if valid */ function dm_validate_domain( $domain ) { - // Basic validation - return (bool) preg_match( '/^[a-z0-9]+([\-\.]{1}[a-z0-9]+)*\.[a-z]{2,}$/i', $domain ); + // Basic validation - now accepts www prefix + return (bool) preg_match( '/^(www\.)?[a-z0-9]+([\-\.]{1}[a-z0-9]+)*\.[a-z]{2,}$/i', $domain ); +} + +/** + * Check if two domains are the same (ignoring www prefix) + * + * @param string $domain1 First domain + * @param string $domain2 Second domain + * @return bool True if domains are essentially the same + */ +function dm_domains_are_equivalent( $domain1, $domain2 ) { + // Remove www. prefix for comparison + $clean1 = preg_replace( '/^www\./i', '', $domain1 ); + $clean2 = preg_replace( '/^www\./i', '', $domain2 ); + + return strcasecmp( $clean1, $clean2 ) === 0; } /** @@ -147,6 +172,30 @@ function dm_get_domain_by_name( $domain ) { )); } +/** + * Check if domain exists for another blog + * UPDATED: More precise checking for domain conflicts + * + * @param string $domain Domain name + * @param int $exclude_blog_id Blog ID to exclude from check (optional) + * @return object|null Domain object if exists for another blog, null otherwise + */ +function dm_domain_exists_for_another_blog( $domain, $exclude_blog_id = 0 ) { + global $wpdb; + + $tables = dm_get_table_names(); + + $query = "SELECT * FROM {$tables['domains']} WHERE domain = %s"; + $params = array( $domain ); + + if ( $exclude_blog_id > 0 ) { + $query .= " AND blog_id != %d"; + $params[] = $exclude_blog_id; + } + + return $wpdb->get_row( $wpdb->prepare( $query, $params ) ); +} + /** * Get domains by blog ID * @@ -212,6 +261,7 @@ function dm_add_domain( $blog_id, $domain, $active = 0 ) { if ( $result ) { dm_log_action( 'add', $domain, $blog_id ); + dm_clear_domain_cache( $blog_id ); return $wpdb->insert_id; } @@ -220,17 +270,35 @@ function dm_add_domain( $blog_id, $domain, $active = 0 ) { /** * Update domain mapping + * UPDATED: Support changing domain name and blog_id * - * @param string $domain Domain name + * @param string $domain Domain name (current) * @param int $blog_id Blog ID * @param int $active Whether domain is primary (1) or not (0) + * @param string $new_domain New domain name (optional) * @return bool True on success, false on failure */ -function dm_update_domain( $domain, $blog_id, $active ) { +function dm_update_domain( $domain, $blog_id, $active, $new_domain = null ) { global $wpdb; $tables = dm_get_table_names(); + // If changing domain name + if ( $new_domain && $new_domain !== $domain ) { + $new_domain = dm_clean_domain( $new_domain ); + + // Validate new domain + if ( ! dm_validate_domain( $new_domain ) ) { + return false; + } + + // Check if new domain exists for another blog + $existing = dm_domain_exists_for_another_blog( $new_domain, $blog_id ); + if ( $existing ) { + return false; + } + } + // If setting as primary, reset other domains if ( $active ) { $wpdb->update( @@ -242,17 +310,30 @@ function dm_update_domain( $domain, $blog_id, $active ) { ); } + // Prepare update data + $data = array( + 'active' => $active, + 'blog_id' => $blog_id + ); + $data_format = array( '%d', '%d' ); + + if ( $new_domain && $new_domain !== $domain ) { + $data['domain'] = $new_domain; + $data_format[] = '%s'; + } + // Update domain $result = $wpdb->update( $tables['domains'], - array( 'active' => $active ), + $data, array( 'domain' => $domain ), - array( '%d' ), + $data_format, array( '%s' ) ); if ( $result !== false ) { - dm_log_action( 'edit', $domain, $blog_id ); + dm_log_action( 'edit', $new_domain ?: $domain, $blog_id ); + dm_clear_domain_cache( $blog_id ); return true; } @@ -286,6 +367,7 @@ function dm_delete_domain( $domain ) { if ( $result ) { dm_log_action( 'delete', $domain, $domain_info->blog_id ); + dm_clear_domain_cache( $domain_info->blog_id ); return true; } @@ -319,6 +401,27 @@ function dm_get_health_result( $domain ) { return isset( $health_results[$domain_key] ) ? $health_results[$domain_key] : null; } +/** + * Check if domain has all health checks passing + * + * @param string $domain Domain name + * @return bool True if all health checks pass + */ +function dm_is_domain_healthy( $domain ) { + $health_result = dm_get_health_result( $domain ); + + if ( ! $health_result ) { + return false; + } + + // Check all three criteria: DNS, SSL, and Accessibility + $dns_ok = isset( $health_result['dns_status'] ) && $health_result['dns_status'] === 'success'; + $ssl_ok = isset( $health_result['ssl_valid'] ) && $health_result['ssl_valid'] === true; + $accessible_ok = isset( $health_result['accessible'] ) && $health_result['accessible'] === true; + + return $dns_ok && $ssl_ok && $accessible_ok; +} + /** * Format action name for display * @@ -339,3 +442,21 @@ function dm_format_action_name( $action ) { return ucfirst( $action ); } } + +// Cache functions +function dm_get_domains_by_blog_id_cached($blog_id) { + $cache_key = 'dm_domains_' . $blog_id; + $domains = wp_cache_get($cache_key, 'domain_mapping'); + + if (false === $domains) { + $domains = dm_get_domains_by_blog_id($blog_id); + wp_cache_set($cache_key, $domains, 'domain_mapping', HOUR_IN_SECONDS); + } + + return $domains; +} + +// Clear cache function +function dm_clear_domain_cache($blog_id) { + wp_cache_delete('dm_domains_' . $blog_id, 'domain_mapping'); +} diff --git a/languages/wp-domain-mapping-zh_CN.l10n.php b/languages/wp-domain-mapping-zh_CN.l10n.php new file mode 100644 index 0000000..40c5b01 --- /dev/null +++ b/languages/wp-domain-mapping-zh_CN.l10n.php @@ -0,0 +1,3 @@ +NULL,'plural-forms'=>'nplurals=1; plural=0;','language'=>'zh_CN','pot-creation-date'=>'2025-05-24 12:42+0800','po-revision-date'=>'2025-05-24 13:09+0800','translation-revision-date'=>'2025-05-24 13:09+0800','project-id-version'=>'WP Domain Mapping','x-generator'=>'Poedit 3.6','messages'=>['Version: %s'=>'版本:%s','Document'=>'文档','Support'=>'支持','Edit Domain'=>'编辑域名','Add New Domain'=>'添加新域名','Site ID'=>'站点 ID','Domain'=>'域名','Enter the domain without http:// or https:// (e.g., example.com)'=>'输入不带 http:// 或 https:// 的域名(例如 example.com)','Primary'=>'主域名','Update Domain'=>'更新域名','Add Domain'=>'添加域名','Search & Filter Domains'=>'搜索和过滤域名','Domain:'=>'域名:','Site ID:'=>'站点 ID:','Primary:'=>'主域:','All'=>'全部','Yes'=>'是','No'=>'否','Filter'=>'筛选','Manage Domains'=>'管理域名','Domain Logs'=>'域名日志','«'=>'«','»'=>'»','%s item'=>'%s 项','Note: %s'=>'注意: %s','Domain Statistics'=>'域名统计','Total Domains'=>'域名总数','Primary Domains'=>'主域','No domains found.'=>'未找到域名。','Select bulk action'=>'选择批量操作','Bulk Actions'=>'批量操作','Delete'=>'删除','Apply'=>'应用','Site Name'=>'站点名称','Actions'=>'操作','Edit'=>'编辑','User'=>'用户','Action'=>'操作','Site'=>'站点','Site #%d'=>'站点 #%d','Domain Health'=>'域名健康','Server Configuration'=>'服务器配置','Configure the IP address or CNAME for domain mapping.'=>'配置域映射的IP地址或CNAME。','Server IP Address:'=>'服务器 IP 地址:','Enter the IP address(es) users should point their DNS A records to. Use commas to separate multiple IPs.'=>'输入用户应将其 DNS A 记录指向的 IP 地址。使用逗号分隔多个 IP。','Server CNAME Domain:'=>'服务器 CNAME 域名:','Use a CNAME instead of an IP (overrides IP settings). %s'=>'使用 CNAME 而不是 IP(覆盖 IP 设置)。%s','Domain Options'=>'域名选项','Enable Remote Login'=>'启用远程登录','Enable User Domain Mapping Page'=>'启用用户域映射页面','Redirect Admin Pages to Original Domain'=>'将管理页面重定向到原始域','Disable Primary Domain Check'=>'禁用主域检查','Save Configuration'=>'保存配置','Domain Health Status'=>'域名健康状态','Processed '=>'正在处理','domains'=>'域名','%s domain'=>'%s 域名','No domains found'=>'未找到域名','DNS Status'=>'DNS 状态','SSL Status'=>'SSL 状态','Reachable'=>'可达','Last Check'=>'最后检测','Primary Domain'=>'主域','Checking...'=>'检查中...','Export Domain Mappings'=>'导出域名映射','Import Domain Mappings'=>'导入域名映射','Domain added successfully.'=>'域名添加成功。','Domain Mapping'=>'域名映射','Invalid'=>'无效','The domain mapping plugin only works if the site is installed in /. This is a limitation of how virtual servers work and is very difficult to work around.'=>'域映射插件只能在站点是安装位于根目录时才有效。这是虚拟服务器工作方式的限制,很难解决。','Domains'=>'域名','Saving...'=>'正在保存...','Processing...'=>'正在处理…','Please select at least one domain.'=>'请至少选择一个域名。','This plugin has not been configured correctly yet.'=>'该插件尚未正确配置。','Please uncomment the line define( \'SUNRISE\', \'on\' ); or add it to your %swp-config.php'=>'请取消注释行 define( \'SUNRISE\', \'on\' ); 或将其添加到您的 %swp-config.php','Please edit your %swp-config.php and move the line define( \'SUNRISE\', \'on\' ); above the last require_once() in that file or make sure you updated sunrise.php.'=>'请编辑你的 %swp-config.php 和移动行define( \'SUNRISE\', \'on\' );上面最后一次()需要在文件或确保您sunrise.php更新。','Domain Mapping Disabled.'=>'域映射已禁用。','You must create a network for it to work.'=>'您必须创建网络才能使其正常工作。','Permission denied.'=>'没有权限。','Domain updated successfully.'=>'域名更新成功。','Invalid action.'=>'无效操作。','You must enter a domain'=>'您必须输入一个域名','Please set the IP address or CNAME of your server in the site admin page.'=>'请在站点管理页面中设置您服务器的 IP 地址或 CNAME。','Mapping'=>'映射','New domain added.'=>'已添加新域名。','New domain already exists.'=>'新的域名已经存在。','New primary domain.'=>'新的主域名。','Domain deleted.'=>'域名已删除。','Incorrect or out of date login key'=>'登录密钥不正确或过期','Unknown login key'=>'未知的登录密钥','Unknown logout key'=>'未知的退出密钥','Site ID: %d'=>'站点 ID:%d','Domain: %s'=>'域名: %s','International Domain Names should be in punycode format.'=>'国际域名应采用punycode格式。','WP Domain Mapping'=>'文派域名映射','https://wenpai.org/plugins/wp-domain-mapping/'=>'https://wenpai.org/plugins/wp-domain-mapping/','Map any site on a WordPress website to another domain with enhanced management features.'=>'使用增强的管理功能将 WordPress 网站上的任何站点映射到另一个域名。','WPDomain.com'=>'WPDomain.com','https://wpdomain.com/'=>'https://wpdomain.com/']]; diff --git a/languages/wp-domain-mapping-zh_CN.mo b/languages/wp-domain-mapping-zh_CN.mo index b9941bf..5e00556 100644 Binary files a/languages/wp-domain-mapping-zh_CN.mo and b/languages/wp-domain-mapping-zh_CN.mo differ diff --git a/languages/wp-domain-mapping-zh_CN.po b/languages/wp-domain-mapping-zh_CN.po index 353fd7f..a8b77b2 100644 --- a/languages/wp-domain-mapping-zh_CN.po +++ b/languages/wp-domain-mapping-zh_CN.po @@ -1,10 +1,8 @@ -# Translation of WP Domain Mapping in Chinese (China) -# This file is distributed under the same license as the WP Domain Mapping package. msgid "" msgstr "" "Project-Id-Version: WP Domain Mapping\n" -"POT-Creation-Date: \n" -"PO-Revision-Date: 2025-03-21 11:00+0800\n" +"POT-Creation-Date: 2025-05-24 12:42+0800\n" +"PO-Revision-Date: 2025-05-24 13:09+0800\n" "Last-Translator: \n" "Language-Team: \n" "Language: zh_CN\n" @@ -12,391 +10,1482 @@ msgstr "" "Content-Type: text/plain; charset=UTF-8\n" "Content-Transfer-Encoding: 8bit\n" "Plural-Forms: nplurals=1; plural=0;\n" -"X-Generator: Poedit 3.5\n" +"X-Generator: Poedit 3.6\n" +"X-Poedit-Basepath: ..\n" +"X-Poedit-Flags-xgettext: --add-comments=translators:\n" +"X-Poedit-WPHeader: wp-domain-mapping.php\n" +"X-Poedit-SourceCharset: UTF-8\n" +"X-Poedit-KeywordsList: " +"__;_e;_n:1,2;_x:1,2c;_ex:1,2c;_nx:4c,1,2;esc_attr__;esc_attr_e;esc_attr_x:1,2c;esc_html__;esc_html_e;esc_html_x:1,2c;_n_noop:1,2;_nx_noop:3c,1,2;__ngettext_noop:1,2\n" +"X-Poedit-SearchPath-0: .\n" +"X-Poedit-SearchPathExcluded-0: *.min.js\n" -#. Author URI of the plugin/theme -msgid "https://wpdomain.com/" -msgstr "https://wpdomain.com/" +#: admin/domains-page.php:18 admin/pages.php:21 admin/settings-page.php:39 +#, php-format +msgid "Version: %s" +msgstr "版本:%s" -#. Author of the plugin/theme -msgid "WPDomain.com" -msgstr "WPDomain.com" +#: admin/domains-page.php:21 admin/pages.php:24 admin/settings-page.php:42 +msgid "Document" +msgstr "文档" -#. Description of the plugin/theme -msgid "Map any site on a WordPress website to another domain with enhanced management features." -msgstr "使用增强的管理功能将 WordPress 网站上的任何站点映射到另一个域名。" +#: admin/domains-page.php:24 admin/pages.php:27 admin/settings-page.php:45 +msgid "Support" +msgstr "支持" -#. Plugin URI of the plugin/theme -msgid "https://wenpai.org/plugins/wp-domain-mapping/" -msgstr "https://wenpai.org/plugins/wp-domain-mapping/" +#: admin/domains-page.php:29 +msgid "Edit Domain" +msgstr "编辑域名" + +#: admin/domains-page.php:29 admin/templates.php:386 admin/user-page.php:43 +msgid "Add New Domain" +msgstr "添加新域名" + +#: admin/domains-page.php:36 admin/domains-page.php:307 +#: includes/class-tools.php:145 +msgid "Site ID" +msgstr "站点 ID" + +#: admin/domains-page.php:46 +#, php-format +msgid "" +"Not sure about Site ID? View all sites " +"to find the ID." +msgstr "" + +#: admin/domains-page.php:57 admin/domains-page.php:309 admin/logs-table.php:73 +#: admin/pages.php:646 admin/templates.php:393 admin/templates.php:429 +#: admin/templates.php:578 admin/user-page.php:50 admin/user-page.php:86 +msgid "Domain" +msgstr "域名" + +#: admin/domains-page.php:62 admin/templates.php:398 admin/user-page.php:55 +msgid "Enter the domain without http:// or https:// (e.g., example.com)" +msgstr "输入不带 http:// 或 https:// 的域名(例如 example.com)" + +#: admin/domains-page.php:67 admin/domains-page.php:310 admin/templates.php:430 +#: admin/user-page.php:87 +msgid "Primary" +msgstr "主域名" + +#: admin/domains-page.php:71 +msgid "Set as the primary domain for this site" +msgstr "" + +#: admin/domains-page.php:78 admin/domains-page.php:368 +msgid "Warning! Primary domains are currently disabled in network settings." +msgstr "" + +#: admin/domains-page.php:85 +msgid "Update Domain" +msgstr "更新域名" + +#: admin/domains-page.php:86 admin/templates.php:417 admin/user-page.php:74 +msgid "Add Domain" +msgstr "添加域名" + +#: admin/domains-page.php:90 +msgid "Cancel" +msgstr "" + +#: admin/domains-page.php:98 +msgid "Search & Filter Domains" +msgstr "搜索和过滤域名" + +#: admin/domains-page.php:103 +msgid "Domain:" +msgstr "域名:" + +#: admin/domains-page.php:108 +msgid "Site ID:" +msgstr "站点 ID:" + +#: admin/domains-page.php:113 +msgid "Primary:" +msgstr "主域:" + +#: admin/domains-page.php:115 +msgid "All" +msgstr "全部" + +#: admin/domains-page.php:117 admin/domains-page.php:339 +#: admin/templates.php:446 admin/user-page.php:103 +msgid "Yes" +msgstr "是" + +#: admin/domains-page.php:120 admin/domains-page.php:342 +msgid "No" +msgstr "否" + +#: admin/domains-page.php:126 admin/logs-table.php:31 +msgid "Filter" +msgstr "筛选" + +#: admin/domains-page.php:129 admin/logs-table.php:35 +msgid "Clear" +msgstr "" + +#: admin/domains-page.php:140 admin/pages.php:274 admin/settings-page.php:175 +#: admin/templates.php:73 +msgid "Manage Domains" +msgstr "管理域名" + +#: admin/domains-page.php:143 +msgid "Domain Logs" +msgstr "域名日志" + +#: admin/domains-page.php:205 admin/logs-table.php:47 admin/logs-table.php:144 +msgid "«" +msgstr "«" + +#: admin/domains-page.php:206 admin/logs-table.php:48 admin/logs-table.php:145 +msgid "»" +msgstr "»" + +#. translators: %s: number of items +#: admin/domains-page.php:217 +#, php-format +msgid "%s item" +msgid_plural "%s items" +msgstr[0] "%s 项" + +#. translators: %s: IDN warning message +#: admin/domains-page.php:230 +#, php-format +msgid "Note: %s" +msgstr "注意: %s" + +#: admin/domains-page.php:245 +msgid "Domain Statistics" +msgstr "域名统计" + +#: admin/domains-page.php:249 +msgid "Total Domains" +msgstr "域名总数" + +#: admin/domains-page.php:253 +msgid "Primary Domains" +msgstr "主域" + +#: admin/domains-page.php:257 +msgid "Sites with Mapped Domains" +msgstr "" + +#: admin/domains-page.php:280 admin/pages.php:731 admin/templates.php:744 +msgid "No domains found." +msgstr "未找到域名。" + +#: admin/domains-page.php:292 +msgid "Select bulk action" +msgstr "选择批量操作" + +#: admin/domains-page.php:294 +msgid "Bulk Actions" +msgstr "批量操作" + +#: admin/domains-page.php:295 admin/domains-page.php:355 +#: admin/templates.php:462 admin/user-page.php:119 +msgid "Delete" +msgstr "删除" + +#: admin/domains-page.php:297 +msgid "Apply" +msgstr "应用" + +#: admin/domains-page.php:308 +msgid "Site Name" +msgstr "站点名称" + +#: admin/domains-page.php:311 admin/pages.php:652 admin/templates.php:431 +#: admin/templates.php:584 admin/user-page.php:88 +msgid "Actions" +msgstr "操作" + +#: admin/domains-page.php:316 admin/pages.php:660 admin/templates.php:592 +msgid "Unknown" +msgstr "" + +#: admin/domains-page.php:349 +msgid "Edit" +msgstr "编辑" + +#: admin/domains-page.php:385 +msgid "" +"Domain mapping logs table is missing. Please deactivate and reactivate the " +"plugin." +msgstr "" + +#: admin/domains-page.php:421 +msgid "No domain mapping logs available." +msgstr "" + +#: admin/logs-table.php:21 +msgid "Filter by action" +msgstr "" + +#: admin/logs-table.php:23 +msgid "All actions" +msgstr "" + +#. translators: %s: number of items +#: admin/logs-table.php:59 admin/logs-table.php:156 +#, php-format +msgid "%s log entry" +msgid_plural "%s log entries" +msgstr[0] "" + +#: admin/logs-table.php:71 +msgid "User" +msgstr "用户" + +#: admin/logs-table.php:72 +msgid "Action" +msgstr "操作" + +#: admin/logs-table.php:74 admin/pages.php:647 admin/templates.php:579 +msgid "Site" +msgstr "站点" + +#: admin/logs-table.php:75 +msgid "Date" +msgstr "" + +#: admin/logs-table.php:88 +#, php-format +msgid "User #%d" +msgstr "" + +#: admin/logs-table.php:102 +#, php-format +msgid "Site #%d" +msgstr "站点 #%d" + +#. translators: %s: time ago +#: admin/logs-table.php:128 +#, php-format +msgid "%s ago" +msgstr "" + +#: admin/pages.php:38 +msgid "Settings" +msgstr "" + +#: admin/pages.php:39 +msgid "Domain Health" +msgstr "域名健康" + +#: admin/pages.php:40 +msgid "Import/Export" +msgstr "" + +#: admin/pages.php:46 admin/templates.php:535 +msgid "Domain health check completed." +msgstr "" + +#: admin/pages.php:52 +msgid "Domain health check started. The check is running in the background." +msgstr "" + +#: admin/pages.php:58 admin/templates.php:541 includes/class-admin.php:610 +msgid "Settings saved." +msgstr "" + +#: admin/pages.php:67 admin/templates.php:824 +#, php-format +msgid "%d domain mapping imported successfully." +msgid_plural "%d domain mappings imported successfully." +msgstr[0] "" + +#: admin/pages.php:79 admin/templates.php:836 +msgid "Domain mappings exported successfully." +msgstr "" + +#: admin/pages.php:162 admin/settings-page.php:54 +msgid "Server Configuration" +msgstr "服务器配置" + +#: admin/pages.php:163 admin/settings-page.php:55 +msgid "Configure the IP address or CNAME for domain mapping." +msgstr "配置域映射的IP地址或CNAME。" + +#: admin/pages.php:167 admin/settings-page.php:59 +msgid "Server IP Address:" +msgstr "服务器 IP 地址:" + +#: admin/pages.php:171 admin/settings-page.php:63 +msgid "" +"Enter the IP address(es) users should point their DNS A records to. Use " +"commas to separate multiple IPs." +msgstr "输入用户应将其 DNS A 记录指向的 IP 地址。使用逗号分隔多个 IP。" + +#: admin/pages.php:176 admin/settings-page.php:77 +msgid "Server CNAME Domain:" +msgstr "服务器 CNAME 域名:" + +#. translators: %s: IDN warning message +#: admin/pages.php:183 admin/settings-page.php:84 +#, php-format +msgid "Use a CNAME instead of an IP (overrides IP settings). %s" +msgstr "使用 CNAME 而不是 IP(覆盖 IP 设置)。%s" + +#: admin/pages.php:192 admin/pages.php:198 admin/settings-page.php:93 +#: admin/settings-page.php:99 +msgid "Domain Options" +msgstr "域名选项" + +#: admin/pages.php:201 admin/settings-page.php:102 +msgid "Enable Remote Login" +msgstr "启用远程登录" + +#: admin/pages.php:204 admin/settings-page.php:105 +msgid "" +"Allows users to log in from mapped domains and be redirected to the original " +"domain for authentication." +msgstr "" + +#: admin/pages.php:213 admin/settings-page.php:114 admin/templates.php:12 +msgid "Permanent Redirect" +msgstr "" + +#: admin/pages.php:216 admin/settings-page.php:117 admin/templates.php:15 +msgid "Use Permanent Redirect (301)" +msgstr "" + +#: admin/pages.php:219 admin/settings-page.php:120 admin/templates.php:18 +msgid "" +"Use 301 redirects instead of 302 redirects. This is better for SEO but may " +"cause caching issues." +msgstr "" + +#: admin/pages.php:228 admin/settings-page.php:129 admin/templates.php:27 +msgid "User Settings" +msgstr "" + +#: admin/pages.php:231 admin/settings-page.php:132 admin/templates.php:30 +msgid "Enable User Domain Mapping Page" +msgstr "启用用户域映射页面" + +#: admin/pages.php:234 admin/settings-page.php:135 admin/templates.php:33 +msgid "" +"Allow site administrators to manage their domain mappings from the Tools " +"menu." +msgstr "" + +#: admin/pages.php:243 admin/settings-page.php:144 admin/templates.php:42 +msgid "Redirect Admin" +msgstr "" + +#: admin/pages.php:246 admin/settings-page.php:147 admin/templates.php:45 +msgid "Redirect Admin Pages to Original Domain" +msgstr "将管理页面重定向到原始域" + +#: admin/pages.php:249 admin/settings-page.php:150 admin/templates.php:48 +msgid "" +"Force admin pages to use the original WordPress domain instead of the mapped " +"domain." +msgstr "" + +#: admin/pages.php:258 admin/settings-page.php:159 admin/templates.php:57 +msgid "Disable Primary Domain" +msgstr "" + +#: admin/pages.php:261 admin/settings-page.php:162 admin/templates.php:60 +msgid "Disable Primary Domain Check" +msgstr "禁用主域检查" + +#: admin/pages.php:264 admin/settings-page.php:165 admin/templates.php:63 +msgid "" +"Do not redirect to the primary domain, but allow access through any mapped " +"domain." +msgstr "" + +#: admin/pages.php:272 admin/settings-page.php:173 admin/templates.php:71 +msgid "Save Configuration" +msgstr "保存配置" + +#: admin/pages.php:292 admin/settings-page.php:182 admin/templates.php:80 +msgid "DNS Setup Instructions" +msgstr "" + +#: admin/pages.php:296 admin/settings-page.php:186 admin/templates.php:84 +#: admin/templates.php:488 admin/user-page.php:145 +msgid "CNAME Method (Recommended)" +msgstr "" + +#. translators: %s: CNAME value +#: admin/pages.php:301 admin/settings-page.php:191 admin/templates.php:88 +#, php-format +msgid "" +"Tell your users to add a DNS \"CNAME\" record for their domain pointing to: " +"%s" +msgstr "" + +#: admin/pages.php:307 admin/pages.php:339 admin/settings-page.php:197 +#: admin/settings-page.php:229 admin/templates.php:94 admin/templates.php:125 +msgid "Example DNS Record" +msgstr "" + +#: admin/pages.php:311 admin/pages.php:343 admin/settings-page.php:201 +#: admin/settings-page.php:233 admin/templates.php:98 admin/templates.php:129 +msgid "Type" +msgstr "" + +#: admin/pages.php:312 admin/pages.php:344 admin/settings-page.php:202 +#: admin/settings-page.php:234 admin/templates.php:99 admin/templates.php:130 +msgid "Name" +msgstr "" + +#: admin/pages.php:313 admin/pages.php:345 admin/pages.php:396 +#: admin/settings-page.php:203 admin/settings-page.php:235 +#: admin/settings-page.php:287 admin/templates.php:100 admin/templates.php:131 +#: admin/templates.php:183 +msgid "Value" +msgstr "" + +#: admin/pages.php:319 admin/pages.php:355 admin/settings-page.php:209 +#: admin/settings-page.php:245 admin/templates.php:106 admin/templates.php:141 +msgid "(or empty)" +msgstr "" + +#: admin/pages.php:328 admin/settings-page.php:218 admin/templates.php:115 +#: admin/templates.php:493 admin/user-page.php:150 +msgid "A Record Method" +msgstr "" + +#. translators: %s: IP address(es) +#: admin/pages.php:333 admin/settings-page.php:223 admin/templates.php:119 +#, php-format +msgid "" +"Tell your users to add a DNS \"A\" record for their domain pointing to: %s" +msgstr "" + +#: admin/pages.php:367 admin/settings-page.php:257 admin/templates.php:153 +msgid "" +"Please configure either a Server IP Address or CNAME to provide DNS setup " +"instructions." +msgstr "" + +#: admin/pages.php:372 admin/settings-page.php:262 admin/templates.php:158 +msgid "Additional DNS Tips" +msgstr "" + +#: admin/pages.php:374 admin/settings-page.php:265 admin/templates.php:161 +msgid "Most DNS changes take 24-48 hours to fully propagate worldwide." +msgstr "" + +#: admin/pages.php:375 admin/settings-page.php:268 admin/templates.php:164 +msgid "" +"For \"www\" subdomain, create a separate CNAME record with \"www\" as the " +"name pointing to the same value." +msgstr "" + +#: admin/pages.php:376 admin/settings-page.php:271 admin/templates.php:167 +msgid "" +"If you're using Cloudflare or similar services, you may need to adjust proxy " +"settings." +msgstr "" + +#: admin/pages.php:377 admin/settings-page.php:274 admin/templates.php:170 +msgid "" +"For SSL to work properly, make sure your web server is configured with the " +"appropriate SSL certificates for mapped domains." +msgstr "" + +#: admin/pages.php:390 admin/settings-page.php:281 admin/templates.php:177 +msgid "Installation Check" +msgstr "" + +#: admin/pages.php:394 admin/settings-page.php:285 admin/templates.php:181 +msgid "Status" +msgstr "" + +#: admin/pages.php:395 admin/settings-page.php:286 admin/templates.php:182 +msgid "Check" +msgstr "" + +#: admin/pages.php:406 admin/settings-page.php:297 admin/templates.php:193 +msgid "sunrise.php file" +msgstr "" + +#: admin/pages.php:409 admin/settings-page.php:300 admin/templates.php:196 +msgid "Found" +msgstr "" + +#. translators: %s: WordPress content directory +#: admin/pages.php:414 admin/settings-page.php:305 admin/templates.php:200 +#, php-format +msgid "Not found - copy sunrise.php to %s" +msgstr "" + +#: admin/pages.php:429 admin/settings-page.php:320 admin/templates.php:215 +msgid "SUNRISE constant" +msgstr "" + +#. translators: %s: SUNRISE constant value +#: admin/pages.php:435 admin/settings-page.php:326 admin/templates.php:220 +#, php-format +msgid "Defined as: %s" +msgstr "" + +#: admin/pages.php:440 admin/settings-page.php:331 admin/templates.php:225 +msgid "Not defined - add to wp-config.php: " +msgstr "" + +#: admin/pages.php:453 admin/settings-page.php:344 admin/templates.php:238 +msgid "SUNRISE_LOADED" +msgstr "" + +#: admin/pages.php:456 admin/settings-page.php:347 admin/templates.php:241 +msgid "Loaded successfully" +msgstr "" + +#: admin/pages.php:460 admin/settings-page.php:351 admin/templates.php:245 +msgid "" +"Not loaded - make sure SUNRISE is defined before the require_once() in wp-" +"config.php" +msgstr "" + +#: admin/pages.php:462 admin/settings-page.php:353 admin/templates.php:247 +msgid "Not loaded - SUNRISE constant not defined" +msgstr "" + +#: admin/pages.php:476 admin/settings-page.php:367 admin/templates.php:261 +msgid "COOKIE_DOMAIN" +msgstr "" + +#: admin/pages.php:479 admin/settings-page.php:370 admin/templates.php:264 +msgid "Not defined (correct)" +msgstr "" + +#. translators: %s: COOKIE_DOMAIN constant value +#: admin/pages.php:484 admin/settings-page.php:375 admin/templates.php:268 +#, php-format +msgid "Defined as: %s - remove this from wp-config.php" +msgstr "" + +#: admin/pages.php:510 admin/settings-page.php:404 admin/templates.php:297 +msgid "Database tables" +msgstr "" + +#: admin/pages.php:513 admin/settings-page.php:407 admin/templates.php:300 +msgid "All tables exist" +msgstr "" + +#: admin/pages.php:515 admin/settings-page.php:409 admin/templates.php:302 +msgid "Some tables are missing - deactivate and reactivate the plugin" +msgstr "" + +#: admin/pages.php:527 admin/settings-page.php:421 admin/templates.php:314 +msgid "Multisite" +msgstr "" + +#: admin/pages.php:530 admin/settings-page.php:424 admin/templates.php:317 +msgid "Enabled" +msgstr "" + +#: admin/pages.php:532 admin/settings-page.php:426 admin/templates.php:319 +msgid "Not enabled - this plugin requires WordPress Multisite" +msgstr "" + +#: admin/pages.php:564 admin/templates.php:547 +msgid "Domain Health Status" +msgstr "域名健康状态" + +#: admin/pages.php:569 +msgid "Health check in progress..." +msgstr "" + +#: admin/pages.php:573 +#, php-format +msgid "Processed %d of %d domains (%d%%)" +msgstr "" + +#: admin/pages.php:602 +msgid "Processed " +msgstr "正在处理" + +#: admin/pages.php:603 +msgid "of" +msgstr "" + +#: admin/pages.php:604 +msgid "domains" +msgstr "域名" + +#: admin/pages.php:620 admin/templates.php:553 +msgid "Check All Domains Now" +msgstr "" + +#: admin/pages.php:631 admin/templates.php:563 +#, php-format +msgid "%s domain" +msgid_plural "%s domains" +msgstr[0] "%s 域名" + +#: admin/pages.php:635 admin/templates.php:567 +msgid "No domains found" +msgstr "未找到域名" + +#: admin/pages.php:648 admin/templates.php:580 admin/templates.php:679 +msgid "DNS Status" +msgstr "DNS 状态" + +#: admin/pages.php:649 admin/templates.php:581 +msgid "SSL Status" +msgstr "SSL 状态" + +#: admin/pages.php:650 admin/templates.php:582 includes/class-tools.php:177 +#: includes/class-tools.php:190 +msgid "Reachable" +msgstr "可达" + +#: admin/pages.php:651 admin/templates.php:583 admin/templates.php:675 +msgid "Last Check" +msgstr "最后检测" + +#: admin/pages.php:666 admin/templates.php:403 admin/templates.php:406 +#: admin/templates.php:598 admin/user-page.php:60 admin/user-page.php:63 +msgid "Primary Domain" +msgstr "主域" + +#: admin/pages.php:680 admin/templates.php:612 admin/templates.php:684 +msgid "DNS correctly configured" +msgstr "" + +#: admin/pages.php:685 admin/pages.php:699 admin/pages.php:710 +#: admin/templates.php:617 admin/templates.php:631 admin/templates.php:642 +msgid "Not checked yet" +msgstr "" + +#: admin/pages.php:691 admin/templates.php:623 +msgid "SSL certificate valid" +msgstr "" + +#: admin/pages.php:693 admin/templates.php:625 +#, php-format +msgid "Expires: %s" +msgstr "" + +#: admin/pages.php:696 admin/templates.php:628 +msgid "SSL certificate issue" +msgstr "" + +#: admin/pages.php:705 admin/templates.php:637 includes/class-tools.php:243 +msgid "Site is accessible" +msgstr "" + +#: admin/pages.php:707 admin/templates.php:639 includes/class-tools.php:245 +msgid "Site is not accessible" +msgstr "" + +#: admin/pages.php:716 admin/templates.php:648 +msgid "ago" +msgstr "" + +#: admin/pages.php:718 admin/templates.php:650 +msgid "Never" +msgstr "" + +#: admin/pages.php:724 admin/pages.php:826 admin/pages.php:831 +#: admin/templates.php:656 +msgid "Check Now" +msgstr "" + +#: admin/pages.php:739 admin/templates.php:752 +msgid "Health Check Settings" +msgstr "" + +#: admin/pages.php:747 admin/pages.php:750 admin/templates.php:760 +#: admin/templates.php:763 +msgid "Automatic Health Checks" +msgstr "" + +#: admin/pages.php:753 admin/templates.php:766 +msgid "Enable automatic daily health checks" +msgstr "" + +#: admin/pages.php:759 admin/pages.php:762 admin/templates.php:772 +#: admin/templates.php:775 +msgid "Email Notifications" +msgstr "" + +#: admin/pages.php:765 admin/templates.php:778 +msgid "Send email notifications when domain health issues are detected" +msgstr "" + +#: admin/pages.php:771 admin/templates.php:784 +msgid "Notification Email" +msgstr "" + +#: admin/pages.php:774 admin/templates.php:787 +msgid "Email address for domain health notifications." +msgstr "" + +#: admin/pages.php:778 admin/templates.php:791 +msgid "SSL Expiry Warning" +msgstr "" + +#: admin/pages.php:781 admin/templates.php:794 +msgid "days" +msgstr "" + +#: admin/pages.php:782 admin/templates.php:795 +msgid "" +"Send notifications when SSL certificates are expiring within this many days." +msgstr "" + +#: admin/pages.php:786 +msgid "Batch Size" +msgstr "" + +#: admin/pages.php:789 +msgid "domains per batch" +msgstr "" + +#: admin/pages.php:790 +msgid "" +"Number of domains to check in each batch. Lower values prevent timeouts but " +"take longer." +msgstr "" + +#: admin/pages.php:796 admin/templates.php:801 +msgid "Save Changes" +msgstr "" + +#: admin/pages.php:809 +msgid "Checking..." +msgstr "检查中..." + +#: admin/pages.php:825 admin/pages.php:830 +msgid "An error occurred during the health check." +msgstr "" + +#: admin/pages.php:846 admin/templates.php:844 +msgid "Export Domain Mappings" +msgstr "导出域名映射" + +#: admin/pages.php:847 admin/templates.php:845 +msgid "Export all domain mappings to a CSV file." +msgstr "" + +#: admin/pages.php:856 admin/templates.php:854 +msgid "Include column headers" +msgstr "" + +#: admin/pages.php:861 admin/templates.php:859 +msgid "Export for specific site ID (optional):" +msgstr "" + +#: admin/pages.php:863 admin/templates.php:861 +msgid "Leave empty to export all domains." +msgstr "" + +#: admin/pages.php:867 admin/templates.php:865 +msgid "Export to CSV" +msgstr "" + +#: admin/pages.php:873 admin/templates.php:871 +msgid "Import Domain Mappings" +msgstr "导入域名映射" + +#: admin/pages.php:874 admin/templates.php:872 +msgid "Import domain mappings from a CSV file." +msgstr "" + +#: admin/pages.php:881 admin/templates.php:879 +msgid "CSV File:" +msgstr "" + +#: admin/pages.php:884 admin/templates.php:882 +msgid "The CSV file should have the columns: blog_id, domain, active (1 or 0)." +msgstr "" + +#: admin/pages.php:885 admin/templates.php:883 +msgid "Example: 1,example.com,1" +msgstr "" + +#: admin/pages.php:892 admin/templates.php:890 +msgid "First row contains column headers" +msgstr "" + +#: admin/pages.php:899 admin/templates.php:897 +msgid "Update existing mappings" +msgstr "" + +#: admin/pages.php:901 admin/templates.php:899 +#, fuzzy +#| msgid "New domain already exists." +msgid "If unchecked, will skip domains that already exist." +msgstr "新的域名已经存在。" + +#: admin/pages.php:907 admin/templates.php:905 +msgid "Validate site IDs" +msgstr "" + +#: admin/pages.php:909 admin/templates.php:907 +msgid "If checked, will only import domains for existing sites." +msgstr "" + +#: admin/pages.php:913 admin/templates.php:911 +msgid "Import from CSV" +msgstr "" + +#: admin/pages.php:918 admin/templates.php:916 +#, fuzzy +#| msgid "Processing..." +msgid "Processing import..." +msgstr "正在处理…" + +#: admin/pages.php:926 admin/templates.php:924 +msgid "Import Results" +msgstr "" + +#: admin/pages.php:933 admin/templates.php:931 +msgid "CSV Format" +msgstr "" + +#: admin/pages.php:934 admin/templates.php:932 +msgid "The CSV file should follow this format:" +msgstr "" + +#: admin/pages.php:959 admin/templates.php:957 +msgid "The ID of the WordPress site (required)" +msgstr "" + +#: admin/pages.php:960 admin/templates.php:958 +#, fuzzy +#| msgid "Enter the domain without http:// or https:// (e.g., example.com)" +msgid "The domain name without http:// or https:// (required)" +msgstr "输入不带 http:// 或 https:// 的域名(例如 example.com)" + +#: admin/pages.php:961 admin/templates.php:959 +msgid "Set to 1 to make this the primary domain, 0 otherwise (required)" +msgstr "" + +#: admin/pages.php:1029 +msgid "An error occurred during import." +msgstr "" + +#: admin/pages.php:1063 includes/class-admin.php:549 +#, fuzzy, php-format +#| msgid "" +#| "Warning! This plugin will only work if WordPress is " +#| "installed in the root directory of your webserver. It is currently " +#| "installed in ’%s’." +msgid "" +"Warning! This plugin will only work if WordPress is " +"installed in the root directory of your webserver. It is currently installed " +"in '%s'." +msgstr "" +"警告!此插件仅当 WordPress 安装在您的网络服务器的根目录中时" +"才有效。它当前安装在『%s』中。" + +#. translators: %s: Server IP address +#: admin/settings-page.php:69 +#, php-format +msgid "Detected server IP: %s" +msgstr "" + +#: admin/templates.php:367 admin/user-page.php:23 includes/class-admin.php:298 +msgid "Domain added successfully." +msgstr "域名添加成功。" + +#: admin/templates.php:370 admin/user-page.php:26 +#, fuzzy +#| msgid "New domain already exists." +msgid "This domain is already mapped to a site." +msgstr "新的域名已经存在。" + +#: admin/templates.php:373 admin/user-page.php:29 +msgid "Primary domain updated." +msgstr "" + +#: admin/templates.php:376 admin/user-page.php:32 includes/class-admin.php:377 +#, fuzzy, php-format +#| msgid "Domain updated successfully." +msgid "Domain deleted successfully." +msgid_plural "%d domains deleted successfully." +msgstr[0] "域名更新成功。" + +#: admin/templates.php:383 admin/user-page.php:15 includes/class-admin.php:108 +#: includes/class-admin.php:109 includes/class-admin.php:123 +#: includes/class-admin.php:124 +msgid "Domain Mapping" +msgstr "域名映射" + +#: admin/templates.php:409 admin/user-page.php:66 +msgid "Set this domain as the primary domain for this site" +msgstr "" + +#: admin/templates.php:424 admin/user-page.php:81 +#, fuzzy +#| msgid "Manage Domains" +msgid "Your Mapped Domains" +msgstr "管理域名" + +#: admin/templates.php:452 admin/user-page.php:109 +#, fuzzy +#| msgid "Primary" +msgid "Make Primary" +msgstr "主域名" + +#: admin/templates.php:461 admin/user-page.php:118 +msgid "Are you sure you want to delete this domain?" +msgstr "" + +#: admin/templates.php:474 admin/user-page.php:131 +#, fuzzy +#| msgid "Save Configuration" +msgid "DNS Configuration Instructions" +msgstr "保存配置" + +#: admin/templates.php:482 admin/user-page.php:139 +msgid "" +"The site administrator has not configured the DNS settings. Please contact " +"them for assistance." +msgstr "" + +#: admin/templates.php:485 admin/user-page.php:142 +msgid "" +"To map your domain to this site, you need to update your DNS records with " +"your domain registrar." +msgstr "" + +#: admin/templates.php:489 admin/user-page.php:146 +#, fuzzy, php-format +#| msgid "Add a DNS \"CNAME\" record pointing to: %s" +msgid "Create a CNAME record for your domain pointing to:%s
"
+msgstr "添加指向以下地址的 DNS“CNAME”记录:%s"
+
+#: admin/templates.php:494 admin/user-page.php:151
+#, php-format
+msgid "Create an A record for your domain pointing to: %s
"
+msgstr ""
+
+#: admin/templates.php:497 admin/user-page.php:154
+msgid ""
+"DNS changes may take 24-48 hours to fully propagate across the internet."
+msgstr ""
+
+#: admin/templates.php:510 admin/templates.php:815
+msgid "You do not have sufficient permissions to access this page."
+msgstr ""
+
+#: admin/templates.php:661
+msgid "Details"
+msgstr ""
+
+#: admin/templates.php:670
+#, php-format
+msgid "Health Details for %s"
+msgstr ""
+
+#: admin/templates.php:690 admin/templates.php:710 includes/class-tools.php:248
+msgid "Not checked"
+msgstr ""
+
+#: admin/templates.php:695
+msgid "Resolved IP"
+msgstr ""
+
+#: admin/templates.php:699
+msgid "SSL Valid"
+msgstr ""
+
+#: admin/templates.php:704
+msgid "Valid"
+msgstr ""
+
+#: admin/templates.php:707
+msgid "Invalid"
+msgstr "无效"
+
+#: admin/templates.php:715
+msgid "SSL Expiry"
+msgstr ""
+
+#: admin/templates.php:719
+msgid "Response Code"
+msgstr ""
+
+#: includes/class-admin.php:103
+msgid ""
+"The domain mapping plugin only works if the site is installed in /. This is "
+"a limitation of how virtual servers work and is very difficult to work "
+"around."
+msgstr ""
+"域映射插件只能在站点是安装位于根目录时才有效。这是虚拟服务器工作方式的限制,"
+"很难解决。"
+
+#: includes/class-admin.php:132 includes/class-admin.php:133
+#: includes/class-admin.php:664
+msgid "Domains"
+msgstr "域名"
+
+#: includes/class-admin.php:168
+#, fuzzy
+#| msgid "Domain deleted."
+msgid "Domain is required."
+msgstr "域名已删除。"
+
+#: includes/class-admin.php:169
+msgid "Site ID is required."
+msgstr ""
+
+#: includes/class-admin.php:170
+msgid "Saving..."
+msgstr "正在保存..."
+
+#: includes/class-admin.php:171
+msgid "Processing..."
+msgstr "正在处理…"
+
+#: includes/class-admin.php:172
+#, fuzzy
+#| msgid "Server error occurred."
+msgid "An error occurred."
+msgstr "发生服务器错误。"
+
+#: includes/class-admin.php:173
+msgid "Please select at least one domain."
+msgstr "请至少选择一个域名。"
+
+#. translators: %1$s: Content directory, %2$s: WordPress install path
+#: includes/class-admin.php:191
+#, fuzzy, php-format
+#| msgid ""
+#| "Please copy sunrise.php to %s/sunrise.php and ensure the SUNRISE "
+#| "definition is in %swp-config.php"
+msgid ""
+"Please copy sunrise.php to %1$s/sunrise.php and ensure the SUNRISE "
+"definition is in %2$swp-config.php"
+msgstr ""
+"请复制sunrise.php到 %s/sunrise.php,并确保SUNRISE定义在%swp-config.php文件"
+
+#: includes/class-admin.php:197 includes/class-admin.php:210
+#: includes/class-admin.php:223 includes/class-admin.php:638
+msgid "This plugin has not been configured correctly yet."
+msgstr "该插件尚未正确配置。"
+
+#. translators: %s: WordPress install path
+#: includes/class-admin.php:205
+#, php-format
+msgid ""
+"Please uncomment the line define( 'SUNRISE', 'on' ); or add it to "
+"your %swp-config.php"
+msgstr ""
+"请取消注释行 define( 'SUNRISE', 'on' ); 或将其添加到您的 %swp-"
+"config.php"
+
+#. translators: %s: WordPress install path
+#: includes/class-admin.php:218
+#, php-format
+msgid ""
+"Please edit your %swp-config.php and move the line define( 'SUNRISE', "
+"'on' ); above the last require_once() in that file or make sure you "
+"updated sunrise.php."
+msgstr ""
+"请编辑你的 %swp-config.php 和移动行define( 'SUNRISE', 'on' );上面最"
+"后一次()需要在文件或确保您sunrise.php更新。"
+
+#: includes/class-admin.php:233
+msgid "Domain Mapping Disabled."
+msgstr "域映射已禁用。"
+
+#: includes/class-admin.php:237
+#, php-format
+msgid "You must create a network for it to work."
+msgstr "您必须创建网络才能使其正常工作。"
+
+#: includes/class-admin.php:251
+msgid "Permission denied."
+msgstr "没有权限。"
+
+#: includes/class-admin.php:268
+#, fuzzy
+#| msgid "Invalid action."
+msgid "Invalid domain format."
+msgstr "无效操作。"
+
+#: includes/class-admin.php:301
+#, fuzzy
+#| msgid "Failed to save domain."
+msgid "Failed to add domain."
+msgstr "无法保存域名。"
+
+#: includes/class-admin.php:322
+msgid "Domain updated successfully."
+msgstr "域名更新成功。"
+
+#: includes/class-admin.php:325
+msgid "No changes were made or update failed."
+msgstr ""
+
+#: includes/class-admin.php:330
+msgid "An error occurred while saving domain."
+msgstr ""
+
+#: includes/class-admin.php:333
+#, fuzzy
+#| msgid "New domain already exists."
+msgid "Domain already exists for another site."
+msgstr "新的域名已经存在。"
+
+#: includes/class-admin.php:336
+msgid "Invalid site ID."
+msgstr ""
+
+#: includes/class-admin.php:387
+#, fuzzy
+#| msgid "Domain deleted."
+msgid "No domains were deleted."
+msgstr "域名已删除。"
+
+#: includes/class-admin.php:391
+msgid "An error occurred while deleting domains."
+msgstr ""
+
+#: includes/class-admin.php:396
+msgid "Invalid action."
+msgstr "无效操作。"
+
+#: includes/class-admin.php:412 includes/class-admin.php:503
+msgid "You must enter a domain"
+msgstr "您必须输入一个域名"
+
+#: includes/class-admin.php:425
+msgid "Invalid domain format"
+msgstr ""
+
+#: includes/class-admin.php:634
+msgid ""
+"Please set the IP address or CNAME of your server in the site admin page."
+msgstr ""
+"请在站点管理页面中设置您服务"
+"器的 IP 地址或 CNAME。"
+
+#: includes/class-admin.php:676
+msgid "Mapping"
+msgstr "映射"
+
+#: includes/class-admin.php:720
+msgid "New domain added."
+msgstr "已添加新域名。"
+
+#: includes/class-admin.php:723
+msgid "New domain already exists."
+msgstr "新的域名已经存在。"
+
+#: includes/class-admin.php:726
+msgid "New primary domain."
+msgstr "新的主域名。"
+
+#: includes/class-admin.php:729
+msgid "Domain deleted."
+msgstr "域名已删除。"
+
+#: includes/class-core.php:173
+#, fuzzy
+#| msgid "Domain mapping database table created."
+msgid "Domain mapping database tables created."
+msgstr "域映射创建数据库表。"
+
+#: includes/class-core.php:545
+msgid "Incorrect or out of date login key"
+msgstr "登录密钥不正确或过期"
+
+#: includes/class-core.php:548
+msgid "Unknown login key"
+msgstr "未知的登录密钥"
+
+#: includes/class-core.php:569
+msgid "Unknown logout key"
+msgstr "未知的退出密钥"
+
+#: includes/class-tools.php:127
+#, php-format
+msgid "Site ID: %d"
+msgstr "站点 ID:%d"
+
+#: includes/class-tools.php:130
+msgid "Edit this site"
+msgstr ""
+
+#: includes/class-tools.php:130
+msgid "Current site ID"
+msgstr ""
+
+#: includes/class-tools.php:176 includes/class-tools.php:189
+msgid "SSL"
+msgstr ""
+
+#: includes/class-tools.php:210
+msgid "SSL Enabled"
+msgstr ""
+
+#: includes/class-tools.php:212
+msgid "No SSL"
+msgstr ""
+
+#: includes/class-tools.php:220
+msgid "Main site is accessible"
+msgstr ""
+
+#: includes/class-tools.php:251
+msgid "No domain"
+msgstr ""
+
+#: includes/class-tools.php:316 includes/class-tools.php:340
+#: includes/class-tools.php:385 includes/class-tools.php:436
+msgid "Security check failed."
+msgstr ""
+
+#: includes/class-tools.php:321 includes/class-tools.php:345
+#: includes/class-tools.php:380 includes/class-tools.php:431
+msgid "You do not have sufficient permissions to perform this action."
+msgstr ""
+
+#: includes/class-tools.php:391
+#, fuzzy
+#| msgid "No domains found."
+msgid "No domain specified."
+msgstr "未找到域名。"
+
+#: includes/class-tools.php:402
+msgid "Main site is always accessible"
+msgstr ""
+
+#: includes/class-tools.php:525
+msgid "Health check completed."
+msgstr ""
+
+#: includes/class-tools.php:593
+msgid "DNS check not performed"
+msgstr ""
+
+#: includes/class-tools.php:612
+msgid "Domain A record is correctly pointing to server IP."
+msgstr ""
+
+#: includes/class-tools.php:632
+msgid "Domain CNAME record is correctly configured."
+msgstr ""
+
+#: includes/class-tools.php:634
+msgid "Domain is not pointing to the correct server."
+msgstr ""
+
+#: includes/class-tools.php:637
+msgid "Cannot verify DNS configuration."
+msgstr ""
+
+#: includes/class-tools.php:640
+msgid "Domain does not resolve to an IP address."
+msgstr ""
+
+#: includes/class-tools.php:772
+#, php-format
+msgid "[%s] Domain Mapping Health Alert"
+msgstr ""
+
+#: includes/class-tools.php:775
+#, php-format
+msgid "Domain health issues were detected on %s."
+msgstr ""
+
+#: includes/class-tools.php:776
+msgid "The following domains have issues:"
+msgstr ""
+
+#: includes/class-tools.php:779
+#, php-format
+msgid "Domain: %s"
+msgstr "域名: %s"
+
+#: includes/class-tools.php:783
+#, php-format
+msgid "DNS Issue: %s"
+msgstr ""
+
+#: includes/class-tools.php:788
+msgid "SSL Certificate is invalid or missing."
+msgstr ""
+
+#: includes/class-tools.php:796
+#, php-format
+msgid "SSL Certificate expires on %s (within %d days)."
+msgstr ""
+
+#: includes/class-tools.php:805
+msgid "Site is not accessible."
+msgstr ""
+
+#: includes/class-tools.php:807
+#, php-format
+msgid "HTTP Response Code: %d"
+msgstr ""
+
+#: includes/class-tools.php:816
+#, php-format
+msgid "To view and manage these issues, please visit: %s"
+msgstr ""
+
+#: includes/class-tools.php:838
+msgid "You do not have sufficient permissions to export data."
+msgstr ""
+
+#: includes/class-tools.php:843 includes/class-tools.php:899
+msgid "Invalid security token. Please try again."
+msgstr ""
+
+#: includes/class-tools.php:894
+msgid "You do not have sufficient permissions to import data."
+msgstr ""
+
+#: includes/class-tools.php:904
+msgid "No file uploaded or upload error."
+msgstr ""
+
+#: includes/class-tools.php:915
+msgid "Could not open the uploaded file."
+msgstr ""
+
+#: includes/class-tools.php:940
+#, php-format
+msgid "Row %d: Invalid format. Expected at least 3 columns."
+msgstr ""
+
+#: includes/class-tools.php:956
+#, php-format
+msgid "Row %d: Domain %s already processed in this import. Skipped duplicate."
+msgstr ""
+
+#: includes/class-tools.php:970
+#, php-format
+msgid "Row %d: Invalid blog ID: %d"
+msgstr ""
+
+#: includes/class-tools.php:981
+#, php-format
+msgid "Row %d: Site ID %d does not exist."
+msgstr ""
+
+#: includes/class-tools.php:992
+#, php-format
+msgid "Row %d: Invalid domain format: %s"
+msgstr ""
+
+#: includes/class-tools.php:1006
+#, php-format
+msgid "Row %d: Domain %s is already mapped to blog ID %d."
+msgstr ""
+
+#: includes/class-tools.php:1013
+#, php-format
+msgid "Row %d: Domain %s already exists for blog ID %d. Skipped."
+msgstr ""
+
+#: includes/class-tools.php:1024
+#, php-format
+msgid "Row %d: Updated domain %s for blog ID %d."
+msgstr ""
+
+#: includes/class-tools.php:1031
+#, php-format
+msgid "Row %d: Failed to update domain %s for blog ID %d."
+msgstr ""
+
+#: includes/class-tools.php:1044
+#, php-format
+msgid "Row %d: Added domain %s for blog ID %d."
+msgstr ""
+
+#: includes/class-tools.php:1051
+#, php-format
+msgid "Row %d: Failed to add domain %s for blog ID %d."
+msgstr ""
+
+#: includes/class-tools.php:1065
+#, php-format
+msgid "Import completed: %d imported, %d skipped, %d errors."
+msgstr ""
+
+#: includes/functions.php:73
+#, php-format
+msgid ""
+"International Domain Names should be in punycode format."
+msgstr "国际域名应采用punycode格式。"
+
+#: includes/functions.php:331
+msgid "Added"
+msgstr ""
+
+#: includes/functions.php:333
+#, fuzzy
+#| msgid "Update Domain"
+msgid "Updated"
+msgstr "更新域名"
+
+#: includes/functions.php:335
+#, fuzzy
+#| msgid "Delete"
+msgid "Deleted"
+msgstr "删除"
+
+#: includes/functions.php:337
+msgid "Imported"
+msgstr ""
#. Plugin Name of the plugin/theme
msgid "WP Domain Mapping"
msgstr "文派域名映射"
-#: wp-domain-mapping.php:1111
-msgid "International Domain Names should be in punycode format."
-msgstr "国际域名应采用punycode格式。"
+#. Plugin URI of the plugin/theme
+msgid "https://wenpai.org/plugins/wp-domain-mapping/"
+msgstr "https://wenpai.org/plugins/wp-domain-mapping/"
-#: wp-domain-mapping.php:1076
-msgid "Mapping"
-msgstr "映射"
+#. Description of the plugin/theme
+msgid ""
+"Map any site on a WordPress website to another domain with enhanced "
+"management features."
+msgstr "使用增强的管理功能将 WordPress 网站上的任何站点映射到另一个域名。"
-#: wp-domain-mapping.php:1049
-msgid "Unknown logout key"
-msgstr "未知的退出密钥"
+#. Author of the plugin/theme
+msgid "WPDomain.com"
+msgstr "WPDomain.com"
-#: wp-domain-mapping.php:1039
-msgid "Unknown login key"
-msgstr "未知的登录密钥"
+#. Author URI of the plugin/theme
+msgid "https://wpdomain.com/"
+msgstr "https://wpdomain.com/"
-#: wp-domain-mapping.php:1036
-msgid "Incorrect or out of date login key"
-msgstr "登录密钥不正确或过期"
+#~ msgid "Add a DNS \"A\" record pointing to: %s"
+#~ msgstr "添加指向 %s 的 DNS “A” 记录"
-#: wp-domain-mapping.php:838
-msgid "Please edit your %swp-config.php and move the line define( 'SUNRISE', 'on' ); above the last require_once() in that file or make sure you updated sunrise.php."
-msgstr "请编辑你的 %swp-config.php 和移动行define( 'SUNRISE', 'on' );上面最后一次()需要在文件或确保您sunrise.php更新。"
+#~ msgid "Add"
+#~ msgstr "添加"
-#: wp-domain-mapping.php:831
-msgid "Please uncomment the line define( 'SUNRISE', 'on' ); or add it to your %swp-config.php"
-msgstr "请取消注释行 define( 'SUNRISE', 'on' ); 或将其添加到您的 %swp-config.php"
+#~ msgid "* The primary domain cannot be deleted."
+#~ msgstr "*主域名不能被删除。"
-#: wp-domain-mapping.php:824
-msgid "Please copy sunrise.php to %s/sunrise.php and ensure the SUNRISE definition is in %swp-config.php"
-msgstr "请复制sunrise.php到 %s/sunrise.php,并确保SUNRISE定义在%swp-config.php文件"
+#~ msgid "Set Primary Domain"
+#~ msgstr "设置为主域"
-#: wp-domain-mapping.php:778 wp-domain-mapping.php:807
-msgid "You must enter a domain"
-msgstr "您必须输入一个域名"
+#~ msgid "Active Domains"
+#~ msgstr "活跃域名"
-#: wp-domain-mapping.php:758
-msgid "Add a DNS \"A\" record pointing to: %s"
-msgstr "添加指向 %s 的 DNS “A” 记录"
+#~ msgid "Domain Mapping Configuration"
+#~ msgstr "域映射配置"
-#: wp-domain-mapping.php:755
-msgid "Add a DNS \"CNAME\" record pointing to: %s"
-msgstr "添加指向以下地址的 DNS“CNAME”记录:%s"
+#~ msgid "Timestamp"
+#~ msgstr "时间戳"
-#: wp-domain-mapping.php:751
-msgid "Add"
-msgstr "添加"
+#~ msgid "Failed to delete domains."
+#~ msgstr "无法删除域名。"
-#: wp-domain-mapping.php:750
-msgid "Set as Primary Domain"
-msgstr "设置为主域"
+#~ msgid "Selected domains deleted successfully."
+#~ msgstr "选定的域名已成功删除。"
-#: wp-domain-mapping.php:739
-msgid "* The primary domain cannot be deleted."
-msgstr "*主域名不能被删除。"
-
-#: wp-domain-mapping.php:737
-msgid "Set Primary Domain"
-msgstr "设置为主域"
-
-#: wp-domain-mapping.php:713
-msgid "Active Domains"
-msgstr "活跃域名"
-
-#: wp-domain-mapping.php:702 wp-domain-mapping.php:826
-#: wp-domain-mapping.php:833 wp-domain-mapping.php:840
-msgid "This plugin has not been configured correctly yet."
-msgstr "该插件尚未正确配置。"
-
-#: wp-domain-mapping.php:700
-msgid "Please set the IP address or CNAME of your server in the site admin page."
-msgstr "请在站点管理页面中设置您服务器的 IP 地址或 CNAME。"
-
-#: wp-domain-mapping.php:674
-msgid "Save Configuration"
-msgstr "保存配置"
-
-#: wp-domain-mapping.php:672
-msgid "Disable Primary Domain Check"
-msgstr "禁用主域检查"
-
-#: wp-domain-mapping.php:671
-msgid "Redirect Admin Pages to Original Domain"
-msgstr "将管理页面重定向到原始域"
-
-#: wp-domain-mapping.php:670
-msgid "Enable User Domain Mapping Page"
-msgstr "启用用户域映射页面"
-
-#: wp-domain-mapping.php:669
-msgid "Use Permanent Redirect (301) - Better for SEO"
-msgstr "使用永久重定向(301)-更有利于 SEO"
-
-#: wp-domain-mapping.php:668
-msgid "Enable Remote Login"
-msgstr "启用远程登录"
-
-#: wp-domain-mapping.php:666
-msgid "Domain Options"
-msgstr "域名选项"
-
-#: wp-domain-mapping.php:662
-msgid "Use a CNAME instead of an IP (overrides IP settings). %s"
-msgstr "使用 CNAME 而不是 IP(覆盖 IP 设置)。%s"
-
-#: wp-domain-mapping.php:659
-msgid "Server CNAME Domain:"
-msgstr "服务器 CNAME 域名:"
-
-#: wp-domain-mapping.php:655
-msgid "Enter the IP address(es) users should point their DNS A records to. Use commas to separate multiple IPs."
-msgstr "输入用户应将其 DNS A 记录指向的 IP 地址。使用逗号分隔多个 IP。"
-
-#: wp-domain-mapping.php:652
-msgid "Server IP Address:"
-msgstr "服务器 IP 地址:"
-
-#: wp-domain-mapping.php:646
-msgid "Configure the IP address or CNAME for domain mapping."
-msgstr "配置域映射的IP地址或CNAME。"
-
-#: wp-domain-mapping.php:645
-msgid "Server Configuration"
-msgstr "服务器配置"
-
-#: wp-domain-mapping.php:643
-msgid "Domain Mapping Configuration"
-msgstr "域映射配置"
-
-#: wp-domain-mapping.php:574
-msgid "Timestamp"
-msgstr "时间戳"
-
-#: wp-domain-mapping.php:571
-msgid "Action"
-msgstr "操作"
-
-#: wp-domain-mapping.php:570
-msgid "User"
-msgstr "用户"
-
-#: wp-domain-mapping.php:563
-msgid "No logs available."
-msgstr "无可用日志。"
-
-#: wp-domain-mapping.php:508 wp-domain-mapping.php:525
-msgid "Edit"
-msgstr "编辑"
-
-#: wp-domain-mapping.php:498
-msgid "Apply"
-msgstr "应用"
-
-#: wp-domain-mapping.php:496 wp-domain-mapping.php:718
-#: wp-domain-mapping.php:729
-msgid "Delete"
-msgstr "删除"
-
-#: wp-domain-mapping.php:495
-msgid "Bulk Actions"
-msgstr "批量操作"
-
-#: wp-domain-mapping.php:486
-msgid "No domains found."
-msgstr "未找到域名。"
-
-#: wp-domain-mapping.php:476
-msgid "Add Domain"
-msgstr "添加域名"
-
-#: wp-domain-mapping.php:476
-msgid "Update Domain"
-msgstr "更新域名"
-
-#: wp-domain-mapping.php:472 wp-domain-mapping.php:540
-#: wp-domain-mapping.php:740
-msgid "Warning! Primary domains are currently disabled."
-msgstr "警告!主域名目前已被禁用。"
-
-#: wp-domain-mapping.php:467 wp-domain-mapping.php:507
-#: wp-domain-mapping.php:718
-msgid "Primary"
-msgstr "主域名"
-
-#: wp-domain-mapping.php:463
-msgid "Enter the domain without http:// or https:// (e.g., example.com)"
-msgstr "输入不带 http:// 或 https:// 的域名(例如 example.com)"
-
-#: wp-domain-mapping.php:460 wp-domain-mapping.php:506
-#: wp-domain-mapping.php:572 wp-domain-mapping.php:718
-msgid "Domain"
-msgstr "域名"
-
-#: wp-domain-mapping.php:456 wp-domain-mapping.php:505
-#: wp-domain-mapping.php:573
-msgid "Site ID"
-msgstr "站点 ID"
-
-#: wp-domain-mapping.php:384
-msgid "Failed to delete domains."
-msgstr "无法删除域名。"
-
-#: wp-domain-mapping.php:369
-msgid "Processing..."
-msgstr "正在处理…"
-
-#: wp-domain-mapping.php:362
-msgid "Please select at least one domain."
-msgstr "请至少选择一个域名。"
-
-#: wp-domain-mapping.php:350 wp-domain-mapping.php:388
-msgid "Server error occurred."
-msgstr "发生服务器错误。"
-
-#: wp-domain-mapping.php:346
-msgid "Failed to save domain."
-msgstr "无法保存域名。"
-
-#: wp-domain-mapping.php:336
-msgid "Saving..."
-msgstr "正在保存..."
-
-#: wp-domain-mapping.php:303
-msgid "Primary Domains"
-msgstr "主域"
-
-#: wp-domain-mapping.php:302
-msgid "Total Domains"
-msgstr "域名总数"
-
-#: wp-domain-mapping.php:299
-msgid "Domain Statistics"
-msgstr "域名统计"
-
-#: wp-domain-mapping.php:289 wp-domain-mapping.php:761
-msgid "Note: %s"
-msgstr "注意: %s"
-
-#: wp-domain-mapping.php:285
-msgid "%s item"
-msgid_plural "%s items"
-msgstr[0] "%s 项"
-
-#: wp-domain-mapping.php:279
-msgid "»"
-msgstr "»"
-
-#: wp-domain-mapping.php:278
-msgid "«"
-msgstr "«"
-
-#: wp-domain-mapping.php:250
-msgid "Domain Logs"
-msgstr "域名日志"
-
-#: wp-domain-mapping.php:249
-msgid "Manage Domains"
-msgstr "管理域名"
-
-#: wp-domain-mapping.php:242
-msgid "Filter"
-msgstr "筛选"
-
-#: wp-domain-mapping.php:240 wp-domain-mapping.php:521
-msgid "No"
-msgstr "否"
-
-#: wp-domain-mapping.php:239 wp-domain-mapping.php:519
-msgid "Yes"
-msgstr "是"
-
-#: wp-domain-mapping.php:238
-msgid "All"
-msgstr "全部"
-
-#: wp-domain-mapping.php:236
-msgid "Primary:"
-msgstr "主域:"
-
-#: wp-domain-mapping.php:234
-msgid "Site ID:"
-msgstr "站点 ID:"
-
-#: wp-domain-mapping.php:232 wp-domain-mapping.php:748
-msgid "Domain:"
-msgstr "域名:"
-
-#: wp-domain-mapping.php:228
-msgid "Search & Filter Domains"
-msgstr "搜索和过滤域名"
-
-#: wp-domain-mapping.php:222 wp-domain-mapping.php:744
-msgid "Add New Domain"
-msgstr "添加新域名"
-
-#: wp-domain-mapping.php:222
-msgid "Edit Domain"
-msgstr "编辑域名"
-
-#: wp-domain-mapping.php:204 wp-domain-mapping.php:611
-msgid "Warning! This plugin will only work if WordPress is installed in the root directory of your webserver. It is currently installed in ’%s’."
-msgstr "警告!此插件仅当 WordPress 安装在您的网络服务器的根目录中时才有效。它当前安装在『%s』中。"
-
-#: wp-domain-mapping.php:188
-msgid "Invalid action."
-msgstr "无效操作。"
-
-#: wp-domain-mapping.php:185
-msgid "Selected domains deleted successfully."
-msgstr "选定的域名已成功删除。"
-
-#: wp-domain-mapping.php:175
-msgid "Invalid site ID or domain already exists."
-msgstr "无效的站点 ID 或域名已存在。"
-
-#: wp-domain-mapping.php:172
-msgid "Domain updated successfully."
-msgstr "域名更新成功。"
-
-#: wp-domain-mapping.php:168
-msgid "Domain added successfully."
-msgstr "域名添加成功。"
-
-#: wp-domain-mapping.php:149
-msgid "Permission denied."
-msgstr "没有权限。"
-
-#: wp-domain-mapping.php:139
-msgid "Domain mapping database table created."
-msgstr "域映射创建数据库表。"
-
-#: wp-domain-mapping.php:66
-msgid "Domain deleted."
-msgstr "域名已删除。"
-
-#: wp-domain-mapping.php:63
-msgid "New primary domain."
-msgstr "新的主域名。"
-
-#: wp-domain-mapping.php:60
-msgid "New domain already exists."
-msgstr "新的域名已经存在。"
-
-#: wp-domain-mapping.php:57
-msgid "New domain added."
-msgstr "已添加新域名。"
-
-#: wp-domain-mapping.php:49 wp-domain-mapping.php:219 wp-domain-mapping.php:595
-msgid "Domains"
-msgstr "域名"
-
-#: wp-domain-mapping.php:41 wp-domain-mapping.php:48 wp-domain-mapping.php:711
-msgid "Domain Mapping"
-msgstr "域名映射"
-
-#: wp-domain-mapping.php:37
-msgid "The domain mapping plugin only works if the site is installed in /. This is a limitation of how virtual servers work and is very difficult to work around."
-msgstr "域映射插件只能在站点是安装位于根目录时才有效。这是虚拟服务器工作方式的限制,很难解决。"
-
-#: wp-domain-mapping.php:25
-msgid "You must create a network for it to work."
-msgstr "您必须创建网络才能使其正常工作。"
-
-#: wp-domain-mapping.php:25
-msgid "Domain Mapping Disabled."
-msgstr "域映射已禁用。"
+#~ msgid "Invalid site ID or domain already exists."
+#~ msgstr "无效的站点 ID 或域名已存在。"
diff --git a/sunrise.php b/sunrise.php
index 8c3198f..a3c9c68 100644
--- a/sunrise.php
+++ b/sunrise.php
@@ -29,8 +29,11 @@ global $wpdb, $current_blog, $current_site;
$domain_mapping_table = $wpdb->base_prefix . 'domain_mapping';
// Check for the current domain in the domain mapping table
-$domain = $wpdb->escape($_SERVER['HTTP_HOST']);
-$blog_id = $wpdb->get_var("SELECT blog_id FROM {$domain_mapping_table} WHERE domain = '{$domain}' LIMIT 1");
+$domain = sanitize_text_field($_SERVER['HTTP_HOST']);
+$blog_id = $wpdb->get_var($wpdb->prepare(
+ "SELECT blog_id FROM {$domain_mapping_table} WHERE domain = %s LIMIT 1",
+ $domain
+));
// If we found a mapped domain, override current_blog
if (!empty($blog_id)) {
diff --git a/wp-domain-mapping.php b/wp-domain-mapping.php
index 82a777c..d9a2fca 100644
--- a/wp-domain-mapping.php
+++ b/wp-domain-mapping.php
@@ -3,7 +3,7 @@
* Plugin Name: WP Domain Mapping
* Plugin URI: https://wenpai.org/plugins/wp-domain-mapping/
* Description: Map any site on a WordPress website to another domain with enhanced management features.
- * Version: 2.0.2
+ * Version: 2.1.0
* Author: WPDomain.com
* Author URI: https://wpdomain.com/
* Network: true
@@ -20,7 +20,7 @@ if ( ! defined( 'ABSPATH' ) ) {
}
// Define plugin constants
-define( 'WP_DOMAIN_MAPPING_VERSION', '2.0.2' );
+define( 'WP_DOMAIN_MAPPING_VERSION', '2.1.0' );
define( 'WP_DOMAIN_MAPPING_DIR_URL', plugin_dir_url( __FILE__ ) );
define( 'WP_DOMAIN_MAPPING_DIR_PATH', plugin_dir_path( __FILE__ ) );
define( 'WP_DOMAIN_MAPPING_BASENAME', plugin_basename( __FILE__ ) );