Plugin Directory

Changeset 3317194


Ignore:
Timestamp:
06/24/2025 07:23:40 PM (9 months ago)
Author:
omykhailenko
Message:

Updating trunk

Location:
mailgun/trunk
Files:
6 edited

Legend:

Unmodified
Added
Removed
  • mailgun/trunk/CHANGELOG.md

    r3291440 r3317194  
    11Changelog
    22=========
     3
     42.1.9 (2025-06-24)
     5- Added fallback option. Merge PR for widget
    36
    472.1.8 (2025-05-11)
  • mailgun/trunk/includes/options-page.php

    r3263795 r3317194  
    6161
    6262$suppressClicks = $this->get_option('suppress_clicks') ?: 'no';
     63$emailFallback = $this->get_option('email_fallback') ?: 'no';
     64
     65$settings = [];
     66try {
     67    $settings = $mailgun->getTrackingSettings();
     68} catch (Throwable $e) {
     69}
    6370
    6471?>
     
    117124
    118125        <table class="form-table">
     126            <?php if ($settings) : ?>
     127                <tr>
     128                    <th><?php _e('Domain tracking settings from account', 'mailgun'); ?></th>
     129                    <td>
     130                        <ul>
     131                            <li>
     132                                <b>Click tracking</b> &mdash; <?php echo $settings['tracking']['open']['active'] == 1 ? 'Yes' : 'No'?>
     133                            </li>
     134                            <li>
     135                                <b>Open tracking</b> &mdash;  <?php echo $settings['tracking']['click']['active'] == 1 ? 'Yes' : 'No'?>
     136                            </li>
     137                            <li>
     138                                <b>Unsubscribes</b> &mdash; <?php echo $settings['tracking']['unsubscribe']['active'] == 1 ? 'Yes' : 'No'?>
     139                            </li>
     140                        </ul>
     141                    </td>
     142                </tr>
     143            <?php endif; ?>
    119144            <tr valign="top">
    120145                <th scope="row">
     
    430455                        <span><?php _e('Experimental function', 'mailgun'); ?></span>
    431456                    </p>
     457                </td>
     458            </tr>
     459            <tr valign="top">
     460                <th scope="row">
     461                    <?php _e('Email fallback', 'mailgun'); ?> <br>
     462                </th>
     463                <td>
     464                    <select
     465                            name="mailgun[email_fallback]">
     466                        <option value="yes"<?php selected('yes', $emailFallback); ?>><?php _e('Yes', 'mailgun'); ?></option>
     467                        <option value="no"<?php selected('no', $emailFallback); ?>><?php _e('No', 'mailgun'); ?></option>
     468                    </select>
    432469                </td>
    433470            </tr>
  • mailgun/trunk/includes/wp-mail-api.php

    r3245197 r3317194  
    496496
    497497        // Email Fallback
    498 
    499         if ($isFallbackNeeded) {
     498        $isFallbackEnabled = get_option('email_fallback') ?: 'no';
     499        if ($isFallbackNeeded && $isFallbackEnabled === 'yes') {
    500500            global $phpmailer;
    501501
  • mailgun/trunk/mailgun.php

    r3291440 r3317194  
    44 * Plugin URI:   http://wordpress.org/extend/plugins/mailgun/
    55 * Description:  Mailgun integration for WordPress
    6  * Version:      2.1.8
     6 * Version:      2.1.9
    77 * Requires PHP: 7.4
    88 * Requires at least: 4.4
     
    293293
    294294        return $results;
     295    }
     296
     297    /**
     298     * @return array
     299     * @throws JsonException
     300     */
     301    public function getTrackingSettings(): array
     302    {
     303        $domain   = ( defined( 'MAILGUN_DOMAIN' ) && MAILGUN_DOMAIN ) ? MAILGUN_DOMAIN : $this->get_option( 'domain' );
     304        if (!$domain) {
     305            return [];
     306        }
     307        $settings = $this->api_call(sprintf("domains/%s/tracking", $domain), [], 'GET' );
     308
     309        return json_decode( $settings, true, 512, JSON_THROW_ON_ERROR );
    295310    }
    296311
     
    385400                    <?php if ( isset( $args['collect_name'] ) && (int) $args['collect_name'] === 1 ) : ?>
    386401                        <p class="mailgun-list-widget-name">
    387                             <strong>Name:</strong>
    388                             <input type="text" name="name"/>
     402                            <label><strong>Name:</strong></label>
     403                            <input type="text" name="name" placeholder="Name"/>
    389404                        </p>
    390405                    <?php endif; ?>
    391406                    <p class="mailgun-list-widget-email">
    392                         <strong>Email:</strong>
    393                         <input type="text" name="email"/>
     407                        <label><strong>Email:</strong></label>
     408                        <input type="text" name="email" placeholder="Email"/>
    394409                    </p>
    395410                </div>
    396411
    397                 <?php if ( count( $list_addresses ) > '1' ) : ?>
     412                <div class="mailgun-list-widget-lists">
     413                    <?php if ( count( $list_addresses ) > '1' ) : ?>
    398414                    <ul class="mailgun-lists" style="list-style: none;">
    399415                        <?php
     
    415431                <input class="mailgun-list-submit-button" data-form-id="<?php echo esc_attr( $form_class_id ); ?>" type="button"
    416432                        value="Subscribe"/>
    417                 <input type="hidden" name="mailgun-submission" value="1"/>
     433                <input type="hidden" name="mailgun-submission" value="1"/></div>
    418434
    419435            </form>
     
    444460                return
    445461                }
     462
     463              // Email validation regex pattern
     464              var emailPattern = /.+@.+\..{2,}/;
     465
     466              if (!emailPattern.test(jQuery('.' + form_id + ' .mailgun-list-widget-email input').val())) {
     467                  alert('Please enter a valid email address.')
     468                  return
     469              }
    446470
    447471                jQuery.ajax({
  • mailgun/trunk/readme.md

    r3291440 r3317194  
    55Tags: mailgun, smtp, http, api, mail, email
    66Tested up to: 6.8.1
    7 Stable tag: 2.1.8
     7Stable tag: 2.1.9
    88Requires PHP: 7.4
    99License: GPLv2 or later
  • mailgun/trunk/readme.txt

    r3291440 r3317194  
    55Tags: mailgun, smtp, http, api, mail, email
    66Tested up to: 6.8.1
    7 Stable tag: 2.1.8
     7Stable tag: 2.1.9
    88Requires PHP: 7.4
    99License: GPLv2 or later
     
    130130== Changelog ==
    131131
     132= 2.1.9 (2025-06-24): =
     133- Added fallback option. Merge PR for widget
     134
    132135= 2.1.8 (2025-05-11): =
    133136- Just keep update WP version. And tested compatibility with it
Note: See TracChangeset for help on using the changeset viewer.