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: 167: 168: 169: 170: 171: 172: 173: 174: 175: 176: 177: 178: 179: 180: 181: 182: 183: 184: 185: 186: 187: 188: 189: 190: 191: 192: 193: 194: 195: 196: 197: 198: 199: 200: 201: 202: 203: 204: 205: 206: 207: 208: 209: 210: 211: 212: 213: 214: 215: 216: 217:
<?php
if ( !class_exists('Inbound_Mailer_Plugin') ) {
final class Inbound_Mailer_Plugin {
public static $notices = array();
public function __construct() {
self::define_constants();
self::includes();
self::load_text_domain_init();
}
public static function is_valid_php_version() {
return version_compare( PHP_VERSION, '5.3', '>=' );
}
static function fail_php_version() {
self::notice( __( 'Inbound Email Component requires PHP version 5.3+, plugin is currently NOT ACTIVE.', 'inbound-pro' ) );
}
public static function notice( $message, $is_error = true ) {
if ( defined( 'WP_CLI' ) ) {
$message = strip_tags( $message );
if ( $is_error ) {
WP_CLI::warning( $message );
} else {
WP_CLI::success( $message );
}
} else {
add_action( 'all_admin_notices', array( __CLASS__, 'admin_notices' ) );
self::$notices[] = compact( 'message', 'is_error' );
}
}
public static function admin_notices() {
foreach ( self::$notices as $notice ) {
$class_name = empty( $notice['is_error'] ) ? 'updated' : 'error';
$html_message = sprintf( '<div class="%s">%s</div>', esc_attr( $class_name ), wpautop( $notice['message'] ) );
echo wp_kses_post( $html_message );
}
}
private static function define_constants() {
define('INBOUND_EMAIL_CURRENT_VERSION', '2.2.1' );
define('INBOUND_EMAIL_URLPATH', plugin_dir_url( __FILE__ ) );
define('INBOUND_EMAIL_PATH', plugin_dir_path( __FILE__ ) );
define('INBOUND_EMAIL_SLUG', 'mailer');
define('INBOUND_EMAIL_FILE', __FILE__ );
$uploads = wp_upload_dir();
define('INBOUND_EMAIL_UPLOADS_PATH', $uploads['basedir'].'/inbound-email/templates/' );
define('INBOUND_EMAIL_UPLOADS_URLPATH', $uploads['baseurl'].'/inbound-email/templates/' );
define('INBOUND_EMAIL_THEME_TEMPLATES_PATH' , get_template_directory(). '/emails/' );
define('INBOUND_EMAIL_THEME_TEMPLATES_URLPATH' , get_template_directory_uri(). '/emails/' );
define('INBOUND_EMAIL_STORE_URL', 'http://www.inboundnow.com/market/' );
}
private static function includes() {
switch (is_admin()) :
case true :
include_once('classes/class.activation.database-routines.php');
include_once('classes/class.activation.php');
include_once('classes/class.maintenance-lists.php');
include_once('classes/class.postmeta.php');
include_once('classes/class.post-type.inbound-email.php');
include_once('classes/class.extension.wordpress-seo.php');
include_once('classes/class.metaboxes.inbound-email.php');
include_once('classes/class.token-engine.php');
include_once('classes/class.inbound-forms.php');
include_once('classes/class.menus.php');
include_once('classes/class.ajax.listeners.php');
include_once('classes/class.enqueues.php');
include_once('classes/class.settings.php');
include_once('classes/class.notifications.php');
include_once('classes/class.clone-post.php');
include_once('classes/class.acf-integration.php');
include_once('classes/class.variations.php');
include_once('classes/class.load.email-settings.php');
include_once('classes/class.load.email-templates.php');
include_once('classes/class.templates.list-table.php');
include_once('classes/class.templates.manage.php');
include_once('classes/class.templates.preview.php');
include_once('modules/module.utils.php');
include_once('classes/class.customizer.php');
include_once('classes/class.tracking.php');
include_once('classes/class.statistics.sparkpost.php');
include_once('classes/class.scheduling.php');
include_once('classes/class.mailer.php');
include_once('classes/class.mailer.sparkpost.php');
include_once('classes/class.connector.sparkpost.php');
include_once('classes/class.unsubscribe.php');
include_once('classes/class.lead-profile.php');
BREAK;
case false :
include_once('classes/class.settings.php');
include_once('classes/class.maintenance-lists.php');
include_once('classes/class.postmeta.php');;
include_once('classes/class.load.email-templates.php');
include_once('classes/class.post-type.inbound-email.php');
include_once('classes/class.inbound-forms.php');
include_once('classes/class.extension.wordpress-seo.php');
include_once('classes/class.enqueues.php');
include_once('classes/class.tracking.php');
include_once('classes/class.ajax.listeners.php');
include_once('classes/class.variations.php');
include_once('classes/class.templates.preview.php');
include_once('classes/class.unsubscribe.php');
include_once('classes/class.acf-integration.php');
include_once('modules/module.utils.php');
include_once('classes/class.customizer.php');
include_once('classes/class.token-engine.php');
include_once('classes/class.mailer.php');
include_once('classes/class.mailer.sparkpost.php');
include_once('classes/class.connector.sparkpost.php');
include_once('classes/class.scheduling.php');
include_once('classes/class.statistics.sparkpost.php');
BREAK;
endswitch;
}
private static function load_text_domain_init() {
add_action( 'init' , array( __CLASS__ , 'load_text_domain' ) );
}
public static function load_text_domain() {
load_plugin_textdomain( 'inbound-email' , false , INBOUND_EMAIL_SLUG . '/lang/' );
}
}
if ( Inbound_Mailer_Plugin::is_valid_php_version() ) {
new Inbound_Mailer_Plugin;
} else {
Inbound_Mailer_Plugin::fail_php_version();
}
function mailer_check_active() {
return 1;
}
}