-
Notifications
You must be signed in to change notification settings - Fork 3
/
Copy pathcheck-email.php
166 lines (137 loc) · 5.87 KB
/
check-email.php
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
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
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
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
148
149
150
151
152
153
154
155
156
157
158
159
160
161
162
163
164
165
166
<?php
/*
* Plugin Name: Check & Log Email - Easy Email Testing & Mail logging
* Description: Check & Log email allows you to test if your WordPress installation is sending emails correctly and logs every email.
* Author: checkemail
* Version: 2.0.4
* Author URI: https://check-email.tech/
* License: GPLv3 or later
* License URI: http://www.gnu.org/licenses/gpl-3.0.html
* Requires PHP: 5.6
* Text Domain: check-email
* Domain Path: /languages
*
* Copyright 2015-2020 Chris Taylor [email protected]
* Copyright 2020 MachoThemes [email protected]
* Copyright 2020 WPChill [email protected]
* Copyright 2023 WPOmnia [email protected]
*
* NOTE:
* Chris Taylor transferred ownership rights on: 2020-06-19 07:52:03 GMT when ownership was handed over to MachoThemes
* The MachoThemes ownership period started on: 2020-06-19 07:52:03 GMT
* MachoThemes sold the plugin to WPOmnia on: 2023-10-15 15:52:03 GMT
*
* This program is free software; you can redistribute it and/or modify
* it under the terms of the GNU General Public License, version 3, as
* published by the Free Software Foundation.
*
* This program is distributed in the hope that it will be useful,
* but WITHOUT ANY WARRANTY; without even the implied warranty of
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
* GNU General Public License for more details.
*
* You should have received a copy of the GNU General Public License
* along with this program; if not, write to the Free software
* Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA
*/
defined( 'ABSPATH' ) || exit; // Exit if accessed directly.
define( 'CK_MAIL_TOC_DIR_NAME', plugin_basename( dirname( __FILE__ ) ) );
define( 'CK_MAIL_TOC_BASE_NAME', plugin_basename( __FILE__ ) );
define( 'CK_MAIL_PATH', dirname( __FILE__ ) );
define( 'CK_MAIL_URL', plugin_dir_url( __FILE__ ) );
define( 'CK_MAIL_VERSION', '2.0.4' );
require_once(CK_MAIL_PATH. "/include/helper-function.php" );
if ( is_admin() ) {
require_once(CK_MAIL_PATH. "/include/class-check-email-newsletter.php" );
require_once(CK_MAIL_PATH. "/include/Check_Email_SMTP_Tab.php" );
}
if ( version_compare( PHP_VERSION, '5.6.0', '<' ) ) {
function check_email_compatibility_notice() {
?>
<div class="error">
<p>
<?php
echo esc_html__( 'Check & Log Email requires at least PHP 5.6 to function properly. Please upgrade PHP.', 'check-email' );
?>
</p>
</div>
<?php
}
add_action( 'admin_notices', 'check_email_compatibility_notice' );
/**
* Deactivate Email Log.
*/
function check_email_deactivate() {
deactivate_plugins( plugin_basename( __FILE__ ) );
}
add_action( 'admin_init', 'check_email_deactivate' );
return;
}
/**
* Load Check Email Log.
*/
function check_email_log( $plugin_file ) {
global $check_email;
$plugin_dir = plugin_dir_path( $plugin_file );
// setup autoloader.
require_once 'include/class-check-email-log-autoloader.php';
$loader = new \CheckEmail\Check_Email_Log_Autoloader();
$loader->add_namespace( 'CheckEmail', $plugin_dir . 'include' );
if ( file_exists( $plugin_dir . 'tests/' ) ) {
// if tests are present, then add them.
$loader->add_namespace( 'CheckEmail', $plugin_dir . 'tests/wp-tests' );
}
$loader->add_file( $plugin_dir . 'include/Util/helper.php' );
$loader->register();
$check_email = new \CheckEmail\Core\Check_Email_Log( $plugin_file, $loader, new \CheckEmail\Core\DB\Check_Email_Table_Manager() );
$check_email->add_loadie( new \CheckEmail\Core\Check_Email_Multisite() );
$check_email->add_loadie( new \CheckEmail\Check_Email_Encode_Tab() );
$check_email->add_loadie( new \CheckEmail\Core\Check_Email_Logger() );
$check_email->add_loadie( new \CheckEmail\Core\Check_Email_Review() );
$check_email->add_loadie( new \CheckEmail\Core\Check_Email_Export_Log() );
$check_email->add_loadie( new \CheckEmail\Core\UI\Check_Email_UI_Loader() );
$check_email->add_loadie( new \CheckEmail\Core\Request\Check_Email_Nonce_Checker() );
$check_email->add_loadie( new \CheckEmail\Core\Request\Check_Email_Log_List_Action() );
$capability_giver = new \CheckEmail\Core\Check_Email_Admin_Capability_Giver();
$check_email->add_loadie( $capability_giver );
$capability_giver->add_cap_to_admin();
$check_email->add_loadie( new \CheckEmail\Core\Check_Email_From_Handler() );
// `register_activation_hook` can't be called from inside any hook.
register_activation_hook( $plugin_file, array( $check_email->table_manager, 'on_activate' ) );
// Ideally the plugin should be loaded in a later event like `init` or `wp_loaded`.
// But some plugins like EDD are sending emails in `init` event itself,
// which won't be logged if the plugin is loaded in `wp_loaded` or `init`.
add_action( 'plugins_loaded', array( $check_email, 'load' ), 101 );
}
function wpchill_check_email() {
global $check_email;
return $check_email;
}
check_email_log( __FILE__ );
/**
* Add settings link to plugin actions
*
* @param array $plugin_actions
* @param string $plugin_file
* @since 1.0.11
* @return array
*/
function check_email_add_plugin_link( $links ) {
$url = add_query_arg( 'page', 'check-email-settings', self_admin_url( 'admin.php' ) );
$setting_link = '<a href="' . esc_url( $url ) . '">' . __( 'Settings', 'check-email' ) . '</a> |';
$setting_link .= '<a href="https://check-email.tech/contact/" target="_blank">' . __( ' Support', 'check-email' ) . '</a>';
array_push( $links, $setting_link );
return $links;
}
add_filter( 'plugin_action_links_'.plugin_basename(__FILE__), 'check_email_add_plugin_link', 10, 2 );
function checkMail_is_plugins_page() {
if(function_exists('get_current_screen')){
$screen = get_current_screen();
if(is_object($screen)){
if($screen->id == 'plugins' || $screen->id == 'plugins-network'){
return true;
}
}
}
return false;
}