PluginProbe ʕ •ᴥ•ʔ
Check & Log Email – Easy Email Testing & Mail logging / 2.0.9
Check & Log Email – Easy Email Testing & Mail logging v2.0.9
1.0.4 1.0.5 1.0.6 1.0.7 1.0.8 1.0.9 2.0 2.0.1 2.0.10 2.0.11 2.0.12 2.0.13 2.0.13.1 2.0.13.2 2.0.14 2.0.2 2.0.3 2.0.4 2.0.5 2.0.5.1 2.0.6 2.0.7 2.0.8 2.0.9 trunk 0.5.7 0.6.0 0.6.1 0.6.2 1.0.0 1.0.1 1.0.10 1.0.11 1.0.12 1.0.12.1 1.0.13 1.0.13.1 1.0.2 1.0.3
check-email / check-email.php
check-email Last commit date
assets 9 months ago include 9 months ago languages 9 months ago vendor 9 months ago changelog.txt 9 months ago check-email.php 9 months ago readme.txt 7 months ago uninstall.php 9 months ago
check-email.php
226 lines
1 <?php
2 /*
3 * Plugin Name: Check & Log Email - Easy Email Testing & Mail logging
4 * Description: Check & Log email allows you to test if your WordPress installation is sending emails correctly and logs every email.
5 * Author: checkemail
6 * Version: 2.0.9
7 * Author URI: https://check-email.tech/
8 * Plugin URI: https://check-email.tech/
9 * License: GPLv3 or later
10 * License URI: http://www.gnu.org/licenses/gpl-3.0.html
11 * Requires PHP: 5.6
12 * Text Domain: check-email
13 * Domain Path: /languages
14 *
15 * Copyright 2015-2020 Chris Taylor chris@stillbreathing.co.uk
16 * Copyright 2020 MachoThemes office@machothemes.com
17 * Copyright 2020 WPChill heyyy@wpchill.com
18 * Copyright 2023 WPOmnia contact@wpomnia.com
19 *
20 * NOTE:
21 * Chris Taylor transferred ownership rights on: 2020-06-19 07:52:03 GMT when ownership was handed over to MachoThemes
22 * The MachoThemes ownership period started on: 2020-06-19 07:52:03 GMT
23 * MachoThemes sold the plugin to WPOmnia on: 2023-10-15 15:52:03 GMT
24 *
25 * This program is free software; you can redistribute it and/or modify
26 * it under the terms of the GNU General Public License, version 3, as
27 * published by the Free Software Foundation.
28 *
29 * This program is distributed in the hope that it will be useful,
30 * but WITHOUT ANY WARRANTY; without even the implied warranty of
31 * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
32 * GNU General Public License for more details.
33 *
34 * You should have received a copy of the GNU General Public License
35 * along with this program; if not, write to the Free software
36 * Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA
37 */
38 defined( 'ABSPATH' ) || exit; // Exit if accessed directly.
39
40 define( 'CK_MAIL_TOC_DIR_NAME', plugin_basename( dirname( __FILE__ ) ) );
41 define( 'CK_MAIL_TOC_BASE_NAME', plugin_basename( __FILE__ ) );
42 define( 'CK_MAIL_PATH', dirname( __FILE__ ) );
43 define( 'CK_MAIL_URL', plugin_dir_url( __FILE__ ) );
44 define( 'CK_MAIL_VERSION', '2.0.9' );
45
46 require_once(CK_MAIL_PATH. "/include/helper-function.php" );
47 if ( is_admin() ) {
48 require_once(CK_MAIL_PATH. "/include/class-check-email-newsletter.php" );
49 require_once(CK_MAIL_PATH. "/include/Check_Email_SMTP_Tab.php" );
50 }
51
52
53 if ( version_compare( PHP_VERSION, '5.6.0', '<' ) ) {
54 function check_email_compatibility_notice() {
55 ?>
56 <div class="error">
57 <p>
58 <?php
59 echo esc_html__( 'Check & Log Email requires at least PHP 5.6 to function properly. Please upgrade PHP.', 'check-email' );
60 ?>
61 </p>
62 </div>
63 <?php
64 }
65
66 add_action( 'admin_notices', 'check_email_compatibility_notice' );
67
68
69 /**
70 * Deactivate Email Log.
71 */
72 function check_email_deactivate() {
73 deactivate_plugins( plugin_basename( __FILE__ ) );
74 }
75
76 add_action( 'admin_init', 'check_email_deactivate' );
77
78 return;
79 }
80
81 if(!defined('CK_MAIL_PRO_VERSION')){
82 // Register a reusable filter to render the Upgrade banner.
83 add_filter('pro_upgrade_banner', function ($html, $args = []) {
84
85 $args = wp_parse_args($args, [
86 'title' => __('Solve email delivery issues faster with PRO version (50% discount)', 'check-email'),
87 'message' => __('Unlock advanced features like real-time monitoring and detailed analytics.', 'check-email'),
88 'cta_text' => __('Upgrade Now', 'check-email'),
89 'cta_url' => 'https://check-email.tech/pricing/#pricings',
90 'icon' => '🎉',
91 'style' => 'yellow',
92 'class' => '',
93 'dismissible' => false, // true/false
94 'dismiss_key' => 'my_ck', // unique key if dismissible (stored in localStorage)
95 ]);
96 ob_start();
97
98 $classes = 'celog-banner celog-banner--' . esc_attr($args['style']) . ' ' . esc_attr($args['class']);
99
100 echo '<div class="celog-header">
101 <div class="' . $classes . '">
102 <div class="celog-banner__icon">' . esc_html($args['icon']) . '</div>
103 <div class="celog-banner__body">
104 <div class="celog-banner__title">' . esc_html($args['title']) . '</div>
105 <a href="' . esc_url($args['cta_url']) . '" target="_blank" class="check-mail-premium-btn" style="background:#f57429; border-color:#f57429">' . esc_html($args['cta_text']) . '</a>
106 </div>';
107 echo '</div>';
108 if ($args['dismissible']) {
109 echo '<button type="button" class="celog-banner__close" aria-label="' . esc_attr__('Dismiss', 'check-email') . '">×</button>';
110 }
111 echo '</div>';
112 if ($args['dismissible'] && $args['dismiss_key']) {
113 echo '<script>
114 (function(){
115 try {
116 var key = "celog_dismiss_" + ' . json_encode($args['dismiss_key']) . ';
117 var box = document.querySelector("[data-dismiss-key=\'' . esc_attr($args['dismiss_key']) . '\']");
118 if (localStorage.getItem(key)) { box.style.display="none"; return; }
119 var btn = box.querySelector(".celog-banner__close");
120 if (btn) btn.addEventListener("click", function(){
121 box.remove();
122 localStorage.setItem(key, "1");
123 });
124 } catch(e){}
125 })();
126 </script>';
127 }
128 return ob_get_clean();
129 }, 10, 2);
130
131 }
132
133
134
135
136
137 /**
138 * Load Check Email Log.
139 */
140 function check_email_log( $plugin_file ) {
141 global $check_email;
142
143 $plugin_dir = plugin_dir_path( $plugin_file );
144
145 // setup autoloader.
146 require_once 'include/class-check-email-log-autoloader.php';
147
148 $loader = new \CheckEmail\Check_Email_Log_Autoloader();
149 $loader->add_namespace( 'CheckEmail', $plugin_dir . 'include' );
150
151 if ( file_exists( $plugin_dir . 'tests/' ) ) {
152 // if tests are present, then add them.
153 $loader->add_namespace( 'CheckEmail', $plugin_dir . 'tests/wp-tests' );
154 }
155
156 $loader->add_file( $plugin_dir . 'include/Util/helper.php' );
157
158 $loader->register();
159
160 $check_email = new \CheckEmail\Core\Check_Email_Log( $plugin_file, $loader, new \CheckEmail\Core\DB\Check_Email_Table_Manager() );
161
162 $check_email->add_loadie( new \CheckEmail\Core\Check_Email_Multisite() );
163 $check_email->add_loadie( new \CheckEmail\Check_Email_Encode_Tab() );
164 $check_email->add_loadie( new \CheckEmail\Check_Email_Notify_Tab() );
165 $check_email->add_loadie( new \CheckEmail\Core\Check_Email_Logger() );
166 $check_email->add_loadie( new \CheckEmail\Core\Check_Email_Review() );
167 $check_email->add_loadie( new \CheckEmail\Core\Check_Email_Export_Log() );
168 $check_email->add_loadie( new \CheckEmail\Core\UI\Check_Email_UI_Loader() );
169
170 $check_email->add_loadie( new \CheckEmail\Core\Request\Check_Email_Nonce_Checker() );
171 $check_email->add_loadie( new \CheckEmail\Core\Request\Check_Email_Log_List_Action() );
172
173 $capability_giver = new \CheckEmail\Core\Check_Email_Admin_Capability_Giver();
174 $check_email->add_loadie( $capability_giver );
175 $capability_giver->add_cap_to_admin();
176
177 $check_email->add_loadie( new \CheckEmail\Core\Check_Email_From_Handler() );
178
179 // `register_activation_hook` can't be called from inside any hook.
180 register_activation_hook( $plugin_file, array( $check_email->table_manager, 'on_activate' ) );
181
182 // Ideally the plugin should be loaded in a later event like `init` or `wp_loaded`.
183 // But some plugins like EDD are sending emails in `init` event itself,
184 // which won't be logged if the plugin is loaded in `wp_loaded` or `init`.
185 add_action( 'plugins_loaded', array( $check_email, 'load' ), 101 );
186 }
187
188 function wpchill_check_email() {
189 global $check_email;
190 return $check_email;
191 }
192
193 check_email_log( __FILE__ );
194
195
196 /**
197 * Add settings link to plugin actions
198 *
199 * @param array $plugin_actions
200 * @param string $plugin_file
201 * @since 1.0.11
202 * @return array
203 */
204 function check_email_add_plugin_link( $links ) {
205
206 $url = add_query_arg( 'page', 'check-email-settings', self_admin_url( 'admin.php' ) );
207 $setting_link = '<a href="' . esc_url( $url ) . '">' . __( 'Settings', 'check-email' ) . '</a> |';
208 $setting_link .= '<a href="https://check-email.tech/contact/" target="_blank">' . __( ' Support', 'check-email' ) . '</a>';
209 array_push( $links, $setting_link );
210 return $links;
211 }
212 add_filter( 'plugin_action_links_'.plugin_basename(__FILE__), 'check_email_add_plugin_link', 10, 2 );
213
214 function checkMail_is_plugins_page() {
215
216 if(function_exists('get_current_screen')){
217 $screen = get_current_screen();
218 if(is_object($screen)){
219 if($screen->id == 'plugins' || $screen->id == 'plugins-network'){
220 return true;
221 }
222 }
223 }
224 return false;
225 }
226