Plugin Directory

Changeset 3657120


Ignore:
Timestamp:
08/20/2026 02:40:13 PM (2 months ago)
Author:
onartline
Message:

Update trunk to version 1.0.1

Location:
onartline-multisite-domain-mapping/trunk
Files:
18 edited

Legend:

Unmodified
Added
Removed
  • onartline-multisite-domain-mapping/trunk/README.md

    r3651261 r3657120  
    8989Point your domain to your server by setting the following DNS records:
    9090
    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)
    9293- **CNAME Record** – Name: `www` – Value: Your primary domain or server CNAME
    9394
    … …  
    124125## Changelog
    125126
     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
    126135### 1.0.0
    127136- Initial release
  • onartline-multisite-domain-mapping/trunk/README.txt

    r3651261 r3657120  
    55Requires at least: 7.0
    66Tested up to: 7.1
    7 Stable tag: 1.0.0
     7Stable tag: 1.0.1
    88Requires PHP: 8.3
    99License: GPLv2 or later
    … …  
    114114= 7. Configure DNS =
    115115
    116 
    117116Point your domain to your server by setting the following DNS records:
    118117
    119 
    120 * **A Record** – Name: `@` – Value: Your server IP address
     118* **A Record** – Name: `@` – Value: Your server's IPv4 address
     119* **AAAA Record** – Name: `@` – Value: Your server's IPv6 address (optional, if available)
    121120* **CNAME Record** – Name: `www` – Value: Your primary domain or server CNAME
    122 
    123121
    124122The required values are displayed in **Network Admin → Domain Mapping → Settings**.
    … …  
    167165== Changelog ==
    168166
     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.
    169174
    170175= 1.0.0 =
  • onartline-multisite-domain-mapping/trunk/admin/class-omdm-network-admin.php

    r3630157 r3657120  
    66 */
    77
    8 
    98if ( ! defined( 'ABSPATH' ) ) {
    109    exit;
    1110}
    1211
    13 
    1412class omdm_Network_Admin {
    15 
    1613
    1714    private string $plugin_name;
    … …  
    1916    private wpdb   $db;
    2017
    21 
    2218    public function __construct( string $plugin_name, string $version ) {
    2319        $this->plugin_name = $plugin_name;
    2420        $this->version     = $version;
    2521
    26 
    2722        global $wpdb;
    2823        $this->db = $wpdb;
    2924    }
    30 
    3125
    3226    /**
    … …  
    4438        );
    4539
    46 
    4740        add_submenu_page(
    4841            'onartline-multisite-domain-mapping',
    … …  
    5447        );
    5548
    56 
    5749        add_submenu_page(
    5850            'onartline-multisite-domain-mapping',
    … …  
    6456        );
    6557
    66 
    6758        add_submenu_page(
    6859            'onartline-multisite-domain-mapping',
    … …  
    7465        );
    7566
    76 
    7767        add_action(
    7868            'load-toplevel_page_onartline-multisite-domain-mapping',
    … …  
    8070        );
    8171    }
    82 
    8372
    8473    /**
    … …  
    9584        }
    9685
    97 
    9886        $action = '';
    99 
    10087
    10188        if ( isset( $_POST['action'] ) ) {
    … …  
    11299            }
    113100        }
    114 
    115101
    116102        if (
    … …  
    123109            }
    124110
    125 
    126111            $ids     = array_map( 'intval', wp_unslash( $_POST['domain_ids'] ) );
    127112            $table   = $this->db->base_prefix . 'omdm_domain_mapping';
    128113            $domains = [];
    129 
    130114
    131115            foreach ( $ids as $id ) {
    … …  
    139123            }
    140124
    141 
    142125            $count = count( $domains );
    143 
    144126
    145127            if ( 1 === $count ) {
    … …  
    158140            }
    159141
    160 
    161142            wp_safe_redirect( $redirect_url );
    162143            exit;
    163144        }
    164     }    /**
     145    }
     146            /**
    165147     * Übersicht rendern
    166148     */
    … …  
    174156            </h1>
    175157
    176 
    177158            <a href="<?php echo esc_url( network_admin_url( 'admin.php?page=onartline-multisite-domain-mapping-add' ) ); ?>"
    178159               class="page-title-action">
    … …  
    180161            </a>
    181162
    182 
    183163            <hr class="wp-header-end">
    184164
    185 
    186165            <?php $this->render_notices(); ?>
    187 
    188166
    189167            <form method="post">
    … …  
    202180    }
    203181
    204 
    205182    /**
    206183     * Domain hinzufügen / bearbeiten rendern
    … …  
    212189        $table = $this->db->base_prefix . 'omdm_domain_mapping';
    213190
    214 
    215191        // phpcs:ignore WordPress.Security.NonceVerification.Recommended -- Nur Lesezugriff zur Formular-Vorbefüllung, keine Datenänderung.
    216192        $edit_id = isset( $_GET['edit'] ) ? (int) $_GET['edit'] : 0;
    217193        $mapping = null;
    218 
    219194
    220195        if ( $edit_id ) {
    … …  
    232207            </h1>
    233208
    234 
    235209            <?php $this->render_notices(); ?>
    236 
    237210
    238211            <form method="post" action="<?php echo esc_url( network_admin_url( 'edit.php?action=omdm_save_domain' ) ); ?>">
    … …  
    241214                    <input type="hidden" name="omdm_id" value="<?php echo esc_attr( $mapping->id ); ?>">
    242215                <?php endif; ?>
    243 
    244216
    245217                <table class="form-table">
    … …  
    292264                </table>
    293265
    294 
    295266                <?php submit_button( $mapping
    296267                    ? __( 'Update domain', 'onartline-multisite-domain-mapping' )
    … …  
    301272        <?php
    302273    }
    303 
    304 
    305274    /**
    306275     * Einstellungen rendern
    … …  
    308277    public function render_settings(): void {
    309278        $server_ip    = get_site_option( 'omdm_server_ip', '' );
     279        $server_ipv6  = get_site_option( 'omdm_server_ipv6', '' );
    310280        $server_cname = get_site_option( 'omdm_server_cname', '' );
    311281        ?>
    … …  
    313283            <h1><?php esc_html_e( 'Domain Mapping – Settings', 'onartline-multisite-domain-mapping' ); ?></h1>
    314284
    315 
    316285            <?php $this->render_notices(); ?>
    317 
    318286
    319287            <form method="post" action="<?php echo esc_url( network_admin_url( 'edit.php?action=omdm_save_settings' ) ); ?>">
    320288                <?php wp_nonce_field( 'omdm_save_settings' ); ?>
    321 
    322289
    323290                <table class="form-table">
    … …  
    355322                        </td>
    356323                    </tr>
    357                                                             <tr>
     324                    <tr>
    358325                        <td colspan="2">
    359326                            <hr>
    … …  
    374341                            <p class="description">
    375342                                <?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.',
    377359                                    'onartline-multisite-domain-mapping'
    378360                                ); ?>
    … …  
    389371                            <p class="description">
    390372                                <?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 is ignored.',
     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.',
    392374                                    'onartline-multisite-domain-mapping'
    393375                                ); ?>
    … …  
    395377                        </td>
    396378                    </tr>
    397 
    398379
    399380                    <tr>
    … …  
    421402                </table>
    422403
    423 
    424404                <?php submit_button( __( 'Save settings', 'onartline-multisite-domain-mapping' ) ); ?>
    425405            </form>
    … …  
    427407        <?php
    428408    }
    429 
    430 
    431     /**
     409            /**
    432410     * Domain speichern
    433411     */
    … …  
    435413        check_admin_referer( 'omdm_save_domain' );
    436414
    437 
    438415        if ( ! current_user_can( 'manage_network' ) ) {
    439416            wp_die( esc_html__( 'No permission.', 'onartline-multisite-domain-mapping' ) );
    440417        }
    441 
    442418
    443419        $id          = isset( $_POST['omdm_id'] ) ? (int) $_POST['omdm_id'] : 0;
    … …  
    447423        $force_https = isset( $_POST['omdm_force_https'] ) ? 1 : 0;
    448424
    449 
    450425        if ( ! $blog_id || ! $domain ) {
    451426            wp_safe_redirect( network_admin_url( 'admin.php?page=onartline-multisite-domain-mapping-add&omdm_error=empty' ) );
    … …  
    453428        }
    454429
    455 
    456430        if ( ! preg_match( '/^[a-z0-9\-\.]+\.[a-z]{2,}$/', $domain ) ) {
    457431            wp_safe_redirect( network_admin_url( 'admin.php?page=onartline-multisite-domain-mapping-add&omdm_error=invalid' ) );
    … …  
    459433        }
    460434
    461 
    462435        $table = $this->db->base_prefix . 'omdm_domain_mapping';
    463 
    464436
    465437        // Netzwerkweite Eindeutigkeitsprüfung: Domain darf nicht bereits einem anderen Eintrag zugeordnet sein.
    … …  
    471443        );
    472444
    473 
    474445        if ( $existing_id && (int) $existing_id !== $id ) {
    475446            wp_safe_redirect( network_admin_url( 'admin.php?page=onartline-multisite-domain-mapping-add&omdm_error=duplicate' ) );
    476447            exit;
    477448        }
    478 
    479449
    480450        if ( $is_primary ) {
    … …  
    488458        }
    489459
    490 
    491460        $data = [
    492461            'blog_id'    => $blog_id,
    … …  
    496465        ];
    497466
    498 
    499467        if ( $id ) {
    500468            $this->db->update( $table, $data, [ 'id' => $id ], [ '%d', '%s', '%d', '%d' ], [ '%d' ] );
    … …  
    502470            $data['is_reachable'] = 1;
    503471
    504 
    505472            $this->db->insert( $table, $data, [ '%d', '%s', '%d', '%d', '%d' ] );
    506473        }
    507 
    508474
    509475        wp_safe_redirect( network_admin_url( 'admin.php?page=onartline-multisite-domain-mapping&omdm_success=1' ) );
    … …  
    511477    }
    512478
    513 
    514479    /**
    515480     * Domain löschen
    … …  
    518483        $id = isset( $_GET['id'] ) ? (int) $_GET['id'] : 0;
    519484
    520 
    521485        if ( ! $id ) {
    522486            wp_die( esc_html__( 'No permission.', 'onartline-multisite-domain-mapping' ) );
    523487        }
    524488
    525 
    526489        check_admin_referer( 'omdm_delete_domain_' . $id );
    527 
    528490
    529491        if ( ! current_user_can( 'manage_network' ) ) {
    530492            wp_die( esc_html__( 'No permission.', 'onartline-multisite-domain-mapping' ) );
    531493        }
    532 
    533494
    534495        $table   = $this->db->base_prefix . 'omdm_domain_mapping';
    … …  
    537498        );
    538499
    539 
    540500        $this->db->delete( $table, [ 'id' => $id ], [ '%d' ] );
    541501
    542 
    543502        $domain_name = $mapping ? $mapping->domain : '';
    544 
    545503
    546504        if ( $domain_name ) {
    … …  
    556514        }
    557515
    558 
    559516        wp_safe_redirect( $redirect_url );
    560517        exit;
    561518    }
    562519
     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    }
    563549
    564550    /**
    … …  
    568554        check_admin_referer( 'omdm_save_settings' );
    569555
    570 
    571556        if ( ! current_user_can( 'manage_network' ) ) {
    572557            wp_die( esc_html__( 'No permission.', 'onartline-multisite-domain-mapping' ) );
    573558        }
    574 
    575559
    576560        update_site_option( 'omdm_force_https', isset( $_POST['omdm_force_https'] ) );
    … …  
    579563        update_site_option( 'omdm_delete_data_on_uninstall', isset( $_POST['omdm_delete_data_on_uninstall'] ) );
    580564
    581 
    582         $server_ip = isset( $_POST['omdm_server_ip'] )
     565        $server_ip_raw = isset( $_POST['omdm_server_ip'] )
    583566            ? sanitize_text_field( wp_unslash( $_POST['omdm_server_ip'] ) )
    584567            : '';
    585568
    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'] ) )
    589571            : '';
    590572
     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        }
    591599
    592600        update_site_option( 'omdm_server_ip', $server_ip );
     601        update_site_option( 'omdm_server_ipv6', $server_ipv6 );
    593602        update_site_option( 'omdm_server_cname', $server_cname );
    594 
    595603
    596604        wp_safe_redirect( network_admin_url( 'admin.php?page=onartline-multisite-domain-mapping-settings&omdm_success=1' ) );
    597605        exit;
    598606    }
    599             /**
     607
     608    /**
    600609     * Admin-Hinweise (Erfolg/Fehler) anzeigen
    601610     *
    … …  
    613622            <?php
    614623        }
    615 
    616624
    617625        // phpcs:ignore WordPress.Security.NonceVerification.Recommended -- Reine Anzeige-Parameter nach Redirect, keine Datenänderung.
    … …  
    642650            <?php
    643651        }
    644 
    645652
    646653        // phpcs:ignore WordPress.Security.NonceVerification.Recommended -- Reine Anzeige-Parameter nach Redirect, keine Datenänderung.
    … …  
    665672        }
    666673
    667 
    668674        // phpcs:ignore WordPress.Security.NonceVerification.Recommended -- Reine Anzeige-Parameter nach Redirect, keine Datenänderung.
    669675        if ( isset( $_GET['omdm_error'] ) ) {
    … …  
    671677            $error = sanitize_text_field( wp_unslash( $_GET['omdm_error'] ) );
    672678
    673 
    674679            $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' ),
    679687            };
    680688            ?>
  • onartline-multisite-domain-mapping/trunk/docs/README-DE.md

    r3651261 r3657120  
    8989Richten Sie Ihre Domain auf Ihren Server aus, indem Sie folgende DNS-Einträge setzen:
    9090
    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)
    9293- **CNAME-Eintrag** – Name: `www` – Wert: Ihre Primärdomain oder Server-CNAME
    9394
    … …  
    124125## Changelog
    125126
     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
    126135### 1.0.0
    127136- Erstveröffentlichung
  • onartline-multisite-domain-mapping/trunk/docs/README-ES.md

    r3651261 r3657120  
    8989Apunte su dominio a su servidor configurando los siguientes registros DNS:
    9090
    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)
    9293- **Registro CNAME** – Nombre: `www` – Valor: Su dominio principal o CNAME del servidor
    9394
    … …  
    124125## Registro de cambios
    125126
     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
    126135### 1.0.0
    127136- Lanzamiento inicial
  • onartline-multisite-domain-mapping/trunk/docs/README-FR.md

    r3651261 r3657120  
    8989Faites pointer votre domaine vers votre serveur en configurant les enregistrements DNS suivants :
    9090
    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)
    9293- **Enregistrement CNAME** – Nom : `www` – Valeur : votre domaine principal ou le CNAME du serveur
    9394
    … …  
    124125## Journal des modifications
    125126
     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
    126135### 1.0.0
    127136- Version initiale
  • onartline-multisite-domain-mapping/trunk/docs/README-IT.md

    r3651261 r3657120  
    8989Punta il tuo dominio al tuo server impostando i seguenti record DNS:
    9090
    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)
    9293- **Record CNAME** – Nome: `www` – Valore: il tuo dominio principale o il CNAME del server
    9394
    … …  
    124125## Changelog
    125126
     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
    126135### 1.0.0
    127136- Rilascio iniziale
  • onartline-multisite-domain-mapping/trunk/docs/README-NL.md

    r3651261 r3657120  
    8989Wijs uw domein naar uw server door de volgende DNS-records in te stellen:
    9090
    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)
    9293- **CNAME-record** – Naam: `www` – Waarde: uw primaire domein of server-CNAME
    9394
    … …  
    124125## Changelog
    125126
     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
    126135### 1.0.0
    127136- Eerste release
  • onartline-multisite-domain-mapping/trunk/docs/README-PT-BR.md

    r3651261 r3657120  
    8989Aponte seu domínio para o seu servidor configurando os seguintes registros DNS:
    9090
    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)
    9293- **Registro CNAME** – Nome: `www` – Valor: seu domínio principal ou o CNAME do servidor
    9394
    … …  
    124125## Changelog
    125126
     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
    126135### 1.0.0
    127136- Lançamento inicial
  • onartline-multisite-domain-mapping/trunk/docs/README-PT.md

    r3651261 r3657120  
    8989Aponte o seu domínio para o seu servidor configurando os seguintes registos DNS:
    9090
    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)
    9293- **Registo CNAME** – Nome: `www` – Valor: o seu domínio principal ou o CNAME do servidor
    9394
    … …  
    124125## Changelog
    125126
     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
    126135### 1.0.0
    127136- Lançamento inicial
  • onartline-multisite-domain-mapping/trunk/includes/class-omdm-activator.php

    r3630157 r3657120  
    99 */
    1010
     11
    1112if ( ! defined( 'ABSPATH' ) ) {
    1213    exit;
    1314}
    1415
     16
    1517class omdm_Activator {
    1618
     19
    1720    /**
    1821     * Marker, der die sunrise.php als vom Plugin verwaltet kennzeichnet.
    1922     */
    2023    const SUNRISE_MARKER = 'omdm_SUNRISE_MARKER';
     24
    2125
    2226    /**
    … …  
    2630    const CUSTOM_MARKER = 'omdm_CUSTOM_SUNRISE_MARKER';
    2731
     32
    2833    /**
    2934     * Wird bei Plugin-Aktivierung aufgerufen.
    3035     */
    3136    public static function activate(): void {
     37
    3238
    3339        // ── Multisite-Voraussetzung prüfen ────────────────────────────────────
    … …  
    3743        }
    3844
     45
    3946        // ── Alte Transients bereinigen ────────────────────────────────────────
    4047        self::clear_sunrise_transients();
    4148
     49
    4250        // ── Datenbank-Tabellen anlegen ────────────────────────────────────────
    4351        self::create_tables();
    4452
     53
    4554        // ── Standard-Optionen setzen ──────────────────────────────────────────
    4655        self::set_default_options();
    4756
     57
    4858        // ── WP_Filesystem initialisieren ──────────────────────────────────────
    4959        require_once ABSPATH . 'wp-admin/includes/file.php';
    5060
     61
    5162        if ( ! WP_Filesystem() ) {
    5263            set_transient( 'omdm_sunrise_not_writable', true, 300 );
    … …  
    5465        }
    5566
     67
    5668        global $wp_filesystem;
     69
    5770
    5871        $source      = plugin_dir_path( dirname( __FILE__ ) ) . 'sunrise.php';
    5972        $destination = WP_CONTENT_DIR . '/sunrise.php';
     73
    6074
    6175        // sunrise.php bereits vorhanden → Herkunft und Version prüfen
    … …  
    6377            $existing_content = $wp_filesystem->get_contents( $destination );
    6478
     79
    6580            if ( false !== $existing_content && false !== strpos( $existing_content, self::SUNRISE_MARKER ) ) {
     81
    6682
    6783                // Individuell angepasste sunrise.php → nicht anfassen.
    … …  
    7187                }
    7288
     89
    7390                // Eigene, unveränderte sunrise.php – Version vergleichen.
    7491                $source_content = $wp_filesystem->exists( $source )
    … …  
    7693                    : false;
    7794
     95
    7896                $existing_version = self::get_sunrise_marker_version( $existing_content );
    7997                $source_version   = $source_content ? self::get_sunrise_marker_version( $source_content ) : '0';
     98
    8099
    81100                if ( false !== $source_content && version_compare( $source_version, $existing_version, '>' ) ) {
    … …  
    95114        }
    96115
     116
    97117        if ( ! $wp_filesystem->exists( $source ) ) {
    98118            set_transient( 'omdm_sunrise_source_missing', true, 300 );
    … …  
    100120        }
    101121
     122
    102123        if ( ! $wp_filesystem->is_writable( WP_CONTENT_DIR ) ) {
    103124            set_transient( 'omdm_sunrise_not_writable', true, 300 );
    104125            return;
    105126        }
     127
    106128
    107129        if ( $wp_filesystem->copy( $source, $destination, true ) ) {
    … …  
    112134        }
    113135    }
     136
    114137
    115138    /**
    … …  
    126149        }
    127150
     151
    128152        require_once ABSPATH . 'wp-admin/includes/plugin.php';
    129153
     154
    130155        $plugin_file = plugin_basename( plugin_dir_path( dirname( __FILE__ ) ) . 'onartline-multisite-domain-mapping.php' );
     156
    131157
    132158        if ( is_plugin_active( $plugin_file ) ) {
    … …  
    134160        }
    135161    }
     162
    136163
    137164    /**
    … …  
    152179        );
    153180
     181
    154182        foreach ( $transients as $transient ) {
    155183            delete_transient( $transient );
    156184        }
    157185    }
     186
    158187
    159188    /**
    … …  
    165194        }
    166195        return '0';
    167     }    /**
     196    }
     197
     198
     199    /**
    168200     * Datenbank-Tabellen erstellen.
    169201     */
    … …  
    172204        require_once ABSPATH . 'wp-admin/includes/upgrade.php';
    173205
     206
    174207        $charset = $wpdb->get_charset_collate();
    175208        $prefix  = $wpdb->base_prefix;
     209
    176210
    177211        $sql1 = "CREATE TABLE {$prefix}omdm_domain_mapping (
    … …  
    187221            KEY domain (domain)
    188222        ) $charset;";
     223
    189224
    190225        $sql2 = "CREATE TABLE {$prefix}omdm_login_tokens (
    … …  
    202237        ) $charset;";
    203238
     239
    204240        dbDelta( $sql1 );
    205241        dbDelta( $sql2 );
    206242    }
     243
    207244
    208245    /**
    … …  
    213250            add_site_option( 'omdm_version', omdm_VERSION );
    214251        }
    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 );
    217254        }
    218255        if ( false === get_site_option( 'omdm_301_redirect' ) ) {
    219256            add_site_option( 'omdm_301_redirect', 0 );
    220257        }
     258        if ( false === get_site_option( 'omdm_allow_site_mapping' ) ) {
     259            add_site_option( 'omdm_allow_site_mapping', 0 );
     260        }
    221261        if ( false === get_site_option( 'omdm_delete_data_on_uninstall' ) ) {
    222262            add_site_option( 'omdm_delete_data_on_uninstall', 0 );
    223263        }
    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    }
    226274    /**
    227275     * Prüft dynamisch, ob SUNRISE bereits korrekt in der wp-config.php
    … …  
    237285                . '</p>';
    238286        }
     287
    239288
    240289        return '<p><strong>' . esc_html__( 'Note:', 'onartline-multisite-domain-mapping' ) . '</strong> '
    … …  
    253302        $source = plugin_dir_path( dirname( __FILE__ ) ) . 'sunrise.php';
    254303
     304
    255305        if ( ! file_exists( $source ) ) {
    256306            return '';
    257307        }
     308
    258309
    259310        return '<p>' . sprintf(
    … …  
    267318    }
    268319
     320
    269321    /**
    270322     * Erstellt die abgesicherte URL für den "Installation fortsetzen"-Button.
    … …  
    277329    }
    278330
     331
    279332    /**
    280333     * Wird aufgerufen, wenn der Nutzer im Admin-Notice auf
    … …  
    284337        check_admin_referer( 'omdm_retry_sunrise_install' );
    285338
     339
    286340        if ( ! current_user_can( 'manage_network_options' ) ) {
    287341            wp_die( esc_html__( 'No permission.', 'onartline-multisite-domain-mapping' ) );
    288342        }
    289343
     344
    290345        self::activate();
     346
    291347
    292348        $redirect = wp_get_referer() ? wp_get_referer() : network_admin_url( 'plugins.php' );
    293349        wp_safe_redirect( $redirect );
    294350        exit;
    295     }    /**
     351    }
     352
     353
     354    /**
    296355     * Admin-Notices nach Aktivierung anzeigen.
    297356     */
    298357    public static function activation_notices(): void {
     358
    299359
    300360        if ( get_transient( 'omdm_requires_multisite' ) ) {
    … …  
    310370        }
    311371
     372
    312373        if ( get_transient( 'omdm_sunrise_copied' ) ) {
    313374            delete_transient( 'omdm_sunrise_copied' );
    … …  
    324385        }
    325386
     387
    326388        if ( get_transient( 'omdm_sunrise_updated' ) ) {
    327389            delete_transient( 'omdm_sunrise_updated' );
    … …  
    337399            return;
    338400        }
     401
    339402
    340403        if ( get_transient( 'omdm_sunrise_update_failed' ) ) {
    … …  
    358421        }
    359422
     423
    360424        // ── Individuell angepasste sunrise.php erkannt ────────────────────────
    361425        if ( get_transient( 'omdm_sunrise_custom_detected' ) ) {
    … …  
    373437        }
    374438
     439
    375440        if ( get_transient( 'omdm_sunrise_foreign_exists' ) ) {
    376441            delete_transient( 'omdm_sunrise_foreign_exists' );
    … …  
    392457            return;
    393458        }
     459
    394460
    395461        if ( get_transient( 'omdm_sunrise_not_writable' ) ) {
    … …  
    423489        }
    424490
     491
    425492        if ( get_transient( 'omdm_sunrise_source_missing' ) ) {
    426493            delete_transient( 'omdm_sunrise_source_missing' );
    … …  
    434501            return;
    435502        }
     503
    436504
    437505        if ( get_transient( 'omdm_sunrise_copy_failed' ) ) {
    … …  
    459527        }
    460528
     529
    461530        if ( get_transient( 'omdm_sunrise_already_exists' ) ) {
    462531            delete_transient( 'omdm_sunrise_already_exists' );
  • onartline-multisite-domain-mapping/trunk/includes/class-omdm-domain-mapper.php

    r3630157 r3657120  
    66 */
    77
     8
    89if ( ! defined( 'ABSPATH' ) ) {
    910    exit;
    1011}
    1112
     13
    1214class omdm_Domain_Mapper {
    1315
     16
    1417    private wpdb $db;
    1518
     19
    1620    /**
    1721     * Cache-Gruppe für Domain-Mapping-Abfragen.
    … …  
    1923    private const CACHE_GROUP = 'omdm_domain_mapping';
    2024
     25
    2126    /**
    2227     * Cache-Dauer in Sekunden (1 Stunde).
    2328     */
    2429    private const CACHE_TTL = HOUR_IN_SECONDS;
     30
    2531
    2632    public function __construct() {
    … …  
    2935    }
    3036
     37
    3138    /**
    3239     * Domain dem richtigen Site zuordnen
    3340     */
    3441    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
    3853
    3954        $current_domain = $this->get_current_domain();
    4055        $mapping        = $this->get_mapping_by_domain( $current_domain );
    4156
     57
    4258        if ( ! $mapping ) {
    4359            return;
    4460        }
     61
    4562
    4663        $this->maybe_redirect_to_primary( $mapping );
    4764        $this->maybe_redirect_to_https( $mapping );
    4865    }
     66
    4967
    5068    /**
    … …  
    5674        }
    5775
     76
    5877        $primary = $this->get_primary_domain( $blog_id );
     78
    5979
    6080        if ( ! $primary ) {
    … …  
    6282        }
    6383
     84
    6485        return $this->replace_domain_in_url( $url, $primary, $scheme );
    6586    }
     87
    6688
    6789    /**
    … …  
    7395        }
    7496
     97
    7598        $primary = $this->get_primary_domain( $blog_id );
     99
    76100
    77101        if ( ! $primary ) {
    … …  
    79103        }
    80104
     105
    81106        return $this->replace_domain_in_url( $url, $primary, $scheme );
    82107    }
     108
    83109
    84110    /**
    … …  
    90116    }
    91117
     118
    92119    /**
    93120     * Mapping anhand Domain aus DB holen (mit Object-Cache).
    … …  
    97124        $cached    = wp_cache_get( $cache_key, self::CACHE_GROUP, false, $found );
    98125
     126
    99127        if ( $found ) {
    100128            return $cached ?: null;
    101129        }
    102130
     131
    103132        $table = $this->db->base_prefix . 'omdm_domain_mapping';
     133
    104134
    105135        // phpcs:ignore WordPress.DB.DirectDatabaseQuery.DirectQuery -- Ergebnis wird im Object-Cache gehalten, daher kein zusätzliches Caching-Tag nötig.
    … …  
    112142        );
    113143
     144
    114145        wp_cache_set( $cache_key, $mapping, self::CACHE_GROUP, self::CACHE_TTL );
    115146
     147
    116148        return $mapping;
    117149    }
    118150
     151
    119152    /**
    120153     * Primary Domain eines Sites holen (mit Object-Cache).
    121154     */
    122     private function get_primary_domain( int $blog_id ): ?object {
     155    public function get_primary_domain( int $blog_id ): ?object {
    123156        $cache_key = 'primary_' . $blog_id;
    124157        $cached    = wp_cache_get( $cache_key, self::CACHE_GROUP, false, $found );
    125158
     159
    126160        if ( $found ) {
    127161            return $cached ?: null;
    128162        }
    129163
     164
    130165        $table = $this->db->base_prefix . 'omdm_domain_mapping';
     166
    131167
    132168        // phpcs:ignore WordPress.DB.DirectDatabaseQuery.DirectQuery -- Ergebnis wird im Object-Cache gehalten, daher kein zusätzliches Caching-Tag nötig.
    … …  
    139175        );
    140176
     177
    141178        wp_cache_set( $cache_key, $primary, self::CACHE_GROUP, self::CACHE_TTL );
    142179
     180
    143181        return $primary;
    144182    }
    145183
     184
    146185    /**
    147186     * 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.
    149188     */
    150189    public static function invalidate_cache( ?string $domain = null, ?int $blog_id = null ): void {
    … …  
    153192        }
    154193
     194
    155195        if ( $blog_id ) {
    156196            wp_cache_delete( 'primary_' . $blog_id, self::CACHE_GROUP );
    157197        }
    158198    }
    159 
    160     /**
     199            /**
    161200     * Auf Primary Domain weiterleiten falls nötig
    162201     */
    … …  
    166205        }
    167206
     207
    168208        $redirect_enabled = get_site_option( 'omdm_301_redirect', false );
    169209
     210
    170211        if ( ! $redirect_enabled ) {
    171212            return;
    172213        }
    173214
     215
    174216        $primary = $this->get_primary_domain( (int) $mapping->blog_id );
    175217
     218
    176219        if ( ! $primary ) {
    177220            return;
    178221        }
     222
    179223
    180224        $current_domain = $this->get_current_domain();
    … …  
    182226            return;
    183227        }
     228
    184229
    185230        $scheme      = $primary->https ? 'https' : 'http';
    … …  
    187232        $target      = $scheme . '://' . $primary->domain . $request_uri;
    188233
     234
    189235        wp_redirect( esc_url_raw( $target ), 301 ); // phpcs:ignore WordPress.Security.SafeRedirect.wp_redirect_wp_redirect -- gezielte Weiterleitung auf gemappte Domain.
    190236        exit;
    191237    }
     238
    192239
    193240    /**
    … …  
    198245        $force_https_domain = (bool) $mapping->https;
    199246
     247
    200248        if ( ! $force_https_global && ! $force_https_domain ) {
    201249            return;
    202250        }
     251
    203252
    204253        $https_header    = isset( $_SERVER['HTTPS'] ) ? sanitize_text_field( wp_unslash( $_SERVER['HTTPS'] ) ) : '';
    205254        $forwarded_proto = isset( $_SERVER['HTTP_X_FORWARDED_PROTO'] ) ? sanitize_text_field( wp_unslash( $_SERVER['HTTP_X_FORWARDED_PROTO'] ) ) : '';
     255
    206256
    207257        $is_https = ( 'on' === $https_header )
    … …  
    209259            || ( isset( $_SERVER['SERVER_PORT'] ) && 443 === (int) $_SERVER['SERVER_PORT'] );
    210260
     261
    211262        if ( $is_https ) {
    212263            return;
    213264        }
     265
    214266
    215267        $request_uri = isset( $_SERVER['REQUEST_URI'] ) ? sanitize_text_field( wp_unslash( $_SERVER['REQUEST_URI'] ) ) : '/';
    216268        $target      = 'https://' . $mapping->domain . $request_uri;
    217269
     270
    218271        wp_redirect( esc_url_raw( $target ), 301 ); // phpcs:ignore WordPress.Security.SafeRedirect.wp_redirect_wp_redirect -- gezielte Weiterleitung auf gemappte Domain.
    219272        exit;
    220273    }
    221274
     275
    222276    /**
    223277     * Domain in URL ersetzen
    … …  
    226280        $parsed = wp_parse_url( $url );
    227281
     282
    228283        if ( ! isset( $parsed['host'] ) ) {
    229284            return $url;
    230285        }
    231286
     287
    232288        $new_scheme = $scheme ?? $parsed['scheme'] ?? 'https';
     289
    233290
    234291        if ( $primary->https || get_site_option( 'omdm_force_https', false ) ) {
    … …  
    236293        }
    237294
     295
    238296        $new_url  = $new_scheme . '://' . $primary->domain;
    239297        $new_url .= $parsed['path'] ?? '';
    240298
     299
    241300        if ( ! empty( $parsed['query'] ) ) {
    242301            $new_url .= '?' . $parsed['query'];
    243302        }
    244303
     304
    245305        if ( ! empty( $parsed['fragment'] ) ) {
    246306            $new_url .= '#' . $parsed['fragment'];
    247307        }
    248308
     309
    249310        return $new_url;
    250311    }
  • onartline-multisite-domain-mapping/trunk/includes/class-omdm-loader.php

    r3630157 r3657120  
    77 */
    88
     9
    910if ( ! defined( 'ABSPATH' ) ) {
    1011    exit;
    1112}
    1213
     14
    1315class omdm_Loader {
     16
    1417
    1518    protected array $actions = [];
    … …  
    1922    private string $version;
    2023
     24
    2125    public function __construct( string $plugin_name, string $version ) {
    2226        $this->plugin_name = $plugin_name;
    2327        $this->version     = $version;
    2428
     29
    2530        $this->register_hooks();
    2631    }
     32
    2733
    2834    /**
    … …  
    3137    private function register_hooks(): void {
    3238
     39
    3340        // Domain Mapper
    3441        $this->add_action( 'init', omdm_Domain_Mapper::class, 'map_domain' );
    3542        $this->add_filter( 'site_url', omdm_Domain_Mapper::class, 'filter_site_url', 10, 4 );
    3643        $this->add_filter( 'home_url', omdm_Domain_Mapper::class, 'filter_home_url', 10, 4 );
     44
    3745
    3846        // Login Handler
    … …  
    4351        $this->add_filter( 'admin_url', omdm_Login_Handler::class, 'filter_admin_url', 10, 3 );
    4452
     53
    4554        // Cron Handler
    4655        $this->add_action( 'omdm_domain_check', omdm_Cron_Handler::class, 'run_domain_check' );
     56
    4757
    4858        // Network Admin – lazy, Hook-basiert
    … …  
    5262        $this->add_action( 'network_admin_edit_omdm_save_settings', $this, 'load_network_admin' );
    5363
     64
    5465        // Activator Notices
    5566        if ( class_exists( 'omdm_Activator' ) ) {
    … …  
    5768        }
    5869    }
     70
    5971
    6072    /**
    … …  
    6476        static $network_admin = null;
    6577
     78
    6679        if ( null === $network_admin ) {
    6780            $network_admin = new omdm_Network_Admin( $this->plugin_name, $this->version );
    6881        }
     82
    6983
    7084        match ( current_action() ) {
    … …  
    7690        };
    7791    }
     92
    7893
    7994    /**
    … …  
    87102        }
    88103
     104
    89105        if ( ! isset( $this->instances[ $component ] ) ) {
    90             $this->instances[ $component ] = new $component();
     106            $this->instances[ $component ] = $this->instantiate_component( $component );
    91107        }
     108
    92109
    93110        return $this->instances[ $component ];
    94111    }
     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
    95127
    96128    private function add_action(
    … …  
    104136    }
    105137
     138
    106139    private function add_filter(
    107140        string $hook,
    … …  
    113146        $this->filters[] = compact( 'hook', 'component', 'callback', 'priority', 'accepted_args' );
    114147    }
     148
    115149
    116150    /**
    … …  
    132166        }
    133167
     168
    134169        foreach ( $this->filters as $filter ) {
    135170            add_filter(
  • onartline-multisite-domain-mapping/trunk/includes/class-omdm-login-handler.php

    r3630157 r3657120  
    137137            $uri      = isset( $_SERVER['REQUEST_URI'] ) ? sanitize_text_field( wp_unslash( $_SERVER['REQUEST_URI'] ) ) : '';
    138138            $uri      = remove_query_arg( 'omdm_token', $uri );
    139             $redirect = $scheme . '://' . $host . $uri;
     139            $redirect = esc_url_raw( $scheme . '://' . $host . $uri );
    140140        }
    141141
  • onartline-multisite-domain-mapping/trunk/includes/class-omdm-plugin.php

    r3630157 r3657120  
    1717    protected omdm_Loader $loader;
    1818    protected string $plugin_name = 'onartline-multisite-domain-mapping';
    19     protected string $version = '1.0.0';
     19    protected string $version = '1.0.1';
    2020
    2121
  • onartline-multisite-domain-mapping/trunk/includes/class-omdm-site-settings.php

    r3630157 r3657120  
    207207        }
    208208
     209        omdm_Domain_Mapper::invalidate_cache( $domain, $site_id );
     210
    209211        wp_safe_redirect( add_query_arg( 'omdm_saved', '1', admin_url( 'admin.php?page=omdm-site-settings' ) ) );
    210212        exit;
  • onartline-multisite-domain-mapping/trunk/languages/onartline-multisite-domain-mapping.pot

    r3630157 r3657120  
    44msgid ""
    55msgstr ""
    6 "Project-Id-Version: Onartline Multisite Domain Mapping 1.0.0\n"
     6"Project-Id-Version: Onartline Multisite Domain Mapping 1.0.1\n"
    77"Report-Msgid-Bugs-To: https://wordpress.org/support/plugin/onartline-multisite-domain-mapping\n"
    8 "POT-Creation-Date: 2026-07-19 00: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"
    1010"Last-Translator: \n"
    1111"Language-Team: \n"
    … …  
    109109# --- Network Admin – Menu ---
    110110
    111 #: admin/class-omdm-network-admin.php
     111#: admin/class-omdm-network-admin.php includes/class-omdm-site-settings.php
    112112msgid "Domain Mapping"
    113113msgstr ""
    … …  
    279279
    280280#: 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)."
     281msgid "IPv4 address for the DNS A record. Enter multiple IPs comma-separated (e.g. for round-robin DNS)."
    282282msgstr ""
    283283
    … …  
    291291
    292292#: 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."
     293msgid "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."
     294msgstr ""
     295
     296#: admin/class-omdm-network-admin.php
     297msgid "Server IPv6 address"
     298msgstr ""
     299
     300#: admin/class-omdm-network-admin.php
     301msgid "e.g. 2001:db8::1 or multiple, comma-separated"
     302msgstr ""
     303
     304#: admin/class-omdm-network-admin.php
     305msgid "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."
     306msgstr ""
     307
     308#: admin/class-omdm-network-admin.php
     309msgid "Please enter a valid IPv4 address (e.g. 192.168.1.1)."
     310msgstr ""
     311
     312#: admin/class-omdm-network-admin.php
     313msgid "Please enter a valid IPv6 address (e.g. 2001:db8::1)."
     314msgstr ""
     315
     316#: admin/class-omdm-network-admin.php
     317msgid "Please enter a valid CNAME domain (e.g. proxy.example.com)."
    294318msgstr ""
    295319
    … …  
    370394
    371395#: includes/class-omdm-site-settings.php
    372 msgid "Domain Mapping"
    373 msgstr ""
    374 
    375 #: includes/class-omdm-site-settings.php
    376396msgid "Your Mapped Domains"
    377397msgstr ""
  • onartline-multisite-domain-mapping/trunk/onartline-multisite-domain-mapping.php

    r3630157 r3657120  
    44 * Plugin URI:        https://wordpress.org/plugins/onartline-multisite-domain-mapping
    55 * Description:       Map domains to sites in a WordPress Multisite network. Requires PHP 8.3+ and WordPress 7.0+.
    6  * Version:           1.0.0
     6 * Version:           1.0.1
    77 * Requires at least: 7.0
    88 * Requires PHP:      8.3
    … …  
    2222// ── Plugin-Konstanten ─────────────────────────────────────────────────────────
    2323
    24 define( 'omdm_VERSION',     '1.0.0' );
     24define( 'omdm_VERSION',     '1.0.1' );
    2525define( 'omdm_DB_VERSION',  '1.0.0' );
    2626define( 'omdm_PLUGIN_DIR',  plugin_dir_path( __FILE__ ) );
Note: See TracChangeset for help on using the changeset viewer.