Skip to content

Commit e22aa65

Browse files
committed
version 2.0.6 released
1 parent 1d6126c commit e22aa65

14 files changed

+323
-292
lines changed

README.txt

Lines changed: 8 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -3,8 +3,8 @@ Contributors: codeboxr, manchumahara
33
Tags: wordpress smtp,wordpress email log,smtp
44
Requires at least: 5.3
55
Requires PHP: 8.2
6-
Tested up to: 6.7.1
7-
Stable tag: 2.0.5
6+
Tested up to: 6.7.2
7+
Stable tag: 2.0.6
88
License: GPLv2 or later
99
License URI: http://www.gnu.org/licenses/gpl-2.0.html
1010

@@ -117,6 +117,12 @@ e.g.
117117

118118

119119
== Changelog ==
120+
= 2.0.6 =
121+
* [updated] Miscellaneous changes and improvement(+ Some methods moved to helper class)
122+
* [new] Pro addon V1.0.4 released
123+
* [updated] WordPress Core V6.7.2 compatible
124+
* [updated] Language file is now loaded using 'init' hook
125+
120126
= 2.0.5 =
121127
* [updated] Miscellaneous changes and improvement
122128
* [new] Pro addon V1.0.3 released (Mail api support added)

assets/css/comfortsmtp-admin.css

Lines changed: 1 addition & 1 deletion
Some generated files are not rendered by default. Learn more about customizing how changed files appear on GitHub.

assets/css/comfortsmtp-builder.css

Lines changed: 1 addition & 1 deletion
Some generated files are not rendered by default. Learn more about customizing how changed files appear on GitHub.

assets/css/comfortsmtp-settings.css

Lines changed: 1 addition & 1 deletion
Some generated files are not rendered by default. Learn more about customizing how changed files appear on GitHub.

assets/icons/icon_help.svg

Lines changed: 1 addition & 0 deletions
Loading

assets/icons/icon_help_white.svg

Lines changed: 1 addition & 0 deletions
Loading

cbxwpemaillogger.php

Lines changed: 6 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -16,7 +16,7 @@
1616
* Plugin Name: Comfort Email SMTP, Logger & Email Api
1717
* Plugin URI: https://codeboxr.com/product/cbx-email-logger-for-wordpress/
1818
* Description: Various SMTP protocol, Logs email, tracks sent or failed status and more.
19-
* Version: 2.0.5
19+
* Version: 2.0.6
2020
* Requires at least: 5.3
2121
* Requires PHP: 8.2
2222
* Author: Codeboxr
@@ -35,7 +35,7 @@
3535
}
3636

3737
defined( 'COMFORTSMTP_PLUGIN_NAME' ) or define( 'COMFORTSMTP_PLUGIN_NAME', 'cbxwpemaillogger' );
38-
defined( 'COMFORTSMTP_PLUGIN_VERSION' ) or define( 'COMFORTSMTP_PLUGIN_VERSION', '2.0.5' );
38+
defined( 'COMFORTSMTP_PLUGIN_VERSION' ) or define( 'COMFORTSMTP_PLUGIN_VERSION', '2.0.6' );
3939
defined( 'COMFORTSMTP_BASE_NAME' ) or define( 'COMFORTSMTP_BASE_NAME', plugin_basename( __FILE__ ) );
4040
defined( 'COMFORTSMTP_ROOT_PATH' ) or define( 'COMFORTSMTP_ROOT_PATH', plugin_dir_path( __FILE__ ) );
4141
defined( 'COMFORTSMTP_ROOT_URL' ) or define( 'COMFORTSMTP_ROOT_URL', plugin_dir_url( __FILE__ ) );
@@ -99,7 +99,7 @@ function activate_comfortsmtp() {
9999

100100
ComfortSmtpHelpers::load_orm();
101101

102-
ComfortSmtp::activate();
102+
ComfortSmtpHelpers::activate();
103103
}//end function activate_comfortsmtp
104104

105105
register_activation_hook( __FILE__, 'activate_comfortsmtp' );
@@ -109,7 +109,7 @@ function activate_comfortsmtp() {
109109
* The code that runs during plugin deactivation.
110110
*/
111111
function deactivate_comfortsmtp() {
112-
ComfortSmtp::deactivate();
112+
ComfortSmtpHelpers::deactivate();
113113
}//end function deactivate_comfortsmtp
114114

115115
register_deactivation_hook( __FILE__, 'deactivate_comfortsmtp' );
@@ -120,14 +120,14 @@ function deactivate_comfortsmtp() {
120120
*
121121
* @since 1.0
122122
*/
123-
function comfortsmtp() { // phpcs:ignore WordPress.NamingConventions.ValidFunctionName.FunctionNameInvalid
123+
function comfortsmtp_core() { // phpcs:ignore WordPress.NamingConventions.ValidFunctionName.FunctionNameInvalid
124124
global $comfortsmtp_core;
125125
if ( ! isset( $comfortsmtp_core ) ) {
126126
$comfortsmtp_core = run_comfortsmtp_core();
127127
}
128128

129129
return $comfortsmtp_core;
130-
}//end method comfortsmtp
130+
}//end method comfortsmtp_core
131131

132132
/**
133133
* Begins execution of the plugin.

includes/ComfortSmtp.php

Lines changed: 17 additions & 122 deletions
Original file line numberDiff line numberDiff line change
@@ -80,145 +80,40 @@ public function __set( string $key, $value ) {
8080
}//end magic mathod set
8181

8282
/**
83-
* Include necessary files
83+
* Cloning is forbidden.
8484
*
85-
* @return void
86-
*/
87-
private function include_files() {
88-
require_once __DIR__ . '/../lib/autoload.php';
89-
// include_once __DIR__ . '/ComfortSmtpEmails.php';
90-
}//end method include_files
91-
92-
/**
93-
* On plugin activate
85+
* @since 2.0.5
9486
*/
95-
public static function activate() {
96-
//set the current version
97-
update_option('comfortsmtp_version', COMFORTSMTP_PLUGIN_VERSION);
98-
99-
100-
( new self() )->migration_and_defaults();
101-
102-
( new self() )->create_cron_job();
103-
//clear old plugin's event hook
104-
//wp_clear_scheduled_hook( 'cbxwpemaillogger_daily_event' );
105-
set_transient('comfortsmtp_upgraded_notice', 1);
106-
}//end method activate
87+
public function __clone() {
88+
cbxmcratingreview_doing_it_wrong( __FUNCTION__, esc_html__( 'Cloning is forbidden.', 'cbxwpemaillogger' ), '2.0.5' );
89+
}//end method clone
10790

10891
/**
109-
* On plugin deactivate
110-
*/
111-
public static function deactivate() {
112-
wp_clear_scheduled_hook( 'cbxwpemaillogger_daily_event' );
113-
}//end method activate
114-
115-
/**
116-
* On plugin active or reset data set default data for this plugin
92+
* Unserializing instances of this class is forbidden.
11793
*
118-
* @since 1.0.0
94+
* @since 2.0.5
11995
*/
120-
public function default_data_set() {
121-
// create base/main upload directories
122-
$this->create_base_upload_directories();
123-
124-
// add role and custom capability
125-
$this->defaultRoleCapability();
126-
}//end method default_data_set
96+
public function __wakeup() {
97+
cbxmcratingreview_doing_it_wrong( __FUNCTION__, esc_html__( 'Unserializing instances of this class is forbidden.', 'cbxwpemaillogger' ), '2.0.5' );
98+
}//end method wakeup
12799

128100
/**
129-
* create base/main upload directories
130-
*/
131-
public function create_base_upload_directories() {
132-
ComfortSmtpHelpers::checkUploadDir();
133-
}//end method create_base_upload_directories
134-
135-
/**
136-
* create cron job
137-
*/
138-
public function create_cron_job() {
139-
$settings = new ComfortSmtpSettings();
140-
141-
$delete_old_log = $settings->get_option( 'delete_old_log', 'comfortsmtp_log', 'no' );
142-
143-
if ( $delete_old_log == 'yes' ) {
144-
if ( ! wp_next_scheduled( 'cbxwpemaillogger_daily_event' ) ) {
145-
wp_schedule_event( time(), 'daily', 'cbxwpemaillogger_daily_event' );
146-
}
147-
}
148-
}//end method create_cron_job
149-
150-
/**
151-
* On plugin activate
101+
* Include necessary files
102+
*
103+
* @return void
152104
*/
153-
public static function migration_and_defaults() {
105+
private function include_files() {
106+
require_once __DIR__ . '/../lib/autoload.php';
107+
// include_once __DIR__ . '/ComfortSmtpEmails.php';
108+
}//end method include_files
154109

155-
MigrationManage::run();
156110

157-
//set default data
158-
( new self() )->default_data_set();
159111

160-
//ComfortSmtpHelpers::upload_folder();
161112

162-
MigrationManage::migrate_old_options();
163-
}//end method activate
164113

165-
/**
166-
* Create default role and capability on plugin activation and rest
167-
*
168-
* @since 1.0.0
169-
*/
170-
private function defaultRoleCapability() {
171-
//smtp capabilities list
172-
$caps = comfortsmtp_all_caps();
173114

174-
//add the caps to the administrator role
175-
$role = get_role( 'administrator' );
176115

177-
foreach ( $caps as $cap ) {
178-
//add cap to the role
179-
if ( ! $role->has_cap( $cap ) ) {
180-
// add a custom capability
181-
$role->add_cap( $cap, true );
182116

183-
}
184117

185-
//update the same cap for the current user who is installing or updating if logged in
186-
$this->update_user_capability($cap);
187-
}
188-
}//end method defaultRoleCapability
189118

190-
/**
191-
* Add any capability to the current user
192-
*
193-
* @param $capability_to_add
194-
*
195-
* @return void
196-
*/
197-
private function update_user_capability( $capability_to_add ) {
198-
// Check if a user is logged in.
199-
if ( is_user_logged_in() ) {
200-
// Get the current user object.
201-
$user = wp_get_current_user();
202-
203-
// Check if the user already has the capability.
204-
if ( ! $user->has_cap( $capability_to_add ) ) {
205-
// Add the capability.
206-
$user->add_cap( $capability_to_add );
207-
208-
// Optional: Log the capability addition (for debugging or auditing).
209-
//error_log( 'Added capability "' . $capability_to_add . '" to user: ' . $user->user_login );
210-
211-
// Optional: Force a refresh of the user's capabilities (sometimes needed).
212-
wp_cache_delete( $user->ID, 'users' );
213-
wp_cache_delete( 'user_meta', $user->ID );
214-
215-
} else {
216-
// Optional: Log that the user already has the capability.
217-
//error_log( 'User: ' . $user->user_login . ' already has capability: ' . $capability_to_add );
218-
}
219-
} else {
220-
// Optional: Handle the case where no user is logged in.
221-
//error_log( 'No user is logged in.' );
222-
}
223-
}//end method update_user_capability
224119
}//end class ComfortSmtp

includes/ComfortSmtpAdmin.php

Lines changed: 34 additions & 40 deletions
Original file line numberDiff line numberDiff line change
@@ -499,6 +499,7 @@ public function insert_log( $atts ) {
499499

500500
$to = $atts['to'];
501501
if ( ! is_array( $to ) ) {
502+
if(is_null($to)) $to = '';
502503
$to = explode( ',', $to );
503504
}
504505

@@ -1031,7 +1032,7 @@ public function plugin_upgrader_process_complete() {
10311032
ComfortSmtpHelpers::load_orm();
10321033

10331034
// Run the upgrade routine
1034-
comfortsmtp()->migration_and_defaults();
1035+
ComfortSmtpHelpers::migration_and_defaults();
10351036

10361037
// Update the saved version
10371038
update_option( 'comfortsmtp_version', COMFORTSMTP_PLUGIN_VERSION );
@@ -1046,36 +1047,35 @@ public function plugin_upgrader_process_complete() {
10461047
public function plugin_activate_upgrade_notices() {
10471048
$activation_notice_shown = false;
10481049

1050+
1051+
$kiss_html_arr = [
1052+
'strong' => [],
1053+
'a' => [
1054+
'href' => [],
1055+
'class' => []
1056+
]
1057+
];
1058+
10491059
// Check the transient to see if we've just activated the plugin
10501060
if ( get_transient( 'comfortsmtp_activated_notice' ) ) {
10511061
echo '<div class="notice notice-success is-dismissible" style="border-color: #6648fe !important;">';
10521062

1063+
echo '<p>';
1064+
10531065
//phpcs:ignore PluginCheck.CodeAnalysis.ImageFunctions.NonEnqueuedImage
1054-
echo '<p><img alt="icon" style="float: left; display: inline-block; margin-right: 20px;" src="' . esc_url( plugins_url( 'assets/images/icon_c_48.png',
1055-
dirname( __FILE__ ) ) ) . '"/>';
1056-
1057-
/* translators: 1: plugin version 2. team url */
1058-
echo wp_kses( sprintf( __( 'Thanks for installing/deactivating <strong>CBX Email SMTP & Logger</strong> V%1$s - <a href="%2$s" target="_blank">Codeboxr Team</a>',
1059-
'cbxwpemaillogger' ), esc_attr( COMFORTSMTP_PLUGIN_VERSION ), 'https://codeboxr.com' ), [
1060-
'strong' => [],
1061-
'a' => [
1062-
'href' => [],
1063-
'class' => []
1064-
]
1065-
] );
1066+
echo '<img alt="icon" style="float: left; display: inline-block; margin-right: 20px;" src="' . esc_url( plugins_url( 'assets/images/icon_c_48.png',
1067+
dirname( __FILE__ ) ) ) . '" />';
1068+
1069+
/* translators: 1: plugin version 2. codeboxr website url */
1070+
echo sprintf(wp_kses(__( 'Thanks for installing/deactivating <strong>CBX Email SMTP & Logger</strong> V%1$s - <a href="%2$s" target="_blank">Codeboxr Team</a>',
1071+
'cbxwpemaillogger' ), $kiss_html_arr), esc_attr( COMFORTSMTP_PLUGIN_VERSION ), 'https://codeboxr.com');
10661072

10671073
echo '</p>';
10681074

10691075
/* translators: 1: Settings url 2. plugin url */
1070-
echo '<p>' . wp_kses( sprintf( __( 'Check Plugin <a href="%1$s">Setting</a> and <a href="%2$s" target="_blank"><span class="dashicons dashicons-external"></span> Documentation</a>',
1071-
'cbxwpemaillogger' ), esc_attr( admin_url( 'admin.php?page=comfortsmtp_settings' ) ),
1072-
'https://codeboxr.com/product/cbx-email-logger-for-wordpress/' ), [
1073-
'strong' => [],
1074-
'a' => [
1075-
'href' => [],
1076-
'span' => []
1077-
]
1078-
] ) . '</p>';
1076+
echo '<p>' . sprintf( wp_kses(__( 'Check Plugin <a href="%1$s">Setting</a> and <a href="%2$s" target="_blank"><span class="dashicons dashicons-external"></span> Documentation</a>',
1077+
'cbxwpemaillogger' ), $kiss_html_arr), esc_attr( admin_url( 'admin.php?page=comfortsmtp_settings' ) ),
1078+
'https://codeboxr.com/product/cbx-email-logger-for-wordpress/' ) . '</p>';
10791079
echo '</div>';
10801080

10811081

@@ -1092,33 +1092,27 @@ public function plugin_activate_upgrade_notices() {
10921092
if(!$activation_notice_shown){
10931093
echo '<div class="notice notice-success is-dismissible" style="border-color: #6648fe !important;">';
10941094

1095+
echo '<p>';
1096+
10951097
//phpcs:ignore PluginCheck.CodeAnalysis.ImageFunctions.NonEnqueuedImage
1096-
echo '<p><img alt="icon" style="float: left; display: inline-block; margin-right: 20px;" src="' . esc_url( plugins_url( 'assets/images/icon_c_48.png',
1098+
echo '<img alt="icon" style="float: left; display: inline-block; margin-right: 20px;" src="' . esc_url( plugins_url( 'assets/images/icon_c_48.png',
10971099
dirname( __FILE__ ) ) ) . '"/>';
10981100

10991101
/* translators: 1: plugin version 2. team url */
1100-
echo wp_kses( sprintf( __( 'Thanks for upgrading <strong>CBX Email SMTP & Logger</strong> V%1$s - <a href="%2$s" target="_blank">Codeboxr Team</a>',
1101-
'cbxwpemaillogger' ), esc_attr( COMFORTSMTP_PLUGIN_VERSION ), 'https://codeboxr.com' ), [
1102-
'strong' => [],
1103-
'a' => [
1104-
'href' => [],
1105-
'class' => []
1106-
]
1107-
] );
1102+
echo sprintf(wp_kses(__( 'Thanks for upgrading <strong>CBX Email SMTP & Logger</strong> V%1$s - <a href="%2$s" target="_blank">Codeboxr Team</a>',
1103+
'cbxwpemaillogger' ), $kiss_html_arr), esc_attr( COMFORTSMTP_PLUGIN_VERSION ), 'https://codeboxr.com' ) ;
11081104

11091105
echo '</p>';
11101106

11111107

1108+
echo '<p>';
1109+
11121110
/* translators: 1: Settings url 2. plugin url */
1113-
echo '<p>' . wp_kses( sprintf( __( 'Check Plugin <a href="%1$s">Setting</a> and <a href="%2$s" target="_blank"><span class="dashicons dashicons-external"></span> Documentation</a>',
1114-
'cbxwpemaillogger' ), esc_attr( admin_url( 'admin.php?page=comfortsmtp_settings' ) ),
1115-
'https://codeboxr.com/product/cbx-email-logger-for-wordpress/' ), [
1116-
'strong' => [],
1117-
'a' => [
1118-
'href' => [],
1119-
'span' => []
1120-
]
1121-
] ) . '</p>';
1111+
echo sprintf(wp_kses( __( 'Check Plugin <a href="%1$s">Setting</a> and <a href="%2$s" target="_blank"><span class="dashicons dashicons-external"></span> Documentation</a>',
1112+
'cbxwpemaillogger' ), $kiss_html_arr), esc_attr( admin_url( 'admin.php?page=comfortsmtp_settings' ) ),
1113+
'https://codeboxr.com/product/cbx-email-logger-for-wordpress/' );
1114+
1115+
echo '</p>';
11221116

11231117
echo '</div>';
11241118

includes/ComfortSmtpHooks.php

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -31,7 +31,8 @@ private function define_common_hooks() {
3131
$route = $this->api_routes;
3232
$helper = new ComfortSmtpHelpers();
3333

34-
add_action( 'plugins_loaded', [ $this, 'load_plugin_textdomain' ] );
34+
//add_action( 'plugins_loaded', [ $this, 'load_plugin_textdomain' ] );
35+
add_action( 'init', [ $this, 'load_plugin_textdomain' ] );
3536
add_filter( 'script_loader_tag', [ $this, 'add_module_to_script' ], 10, 3 );
3637

3738
add_action( 'rest_api_init', [ $route, 'init' ] );

0 commit comments

Comments
 (0)