| 1 |
<?php |
| 2 |
/** |
| 3 |
* Plugin Name: YayMail - WooCommerce Email Customizer |
| 4 |
* Plugin URI: https://yaycommerce.com/yaymail-woocommerce-email-customizer/ |
| 5 |
* Description: Create awesome transactional emails with a drag and drop email builder |
| 6 |
* Version: 2.1.5 |
| 7 |
* Author: YayCommerce |
| 8 |
* Author URI: https://yaycommerce.com |
| 9 |
* Text Domain: yaymail |
| 10 |
* WC requires at least: 3.0.0 |
| 11 |
* WC tested up to: 5.5.2 |
| 12 |
* Domain Path: /i18n/languages/ |
| 13 |
*/ |
| 14 |
|
| 15 |
namespace YayMail; |
| 16 |
|
| 17 |
defined( 'ABSPATH' ) || exit; |
| 18 |
define( 'YAYMAIL_PREFIX', 'yaymail' ); |
| 19 |
define( 'YAYMAIL_DEBUG', false ); |
| 20 |
define( 'YAYMAIL_VERSION', '2.1.5' ); |
| 21 |
define( 'YAYMAIL_PLUGIN_URL', plugin_dir_url( __FILE__ ) ); |
| 22 |
define( 'YAYMAIL_PLUGIN_PATH', plugin_dir_path( __FILE__ ) ); |
| 23 |
define( 'YAYMAIL_PLUGIN_BASENAME', plugin_basename( __FILE__ ) ); |
| 24 |
|
| 25 |
spl_autoload_register( |
| 26 |
function ( $class ) { |
| 27 |
$prefix = __NAMESPACE__; |
| 28 |
$base_dir = __DIR__ . '/includes'; |
| 29 |
|
| 30 |
$len = strlen( $prefix ); |
| 31 |
if ( strncmp( $prefix, $class, $len ) !== 0 ) { |
| 32 |
return; |
| 33 |
} |
| 34 |
|
| 35 |
$relative_class_name = substr( $class, $len ); |
| 36 |
|
| 37 |
$file = $base_dir . str_replace( '\\', '/', $relative_class_name ) . '.php'; |
| 38 |
|
| 39 |
if ( file_exists( $file ) ) { |
| 40 |
require $file; |
| 41 |
} |
| 42 |
} |
| 43 |
); |
| 44 |
|
| 45 |
if ( ! function_exists( 'install_yaymail_admin_notice' ) ) { |
| 46 |
function install_yaymail_admin_notice() { |
| 47 |
?> |
| 48 |
<div class="error"> |
| 49 |
<p> |
| 50 |
<?php |
| 51 |
// translators: %s: search WooCommerce plugin link |
| 52 |
printf( 'YayMail ' . esc_html__( 'is enabled but not effective. It requires %1$sWooCommerce%2$s in order to work.', 'yaymail' ), '<a href="' . esc_url( admin_url( 'plugin-install.php?s=woocommerce&tab=search&type=term' ) ) . '">', '</a>' ); |
| 53 |
?> |
| 54 |
</p> |
| 55 |
</div> |
| 56 |
<?php |
| 57 |
} |
| 58 |
} |
| 59 |
|
| 60 |
function init() { |
| 61 |
if ( ! function_exists( 'WC' ) ) { |
| 62 |
add_action( 'admin_notices', 'YayMail\\install_yaymail_admin_notice' ); |
| 63 |
} |
| 64 |
Plugin::getInstance(); |
| 65 |
I18n::getInstance(); |
| 66 |
Page\Settings::getInstance(); |
| 67 |
MailBuilder\WooTemplate::getInstance(); |
| 68 |
MailBuilder\YaymailElement::getInstance(); |
| 69 |
} |
| 70 |
add_action( 'plugins_loaded', 'YayMail\\init' ); |
| 71 |
|
| 72 |
register_activation_hook( __FILE__, array( 'YayMail\\Plugin', 'activate' ) ); |
| 73 |
register_deactivation_hook( __FILE__, array( 'YayMail\\Plugin', 'deactivate' ) ); |
| 74 |
|