Changeset 3255467
- Timestamp:
- 03/13/2025 03:39:29 PM (14 months ago)
- Location:
- turbosmtp
- Files:
-
- 14 edited
- 1 copied
-
tags/4.9.1 (copied) (copied from turbosmtp/trunk)
-
tags/4.9.1/README.md (modified) (2 diffs)
-
tags/4.9.1/admin/class-turbosmtp-admin.php (modified) (2 diffs)
-
tags/4.9.1/admin/partials/configuration.php (modified) (2 diffs)
-
tags/4.9.1/common-api.php (modified) (3 diffs)
-
tags/4.9.1/includes/class-turbosmtp.php (modified) (2 diffs)
-
tags/4.9.1/public/class-turbosmtp-public.php (modified) (4 diffs)
-
tags/4.9.1/turbosmtp.php (modified) (2 diffs)
-
trunk/README.md (modified) (2 diffs)
-
trunk/admin/class-turbosmtp-admin.php (modified) (2 diffs)
-
trunk/admin/partials/configuration.php (modified) (2 diffs)
-
trunk/common-api.php (modified) (3 diffs)
-
trunk/includes/class-turbosmtp.php (modified) (2 diffs)
-
trunk/public/class-turbosmtp-public.php (modified) (4 diffs)
-
trunk/turbosmtp.php (modified) (2 diffs)
Legend:
- Unmodified
- Added
- Removed
-
turbosmtp/tags/4.9.1/README.md
r3254931 r3255467 4 4 Requires at least: 6.0 5 5 Tested up to: 6.7.1 6 Stable tag: 4.9. 06 Stable tag: 4.9.1 7 7 License: GPLv2 or later 8 8 License URI: http://www.gnu.org/licenses/gpl-2.0.html … … 29 29 30 30 == Changelog == 31 32 = 4.9.1 = 33 * Better handling of From / From name in API / SMTP sending 31 34 32 35 = 4.9.0 = -
turbosmtp/tags/4.9.1/admin/class-turbosmtp-admin.php
r3254918 r3255467 79 79 $turbosmtp_hosts = turbosmtp_valid_hosts(); 80 80 $send_options = get_option( "ts_send_options" ); 81 81 82 $user_config = $this->api->get_user_config(); 83 84 if (!isset($send_options['email'])){ 85 $send_options['email'] = $user_config['email']; 86 } 87 88 if (!isset($send_options['host'])){ 89 $send_options['host'] = 'pro.turbo-smtp.com'; 90 } 91 92 if (!isset($send_options['smtpsecure'])){ 93 $send_options['smtpsecure'] = 'ssl'; 94 } 95 96 if (!isset($send_options['port'])){ 97 $send_options['port'] = 465; 98 } 99 100 if (!isset($send_options['port'])){ 101 $send_options['port'] = 465; 102 } 103 82 104 $current_user = wp_get_current_user(); 83 105 require_once plugin_dir_path( TURBOSMTP_BASE_PATH ) . '/admin/partials/configuration.php'; … … 282 304 } 283 305 require_once plugin_dir_path( TURBOSMTP_BASE_PATH ) . '/admin/partials/credentials.php'; 306 } 307 308 /** 309 * Register the shortcut for the settings area. 310 * 311 * @since 1.0.0 312 */ 313 public function settings_link( $links, $file ) { 314 if ( is_network_admin() ) { 315 $settings_url = network_admin_url( 'admin.php?page=turbosmtp_config' ); 316 } else { 317 $settings_url = admin_url( 'admin.php?page=turbosmtp_config' ); 318 } 319 320 $settings_link = '<a href="' . esc_url( $settings_url ) . '">' . __( 'Settings', 'turbosmtp' ) . '</a>'; 321 array_unshift( $links, $settings_link ); 322 323 return $links; 284 324 } 285 325 -
turbosmtp/tags/4.9.1/admin/partials/configuration.php
r3254918 r3255467 18 18 */ 19 19 20 ?>21 22 <?php23 20 24 21 $send_method = $send_options['is_smtp'] ? 'smtp' : 'api'; … … 203 200 <p> 204 201 <input id="turboSMTP_mail_smtpsecure_none" name="ts_smtp_smtpsecure" type="radio" 205 value="" <?php if ($send_options["smtpsecure"] == '') { ?> checked="checked"<?php } ?> />202 value="" <?php if ($send_options["smtpsecure"] == '') { ?> checked="checked"<?php } ?> /> 206 203 <label for="ts_smtp_smtpsecure"> 207 204 <?php _e("No encryption (non-SSL)", "turbosmtp"); ?> -
turbosmtp/tags/4.9.1/common-api.php
r3254918 r3255467 131 131 } 132 132 133 function turbosmtp_get_header _content_type(133 function turbosmtp_get_headers_data( 134 134 $headers 135 135 ) { 136 136 137 $content_type = "text/plain"; 137 $data = [ 138 "content-type" => "text/plain", 139 "from" => "", 140 "fromname" => "", 141 "cc" => [], 142 "bcc" => [], 143 "reply-to" => [] 144 ]; 138 145 139 146 if ( ! is_array( $headers ) ) { … … 150 157 list( $name, $content ) = explode( ':', trim( $header ), 2 ); 151 158 152 if (strtolower($name) === 'content-type') { 153 154 if ( str_contains( $content, ';' ) ) { 155 list( $type ) = explode( ';', $content ); 156 $content_type = trim( $type ); 157 } elseif ( '' !== trim( $content ) ) { 158 $content_type = trim( $content ); 159 } 160 159 $name = strtolower( $name ); 160 161 switch ( $name ) { 162 case 'content-type': 163 164 if ( str_contains( $content, ';' ) ) { 165 list( $type ) = explode( ';', $content ); 166 $data['content-type'] = trim( $type ); 167 } elseif ( '' !== trim( $content ) ) { 168 $data['content-type'] = trim( $content ); 169 } 170 break; 171 172 case 'from': 173 $bracket_pos = strpos( $content, '<' ); 174 if ( false !== $bracket_pos ) { 175 // Text before the bracketed email is the "From" name. 176 if ( $bracket_pos > 0 ) { 177 $from_name = substr( $content, 0, $bracket_pos ); 178 $from_name = str_replace( '"', '', $from_name ); 179 $from_name = trim( $from_name ); 180 $data['fromname'] = $from_name; 181 } 182 183 $from_email = substr( $content, $bracket_pos + 1 ); 184 $from_email = str_replace( '>', '', $from_email ); 185 $from_email = trim( $from_email ); 186 $data['from'] = $from_email; 187 188 } elseif ( '' !== trim( $content ) ) { 189 $from_email = trim( $content ); 190 $data['from'] = $from_email; 191 } 192 193 break; 194 195 case 'cc': 196 $data['cc'] = array_merge( (array) $data['cc'], explode( ',', $content ) ); 197 break; 198 case 'bcc': 199 $data['bcc'] = array_merge( (array) $data['bcc'], explode( ',', $content ) ); 200 break; 201 case 'reply-to': 202 $data['reply-to'] = array_merge( (array) $data['reply-to'], explode( ',', $content ) ); 203 break; 161 204 } 162 205 … … 164 207 } 165 208 166 return $ content_type;167 168 } 209 return $data; 210 211 } -
turbosmtp/tags/4.9.1/includes/class-turbosmtp.php
r3254918 r3255467 155 155 $this->get_version() 156 156 ); 157 158 $prefix = is_network_admin() ? 'network_admin_' : ''; 159 $this->loader->add_filter("{$prefix}plugin_action_links_" . plugin_basename(TURBOSMTP_BASE_PATH), $plugin_admin, 'settings_link', 10, 2); 157 160 158 161 $this->loader->add_action( 'admin_enqueue_scripts', $plugin_admin, 'enqueue_styles' ); … … 201 204 if ( turbosmtp_validapi() ) { 202 205 $this->loader->add_action('pre_wp_mail', $plugin_public, 'maybe_send_via_http', 10, 2 ); 203 $this->loader->add_action( 'phpmailer_init', $plugin_public,' phpmailer_init' );206 $this->loader->add_action( 'phpmailer_init', $plugin_public,'maybe_send_via_phpmailer' ); 204 207 } 205 208 -
turbosmtp/tags/4.9.1/public/class-turbosmtp-public.php
r3254918 r3255467 70 70 */ 71 71 72 function phpmailer_init(72 function maybe_send_via_phpmailer( 73 73 $phpmailer 74 74 ) { … … 84 84 } 85 85 86 $from = $phpmailer->From ?: $send_options['from']; 87 $fromname = $phpmailer->FromName ?: $send_options['fromname']; 88 86 89 $phpmailer->isSMTP(); 87 $phpmailer->setFrom( $ send_options["from"], $send_options["fromname"]);90 $phpmailer->setFrom( $from, $fromname ); 88 91 $phpmailer->Host = $send_options["host"]; 89 92 $phpmailer->SMTPAuth = 'yes'; … … 105 108 } 106 109 107 $ content_type = turbosmtp_get_header_content_type(110 $data = turbosmtp_get_headers_data( 108 111 $atts['headers'] 109 112 ); 110 113 114 $content_type = $data['content-type']; 115 $from = $data['from'] ?: $send_options['from']; 116 $fromname = $data['fromname'] ?: $send_options['fromname']; 117 111 118 $mail_atts = [ 112 119 'to' => $atts['to'], 113 'from' => $ send_options['from'],114 'fromname' => $ send_options['fromname'],120 'from' => $from, 121 'fromname' => $fromname, 115 122 'subject' => $atts['subject'], 116 123 'message' => $atts['message'], … … 149 156 public function turbosmtp_api_response( $response, $args ) { 150 157 $code = (int) $args['code']; 151 if ( $code === 401 && apply_filters( 'turbosmtp_disconnect_if_api_response_401', true) ) {158 if ( $code === 401 && apply_filters( 'turbosmtp_disconnect_if_api_response_401', true ) ) { 152 159 $auth_options = get_option( "ts_auth_options" ); 153 160 $auth_options['valid_api'] = false; -
turbosmtp/tags/4.9.1/turbosmtp.php
r3254918 r3255467 17 17 * Plugin URI: https://www.serversmtp.com/en/smtp-wordpress-configure 18 18 * Description: Easily send emails from your WordPress blog using turboSMTP's services 19 * Version: 4.9. 019 * Version: 4.9.1 20 20 * Author: dueclic 21 21 * Author URI: https://www.dueclic.com/ … … 38 38 * Rename this for your plugin and update it as you release new versions. 39 39 */ 40 define( 'TURBOSMTP_VERSION', '4.9. 0' );40 define( 'TURBOSMTP_VERSION', '4.9.1' ); 41 41 define( 'TURBOSMTP_BASE_PATH', __FILE__ ); 42 42 -
turbosmtp/trunk/README.md
r3254931 r3255467 4 4 Requires at least: 6.0 5 5 Tested up to: 6.7.1 6 Stable tag: 4.9. 06 Stable tag: 4.9.1 7 7 License: GPLv2 or later 8 8 License URI: http://www.gnu.org/licenses/gpl-2.0.html … … 29 29 30 30 == Changelog == 31 32 = 4.9.1 = 33 * Better handling of From / From name in API / SMTP sending 31 34 32 35 = 4.9.0 = -
turbosmtp/trunk/admin/class-turbosmtp-admin.php
r3254918 r3255467 79 79 $turbosmtp_hosts = turbosmtp_valid_hosts(); 80 80 $send_options = get_option( "ts_send_options" ); 81 81 82 $user_config = $this->api->get_user_config(); 83 84 if (!isset($send_options['email'])){ 85 $send_options['email'] = $user_config['email']; 86 } 87 88 if (!isset($send_options['host'])){ 89 $send_options['host'] = 'pro.turbo-smtp.com'; 90 } 91 92 if (!isset($send_options['smtpsecure'])){ 93 $send_options['smtpsecure'] = 'ssl'; 94 } 95 96 if (!isset($send_options['port'])){ 97 $send_options['port'] = 465; 98 } 99 100 if (!isset($send_options['port'])){ 101 $send_options['port'] = 465; 102 } 103 82 104 $current_user = wp_get_current_user(); 83 105 require_once plugin_dir_path( TURBOSMTP_BASE_PATH ) . '/admin/partials/configuration.php'; … … 282 304 } 283 305 require_once plugin_dir_path( TURBOSMTP_BASE_PATH ) . '/admin/partials/credentials.php'; 306 } 307 308 /** 309 * Register the shortcut for the settings area. 310 * 311 * @since 1.0.0 312 */ 313 public function settings_link( $links, $file ) { 314 if ( is_network_admin() ) { 315 $settings_url = network_admin_url( 'admin.php?page=turbosmtp_config' ); 316 } else { 317 $settings_url = admin_url( 'admin.php?page=turbosmtp_config' ); 318 } 319 320 $settings_link = '<a href="' . esc_url( $settings_url ) . '">' . __( 'Settings', 'turbosmtp' ) . '</a>'; 321 array_unshift( $links, $settings_link ); 322 323 return $links; 284 324 } 285 325 -
turbosmtp/trunk/admin/partials/configuration.php
r3254918 r3255467 18 18 */ 19 19 20 ?>21 22 <?php23 20 24 21 $send_method = $send_options['is_smtp'] ? 'smtp' : 'api'; … … 203 200 <p> 204 201 <input id="turboSMTP_mail_smtpsecure_none" name="ts_smtp_smtpsecure" type="radio" 205 value="" <?php if ($send_options["smtpsecure"] == '') { ?> checked="checked"<?php } ?> />202 value="" <?php if ($send_options["smtpsecure"] == '') { ?> checked="checked"<?php } ?> /> 206 203 <label for="ts_smtp_smtpsecure"> 207 204 <?php _e("No encryption (non-SSL)", "turbosmtp"); ?> -
turbosmtp/trunk/common-api.php
r3254918 r3255467 131 131 } 132 132 133 function turbosmtp_get_header _content_type(133 function turbosmtp_get_headers_data( 134 134 $headers 135 135 ) { 136 136 137 $content_type = "text/plain"; 137 $data = [ 138 "content-type" => "text/plain", 139 "from" => "", 140 "fromname" => "", 141 "cc" => [], 142 "bcc" => [], 143 "reply-to" => [] 144 ]; 138 145 139 146 if ( ! is_array( $headers ) ) { … … 150 157 list( $name, $content ) = explode( ':', trim( $header ), 2 ); 151 158 152 if (strtolower($name) === 'content-type') { 153 154 if ( str_contains( $content, ';' ) ) { 155 list( $type ) = explode( ';', $content ); 156 $content_type = trim( $type ); 157 } elseif ( '' !== trim( $content ) ) { 158 $content_type = trim( $content ); 159 } 160 159 $name = strtolower( $name ); 160 161 switch ( $name ) { 162 case 'content-type': 163 164 if ( str_contains( $content, ';' ) ) { 165 list( $type ) = explode( ';', $content ); 166 $data['content-type'] = trim( $type ); 167 } elseif ( '' !== trim( $content ) ) { 168 $data['content-type'] = trim( $content ); 169 } 170 break; 171 172 case 'from': 173 $bracket_pos = strpos( $content, '<' ); 174 if ( false !== $bracket_pos ) { 175 // Text before the bracketed email is the "From" name. 176 if ( $bracket_pos > 0 ) { 177 $from_name = substr( $content, 0, $bracket_pos ); 178 $from_name = str_replace( '"', '', $from_name ); 179 $from_name = trim( $from_name ); 180 $data['fromname'] = $from_name; 181 } 182 183 $from_email = substr( $content, $bracket_pos + 1 ); 184 $from_email = str_replace( '>', '', $from_email ); 185 $from_email = trim( $from_email ); 186 $data['from'] = $from_email; 187 188 } elseif ( '' !== trim( $content ) ) { 189 $from_email = trim( $content ); 190 $data['from'] = $from_email; 191 } 192 193 break; 194 195 case 'cc': 196 $data['cc'] = array_merge( (array) $data['cc'], explode( ',', $content ) ); 197 break; 198 case 'bcc': 199 $data['bcc'] = array_merge( (array) $data['bcc'], explode( ',', $content ) ); 200 break; 201 case 'reply-to': 202 $data['reply-to'] = array_merge( (array) $data['reply-to'], explode( ',', $content ) ); 203 break; 161 204 } 162 205 … … 164 207 } 165 208 166 return $ content_type;167 168 } 209 return $data; 210 211 } -
turbosmtp/trunk/includes/class-turbosmtp.php
r3254918 r3255467 155 155 $this->get_version() 156 156 ); 157 158 $prefix = is_network_admin() ? 'network_admin_' : ''; 159 $this->loader->add_filter("{$prefix}plugin_action_links_" . plugin_basename(TURBOSMTP_BASE_PATH), $plugin_admin, 'settings_link', 10, 2); 157 160 158 161 $this->loader->add_action( 'admin_enqueue_scripts', $plugin_admin, 'enqueue_styles' ); … … 201 204 if ( turbosmtp_validapi() ) { 202 205 $this->loader->add_action('pre_wp_mail', $plugin_public, 'maybe_send_via_http', 10, 2 ); 203 $this->loader->add_action( 'phpmailer_init', $plugin_public,' phpmailer_init' );206 $this->loader->add_action( 'phpmailer_init', $plugin_public,'maybe_send_via_phpmailer' ); 204 207 } 205 208 -
turbosmtp/trunk/public/class-turbosmtp-public.php
r3254918 r3255467 70 70 */ 71 71 72 function phpmailer_init(72 function maybe_send_via_phpmailer( 73 73 $phpmailer 74 74 ) { … … 84 84 } 85 85 86 $from = $phpmailer->From ?: $send_options['from']; 87 $fromname = $phpmailer->FromName ?: $send_options['fromname']; 88 86 89 $phpmailer->isSMTP(); 87 $phpmailer->setFrom( $ send_options["from"], $send_options["fromname"]);90 $phpmailer->setFrom( $from, $fromname ); 88 91 $phpmailer->Host = $send_options["host"]; 89 92 $phpmailer->SMTPAuth = 'yes'; … … 105 108 } 106 109 107 $ content_type = turbosmtp_get_header_content_type(110 $data = turbosmtp_get_headers_data( 108 111 $atts['headers'] 109 112 ); 110 113 114 $content_type = $data['content-type']; 115 $from = $data['from'] ?: $send_options['from']; 116 $fromname = $data['fromname'] ?: $send_options['fromname']; 117 111 118 $mail_atts = [ 112 119 'to' => $atts['to'], 113 'from' => $ send_options['from'],114 'fromname' => $ send_options['fromname'],120 'from' => $from, 121 'fromname' => $fromname, 115 122 'subject' => $atts['subject'], 116 123 'message' => $atts['message'], … … 149 156 public function turbosmtp_api_response( $response, $args ) { 150 157 $code = (int) $args['code']; 151 if ( $code === 401 && apply_filters( 'turbosmtp_disconnect_if_api_response_401', true) ) {158 if ( $code === 401 && apply_filters( 'turbosmtp_disconnect_if_api_response_401', true ) ) { 152 159 $auth_options = get_option( "ts_auth_options" ); 153 160 $auth_options['valid_api'] = false; -
turbosmtp/trunk/turbosmtp.php
r3254918 r3255467 17 17 * Plugin URI: https://www.serversmtp.com/en/smtp-wordpress-configure 18 18 * Description: Easily send emails from your WordPress blog using turboSMTP's services 19 * Version: 4.9. 019 * Version: 4.9.1 20 20 * Author: dueclic 21 21 * Author URI: https://www.dueclic.com/ … … 38 38 * Rename this for your plugin and update it as you release new versions. 39 39 */ 40 define( 'TURBOSMTP_VERSION', '4.9. 0' );40 define( 'TURBOSMTP_VERSION', '4.9.1' ); 41 41 define( 'TURBOSMTP_BASE_PATH', __FILE__ ); 42 42
Note: See TracChangeset
for help on using the changeset viewer.
