Plugin Directory

Changeset 1469692

Timestamp:
08/08/2016 01:14:27 AM (8 years ago)
Author:
jbrinley
Message:

Version 1.1.1 - subscription management

Location:
mailgun-subscriptions/trunk
Files:
9 added
13 edited

Legend:

Unmodified
Added
Removed
  • mailgun-subscriptions/trunk/Mailgun_Subscriptions/API.php

    r994371 r1469692  
    88    private $key = '';
    99    private $url = '';
    10     public function __construct( $apiKey, $apiEndpoint = "api.mailgun.net", $apiVersion = "v2", $ssl = true ) {
     10    public function __construct( $apiKey, $apiEndpoint = "api.mailgun.net", $apiVersion = "v", $ssl = true ) {
    1111        $this->key = $apiKey;
    1212        $this->url = $this->build_base_url( $apiEndpoint, $apiVersion, $ssl );
     
    4545    }
    4646
     47
     48
     49
     50
     51
     52
     53
     54
     55
     56
     57
     58
     59
     60
     61
     62
     63
     64
     65
     66
     67
     68
     69
     70
     71
     72
     73
     74
     75
     76
     77
     78
     79
     80
    4781    public function validate_email( $address ) {
    4882        $response = $this->get( 'address/validate', array(
  • mailgun-subscriptions/trunk/Mailgun_Subscriptions/Admin_Page.php

    r994371 r1469692  
    88class Admin_Page {
    99    const MENU_SLUG = 'mailgun_subscriptions';
     10
    1011
    1112    public function refresh_caches() {
     
    150151        );
    151152
     153
     154
     155
     156
     157
     158
     159
     160
     161
     162
     163
     164
     165
     166
     167
     168
     169
     170
    152171        register_setting(
    153172            self::MENU_SLUG,
     
    159178            'mailgun_new_list',
    160179            array( $this, 'save_new_list' )
     180
     181
     182
     183
     184
     185
     186
     187
     188
     189
     190
     191
     192
     193
     194
     195
     196
     197
     198
     199
    161200        );
    162201    }
     
    199238        $value = get_option( $args['option'], $args['default'] );
    200239        printf( '<textarea rows="%s" cols="%s" name="%s" class="widefat">%s</textarea>', intval($args['rows']), intval($args['cols']), esc_attr($args['option']), esc_textarea($value) );
     240
     241
     242
     243
     244
     245
     246
     247
     248
     249
     250
     251
     252
     253
     254
     255
    201256        if ( !empty($args['description']) ) {
    202257            printf( '<p class="description">%s</p>', $args['description'] );
     
    359414        $description = __("This email will be sent to users after they confirm their subscription. Leave blank to disable this email. Your template can contain the following shortcodes:<br />
    360415            <code>[email]</code> &ndash; This is the user's email address.<br />
    361             <code>[lists]</code> &ndash; This is a list of the lists the user opted to subscribe to.", 'mailgun-subscriptions' );
     416            <code>[lists]</code> &ndash; This is a list of the lists the user opted to subscribe to.<br />
     417            <code>[link]</code> &ndash; This is the URL to the user's account management page.", 'mailgun-subscriptions' );
    362418        return $description;
     419
     420
     421
     422
     423
     424
     425
     426
     427
     428
    363429    }
    364430}
  • mailgun-subscriptions/trunk/Mailgun_Subscriptions/Confirmation_Handler.php

    r994371 r1469692  
    9999        $message = str_replace( '[email]', $this->confirmation->get_address(), $message );
    100100        $message = str_replace( '[lists]', $this->get_formatted_lists(), $message );
     101
    101102        return $message;
    102103    }
     
    117118        }
    118119        return apply_filters( 'mailgun_welcome_email_lists', implode("\n", $formatted), $requested_lists );
     120
     121
     122
     123
     124
    119125    }
    120126
  • mailgun-subscriptions/trunk/Mailgun_Subscriptions/Plugin.php

    r994371 r1469692  
    66
    77class Plugin {
    8     const VERSION = '1.0';
     8    const VERSION = '1.';
    99
    1010    /** @var Plugin */
     
    2424    /** @var Shortcode_Handler */
    2525    private $shortcode_handler = NULL;
     26
     27
     28
     29
     30
     31
     32
     33
     34
    2635
    2736    public function api( $public = FALSE ) {
     
    4958    }
    5059
     60
     61
     62
     63
     64
     65
     66
     67
    5168    private function setup( $plugin_file ) {
    5269        self::$plugin_file = $plugin_file;
     
    6077
    6178        if ( !is_admin() ) {
    62             if ( !empty($_POST['mailgun-action']) && $_POST['mailgun-action'] == 'subscribe' ) {
    63                 $this->setup_submission_handler();
     79            if ( !empty( $_REQUEST[ 'mailgun-action' ] ) ) {
     80                switch( $_REQUEST[ 'mailgun-action' ] ) {
     81                    case 'subscribe':
     82                        $this->setup_submission_handler();
     83                        break;
     84                    case 'confirm':
     85                        $this->setup_confirmation_handler();
     86                        break;
     87                    case 'request-token':
     88                        $this->setup_token_request_handler();
     89                        break;
     90                    case 'account-subscribe':
     91                    case 'account-resubscribe':
     92                    case 'account-unsubscribe':
     93                        $this->setup_account_management_handler();
     94                        break;
     95                }
    6496            }
    65             if ( !empty($_GET['mailgun-action']) && $_GET['mailgun-action'] == 'confirm' ) {
    66                 $this->setup_confirmation_handler();
    67             }
    68 
    6997            add_action( 'wp', array( $this, 'setup_confirmation_page' ), 10, 0 );
    7098        }
     
    76104        $this->setup_widget();
    77105        $this->setup_shortcodes();
     106
    78107        add_action( 'mailgun_enqueue_assets', array( $this, 'enqueue_assets' ), 10, 0 );
    79108    }
     
    127156        $this->shortcode_handler = new Shortcode_Handler();
    128157        $this->shortcode_handler->register_shortcodes();
     158
     159
     160
     161
     162
     163
     164
     165
     166
     167
     168
     169
     170
     171
     172
    129173    }
    130174
  • mailgun-subscriptions/trunk/Mailgun_Subscriptions/Shortcode_Handler.php

    r994371 r1469692  
    1010        add_shortcode( 'mailgun_lists', array( $this, 'lists_shortcode' ) );
    1111        add_shortcode( 'mailgun_subscription_form', array( $this, 'form_shortcode' ) );
     12
    1213    }
    1314
     
    8586        return array_keys($lists);
    8687    }
     88
     89
     90
     91
     92
    8793}
  • mailgun-subscriptions/trunk/Mailgun_Subscriptions/Submission_Handler.php

    r994371 r1469692  
    186186    protected function get_redirect_base_url() {
    187187        $url = $_SERVER['REQUEST_URI'];
    188         foreach ( array('mailgun-message', 'mailgun-error', 'mailgun-action', 'ref') as $key ) {
    189             $url = remove_query_arg('key', $url);
     188        foreach ( array('mailgun-message', 'mailgun-error', 'mailgun-action', 'ref') as $key ) {
     189            $url = remove_query_arg();
    190190        }
    191191        return $url;
  • mailgun-subscriptions/trunk/Mailgun_Subscriptions/Subscription_Form.php

    r994371 r1469692  
    7171                break;
    7272            default:
    73                 $message = $code;
     73                $message = ;
    7474                break;
    7575        }
  • mailgun-subscriptions/trunk/Mailgun_Subscriptions/Template.php

    r994371 r1469692  
    1111
    1212    public static function welcome_email() {
    13         return __("Your email address, [email], has been confirmed. You are now subscribed to the following lists:\n\n[lists]", 'mailgun-subscriptions');
     13        return __("Your email address, [email], has been confirmed. You are now subscribed to the following lists:\n\n[lists]", 'mailgun-subscriptions');
    1414    }
    1515
     
    1717        return __("<p>Thank you for confirming your subscription. <strong>[mailgun_email]</strong> is now subscribed to:</p>[mailgun_lists]", 'mailgun-subscriptions');
    1818    }
     19
     20
     21
     22
    1923}
  • mailgun-subscriptions/trunk/Mailgun_Subscriptions/Widget.php

    r994371 r1469692  
    3838            'lists' => $instance['lists'],
    3939        ));
     40
     41
     42
     43
     44
     45
     46
     47
    4048
    4149        echo $args['after_widget'];
  • mailgun-subscriptions/trunk/assets/mailgun-subscriptions.css

    r994371 r1469692  
    2323    color: #CC0000;
    2424}
     25
     26
     27
     28
     29
     30
     31
     32
     33
     34
     35
     36
     37
     38
     39
     40
     41
     42
     43
     44
     45
     46
     47
     48
     49
     50
     51
     52
     53
     54
  • mailgun-subscriptions/trunk/mailgun-subscriptions.php

    r994371 r1469692  
    66Author: Flightless
    77Author URI: http://flightless.us/
    8 Version: 1.0
     8Version: 1.
    99Text Domain: mailgun-subscriptions
    1010Domain Path: /languages
  • mailgun-subscriptions/trunk/readme.md

    r994371 r1469692  
    88
    99You'll find the "Mailgun Lists" settings page in the Settings admin menu. Here, you can setup your API keys, control which lists you're making available, and create custom descriptions for your lists.
     10
     11
    1012
    1113## Subscription Form Widget
     
    3638### Confirmation Email
    3739
    38 You can set up templates for two emails the plugin will send.
     40You can set up templates for t emails the plugin will send.
    3941
    4042When a user first submits the subscription form, the "Confirmation Email" is sent. Your template should contain the following shortcodes:
     
    5860* `[email]` - This is the user's email address.
    5961* `[lists]` - This is a list of the lists the user opted to subscribe to.
     62
    6063
    6164#### Filters
     
    6669
    6770`mailgun_welcome_email_lists` - Edit the list of mailing lists in the email template.
     71
     72
     73
     74
     75
     76
     77
     78
     79
     80
     81
     82
    6883
    6984## Confirmation Page
  • mailgun-subscriptions/trunk/readme.txt

    r994371 r1469692  
    33Tags: mailing lists, subscriptions, widget, email
    44Requires at least: 3.9
    5 Tested up to: 3.9
    6 Stable tag: 1.0
     5Tested up to:
     6Stable tag: 1.
    77License: BSD 3-Clause
    88License URI: http://opensource.org/licenses/BSD-3-Clause
     
    2121== Changelog ==
    2222
     23
     24
     25
     26
    2327= 1.0 =
    2428* Initial version
Note: See TracChangeset for help on using the changeset viewer.