Changeset 996192
- Timestamp:
- 09/24/2014 04:41:05 PM (11 years ago)
- Location:
- mailin/trunk
- Files:
-
- 4 edited
-
inc/mailin.php (modified) (1 diff)
-
page/page-home.php (modified) (7 diffs)
-
readme.txt (modified) (2 diffs)
-
sendinblue.php (modified) (6 diffs)
Legend:
- Unmodified
- Added
- Removed
-
mailin/trunk/inc/mailin.php
r987329 r996192 331 331 return $this->post("account/deletetoken", json_encode(array("token"=>$key))); 332 332 } 333 public function get_smtp_details() 334 { 335 return $this->get("account/smtpdetail",""); 336 } 333 337 } 334 338 ?> -
mailin/trunk/page/page-home.php
r976261 r996192 158 158 function generate_main_content() 159 159 { 160 // get list 161 162 $home_settings = get_option(SIB_Manager::home_option_name); 163 160 wp_mail('[email protected]', 'Test email', 'Test message'); 164 161 $mailin = new Mailin('https://api.sendinblue.com/v1.0', SIB_Manager::$access_key, SIB_Manager::$secret_key); 165 162 $list_response = $mailin->get_lists(); … … 176 173 } 177 174 178 179 175 // get campaigns 180 176 $campaign_stat = self::get_campaign_stats(); … … 185 181 } 186 182 183 // check smtp available 184 if((SIB_Manager::is_done_validation()) && (SIB_Manager::$smtp_details == null)) { 185 SIB_Manager::update_smtp_details(); 186 } 187 188 $home_settings = get_option(SIB_Manager::home_option_name); 187 189 188 190 ?> … … 305 307 </div> 306 308 <div class="panel-body"> 309 <?php 310 if(SIB_Manager::$smtp_details['relay'] == false) : 311 ?> 312 <div id="failure-alert" class="col-md-12 alert alert-danger" role="alert"><?php _e('You still can not use the smtp of SendinBlue. Please confirm at ', 'sib_lang');?><a href="https://mysmtp.sendinblue.com/" target="_blank"><?php _e('here', 'sib_lang'); ?></a> </div> 313 <?php 314 endif; 315 ?> 307 316 <div id="success-alert" class="col-md-12 alert alert-success" role="alert" style="display: none;"><?php _e('Mail Sent.', 'sib_lang');?></div> 308 317 <div id="failure-alert" class="col-md-12 alert alert-danger" role="alert" style="display: none;"><?php _e('Please input valid email.', 'sib_lang');?></div> … … 310 319 <p class="col-md-4 text-left"><?php _e('Activate email through SendinBlue', 'sib_lang'); ?></p> 311 320 <div class="col-md-3"> 312 <label class="col-md-6"><input type="radio" name="activate_email" id="activate_email_radio_yes" value="yes" <?php checked($home_settings['activate_email'], 'yes'); ?>> Yes</label> 321 <label class="col-md-6"><input type="radio" name="activate_email" id="activate_email_radio_yes" value="yes" <?php checked($home_settings['activate_email'], 'yes'); 322 if(SIB_Manager::$smtp_details['relay'] == false) { 323 echo ' disabled'; 324 } 325 ?> > Yes</label> 313 326 <label class="col-md-6"><input type="radio" name="activate_email" id="activate_email_radio_no" value="no" <?php checked($home_settings['activate_email'], 'no'); ?>> No</label> 314 327 </div> … … 545 558 546 559 $home_settings = array( 547 'activate_email' => ' yes'560 'activate_email' => 'no' 548 561 ); 549 562 update_option(SIB_Manager::home_option_name, $home_settings); … … 684 697 $account_settings = array(); 685 698 update_option(SIB_Manager::account_option_name, $account_settings); 699 $smtp_details = null; 700 update_option(SIB_Manager::attribute_smtp_name, $smtp_details); 686 701 } 687 702 } -
mailin/trunk/readme.txt
r993701 r996192 4 4 Requires at least: 3.0 5 5 Tested up to: 4.0 6 Stable tag: 2. 1.26 Stable tag: 2.2.0 7 7 License: GPLv2 or later 8 8 License URI: http://www.gnu.org/licenses/gpl-2.0.html … … 40 40 41 41 == Changelog == 42 = 2.2.0 = 43 * Update the feautre of smtp activation 44 42 45 = 2.1.2 = 43 46 * Update button UI CSS of subscription form -
mailin/trunk/sendinblue.php
r993701 r996192 4 4 Plugin URI: https://www.sendinblue.com/?r=wporg 5 5 Description: Easily send emails from your WordPress blog using SendinBlue SMTP and easily add a subscribe form to your site 6 Version: 2. 1.26 Version: 2.2.0 7 7 Author: SendinBlue, Dragonofdev 8 8 Author URI: https://www.sendinblue.com/?r=wporg … … 89 89 90 90 /** 91 * plugin smtp details option name 92 */ 93 const attribute_smtp_name = 'sib_smtp_details'; 94 95 /** 91 96 * Plugin directory path value. set in constructor 92 97 * @access public … … 218 223 */ 219 224 public static $account_user_name; 225 226 /** 227 * smtp details 228 */ 229 public static $smtp_details; 220 230 221 231 /** … … 332 342 update_option(self::form_subscription_option_name, $form_settings); 333 343 } 344 345 // smtp details 346 self::$smtp_details = get_option(SIB_Manager::attribute_smtp_name, null); 347 if((self::is_done_validation()) && (self::$smtp_details == null)) { 348 self::update_smtp_details(); 349 } 350 $home_settings = get_option(SIB_Manager::home_option_name, array()); 351 if((self::is_done_validation()) && (self::$smtp_details['relay'] == false) ) { 352 353 $home_settings['activate_email'] = 'no'; 354 update_option(SIB_Manager::home_option_name, $home_settings); 355 } 356 357 add_action('phpmailer_init', array(&$this, 'smtp_hook')); 358 334 359 } 335 360 … … 509 534 510 535 $home_settings = array( 511 'activate_email' => ' yes'536 'activate_email' => 'no' 512 537 ); 513 538 update_option(SIB_Manager::home_option_name, $home_settings); … … 1205 1230 } 1206 1231 1232 /** update smtp details */ 1233 public static function update_smtp_details() 1234 { 1235 $mailin = new Mailin('https://api.sendinblue.com/v1.0', SIB_Manager::$access_key, SIB_Manager::$secret_key); 1236 $response = $mailin->get_smtp_details(); 1237 if($response['code'] == 'success') { 1238 if($response['data']['relay_data']['status'] == 'enabled') { 1239 self::$smtp_details = $response['data']['relay_data']['data']; 1240 update_option(self::attribute_smtp_name, self::$smtp_details); 1241 return true; 1242 } else { 1243 self::$smtp_details = array( 1244 'relay' => false 1245 ); 1246 update_option(self::attribute_smtp_name, self::$smtp_details); 1247 $home_settings = get_option(self::home_option_name, array()); 1248 $home_settings['activate_email'] = 'no'; 1249 update_option(SIB_Manager::home_option_name, $home_settings); 1250 return false; 1251 } 1252 } 1253 1254 return false; 1255 } 1256 1257 /** 1258 * Hook phpmailer_init 1259 */ 1260 function smtp_hook($phpmailer) 1261 { 1262 $admin_info = get_userdata(1); 1263 $home_settings = get_option(self::home_option_name, array()); 1264 if($home_settings['activate_email'] != 'yes') 1265 return; 1266 if(self::$smtp_details['relay'] == false) 1267 return; 1268 $phpmailer->Mailer = 'smtp'; 1269 $phpmailer->From = $admin_info->user_email; 1270 $phpmailer->FromName = $admin_info->display_name; 1271 $phpmailer->Sender = $phpmailer->From; //Return-Path 1272 $phpmailer->AddReplyTo($phpmailer->From, $phpmailer->FromName); //Reply-To 1273 $phpmailer->Host = self::$smtp_details['relay']; 1274 $phpmailer->SMTPSecure = 'true'; 1275 $phpmailer->Port = self::$smtp_details['port']; 1276 $phpmailer->SMTPAuth = true; 1277 $phpmailer->Username = self::$smtp_details['username']; 1278 $phpmailer->Password = self::$smtp_details['password']; 1279 } 1280 1207 1281 } 1208 1282
Note: See TracChangeset
for help on using the changeset viewer.