Changeset 3348048
- Timestamp:
- 08/21/2025 10:43:21 AM (7 months ago)
- Location:
- omppm-override-phpmail-mailpoet/trunk
- Files:
-
- 4 edited
-
README.md (modified) (2 diffs)
-
includes/class-omppm-admin.php (modified) (4 diffs)
-
omppm-override-phpmail-mailpoet.php (modified) (7 diffs)
-
readme.txt (modified) (2 diffs)
Legend:
- Unmodified
- Added
- Removed
-
omppm-override-phpmail-mailpoet/trunk/README.md
r3347023 r3348048 4 4 **Tags:** mailpoet, smtp, wp_mail, gmail-api, phpmailer 5 5 **Tested up to:** 6.8 6 **Stable tag:** 1.2. 06 **Stable tag:** 1.2.2 7 7 **License:** GPLv2 or later 8 8 **License URI:** https://www.gnu.org/licenses/gpl-2.0.html … … 98 98 99 99 ## Changelog ## 100 101 **1.2.2** 102 * Release date: August 21st 2025 103 * **NEW: Dynamic MailPoet email type detection using reflection** 104 * **NEW: Automatic support for all official MailPoet email types** 105 * **NEW: Future-proof email type validation system** 106 * **NEW: Reflection-based email type discovery** 107 * **NEW: Cached email type detection for performance** 108 * **NEW: Enhanced admin interface with dynamic email type count** 109 * **NEW: Automatic updates when MailPoet adds new email types** 110 * **NEW: Support for all MailPoet email types:** 111 * automation, automation_notification, automation_transactional 112 * standard, notification, notification_history 113 * re_engagement, wc_transactional, confirmation_email 114 * automatic, welcome (legacy support) 115 * **NEW: Intelligent fallback system for email type detection** 116 * **NEW: Enhanced debugging for email type matching** 117 * **NEW: Performance-optimized reflection with caching** 118 * Improved compatibility with MailPoet's latest email type system 119 * Enhanced support for WooCommerce transactional emails 120 * Better error handling and logging for email type detection 121 * Future-proof architecture that automatically adapts to MailPoet updates 122 123 **1.2.1** 124 * Release date: August 20th 2025 125 * **NEW: Enhanced email type support with pattern matching** 126 * **NEW: Support for preview emails** 127 * **NEW: Support for email stats notifications** 128 * **NEW: Support for new subscriber notifications** 129 * **NEW: Intelligent pattern matching for automatic emails** 130 * **NEW: WooCommerce automatic email support (automatic_woocommerce_*)** 131 * **NEW: Generic automatic email pattern support (automatic_*_*)** 132 * **NEW: Enhanced email type validation with regex patterns** 133 * **NEW: Improved debugging for email type matching** 134 * **NEW: Admin interface shows supported email types count** 135 * **NEW: Future-proof email type detection system** 136 * Improved compatibility with MailPoet's latest automatic email system 137 * Enhanced support for complex email type patterns 138 * Better error handling and logging for email type detection 100 139 101 140 **1.2.0** -
omppm-override-phpmail-mailpoet/trunk/includes/class-omppm-admin.php
r3347023 r3348048 8 8 9 9 namespace OMPPM\Admin; 10 11 use ReflectionClass; 12 use ReflectionException; 10 13 11 14 // Prevent direct access … … 35 38 * Plugin version constant 36 39 */ 37 private const PLUGIN_VERSION = '1.2. 0';40 private const PLUGIN_VERSION = '1.2.2'; 38 41 39 42 /** … … 232 235 <span class="omppm-status-value <?php echo class_exists('\\MailPoet\\Mailer\\Methods\\PHPMail') ? 'omppm-success' : 'omppm-warning'; ?>"> 233 236 <?php echo class_exists('\\MailPoet\\Mailer\\Methods\\PHPMail') ? __('Yes', 'omppm-override-phpmail-mailpoet') : __('No', 'omppm-override-phpmail-mailpoet'); ?> 237 </span> 238 </div> 239 <div class="omppm-status-item"> 240 <span class="omppm-status-label"><?php _e('Supported Email Types:', 'omppm-override-phpmail-mailpoet'); ?></span> 241 <span class="omppm-status-value omppm-success"> 242 <?php echo count($this->get_supported_email_types()); ?> <?php _e('types', 'omppm-override-phpmail-mailpoet'); ?> 234 243 </span> 235 244 </div> … … 581 590 return $plugin_data['Version'] ?? '1.0.11'; 582 591 } 592 593 /** 594 * Get supported email types for display 595 */ 596 private function get_supported_email_types(): array { 597 $emailTypes = [ 598 'newsletter', 599 'post_notification', 600 'welcome_email', 601 'automatic', 602 'sending_test', 603 'confirmation', 604 'unsubscribe', 605 're_engagement', 606 'transactional', 607 'notification', 608 'preview', 609 'email_stats_notification', 610 'new_subscriber_notification', 611 'automatic_woocommerce_*', 612 'automatic_*_*' 613 ]; 614 615 // Add dynamic MailPoet email types 616 $mailpoetTypes = $this->get_mailpoet_email_types(); 617 $emailTypes = array_merge($emailTypes, $mailpoetTypes); 618 619 return array_unique($emailTypes); 620 } 621 622 /** 623 * Get MailPoet email types dynamically 624 */ 625 private function get_mailpoet_email_types(): array { 626 if (!class_exists('MailPoet\Entities\NewsletterEntity')) { 627 return []; 628 } 629 630 try { 631 $reflection = new ReflectionClass('MailPoet\Entities\NewsletterEntity'); 632 $constants = $reflection->getConstants(); 633 634 $mailpoetTypes = []; 635 foreach ($constants as $name => $value) { 636 if (strpos($name, 'TYPE_') === 0) { 637 $mailpoetTypes[] = $value; 638 } 639 } 640 641 return $mailpoetTypes; 642 643 } catch (ReflectionException $e) { 644 return []; 645 } 646 } 583 647 } -
omppm-override-phpmail-mailpoet/trunk/omppm-override-phpmail-mailpoet.php
r3347023 r3348048 6 6 * Plugin URI: https://saskialund.de/ 7 7 * Description: The missing link between MailPoet and your SMTP plugin – for reliable email delivery! 8 * Version: 1.2. 08 * Version: 1.2.2 9 9 * Requires at least: 6.5 10 10 * Requires PHP: 8.0 … … 51 51 use MailPoet\Mailer\Mailer as MailPoetMailer; 52 52 use PHPMailer\PHPMailer\PHPMailer; 53 use ReflectionClass; 54 use ReflectionException; 53 55 54 56 /** … … 68 70 case TRANSACTIONAL = 'transactional'; 69 71 case NOTIFICATION = 'notification'; 72 case PREVIEW = 'preview'; 73 case EMAIL_STATS_NOTIFICATION = 'email_stats_notification'; 74 case NEW_SUBSCRIBER_NOTIFICATION = 'new_subscriber_notification'; 70 75 } 71 76 } else { … … 82 87 public const TRANSACTIONAL = 'transactional'; 83 88 public const NOTIFICATION = 'notification'; 89 public const PREVIEW = 'preview'; 90 public const EMAIL_STATS_NOTIFICATION = 'email_stats_notification'; 91 public const NEW_SUBSCRIBER_NOTIFICATION = 'new_subscriber_notification'; 84 92 } 85 93 } … … 172 180 version_compare(PHP_VERSION, '8.1.0', '>=') ? EmailType::RE_ENGAGEMENT->value : EmailType::RE_ENGAGEMENT, 173 181 version_compare(PHP_VERSION, '8.1.0', '>=') ? EmailType::TRANSACTIONAL->value : EmailType::TRANSACTIONAL, 174 version_compare(PHP_VERSION, '8.1.0', '>=') ? EmailType::NOTIFICATION->value : EmailType::NOTIFICATION 182 version_compare(PHP_VERSION, '8.1.0', '>=') ? EmailType::NOTIFICATION->value : EmailType::NOTIFICATION, 183 version_compare(PHP_VERSION, '8.1.0', '>=') ? EmailType::PREVIEW->value : EmailType::PREVIEW, 184 version_compare(PHP_VERSION, '8.1.0', '>=') ? EmailType::EMAIL_STATS_NOTIFICATION->value : EmailType::EMAIL_STATS_NOTIFICATION, 185 version_compare(PHP_VERSION, '8.1.0', '>=') ? EmailType::NEW_SUBSCRIBER_NOTIFICATION->value : EmailType::NEW_SUBSCRIBER_NOTIFICATION 175 186 ]; 176 187 … … 184 195 } 185 196 197 /** 198 * Enhanced email type validation with dynamic MailPoet type detection 199 * Supports all official MailPoet email types and pattern matching 200 */ 201 private function isSupportedEmailType(string $email_type): bool { 202 // Get dynamic MailPoet email types using reflection 203 $mailpoetTypes = $this->getMailPoetEmailTypes(); 204 205 // Direct match with MailPoet email types 206 if (in_array($email_type, $mailpoetTypes, true)) { 207 if (OMPPM_DEBUG) { 208 error_log("OMPPM: MailPoet email type matched: " . $email_type); 209 } 210 return true; 211 } 212 213 // Direct match with our supported email types 214 if (version_compare(PHP_VERSION, '8.0.0', '>=')) { 215 if (in_array($email_type, $this->supported_email_types, strict: true)) { 216 if (OMPPM_DEBUG) { 217 error_log("OMPPM: Supported email type matched: " . $email_type); 218 } 219 return true; 220 } 221 } else { 222 if (in_array($email_type, $this->supported_email_types, true)) { 223 if (OMPPM_DEBUG) { 224 error_log("OMPPM: Supported email type matched: " . $email_type); 225 } 226 return true; 227 } 228 } 229 230 // Pattern matching for automatic emails (automatic_{group}_{event}) 231 if (strpos($email_type, 'automatic_') === 0) { 232 if (OMPPM_DEBUG) { 233 error_log("OMPPM: Automatic email pattern matched: " . $email_type); 234 } 235 return true; 236 } 237 238 // Pattern matching for WooCommerce automatic emails 239 if (strpos($email_type, 'automatic_woocommerce_') === 0) { 240 if (OMPPM_DEBUG) { 241 error_log("OMPPM: WooCommerce automatic email pattern matched: " . $email_type); 242 } 243 return true; 244 } 245 246 // Pattern matching for other automatic email patterns 247 if (preg_match('/^automatic_[a-zA-Z0-9_]+_[a-zA-Z0-9_]+$/', $email_type)) { 248 if (OMPPM_DEBUG) { 249 error_log("OMPPM: Generic automatic email pattern matched: " . $email_type); 250 } 251 return true; 252 } 253 254 if (OMPPM_DEBUG) { 255 error_log("OMPPM: Email type not supported: " . $email_type); 256 } 257 258 return false; 259 } 260 261 /** 262 * Dynamically get all MailPoet email types using reflection 263 * This ensures we always support the latest MailPoet email types 264 */ 265 private function getMailPoetEmailTypes(): array { 266 static $mailpoetTypes = null; 267 268 // Cache the result to avoid repeated reflection calls 269 if ($mailpoetTypes !== null) { 270 return $mailpoetTypes; 271 } 272 273 $mailpoetTypes = []; 274 275 // Check if NewsletterEntity class exists 276 if (!class_exists('MailPoet\Entities\NewsletterEntity')) { 277 if (OMPPM_DEBUG) { 278 error_log("OMPPM: NewsletterEntity class not found"); 279 } 280 return $mailpoetTypes; 281 } 282 283 try { 284 $reflection = new ReflectionClass('MailPoet\Entities\NewsletterEntity'); 285 $constants = $reflection->getConstants(); 286 287 foreach ($constants as $name => $value) { 288 if (strpos($name, 'TYPE_') === 0) { 289 $mailpoetTypes[] = $value; 290 } 291 } 292 293 if (OMPPM_DEBUG) { 294 error_log("OMPPM: Found " . count($mailpoetTypes) . " MailPoet email types: " . implode(', ', $mailpoetTypes)); 295 } 296 297 } catch (ReflectionException $e) { 298 if (OMPPM_DEBUG) { 299 error_log("OMPPM: Reflection error: " . $e->getMessage()); 300 } 301 } 302 303 return $mailpoetTypes; 304 } 305 186 306 public function send($newsletter, $subscriber, $extraParams = []): array { 187 307 if (OMPPM_DEBUG) { … … 201 321 if ($email_type) { 202 322 $email_type = sanitize_text_field($email_type); 203 // Use named arguments for PHP 8.0+, fallback for older versions 204 if (version_compare(PHP_VERSION, '8.0.0', '>=')) { 205 $is_mailpoet_mail = in_array($email_type, $this->supported_email_types, strict: true); 206 } else { 207 $is_mailpoet_mail = in_array($email_type, $this->supported_email_types, true); 208 } 323 324 // Enhanced email type validation with pattern matching 325 $is_mailpoet_mail = $this->isSupportedEmailType($email_type); 209 326 } 210 327 -
omppm-override-phpmail-mailpoet/trunk/readme.txt
r3347023 r3348048 4 4 Tags: mailpoet, smtp, wp_mail, gmail-api, phpmailer 5 5 Tested up to: 6.8 6 Stable tag: 1.2. 06 Stable tag: 1.2.2 7 7 License: GPLv2 or later 8 8 License URI: https://www.gnu.org/licenses/gpl-2.0.html … … 66 66 67 67 == Changelog == 68 69 = 1.2.2 = 70 71 Release date: August 21st 2025 72 73 - **NEU: Dynamische MailPoet E-Mail-Typ-Erkennung mit Reflection** 74 - **NEU: Automatische Unterstützung für alle offiziellen MailPoet E-Mail-Typen** 75 - **NEU: Zukunftssichere E-Mail-Typ-Validierung** 76 - **NEU: Reflection-basierte E-Mail-Typ-Entdeckung** 77 - **NEU: Gecachte E-Mail-Typ-Erkennung für Performance** 78 - **NEU: Erweitertes Admin-Interface mit dynamischer E-Mail-Typ-Anzahl** 79 - **NEU: Automatische Updates wenn MailPoet neue E-Mail-Typen hinzufügt** 80 - **NEU: Unterstützung für alle MailPoet E-Mail-Typen:** 81 * automation, automation_notification, automation_transactional 82 * standard, notification, notification_history 83 * re_engagement, wc_transactional, confirmation_email 84 * automatic, welcome (Legacy-Support) 85 - **NEU: Intelligentes Fallback-System für E-Mail-Typ-Erkennung** 86 - **NEU: Verbessertes Debugging für E-Mail-Typ-Matching** 87 - **NEU: Performance-optimierte Reflection mit Caching** 88 - Verbesserte Kompatibilität mit MailPoets neuestem E-Mail-Typ-System 89 - Erweiterte Unterstützung für WooCommerce transaktionale E-Mails 90 - Bessere Fehlerbehandlung und Logging für E-Mail-Typ-Erkennung 91 - Zukunftssichere Architektur die sich automatisch an MailPoet-Updates anpasst 92 93 = 1.2.1 = 94 95 Release date: August 20th 2025 96 97 - **NEU: Erweiterte E-Mail-Typ-Unterstützung mit Pattern-Matching** 98 - **NEU: Unterstützung für Preview-E-Mails** 99 - **NEU: Unterstützung für E-Mail-Statistik-Benachrichtigungen** 100 - **NEU: Unterstützung für neue Abonnenten-Benachrichtigungen** 101 - **NEU: Intelligentes Pattern-Matching für automatische E-Mails** 102 - **NEU: WooCommerce automatische E-Mail-Unterstützung (automatic_woocommerce_*)** 103 - **NEU: Generische automatische E-Mail-Pattern-Unterstützung (automatic_*_*)** 104 - **NEU: Erweiterte E-Mail-Typ-Validierung mit Regex-Patterns** 105 - **NEU: Verbessertes Debugging für E-Mail-Typ-Matching** 106 - **NEU: Admin-Interface zeigt Anzahl unterstützter E-Mail-Typen** 107 - **NEU: Zukunftssichere E-Mail-Typ-Erkennung** 108 - Verbesserte Kompatibilität mit MailPoets neuestem automatischen E-Mail-System 109 - Erweiterte Unterstützung für komplexe E-Mail-Typ-Patterns 110 - Bessere Fehlerbehandlung und Logging für E-Mail-Typ-Erkennung 68 111 69 112 = 1.2.0 =
Note: See TracChangeset
for help on using the changeset viewer.