Changeset 1469692
- Timestamp:
- 08/08/2016 01:14:27 AM (8 years ago)
- Location:
- mailgun-subscriptions/trunk
- Files:
-
- 9 added
- 13 edited
Legend:
- Unmodified
- Added
- Removed
-
mailgun-subscriptions/trunk/Mailgun_Subscriptions/API.php
r994371 r1469692 8 8 private $key = ''; 9 9 private $url = ''; 10 public function __construct( $apiKey, $apiEndpoint = "api.mailgun.net", $apiVersion = "v 2", $ssl = true ) {10 public function __construct( $apiKey, $apiEndpoint = "api.mailgun.net", $apiVersion = "v", $ssl = true ) { 11 11 $this->key = $apiKey; 12 12 $this->url = $this->build_base_url( $apiEndpoint, $apiVersion, $ssl ); … … 45 45 } 46 46 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 47 81 public function validate_email( $address ) { 48 82 $response = $this->get( 'address/validate', array( -
mailgun-subscriptions/trunk/Mailgun_Subscriptions/Admin_Page.php
r994371 r1469692 8 8 class Admin_Page { 9 9 const MENU_SLUG = 'mailgun_subscriptions'; 10 10 11 11 12 public function refresh_caches() { … … 150 151 ); 151 152 153 154 155 156 157 158 159 160 161 162 163 164 165 166 167 168 169 170 152 171 register_setting( 153 172 self::MENU_SLUG, … … 159 178 'mailgun_new_list', 160 179 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 161 200 ); 162 201 } … … 199 238 $value = get_option( $args['option'], $args['default'] ); 200 239 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 201 256 if ( !empty($args['description']) ) { 202 257 printf( '<p class="description">%s</p>', $args['description'] ); … … 359 414 $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 /> 360 415 <code>[email]</code> – This is the user's email address.<br /> 361 <code>[lists]</code> – This is a list of the lists the user opted to subscribe to.", 'mailgun-subscriptions' ); 416 <code>[lists]</code> – This is a list of the lists the user opted to subscribe to.<br /> 417 <code>[link]</code> – This is the URL to the user's account management page.", 'mailgun-subscriptions' ); 362 418 return $description; 419 420 421 422 423 424 425 426 427 428 363 429 } 364 430 } -
mailgun-subscriptions/trunk/Mailgun_Subscriptions/Confirmation_Handler.php
r994371 r1469692 99 99 $message = str_replace( '[email]', $this->confirmation->get_address(), $message ); 100 100 $message = str_replace( '[lists]', $this->get_formatted_lists(), $message ); 101 101 102 return $message; 102 103 } … … 117 118 } 118 119 return apply_filters( 'mailgun_welcome_email_lists', implode("\n", $formatted), $requested_lists ); 120 121 122 123 124 119 125 } 120 126 -
mailgun-subscriptions/trunk/Mailgun_Subscriptions/Plugin.php
r994371 r1469692 6 6 7 7 class Plugin { 8 const VERSION = '1. 0';8 const VERSION = '1.'; 9 9 10 10 /** @var Plugin */ … … 24 24 /** @var Shortcode_Handler */ 25 25 private $shortcode_handler = NULL; 26 27 28 29 30 31 32 33 34 26 35 27 36 public function api( $public = FALSE ) { … … 49 58 } 50 59 60 61 62 63 64 65 66 67 51 68 private function setup( $plugin_file ) { 52 69 self::$plugin_file = $plugin_file; … … 60 77 61 78 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 } 64 96 } 65 if ( !empty($_GET['mailgun-action']) && $_GET['mailgun-action'] == 'confirm' ) {66 $this->setup_confirmation_handler();67 }68 69 97 add_action( 'wp', array( $this, 'setup_confirmation_page' ), 10, 0 ); 70 98 } … … 76 104 $this->setup_widget(); 77 105 $this->setup_shortcodes(); 106 78 107 add_action( 'mailgun_enqueue_assets', array( $this, 'enqueue_assets' ), 10, 0 ); 79 108 } … … 127 156 $this->shortcode_handler = new Shortcode_Handler(); 128 157 $this->shortcode_handler->register_shortcodes(); 158 159 160 161 162 163 164 165 166 167 168 169 170 171 172 129 173 } 130 174 -
mailgun-subscriptions/trunk/Mailgun_Subscriptions/Shortcode_Handler.php
r994371 r1469692 10 10 add_shortcode( 'mailgun_lists', array( $this, 'lists_shortcode' ) ); 11 11 add_shortcode( 'mailgun_subscription_form', array( $this, 'form_shortcode' ) ); 12 12 13 } 13 14 … … 85 86 return array_keys($lists); 86 87 } 88 89 90 91 92 87 93 } -
mailgun-subscriptions/trunk/Mailgun_Subscriptions/Submission_Handler.php
r994371 r1469692 186 186 protected function get_redirect_base_url() { 187 187 $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(); 190 190 } 191 191 return $url; -
mailgun-subscriptions/trunk/Mailgun_Subscriptions/Subscription_Form.php
r994371 r1469692 71 71 break; 72 72 default: 73 $message = $code;73 $message = ; 74 74 break; 75 75 } -
mailgun-subscriptions/trunk/Mailgun_Subscriptions/Template.php
r994371 r1469692 11 11 12 12 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'); 14 14 } 15 15 … … 17 17 return __("<p>Thank you for confirming your subscription. <strong>[mailgun_email]</strong> is now subscribed to:</p>[mailgun_lists]", 'mailgun-subscriptions'); 18 18 } 19 20 21 22 19 23 } -
mailgun-subscriptions/trunk/Mailgun_Subscriptions/Widget.php
r994371 r1469692 38 38 'lists' => $instance['lists'], 39 39 )); 40 41 42 43 44 45 46 47 40 48 41 49 echo $args['after_widget']; -
mailgun-subscriptions/trunk/assets/mailgun-subscriptions.css
r994371 r1469692 23 23 color: #CC0000; 24 24 } 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 6 6 Author: Flightless 7 7 Author URI: http://flightless.us/ 8 Version: 1. 08 Version: 1. 9 9 Text Domain: mailgun-subscriptions 10 10 Domain Path: /languages -
mailgun-subscriptions/trunk/readme.md
r994371 r1469692 8 8 9 9 You'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 10 12 11 13 ## Subscription Form Widget … … 36 38 ### Confirmation Email 37 39 38 You can set up templates for t woemails the plugin will send.40 You can set up templates for t emails the plugin will send. 39 41 40 42 When a user first submits the subscription form, the "Confirmation Email" is sent. Your template should contain the following shortcodes: … … 58 60 * `[email]` - This is the user's email address. 59 61 * `[lists]` - This is a list of the lists the user opted to subscribe to. 62 60 63 61 64 #### Filters … … 66 69 67 70 `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 68 83 69 84 ## Confirmation Page -
mailgun-subscriptions/trunk/readme.txt
r994371 r1469692 3 3 Tags: mailing lists, subscriptions, widget, email 4 4 Requires at least: 3.9 5 Tested up to: 3.96 Stable tag: 1. 05 Tested up to: 6 Stable tag: 1. 7 7 License: BSD 3-Clause 8 8 License URI: http://opensource.org/licenses/BSD-3-Clause … … 21 21 == Changelog == 22 22 23 24 25 26 23 27 = 1.0 = 24 28 * Initial version
Note: See TracChangeset
for help on using the changeset viewer.