Completed
Push — master ( 66da2f...381ab5 )
by Sudar
27:41
created

email-log.php (1 issue)

Labels
Severity

Upgrade to new PHP Analysis Engine

These results are based on our legacy PHP analysis, consider migrating to our new PHP analysis engine instead. Learn more

1
<?php
2
/**
3
 * Plugin Name: Email Log
4
 * Plugin URI: http://sudarmuthu.com/wordpress/email-log
5
 * Description: Logs every email sent through WordPress
6
 * Donate Link: http://sudarmuthu.com/if-you-wanna-thank-me
7
 * Author: Sudar
8
 * Version: 1.9.1
9
 * Author URI: http://sudarmuthu.com/
10
 * Text Domain: email-log
11
 * Domain Path: languages/
12
 * === RELEASE NOTES ===
13
 * Check readme file for full release notes
14
 */
15
16
/**
17
 * Copyright 2009  Sudar Muthu  (email : [email protected])
18
 * This program is free software; you can redistribute it and/or modify
19
 * it under the terms of the GNU General Public License, version 2, as
20
 * published by the Free Software Foundation.
21
 * This program is distributed in the hope that it will be useful,
22
 * but WITHOUT ANY WARRANTY; without even the implied warranty of
23
 * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
24
 * GNU General Public License for more details.
25
 * You should have received a copy of the GNU General Public License
26
 * along with this program; if not, write to the Free Software
27
 * Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA  02110-1301  USA
28
 */
29
30
defined( 'ABSPATH' ) || exit; // Exit if accessed directly
31
32
if ( version_compare( PHP_VERSION, '5.3.0', '<' ) ) {
33
	/**
34
	 * v2.0 of the Email Log plugin dropped support for PHP 5.2.
35
	 * If you are still struck with PHP 5.2 and can't update, then use v1.9.1 of the plugin.
36
	 * But note that some add-ons may not work.
37
	 *
38
	 * @see   http://sudarmuthu.com/blog/why-i-am-dropping-support-for-php-5-2-in-my-wordpress-plugins/
39
	 *
40
	 * @since 2.0
41
	 */
42
	function email_log_compatibility_notice() {
43
		?>
44
		<div class="error">
45
			<p>
46
				<?php __( 'Email Log requires at least PHP 5.3 to function properly. Please upgrade PHP or use v1.9.1 of Email Log', 'email-log' ); ?>
47
			</p>
48
		</div>
49
		<?php
50
	}
51
52
	add_action( 'admin_notices', 'email_log_compatibility_notice' );
53
54
	/**
55
	 * Deactivate Email Log.
56
	 *
57
	 * @since 2.0
58
	 */
59
	function email_log_deactivate() {
60
		deactivate_plugins( plugin_basename( __FILE__ ) );
61
	}
62
63
	add_action( 'admin_init', 'email_log_deactivate' );
64
65
	return;
66
}
67
68
global $email_log;
69
$plugin_dir = plugin_dir_path( __FILE__ );
70
71
// setup autoloader.
72
require_once 'include/EmailLogAutoloader.php';
73
74
$loader = new \EmailLog\EmailLogAutoloader();
75
$loader->add_namespace( 'EmailLog', $plugin_dir . 'include' );
76
77
if ( file_exists( $plugin_dir . 'tests/' ) ) {
78
	// if tests are present, then add them.
79
	$loader->add_namespace( 'EmailLog', $plugin_dir . 'tests/wp-tests' );
80
}
81
82
$loader->add_file( $plugin_dir . 'include/Util/helper.php' );
83
84
$loader->register();
85
86
$email_log                       = new \EmailLog\Core\EmailLog( __FILE__ );
87
$email_log->table_manager        = new \EmailLog\Core\DB\TableManager();
88
$email_log->logger               = new \EmailLog\Core\EmailLogger();
89
$email_log->plugin_list_enhancer = new \EmailLog\Core\UI\PluginListEnhancer( __FILE__ );
0 ignored issues
show
The property plugin_list_enhancer does not seem to exist in EmailLog\Core\EmailLog.

An attempt at access to an undefined property has been detected. This may either be a typographical error or the property has been renamed but there are still references to its old name.

If you really want to allow access to undefined properties, you can define magic methods to allow access. See the php core documentation on Overloading.

Loading history...
90
91
// `register_activation_hook` can't be called from inside any hook.
92
register_activation_hook( __FILE__, array( $email_log->table_manager, 'on_activate' ) );
93
94
// Load the plugin
95
add_action( 'wp_loaded', array( $email_log, 'load' ) );
96
97
/**
98
 * Return the global instance of Email Log plugin.
99
 * Eventually the EmailLog class might become singleton.
100
 *
101
 * @since 2.0
102
 *
103
 * @global EmailLog $email_log
104
 * @return \EmailLog\Core\EmailLog
105
 */
106
function email_log() {
107 2
	global $email_log;
108
109 2
	return $email_log;
110
}
111