Changeset 3657120
- Timestamp:
- 08/20/2026 02:40:13 PM (2 months ago)
- Location:
- onartline-multisite-domain-mapping/trunk
- Files:
-
- 18 edited
-
README.md (modified) (2 diffs)
-
README.txt (modified) (3 diffs)
-
admin/class-omdm-network-admin.php (modified) (46 diffs)
-
docs/README-DE.md (modified) (2 diffs)
-
docs/README-ES.md (modified) (2 diffs)
-
docs/README-FR.md (modified) (2 diffs)
-
docs/README-IT.md (modified) (2 diffs)
-
docs/README-NL.md (modified) (2 diffs)
-
docs/README-PT-BR.md (modified) (2 diffs)
-
docs/README-PT.md (modified) (2 diffs)
-
includes/class-omdm-activator.php (modified) (32 diffs)
-
includes/class-omdm-domain-mapper.php (modified) (19 diffs)
-
includes/class-omdm-loader.php (modified) (12 diffs)
-
includes/class-omdm-login-handler.php (modified) (1 diff)
-
includes/class-omdm-plugin.php (modified) (1 diff)
-
includes/class-omdm-site-settings.php (modified) (1 diff)
-
languages/onartline-multisite-domain-mapping.pot (modified) (5 diffs)
-
onartline-multisite-domain-mapping.php (modified) (2 diffs)
Legend:
- Unmodified
- Added
- Removed
-
onartline-multisite-domain-mapping/trunk/README.md
r3651261 r3657120 89 89 Point your domain to your server by setting the following DNS records: 90 90 91 - **A Record** – Name: `@` – Value: Your server IP address 91 - **A Record** – Name: `@` – Value: Your server's IPv4 address 92 - **AAAA Record** – Name: `@` – Value: Your server's IPv6 address (optional, if available) 92 93 - **CNAME Record** – Name: `www` – Value: Your primary domain or server CNAME 93 94 … … 124 125 ## Changelog 125 126 127 ### 1.0.1 128 - Fix: Corrected cache invalidation after saving a new domain in the site settings, so newly added domains resolve correctly right away. 129 - Fix: Resolved a parse error caused by duplicate methods defined outside the omdm_Login_Handler class. 130 - Fix: Domain mapping now correctly excludes login, AJAX, and REST requests. 131 - Fix: Corrected default values in set_default_options(). 132 - New: Added IPv6 support to the DNS information field on the settings page. 133 - New: Introduced consistent format validation for IPv4, IPv6, and CNAME entries. 134 126 135 ### 1.0.0 127 136 - Initial release -
onartline-multisite-domain-mapping/trunk/README.txt
r3651261 r3657120 5 5 Requires at least: 7.0 6 6 Tested up to: 7.1 7 Stable tag: 1.0. 07 Stable tag: 1.0.1 8 8 Requires PHP: 8.3 9 9 License: GPLv2 or later … … 114 114 = 7. Configure DNS = 115 115 116 117 116 Point your domain to your server by setting the following DNS records: 118 117 119 120 * **A Record** – Name: `@` – Value: Your server IP address118 * **A Record** – Name: `@` – Value: Your server's IPv4 address 119 * **AAAA Record** – Name: `@` – Value: Your server's IPv6 address (optional, if available) 121 120 * **CNAME Record** – Name: `www` – Value: Your primary domain or server CNAME 122 123 121 124 122 The required values are displayed in **Network Admin → Domain Mapping → Settings**. … … 167 165 == Changelog == 168 166 167 = 1.0.1 = 168 * Fix: Corrected cache invalidation after saving a new domain in the site settings, so newly added domains resolve correctly right away. 169 * Fix: Resolved a parse error caused by duplicate methods defined outside the omdm_Login_Handler class. 170 * Fix: Domain mapping now correctly excludes login, AJAX, and REST requests. 171 * Fix: Corrected default values in set_default_options(). 172 * New: Added IPv6 support to the DNS information field on the settings page. 173 * New: Introduced consistent format validation for IPv4, IPv6, and CNAME entries. 169 174 170 175 = 1.0.0 = -
onartline-multisite-domain-mapping/trunk/admin/class-omdm-network-admin.php
r3630157 r3657120 6 6 */ 7 7 8 9 8 if ( ! defined( 'ABSPATH' ) ) { 10 9 exit; 11 10 } 12 11 13 14 12 class omdm_Network_Admin { 15 16 13 17 14 private string $plugin_name; … … 19 16 private wpdb $db; 20 17 21 22 18 public function __construct( string $plugin_name, string $version ) { 23 19 $this->plugin_name = $plugin_name; 24 20 $this->version = $version; 25 21 26 27 22 global $wpdb; 28 23 $this->db = $wpdb; 29 24 } 30 31 25 32 26 /** … … 44 38 ); 45 39 46 47 40 add_submenu_page( 48 41 'onartline-multisite-domain-mapping', … … 54 47 ); 55 48 56 57 49 add_submenu_page( 58 50 'onartline-multisite-domain-mapping', … … 64 56 ); 65 57 66 67 58 add_submenu_page( 68 59 'onartline-multisite-domain-mapping', … … 74 65 ); 75 66 76 77 67 add_action( 78 68 'load-toplevel_page_onartline-multisite-domain-mapping', … … 80 70 ); 81 71 } 82 83 72 84 73 /** … … 95 84 } 96 85 97 98 86 $action = ''; 99 100 87 101 88 if ( isset( $_POST['action'] ) ) { … … 112 99 } 113 100 } 114 115 101 116 102 if ( … … 123 109 } 124 110 125 126 111 $ids = array_map( 'intval', wp_unslash( $_POST['domain_ids'] ) ); 127 112 $table = $this->db->base_prefix . 'omdm_domain_mapping'; 128 113 $domains = []; 129 130 114 131 115 foreach ( $ids as $id ) { … … 139 123 } 140 124 141 142 125 $count = count( $domains ); 143 144 126 145 127 if ( 1 === $count ) { … … 158 140 } 159 141 160 161 142 wp_safe_redirect( $redirect_url ); 162 143 exit; 163 144 } 164 } /** 145 } 146 /** 165 147 * Übersicht rendern 166 148 */ … … 174 156 </h1> 175 157 176 177 158 <a href="<?php echo esc_url( network_admin_url( 'admin.php?page=onartline-multisite-domain-mapping-add' ) ); ?>" 178 159 class="page-title-action"> … … 180 161 </a> 181 162 182 183 163 <hr class="wp-header-end"> 184 164 185 186 165 <?php $this->render_notices(); ?> 187 188 166 189 167 <form method="post"> … … 202 180 } 203 181 204 205 182 /** 206 183 * Domain hinzufügen / bearbeiten rendern … … 212 189 $table = $this->db->base_prefix . 'omdm_domain_mapping'; 213 190 214 215 191 // phpcs:ignore WordPress.Security.NonceVerification.Recommended -- Nur Lesezugriff zur Formular-Vorbefüllung, keine Datenänderung. 216 192 $edit_id = isset( $_GET['edit'] ) ? (int) $_GET['edit'] : 0; 217 193 $mapping = null; 218 219 194 220 195 if ( $edit_id ) { … … 232 207 </h1> 233 208 234 235 209 <?php $this->render_notices(); ?> 236 237 210 238 211 <form method="post" action="<?php echo esc_url( network_admin_url( 'edit.php?action=omdm_save_domain' ) ); ?>"> … … 241 214 <input type="hidden" name="omdm_id" value="<?php echo esc_attr( $mapping->id ); ?>"> 242 215 <?php endif; ?> 243 244 216 245 217 <table class="form-table"> … … 292 264 </table> 293 265 294 295 266 <?php submit_button( $mapping 296 267 ? __( 'Update domain', 'onartline-multisite-domain-mapping' ) … … 301 272 <?php 302 273 } 303 304 305 274 /** 306 275 * Einstellungen rendern … … 308 277 public function render_settings(): void { 309 278 $server_ip = get_site_option( 'omdm_server_ip', '' ); 279 $server_ipv6 = get_site_option( 'omdm_server_ipv6', '' ); 310 280 $server_cname = get_site_option( 'omdm_server_cname', '' ); 311 281 ?> … … 313 283 <h1><?php esc_html_e( 'Domain Mapping – Settings', 'onartline-multisite-domain-mapping' ); ?></h1> 314 284 315 316 285 <?php $this->render_notices(); ?> 317 318 286 319 287 <form method="post" action="<?php echo esc_url( network_admin_url( 'edit.php?action=omdm_save_settings' ) ); ?>"> 320 288 <?php wp_nonce_field( 'omdm_save_settings' ); ?> 321 322 289 323 290 <table class="form-table"> … … 355 322 </td> 356 323 </tr> 357 <tr>324 <tr> 358 325 <td colspan="2"> 359 326 <hr> … … 374 341 <p class="description"> 375 342 <?php esc_html_e( 376 'IP address for the DNS A record. Enter multiple IPs comma-separated (e.g. for round-robin DNS).', 343 'IPv4 address for the DNS A record. Enter multiple IPs comma-separated (e.g. for round-robin DNS).', 344 'onartline-multisite-domain-mapping' 345 ); ?> 346 </p> 347 </td> 348 </tr> 349 <tr> 350 <th><?php esc_html_e( 'Server IPv6 address', 'onartline-multisite-domain-mapping' ); ?></th> 351 <td> 352 <input type="text" name="omdm_server_ipv6" 353 value="<?php echo esc_attr( $server_ipv6 ); ?>" 354 placeholder="<?php esc_attr_e( 'e.g. 2001:db8::1 or multiple, comma-separated', 'onartline-multisite-domain-mapping' ); ?>" 355 class="regular-text"> 356 <p class="description"> 357 <?php esc_html_e( 358 'IPv6 address for the DNS AAAA record. Enter multiple IPs comma-separated (e.g. for round-robin DNS). Leave empty if IPv6 is not supported by your server.', 377 359 'onartline-multisite-domain-mapping' 378 360 ); ?> … … 389 371 <p class="description"> 390 372 <?php esc_html_e( 391 'CNAME domain as an alternative to the IP address. Enter internationalized domain names in Punycode format. Note: If a CNAME domain is provided, the IP address isignored.',373 'CNAME domain as an alternative to the IP address. Enter internationalized domain names in Punycode format. Note: If a CNAME domain is provided, the IP address and IPv6 address fields are ignored.', 392 374 'onartline-multisite-domain-mapping' 393 375 ); ?> … … 395 377 </td> 396 378 </tr> 397 398 379 399 380 <tr> … … 421 402 </table> 422 403 423 424 404 <?php submit_button( __( 'Save settings', 'onartline-multisite-domain-mapping' ) ); ?> 425 405 </form> … … 427 407 <?php 428 408 } 429 430 431 /** 409 /** 432 410 * Domain speichern 433 411 */ … … 435 413 check_admin_referer( 'omdm_save_domain' ); 436 414 437 438 415 if ( ! current_user_can( 'manage_network' ) ) { 439 416 wp_die( esc_html__( 'No permission.', 'onartline-multisite-domain-mapping' ) ); 440 417 } 441 442 418 443 419 $id = isset( $_POST['omdm_id'] ) ? (int) $_POST['omdm_id'] : 0; … … 447 423 $force_https = isset( $_POST['omdm_force_https'] ) ? 1 : 0; 448 424 449 450 425 if ( ! $blog_id || ! $domain ) { 451 426 wp_safe_redirect( network_admin_url( 'admin.php?page=onartline-multisite-domain-mapping-add&omdm_error=empty' ) ); … … 453 428 } 454 429 455 456 430 if ( ! preg_match( '/^[a-z0-9\-\.]+\.[a-z]{2,}$/', $domain ) ) { 457 431 wp_safe_redirect( network_admin_url( 'admin.php?page=onartline-multisite-domain-mapping-add&omdm_error=invalid' ) ); … … 459 433 } 460 434 461 462 435 $table = $this->db->base_prefix . 'omdm_domain_mapping'; 463 464 436 465 437 // Netzwerkweite Eindeutigkeitsprüfung: Domain darf nicht bereits einem anderen Eintrag zugeordnet sein. … … 471 443 ); 472 444 473 474 445 if ( $existing_id && (int) $existing_id !== $id ) { 475 446 wp_safe_redirect( network_admin_url( 'admin.php?page=onartline-multisite-domain-mapping-add&omdm_error=duplicate' ) ); 476 447 exit; 477 448 } 478 479 449 480 450 if ( $is_primary ) { … … 488 458 } 489 459 490 491 460 $data = [ 492 461 'blog_id' => $blog_id, … … 496 465 ]; 497 466 498 499 467 if ( $id ) { 500 468 $this->db->update( $table, $data, [ 'id' => $id ], [ '%d', '%s', '%d', '%d' ], [ '%d' ] ); … … 502 470 $data['is_reachable'] = 1; 503 471 504 505 472 $this->db->insert( $table, $data, [ '%d', '%s', '%d', '%d', '%d' ] ); 506 473 } 507 508 474 509 475 wp_safe_redirect( network_admin_url( 'admin.php?page=onartline-multisite-domain-mapping&omdm_success=1' ) ); … … 511 477 } 512 478 513 514 479 /** 515 480 * Domain löschen … … 518 483 $id = isset( $_GET['id'] ) ? (int) $_GET['id'] : 0; 519 484 520 521 485 if ( ! $id ) { 522 486 wp_die( esc_html__( 'No permission.', 'onartline-multisite-domain-mapping' ) ); 523 487 } 524 488 525 526 489 check_admin_referer( 'omdm_delete_domain_' . $id ); 527 528 490 529 491 if ( ! current_user_can( 'manage_network' ) ) { 530 492 wp_die( esc_html__( 'No permission.', 'onartline-multisite-domain-mapping' ) ); 531 493 } 532 533 494 534 495 $table = $this->db->base_prefix . 'omdm_domain_mapping'; … … 537 498 ); 538 499 539 540 500 $this->db->delete( $table, [ 'id' => $id ], [ '%d' ] ); 541 501 542 543 502 $domain_name = $mapping ? $mapping->domain : ''; 544 545 503 546 504 if ( $domain_name ) { … … 556 514 } 557 515 558 559 516 wp_safe_redirect( $redirect_url ); 560 517 exit; 561 518 } 562 519 520 /** 521 * Validiert eine kommagetrennte Liste von IP-Adressen. 522 * 523 * @param string $input Roh-Eingabe, kommagetrennt. 524 * @param int $filter_flag FILTER_FLAG_IPV4 oder FILTER_FLAG_IPV6. 525 * @return string|false Bereinigte, kommagetrennte Liste oder false bei ungültiger Eingabe. 526 */ 527 private function validate_ip_list( string $input, int $filter_flag ) { 528 $input = trim( $input ); 529 530 if ( '' === $input ) { 531 return ''; 532 } 533 534 $ips = array_map( 'trim', explode( ',', $input ) ); 535 $valid_ips = []; 536 537 foreach ( $ips as $ip ) { 538 if ( '' === $ip ) { 539 continue; 540 } 541 if ( ! filter_var( $ip, FILTER_VALIDATE_IP, $filter_flag ) ) { 542 return false; 543 } 544 $valid_ips[] = $ip; 545 } 546 547 return implode( ', ', $valid_ips ); 548 } 563 549 564 550 /** … … 568 554 check_admin_referer( 'omdm_save_settings' ); 569 555 570 571 556 if ( ! current_user_can( 'manage_network' ) ) { 572 557 wp_die( esc_html__( 'No permission.', 'onartline-multisite-domain-mapping' ) ); 573 558 } 574 575 559 576 560 update_site_option( 'omdm_force_https', isset( $_POST['omdm_force_https'] ) ); … … 579 563 update_site_option( 'omdm_delete_data_on_uninstall', isset( $_POST['omdm_delete_data_on_uninstall'] ) ); 580 564 581 582 $server_ip = isset( $_POST['omdm_server_ip'] ) 565 $server_ip_raw = isset( $_POST['omdm_server_ip'] ) 583 566 ? sanitize_text_field( wp_unslash( $_POST['omdm_server_ip'] ) ) 584 567 : ''; 585 568 586 587 $server_cname = isset( $_POST['omdm_server_cname'] ) 588 ? sanitize_text_field( wp_unslash( $_POST['omdm_server_cname'] ) ) 569 $server_ipv6_raw = isset( $_POST['omdm_server_ipv6'] ) 570 ? sanitize_text_field( wp_unslash( $_POST['omdm_server_ipv6'] ) ) 589 571 : ''; 590 572 573 $server_cname_raw = isset( $_POST['omdm_server_cname'] ) 574 ? strtolower( sanitize_text_field( wp_unslash( $_POST['omdm_server_cname'] ) ) ) 575 : ''; 576 577 $server_ip = $this->validate_ip_list( $server_ip_raw, FILTER_FLAG_IPV4 ); 578 $server_ipv6 = $this->validate_ip_list( $server_ipv6_raw, FILTER_FLAG_IPV6 ); 579 580 if ( false === $server_ip ) { 581 wp_safe_redirect( network_admin_url( 'admin.php?page=onartline-multisite-domain-mapping-settings&omdm_error=invalid_ip' ) ); 582 exit; 583 } 584 585 if ( false === $server_ipv6 ) { 586 wp_safe_redirect( network_admin_url( 'admin.php?page=onartline-multisite-domain-mapping-settings&omdm_error=invalid_ipv6' ) ); 587 exit; 588 } 589 590 $server_cname = ''; 591 592 if ( '' !== $server_cname_raw ) { 593 if ( ! preg_match( '/^[a-z0-9\-\.]+\.[a-z]{2,}$/', $server_cname_raw ) ) { 594 wp_safe_redirect( network_admin_url( 'admin.php?page=onartline-multisite-domain-mapping-settings&omdm_error=invalid_cname' ) ); 595 exit; 596 } 597 $server_cname = $server_cname_raw; 598 } 591 599 592 600 update_site_option( 'omdm_server_ip', $server_ip ); 601 update_site_option( 'omdm_server_ipv6', $server_ipv6 ); 593 602 update_site_option( 'omdm_server_cname', $server_cname ); 594 595 603 596 604 wp_safe_redirect( network_admin_url( 'admin.php?page=onartline-multisite-domain-mapping-settings&omdm_success=1' ) ); 597 605 exit; 598 606 } 599 /** 607 608 /** 600 609 * Admin-Hinweise (Erfolg/Fehler) anzeigen 601 610 * … … 613 622 <?php 614 623 } 615 616 624 617 625 // phpcs:ignore WordPress.Security.NonceVerification.Recommended -- Reine Anzeige-Parameter nach Redirect, keine Datenänderung. … … 642 650 <?php 643 651 } 644 645 652 646 653 // phpcs:ignore WordPress.Security.NonceVerification.Recommended -- Reine Anzeige-Parameter nach Redirect, keine Datenänderung. … … 665 672 } 666 673 667 668 674 // phpcs:ignore WordPress.Security.NonceVerification.Recommended -- Reine Anzeige-Parameter nach Redirect, keine Datenänderung. 669 675 if ( isset( $_GET['omdm_error'] ) ) { … … 671 677 $error = sanitize_text_field( wp_unslash( $_GET['omdm_error'] ) ); 672 678 673 674 679 $message = match ( $error ) { 675 'empty' => __( 'Please fill in all required fields.', 'onartline-multisite-domain-mapping' ), 676 'invalid' => __( 'Please enter a valid domain (e.g. example.com).', 'onartline-multisite-domain-mapping' ), 677 'duplicate' => __( 'This domain is already assigned to another site.', 'onartline-multisite-domain-mapping' ), 678 default => __( 'An error occurred. Please try again.', 'onartline-multisite-domain-mapping' ), 680 'empty' => __( 'Please fill in all required fields.', 'onartline-multisite-domain-mapping' ), 681 'invalid' => __( 'Please enter a valid domain (e.g. example.com).', 'onartline-multisite-domain-mapping' ), 682 'duplicate' => __( 'This domain is already assigned to another site.', 'onartline-multisite-domain-mapping' ), 683 'invalid_ip' => __( 'Please enter a valid IPv4 address (e.g. 192.168.1.1).', 'onartline-multisite-domain-mapping' ), 684 'invalid_ipv6' => __( 'Please enter a valid IPv6 address (e.g. 2001:db8::1).', 'onartline-multisite-domain-mapping' ), 685 'invalid_cname' => __( 'Please enter a valid CNAME domain (e.g. proxy.example.com).', 'onartline-multisite-domain-mapping' ), 686 default => __( 'An error occurred. Please try again.', 'onartline-multisite-domain-mapping' ), 679 687 }; 680 688 ?> -
onartline-multisite-domain-mapping/trunk/docs/README-DE.md
r3651261 r3657120 89 89 Richten Sie Ihre Domain auf Ihren Server aus, indem Sie folgende DNS-Einträge setzen: 90 90 91 - **A-Eintrag** – Name: `@` – Wert: Ihre Server-IP-Adresse 91 - **A-Eintrag** – Name: `@` – Wert: Die IPv4-Adresse Ihres Servers 92 - **AAAA-Eintrag** – Name: `@` – Wert: Die IPv6-Adresse Ihres Servers (optional, falls vorhanden) 92 93 - **CNAME-Eintrag** – Name: `www` – Wert: Ihre Primärdomain oder Server-CNAME 93 94 … … 124 125 ## Changelog 125 126 127 ### 1.0.1 128 - Fix: Cache-Invalidierung nach dem Speichern einer neuen Domain in den Website-Einstellungen korrigiert, sodass neu hinzugefügte Domains sofort korrekt aufgelöst werden. 129 - Fix: Parse Error durch doppelt definierte Methoden außerhalb der Klasse omdm_Login_Handler behoben. 130 - Fix: Domain-Zuordnung schließt Login-, AJAX- und REST-Anfragen nun korrekt aus. 131 - Fix: Standardwerte in set_default_options() korrigiert. 132 - New: IPv6-Unterstützung im DNS-Informationsfeld der Einstellungsseite ergänzt. 133 - New: Einheitliche Format-Validierung für IPv4, IPv6 und CNAME-Einträge eingeführt. 134 126 135 ### 1.0.0 127 136 - Erstveröffentlichung -
onartline-multisite-domain-mapping/trunk/docs/README-ES.md
r3651261 r3657120 89 89 Apunte su dominio a su servidor configurando los siguientes registros DNS: 90 90 91 - **Registro A** – Nombre: `@` – Valor: La dirección IP de su servidor 91 - **Registro A** – Nombre: `@` – Valor: La dirección IPv4 de su servidor 92 - **Registro AAAA** – Nombre: `@` – Valor: La dirección IPv6 de su servidor (opcional, si está disponible) 92 93 - **Registro CNAME** – Nombre: `www` – Valor: Su dominio principal o CNAME del servidor 93 94 … … 124 125 ## Registro de cambios 125 126 127 ### 1.0.1 128 - Corrección: Se corrigió la invalidación de caché tras guardar un nuevo dominio en la configuración del sitio, de modo que los dominios recién añadidos se resuelvan correctamente de inmediato. 129 - Corrección: Se solucionó un error de análisis (parse error) causado por métodos duplicados definidos fuera de la clase omdm_Login_Handler. 130 - Corrección: La asignación de dominios ahora excluye correctamente las solicitudes de inicio de sesión, AJAX y REST. 131 - Corrección: Se corrigieron los valores predeterminados en set_default_options(). 132 - Novedad: Se añadió soporte para IPv6 en el campo de información DNS de la página de configuración. 133 - Novedad: Se introdujo una validación de formato coherente para las entradas IPv4, IPv6 y CNAME. 134 126 135 ### 1.0.0 127 136 - Lanzamiento inicial -
onartline-multisite-domain-mapping/trunk/docs/README-FR.md
r3651261 r3657120 89 89 Faites pointer votre domaine vers votre serveur en configurant les enregistrements DNS suivants : 90 90 91 - **Enregistrement A** – Nom : `@` – Valeur : l'adresse IP de votre serveur 91 - **Enregistrement A** – Nom : `@` – Valeur : l'adresse IPv4 de votre serveur 92 - **Enregistrement AAAA** – Nom : `@` – Valeur : l'adresse IPv6 de votre serveur (facultatif, si disponible) 92 93 - **Enregistrement CNAME** – Nom : `www` – Valeur : votre domaine principal ou le CNAME du serveur 93 94 … … 124 125 ## Journal des modifications 125 126 127 ### 1.0.1 128 - Correction : Correction de l'invalidation du cache après l'enregistrement d'un nouveau domaine dans les paramètres du site, afin que les domaines nouvellement ajoutés soient résolus correctement dès leur ajout. 129 - Correction : Résolution d'une erreur d'analyse (parse error) causée par des méthodes dupliquées définies en dehors de la classe omdm_Login_Handler. 130 - Correction : L'attribution de domaines exclut désormais correctement les requêtes de connexion, AJAX et REST. 131 - Correction : Correction des valeurs par défaut dans set_default_options(). 132 - Nouveauté : Ajout de la prise en charge de l'IPv6 dans le champ d'informations DNS de la page des paramètres. 133 - Nouveauté : Introduction d'une validation de format cohérente pour les entrées IPv4, IPv6 et CNAME. 134 126 135 ### 1.0.0 127 136 - Version initiale -
onartline-multisite-domain-mapping/trunk/docs/README-IT.md
r3651261 r3657120 89 89 Punta il tuo dominio al tuo server impostando i seguenti record DNS: 90 90 91 - **Record A** – Nome: `@` – Valore: l'indirizzo IP del tuo server 91 - **Record A** – Nome: `@` – Valore: l'indirizzo IPv4 del tuo server 92 - **Record AAAA** – Nome: `@` – Valore: l'indirizzo IPv6 del tuo server (opzionale, se disponibile) 92 93 - **Record CNAME** – Nome: `www` – Valore: il tuo dominio principale o il CNAME del server 93 94 … … 124 125 ## Changelog 125 126 127 ### 1.0.1 128 - Correzione: Corretta l'invalidazione della cache dopo il salvataggio di un nuovo dominio nelle impostazioni del sito, in modo che i domini appena aggiunti vengano risolti correttamente da subito. 129 - Correzione: Risolto un errore di analisi (parse error) causato da metodi duplicati definiti fuori dalla classe omdm_Login_Handler. 130 - Correzione: L'assegnazione dei domini ora esclude correttamente le richieste di accesso, AJAX e REST. 131 - Correzione: Corretti i valori predefiniti in set_default_options(). 132 - Novità: Aggiunto il supporto IPv6 nel campo delle informazioni DNS nella pagina delle impostazioni. 133 - Novità: Introdotta una validazione del formato coerente per le voci IPv4, IPv6 e CNAME. 134 126 135 ### 1.0.0 127 136 - Rilascio iniziale -
onartline-multisite-domain-mapping/trunk/docs/README-NL.md
r3651261 r3657120 89 89 Wijs uw domein naar uw server door de volgende DNS-records in te stellen: 90 90 91 - **A-record** – Naam: `@` – Waarde: het IP-adres van uw server 91 - **A-record** – Naam: `@` – Waarde: het IPv4-adres van uw server 92 - **AAAA-record** – Naam: `@` – Waarde: het IPv6-adres van uw server (optioneel, indien beschikbaar) 92 93 - **CNAME-record** – Naam: `www` – Waarde: uw primaire domein of server-CNAME 93 94 … … 124 125 ## Changelog 125 126 127 ### 1.0.1 128 - Fix: Cache-invalidatie na het opslaan van een nieuw domein in de site-instellingen gecorrigeerd, zodat nieuw toegevoegde domeinen direct correct worden opgelost. 129 - Fix: Parse error opgelost die werd veroorzaakt door dubbele methoden gedefinieerd buiten de klasse omdm_Login_Handler. 130 - Fix: Domeintoewijzing sluit nu correct login-, AJAX- en REST-verzoeken uit. 131 - Fix: Standaardwaarden in set_default_options() gecorrigeerd. 132 - Nieuw: IPv6-ondersteuning toegevoegd aan het DNS-informatieveld op de instellingenpagina. 133 - Nieuw: Consistente formaatvalidatie geïntroduceerd voor IPv4-, IPv6- en CNAME-invoer. 134 126 135 ### 1.0.0 127 136 - Eerste release -
onartline-multisite-domain-mapping/trunk/docs/README-PT-BR.md
r3651261 r3657120 89 89 Aponte seu domínio para o seu servidor configurando os seguintes registros DNS: 90 90 91 - **Registro A** – Nome: `@` – Valor: o endereço IP do seu servidor 91 - **Registro A** – Nome: `@` – Valor: o endereço IPv4 do seu servidor 92 - **Registro AAAA** – Nome: `@` – Valor: o endereço IPv6 do seu servidor (opcional, se disponível) 92 93 - **Registro CNAME** – Nome: `www` – Valor: seu domínio principal ou o CNAME do servidor 93 94 … … 124 125 ## Changelog 125 126 127 ### 1.0.1 128 - Correção: Corrigida a invalidação de cache após salvar um novo domínio nas configurações do site, para que os domínios recém-adicionados sejam resolvidos corretamente de imediato. 129 - Correção: Resolvido um erro de análise (parse error) causado por métodos duplicados definidos fora da classe omdm_Login_Handler. 130 - Correção: O mapeamento de domínios agora exclui corretamente as solicitações de login, AJAX e REST. 131 - Correção: Corrigidos os valores padrão em set_default_options(). 132 - Novo: Adicionado suporte a IPv6 no campo de informações de DNS na página de configurações. 133 - Novo: Introduzida uma validação de formato consistente para entradas IPv4, IPv6 e CNAME. 134 126 135 ### 1.0.0 127 136 - Lançamento inicial -
onartline-multisite-domain-mapping/trunk/docs/README-PT.md
r3651261 r3657120 89 89 Aponte o seu domínio para o seu servidor configurando os seguintes registos DNS: 90 90 91 - **Registo A** – Nome: `@` – Valor: o endereço IP do seu servidor 91 - **Registo A** – Nome: `@` – Valor: o endereço IPv4 do seu servidor 92 - **Registo AAAA** – Nome: `@` – Valor: o endereço IPv6 do seu servidor (opcional, se disponível) 92 93 - **Registo CNAME** – Nome: `www` – Valor: o seu domínio principal ou o CNAME do servidor 93 94 … … 124 125 ## Changelog 125 126 127 ### 1.0.1 128 - Correção: Corrigida a invalidação de cache após guardar um novo domínio nas definições do site, para que os domínios recém-adicionados sejam resolvidos corretamente de imediato. 129 - Correção: Resolvido um erro de análise (parse error) causado por métodos duplicados definidos fora da classe omdm_Login_Handler. 130 - Correção: O mapeamento de domínios agora exclui corretamente os pedidos de início de sessão, AJAX e REST. 131 - Correção: Corrigidos os valores predefinidos em set_default_options(). 132 - Novo: Adicionado suporte a IPv6 no campo de informações de DNS na página de definições. 133 - Novo: Introduzida uma validação de formato consistente para entradas IPv4, IPv6 e CNAME. 134 126 135 ### 1.0.0 127 136 - Lançamento inicial -
onartline-multisite-domain-mapping/trunk/includes/class-omdm-activator.php
r3630157 r3657120 9 9 */ 10 10 11 11 12 if ( ! defined( 'ABSPATH' ) ) { 12 13 exit; 13 14 } 14 15 16 15 17 class omdm_Activator { 16 18 19 17 20 /** 18 21 * Marker, der die sunrise.php als vom Plugin verwaltet kennzeichnet. 19 22 */ 20 23 const SUNRISE_MARKER = 'omdm_SUNRISE_MARKER'; 24 21 25 22 26 /** … … 26 30 const CUSTOM_MARKER = 'omdm_CUSTOM_SUNRISE_MARKER'; 27 31 32 28 33 /** 29 34 * Wird bei Plugin-Aktivierung aufgerufen. 30 35 */ 31 36 public static function activate(): void { 37 32 38 33 39 // ── Multisite-Voraussetzung prüfen ──────────────────────────────────── … … 37 43 } 38 44 45 39 46 // ── Alte Transients bereinigen ──────────────────────────────────────── 40 47 self::clear_sunrise_transients(); 41 48 49 42 50 // ── Datenbank-Tabellen anlegen ──────────────────────────────────────── 43 51 self::create_tables(); 44 52 53 45 54 // ── Standard-Optionen setzen ────────────────────────────────────────── 46 55 self::set_default_options(); 47 56 57 48 58 // ── WP_Filesystem initialisieren ────────────────────────────────────── 49 59 require_once ABSPATH . 'wp-admin/includes/file.php'; 50 60 61 51 62 if ( ! WP_Filesystem() ) { 52 63 set_transient( 'omdm_sunrise_not_writable', true, 300 ); … … 54 65 } 55 66 67 56 68 global $wp_filesystem; 69 57 70 58 71 $source = plugin_dir_path( dirname( __FILE__ ) ) . 'sunrise.php'; 59 72 $destination = WP_CONTENT_DIR . '/sunrise.php'; 73 60 74 61 75 // sunrise.php bereits vorhanden → Herkunft und Version prüfen … … 63 77 $existing_content = $wp_filesystem->get_contents( $destination ); 64 78 79 65 80 if ( false !== $existing_content && false !== strpos( $existing_content, self::SUNRISE_MARKER ) ) { 81 66 82 67 83 // Individuell angepasste sunrise.php → nicht anfassen. … … 71 87 } 72 88 89 73 90 // Eigene, unveränderte sunrise.php – Version vergleichen. 74 91 $source_content = $wp_filesystem->exists( $source ) … … 76 93 : false; 77 94 95 78 96 $existing_version = self::get_sunrise_marker_version( $existing_content ); 79 97 $source_version = $source_content ? self::get_sunrise_marker_version( $source_content ) : '0'; 98 80 99 81 100 if ( false !== $source_content && version_compare( $source_version, $existing_version, '>' ) ) { … … 95 114 } 96 115 116 97 117 if ( ! $wp_filesystem->exists( $source ) ) { 98 118 set_transient( 'omdm_sunrise_source_missing', true, 300 ); … … 100 120 } 101 121 122 102 123 if ( ! $wp_filesystem->is_writable( WP_CONTENT_DIR ) ) { 103 124 set_transient( 'omdm_sunrise_not_writable', true, 300 ); 104 125 return; 105 126 } 127 106 128 107 129 if ( $wp_filesystem->copy( $source, $destination, true ) ) { … … 112 134 } 113 135 } 136 114 137 115 138 /** … … 126 149 } 127 150 151 128 152 require_once ABSPATH . 'wp-admin/includes/plugin.php'; 129 153 154 130 155 $plugin_file = plugin_basename( plugin_dir_path( dirname( __FILE__ ) ) . 'onartline-multisite-domain-mapping.php' ); 156 131 157 132 158 if ( is_plugin_active( $plugin_file ) ) { … … 134 160 } 135 161 } 162 136 163 137 164 /** … … 152 179 ); 153 180 181 154 182 foreach ( $transients as $transient ) { 155 183 delete_transient( $transient ); 156 184 } 157 185 } 186 158 187 159 188 /** … … 165 194 } 166 195 return '0'; 167 } /** 196 } 197 198 199 /** 168 200 * Datenbank-Tabellen erstellen. 169 201 */ … … 172 204 require_once ABSPATH . 'wp-admin/includes/upgrade.php'; 173 205 206 174 207 $charset = $wpdb->get_charset_collate(); 175 208 $prefix = $wpdb->base_prefix; 209 176 210 177 211 $sql1 = "CREATE TABLE {$prefix}omdm_domain_mapping ( … … 187 221 KEY domain (domain) 188 222 ) $charset;"; 223 189 224 190 225 $sql2 = "CREATE TABLE {$prefix}omdm_login_tokens ( … … 202 237 ) $charset;"; 203 238 239 204 240 dbDelta( $sql1 ); 205 241 dbDelta( $sql2 ); 206 242 } 243 207 244 208 245 /** … … 213 250 add_site_option( 'omdm_version', omdm_VERSION ); 214 251 } 215 if ( false === get_site_option( 'omdm_ https_redirect' ) ) {216 add_site_option( 'omdm_ https_redirect', 0 );252 if ( false === get_site_option( 'omdm_force_https' ) ) { 253 add_site_option( 'omdm_force_https', 0 ); 217 254 } 218 255 if ( false === get_site_option( 'omdm_301_redirect' ) ) { 219 256 add_site_option( 'omdm_301_redirect', 0 ); 220 257 } 258 if ( false === get_site_option( 'omdm_allow_site_mapping' ) ) { 259 add_site_option( 'omdm_allow_site_mapping', 0 ); 260 } 221 261 if ( false === get_site_option( 'omdm_delete_data_on_uninstall' ) ) { 222 262 add_site_option( 'omdm_delete_data_on_uninstall', 0 ); 223 263 } 224 } 225 264 if ( false === get_site_option( 'omdm_server_ip' ) ) { 265 add_site_option( 'omdm_server_ip', '' ); 266 } 267 if ( false === get_site_option( 'omdm_server_ipv6' ) ) { 268 add_site_option( 'omdm_server_ipv6', '' ); 269 } 270 if ( false === get_site_option( 'omdm_server_cname' ) ) { 271 add_site_option( 'omdm_server_cname', '' ); 272 } 273 } 226 274 /** 227 275 * Prüft dynamisch, ob SUNRISE bereits korrekt in der wp-config.php … … 237 285 . '</p>'; 238 286 } 287 239 288 240 289 return '<p><strong>' . esc_html__( 'Note:', 'onartline-multisite-domain-mapping' ) . '</strong> ' … … 253 302 $source = plugin_dir_path( dirname( __FILE__ ) ) . 'sunrise.php'; 254 303 304 255 305 if ( ! file_exists( $source ) ) { 256 306 return ''; 257 307 } 308 258 309 259 310 return '<p>' . sprintf( … … 267 318 } 268 319 320 269 321 /** 270 322 * Erstellt die abgesicherte URL für den "Installation fortsetzen"-Button. … … 277 329 } 278 330 331 279 332 /** 280 333 * Wird aufgerufen, wenn der Nutzer im Admin-Notice auf … … 284 337 check_admin_referer( 'omdm_retry_sunrise_install' ); 285 338 339 286 340 if ( ! current_user_can( 'manage_network_options' ) ) { 287 341 wp_die( esc_html__( 'No permission.', 'onartline-multisite-domain-mapping' ) ); 288 342 } 289 343 344 290 345 self::activate(); 346 291 347 292 348 $redirect = wp_get_referer() ? wp_get_referer() : network_admin_url( 'plugins.php' ); 293 349 wp_safe_redirect( $redirect ); 294 350 exit; 295 } /** 351 } 352 353 354 /** 296 355 * Admin-Notices nach Aktivierung anzeigen. 297 356 */ 298 357 public static function activation_notices(): void { 358 299 359 300 360 if ( get_transient( 'omdm_requires_multisite' ) ) { … … 310 370 } 311 371 372 312 373 if ( get_transient( 'omdm_sunrise_copied' ) ) { 313 374 delete_transient( 'omdm_sunrise_copied' ); … … 324 385 } 325 386 387 326 388 if ( get_transient( 'omdm_sunrise_updated' ) ) { 327 389 delete_transient( 'omdm_sunrise_updated' ); … … 337 399 return; 338 400 } 401 339 402 340 403 if ( get_transient( 'omdm_sunrise_update_failed' ) ) { … … 358 421 } 359 422 423 360 424 // ── Individuell angepasste sunrise.php erkannt ──────────────────────── 361 425 if ( get_transient( 'omdm_sunrise_custom_detected' ) ) { … … 373 437 } 374 438 439 375 440 if ( get_transient( 'omdm_sunrise_foreign_exists' ) ) { 376 441 delete_transient( 'omdm_sunrise_foreign_exists' ); … … 392 457 return; 393 458 } 459 394 460 395 461 if ( get_transient( 'omdm_sunrise_not_writable' ) ) { … … 423 489 } 424 490 491 425 492 if ( get_transient( 'omdm_sunrise_source_missing' ) ) { 426 493 delete_transient( 'omdm_sunrise_source_missing' ); … … 434 501 return; 435 502 } 503 436 504 437 505 if ( get_transient( 'omdm_sunrise_copy_failed' ) ) { … … 459 527 } 460 528 529 461 530 if ( get_transient( 'omdm_sunrise_already_exists' ) ) { 462 531 delete_transient( 'omdm_sunrise_already_exists' ); -
onartline-multisite-domain-mapping/trunk/includes/class-omdm-domain-mapper.php
r3630157 r3657120 6 6 */ 7 7 8 8 9 if ( ! defined( 'ABSPATH' ) ) { 9 10 exit; 10 11 } 11 12 13 12 14 class omdm_Domain_Mapper { 13 15 16 14 17 private wpdb $db; 15 18 19 16 20 /** 17 21 * Cache-Gruppe für Domain-Mapping-Abfragen. … … 19 23 private const CACHE_GROUP = 'omdm_domain_mapping'; 20 24 25 21 26 /** 22 27 * Cache-Dauer in Sekunden (1 Stunde). 23 28 */ 24 29 private const CACHE_TTL = HOUR_IN_SECONDS; 30 25 31 26 32 public function __construct() { … … 29 35 } 30 36 37 31 38 /** 32 39 * Domain dem richtigen Site zuordnen 33 40 */ 34 41 public function map_domain(): void { 35 if ( is_admin() ) { 36 return; 37 } 42 if ( is_admin() || wp_doing_ajax() || ( defined( 'REST_REQUEST' ) && REST_REQUEST ) ) { 43 return; 44 } 45 46 47 // wp-login.php ausnehmen, damit POST-Daten (z. B. beim Login) durch 48 // eine 301-Weiterleitung nicht verloren gehen. 49 if ( isset( $GLOBALS['pagenow'] ) && 'wp-login.php' === $GLOBALS['pagenow'] ) { 50 return; 51 } 52 38 53 39 54 $current_domain = $this->get_current_domain(); 40 55 $mapping = $this->get_mapping_by_domain( $current_domain ); 41 56 57 42 58 if ( ! $mapping ) { 43 59 return; 44 60 } 61 45 62 46 63 $this->maybe_redirect_to_primary( $mapping ); 47 64 $this->maybe_redirect_to_https( $mapping ); 48 65 } 66 49 67 50 68 /** … … 56 74 } 57 75 76 58 77 $primary = $this->get_primary_domain( $blog_id ); 78 59 79 60 80 if ( ! $primary ) { … … 62 82 } 63 83 84 64 85 return $this->replace_domain_in_url( $url, $primary, $scheme ); 65 86 } 87 66 88 67 89 /** … … 73 95 } 74 96 97 75 98 $primary = $this->get_primary_domain( $blog_id ); 99 76 100 77 101 if ( ! $primary ) { … … 79 103 } 80 104 105 81 106 return $this->replace_domain_in_url( $url, $primary, $scheme ); 82 107 } 108 83 109 84 110 /** … … 90 116 } 91 117 118 92 119 /** 93 120 * Mapping anhand Domain aus DB holen (mit Object-Cache). … … 97 124 $cached = wp_cache_get( $cache_key, self::CACHE_GROUP, false, $found ); 98 125 126 99 127 if ( $found ) { 100 128 return $cached ?: null; 101 129 } 102 130 131 103 132 $table = $this->db->base_prefix . 'omdm_domain_mapping'; 133 104 134 105 135 // phpcs:ignore WordPress.DB.DirectDatabaseQuery.DirectQuery -- Ergebnis wird im Object-Cache gehalten, daher kein zusätzliches Caching-Tag nötig. … … 112 142 ); 113 143 144 114 145 wp_cache_set( $cache_key, $mapping, self::CACHE_GROUP, self::CACHE_TTL ); 115 146 147 116 148 return $mapping; 117 149 } 118 150 151 119 152 /** 120 153 * Primary Domain eines Sites holen (mit Object-Cache). 121 154 */ 122 p rivatefunction get_primary_domain( int $blog_id ): ?object {155 public function get_primary_domain( int $blog_id ): ?object { 123 156 $cache_key = 'primary_' . $blog_id; 124 157 $cached = wp_cache_get( $cache_key, self::CACHE_GROUP, false, $found ); 125 158 159 126 160 if ( $found ) { 127 161 return $cached ?: null; 128 162 } 129 163 164 130 165 $table = $this->db->base_prefix . 'omdm_domain_mapping'; 166 131 167 132 168 // phpcs:ignore WordPress.DB.DirectDatabaseQuery.DirectQuery -- Ergebnis wird im Object-Cache gehalten, daher kein zusätzliches Caching-Tag nötig. … … 139 175 ); 140 176 177 141 178 wp_cache_set( $cache_key, $primary, self::CACHE_GROUP, self::CACHE_TTL ); 142 179 180 143 181 return $primary; 144 182 } 145 183 184 146 185 /** 147 186 * Cache für eine bestimmte Domain und/oder einen Blog invalidieren. 148 * Wird von class- wsdm-network-admin.php nach save/delete aufgerufen.187 * Wird von class-omdm-network-admin.php nach save/delete aufgerufen. 149 188 */ 150 189 public static function invalidate_cache( ?string $domain = null, ?int $blog_id = null ): void { … … 153 192 } 154 193 194 155 195 if ( $blog_id ) { 156 196 wp_cache_delete( 'primary_' . $blog_id, self::CACHE_GROUP ); 157 197 } 158 198 } 159 160 /** 199 /** 161 200 * Auf Primary Domain weiterleiten falls nötig 162 201 */ … … 166 205 } 167 206 207 168 208 $redirect_enabled = get_site_option( 'omdm_301_redirect', false ); 169 209 210 170 211 if ( ! $redirect_enabled ) { 171 212 return; 172 213 } 173 214 215 174 216 $primary = $this->get_primary_domain( (int) $mapping->blog_id ); 175 217 218 176 219 if ( ! $primary ) { 177 220 return; 178 221 } 222 179 223 180 224 $current_domain = $this->get_current_domain(); … … 182 226 return; 183 227 } 228 184 229 185 230 $scheme = $primary->https ? 'https' : 'http'; … … 187 232 $target = $scheme . '://' . $primary->domain . $request_uri; 188 233 234 189 235 wp_redirect( esc_url_raw( $target ), 301 ); // phpcs:ignore WordPress.Security.SafeRedirect.wp_redirect_wp_redirect -- gezielte Weiterleitung auf gemappte Domain. 190 236 exit; 191 237 } 238 192 239 193 240 /** … … 198 245 $force_https_domain = (bool) $mapping->https; 199 246 247 200 248 if ( ! $force_https_global && ! $force_https_domain ) { 201 249 return; 202 250 } 251 203 252 204 253 $https_header = isset( $_SERVER['HTTPS'] ) ? sanitize_text_field( wp_unslash( $_SERVER['HTTPS'] ) ) : ''; 205 254 $forwarded_proto = isset( $_SERVER['HTTP_X_FORWARDED_PROTO'] ) ? sanitize_text_field( wp_unslash( $_SERVER['HTTP_X_FORWARDED_PROTO'] ) ) : ''; 255 206 256 207 257 $is_https = ( 'on' === $https_header ) … … 209 259 || ( isset( $_SERVER['SERVER_PORT'] ) && 443 === (int) $_SERVER['SERVER_PORT'] ); 210 260 261 211 262 if ( $is_https ) { 212 263 return; 213 264 } 265 214 266 215 267 $request_uri = isset( $_SERVER['REQUEST_URI'] ) ? sanitize_text_field( wp_unslash( $_SERVER['REQUEST_URI'] ) ) : '/'; 216 268 $target = 'https://' . $mapping->domain . $request_uri; 217 269 270 218 271 wp_redirect( esc_url_raw( $target ), 301 ); // phpcs:ignore WordPress.Security.SafeRedirect.wp_redirect_wp_redirect -- gezielte Weiterleitung auf gemappte Domain. 219 272 exit; 220 273 } 221 274 275 222 276 /** 223 277 * Domain in URL ersetzen … … 226 280 $parsed = wp_parse_url( $url ); 227 281 282 228 283 if ( ! isset( $parsed['host'] ) ) { 229 284 return $url; 230 285 } 231 286 287 232 288 $new_scheme = $scheme ?? $parsed['scheme'] ?? 'https'; 289 233 290 234 291 if ( $primary->https || get_site_option( 'omdm_force_https', false ) ) { … … 236 293 } 237 294 295 238 296 $new_url = $new_scheme . '://' . $primary->domain; 239 297 $new_url .= $parsed['path'] ?? ''; 240 298 299 241 300 if ( ! empty( $parsed['query'] ) ) { 242 301 $new_url .= '?' . $parsed['query']; 243 302 } 244 303 304 245 305 if ( ! empty( $parsed['fragment'] ) ) { 246 306 $new_url .= '#' . $parsed['fragment']; 247 307 } 248 308 309 249 310 return $new_url; 250 311 } -
onartline-multisite-domain-mapping/trunk/includes/class-omdm-loader.php
r3630157 r3657120 7 7 */ 8 8 9 9 10 if ( ! defined( 'ABSPATH' ) ) { 10 11 exit; 11 12 } 12 13 14 13 15 class omdm_Loader { 16 14 17 15 18 protected array $actions = []; … … 19 22 private string $version; 20 23 24 21 25 public function __construct( string $plugin_name, string $version ) { 22 26 $this->plugin_name = $plugin_name; 23 27 $this->version = $version; 24 28 29 25 30 $this->register_hooks(); 26 31 } 32 27 33 28 34 /** … … 31 37 private function register_hooks(): void { 32 38 39 33 40 // Domain Mapper 34 41 $this->add_action( 'init', omdm_Domain_Mapper::class, 'map_domain' ); 35 42 $this->add_filter( 'site_url', omdm_Domain_Mapper::class, 'filter_site_url', 10, 4 ); 36 43 $this->add_filter( 'home_url', omdm_Domain_Mapper::class, 'filter_home_url', 10, 4 ); 44 37 45 38 46 // Login Handler … … 43 51 $this->add_filter( 'admin_url', omdm_Login_Handler::class, 'filter_admin_url', 10, 3 ); 44 52 53 45 54 // Cron Handler 46 55 $this->add_action( 'omdm_domain_check', omdm_Cron_Handler::class, 'run_domain_check' ); 56 47 57 48 58 // Network Admin – lazy, Hook-basiert … … 52 62 $this->add_action( 'network_admin_edit_omdm_save_settings', $this, 'load_network_admin' ); 53 63 64 54 65 // Activator Notices 55 66 if ( class_exists( 'omdm_Activator' ) ) { … … 57 68 } 58 69 } 70 59 71 60 72 /** … … 64 76 static $network_admin = null; 65 77 78 66 79 if ( null === $network_admin ) { 67 80 $network_admin = new omdm_Network_Admin( $this->plugin_name, $this->version ); 68 81 } 82 69 83 70 84 match ( current_action() ) { … … 76 90 }; 77 91 } 92 78 93 79 94 /** … … 87 102 } 88 103 104 89 105 if ( ! isset( $this->instances[ $component ] ) ) { 90 $this->instances[ $component ] = new $component();106 $this->instances[ $component ] = $this->instantiate_component( $component ); 91 107 } 108 92 109 93 110 return $this->instances[ $component ]; 94 111 } 112 /** 113 * Erzeugt eine Komponente inklusive ihrer benötigten Abhängigkeiten. 114 * 115 * @param string $component Vollqualifizierter Klassenname. 116 */ 117 private function instantiate_component( string $component ): object { 118 if ( omdm_Login_Handler::class === $component ) { 119 $domain_mapper = $this->resolve_component( omdm_Domain_Mapper::class ); 120 return new omdm_Login_Handler( $domain_mapper ); 121 } 122 123 124 return new $component(); 125 } 126 95 127 96 128 private function add_action( … … 104 136 } 105 137 138 106 139 private function add_filter( 107 140 string $hook, … … 113 146 $this->filters[] = compact( 'hook', 'component', 'callback', 'priority', 'accepted_args' ); 114 147 } 148 115 149 116 150 /** … … 132 166 } 133 167 168 134 169 foreach ( $this->filters as $filter ) { 135 170 add_filter( -
onartline-multisite-domain-mapping/trunk/includes/class-omdm-login-handler.php
r3630157 r3657120 137 137 $uri = isset( $_SERVER['REQUEST_URI'] ) ? sanitize_text_field( wp_unslash( $_SERVER['REQUEST_URI'] ) ) : ''; 138 138 $uri = remove_query_arg( 'omdm_token', $uri ); 139 $redirect = $scheme . '://' . $host . $uri;139 $redirect = esc_url_raw( $scheme . '://' . $host . $uri ); 140 140 } 141 141 -
onartline-multisite-domain-mapping/trunk/includes/class-omdm-plugin.php
r3630157 r3657120 17 17 protected omdm_Loader $loader; 18 18 protected string $plugin_name = 'onartline-multisite-domain-mapping'; 19 protected string $version = '1.0. 0';19 protected string $version = '1.0.1'; 20 20 21 21 -
onartline-multisite-domain-mapping/trunk/includes/class-omdm-site-settings.php
r3630157 r3657120 207 207 } 208 208 209 omdm_Domain_Mapper::invalidate_cache( $domain, $site_id ); 210 209 211 wp_safe_redirect( add_query_arg( 'omdm_saved', '1', admin_url( 'admin.php?page=omdm-site-settings' ) ) ); 210 212 exit; -
onartline-multisite-domain-mapping/trunk/languages/onartline-multisite-domain-mapping.pot
r3630157 r3657120 4 4 msgid "" 5 5 msgstr "" 6 "Project-Id-Version: Onartline Multisite Domain Mapping 1.0. 0\n"6 "Project-Id-Version: Onartline Multisite Domain Mapping 1.0.1\n" 7 7 "Report-Msgid-Bugs-To: https://wordpress.org/support/plugin/onartline-multisite-domain-mapping\n" 8 "POT-Creation-Date: 2026-0 7-1900:00+0000\n"9 "PO-Revision-Date: 2026-07-19 00:00+0000\n"8 "POT-Creation-Date: 2026-08-20 00:00+0000\n" 9 "PO-Revision-Date: YEAR-MO-DA HO:MI+ZONE\n" 10 10 "Last-Translator: \n" 11 11 "Language-Team: \n" … … 109 109 # --- Network Admin – Menu --- 110 110 111 #: admin/class-omdm-network-admin.php 111 #: admin/class-omdm-network-admin.php includes/class-omdm-site-settings.php 112 112 msgid "Domain Mapping" 113 113 msgstr "" … … 279 279 280 280 #: admin/class-omdm-network-admin.php 281 msgid "IP address for the DNS A record. Enter multiple IPs comma-separated (e.g. for round-robin DNS)."281 msgid "IPv4 address for the DNS A record. Enter multiple IPs comma-separated (e.g. for round-robin DNS)." 282 282 msgstr "" 283 283 … … 291 291 292 292 #: admin/class-omdm-network-admin.php 293 msgid "CNAME domain as an alternative to the IP address. Enter internationalized domain names in Punycode format. Note: If a CNAME domain is provided, the IP address is ignored." 293 msgid "CNAME domain as an alternative to the IP address. Enter internationalized domain names in Punycode format. Note: If a CNAME domain is provided, the IP address and IPv6 address fields are ignored." 294 msgstr "" 295 296 #: admin/class-omdm-network-admin.php 297 msgid "Server IPv6 address" 298 msgstr "" 299 300 #: admin/class-omdm-network-admin.php 301 msgid "e.g. 2001:db8::1 or multiple, comma-separated" 302 msgstr "" 303 304 #: admin/class-omdm-network-admin.php 305 msgid "IPv6 address for the DNS AAAA record. Enter multiple IPs comma-separated (e.g. for round-robin DNS). Leave empty if IPv6 is not supported by your server." 306 msgstr "" 307 308 #: admin/class-omdm-network-admin.php 309 msgid "Please enter a valid IPv4 address (e.g. 192.168.1.1)." 310 msgstr "" 311 312 #: admin/class-omdm-network-admin.php 313 msgid "Please enter a valid IPv6 address (e.g. 2001:db8::1)." 314 msgstr "" 315 316 #: admin/class-omdm-network-admin.php 317 msgid "Please enter a valid CNAME domain (e.g. proxy.example.com)." 294 318 msgstr "" 295 319 … … 370 394 371 395 #: includes/class-omdm-site-settings.php 372 msgid "Domain Mapping"373 msgstr ""374 375 #: includes/class-omdm-site-settings.php376 396 msgid "Your Mapped Domains" 377 397 msgstr "" -
onartline-multisite-domain-mapping/trunk/onartline-multisite-domain-mapping.php
r3630157 r3657120 4 4 * Plugin URI: https://wordpress.org/plugins/onartline-multisite-domain-mapping 5 5 * Description: Map domains to sites in a WordPress Multisite network. Requires PHP 8.3+ and WordPress 7.0+. 6 * Version: 1.0. 06 * Version: 1.0.1 7 7 * Requires at least: 7.0 8 8 * Requires PHP: 8.3 … … 22 22 // ── Plugin-Konstanten ───────────────────────────────────────────────────────── 23 23 24 define( 'omdm_VERSION', '1.0. 0' );24 define( 'omdm_VERSION', '1.0.1' ); 25 25 define( 'omdm_DB_VERSION', '1.0.0' ); 26 26 define( 'omdm_PLUGIN_DIR', plugin_dir_path( __FILE__ ) );
Note:
See TracChangeset
for help on using the changeset viewer.
![(please configure the [header_logo] section in trac.ini)](/chrome/site/your_project_logo.png)